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_database.php | 142 ++++++------ phpBB/admin/admin_email.php | 10 +- phpBB/admin/admin_forums.php | 448 ++++++++++++++++++++------------------ phpBB/admin/admin_permissions.php | 47 ++-- phpBB/admin/admin_prune.php | 10 +- phpBB/admin/admin_prune_users.php | 6 +- phpBB/admin/admin_search.php | 6 +- phpBB/admin/admin_smilies.php | 42 ++-- phpBB/admin/admin_styles.php | 52 ++--- phpBB/admin/admin_users.php | 46 ++-- phpBB/admin/admin_viewlogs.php | 4 +- phpBB/admin/admin_words.php | 30 ++- 12 files changed, 421 insertions(+), 422 deletions(-) (limited to 'phpBB/admin') diff --git a/phpBB/admin/admin_database.php b/phpBB/admin/admin_database.php index 2a5c36ab82..2fde6824d9 100644 --- a/phpBB/admin/admin_database.php +++ b/phpBB/admin/admin_database.php @@ -18,17 +18,9 @@ * (at your option) any later version. * ***************************************************************************/ - -/*************************************************************************** -* We will attempt to create a file based backup of all of the data in the -* users phpBB database. The resulting file should be able to be imported by -* the db_restore.php function, or by using the mysql command_line -* -* Some functions are adapted from the upgrade_20.php script and others -* adapted from the unoficial phpMyAdmin 2.2.0. -***************************************************************************/ - -define('IN_PHPBB', 1); +// +// Some functions are adapted phpMyAdmin 2.2.0. +// if ( !empty($setmodules) ) { @@ -38,26 +30,29 @@ if ( !empty($setmodules) ) } $filename = basename(__FILE__); - $module['DB']['DB_Backup'] = $filename . "$SID&perform=backup"; + $module['DB']['DB_Backup'] = $filename . "$SID&mode=backup"; $file_uploads = @ini_get('file_uploads'); if( ( $file_uploads != 0 || empty($file_uploads) ) && strtolower($file_uploads) != 'off' && @phpversion() != '4.0.4pl1' ) { - $module['DB']['DB_Restore'] = $filename . "$SID&perform=restore"; + $module['DB']['DB_Restore'] = $filename . "$SID&mode=restore"; } return; } +define('IN_PHPBB', 1); // // Load default header // -$no_page_header = TRUE; -$phpbb_root_path = "../"; +$phpbb_root_path = '../'; require($phpbb_root_path . 'extension.inc'); require('pagestart.' . $phpEx); include($phpbb_root_path . 'includes/functions_admin.'.$phpEx); +// +// +// if ( !$acl->get_acl_admin('general') ) { message_die(MESSAGE, $lang['No_admin']); @@ -73,11 +68,11 @@ if ( !$acl->get_acl_admin('general') ) // Begin program proper // -if ( isset($HTTP_GET_VARS['perform']) || isset($HTTP_POST_VARS['perform']) ) +if ( isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode']) ) { - $perform = ( isset($HTTP_POST_VARS['perform']) ) ? $HTTP_POST_VARS['perform'] : $HTTP_GET_VARS['perform']; + $mode = ( isset($HTTP_POST_VARS['mode']) ) ? $HTTP_POST_VARS['mode'] : $HTTP_GET_VARS['mode']; - switch($perform) + switch($mode) { case 'backup': @@ -96,77 +91,73 @@ if ( isset($HTTP_GET_VARS['perform']) || isset($HTTP_POST_VARS['perform']) ) break; } - include('page_header_admin.'.$phpEx); - - $template->assign_vars(array( - "MESSAGE_TITLE" => $lang['Information'], - "MESSAGE_TEXT" => $lang['Backups_not_supported']) - ); - + message_die(MESSAGE, $lang['Backups_not_supported']); break; } - $tables = array('auth_access', 'banlist', 'categories', 'config', 'disallow', 'forums', 'forum_prune', 'groups', 'posts', 'posts_text', 'privmsgs', 'privmsgs_text', 'ranks', 'search_results', 'search_results', 'search_wordlist', 'search_wordmatch', 'sessions', 'smilies', 'themes', 'themes_name', 'topics', 'topics_watch', 'user_group', 'users', 'vote_desc', 'vote_results', 'vote_voters', 'words'); + $tables = array('search_wordlist', 'search_wordmatch', 'auth_access', 'banlist', 'categories', 'config', 'disallow', 'forums', 'forum_prune', 'groups', 'posts', 'posts_text', 'privmsgs', 'privmsgs_text', 'ranks', 'search_results', 'search_results', 'sessions', 'smilies', 'themes', 'themes_name', 'topics', 'topics_watch', 'user_group', 'users', 'vote_desc', 'vote_results', 'vote_voters', 'words'); + + $additional_tables = ( isset($HTTP_POST_VARS['additional_tables']) ) ? $HTTP_POST_VARS['additional_tables'] : ( ( isset($HTTP_GET_VARS['additional_tables']) ) ? $HTTP_GET_VARS['additional_tables'] : '' ); - $additional_tables = (isset($HTTP_POST_VARS['additional_tables'])) ? $HTTP_POST_VARS['additional_tables'] : ( ( isset($HTTP_GET_VARS['additional_tables']) ) ? $HTTP_GET_VARS['additional_tables'] : "" ); + $backup_type = ( isset($HTTP_POST_VARS['backup_type']) ) ? $HTTP_POST_VARS['backup_type'] : ( ( isset($HTTP_GET_VARS['backup_type']) ) ? $HTTP_GET_VARS['backup_type'] : '' ); - $backup_type = (isset($HTTP_POST_VARS['backup_type'])) ? $HTTP_POST_VARS['backup_type'] : ( ( isset($HTTP_GET_VARS['backup_type']) ) ? $HTTP_GET_VARS['backup_type'] : "" ); + $ignoresearch = ( !empty($HTTP_POST_VARS['ignoresearch']) ) ? $HTTP_POST_VARS['ignoresearch'] : ( ( !empty($HTTP_GET_VARS['ignoresearch']) ) ? $HTTP_GET_VARS['ignoresearch'] : 0 ); - $gzipcompress = (!empty($HTTP_POST_VARS['gzipcompress'])) ? $HTTP_POST_VARS['gzipcompress'] : ( ( !empty($HTTP_GET_VARS['gzipcompress']) ) ? $HTTP_GET_VARS['gzipcompress'] : 0 ); + $gzipcompress = ( !empty($HTTP_POST_VARS['gzipcompress']) ) ? $HTTP_POST_VARS['gzipcompress'] : ( ( !empty($HTTP_GET_VARS['gzipcompress']) ) ? $HTTP_GET_VARS['gzipcompress'] : 0 ); if ( !empty($additional_tables) ) { - if ( ereg(",", $additional_tables)) - { - $additional_tables = split(",", $additional_tables); + $additional_tables = explode(', ', $additional_tables); - for($i = 0; $i < count($additional_tables); $i++) - { - $tables[] = trim($additional_tables[$i]); - } - - } - else + for($i = 0; $i < count($additional_tables); $i++) { - $tables[] = trim($additional_tables); + $tables[] = trim($additional_tables[$i]); } + unset($additional_tables); } if ( !isset($HTTP_POST_VARS['backupstart']) && !isset($HTTP_GET_VARS['backupstart'])) { - $s_hidden_fields = ''; + $s_hidden_fields = ''; - page_header($lang['DB']); + page_header($lang['DB_Backup']); ?>

-
"> +">
- - + + - - + + - - - - - - + + + - + + @@ -180,7 +171,7 @@ if ( isset($HTTP_GET_VARS['perform']) || isset($HTTP_POST_VARS['perform']) ) else if ( !isset($HTTP_POST_VARS['startdownload']) && !isset($HTTP_GET_VARS['startdownload']) ) { $template->assign_vars(array( - "META" => "", + "META" => "", "MESSAGE_TITLE" => $lang['Database_Utilities'] . " : " . $lang['Backup'], "MESSAGE_TEXT" => $lang['Backup_download']) @@ -229,14 +220,15 @@ if ( isset($HTTP_GET_VARS['perform']) || isset($HTTP_POST_VARS['perform']) ) echo "#\n# DATE : " . gmdate("d-m-Y H:i:s", time()) . " GMT\n"; echo "#\n"; - if(SQL_LAYER == 'postgresql') + if ( SQL_LAYER == 'postgresql' ) { echo "\n" . pg_get_sequences("\n", $backup_type); } + for($i = 0; $i < count($tables); $i++) { $table_name = $tables[$i]; - if(SQL_LAYER != 'mysql4') + if ( SQL_LAYER != 'mysql4' ) { $table_def_function = "get_table_def_" . SQL_LAYER; $table_content_function = "get_table_content_" . SQL_LAYER; @@ -247,19 +239,19 @@ if ( isset($HTTP_GET_VARS['perform']) || isset($HTTP_POST_VARS['perform']) ) $table_content_function = "get_table_content_mysql"; } - if($backup_type != 'data') + if ( $backup_type != 'data' ) { echo "#\n# TABLE: " . $table_prefix . $table_name . "\n#\n"; echo $table_def_function($table_prefix . $table_name, "\n") . "\n"; } - if($backup_type != 'structure') + if ( $backup_type != 'structure' ) { $table_content_function($table_prefix . $table_name, "output_table_content"); } } - if($do_gzip_compress) + if ( $do_gzip_compress ) { $Size = ob_get_length(); $Crc = crc32(ob_get_contents()); @@ -275,9 +267,9 @@ if ( isset($HTTP_GET_VARS['perform']) || isset($HTTP_POST_VARS['perform']) ) if ( !isset($restore_start) ) { - $s_hidden_fields = ''; + $s_hidden_fields = ''; - page_header($lang['DB']); + page_header($lang['DB_Restore']); ?> @@ -285,14 +277,21 @@ if ( isset($HTTP_GET_VARS['perform']) || isset($HTTP_POST_VARS['perform']) )

-">
     

  

    
+">
+ + - + + - + + -
:
    :
+ + + + - - - - - - \ No newline at end of file diff --git a/phpBB/admin/admin_email.php b/phpBB/admin/admin_email.php index 6c99d61fe1..e1e6af523d 100644 --- a/phpBB/admin/admin_email.php +++ b/phpBB/admin/admin_email.php @@ -116,7 +116,7 @@ if ( isset($HTTP_POST_VARS['submit']) ) $email_headers .= 'X-AntiAbuse: Board servername - ' . $server_name . "\n"; $email_headers .= 'X-AntiAbuse: User_id - ' . $userdata['user_id'] . "\n"; $email_headers .= 'X-AntiAbuse: Username - ' . $userdata['username'] . "\n"; - $email_headers .= 'X-AntiAbuse: User IP - ' . $user_ip . "\r\n"; + $email_headers .= 'X-AntiAbuse: User IP - ' . $user_ip . "\n"; $emailer->use_template('admin_send_email'); $emailer->email_address($board_config['board_email']); @@ -132,9 +132,7 @@ if ( isset($HTTP_POST_VARS['submit']) ) $emailer->send(); $emailer->reset(); - $message = $lang['Email_sent'] . '

' . sprintf($lang['Click_return_admin_index'], '', ''); - - message_die(MESSAGE, $message); + message_die(MESSAGE, $lang['Email_sent']); } } @@ -157,11 +155,11 @@ if ( $row = $db->sql_fetchrow($result) ) } $select_list .= ''; -page_header($lang['Users']); +page_header($lang['Mass_Email']); ?> -

+

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 diff --git a/phpBB/admin/admin_permissions.php b/phpBB/admin/admin_permissions.php index 96b5ab711f..9230f63828 100644 --- a/phpBB/admin/admin_permissions.php +++ b/phpBB/admin/admin_permissions.php @@ -29,6 +29,7 @@ if ( !empty($setmodules) ) $filename = basename(__FILE__); $module['Forums']['Permissions'] = $filename . $SID . '&mode=forums'; $module['Forums']['Moderators'] = $filename . $SID . '&mode=moderators'; + $module['Forums']['Super_Moderators'] = $filename . $SID . '&mode=supermoderators'; $module['General']['Administrators'] = $filename . $SID . '&mode=administrators'; return; @@ -60,7 +61,7 @@ if ( isset($HTTP_GET_VARS['f']) || isset($HTTP_POST_VARS['f']) ) } else { - unset($forum_id); + $forum_id = 0; $forum_sql = ''; } @@ -81,6 +82,11 @@ switch ( $mode ) $l_title_explain = $lang['Moderators_explain']; $l_can = '_can'; break; + case 'supermoderators': + $l_title = $lang['Super_Moderators']; + $l_title_explain = $lang['Super_Moderators_explain']; + $l_can = '_can'; + break; case 'administrators': $l_title = $lang['Administrators']; $l_title_explain = $lang['Administrators_explain']; @@ -93,12 +99,15 @@ if ( isset($HTTP_POST_VARS['update']) ) switch ( $HTTP_POST_VARS['type'] ) { case 'group': - $acl->set_acl(15, false, 7530, $HTTP_POST_VARS['option']); + foreach ( $HTTP_POST_VARS['entries'] as $group_id ) + { + $acl->set_acl($forum_id, false, $group_id, $HTTP_POST_VARS['option']); + } break; case 'user': foreach ( $HTTP_POST_VARS['entries'] as $user_id ) { - $acl->set_acl(intval($HTTP_POST_VARS['f']), $user_id, false, $HTTP_POST_VARS['option']); + $acl->set_acl($forum_id, $user_id, false, $HTTP_POST_VARS['option']); } break; } @@ -109,7 +118,7 @@ if ( isset($HTTP_POST_VARS['update']) ) // no id was specified or just the requsted if it // was // -if ( !empty($forum_id) || $mode == 'administrators' ) +if ( !empty($forum_id) || $mode == 'administrators' || $mode == 'supermoderators' ) { // // Clear some vars, grab some info if relevant ... @@ -139,29 +148,30 @@ if ( !empty($forum_id) || $mode == 'administrators' )

+

+ sql_fetchrow($result) ) { - $group_list .= ''; + $group_list .= ''; } $db->sql_freeresult($result); @@ -189,7 +199,7 @@ if ( !empty($forum_id) || $mode == 'administrators' ) -
"> +
">sql_fetchrow($result) ) { - $groups .= ''; + $groups .= ''; } $db->sql_freeresult($result); @@ -287,7 +297,7 @@ if ( !empty($forum_id) || $mode == 'administrators' ) else { - $sql = "SELECT auth_option + $sql = "SELECT auth_option_id, auth_option FROM " . ACL_OPTIONS_TABLE . " WHERE auth_type LIKE '$type_sql'"; $result = $db->sql_query($sql); @@ -332,10 +342,11 @@ if ( !empty($forum_id) || $mode == 'administrators' ) $auth = array(); while ( $row = $db->sql_fetchrow($result) ) { - $ug_test = ( $row['name'] == 'ADMINISTRATORS' ) ? $lang['Admin_group'] : $row['name']; + $ug_test = ( !empty($lang[$row['name']]) ) ? $lang[$row['name']] : $row['name']; $ug .= ( !strstr($ug, $ug_test) ) ? $ug_test . "\n" : ''; + $ug_test = ''; - $ug_hidden = ( !strstr($ug_hidden, $ug_test) ) ? $ug_test : ''; + $ug_hidden .= ( !strstr($ug_hidden, $ug_test) ) ? $ug_test : ''; $auth[$row['auth_option']] = ( isset($auth_group[$row['auth_option']]) ) ? min($auth_group[$row['auth_option']], $row['auth_allow_deny']) : $row['auth_allow_deny']; } @@ -363,8 +374,8 @@ if ( !empty($forum_id) || $mode == 'administrators' ) ?> - - + +

+

+ ">
/> /> /> />
diff --git a/phpBB/admin/admin_prune.php b/phpBB/admin/admin_prune.php index 1660749a1f..f1b531cb7d 100644 --- a/phpBB/admin/admin_prune.php +++ b/phpBB/admin/admin_prune.php @@ -122,7 +122,7 @@ if ( isset($HTTP_POST_VARS['doprune']) ) } else { - page_header($lang['Forums']); + page_header($lang['Prune']); // // If they haven't selected a forum for pruning yet then @@ -145,7 +145,7 @@ else

-">
+">
@@ -174,7 +174,7 @@ else

-">
+">
@@ -191,10 +191,6 @@ else } } -// -// Actually output the page here. -// - page_footer(); ?> \ No newline at end of file diff --git a/phpBB/admin/admin_prune_users.php b/phpBB/admin/admin_prune_users.php index 211288083b..1169c4415d 100644 --- a/phpBB/admin/admin_prune_users.php +++ b/phpBB/admin/admin_prune_users.php @@ -69,7 +69,7 @@ if ( isset($HTTP_POST_VARS['prune']) ) { $values = array('prune', 'deactivate', 'delete', 'users', 'username', 'email', 'joined_select', 'active_select', 'count_select', 'joined', 'active', 'count', 'deleteposts'); - $l_message = '' . $lang['Confirm_prune_users'] . '

  '; + $l_message = '' . $lang['Confirm_prune_users'] . '

  '; foreach ( $values as $field ) { @@ -92,7 +92,7 @@ if ( isset($HTTP_POST_VARS['prune']) ) page_footer(); } - else if ( isset($HTTP_POST_VARS['yes']) ) + else if ( isset($HTTP_POST_VARS['confirm']) ) { if ( !empty($HTTP_POST_VARS['users']) ) { @@ -192,7 +192,7 @@ if ( isset($HTTP_POST_VARS['prune']) ) unset($user_ids); unset($usernames); - } + } message_die(MESSAGE, $lang['Success_user_prune']); } diff --git a/phpBB/admin/admin_search.php b/phpBB/admin/admin_search.php index 998955d401..9adfa2cae4 100644 --- a/phpBB/admin/admin_search.php +++ b/phpBB/admin/admin_search.php @@ -295,7 +295,7 @@ if ( isset($HTTP_POST_VARS['start']) || isset($HTTP_GET_VARS['batchstart']) ) WHERE config_name = 'board_disable'"; $db->sql_query($sql); - page_header($lang['DB']); + page_header($lang['Search_indexing']); ?> @@ -319,7 +319,7 @@ else if ( isset($HTTP_POST_VARS['cancel']) ) WHERE config_name = 'board_disable'"; $db->sql_query($sql); - page_header($lang['DB']); + page_header($lang['Search_indexing']); ?> @@ -334,7 +334,7 @@ else if ( isset($HTTP_POST_VARS['cancel']) ) } else { - page_header($lang['DB']); + page_header($lang['Search_indexing']); ?> diff --git a/phpBB/admin/admin_smilies.php b/phpBB/admin/admin_smilies.php index 7f212425a3..c930c3edc8 100644 --- a/phpBB/admin/admin_smilies.php +++ b/phpBB/admin/admin_smilies.php @@ -19,9 +19,6 @@ * ***************************************************************************/ -// -// First we do the setmodules stuff for the admin cp. -// if ( !empty($setmodules) ) { if ( !$acl->get_acl_admin('general') ) @@ -30,25 +27,27 @@ if ( !empty($setmodules) ) } $filename = basename(__FILE__); - $module['General']['Emoticons'] = $filename . $SID . "&mode=emoticons"; + $module['General']['Emoticons'] = $filename . $SID . '&mode=emoticons'; return; } define('IN_PHPBB', 1); +// +// Include files +// $phpbb_root_path = '../'; require($phpbb_root_path . 'extension.inc'); require('pagestart.' . $phpEx); // -// +// Do we have general permissions? // if ( !$acl->get_acl_admin('general') ) { message_die(MESSAGE, $lang['No_admin']); } - // // Check to see what mode we should operate in. // @@ -70,11 +69,11 @@ $dir = @opendir($phpbb_root_path . $board_config['smilies_path']); while( $file = @readdir($dir) ) { - if ( !is_dir($phpbb_root_path . $board_config['smilies_path'] . '/' . $file) ) + if ( is_file($phpbb_root_path . $board_config['smilies_path'] . '/' . $file) ) { $img_size = @getimagesize($phpbb_root_path . $board_config['smilies_path'] . '/' . $file); - if( $img_size[0] && $img_size[1] ) + if ( $img_size[0] && $img_size[1] ) { $smiley_images[] = $file; } @@ -97,14 +96,14 @@ if ( isset($HTTP_GET_VARS['import_pack']) || isset($HTTP_POST_VARS['import_pack' // $smile_pak = ( isset($HTTP_POST_VARS['smile_pak']) ) ? $HTTP_POST_VARS['smile_pak'] : $HTTP_GET_VARS['smile_pak']; $clear_current = ( isset($HTTP_POST_VARS['clear_current']) ) ? $HTTP_POST_VARS['clear_current'] : $HTTP_GET_VARS['clear_current']; - $replace_existing = ( isset($HTTP_POST_VARS['replace']) ) ? $HTTP_POST_VARS['replace'] : $HTTP_GET_VARS['replace']; + $replace_existing = ( isset($HTTP_POST_VARS['replace']) ) ? intval($HTTP_POST_VARS['replace']) : intval($HTTP_GET_VARS['replace']); if ( !empty($smile_pak) ) { // // The user has already selected a smile_pak file.. Import it. // - if( !empty($clear_current) ) + if ( !empty($clear_current) ) { $sql = "DELETE FROM " . SMILIES_TABLE; @@ -141,13 +140,12 @@ if ( isset($HTTP_GET_VARS['import_pack']) || isset($HTTP_POST_VARS['import_pack' // // Replace > and < with the proper html_entities for matching. // - $smile_data[$j] = str_replace("<", "<", $smile_data[$j]); - $smile_data[$j] = str_replace(">", ">", $smile_data[$j]); + $smile_data[$j] = htmlentities($smile_data[$j]); $k = $smile_data[$j]; - if( $smiles[$k] == 1 ) + if ( $smiles[$k] == 1 ) { - if( !empty($replace_existing) ) + if ( !empty($replace_existing) ) { $sql = "UPDATE " . SMILIES_TABLE . " SET smile_url = '" . str_replace("\'", "''", $smile_data[0]) . "', emoticon = '" . str_replace("\'", "''", $smile_data[1]) . "' @@ -171,7 +169,7 @@ if ( isset($HTTP_GET_VARS['import_pack']) || isset($HTTP_POST_VARS['import_pack' } } - message_die(GENERAL_MESSAGE, $lang['smiley_import_success']); + message_die(MESSAGE, $lang['smiley_import_success']); } else @@ -180,7 +178,8 @@ if ( isset($HTTP_GET_VARS['import_pack']) || isset($HTTP_POST_VARS['import_pack' // Display the script to get the smile_pak cfg file... // $smile_paks_select = " - + diff --git a/phpBB/admin/admin_styles.php b/phpBB/admin/admin_styles.php index d46f61fedd..afe37454c4 100644 --- a/phpBB/admin/admin_styles.php +++ b/phpBB/admin/admin_styles.php @@ -197,7 +197,7 @@ switch ( $mode ) { $tpl = substr($file, 0, strpos($file, '.')); $selected = ( $tplname == $tpl ) ? ' selected="selected"' : ''; - $tplname_options .= ''; + $tplname_options .= ''; } } closedir($dp); @@ -217,7 +217,7 @@ switch ( $mode )

:  

-
<?php echo htmlspecialchars($row['code']); ?><?php echo htmlspecialchars($row['code']); ?> "> ">
+
@@ -242,7 +242,7 @@ switch ( $mode ) case 'edittheme': - $theme_id = ( isset($HTTP_POST_VARS['theme_id']) ) ? $HTTP_POST_VARS['theme_id'] : ''; + $theme_id = ( isset($HTTP_POST_VARS['themeroot']) ) ? $HTTP_POST_VARS['themeroot'] : ''; if ( isset($HTTP_POST_VARS['update']) ) { @@ -256,9 +256,9 @@ switch ( $mode ) $theme_name = $row['theme_name']; $css_data = ( !empty($HTTP_POST_VARS['css_data']) ) ? htmlentities($HTTP_POST_VARS['css_data']) : ''; - $css_external = ( !empty($HTTP_POST_VARS['css_external']) ) ? $HTTP_POST_VARS['css_external'] : ''; + $css_external = ( !empty($HTTP_POST_VARS['css_data']) ) ? $HTTP_POST_VARS['css_data'] : ''; - $sql = "UPDATE " . STYLES_CSS_TABLE . " + $sql = "UPDATE " > STYLES_CSS_TABLE . " SET css_data = '$css_data', css_external = '$css_external' WHERE theme_id = $theme_id"; $db->sql_query($sql); @@ -285,24 +285,9 @@ switch ( $mode ) while ( $row = $db->sql_fetchrow($result) ); } $db->sql_freeresult($result); - -?> - -"> - -

- -

- -
- - - - - - - + +"> + +

+ +

+ +
:  
+ + + @@ -329,14 +327,6 @@ switch ( $mode )
:  
:
- - - sql_fetchrow($result) ) { $selected = ( $tplroot == $row['template_path'] ) ? ' selected="selected"' : ''; - $tplroot_options .= ''; + $tplroot_options .= ''; } return $tplroot_options; diff --git a/phpBB/admin/admin_users.php b/phpBB/admin/admin_users.php index 1562c65476..378636dbd9 100644 --- a/phpBB/admin/admin_users.php +++ b/phpBB/admin/admin_users.php @@ -1012,42 +1012,28 @@ if ( $mode == 'edit' || $mode == 'save' && ( isset($HTTP_POST_VARS['username']) } else { - // - // Default user selection box - // - $sql = "SELECT user_id, username - FROM " . USERS_TABLE . " - WHERE user_id <> " . ANONYMOUS ." - ORDER BY username"; - $result = $db->sql_query($sql); - - $select_list = ''; - $template->set_filenames(array( - 'body' => 'admin/user_select_body.tpl') - ); + page_header($lang['Manage']); - $template->assign_vars(array( - 'L_USER_TITLE' => $lang['User_admin'], - 'L_USER_EXPLAIN' => $lang['User_admin_explain'], - 'L_USER_SELECT' => $lang['Select_a_User'], - 'L_LOOK_UP' => $lang['Look_up_user'], - 'L_FIND_USERNAME' => $lang['Find_username'], +?> - 'U_SEARCH_USER' => "../search.$phpEx$SID&mode=searchuser", +

- 'S_USER_ACTION' => "admin_users.$phpEx$SID", - 'S_USER_SELECT' => $select_list) - ); - $template->display('body'); +

+ +
"> + + + + + + +
', '_phpbbsearch', 'HEIGHT=500,resizable=yes,scrollbars=yes,WIDTH=650');return false;" />
+ + \ No newline at end of file diff --git a/phpBB/admin/admin_viewlogs.php b/phpBB/admin/admin_viewlogs.php index c31e04fa47..e09a98030f 100644 --- a/phpBB/admin/admin_viewlogs.php +++ b/phpBB/admin/admin_viewlogs.php @@ -181,7 +181,7 @@ page_header($l_title);

-
"> +"> - +
: :
'; } - page_header($lang['General']); + page_header($lang['Words_title']); ?> @@ -106,7 +106,7 @@ if( $mode != '' )

-"> +">
@@ -128,7 +128,7 @@ if( $mode != '' ) break; case 'save': - $word_id = ( isset($HTTP_POST_VARS['id']) ) ? $HTTP_POST_VARS['id'] : 0; + $word_id = ( isset($HTTP_POST_VARS['id']) ) ? intval($HTTP_POST_VARS['id']) : 0; $word = ( isset($HTTP_POST_VARS['word']) ) ? trim($HTTP_POST_VARS['word']) : ''; $replacement = ( isset($HTTP_POST_VARS['replacement']) ) ? trim($HTTP_POST_VARS['replacement']) : ''; @@ -144,8 +144,6 @@ if( $mode != '' ) add_admin_log($log_action, stripslashes($word)); $message = ( $word_id ) ? $lang['Word_updated'] : $lang['Word_added']; - $message .= '

' . sprintf($lang['Click_return_wordadmin'], '', '') . '

' . sprintf($lang['Click_return_admin_index'], '', ''); - message_die(MESSAGE, $message); break; @@ -153,7 +151,7 @@ if( $mode != '' ) if ( isset($HTTP_POST_VARS['id']) || isset($HTTP_GET_VARS['id']) ) { - $word_id = ( isset($HTTP_POST_VARS['id']) ) ? $HTTP_POST_VARS['id'] : $HTTP_GET_VARS['id']; + $word_id = ( isset($HTTP_POST_VARS['id']) ) ? intval($HTTP_POST_VARS['id']) : intval($HTTP_GET_VARS['id']); } else { @@ -166,9 +164,7 @@ if( $mode != '' ) add_admin_log('log_delete_word'); - $message = $lang['Word_removed'] . '

' . sprintf($lang['Click_return_wordadmin'], '', '') . '

' . sprintf($lang['Click_return_admin_index'], '', ''); - - message_die(MESSAGE, $message); + message_die(MESSAGE, $lang['Word_removed']); break; } @@ -176,7 +172,7 @@ if( $mode != '' ) else { - page_header($lang['General']); + page_header($lang['Words_title']); ?> @@ -184,7 +180,7 @@ else

-">
+">
@@ -202,14 +198,14 @@ else { do { - $cell_bg = ( $cell_bg == 'row1' ) ? 'row2' : 'row1'; + $row_class = ( $row_class == 'row1' ) ? 'row2' : 'row1'; ?> - - - - + + + +
 ">  ">  ">  ">