getTable("SELECT * FROM forum_cat ORDER by succession ASC"); foreach($cats_db as $idx=>$cat_id) $last_cat_order = $cat_id['succession']; $cat_order = $last_cat_order + 1; //----------------------------------------------------------------- // Add the cat //----------------------------------------------------------------- $db->insertRow("forum_cat",array('name' => ''.$name.'','succession' => ''.$cat_order.'')); //----------------------------------------------------------------- // Write Log //----------------------------------------------------------------- $db->insertRow("log",array('user_id' => ''.$_SESSION['id'].'','user_user' => ''.$_SESSION['username'].'','log' => ''.$language['Logs desc3'].' forum the category -> \''.$name.'\'','date' => ''.time().'')); //----------------------------------------------------------------- // Redirect when finished //----------------------------------------------------------------- header("location: $PHP_SELF?n=modules/forum-admin&a=1&i=114"); break; //----------------------------------------------------------------- // Edit Category //----------------------------------------------------------------- case 2: //----------------------------------------------------------------- // Begin Check //----------------------------------------------------------------- foreach($name as $idx=>$val) if(!$name[$idx]){ header("location: $PHP_SELF?n=modules/forum-admin&a=1&i=115"); exit; } //----------------------------------------------------------------- // Save the Links //----------------------------------------------------------------- foreach($succession as $idx=>$val) { //----------------------------------------------------------------- // Get Original category //----------------------------------------------------------------- $forum_cat = $db->getLine("SELECT * FROM forum_cat",$idx); //----------------------------------------------------------------- // Write Log //----------------------------------------------------------------- if($forum_cat['succession'] != $val) $db->insertRow("log",array('user_id' => ''.$_SESSION['id'].'','user_user' => ''.$_SESSION['username'].'','log' => ''.$language['Logs desc2'].' forum the category -> \''.$forum_cat['name'].'\' to succession \''.$val.'\'','date' => ''.time().'')); //----------------------------------------------------------------- // Write in DB //----------------------------------------------------------------- $db->query("Update `forum_cat` set `succession` = '$val' WHERE `id` = '$idx'"); } foreach($name as $idx=>$val) { //----------------------------------------------------------------- // Get Original category //----------------------------------------------------------------- $forum_cat = $db->getLine("SELECT * FROM forum_cat",$idx); //----------------------------------------------------------------- // Write Log //----------------------------------------------------------------- if($forum_cat['name'] != $val) $db->insertRow("log",array('user_id' => ''.$_SESSION['id'].'','user_user' => ''.$_SESSION['username'].'','log' => ''.$language['Logs desc2'].' forum the category\'s name -> \''.$forum_cat['name'].'\' to \''.$val.'\'','date' => ''.time().'')); //----------------------------------------------------------------- // Write in DB //----------------------------------------------------------------- $db->query("Update `forum_cat` set `name` = '$val' WHERE `id` = '$idx'"); } //----------------------------------------------------------------- // Redirect when finished //----------------------------------------------------------------- header("location: $PHP_SELF?n=modules/forum-admin&a=1&i=116"); break; //----------------------------------------------------------------- // Delete Category //----------------------------------------------------------------- case 3: //----------------------------------------------------------------- // Delete the Link //----------------------------------------------------------------- $forum_replies = $db->getTable("SELECT * FROM forum_replies WHERE cat = '$d'"); $forum_topics = $db->getTable("SELECT * FROM forum_topics WHERE cat = '$d'"); $forum_subcats = $db->getTable("SELECT * FROM forum_subcat WHERE cat = '$d'"); $forum_cat = $db->getLine("SELECT * FROM forum_cat WHERE id = '$d'"); foreach($forum_replies as $forum_reply) $db->deleteRow("forum_replies","cat = '$d'"); foreach($forum_topics as $forum_topic) $db->deleteRow("forum_topics","cat = '$d'"); foreach($forum_subcats as $forum_subcat) $db->deleteRow("forum_subcat","cat = '$d'"); $db->deleteRow("forum_cat","id = '$d'"); //----------------------------------------------------------------- // Write Log //----------------------------------------------------------------- $db->insertRow("log",array('user_id' => ''.$_SESSION['id'].'','user_user' => ''.$_SESSION['username'].'','log' => ''.$language['Logs desc'].' forum the category -> \''.$forum_cat['name'].'\'','date' => ''.time().'')); //----------------------------------------------------------------- // Redirect when finished //----------------------------------------------------------------- header("location: $PHP_SELF?n=modules/forum-admin&a=1&i=117"); break; //----------------------------------------------------------------- // View Categories Managment Form //----------------------------------------------------------------- default: $categories = $db->getTable("SELECT * FROM forum_cat ORDER by succession ASC"); if($categories != FALSE) { foreach($categories as $idx=>$category) { //----------------------------------------------------------------- // Make Layout //----------------------------------------------------------------- $layout .= " {$language[ "; } } //----------------------------------------------------------------- // Echo the back link //----------------------------------------------------------------- echo "
{$language['Admin name']}
» {$language['Admin back']}

"; ?>
'>


'>
getLine("SELECT * FROM forum_cat WHERE id = '$cat'"); //----------------------------------------------------------------- // Begin Check //----------------------------------------------------------------- if(!$name){ header("location: $PHP_SELF?n=modules/forum-admin&a=2&i=118"); exit; } $name = jcm_stripslashes($name); //----------------------------------------------------------------- // Make sure it adds +1 in succession after adding //----------------------------------------------------------------- $subcats_db = $db->getTable("SELECT * FROM forum_subcat WHERE cat = '$cat' ORDER BY succession ASC"); foreach($subcats_db as $idx=>$subcat_id) $last_subcat_order = $subcat_id['succession']; $subcat_order = $last_subcat_order + 1; //----------------------------------------------------------------- // Add the cat //----------------------------------------------------------------- $db->insertRow("forum_subcat",array('cat' => ''.$cat.'','name' => ''.$name.'','succession' => ''.$subcat_order.'')); //----------------------------------------------------------------- // Write Log //----------------------------------------------------------------- $db->insertRow("log",array('user_id' => ''.$_SESSION['id'].'','user_user' => ''.$_SESSION['username'].'','log' => ''.$language['Logs desc3'].' forum the subcategory -> \''.$name.'\' to \''.$forum_cat['name'].'\'','date' => ''.time().'')); //----------------------------------------------------------------- // Redirect when finished //----------------------------------------------------------------- header("location: $PHP_SELF?n=modules/forum-admin&a=2&i=119"); break; //----------------------------------------------------------------- // Save Subcategories succession //----------------------------------------------------------------- case 2: //----------------------------------------------------------------- // Save the Links //----------------------------------------------------------------- foreach($succession as $idx=>$val) { //----------------------------------------------------------------- // Get Original category //----------------------------------------------------------------- $forum_subcat = $db->getLine("SELECT * FROM forum_subcat",$idx); //----------------------------------------------------------------- // Write Log //----------------------------------------------------------------- if($forum_subcat['succession'] != $val) $db->insertRow("log",array('user_id' => ''.$_SESSION['id'].'','user_user' => ''.$_SESSION['username'].'','log' => ''.$language['Logs desc2'].' forum the subcategory -> \''.$forum_subcat['name'].'\' to succession \''.$val.'\'','date' => ''.time().'')); //----------------------------------------------------------------- // Write in DB //----------------------------------------------------------------- $db->query("Update `forum_subcat` set `succession` = '$val' WHERE `id` = '$idx'"); } //----------------------------------------------------------------- // Redirect when finished //----------------------------------------------------------------- header("location: $PHP_SELF?n=modules/forum-admin&a=2&i=120"); break; //----------------------------------------------------------------- // Edit Subcategory //----------------------------------------------------------------- case 3: //----------------------------------------------------------------- // Load Database //----------------------------------------------------------------- $cats = $db->getTable("SELECT * FROM forum_cat"); $subcat = $db->getLine("SELECT * FROM forum_subcat WHERE id = '$d'"); //----------------------------------------------------------------- // Start Edit Nav //----------------------------------------------------------------- switch($k) { //----------------------------------------------------------------- // Do the Edit //----------------------------------------------------------------- case 1: //----------------------------------------------------------------- // Get Original category and subcategory //----------------------------------------------------------------- $forum_cat = $db->getLine("SELECT * FROM forum_cat",$cat); $forum_subcat = $db->getLine("SELECT * FROM forum_subcat",$subcat['id']); //----------------------------------------------------------------- // Start Checks //----------------------------------------------------------------- if(!$name){ header("location: $PHP_SELF?n=modules/forum-admin&a=2&c=3&d=$d&i=121"); exit; } if($subcat['type'] == 5) { if(!$redirect_location){ header("location: $PHP_SELF?n=modules/forum-admin&a=2&c=3&d=$d&i=122"); exit; }} $name = jcm_stripslashes($name); $description = jcm_stripslashes($description); //----------------------------------------------------------------- // Write in Database //----------------------------------------------------------------- $tmp['name'] = $name; $tmp['cat'] = $cat; $tmp['type'] = $type; $tmp['description'] = $description; if($subcat['type'] == 5) { $tmp['redirect_location'] = $redirect_location; } $db->updateRow("forum_subcat",$tmp,"id={$subcat['id']}"); //----------------------------------------------------------------- // Write Log //----------------------------------------------------------------- if($type == 1) $type_text = "Open"; if($type == 2) $type_text = "News"; if($type == 3) $type_text = "Admin"; if($type == 4) $type_text = "Locked"; if($type == 5) $type_text = "Redirected"; if($forum_subcat['name'] != $name) $db->insertRow("log",array('user_id' => ''.$_SESSION['id'].'','user_user' => ''.$_SESSION['username'].'','log' => ''.$language['Logs desc2'].' forum the subcategory\'s name -> \''.$forum_subcat['name'].'\' to \''.$name.'\'','date' => ''.time().'')); if($forum_subcat['cat'] != $cat) $db->insertRow("log",array('user_id' => ''.$_SESSION['id'].'','user_user' => ''.$_SESSION['username'].'','log' => ''.$language['Logs desc2'].' forum the subcategory\'s cat -> \''.$forum_subcat['name'].'\' moved to \''.$forum_cat['name'].'\'','date' => ''.time().'')); if($forum_subcat['type'] != $type) $db->insertRow("log",array('user_id' => ''.$_SESSION['id'].'','user_user' => ''.$_SESSION['username'].'','log' => ''.$language['Logs desc2'].' forum the subcategory\'s type -> \''.$forum_subcat['name'].'\' to \''.$type_text.'\'','date' => ''.time().'')); if($subcat['type'] == 5) if($forum_subcat['redirect_location'] != $redirect_location) $db->insertRow("log",array('user_id' => ''.$_SESSION['id'].'','user_user' => ''.$_SESSION['username'].'','log' => ''.$language['Logs desc2'].' forum the subcategory\'s redirect location -> \''.$forum_subcat['name'].'\' to \''.$redirect_location.'\'','date' => ''.time().'')); if($forum_subcat['description'] != $description) $db->insertRow("log",array('user_id' => ''.$_SESSION['id'].'','user_user' => ''.$_SESSION['username'].'','log' => ''.$language['Logs desc2'].' forum the subcategory\'s description -> \''.$forum_subcat['name'].'\'','date' => ''.time().'')); //----------------------------------------------------------------- // Redirect when finished //----------------------------------------------------------------- header("location: $PHP_SELF?n=modules/forum-admin&a=2&c=3&d=$d&i=123"); break; //----------------------------------------------------------------- // View Edit Form //----------------------------------------------------------------- default: //----------------------------------------------------------------- // Echo the back link //----------------------------------------------------------------- echo "
{$language['Forum view edit desc']}
» {$language['Forum view edit desc2']}

"; ?>
[]
'>
'>
getLine("SELECT * FROM forum_subcat",$d); //----------------------------------------------------------------- // Delete the Link //----------------------------------------------------------------- $forum_replies = $db->getTable("SELECT * FROM forum_replies WHERE subcat = '$d'"); $forum_topics = $db->getTable("SELECT * FROM forum_topics WHERE subcat = '$d'"); foreach($forum_replies as $forum_reply) $db->deleteRow("forum_replies","subcat = '$d'"); foreach($forum_topics as $forum_topic) $db->deleteRow("forum_topics","subcat = '$d'"); $db->deleteRow("forum_subcat","id = '$d'"); //----------------------------------------------------------------- // Write Log //----------------------------------------------------------------- $db->insertRow("log",array('user_id' => ''.$_SESSION['id'].'','user_user' => ''.$_SESSION['username'].'','log' => ''.$language['Logs desc'].' forum the subcategory -> \''.$forum_subcat['name'].'\'','date' => ''.time().'')); //----------------------------------------------------------------- // Redirect when finished //----------------------------------------------------------------- header("location: $PHP_SELF?n=modules/forum-admin&a=2&i=124"); break; //----------------------------------------------------------------- // View Subcategories Managment Form //----------------------------------------------------------------- default: //----------------------------------------------------------------- // Code for Subcats //----------------------------------------------------------------- $categories = $db->getTable("SELECT c.id AS cid, c.succession AS csuccession, c.name AS cname, s.id AS sid, s.succession AS ssuccession, s.name AS sname FROM forum_cat AS c LEFT JOIN forum_subcat AS s ON s.cat=c.id ORDER by c.succession ASC, s.succession ASC"); $cur_category = 0; $cat_count = 0; if($categories != FALSE) { foreach($categories as $idx=>$cat) { if($cat['cid'] != $cur_category) { if ($cur_category != 0) $layout .= "
"; $cat_count++; //----------------------------------------------------------------- // Make Layout //----------------------------------------------------------------- $layout .= " "; $cur_category = $cat['cid']; } if($cat['sid'] != FALSE) { //----------------------------------------------------------------- // Make Layout //----------------------------------------------------------------- $layout .= " "; } else $layout .= ""; } if($cur_category > 0) $layout .= "
{$cat['cname']}
{$language['Forum view subcat desc']}{$language['Forum view subcat desc2']}
{$cat['sname']} {$language[{$language[
{$language['Forum view subcat desc3']}

"; } //----------------------------------------------------------------- // Echo the back link //----------------------------------------------------------------- echo "
{$language['Admin name']}
» {$language['Admin back']}

"; //----------------------------------------------------------------- // View Form //----------------------------------------------------------------- if($categories != FALSE) { ?>
'>

' tabindex='3'>
getTable("SELECT id FROM forum_topics WHERE date < '$prune_date'"); foreach($forum_topics as $forum_topic) { $forum_replies = $db->getTable("SELECT id FROM forum_replies WHERE topic = '{$forum_topic['id']}'"); foreach($forum_replies as $forum_reply) $db->deleteRow("forum_replies","id = '{$forum_reply['id']}'"); $db->deleteRow("forum_topics","id = '{$forum_topic['id']}'"); } //----------------------------------------------------------------- // Take care of subcats information //----------------------------------------------------------------- $forum_subcats = $db->getTable("SELECT id FROM forum_subcat"); foreach($forum_subcats as $forum_subcat) { $forum_topics_after = $db->getInfo_countRows("forum_topics","subcat = '{$forum_subcat['id']}' AND type != '3'"); if($forum_topics_after == 0) { $db->updateRow("forum_subcat",array('lastpost_location' => NULL, 'lastpost_date' => NULL, 'lastpost_reg' => NULL, 'lastpost_id' => NULL, 'lastpost_user' => NULL, 'lastpost_email' => NULL),"id = '{$forum_subcat['id']}'"); } else { $forum_topics_intact = $db->getLine("SELECT * FROM forum_topics WHERE subcat = '{$forum_subcat['id']}' ORDER BY id DESC LIMIT 1"); $last_info['lastpost_location'] = $forum_topics_intact['lastpost_location']; $last_info['lastpost_date'] = $forum_topics_intact['lastpost_date']; $last_info['lastpost_reg'] = $forum_topics_intact['lastpost_reg']; $last_info['lastpost_id'] = $forum_topics_intact['lastpost_id']; $last_info['lastpost_user'] = $forum_topics_intact['lastpost_user']; $last_info['lastpost_email'] = $forum_topics_intact['lastpost_email']; $db->updateRow("forum_subcat",$last_info,"id = '{$forum_subcat['id']}'"); } $check_replies = $db->getInfo_countRows("forum_replies","subcat = '{$forum_subcat['id']}'"); $db->updateRow("forum_subcat",array('topics' => ''.$forum_topics_after.'', 'replies' => ''.$check_replies.''),"id = '{$forum_subcat['id']}'"); } //----------------------------------------------------------------- // Write Log //----------------------------------------------------------------- $db->insertRow("log",array('user_id' => ''.$_SESSION['id'].'','user_user' => ''.$_SESSION['username'].'','log' => ''.$language['Logs desc2'].' forum prune -> \'all subcategories\' since '.today_yesterday($prune_date).'','date' => ''.time().'')); } else { //----------------------------------------------------------------- // Count all topics and Delete topics and the posts from Database //----------------------------------------------------------------- $forum_topics = $db->getTable("SELECT id FROM forum_topics WHERE subcat = '$subcats' AND date < '$prune_date'"); foreach($forum_topics as $forum_topic) { $forum_replies = $db->getTable("SELECT id FROM forum_replies WHERE subcat = '$subcats' AND topic = '{$forum_topic['id']}'"); foreach($forum_replies as $forum_reply) $db->deleteRow("forum_replies","subcat = '$subcats' AND id = '{$forum_reply['id']}'"); $db->deleteRow("forum_topics","subcat = '$subcats' AND id = '{$forum_topic['id']}'"); } //----------------------------------------------------------------- // Take care of subcats information //----------------------------------------------------------------- $forum_topics_after = $db->getInfo_countRows("forum_topics","subcat = '$subcats' AND type != '3'"); if($forum_topics_after == 0) { $db->updateRow("forum_subcat",array('lastpost_location' => NULL, 'lastpost_date' => NULL, 'lastpost_reg' => NULL, 'lastpost_id' => NULL, 'lastpost_user' => NULL, 'lastpost_email' => NULL),"id = '$subcats'"); } else { $forum_topics_intact = $db->getLine("SELECT * FROM forum_topics WHERE subcat = '$subcats' ORDER BY id DESC LIMIT 1"); $last_info['lastpost_location'] = $forum_topics_intact['lastpost_location']; $last_info['lastpost_date'] = $forum_topics_intact['lastpost_date']; $last_info['lastpost_reg'] = $forum_topics_intact['lastpost_reg']; $last_info['lastpost_id'] = $forum_topics_intact['lastpost_id']; $last_info['lastpost_user'] = $forum_topics_intact['lastpost_user']; $last_info['lastpost_email'] = $forum_topics_intact['lastpost_email']; $db->updateRow("forum_subcat",$last_info,"id = '$subcats'"); } $check_replies = $db->getInfo_countRows("forum_replies","subcat = '$subcats'"); $db->updateRow("forum_subcat",array('topics' => ''.$forum_topics_after.'', 'replies' => ''.$check_replies.''),"id = '$subcats'"); //----------------------------------------------------------------- // Write Log //----------------------------------------------------------------- $forum_subcat = $db->getLine("SELECT name FROM forum_subcat WHERE id = '$subcats'"); $db->insertRow("log",array('user_id' => ''.$_SESSION['id'].'','user_user' => ''.$_SESSION['username'].'','log' => ''.$language['Logs desc2'].' forum prune -> \''.$forum_subcat['name'].'\' since '.today_yesterday($prune_date).'','date' => ''.time().'')); } //----------------------------------------------------------------- // Redirect when finished //----------------------------------------------------------------- header("location: $PHP_SELF?n=modules/forum-admin&a=3&i=126"); break; //----------------------------------------------------------------- // View Prune Form //----------------------------------------------------------------- default: //----------------------------------------------------------------- // Load Database //----------------------------------------------------------------- $forum_cats = $db->getTable("SELECT * FROM forum_cat ORDER BY succession ASC"); //----------------------------------------------------------------- // Echo the back link //----------------------------------------------------------------- echo "
{$language['Admin name']}
» {$language['Admin back']}

"; //----------------------------------------------------------------- // Display Layout //----------------------------------------------------------------- ?>

insertRow("forum_ranks",array('name' => ''.$name.'','posts' => ''.$posts.'')); //----------------------------------------------------------------- // Write Log //----------------------------------------------------------------- $db->insertRow("log",array('user_id' => ''.$_SESSION['id'].'','user_user' => ''.$_SESSION['username'].'','log' => ''.$language['Logs desc3'].' forum the rank -> \''.$name.'\' at \''.$posts.'\' posts','date' => ''.time().'')); //----------------------------------------------------------------- // Redirect when finished //----------------------------------------------------------------- header("location: $PHP_SELF?n=modules/forum-admin&a=4&i=129"); break; //----------------------------------------------------------------- // Delete Rank //----------------------------------------------------------------- case 2: //----------------------------------------------------------------- // Get Original rank //----------------------------------------------------------------- $forum_rank = $db->getLine("SELECT * FROM forum_ranks",$d); //----------------------------------------------------------------- // Delete the rank //----------------------------------------------------------------- $db->deleteRow("forum_ranks","id = '$d'"); //----------------------------------------------------------------- // Write Log //----------------------------------------------------------------- $db->insertRow("log",array('user_id' => ''.$_SESSION['id'].'','user_user' => ''.$_SESSION['username'].'','log' => ''.$language['Logs desc'].' forum the rank -> \''.$forum_rank['name'].'\'','date' => ''.time().'')); //----------------------------------------------------------------- // Redirect when finished //----------------------------------------------------------------- header("location: $PHP_SELF?n=modules/forum-admin&a=4&i=130"); break; //----------------------------------------------------------------- // Update Ranks //----------------------------------------------------------------- case 3: //----------------------------------------------------------------- // Begin Check //----------------------------------------------------------------- foreach($name as $idx=>$val) if(!$name[$idx]){ header("location: $PHP_SELF?n=modules/forum-admin&a=4&i=131"); exit; } foreach($posts as $idx=>$val) if(!$posts[$idx]){ header("location: $PHP_SELF?n=modules/forum-admin&a=4&i=132"); exit; } //----------------------------------------------------------------- // Save the ranks //----------------------------------------------------------------- foreach($name as $idx=>$val) { //----------------------------------------------------------------- // Get Original rank //----------------------------------------------------------------- $forum_rank = $db->getLine("SELECT * FROM forum_ranks",$idx); //----------------------------------------------------------------- // Write Log //----------------------------------------------------------------- if($forum_rank['name'] != $val) $db->insertRow("log",array('user_id' => ''.$_SESSION['id'].'','user_user' => ''.$_SESSION['username'].'','log' => ''.$language['Logs desc2'].' forum the rank\'s name -> \''.$forum_rank['name'].'\' to \''.$val.'\'','date' => ''.time().'')); //----------------------------------------------------------------- // Write in DB //----------------------------------------------------------------- $db->query("Update `forum_ranks` set `name` = '$val' WHERE `id` = '$idx'"); } foreach($posts as $idx=>$val) { //----------------------------------------------------------------- // Get Original rank //----------------------------------------------------------------- $forum_rank = $db->getLine("SELECT * FROM forum_ranks",$idx); //----------------------------------------------------------------- // Write Log //----------------------------------------------------------------- if($forum_rank['posts'] != $val) $db->insertRow("log",array('user_id' => ''.$_SESSION['id'].'','user_user' => ''.$_SESSION['username'].'','log' => ''.$language['Logs desc2'].' forum the rank\'s posts -> \''.$forum_rank['name'].'\' to \''.$val.'\'','date' => ''.time().'')); //----------------------------------------------------------------- // Write in DB //----------------------------------------------------------------- $db->query("Update `forum_ranks` set `posts` = '$val' WHERE `id` = '$idx'"); } //----------------------------------------------------------------- // Redirect when finished //----------------------------------------------------------------- header("location: $PHP_SELF?n=modules/forum-admin&a=4&i=133"); break; //----------------------------------------------------------------- // View Ranks Form //----------------------------------------------------------------- default: $ranks_db = $db->getTable("SELECT * FROM forum_ranks ORDER BY posts ASC"); if($ranks_db != FALSE) { foreach($ranks_db as $idx=>$rank) { //----------------------------------------------------------------- // Make Layout //----------------------------------------------------------------- $layout .= " {$language[ "; } } else $layout .= "{$language['Forum view rank desc']}"; //----------------------------------------------------------------- // Echo the back link //----------------------------------------------------------------- echo "
{$language['Admin name']}
» {$language['Admin back']}

"; ?>
'>


' tabindex='3'>