Rev 484 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
169 | tom | 1 | <?php |
2 | |||
3 | require '../_taios.php'; |
||
4 | |||
5 | $page = new Taios_Page('Forums', '../'); |
||
6 | |||
246 | tom | 7 | $parentID = $_GET['parentID']; |
8 | if (empty($parentID)) |
||
9 | { |
||
10 | $parentID = -1; |
||
11 | } |
||
522 | muzer | 12 | |
13 | if (!is_numeric($parentID)) |
||
302 | freddie | 14 | { |
522 | muzer | 15 | $parentID = -1; |
16 | } |
||
17 | |||
18 | if ($parentID != -1) |
||
19 | { |
||
302 | freddie | 20 | $page->title = $page->getForumCategory($parentID)->title; |
21 | } |
||
169 | tom | 22 | |
302 | freddie | 23 | $page->drawHeader(); |
24 | $page->drawMiddle(); |
||
25 | |||
304 | tom | 26 | write('<p><i>The forums are still under construction.</i></p>'); |
27 | |||
270 | tom | 28 | write('<p class="bold">'); |
29 | if ($parentID != -1) |
||
30 | { |
||
31 | write('<a href="index.php?parentID=-1">Back to root</a>'); |
||
32 | } |
||
471 | muzer | 33 | if ($page->isLoggedIn() && $page->isUserNormal($page->getLoggedInUser())) |
281 | tom | 34 | { |
282 | tom | 35 | if ($parentID != -1) |
281 | tom | 36 | { |
37 | write(' · '); |
||
38 | } |
||
39 | write('<a href="add-post.php?categoryID=' . $parentID . '">Add Post</a>'); |
||
40 | } |
||
265 | tom | 41 | if ($page->isUserAdmin($page->getLoggedInUser())) |
42 | { |
||
281 | tom | 43 | if ($page->isLoggedIn()) |
270 | tom | 44 | { |
45 | write(' · '); |
||
46 | } |
||
47 | write('<a href="add-category.php?parentID=' . $parentID . '">Add Category</a>'); |
||
265 | tom | 48 | } |
270 | tom | 49 | write('</p><br />'); |
265 | tom | 50 | |
484 | muzer | 51 | $ids = $page->findIDs('ForumCategories', 'WHERE ParentID = "' . $parentID . '" ORDER BY Title ASC'); |
252 | tom | 52 | |
53 | if (count($ids) >= 1) |
||
54 | { |
||
55 | write('<h3>Categories</h3>'); |
||
56 | } |
||
57 | |||
246 | tom | 58 | for ($i = 0; $i < count($ids); $i++) |
59 | { |
||
251 | tom | 60 | $forumCategory = $page->getForumCategory($ids[$i]); |
522 | muzer | 61 | write('<h4><a href="index.php?parentID=' . $forumCategory->ID . '">' . htmlentities($forumCategory->title, ENT_QUOTES) . '</a></h4>'); |
62 | write('<p>' . htmlentities($forumCategory->description, ENT_QUOTES) . '</p>'); |
||
271 | tom | 63 | if ($page->isUserAdmin($page->getLoggedInUser())) |
64 | { |
||
298 | freddie | 65 | write('<p class="bold"><a href="edit-category.php?id=' . $forumCategory->ID . '">Edit Category</a> · <a href="delete-category-do.php?id=' . $forumCategory->ID . '">Delete Category</a></p>'); |
271 | tom | 66 | } |
252 | tom | 67 | write('<br />'); |
246 | tom | 68 | } |
69 | |||
484 | muzer | 70 | $ids = $page->findIDs('ForumPosts', 'WHERE CategoryID = "' . $parentID . '" AND ParentID = -1 ORDER BY Title ASC'); |
252 | tom | 71 | |
72 | if (count($ids) >= 1) |
||
73 | { |
||
74 | write('<h3>Topics</h3>'); |
||
75 | } |
||
76 | |||
77 | for ($i = 0; $i < count($ids); $i++) |
||
78 | { |
||
79 | $forumPost = $page->getForumPost($ids[$i]); |
||
522 | muzer | 80 | write('<h4><a href="post.php?id=' . $forumPost->ID . '">' . htmlentities($forumPost->title, ENT_QUOTES) . '</a></h4>'); |
252 | tom | 81 | write('<br />'); |
82 | } |
||
83 | |||
169 | tom | 84 | $page->drawFooter(); |
85 | |||
86 | ?> |
||
87 |