Subversion Repositories taios

Rev

Rev 484 | Blame | Compare with Previous | Last modification | View Log | RSS feed

<?php

require '../_taios.php';

$page = new Taios_Page('Add Category', '../');

$page->checkLoggedIn();

$parentID = $_POST['parentID'];
if (empty($parentID)) {
    $parentID = -1;
}

$categoryID = $_POST['categoryID'];
if (empty($categoryID)) {
    $parentID = -1;
}

$title = $_POST['title'];
$content = $_POST['content'];

if (!$page->isUserNormal($page->getLoggedInUser())) {
    $page->redirect('add-post.php?error=You do not have permission to access this page');
}

if (empty($title)) {
    $page->redirect('add-post.php?error=No Title Specified');
}

if (empty($title)) {
    $page->redirect('add-post.php?error=No Content Specified');
}

$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);

?>