/*************************************************************************** Jupiter Content System @ Jupiterportal.com Copyright (C) 2005 Cosmin Flavius (highstrike@gmail.com) 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. More Info About The Licence At http://www.gnu.org/copyleft/gpl.html ****************************************************************************/ //----------------------------------------------------------------- // Filter Acces Rightes //----------------------------------------------------------------- if(isset($is_guest) || isset($is_user) || isset($is_moderator)) { header("location: $PHP_SELF?i=2"); exit; } switch($a) { //----------------------------------------------------------------- // Categories Managment //----------------------------------------------------------------- case 1: //----------------------------------------------------------------- // Start second switch //----------------------------------------------------------------- switch($c) { //----------------------------------------------------------------- // Add New Category //----------------------------------------------------------------- case 1: //----------------------------------------------------------------- // Begin Check //----------------------------------------------------------------- if(!$name){ header("location: $PHP_SELF?n=modules/forum-admin&a=1&i=113"); exit; } $name = jcm_stripslashes($name); //----------------------------------------------------------------- // Make sure it adds +1 in succession after adding //----------------------------------------------------------------- $cats_db = $db->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['Admin name']} | ||
» {$language['Admin back']} |
= $language['Forum view admin desc'] ?> |
{$language['Forum view edit desc']} | ||
» {$language['Forum view edit desc2']} |
{$language['Admin name']} | ||
» {$language['Admin back']} |
{$language['Admin name']} | ||
» {$language['Admin back']} |