$v) {
${$k} = $v;
}
switch (trim($mode)) {
case 'editforum':
$myts =& MyTextSanitizer::getInstance();
if ( isset($HTTP_POST_VARS['save']) && $HTTP_POST_VARS['save'] != "" ) {
if ( !$HTTP_POST_VARS['delete'] ) {
$name = $myts->makeTboxData4Save($HTTP_POST_VARS['name']);
$desc = $myts->makeTareaData4Save($HTTP_POST_VARS['desc']);
$sql = sprintf("UPDATE %s SET forum_name = '%s', forum_desc = '%s', forum_type = '%s', cat_id = %u, forum_access = %u, allow_html = '%s', allow_sig = '%s', posts_per_page = %u, hot_threshold = %u, topics_per_page = %u WHERE forum_id = %u", $xoopsDB->prefix("bb_forums"), $name, $desc, $type, $cat, $forum_access, $html, $sig, $ppp, $hot, $tpp, $forum);
if ( !$r = $xoopsDB->query($sql) ) {
redirect_header("./index.php", 1);
exit();
}
$count = 0;
if ( isset($HTTP_POST_VARS["mods"]) ) {
while ( list($null, $mod) = each($HTTP_POST_VARS["mods"]) ) {
$mod_data = new XoopsUser($mod);
if ( $mod_data->isActive() ) {
$sql = sprintf("INSERT INTO %s (forum_id, user_id) VALUES (%u, %u)", $xoopsDB->prefix("bb_forum_mods"), $forum, $mod);
if ( !$xoopsDB->query($sql) ) {
redirect_header("./index.php", 1);
exit();
}
}
}
}
if ( !isset($mods) ) {
$current_mods = "SELECT count(*) AS total FROM ".$xoopsDB->prefix("bb_forum_mods")." WHERE forum_id = $forum";
$r = $xoopsDB->query($current_mods);
list($total) = $xoopsDB->fetchRow($r);
} else {
$total = count($mods) + 1;
}
if ( isset($rem_mods) && $total > 1 ) {
while ( list($null, $mod) = each($HTTP_POST_VARS["rem_mods"]) ) {
$sql = sprintf("DELETE FROM %s WHERE forum_id = %u AND user_id = %u", $xoopsDB->prefix("bb_forum_mods"), $forum, $mod);
if ( !$xoopsDB->query($sql) ) {
redirect_header("./index.php", 1);
exit();
}
}
} else {
if ( isset($rem_mods) ) {
$mod_not_removed = 1;
}
}
if ( $mod_not_removed ) {
redirect_header("./index.php", 1, _MD_A_FORUMUPDATED."
"._MD_A_HTSMHNBRBITHBTWNLBAMOTF);
}else{
redirect_header("./index.php", 1, _MD_A_FORUMUPDATED);
}
} else {
$sql = "SELECT post_id FROM ".$xoopsDB->prefix("bb_posts")." WHERE forum_id = $forum";
if ( !$r = $xoopsDB->query($sql) ) {
redirect_header("./index.php", 1);
exit();
}
if ( $xoopsDB->getRowsNum($r) > 0 ) {
$sql = "DELETE FROM ".$xoopsDB->prefix("bb_posts_text")." WHERE ";
$looped = false;
while ( $ids = $xoopsDB->fetchArray($r) ) {
if ( $looped == true ) {
$sql .= " OR ";
}
$sql .= "post_id = ".$ids["post_id"]." ";
$looped = true;
}
if ( !$r = $xoopsDB->query($sql) ) {
redirect_header("./index.php", 1);
exit();
}
$sql = sprintf("DELETE FROM %s WHERE forum_id = %u", $xoopsDB->prefix("bb_posts"), $forum);
if ( !$r = $xoopsDB->query($sql) ) {
redirect_header("./index.php", 1);
exit();
}
}
// RMV-NOTIFY
xoops_notification_deletebyitem ($xoopsModule->getVar('mid'), 'forum', $forum);
// Get list of all topics in forum, to delete them too
$sql = sprintf("SELECT topic_id FROM %s WHERE forum_id = %u", $xoopsDB->prefix("bb_topics"), $forum);
if ($r = $xoopsDB->query($sql)) {
while ($row = $xoopsDB->fetchArray($r)) {
xoops_notification_deletebyitem ($xoopsModule->getVar('mid'), 'thread', $row['topic_id']);
}
}
$sql = sprintf("DELETE FROM %s WHERE forum_id = %u", $xoopsDB->prefix("bb_topics"), $forum);
if ( !$r = $xoopsDB->query($sql) ) {
redirect_header("./index.php", 1);
exit();
}
$sql = sprintf("DELETE FROM %s WHERE forum_id = %u", $xoopsDB->prefix("bb_forums"), $forum);
if ( !$r = $xoopsDB->query($sql) ) {
redirect_header("./index.php", 1);
exit();
}
$sql = sprintf("DELETE FROM %s WHERE forum_id = %u", $xoopsDB->prefix("bb_forum_mods"), $forum);
if ( !$r = $xoopsDB->query($sql) ) {
redirect_header("./index.php", 1);
exit();
}
redirect_header("./index.php", 1, _MD_A_FORUMREMOVED);
}
}
if ( isset($HTTP_POST_VARS['submit']) && !isset($HTTP_POST_VARS['save']) ) {
$sql = "SELECT * FROM ".$xoopsDB->prefix("bb_forums")." WHERE forum_id = $forum";
if ( !$result = $xoopsDB->query($sql) ) {
redirect_header("./index.php", 1);
exit();
}
if ( !$myrow = $xoopsDB->fetchArray($result) ) {
redirect_header("./index.php", 1, _MD_A_NOSUCHFORUM);
}
$name = $myts->makeTboxData4Edit($myrow['forum_name']);
$desc = $myts->makeTareaData4Edit($myrow['forum_desc']);
xoops_cp_header();
echo"
"
."";
echo ""._MD_A_FORUMCONF."";
?>
|
|
|
";
xoops_cp_footer();
exit();
}
if ( $row = $xoopsDB->fetchArray($r) ) {
do {
$s = "";
if ( $row['cat_id'] == $myrow['cat_id'] ) {
$s = "SELECTED";
}
echo "\n";
} while ( $row = $xoopsDB->fetchArray($r) );
} else {
echo "\n";
}
?>
Access Level: |
|
|
|
". _MD_A_ALLOWHTML ." | "._MD_A_YES.""._MD_A_NO ." |
". _MD_A_ALLOWSIGNATURES ." |
". _MD_A_YES ."". _MD_A_NO ." |
". _MD_A_HOTTOPICTHRESHOLD ." | |
". _MD_A_POSTPERPAGE ." ". _MD_A_TITNOPPTTWBDPPOT ." |
|
". _MD_A_TOPICPERFORUM ." ". _MD_A_TITNOTPFTWBDPPOAF ." | |
";
echo " |
";
echo "";
}
if ( !isset($HTTP_POST_VARS['submit']) && !isset($HTTP_POST_VARS['save']) ) {
xoops_cp_header();
echo""
."";
echo ""._MD_A_FORUMCONF."";
?>
|
";
xoops_cp_footer();
exit();
}
$sql2 = "UPDATE ".$xoopsDB->prefix("bb_categories")." SET cat_order = $current_order WHERE cat_id = $last_id";
if ( !$r = $xoopsDB->query($sql2) ) {
echo"";
xoops_cp_footer();
exit();
}
echo ""._MD_A_CATEGORYMOVEUP."
";
} else {
echo ""._MD_A_TCIATHU."
";
}
} else if ( isset($down) && $down != "" ) {
$sql = "SELECT cat_order FROM ".$xoopsDB->prefix("bb_categories")." ORDER BY cat_order DESC";
if ( !$r = $xoopsDB->query($sql,1,0) ) {
echo"";
xoops_cp_footer();
exit();
}
list($last_number) = $xoopsDB->fetchRow($r);
if ( $last_number != $current_order ) {
$order = $current_order + 1;
$sql = "UPDATE ".$xoopsDB->prefix("bb_categories")." SET cat_order = $current_order WHERE cat_order = $order";
if ( !$r = $xoopsDB->query($sql) ) {
echo"";
xoops_cp_footer();
exit();
}
$sql = "UPDATE ".$xoopsDB->prefix("bb_categories")." SET cat_order = $order where cat_id = $cat_id";
if ( !$r = $xoopsDB->query($sql) ) {
echo"";
xoops_cp_footer();
exit();
}
echo ""._MD_A_CATEGORYMOVEDOWN."
";
} else {
echo ""._MD_A_TCIATLD."
";
}
}
?>
"
."";
echo ""._MD_A_FORUMCONF."";
?>
|
";
xoops_cp_footer();
?>