Rev 484 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
284 | tom | 1 | <?php |
2 | |||
3 | require '../_taios.php'; |
||
4 | |||
5 | $page = new Taios_Page('Add Category', '../'); |
||
6 | |||
7 | $page->checkLoggedIn(); |
||
8 | |||
9 | $parentID = $_POST['parentID']; |
||
493 | tom | 10 | if (empty($parentID)) { |
284 | tom | 11 | $parentID = -1; |
12 | } |
||
493 | tom | 13 | |
284 | tom | 14 | $categoryID = $_POST['categoryID']; |
493 | tom | 15 | if (empty($categoryID)) { |
284 | tom | 16 | $parentID = -1; |
17 | } |
||
18 | |||
19 | $title = $_POST['title']; |
||
20 | $content = $_POST['content']; |
||
21 | |||
493 | tom | 22 | if (!$page->isUserNormal($page->getLoggedInUser())) { |
471 | muzer | 23 | $page->redirect('add-post.php?error=You do not have permission to access this page'); |
24 | } |
||
25 | |||
493 | tom | 26 | if (empty($title)) { |
284 | tom | 27 | $page->redirect('add-post.php?error=No Title Specified'); |
28 | } |
||
493 | tom | 29 | |
30 | if (empty($title)) { |
||
284 | tom | 31 | $page->redirect('add-post.php?error=No Content Specified'); |
32 | } |
||
33 | |||
493 | tom | 34 | $args = array($page->getLoggedInUser()->ID, $categoryID, $parentID, $title, $content); |
35 | $page->query("INSERT INTO ForumPosts VALUES (0, ?, ?, ?, ?, ?, NOW(), FALSE)", $args); |
||
284 | tom | 36 | $page->redirect('index.php?parentID=' . $categoryID); |
37 | |||
38 | ?> |
||
39 |