Contributions by Keith Gable This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. In addition to being restricted by the GNU General Public License, Essence Engine may not be sold, rented, sublicensed, or leased; you are not permitted to generate revenue with the Essence Engine source code. You may, however, use Essence Engine to run a website that generates revenue via other means. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA $Id$ */ // Forum Administration // 'nuff said $pagetitle = "Forum Manager"; include("mainheader.php"); if (!$userinfo["editforums"]) { sysmsg("You do not have permission to edit forums."); sendlocation("admin.php"); } include("themeheader.php"); if (($_GET["action"] == "addforum") || (($_GET["action"] == "editforum") && ($_REQUEST["forumid"]))) { // Forum form has been submitted if ($_POST["submitted"]) { $modforum = $_POST; if ($_POST["forum_name"] && $_POST["forum_desc"] && $_POST["forum_cat"]) { $doquery = "forum_name='" . mysql_escape_string($_POST["forum_name"]) . "', "; $doquery .= "forum_desc='" . mysql_escape_string($_POST["forum_desc"]) . "', "; $doquery .= "forum_cat='" . mysql_escape_string($_POST["forum_cat"]) . "', "; if ($_POST["forum_allowcomment"]) $doquery .= "forum_allowcomment='1', "; else $doquery .= "forum_allowcomment='0', "; $doquery .= "user_type_view='" . mysql_escape_string($_POST["user_type_view"]) . "', "; $doquery .= "user_type_post='" . mysql_escape_string($_POST["user_type_post"]) . "', "; $doquery .= "user_allow='" . mysql_escape_string($_POST["user_allow"]) . "', "; $doquery .= "user_disallow='" . mysql_escape_string($_POST["user_disallow"]) . "'"; if ($_GET["action"] == "addforum") $doquery = "INSERT INTO forum_forums SET " . $doquery; elseif ($_GET["action"] == "editforum") $doquery = "UPDATE forum_forums SET " . $doquery . " WHERE forum_id='" . mysql_escape_string($_POST["forumid"]) . "' LIMIT 1"; $added = mysql_query($doquery, $db); if (mysql_errno() != 0) $errmsg = "MySQL Error " . mysql_errno() . ": " . mysql_error() . "."; else { if ($_GET["action"] == "addforum") sysmsg('Successfully added the "' . safetext($_POST["forum_name"]) . '" forum.'); elseif ($_GET["action"] == "editforum") sysmsg('Successfully edited the "' . safetext($_POST["forum_name"]) . '" forum.'); sendlocation("adminforums.php"); } } else $errmsg = "You must supply a category, name, and description for the forum."; } elseif ($_GET["forumid"]) { $forumid = mysql_escape_string($_GET["forumid"]); $result = mysql_query("SELECT * FROM forum_forums WHERE forum_id='" . $forumid . "'", $db); $modforum = mysql_fetch_array($result); if (!isset($modforum["forum_name"])) { $_SESSION["sysmsg"] = 'The forum id ' . safetext($forumid) . ' does not exist.'; sendlocation("adminforums.php"); } } if (($_GET["action"] == "addforum") || (($_GET["action"] == "editforum") && (isset($modforum)))) { if ($errmsg) echo '
' . $errmsg . "
\n"; ?>
">

" />
" />
/>


" />
" />
\n"; echo ' ' . "\n"; } else echo ' ' . "\n"; ?>
Do you really want to delete this forum?
\n"; echo "Yes, delete this forum.
\n"; echo "No, do not delete it.
\n"; echo "Note: Make sure you delete or move any posts before deleting the forum!\n"; $result = mysql_query("SELECT * FROM forum_forums WHERE forum_id=" . $forumid, $db); $forum = mysql_fetch_array($result); ?>
Name:
Description:
Users allowed to view:
Users allowed to post:
Users can comment:
Allowed users:
Banned users:
0 LIMIT 1", $db); sendlocation("adminforums.php"); } elseif ($_GET["action"] == "forumdown") { $forumid = mysql_escape_string($_GET["forumid"]); $result = mysql_query("UPDATE forum_forums SET forum_order=forum_order+1 WHERE forum_id='$forumid' AND forum_order<10 LIMIT 1", $db); sendlocation("adminforums.php"); } elseif (($_GET["action"] == "addcat") || (($_GET["action"] == "editcat") && ($_REQUEST["catid"]))) { // Category form has been submitted if ($_POST["submitted"]) { $modcat = $_POST; if ($_POST["cat_name"]) { $doquery = "cat_name='" . mysql_escape_string($_POST["cat_name"]) . "', "; $doquery .= "user_type_view='" . mysql_escape_string($_POST["user_type_view"]) . "', "; $doquery .= "user_allow='" . mysql_escape_string($_POST["user_allow"]) . "', "; $doquery .= "user_disallow='" . mysql_escape_string($_POST["user_disallow"]) . "'"; if ($_GET["action"] == "addcat") $doquery = "INSERT INTO forum_cats SET " . $doquery; elseif ($_GET["action"] == "editcat") $doquery = "UPDATE forum_cats SET " . $doquery . " WHERE cat_id='" . mysql_escape_string($_POST["catid"]) . "' LIMIT 1"; $added = mysql_query($doquery, $db); if (mysql_errno() != 0) $errmsg = "MySQL Error " . mysql_errno() . ": " . mysql_error() . "."; else { if ($_GET["action"] == "addcat") sysmsg('Successfully added the "' . safetext($_POST["cat_name"]) . '" category.'); elseif ($_GET["action"] == "editcat") sysmsg('Successfully edited the "' . safetext($_POST["cat_name"]) . '" category.'); sendlocation("adminforums.php"); } } else $errmsg = "You must supply a name for the category."; } elseif ($_GET["catid"]) { $catid = mysql_escape_string($_GET["catid"]); $result = mysql_query("SELECT * FROM forum_cats WHERE cat_id='" . $catid . "'", $db); $modcat = mysql_fetch_array($result); if (!isset($modcat["cat_name"])) { $_SESSION["sysmsg"] = 'The category id ' . safetext($catid) . ' does not exist.'; sendlocation("adminforums.php"); } } if (($_GET["action"] == "addcat") || (($_GET["action"] == "editcat") && (isset($modcat)))) { if ($errmsg) echo '
' . $errmsg . "
\n"; ?>
">
" />

" />
" />
\n"; echo ' ' . "\n"; } else echo ' ' . "\n"; ?>
Do you really want to delete this category?
\n"; echo "Yes, delete this category.
\n"; echo "No, do not delete it.
\n"; echo "Note: Make sure you delete or move any forums before deleting the category!\n"; $result = mysql_query("SELECT * FROM forum_cats WHERE cat_id=" . $catid, $db); $cat = mysql_fetch_array($result); ?>
Name:
User type allowed:
Allowed users:
Banned users:
0 LIMIT 1", $db); sendlocation("adminforums.php"); } elseif ($_GET["action"] == "catdown") { $catid = mysql_escape_string($_GET["catid"]); $result = mysql_query("UPDATE forum_cats SET cat_order=cat_order+1 WHERE cat_id='$catid' AND cat_order<10 LIMIT 1", $db); sendlocation("adminforums.php"); } else { echo "
Add a new category
"; $result_cats = mysql_query("SELECT * FROM forum_cats ORDER BY cat_order ASC, cat_name ASC", $db); echo "\n"; echo "\n"; if (mysql_affected_rows()) { while ($forum_cats = mysql_fetch_array($result_cats)) { if (checkprivs($forum_cats,$userinfo,"view")) { echo "\n"; echo '"; echo '\n"; $result_forums = mysql_query("SELECT * FROM forum_forums WHERE forum_cat='" . $forum_cats["cat_id"] . "' ORDER BY forum_order ASC, forum_name ASC", $db); if (mysql_affected_rows()) { while ($forum_forums = mysql_fetch_array($result_forums)) { if (checkprivs($forum_forums,$userinfo,"view")) { if (!$userinfo["showhidden"]) $hide = " AND opt_hide=0"; echo "\n"; echo " \n"; echo '\n"; echo "\n"; $forumdisplayed = true; } } if (!$forumdisplayed) echo ""; } else echo ""; $catdisplayed = true; } if (!$catdisplayed) echo ""; } } else echo ""; echo "
TitleFunctions
" . $forum_cats["cat_name"] . " - Category Order: " . $forum_cats["cat_order"] . "Edit - Delete"; echo ' - Move Up - Move Down
Add a new forum in this category
\n
' . $forum_forums["forum_name"] . " - Sort Order: " . $forum_forums["forum_order"] . "
\n
" . $forum_forums["forum_desc"] . "
\n
Edit - Delete"; echo ' - Move Up - Move Down
There are no forums under this category
There are no forums under this category
There are no forum categories.
There are no forum categories.
\n"; } include("themefooter.php"); ?>