query('INSERT INTO '.$db->prefix.'forums (cat_id) VALUES('.$add_to_cat.')') or error('Unable to create forum', __FILE__, __LINE__, $db->error()); redirect('admin_forums.php', 'Forum added. Redirecting ...'); } // Delete a forum else if (isset($_POST['del_forum']) || isset($_POST['comply'])) { confirm_referer('admin_forums.php'); $forum_to_delete = intval($_POST['forum_to_delete']); if (empty($forum_to_delete)) message($lang_common['Bad request']); if (isset($_POST['comply'])) // Delete a forum with all posts { @set_time_limit(0); // Prune all posts and topics (start transaction) prune($forum_to_delete, 1, -1); // Locate any "orphaned redirect topics" and delete them $result = $db->query('SELECT t1.id FROM '.$db->prefix.'topics AS t1 LEFT OUTER JOIN '.$db->prefix.'topics AS t2 ON t1.moved_to=t2.id WHERE t2.id IS NULL AND t1.moved_to IS NOT NULL') or error('Unable to fetch redirect topics', __FILE__, __LINE__, $db->error()); $num_orphans = $db->num_rows($result); if ($num_orphans) { for ($i = 0; $i < $num_orphans; $i++) $orphans[] = $db->result($result, $i); $db->query('DELETE FROM '.$db->prefix.'topics WHERE id IN('.implode(',', $orphans).')') or error('Unable to delete redirect topics', __FILE__, __LINE__, $db->error()); } // Delete the forum (end transaction) $db->query('DELETE FROM '.$db->prefix.'forums WHERE id='.$forum_to_delete, PUN_TRANS_END) or error('Unable to delete forum', __FILE__, __LINE__, $db->error()); redirect('admin_forums.php', 'Forum deleted. Redirecting ...'); } else // If the user hasn't confirmed the delete { $page_title = htmlspecialchars($options['board_title']).' / Admin / Forums'; require 'header.php'; admin_menu('forums'); ?>
Confirm delete forum

 Are you sure that you want to delete this forum?

 WARNING! Deleting a forum will delete all posts (if any) in that forum!

    Go back

 
query('UPDATE '.$db->prefix.'forums SET forum_name=\''.escape($cur_forum_name).'\', forum_desc='.$cur_forum_desc.', closed=\''.$cur_closed.'\', admmod_only=\''.$cur_admmod_only.'\', position='.$cur_position.', cat_id='.$cur_cat_id.' WHERE id='.$id) or error('Unable to update forum', __FILE__, __LINE__, $db->error()); } redirect('admin_forums.php', 'Forum(s) updated. Redirecting ...'); } // Generate an array with all forums and their respective category (used frequently) $result = $db->query('SELECT c.id AS cid, c.cat_name, f.id AS fid, f.forum_name, f.forum_desc, f.closed, f.admmod_only, f.position FROM '.$db->prefix.'categories AS c LEFT JOIN '.$db->prefix.'forums AS f ON c.id=f.cat_id ORDER BY c.position, cid, f.position') or error('Unable to fetch category/forum list', __FILE__, __LINE__, $db->error()); $num_forums = $db->num_rows($result); $forum_list = array(); while ($num_forums--) $forum_list[] = $db->fetch_assoc($result); $page_title = htmlspecialchars($options['board_title']).' / Admin / Forums'; require 'header.php'; admin_menu('forums'); ?>
Add/delete forums

  Add forum to category     


  Delete forum     

 
'."\n"; $cur_category = $cur_forum['cid']; } if ($cur_forum['fid'] != '') { ?>
Edit forums
'.htmlspecialchars($cur_forum['cat_name']).'
Position   Options  > Admins/moderators only
Name    > Closed
Description
(HTML)
  Category