From ca716517676cff9e66ebd301bf771891d0cb0962 Mon Sep 17 00:00:00 2001 From: "Paul S. Owen" Date: Sat, 3 Aug 2002 23:52:33 +0000 Subject: Various updates git-svn-id: file:///svn/phpbb/trunk@2816 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/admin/admin_forums.php | 448 +++++++++++++++++++++++-------------------- 1 file changed, 238 insertions(+), 210 deletions(-) (limited to 'phpBB/admin/admin_forums.php') diff --git a/phpBB/admin/admin_forums.php b/phpBB/admin/admin_forums.php index 644bd7ebfb..ce5ad24541 100644 --- a/phpBB/admin/admin_forums.php +++ b/phpBB/admin/admin_forums.php @@ -1,6 +1,6 @@ get_acl_admin('forum') ) + { + return; + } + $file = basename(__FILE__); $module['Forums']['Manage'] = $file . $SID; return; } +define('IN_PHPBB', 1); // -// Load default header +// Include files // -$phpbb_root_path = "../"; +$phpbb_root_path = '../'; require($phpbb_root_path . 'extension.inc'); require('pagestart.' . $phpEx); include($phpbb_root_path . 'includes/functions_admin.'.$phpEx); -$forum_auth_ary = array( - "auth_view" => AUTH_ALL, - "auth_read" => AUTH_ALL, - "auth_post" => AUTH_ALL, - "auth_reply" => AUTH_ALL, - "auth_edit" => AUTH_REG, - "auth_delete" => AUTH_REG, - "auth_sticky" => AUTH_REG, - "auth_announce" => AUTH_MOD, - "auth_vote" => AUTH_REG, - "auth_pollcreate" => AUTH_REG -); - // -// Mode setting +// Do we have forum admin permissions? // -if( isset($HTTP_POST_VARS['mode']) || isset($HTTP_GET_VARS['mode']) ) -{ - $mode = ( isset($HTTP_POST_VARS['mode']) ) ? $HTTP_POST_VARS['mode'] : $HTTP_GET_VARS['mode']; -} -else +if ( !$acl->get_acl_admin('forum') ) { - $mode = ""; + message_die(MESSAGE, $lang['No_admin']); } -// ------------------ -// Begin function block // -function get_info($mode, $id) -{ - global $db; - - switch($mode) - { - case 'category': - $table = CATEGORIES_TABLE; - $idfield = 'cat_id'; - $namefield = 'cat_title'; - break; - - case 'forum': - $table = FORUMS_TABLE; - $idfield = 'forum_id'; - $namefield = 'forum_name'; - break; - - default: - message_die(GENERAL_ERROR, "Wrong mode for generating select list", "", __LINE__, __FILE__); - break; - } - $sql = "SELECT count(*) as total - FROM $table"; - if( !$result = $db->sql_query($sql) ) - { - message_die(GENERAL_ERROR, "Couldn't get Forum/Category information", "", __LINE__, __FILE__, $sql); - } - $count = $db->sql_fetchrow($result); - $count = $count['total']; - - $sql = "SELECT * - FROM $table - WHERE $idfield = $id"; - - if( !$result = $db->sql_query($sql) ) - { - message_die(GENERAL_ERROR, "Couldn't get Forum/Category information", "", __LINE__, __FILE__, $sql); - } - - if( $db->sql_numrows($result) != 1 ) - { - message_die(GENERAL_ERROR, "Forum/Category doesn't exist or multiple forums/categories with ID $id", "", __LINE__, __FILE__); - } - - $return = $db->sql_fetchrow($result); - $return['number'] = $count; - return $return; -} - -function get_list($mode, $id, $select) +// Mode setting +// +if ( isset($HTTP_POST_VARS['mode']) || isset($HTTP_GET_VARS['mode']) ) { - global $db; - - switch($mode) - { - case 'category': - $table = CATEGORIES_TABLE; - $idfield = 'cat_id'; - $namefield = 'cat_title'; - break; - - case 'forum': - $table = FORUMS_TABLE; - $idfield = 'forum_id'; - $namefield = 'forum_name'; - break; - - default: - message_die(GENERAL_ERROR, "Wrong mode for generating select list", "", __LINE__, __FILE__); - break; - } - - $sql = "SELECT * - FROM $table"; - if( $select == 0 ) - { - $sql .= " WHERE $idfield <> $id"; - } - - if( !$result = $db->sql_query($sql) ) - { - message_die(GENERAL_ERROR, "Couldn't get list of Categories/Forums", "", __LINE__, __FILE__, $sql); - } - - $cat_list = ""; - - while( $row = $db->sql_fetchrow($result) ) - { - $s = ""; - if ($row[$idfield] == $id) - { - $s = " selected=\"selected\""; - } - $catlist .= "\n"; - } - - return($catlist); + $mode = ( isset($HTTP_POST_VARS['mode']) ) ? $HTTP_POST_VARS['mode'] : $HTTP_GET_VARS['mode']; } - -function renumber_order($mode, $cat = 0) +else { - global $db; - - switch($mode) - { - case 'category': - $table = CATEGORIES_TABLE; - $idfield = 'cat_id'; - $orderfield = 'cat_order'; - $cat = 0; - break; - - case 'forum': - $table = FORUMS_TABLE; - $idfield = 'forum_id'; - $orderfield = 'forum_order'; - $catfield = 'cat_id'; - break; - - default: - message_die(GENERAL_ERROR, "Wrong mode for generating select list", "", __LINE__, __FILE__); - break; - } - - $sql = "SELECT * FROM $table"; - if( $cat != 0) - { - $sql .= " WHERE $catfield = $cat"; - } - $sql .= " ORDER BY $orderfield ASC"; - - - if( !$result = $db->sql_query($sql) ) - { - message_die(GENERAL_ERROR, "Couldn't get list of Categories", "", __LINE__, __FILE__, $sql); - } - - $i = 10; - $inc = 10; - - while( $row = $db->sql_fetchrow($result) ) - { - $sql = "UPDATE $table - SET $orderfield = $i - WHERE $idfield = " . $row[$idfield]; - if( !$db->sql_query($sql) ) - { - message_die(GENERAL_ERROR, "Couldn't update order fields", "", __LINE__, __FILE__, $sql); - } - $i += 10; - } - + $mode = ''; } -// -// End function block -// ------------------ // // Begin program proper // -if( isset($HTTP_POST_VARS['addforum']) || isset($HTTP_POST_VARS['addcategory']) ) +if ( isset($HTTP_POST_VARS['addforum']) || isset($HTTP_POST_VARS['addcategory']) ) { $mode = ( isset($HTTP_POST_VARS['addforum']) ) ? "addforum" : "addcat"; @@ -240,7 +77,7 @@ if( isset($HTTP_POST_VARS['addforum']) || isset($HTTP_POST_VARS['addcategory']) } } -if( !empty($mode) ) +if ( !empty($mode) ) { switch($mode) { @@ -831,6 +668,41 @@ if( !empty($mode) ) } } +page_header($lang['Manage']); + + +?> + +

Manage

+ +

Here you can add, edit, delete, lock, unlock individual forums as well as set certain additional controls. If your posts and topics have got out of sync you can also resynchronise a forum. In phpBB 2.2 there are no categories, everything is forum based. Each forum can have an unlimited number of sub-forums and you can determine whether each may be posted to or not (i.e. whether it acts like an old category).

+ +
+ + + + + + + + + + + + + + + + + + + + +
Forum Name   
   
  
+ +set_filenames(array( ); $template->assign_vars(array( - 'S_FORUM_ACTION' => append_sid("admin_forums.$phpEx"), + 'S_FORUM_ACTION' => "admin_forums.$phpEx$SID", 'L_FORUM_TITLE' => $lang['Forum_admin'], 'L_FORUM_EXPLAIN' => $lang['Forum_admin_explain'], 'L_CREATE_FORUM' => $lang['Create_forum'], @@ -854,22 +726,15 @@ $template->assign_vars(array( $sql = "SELECT cat_id, cat_title, cat_order FROM " . CATEGORIES_TABLE . " ORDER BY cat_order"; -if( !$q_categories = $db->sql_query($sql) ) -{ - message_die(GENERAL_ERROR, "Could not query categories list", "", __LINE__, __FILE__, $sql); -} +$q_categories = $db->sql_query($sql); -if( $total_categories = $db->sql_numrows($q_categories) ) +if ( $category_rows = $db->sql_fetchrowset($q_categories) ) { - $category_rows = $db->sql_fetchrowset($q_categories); $sql = "SELECT * FROM " . FORUMS_TABLE . " ORDER BY cat_id, forum_order"; - if(!$q_forums = $db->sql_query($sql)) - { - message_die(GENERAL_ERROR, "Could not query forums information", "", __LINE__, __FILE__, $sql); - } + $q_forums = $db->sql_query($sql); if( $total_forums = $db->sql_numrows($q_forums) ) { @@ -892,18 +757,18 @@ if( $total_categories = $db->sql_numrows($q_categories) ) 'CAT_ID' => $cat_id, 'CAT_DESC' => $category_rows[$i]['cat_title'], - 'U_CAT_EDIT' => append_sid("admin_forums.$phpEx?mode=editcat&" . POST_CAT_URL . "=$cat_id"), - 'U_CAT_DELETE' => append_sid("admin_forums.$phpEx?mode=deletecat&" . POST_CAT_URL . "=$cat_id"), - 'U_CAT_MOVE_UP' => append_sid("admin_forums.$phpEx?mode=cat_order&move=-15&" . POST_CAT_URL . "=$cat_id"), - 'U_CAT_MOVE_DOWN' => append_sid("admin_forums.$phpEx?mode=cat_order&move=15&" . POST_CAT_URL . "=$cat_id"), - 'U_VIEWCAT' => append_sid($phpbb_root_path."index.$phpEx?" . POST_CAT_URL . "=$cat_id")) + 'U_CAT_EDIT' => "admin_forums.$phpEx$SID&mode=editcat&c=$cat_id", + 'U_CAT_DELETE' => "admin_forums.$phpEx$SID&mode=deletecat&c=$cat_id", + 'U_CAT_MOVE_UP' => "admin_forums.$phpEx$SID&mode=cat_order&move=-15&c=$cat_id", + 'U_CAT_MOVE_DOWN' => "admin_forums.$phpEx$SID&mode=cat_order&move=15&c=$cat_id", + 'U_VIEWCAT' => $phpbb_root_path."index.$phpEx$SID&c=$cat_id") ); for($j = 0; $j < $total_forums; $j++) { $forum_id = $forum_rows[$j]['forum_id']; - if ($forum_rows[$j]['cat_id'] == $cat_id) + if ( $forum_rows[$j]['cat_id'] == $cat_id ) { $template->assign_block_vars("catrow.forumrow", array( @@ -913,12 +778,12 @@ if( $total_categories = $db->sql_numrows($q_categories) ) 'NUM_TOPICS' => $forum_rows[$j]['forum_topics'], 'NUM_POSTS' => $forum_rows[$j]['forum_posts'], - 'U_VIEWFORUM' => append_sid($phpbb_root_path."viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id"), - 'U_FORUM_EDIT' => append_sid("admin_forums.$phpEx?mode=editforum&" . POST_FORUM_URL . "=$forum_id"), - 'U_FORUM_DELETE' => append_sid("admin_forums.$phpEx?mode=deleteforum&" . POST_FORUM_URL . "=$forum_id"), - 'U_FORUM_MOVE_UP' => append_sid("admin_forums.$phpEx?mode=forum_order&move=-15&" . POST_FORUM_URL . "=$forum_id"), - 'U_FORUM_MOVE_DOWN' => append_sid("admin_forums.$phpEx?mode=forum_order&move=15&" . POST_FORUM_URL . "=$forum_id"), - 'U_FORUM_RESYNC' => append_sid("admin_forums.$phpEx?mode=forum_sync&" . POST_FORUM_URL . "=$forum_id")) + 'U_VIEWFORUM' => $phpbb_root_path."viewforum.$phpEx$SID&f=$forum_id", + 'U_FORUM_EDIT' => "admin_forums.$$SID&mode=editforum&f=$forum_id", + 'U_FORUM_DELETE' => "admin_forums.$phpEx$SID&mode=deleteforum&f=$forum_id", + 'U_FORUM_MOVE_UP' => "admin_forums.$phpEx$SID&mode=forum_order&move=-15&f=$forum_id", + 'U_FORUM_MOVE_DOWN' => "admin_forums.$phpEx$SID&mode=forum_order&move=15&f=$forum_id", + 'U_FORUM_RESYNC' => "admin_forums.$phpEx$SID&mode=forum_sync&f=$forum_id") ); }// if ... forumid == catid @@ -929,8 +794,171 @@ if( $total_categories = $db->sql_numrows($q_categories) ) }// if ... total_categories -$template->pparse("body"); +page_footer(); + +// +// END +// -include('page_footer_admin.'.$phpEx); +// ------------------ +// Begin function block +// +function get_info($mode, $id) +{ + global $db; -?> + switch($mode) + { + case 'category': + $table = CATEGORIES_TABLE; + $idfield = 'cat_id'; + $namefield = 'cat_title'; + break; + + case 'forum': + $table = FORUMS_TABLE; + $idfield = 'forum_id'; + $namefield = 'forum_name'; + break; + + default: + message_die(GENERAL_ERROR, "Wrong mode for generating select list", "", __LINE__, __FILE__); + break; + } + $sql = "SELECT count(*) as total + FROM $table"; + if( !$result = $db->sql_query($sql) ) + { + message_die(GENERAL_ERROR, "Couldn't get Forum/Category information", "", __LINE__, __FILE__, $sql); + } + $count = $db->sql_fetchrow($result); + $count = $count['total']; + + $sql = "SELECT * + FROM $table + WHERE $idfield = $id"; + + if( !$result = $db->sql_query($sql) ) + { + message_die(GENERAL_ERROR, "Couldn't get Forum/Category information", "", __LINE__, __FILE__, $sql); + } + + if( $db->sql_numrows($result) != 1 ) + { + message_die(GENERAL_ERROR, "Forum/Category doesn't exist or multiple forums/categories with ID $id", "", __LINE__, __FILE__); + } + + $return = $db->sql_fetchrow($result); + $return['number'] = $count; + return $return; +} + +function get_list($mode, $id, $select) +{ + global $db; + + switch($mode) + { + case 'category': + $table = CATEGORIES_TABLE; + $idfield = 'cat_id'; + $namefield = 'cat_title'; + break; + + case 'forum': + $table = FORUMS_TABLE; + $idfield = 'forum_id'; + $namefield = 'forum_name'; + break; + + default: + message_die(GENERAL_ERROR, "Wrong mode for generating select list", "", __LINE__, __FILE__); + break; + } + + $sql = "SELECT * + FROM $table"; + if( $select == 0 ) + { + $sql .= " WHERE $idfield <> $id"; + } + + if( !$result = $db->sql_query($sql) ) + { + message_die(GENERAL_ERROR, "Couldn't get list of Categories/Forums", "", __LINE__, __FILE__, $sql); + } + + $cat_list = ""; + + while( $row = $db->sql_fetchrow($result) ) + { + $s = ""; + if ($row[$idfield] == $id) + { + $s = " selected=\"selected\""; + } + $catlist .= "\n"; + } + + return($catlist); +} + +function renumber_order($mode, $cat = 0) +{ + global $db; + + switch($mode) + { + case 'category': + $table = CATEGORIES_TABLE; + $idfield = 'cat_id'; + $orderfield = 'cat_order'; + $cat = 0; + break; + + case 'forum': + $table = FORUMS_TABLE; + $idfield = 'forum_id'; + $orderfield = 'forum_order'; + $catfield = 'cat_id'; + break; + + default: + message_die(GENERAL_ERROR, "Wrong mode for generating select list", "", __LINE__, __FILE__); + break; + } + + $sql = "SELECT * FROM $table"; + if( $cat != 0) + { + $sql .= " WHERE $catfield = $cat"; + } + $sql .= " ORDER BY $orderfield ASC"; + + + if( !$result = $db->sql_query($sql) ) + { + message_die(GENERAL_ERROR, "Couldn't get list of Categories", "", __LINE__, __FILE__, $sql); + } + + $i = 10; + $inc = 10; + + while( $row = $db->sql_fetchrow($result) ) + { + $sql = "UPDATE $table + SET $orderfield = $i + WHERE $idfield = " . $row[$idfield]; + if( !$db->sql_query($sql) ) + { + message_die(GENERAL_ERROR, "Couldn't update order fields", "", __LINE__, __FILE__, $sql); + } + $i += 10; + } + +} +// +// End function block +// ------------------ + +?> \ No newline at end of file -- cgit v1.2.1