foreach ($forum_index->retrieveCategories($rank) as $category) { $content .= '<option value="' . $category['id'] . '">' . $category['title'] . '</option>'; } $content .= '<input type="submit" value="Edit"></select></form>'; } else { //make sure it exists if (!$forum->catExists($_REQUEST['cat'])) { $content = 'No category exists with the given ID.'; } else { if (isset($_REQUEST['delete'])) { if (!isset($_REQUEST['confirm'])) { $content = 'Are you sure you wish to delete this category and all forums/threads/posts a long with it? <a href="?cat=' . $_REQUEST['cat'] . '&delete=1&confirm=1">Yes!</a> | <a href="?cat=' . $_REQUEST['cat'] . '">Back</a>'; } else { //delete the forums and all threads/posts within them that belong to this category foreach ($forum_index->retrieveSubForums($_REQUEST['cat']) as $a_forum) { $forum->deleteForum($a_forum['id']); } //delete the category itself $database->processQuery("DELETE FROM `cats` WHERE `id` = ?", array($_REQUEST['cat']), false); $content = 'Delete successful!'; } } else { $cat = $database->processQuery("SELECT `title`,`id`,`type`,`pos` FROM `cats` WHERE `id` = ?", array($_REQUEST['cat']), true); if (!isset($_POST['category'])) { $content = ' <form action="editcat.php?cat=' . $cat[0]['id'] . '" method="POST"> <table> <tr> <td>Category</td> <td><input type="text" name="category" class="button" value="' . $cat[0]['title'] . '"></td> </tr>
$content .= '<option value="' . $forum['id'] . '">' . $forum['title'] . '</option>'; } } $content .= '</select> <input type="submit" value="Select" class="button"> </form> </div> '; } else { if (isset($_GET['delete']) || ($forum->forumExists($_GET['id']) || $forum->forumExists($_POST['id']))) { if (isset($_GET['delete'])) { if (!isset($_GET['confirm'])) { $content = 'Are you sure you wish to delete this forum? All posts and threads within it will be lost. <a href="?id=' . $_GET['id'] . '&delete=1&confirm=1">Yes</a> | <a href="editforum.php">No</a>'; } else { //delete the forum, threads, and posts $forum->deleteForum($_GET['id']); $content = 'The forum was successfully deleted. <a href="index.php">Home</a> | <a href="editforum.php">Edit another forum</a>'; } } elseif (!isset($_POST['id'])) { //forum details $f = $database->processQuery("SELECT `icon`,`title`,`type`,`description`,`parent`,`double_posting`,`pos` FROM `forums` WHERE `id` = ? LIMIT 1", array($_GET['id']), true); //save time $type = $f[0]['type']; $icon = $f[0]['icon']; $content = ' <form action="editforum.php" method="POST"> <table> <input type="hidden" name="id" value="' . $_GET['id'] . '"> <tr> <td>Delete</td><td><a href="?id=' . $_GET['id'] . '?&delete=1">Delete this forum.</a></td> </tr>