aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/admin/admin_forums.php
diff options
context:
space:
mode:
authorBart van Bragt <bartvb@users.sourceforge.net>2001-09-03 17:16:34 +0000
committerBart van Bragt <bartvb@users.sourceforge.net>2001-09-03 17:16:34 +0000
commit5206e124cc42bf60a074eb09c37c13a45b672aaf (patch)
tree3ac4148769a66c158f65029d63f8da9263200385 /phpBB/admin/admin_forums.php
parent7d0d488f252eb6e1ed535490109e8677c1bec2d3 (diff)
downloadforums-5206e124cc42bf60a074eb09c37c13a45b672aaf.tar
forums-5206e124cc42bf60a074eb09c37c13a45b672aaf.tar.gz
forums-5206e124cc42bf60a074eb09c37c13a45b672aaf.tar.bz2
forums-5206e124cc42bf60a074eb09c37c13a45b672aaf.tar.xz
forums-5206e124cc42bf60a074eb09c37c13a45b672aaf.zip
Reshuffled some things, removed some debugging
git-svn-id: file:///svn/phpbb/trunk@978 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/admin/admin_forums.php')
-rw-r--r--phpBB/admin/admin_forums.php291
1 files changed, 150 insertions, 141 deletions
diff --git a/phpBB/admin/admin_forums.php b/phpBB/admin/admin_forums.php
index e2040213cc..506534b30d 100644
--- a/phpBB/admin/admin_forums.php
+++ b/phpBB/admin/admin_forums.php
@@ -217,12 +217,83 @@ if(isset($mode)) // Are we supposed to do something?
{
switch($mode)
{
- case 'forum_sync':
- sync('forum', $HTTP_GET_VARS['forum_id']);
- $show_index = TRUE;
+ case 'addforum':
+ case 'editforum':
+ // Show form to create/modify a forum
+ if ($mode == 'editforum')
+ {
+ // $newmode determines if we are going to INSERT or UPDATE after posting?
+ $newmode = 'modforum';
+ $buttonvalue = 'Change';
+
+ $forum_id = $HTTP_GET_VARS['forum_id'];
+
+ $row = get_info('forum', $forum_id);
+ $forumname = $row['forum_name'];
+ $cat_id = $row['cat_id'];
+ $forumdesc = $row['forum_desc'];
+ $forumstatus = $row['forum_status'];
+ //
+ // start forum prune stuff.
+ //
+ if( $row['prune_enable'] == 1 )
+ {
+ $prune_enabled = "checked=\"checked\"";
+ $sql = "SELECT *
+ FROM " . PRUNE_TABLE . "
+ WHERE forum_id = $forum_id";
+ if(!$pr_result = $db->sql_query($sql))
+ {
+ message_die(GENERAL_ERROR, "Auto-Prune: Couldn't read auto_prune table.", __LINE__, __FILE__);
+ }
+ $pr_row = $db->sql_fetchrow($pr_result);
+ }
+ }
+ else
+ {
+ $newmode = 'createforum';
+ $buttonvalue = 'Create';
+
+ $forumname = stripslashes($HTTP_POST_VARS['forumname']);
+ $cat_id = $HTTP_POST_VARS['cat_id'];
+ $forumdesc = '';
+ $forumstatus = FORUM_UNLOCKED;
+ $forum_id = '';
+ }
+
+ $catlist = get_list('category', $cat_id, TRUE);
+
+ $forumstatus == FORUM_LOCKED ? $forumlocked = "selected=\"selected\"" : $forumunlocked = "selected=\"selected\"";
+ $statuslist = "<option value=\"".FORUM_UNLOCKED."\" $forumunlocked>Unlocked</option>\n";
+ $statuslist .= "<option value=\"".FORUM_LOCKED."\" $forumlocked>Locked</option>\n";
+
+ $template->set_filenames(array(
+ "body" => "admin/forum_edit_body.tpl")
+ );
+ $template->assign_vars(array(
+ 'FORUMNAME' => $forumname,
+ 'DESCRIPTION' => $forumdesc,
+ 'S_FORUM_ACTION' => $PHP_SELF,
+ 'S_CATLIST' => $catlist,
+ 'S_STATUSLIST' => $statuslist,
+ 'S_FORUMID' => $forum_id,
+ 'S_NEWMODE' => $newmode,
+ 'S_PRUNE_EN' => $prune_enabled,
+ 'S_PRUNE_DAYS' => $pr_row['prune_days'],
+ 'S_PRUNE_FREQ' => $pr_row['prune_freq'],
+ 'L_ENABLED' => $lang['Enabled'],
+ 'L_PRUNE_DAYS' => $lang['prune_days'],
+ 'L_PRUNE_FREQ' => $lang['prune_freq'],
+ 'L_DAYS' => $lang['days'],
+ 'BUTTONVALUE' => $buttonvalue)
+ );
+ $template->pparse("body");
break;
- case 'createforum': // Create a forum in the DB
+
+
+ case 'createforum':
+ // Create a forum in the DB
$sql = "SELECT MAX(forum_order) AS max_order
FROM " . FORUMS_TABLE . "
WHERE cat_id = " . $HTTP_POST_VARS['cat_id'];
@@ -262,7 +333,8 @@ if(isset($mode)) // Are we supposed to do something?
$show_index = TRUE;
break;
- case 'modforum': // Modify a forum in the DB
+ case 'modforum':
+ // Modify a forum in the DB
if( $HTTP_POST_VARS['prune_enable'] != 1)
{
$HTTP_POST_VARS['prune_enable'] = 0;
@@ -309,8 +381,9 @@ if(isset($mode)) // Are we supposed to do something?
}
$show_index = TRUE;
break;
-
+
case 'addcat':
+ // Create a category in the DB
$sql = "SELECT MAX(cat_order) AS max_order
FROM " . CATEGORIES_TABLE;
if( !$result = $db->sql_query($sql) )
@@ -334,80 +407,9 @@ if(isset($mode)) // Are we supposed to do something?
$show_index = TRUE;
break;
-
- case 'addforum':
- case 'editforum':
- if ($mode == 'editforum')
- {
- // $newmode determines if we are going to INSERT or UPDATE after posting?
- $newmode = 'modforum';
- $buttonvalue = 'Change';
-
- $forum_id = $HTTP_GET_VARS['forum_id'];
-
- $row = get_info('forum', $forum_id);
- $forumname = $row['forum_name'];
- $cat_id = $row['cat_id'];
- $forumdesc = $row['forum_desc'];
- $forumstatus = $row['forum_status'];
- //
- // start forum prune stuff.
- //
- if( $row['prune_enable'] == 1 )
- {
- $prune_enabled = "checked=\"checked\"";
- $sql = "SELECT *
- FROM " . PRUNE_TABLE . "
- WHERE forum_id = $forum_id";
- if(!$pr_result = $db->sql_query($sql))
- {
- message_die(GENERAL_ERROR, "Auto-Prune: Couldn't read auto_prune table.", __LINE__, __FILE__);
- }
- $pr_row = $db->sql_fetchrow($pr_result);
- }
- }
- else
- {
- $newmode = 'createforum';
- $buttonvalue = 'Create';
-
- $forumname = stripslashes($HTTP_POST_VARS['forumname']);
- $cat_id = $HTTP_POST_VARS['cat_id'];
- $forumdesc = '';
- $forumstatus = FORUM_UNLOCKED;
- $forum_id = '';
- }
-
- $catlist = get_list('category', $cat_id, TRUE);
-
- $forumstatus == FORUM_LOCKED ? $forumlocked = "selected=\"selected\"" : $forumunlocked = "selected=\"selected\"";
- $statuslist = "<option value=\"".FORUM_UNLOCKED."\" $forumunlocked>Unlocked</option>\n";
- $statuslist .= "<option value=\"".FORUM_LOCKED."\" $forumlocked>Locked</option>\n";
-
- $template->set_filenames(array(
- "body" => "admin/forum_edit_body.tpl")
- );
- $template->assign_vars(array(
- 'FORUMNAME' => $forumname,
- 'DESCRIPTION' => $forumdesc,
- 'S_FORUM_ACTION' => $PHP_SELF,
- 'S_CATLIST' => $catlist,
- 'S_STATUSLIST' => $statuslist,
- 'S_FORUMID' => $forum_id,
- 'S_NEWMODE' => $newmode,
- 'S_PRUNE_EN' => $prune_enabled,
- 'S_PRUNE_DAYS' => $pr_row['prune_days'],
- 'S_PRUNE_FREQ' => $pr_row['prune_freq'],
- 'L_ENABLED' => $lang['Enabled'],
- 'L_PRUNE_DAYS' => $lang['prune_days'],
- 'L_PRUNE_FREQ' => $lang['prune_freq'],
- 'L_DAYS' => $lang['days'],
- 'BUTTONVALUE' => $buttonvalue)
- );
- $template->pparse("body");
- break;
-
+
case 'editcat':
+ // Show form to edit a category
$newmode = 'modcat';
$buttonvalue = 'Change';
@@ -428,6 +430,7 @@ if(isset($mode)) // Are we supposed to do something?
break;
case 'modcat':
+ // Modify a category in the DB
$sql = "UPDATE " . CATEGORIES_TABLE . "
SET cat_title = '" . $HTTP_POST_VARS['cat_title'] . "'
WHERE cat_id = " . $HTTP_POST_VARS['cat_id'];
@@ -435,17 +438,38 @@ if(isset($mode)) // Are we supposed to do something?
{
message_die(GENERAL_ERROR, "Couldn't update forum information", "", __LINE__, __FILE__, $sql);
}
- print "Modforum: ". $HTTP_POST_VARS['forumname']." sql= <pre>$sql</pre>";
$show_index = TRUE;
break;
+
+ case 'deleteforum':
+ // Show form to delete a forum
+ $forum_id = $HTTP_GET_VARS['forum_id'];
+ $to_ids = get_list('forum', $forum_id, 0);
+ $buttonvalue = "Move&Delete";
+ $newmode = 'movedelforum';
+ $foruminfo = get_info('forum', $forum_id);
+ $name = $foruminfo['forum_name'];
+
+ $template->set_filenames(array(
+ "body" => "admin/forum_delete_body.tpl")
+ );
+ $template->assign_vars(array(
+ 'NAME' => $name,
+ 'S_FORUM_ACTION' => $PHP_SELF,
+ 'S_FROM_ID' => $forum_id,
+ 'S_TO_IDS' => $to_ids,
+ 'S_NEWMODE' => $newmode,
+ 'BUTTONVALUE' => $buttonvalue)
+ );
+ $template->pparse("body");
+ break;
case 'movedelforum':
+ // Move or delete a forum in the DB
$from_id = $HTTP_POST_VARS['from_id'];
$to_id = $HTTP_POST_VARS['to_id'];
$delete_old = $HTTP_POST_VARS['delete_old'];
- print "move '$from_id' to '$to_id'";
-
$sql = "SELECT *
FROM " . FORUMS_TABLE . "
WHERE forum_id IN ($from_id, $to_id)";
@@ -492,11 +516,34 @@ if(isset($mode)) // Are we supposed to do something?
$show_index = TRUE;
break;
+
+ case 'deletecat':
+ // Show form to delete a category
+ $cat_id = $HTTP_GET_VARS['cat_id'];
+ $to_ids = get_list('category', $cat_id, 0);
+ $buttonvalue = "Move&Delete";
+ $newmode = 'movedelcat';
+ $catinfo = get_info('category', $cat_id);
+ $name = $catinfo['cat_title'];
+
+ $template->set_filenames(array(
+ "body" => "admin/forum_delete_body.tpl")
+ );
+ $template->assign_vars(array(
+ 'NAME' => $name,
+ 'S_FORUM_ACTION' => $PHP_SELF,
+ 'S_FROM_ID' => $cat_id,
+ 'S_TO_IDS' => $to_ids,
+ 'S_NEWMODE' => $newmode,
+ 'BUTTONVALUE' => $buttonvalue)
+ );
+ $template->pparse("body");
+ break;
case 'movedelcat':
+ // Move or delete a category in the DB
$from_id = $HTTP_POST_VARS['from_id'];
$to_id = $HTTP_POST_VARS['to_id'];
- print "move '$from_id' to '$to_id'";
$sql = "SELECT *
FROM " . CATEGORIES_TABLE . "
@@ -528,53 +575,26 @@ if(isset($mode)) // Are we supposed to do something?
$show_index = TRUE;
break;
- case 'deletecat':
- print "Deletecat";
- $cat_id = $HTTP_GET_VARS['cat_id'];
- $to_ids = get_list('category', $cat_id, 0);
- $buttonvalue = "Move&Delete";
- $newmode = 'movedelcat';
- $catinfo = get_info('category', $cat_id);
- $name = $catinfo['cat_title'];
-
- $template->set_filenames(array(
- "body" => "admin/forum_delete_body.tpl")
- );
- $template->assign_vars(array(
- 'NAME' => $name,
- 'S_FORUM_ACTION' => $PHP_SELF,
- 'S_FROM_ID' => $cat_id,
- 'S_TO_IDS' => $to_ids,
- 'S_NEWMODE' => $newmode,
- 'BUTTONVALUE' => $buttonvalue)
- );
- $template->pparse("body");
- break;
-
- case 'deleteforum':
- print 'Deleteforum';
+ case 'forum_order':
+ // Change order of forums in the DB
+ $move = $HTTP_GET_VARS['move'];
$forum_id = $HTTP_GET_VARS['forum_id'];
- $to_ids = get_list('forum', $forum_id, 0);
- $buttonvalue = "Move&Delete";
- $newmode = 'movedelforum';
- $foruminfo = get_info('forum', $forum_id);
- $name = $foruminfo['forum_name'];
+ $forum_info = get_info('forum', $forum_id);
+ $cat_id = $forum_info['cat_id'];
- $template->set_filenames(array(
- "body" => "admin/forum_delete_body.tpl")
- );
- $template->assign_vars(array(
- 'NAME' => $name,
- 'S_FORUM_ACTION' => $PHP_SELF,
- 'S_FROM_ID' => $forum_id,
- 'S_TO_IDS' => $to_ids,
- 'S_NEWMODE' => $newmode,
- 'BUTTONVALUE' => $buttonvalue)
- );
- $template->pparse("body");
+ $sql = "UPDATE " . FORUMS_TABLE . "
+ SET forum_order = forum_order + $move
+ WHERE forum_id = $forum_id";
+ if( !$result = $db->sql_query($sql) )
+ {
+ message_die(GENERAL_ERROR, "Couldn't change category order", "", __LINE__, __FILE__, $sql);
+ }
+ renumber_order('forum', $forum_info['cat_id']);
+ $show_index = TRUE;
break;
-
+
case 'cat_order':
+ // Change order of categories in the DB
$move = $HTTP_GET_VARS['move'];
$cat_id = $HTTP_GET_VARS['cat_id'];
@@ -589,25 +609,14 @@ if(isset($mode)) // Are we supposed to do something?
$show_index = TRUE;
break;
- case 'forum_order':
- $move = $HTTP_GET_VARS['move'];
- $forum_id = $HTTP_GET_VARS['forum_id'];
- $forum_info = get_info('forum', $forum_id);
- $cat_id = $forum_info['cat_id'];
-
- $sql = "UPDATE " . FORUMS_TABLE . "
- SET forum_order = forum_order + $move
- WHERE forum_id = $forum_id";
- if( !$result = $db->sql_query($sql) )
- {
- message_die(GENERAL_ERROR, "Couldn't change category order", "", __LINE__, __FILE__, $sql);
- }
- renumber_order('forum', $forum_info['cat_id']);
+ case 'forum_sync':
+ sync('forum', $HTTP_GET_VARS['forum_id']);
$show_index = TRUE;
break;
default:
- print "Oops! Wrong mode..";
+ message_die(GENERAL_ERROR, "Oops! Wrong mode..");
+ break;
}
if ($show_index != TRUE)
{