Subversion Repositories taios

Compare Revisions

Ignore whitespace Rev 484 → Rev 493

/forums/add-post-do.php
7,13 → 7,12
$page->checkLoggedIn();
 
$parentID = $_POST['parentID'];
if (empty($parentID))
{
if (empty($parentID)) {
$parentID = -1;
}
 
$categoryID = $_POST['categoryID'];
if (empty($categoryID))
{
if (empty($categoryID)) {
$parentID = -1;
}
 
20,21 → 19,20
$title = $_POST['title'];
$content = $_POST['content'];
 
if (!$page->isUserNormal($page->getLoggedInUser()))
{
if (!$page->isUserNormal($page->getLoggedInUser())) {
$page->redirect('add-post.php?error=You do not have permission to access this page');
}
 
if (empty($title))
{
if (empty($title)) {
$page->redirect('add-post.php?error=No Title Specified');
}
if (empty($title))
{
 
if (empty($title)) {
$page->redirect('add-post.php?error=No Content Specified');
}
 
$page->query('INSERT INTO ForumPosts VALUES (0, "' .$page->getLoggedInUser()->ID . '", "' . $categoryID . '", "' . $parentID . '", "' . $title . '", "' . $content . '", NOW(), FALSE)');
$args = array($page->getLoggedInUser()->ID, $categoryID, $parentID, $title, $content);
$page->query("INSERT INTO ForumPosts VALUES (0, ?, ?, ?, ?, ?, NOW(), FALSE)", $args);
$page->redirect('index.php?parentID=' . $categoryID);
 
?>
/forums/delete-category-do.php
8,13 → 8,10
 
$id = $page->getGetID();
 
if ($page->isUserAdmin($page->getLoggedInUser()))
{
$page->query('DELETE FROM ForumCategories WHERE ID = "' . $id . '"');
if ($page->isUserAdmin($page->getLoggedInUser())) {
$page->query("DELETE FROM ForumCategories WHERE ID = ?", array($id));
$page->redirect('index.php');
}
else
{
} else {
$page->drawError('You do not have permission to access this page.');
}
 
/forums/edit-category-do.php
11,20 → 11,16
$title = $_POST['title'];
$description = $_POST['description'];
 
if ($page->isUserAdmin($page->getLoggedInUser()))
{
if (empty($title))
{
if ($page->isUserAdmin($page->getLoggedInUser())) {
if (empty($title)) {
$page->redirect('edit-category.php?error=No Title Specified');
}
$page->query('UPDATE ForumCategories SET Title = "' . $title . '", Description = "' . $description . '" WHERE ID = "' . $id . '"');
$args = array($title, $description, $id);
$page->query("UPDATE ForumCategories SET Title = ?, Description = ? WHERE ID = ?", $args);
$page->redirect('index.php');
}
else
{
} else {
$page->drawError('You do not have permission to access this page.');
}
 
?>
 
/forums/add-category-do.php
7,8 → 7,7
$page->checkLoggedIn();
 
$parentID = $_POST['parentID'];
if (empty($parentID))
{
if (empty($parentID)) {
$parentID = -1;
}
 
15,20 → 14,15
$title = $_POST['title'];
$description = $_POST['description'];
 
if ($page->isUserAdmin($page->getLoggedInUser()))
{
if (empty($title))
{
if ($page->isUserAdmin($page->getLoggedInUser())) {
if (empty($title)) {
$page->redirect('add-category.php?error=No Title Specified');
}
$page->query('INSERT INTO ForumCategories VALUES (0, "' . $parentID . '", "' . $title . '", "' . $description . '")');
$page->query("INSERT INTO ForumCategories VALUES (0, ?, ?, ?)", array($parentID, $title, $description));
$page->redirect('index.php?parentID=' . $parentID);
}
else
{
} else {
$page->drawError('You do not have permission to access this page.');
}
 
?>
 
/forums/delete-post-do.php
9,22 → 9,15
$id = $page->getGetID();
$post = $page->getForumPost($id);
 
if (($page->isUserAdmin($page->getLoggedInUser()) || $post->author->ID == $page->getLoggedInUser()->ID) && $post && $page->isUserNormal($page->getLoggedInUser()))
{
$page->query('DELETE FROM ForumPosts WHERE ID = "' . $id . '"');
if (($page->isUserAdmin($page->getLoggedInUser()) || $post->author->ID == $page->getLoggedInUser()->ID) && $post && $page->isUserNormal($page->getLoggedInUser())) {
$page->query("DELETE FROM ForumPosts WHERE ID = ?", array($id));
$page->redirect('index.php');
}
else
{
if (!$post)
{
} else {
if (!$post) {
$page->drawError('No such forum post, #' . $id);
}
else
{
} else {
$page->drawError('You do not have permission to access this page.');
}
}
 
?>