".$locale['401'].""; } elseif ($status == "savecu") { $title = $locale['402']; $message = "".$locale['403'].""; } elseif ($status == "savefe") { $title = $locale['404']; $message = "".$locale['405'].""; } elseif ($status == "savefu") { $title = $locale['406']; $message = "".$locale['407'].""; } elseif ($status == "savefm") { $title = $locale['408']; $message = "".$locale['409'].""; } elseif ($status == "delc1") { $title = $locale['410']; $message = "".$locale['411'].""; } elseif ($status == "delc2") { $title = $locale['410']; $message = "".$locale['412']."
\n".$locale['413']; } elseif ($status == "delf1") { $title = $locale['414']; $message = "".$locale['415'].""; } elseif ($status == "delf2") { $title = $locale['414']; $message = "".$locale['416']."
\n".$locale['417']; } opentable($title); echo "
".$message."
\n"; closetable(); tablebreak(); } if (isset($_POST['save_cat'])) { $cat_name = stripinput($_POST['cat_name']); if ($action == "edit" && $t == "cat") { $result = dbquery("UPDATE ".$db_prefix."forums SET forum_name='$cat_name' WHERE forum_id='$forum_id'"); redirect(FUSION_SELF.$aidlink."&status=savece"); } else { if ($cat_name != "") { $cat_order = isNum($_POST['cat_order']) ? $_POST['cat_order'] : ""; if(!$cat_order) $cat_order=dbresult(dbquery("SELECT MAX(forum_order) FROM ".$db_prefix."forums WHERE forum_cat='0'"),0)+1; $result = dbquery("UPDATE ".$db_prefix."forums SET forum_order=forum_order+1 WHERE forum_cat='0' AND forum_order>='$cat_order'"); $result = dbquery("INSERT INTO ".$db_prefix."forums (forum_cat, forum_name, forum_order, forum_description, forum_moderators, forum_access, forum_posting, forum_lastpost, forum_lastuser) VALUES ('0', '$cat_name', '$cat_order', '', '', '0', '0', '0', '0')"); } redirect(FUSION_SELF.$aidlink."&status=savecu"); } } elseif (isset($_POST['save_forum'])) { $forum_name = stripinput($_POST['forum_name']); $forum_description = stripinput($_POST['forum_description']); $forum_cat = isNum($_POST['forum_cat']) ? $_POST['forum_cat'] : ""; $forum_access = $_POST['forum_access']; $forum_posting = $_POST['forum_posting']; if ($action == "edit" && $t == "forum") { $result = dbquery("UPDATE ".$db_prefix."forums SET forum_name='$forum_name', forum_cat='$forum_cat', forum_description='$forum_description', forum_access='$forum_access', forum_posting='$forum_posting' WHERE forum_id='$forum_id'"); redirect(FUSION_SELF.$aidlink."&status=savefe"); } else { if ($forum_name != "") { $forum_mods = ""; $result = dbquery("SELECT * FROM ".$db_prefix."users WHERE user_level='102'"); while ($data = dbarray($result)) { $forum_mods .= $data['user_id']; if ($i < dbrows($result)) $forum_mods .= "."; $i++; } $forum_order = isNum($_POST['forum_order']) ? $_POST['forum_order'] : ""; if(!$forum_order) $forum_order=dbresult(dbquery("SELECT MAX(forum_order) FROM ".$db_prefix."forums WHERE forum_cat='$forum_cat'"),0)+1; $result = dbquery("UPDATE ".$db_prefix."forums SET forum_order=forum_order+1 WHERE forum_cat='$forum_cat' AND forum_order>='$forum_order'"); $result = dbquery("INSERT INTO ".$db_prefix."forums (forum_cat, forum_name, forum_order, forum_description, forum_moderators, forum_access, forum_posting, forum_lastpost, forum_lastuser) VALUES ('$forum_cat', '$forum_name', '$forum_order', '$forum_description', '$forum_mods', '$forum_access', '$forum_posting', '0', '0')"); } redirect(FUSION_SELF.$aidlink."&status=savefu"); } } elseif (isset($_POST['save_forum_mods'])) { $forum_mods = $_POST['forum_mods']; $result = dbquery("UPDATE ".$db_prefix."forums SET forum_moderators='$forum_mods' WHERE forum_id='".$_POST['forum_id']."'"); redirect(FUSION_SELF.$aidlink."&status=savefm"); } elseif ($action == "moveup") { if ($t == "cat") { $data = dbarray(dbquery("SELECT * FROM ".$db_prefix."forums WHERE forum_cat='0' AND forum_order='$order'")); $result = dbquery("UPDATE ".$db_prefix."forums SET forum_order=forum_order+1 WHERE forum_id='".$data['forum_id']."'"); $result = dbquery("UPDATE ".$db_prefix."forums SET forum_order=forum_order-1 WHERE forum_id='$forum_id'"); } elseif ($t == "forum") { $data = dbarray(dbquery("SELECT * FROM ".$db_prefix."forums WHERE forum_cat='$cat' AND forum_order='$order'")); $result = dbquery("UPDATE ".$db_prefix."forums SET forum_order=forum_order+1 WHERE forum_id='".$data['forum_id']."'"); $result = dbquery("UPDATE ".$db_prefix."forums SET forum_order=forum_order-1 WHERE forum_id='$forum_id'"); } redirect(FUSION_SELF.$aidlink); } elseif ($action == "movedown") { if ($t == "cat") { $data = dbarray(dbquery("SELECT * FROM ".$db_prefix."forums WHERE forum_cat='0' AND forum_order='$order'")); $result = dbquery("UPDATE ".$db_prefix."forums SET forum_order=forum_order-1 WHERE forum_id='".$data['forum_id']."'"); $result = dbquery("UPDATE ".$db_prefix."forums SET forum_order=forum_order+1 WHERE forum_id='$forum_id'"); } elseif ($t == "forum") { $data = dbarray(dbquery("SELECT * FROM ".$db_prefix."forums WHERE forum_cat='$cat' AND forum_order='$order'")); $result = dbquery("UPDATE ".$db_prefix."forums SET forum_order=forum_order-1 WHERE forum_id='".$data['forum_id']."'"); $result = dbquery("UPDATE ".$db_prefix."forums SET forum_order=forum_order+1 WHERE forum_id='$forum_id'"); } redirect(FUSION_SELF.$aidlink); } elseif ($action == "delete" && $t == "cat") { if (dbcount("(*)", "forums", "forum_cat='$forum_id'") == 0) { $data = dbarray(dbquery("SELECT * FROM ".$db_prefix."forums WHERE forum_id='$forum_id'")); $result = dbquery("UPDATE ".$db_prefix."forums SET forum_order=forum_order-1 WHERE forum_cat='0' AND forum_order>'".$data['forum_order']."'"); $result = dbquery("DELETE FROM ".$db_prefix."forums WHERE forum_id='$forum_id'"); redirect(FUSION_SELF.$aidlink."&status=delc1"); } else { redirect(FUSION_SELF.$aidlink."&status=delc2"); } } elseif ($action == "delete" && $t == "forum") { if (dbcount("(*)", "posts", "forum_id='$forum_id'") == 0) { $data = dbarray(dbquery("SELECT * FROM ".$db_prefix."forums WHERE forum_id='$forum_id'")); $result = dbquery("UPDATE ".$db_prefix."forums SET forum_order=forum_order-1 WHERE forum_cat='".$data['forum_cat']."' AND forum_order>'".$data['forum_order']."'"); $result = dbquery("DELETE FROM ".$db_prefix."forums WHERE forum_id='$forum_id'"); redirect(FUSION_SELF.$aidlink."&status=delf1"); } else { redirect(FUSION_SELF.$aidlink."&status=delf2"); } } else { if ($action == "edit") { if ($t == "cat") { $result = dbquery("SELECT * FROM ".$db_prefix."forums WHERE forum_id='$forum_id'"); $data = dbarray($result); $cat_name = $data['forum_name']; $cat_title = $locale['420']; $cat_action = FUSION_SELF.$aidlink."&action=edit&forum_id=".$data['forum_id']."&t=cat"; $forum_title = $locale['421']; $forum_action = FUSION_SELF.$aidlink; } elseif ($t == "forum") { $result = dbquery("SELECT * FROM ".$db_prefix."forums WHERE forum_id='$forum_id'"); $data = dbarray($result); $forum_name = $data['forum_name']; $forum_description = $data['forum_description']; $forum_cat = $data['forum_cat']; $forum_access = $data['forum_access']; $forum_posting = $data['forum_posting']; $forum_title = $locale['422']; $forum_action = FUSION_SELF.$aidlink."&action=edit&forum_id=".$data['forum_id']."&t=forum"; $cat_title = $locale['423']; $cat_action = FUSION_SELF.$aidlink; } } else { $cat_name = ""; $cat_order = ""; $cat_title = $locale['423']; $cat_action = FUSION_SELF.$aidlink; $forum_name = ""; $forum_description = ""; $forum_cat = ""; $forum_order = ""; $forum_access = ""; $forum_posting = ""; $forum_title = $locale['421']; $forum_action = FUSION_SELF.$aidlink; } if ($t != "forum") { opentable($cat_title); echo "
\n"; } echo "
".$locale['440']."
"; if ($action != "edit") { echo $locale['441']."
\n"; closetable(); } if ($t == "") tablebreak(); if ($t != "cat") { $cat_opts = ""; $sel = ""; $result2 = dbquery("SELECT * FROM ".$db_prefix."forums WHERE forum_cat='0' ORDER BY forum_order"); if (dbrows($result2) != 0) { while ($data2 = dbarray($result2)) { if ($action == "edit" && $t == "forum") $sel = ($data2['forum_id'] == $forum_cat ? " selected" : ""); $cat_opts .= "\n"; } } $user_groups = getusergroups(); $access_opts = ""; while(list($key, $user_group) = each($user_groups)){ $sel = ($forum_access == $user_group['0'] ? " selected" : ""); $access_opts .= "\n"; } $post_groups = getusergroups(); $posting_opts = ""; while(list($key, $user_group) = each($post_groups)){ if ($user_group['0'] != "0") { $sel = ($forum_posting == $user_group['0'] ? " selected" : ""); $posting_opts .= "\n"; } } opentable($forum_title); echo "
\n"; } echo "
".$locale['460']."
".$locale['461']."
".$locale['462']."
"; if ($action != "edit") { echo $locale['463']."
".$locale['464']."
".$locale['465']."
\n"; closetable(); if ($action == "edit" && $t == "forum") { tablebreak(); opentable($locale['408']); $result = dbquery("SELECT user_id,user_name FROM ".$db_prefix."users ORDER BY user_level DESC, user_name"); while ($data2 = dbarray($result)) { $user_id = $data2['user_id']; if (!preg_match("(^{$user_id}$|^{$user_id}\.|\.{$user_id}\.|\.{$user_id}$)", $data['forum_moderators'])) { $mods1_user_id[] = $data2['user_id']; $mods1_user_name[] = $data2['user_name']; } else { $mods2_user_id[] = $data2['user_id']; $mods2_user_name[] = $data2['user_name']; } unset($user_id); } echo "

\n"; closetable(); echo "\n"; } } tablebreak(); opentable($locale['480']); $forums_defined = false; $forum = "\n"; $result = dbquery("SELECT * FROM ".$db_prefix."forums WHERE forum_cat='0' ORDER BY forum_order"); if (dbrows($result) != 0) { $forums_defined = true; $forum .= "\n\n"; $i = 1; while ($data = dbarray($result)) { $forum .= "\n"; $result2 = dbquery("SELECT * FROM ".$db_prefix."forums WHERE forum_cat='".$data['forum_id']."' ORDER BY forum_order"); if (dbrows($result2) != 0) { $k = 1; while ($data2 = dbarray($result2)) { $forum .= "\n"; } } else { $forum .= "\n\n\n"; } } } else { $forum .= "\n\n\n"; } echo $forum; if ($forums_defined) echo "\n\n\n"; echo "
".$locale['485']." ".$locale['486']." ".$locale['487']." ".$locale['488']."
".$data['forum_name']." ".$data['forum_order']." \n"; if (dbrows($result) != 1) { $up = $data['forum_order'] - 1; $down = $data['forum_order'] + 1; if ($i == 1) { $forum .= "".$locale[\n"; } elseif ($i < dbrows($result)) { $forum .= "".$locale[\n"; $forum .= "".$locale[\n"; } else { $forum .= "".$locale[\n"; } } $i++; $forum .= " ".$locale['481']." - ".$locale['482']."
".$data2['forum_name']."
".$data2['forum_description']."
".getgroupname($data2['forum_access'])."
".getgroupname($data2['forum_posting'])."
".$data2['forum_order']." \n"; if (dbrows($result2) != 1) { $up = $data2['forum_order'] - 1; $down = $data2['forum_order'] + 1; if ($k == 1) { $forum .= "".$locale[\n"; } elseif ($k < dbrows($result2)) { $forum .= "".$locale[\n"; $forum .= "".$locale[\n"; } else { $forum .= "".$locale[\n"; } } $k++; $forum .= " ".$locale['481']." - ".$locale['482']."
".$locale['483']."
".$locale['484']."
[ ".$locale['493']." ]
\n"; closetable(); } echo "\n"; require_once BASEDIR."footer.php"; ?>