diff options
Diffstat (limited to 'phpBB/admin')
-rw-r--r-- | phpBB/admin/admin_board.php | 9 | ||||
-rw-r--r-- | phpBB/admin/admin_db_utilities.php | 195 | ||||
-rw-r--r-- | phpBB/admin/admin_forum_prune.php | 45 | ||||
-rw-r--r-- | phpBB/admin/admin_forumauth.php | 71 | ||||
-rw-r--r-- | phpBB/admin/admin_forums.php | 127 | ||||
-rw-r--r-- | phpBB/admin/admin_groupauth.php | 183 | ||||
-rw-r--r-- | phpBB/admin/admin_groups.php | 53 | ||||
-rw-r--r-- | phpBB/admin/admin_smilies.php | 49 | ||||
-rw-r--r-- | phpBB/admin/admin_user_ban.php | 111 | ||||
-rw-r--r-- | phpBB/admin/admin_userauth.php | 209 | ||||
-rw-r--r-- | phpBB/admin/admin_users.php | 77 | ||||
-rw-r--r-- | phpBB/admin/index.php | 101 | ||||
-rw-r--r-- | phpBB/admin/page_footer_admin.php | 25 | ||||
-rw-r--r-- | phpBB/admin/page_header_admin.php | 39 | ||||
-rw-r--r-- | phpBB/admin/pagestart.inc | 9 |
15 files changed, 719 insertions, 584 deletions
diff --git a/phpBB/admin/admin_board.php b/phpBB/admin/admin_board.php index a053d0807d..6094330008 100644 --- a/phpBB/admin/admin_board.php +++ b/phpBB/admin/admin_board.php @@ -11,6 +11,15 @@ * ***************************************************************************/ +/*************************************************************************** + * + * 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. + * + ***************************************************************************/ + if($setmodules == 1) { $file = basename(__FILE__); diff --git a/phpBB/admin/admin_db_utilities.php b/phpBB/admin/admin_db_utilities.php index 6ba089ae7b..f512b6622a 100644 --- a/phpBB/admin/admin_db_utilities.php +++ b/phpBB/admin/admin_db_utilities.php @@ -1,16 +1,25 @@ <?php /*************************************************************************** -* admin_db_utilities.php +* admin_db_utilities.php * ------------------- * begin : Thu May 31, 2001 -* copyright : (C) 2001 The phpBB Group -* email : support@phpbb.com -* +* copyright : (C) 2001 The phpBB Group +* email : support@phpbb.com +* * $Id$ -* +* ****************************************************************************/ /*************************************************************************** + * + * 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. + * + ***************************************************************************/ + +/*************************************************************************** * 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 @@ -37,7 +46,7 @@ include($phpbb_root_path . 'common.'.$phpEx); // $userdata = session_pagestart($user_ip, PAGE_INDEX, $session_length); init_userprefs($userdata); -// +// // End session management // @@ -59,10 +68,10 @@ else if( $userdata['user_level'] != ADMIN ) define("VERBOSE", 0); // -// Increase maximum execution time, but don't complain about it if it isn't +// Increase maximum execution time, but don't complain about it if it isn't // allowed. // -@set_time_limit(600); +@set_time_limit(600); // // The following functions are adapted from phpMyAdmin and upgrade_20.php @@ -74,7 +83,7 @@ function pg_get_sequences($crlf, $backup_type) { global $db; - $get_seq_sql = "SELECT relname FROM pg_class WHERE NOT relname ~ 'pg_.*' + $get_seq_sql = "SELECT relname FROM pg_class WHERE NOT relname ~ 'pg_.*' AND relkind = 'S' ORDER BY relname"; $seq = $db->sql_query($get_seq_sql); @@ -105,7 +114,7 @@ function pg_get_sequences($crlf, $backup_type) if($backup_type == 'structure') { $row['last_value'] = 1; - } + } $return_val .= "CREATE SEQUENCE $sequence start " . $row['last_value'] . ' increment ' . $row['increment_by'] . ' maxvalue ' . $row['max_value'] . ' minvalue ' . $row['min_value'] . ' cache ' . $row['cache_value'] . "; $crlf"; @@ -128,8 +137,8 @@ function pg_get_sequences($crlf, $backup_type) } // End function... // -// The following functions will return the "CREATE TABLE syntax for the -// varying DBMS's +// The following functions will return the "CREATE TABLE syntax for the +// varying DBMS's // // This function returns, will return the table def's for postgres... // @@ -174,8 +183,8 @@ function get_table_def_postgres($table, $crlf) // $sql_get_default = "SELECT d.adsrc AS rowdefault FROM pg_attrdef d, pg_class c - WHERE (c.relname = '$table') - AND (c.oid = d.adrelid) + WHERE (c.relname = '$table') + AND (c.oid = d.adrelid) AND d.adnum = " . $row['attnum']; $def_res = $db->sql_query($sql_get_default); @@ -183,7 +192,7 @@ function get_table_def_postgres($table, $crlf) { unset($row['rowdefault']); } - else + else { $row['rowdefault'] = @pg_result($def_res, 0, 'rowdefault'); } @@ -229,13 +238,13 @@ function get_table_def_postgres($table, $crlf) // $sql_pri_keys = "SELECT ic.relname AS index_name, bc.relname AS tab_name, ta.attname AS column_name, i.indisunique AS unique_key, i.indisprimary AS primary_key - FROM pg_class bc, pg_class ic, pg_index i, pg_attribute ta, pg_attribute ia - WHERE (bc.oid = i.indrelid) - AND (ic.oid = i.indexrelid) - AND (ia.attrelid = i.indexrelid) - AND (ta.attrelid = bc.oid) - AND (bc.relname = '$table') - AND (ta.attrelid = i.indrelid) + FROM pg_class bc, pg_class ic, pg_index i, pg_attribute ta, pg_attribute ia + WHERE (bc.oid = i.indrelid) + AND (ic.oid = i.indexrelid) + AND (ia.attrelid = i.indexrelid) + AND (ta.attrelid = bc.oid) + AND (bc.relname = '$table') + AND (ta.attrelid = i.indrelid) AND (ta.attnum = i.indkey[ia.attnum-1]) ORDER BY index_name, tab_name, column_name "; $result = $db->sql_query($sql_pri_keys); @@ -287,16 +296,16 @@ function get_table_def_postgres($table, $crlf) // // Generate constraint clauses for CHECK constraints // - $sql_checks = "SELECT rcname as index_name, rcsrc + $sql_checks = "SELECT rcname as index_name, rcsrc FROM pg_relcheck, pg_class bc - WHERE rcrelid = bc.oid + WHERE rcrelid = bc.oid AND bc.relname = '$table' AND NOT EXISTS ( - SELECT * - FROM pg_relcheck as c, pg_inherits as i - WHERE i.inhrelid = pg_relcheck.rcrelid - AND c.rcname = pg_relcheck.rcname - AND c.rcsrc = pg_relcheck.rcsrc + SELECT * + FROM pg_relcheck as c, pg_inherits as i + WHERE i.inhrelid = pg_relcheck.rcrelid + AND c.rcname = pg_relcheck.rcname + AND c.rcsrc = pg_relcheck.rcsrc AND c.rcrelid = i.inhparent )"; $result = $db->sql_query($sql_checks); @@ -305,7 +314,7 @@ function get_table_def_postgres($table, $crlf) { message_die(GENERAL_ERROR, "Failed in get_table_def (show fields)", "", __LINE__, __FILE__, $sql_checks); } - + // // Add the constraints to the sql file. // @@ -334,7 +343,7 @@ function get_table_def_postgres($table, $crlf) // // This function returns the "CREATE TABLE" syntax for mysql dbms... // -function get_table_def_mysql($table, $crlf) +function get_table_def_mysql($table, $crlf) { global $drop, $db; @@ -350,7 +359,7 @@ function get_table_def_mysql($table, $crlf) { $schema_create .= "DROP TABLE IF EXISTS $table;$crlf"; } - + $schema_create .= "CREATE TABLE $table($crlf"; // @@ -371,7 +380,7 @@ function get_table_def_mysql($table, $crlf) $schema_create .= ' DEFAULT \'' . $row['Default'] . '\''; } - if($row['Null'] != "YES") + if($row['Null'] != "YES") { $schema_create .= ' NOT NULL'; } @@ -406,7 +415,7 @@ function get_table_def_mysql($table, $crlf) $kname = "UNIQUE|$kname"; } - if(!is_array($index[$kname])) + if(!is_array($index[$kname])) { $index[$kname] = array(); } @@ -414,18 +423,18 @@ function get_table_def_mysql($table, $crlf) $index[$kname][] = $row['Column_name']; } - while(list($x, $columns) = @each($index)) + while(list($x, $columns) = @each($index)) { $schema_create .= ", $crlf"; if($x == 'PRIMARY') { $schema_create .= ' PRIMARY KEY (' . implode($columns, ', ') . ')'; - } + } elseif (substr($x,0,6) == 'UNIQUE') { $schema_create .= ' UNIQUE ' . substr($x,7) . ' (' . implode($columns, ', ') . ')'; - } + } else { $schema_create .= " KEY $x (" . implode($columns, ', ') . ')'; @@ -434,15 +443,15 @@ function get_table_def_mysql($table, $crlf) $schema_create .= "$crlf);"; - if(get_magic_quotes_runtime()) + if(get_magic_quotes_runtime()) { return(stripslashes($schema_create)); - } - else + } + else { return($schema_create); } - + } // End get_table_def_mysql @@ -451,7 +460,7 @@ function get_table_def_mysql($table, $crlf) // statement. // // -// The following functions Get the data from the tables and format it as a +// The following functions Get the data from the tables and format it as a // series of INSERT statements, for each different DBMS... // After every row a custom callback function $handler gets called. // $handler must accept one parameter ($sql_insert); @@ -489,7 +498,7 @@ function get_table_content_postgres($table, $handler) unset($schema_vals); unset($schema_fields); unset($schema_insert); - // + // // Build the SQL statement to recreate the data. // for($i = 0; $i < $i_num_fields; $i++) @@ -524,7 +533,7 @@ function get_table_content_postgres($table, $handler) } $schema_vals .= " $strQuote$strVal$strQuote,"; - $schema_fields .= " $aryName[$i],"; + $schema_fields .= " $aryName[$i],"; } @@ -563,7 +572,7 @@ function get_table_content_mysql($table, $handler) message_die(GENERAL_ERROR, "Faild in get_table_content (select *)", "", __LINE__, __FILE__, "SELECT * FROM $table"); } - if($db->sql_numrows($result) > 0) + if($db->sql_numrows($result) > 0) { $schema_insert = "\n#\n# Table Data for $table\n#\n"; } @@ -608,22 +617,22 @@ function get_table_content_mysql($table, $handler) // // If there is no data for the column set it to null. // There was a problem here with an extra space causing the - // sql file not to reimport if the last column was null in + // sql file not to reimport if the last column was null in // any table. Should be fixed now :) JLH // $schema_insert .= ' NULL,'; - } - elseif ($row[$j] != '') + } + elseif ($row[$j] != '') { $schema_insert .= ' \'' . addslashes($row[$j]) . '\','; - } + } else { $schema_insert .= '\'\','; } } // - // Get rid of the the last comma. + // Get rid of the the last comma. // $schema_insert = ereg_replace(',$', '', $schema_insert); $schema_insert .= ');'; @@ -650,14 +659,14 @@ function output_table_content($content) // function remove_remarks($sql) { - $i = 0; + $i = 0; while($i < strlen($sql)) { if( $sql[$i] == "#" && ( $sql[$i-1] == "\n" || $i==0 ) ) { $j = 1; - + while( $sql[$i + $j] != "\n" ) { $j++; @@ -681,15 +690,15 @@ function split_sql_file($sql, $delimiter) $last_char = ""; $ret = array(); $in_string = true; - + for($i = 0; $i < strlen($sql); $i++) { $char = $sql[$i]; - + // // if delimiter found, add the parsed part to the returned array // - if($char == $delimiter && !$in_string) + if($char == $delimiter && !$in_string) { $ret[] = substr($sql, 0, $i); $sql = substr($sql, $i + 1); @@ -704,10 +713,10 @@ function split_sql_file($sql, $delimiter) { $in_string = false; } - + if($char == $in_string && $last_char != "\\") - { + { $in_string = false; } elseif(!$in_string && ($char == "\"" || $char == "'") && ($last_char != "\\")) @@ -725,7 +734,7 @@ function split_sql_file($sql, $delimiter) return($ret); } -// +// // End Functions // ------------- @@ -737,7 +746,7 @@ function split_sql_file($sql, $delimiter) if( isset($HTTP_GET_VARS['perform']) || isset($HTTP_POST_VARS['perform']) ) { $perform = (isset($HTTP_POST_VARS['perform'])) ? $HTTP_POST_VARS['perform'] : $HTTP_GET_VARS['perform']; - + switch($perform) { case 'backup': @@ -764,12 +773,12 @@ if( isset($HTTP_GET_VARS['perform']) || isset($HTTP_POST_VARS['perform']) ) ); $template->assign_vars(array( - "MESSAGE_TITLE" => $lang['Information'], + "MESSAGE_TITLE" => $lang['Information'], "MESSAGE_TEXT" => $lang['Backups_not_supported']) ); $template->pparse("body"); - + break; } @@ -781,7 +790,7 @@ if( isset($HTTP_GET_VARS['perform']) || isset($HTTP_POST_VARS['perform']) ) $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(!empty($additional_tables)) { if(ereg(",", $additional_tables)) { @@ -810,36 +819,36 @@ if( isset($HTTP_GET_VARS['perform']) || isset($HTTP_POST_VARS['perform']) ) $s_hidden_fields = "<input type=\"hidden\" name=\"perform\" value=\"backup\" /><input type=\"hidden\" name=\"drop\" value=\"1\" /><input type=\"hidden\" name=\"perform\" value=\"$perform\" />"; $template->assign_vars(array( - "L_DATABASE_BACKUP" => $lang['Database_Utilities'] . " : " . $lang['Backup'], - "L_BACKUP_EXPLAIN" => $lang['Backup_explain'], + "L_DATABASE_BACKUP" => $lang['Database_Utilities'] . " : " . $lang['Backup'], + "L_BACKUP_EXPLAIN" => $lang['Backup_explain'], "L_FULL_BACKUP" => $lang['Full_backup'], "L_STRUCTURE_BACKUP" => $lang['Structure_backup'], "L_DATA_BACKUP" => $lang['Data_backup'], "L_ADDITIONAL_TABLES" => $lang['Additional_tables'], "L_START_BACKUP" => $lang['Start_backup'], - "L_BACKUP_OPTIONS" => $lang['Backup_options'], - "L_GZIP_COMPRESS" => $lang['Gzip_compress'], - "L_NO" => $lang['No'], - "L_YES" => $lang['Yes'], + "L_BACKUP_OPTIONS" => $lang['Backup_options'], + "L_GZIP_COMPRESS" => $lang['Gzip_compress'], + "L_NO" => $lang['No'], + "L_YES" => $lang['Yes'], - "S_HIDDEN_FIELDS" => $s_hidden_fields, + "S_HIDDEN_FIELDS" => $s_hidden_fields, "S_DBUTILS_ACTION" => append_sid("admin_db_utilities.$phpEx")) ); $template->pparse("body"); break; - + } else if( !isset($HTTP_POST_VARS['startdownload']) && !isset($HTTP_GET_VARS['startdownload']) ) { $template->set_filenames(array( "body" => "admin/admin_message_body.tpl") ); - + $template->assign_vars(array( - "META" => "<meta http-equiv=\"refresh\" content=\"0;url=admin_db_utilities.$phpEx?perform=backup&additional_tables=" . quotemeta($additional_tables) . "&backup_type=$backup_type&drop=1&backupstart=1&gzipcompress=$gzipcompress&startdownload=1\">", + "META" => "<meta http-equiv=\"refresh\" content=\"0;url=admin_db_utilities.$phpEx?perform=backup&additional_tables=" . quotemeta($additional_tables) . "&backup_type=$backup_type&drop=1&backupstart=1&gzipcompress=$gzipcompress&startdownload=1\">", - "MESSAGE_TITLE" => $lang['Database_Utilities'] . " : " . $lang['Backup'], + "MESSAGE_TITLE" => $lang['Database_Utilities'] . " : " . $lang['Backup'], "MESSAGE_TEXT" => $lang['Backup_download']) ); @@ -875,7 +884,7 @@ if( isset($HTTP_GET_VARS['perform']) || isset($HTTP_POST_VARS['perform']) ) { $backup_sql .= "#\n# TABLE: " . $table_prefix . $table_name . "\n#\n"; $backup_sql .= $table_def_function($table_prefix . $table_name, "\n") . "\n"; - } + } if($backup_type != 'structure') { @@ -922,9 +931,9 @@ if( isset($HTTP_GET_VARS['perform']) || isset($HTTP_POST_VARS['perform']) ) break; case 'restore': - if(!isset($restore_start)) - { - // + if(!isset($restore_start)) + { + // // Define Template files... // include('page_header_admin.'.$phpEx); @@ -936,12 +945,12 @@ if( isset($HTTP_GET_VARS['perform']) || isset($HTTP_POST_VARS['perform']) ) $s_hidden_fields = "<input type=\"hidden\" name=\"perform\" value=\"restore\" /><input type=\"hidden\" name=\"perform\" value=\"$perform\" />"; $template->assign_vars(array( - "L_DATABASE_RESTORE" => $lang['Database_Utilities'] . " : " . $lang['Restore'], - "L_RESTORE_EXPLAIN" => $lang['Restore_explain'], - "L_SELECT_FILE" => $lang['Select_file'], - "L_START_RESTORE" => $lang['Start_Restore'], + "L_DATABASE_RESTORE" => $lang['Database_Utilities'] . " : " . $lang['Restore'], + "L_RESTORE_EXPLAIN" => $lang['Restore_explain'], + "L_SELECT_FILE" => $lang['Select_file'], + "L_START_RESTORE" => $lang['Start_Restore'], - "S_DBUTILS_ACTION" => append_sid("admin_db_utilities.$phpEx"), + "S_DBUTILS_ACTION" => append_sid("admin_db_utilities.$phpEx"), "S_HIDDEN_FIELDS" => $s_hidden_fields) ); $template->pparse("body"); @@ -949,8 +958,8 @@ if( isset($HTTP_GET_VARS['perform']) || isset($HTTP_POST_VARS['perform']) ) break; } - else - { + else + { // // Handle the file upload .... // If no file was uploaded report an error... @@ -965,7 +974,7 @@ if( isset($HTTP_GET_VARS['perform']) || isset($HTTP_POST_VARS['perform']) ) message_die(GENERAL_MESSAGE, $lang['Restore_Error_no_file']); } // - // If I file was actually uploaded, check to make sure that we + // If I file was actually uploaded, check to make sure that we // are actually passed the name of an uploaded file, and not // a hackers attempt at getting us to process a local system // file. @@ -1024,7 +1033,7 @@ if( isset($HTTP_GET_VARS['perform']) || isset($HTTP_POST_VARS['perform']) ) $sql_query = trim($sql_query); - if($sql_query != "") + if($sql_query != "") { // Strip out sql comments... $sql_query = remove_remarks($sql_query); @@ -1035,15 +1044,15 @@ if( isset($HTTP_GET_VARS['perform']) || isset($HTTP_POST_VARS['perform']) ) $sql = trim($pieces[$i]); if(!empty($sql) and $sql[0] != "#") - { - if(VERBOSE == 1) + { + if(VERBOSE == 1) { echo "Executing: $sql\n<br>"; flush(); } - + $result = $db->sql_query($sql); - + if(!$result && ( !(SQL_LAYER == 'postgres' && eregi("drop table", $sql) ) ) ) { include('page_header_admin.'.$phpEx); @@ -1060,9 +1069,9 @@ if( isset($HTTP_GET_VARS['perform']) || isset($HTTP_POST_VARS['perform']) ) ); $message = $lang['Restore_success']; - + $template->assign_vars(array( - "MESSAGE_TITLE" => $lang['Database_Utilities'] . " : " . $lang['Restore'], + "MESSAGE_TITLE" => $lang['Database_Utilities'] . " : " . $lang['Restore'], "MESSAGE_TEXT" => $message) ); @@ -1071,7 +1080,7 @@ if( isset($HTTP_GET_VARS['perform']) || isset($HTTP_POST_VARS['perform']) ) } break; } -} +} include('page_footer_admin.'.$phpEx); diff --git a/phpBB/admin/admin_forum_prune.php b/phpBB/admin/admin_forum_prune.php index bd4639a736..04fa64c890 100644 --- a/phpBB/admin/admin_forum_prune.php +++ b/phpBB/admin/admin_forum_prune.php @@ -1,17 +1,26 @@ <?php /*************************************************************************** -* admin_forum_prune.php +* admin_forum_prune.php * ------------------- * begin : Mon Jul 31, 2001 -* copyright : (C) 2001 The phpBB Group -* email : support@phpbb.com -* +* copyright : (C) 2001 The phpBB Group +* email : support@phpbb.com +* * $Id$ -* +* ****************************************************************************/ /*************************************************************************** -* This file is for the setup of the auto_pruning and also will allow for + * + * 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. + * + ***************************************************************************/ + +/*************************************************************************** +* This file is for the setup of the auto_pruning and also will allow for * immediate forum pruning as well. ***************************************************************************/ // @@ -37,13 +46,13 @@ if( $setmodules == 1 ) require('pagestart.inc'); include($phpbb_root_path . 'includes/prune.php'); -// -// Get the forum ID for pruning +// +// Get the forum ID for pruning // if(isset($HTTP_GET_VARS[POST_FORUM_URL]) || isset($HTTP_POST_VARS[POST_FORUM_URL])) { $forum_id = (isset($HTTP_POST_VARS[POST_FORUM_URL])) ? $HTTP_POST_VARS[POST_FORUM_URL] : $HTTP_GET_VARS[POST_FORUM_URL]; - if($forum_id == "ALL") + if($forum_id == "ALL") { $forum_sql = ""; } @@ -60,10 +69,10 @@ else // // Get a list of forum's or the data for the forum that we are pruning. // -$sql = "SELECT f.* - FROM " . FORUMS_TABLE . " f, " . CATEGORIES_TABLE . " c - WHERE c.cat_id = f.cat_id - $forum_sql +$sql = "SELECT f.* + FROM " . FORUMS_TABLE . " f, " . CATEGORIES_TABLE . " c + WHERE c.cat_id = f.cat_id + $forum_sql ORDER BY c.cat_order ASC, f.forum_order ASC"; $f_result = $db->sql_query($sql); @@ -76,7 +85,7 @@ if(isset($HTTP_GET_VARS['submit']) || isset($HTTP_POST_VARS['submit'])) { $submit = (isset($HTTP_POST_VARS['submit'])) ? $HTTP_POST_VARS['submit'] : $HTTP_GET_VARS['submit']; } -else +else { unset($submit); } @@ -115,7 +124,7 @@ if($submit == "Prune") else { // - // If they haven't selected a forum for pruning yet then + // If they haven't selected a forum for pruning yet then // display a select box to use for pruning. // if(empty($forum_id)) @@ -140,11 +149,11 @@ else // Assign the template variables. // $template->assign_vars(array( - "S_FORUMPRUNE_ACTION" => append_sid("admin_forum_prune.$phpEx"), + "S_FORUMPRUNE_ACTION" => append_sid("admin_forum_prune.$phpEx"), "S_FORUMS_SELECT" => $select_list) ); } - else + else { // // Output the form to retrieve Prune information. @@ -152,7 +161,7 @@ else $template->set_filenames(array( "body" => "admin/forum_prune_body.tpl") ); - + $forum_name = ($forum_id == "ALL") ? 'All Forums' : $forum_rows[0]['forum_name']; $prune_data = "Prune Topics that haven't been posted to in the last "; diff --git a/phpBB/admin/admin_forumauth.php b/phpBB/admin/admin_forumauth.php index 742985fec0..d976074e7e 100644 --- a/phpBB/admin/admin_forumauth.php +++ b/phpBB/admin/admin_forumauth.php @@ -1,15 +1,24 @@ <?php -/*************************************************************************** - * admin_forumauth.php - * ------------------- - * begin : Saturday, Feb 13, 2001 - * copyright : (C) 2001 The phpBB Group - * email : support@phpbb.com - * - * $Id$ - * - * - ***************************************************************************/ +/*************************************************************************** + * admin_forumauth.php + * ------------------- + * begin : Saturday, Feb 13, 2001 + * copyright : (C) 2001 The phpBB Group + * email : support@phpbb.com + * + * $Id$ + * + * + ***************************************************************************/ + +/*************************************************************************** + * + * 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. + * + ***************************************************************************/ if($setmodules == 1) { @@ -28,13 +37,13 @@ require('pagestart.inc'); // Start program - define vars // $simple_auth_ary = array( - 0 => array(0, 0, 0, 0, 1, 1, 1, 3), - 1 => array(0, 0, 1, 1, 1, 1, 1, 3), - 2 => array(1, 1, 1, 1, 1, 1, 1, 3), + 0 => array(0, 0, 0, 0, 1, 1, 1, 3), + 1 => array(0, 0, 1, 1, 1, 1, 1, 3), + 2 => array(1, 1, 1, 1, 1, 1, 1, 3), 3 => array(0, 2, 2, 2, 2, 2, 2, 3), 4 => array(2, 2, 2, 2, 2, 2, 2, 3), 5 => array(0, 3, 3, 3, 3, 3, 3, 3), - 6 => array(3, 3, 3, 3, 3, 3, 3, 3), + 6 => array(3, 3, 3, 3, 3, 3, 3, 3), ); $simple_auth_types = array($lang['Public'], $lang['Registered'], $lang['Registered'] . " [" . $lang['Hidden'] . "]", $lang['Private'], $lang['Private'] . " [" . $lang['Hidden'] . "]", $lang['Moderators'], $lang['Moderators'] . " [" . $lang['Hidden'] . "]"); @@ -145,9 +154,9 @@ if(isset($HTTP_POST_VARS['submit'])) // was // $sql = "SELECT f.* - FROM " . FORUMS_TABLE . " f, " . CATEGORIES_TABLE . " c - WHERE c.cat_id = f.cat_id - $forum_sql + FROM " . FORUMS_TABLE . " f, " . CATEGORIES_TABLE . " c + WHERE c.cat_id = f.cat_id + $forum_sql ORDER BY c.cat_order ASC, f.forum_order ASC"; $f_result = $db->sql_query($sql); @@ -171,12 +180,12 @@ if(empty($forum_id)) $select_list .= "</select>"; $template->assign_vars(array( - "L_AUTH_TITLE" => $lang['Forum'] . " " . $lang['Auth_Control'], - "L_AUTH_EXPLAIN" => $lang['Forum_auth_explain'], - "L_AUTH_SELECT" => $lang['Select_a'] . " " . $lang['Forum'], - "L_LOOK_UP" => $lang['Look_up'] . " " . $lang['Forum'], + "L_AUTH_TITLE" => $lang['Forum'] . " " . $lang['Auth_Control'], + "L_AUTH_EXPLAIN" => $lang['Forum_auth_explain'], + "L_AUTH_SELECT" => $lang['Select_a'] . " " . $lang['Forum'], + "L_LOOK_UP" => $lang['Look_up'] . " " . $lang['Forum'], - "S_AUTH_ACTION" => append_sid("admin_forumauth.$phpEx"), + "S_AUTH_ACTION" => append_sid("admin_forumauth.$phpEx"), "S_AUTH_SELECT" => $select_list) ); @@ -233,7 +242,7 @@ else $simple_auth .= $simple_auth_types[$j]; $simple_auth .= "</option>"; } - else + else { $simple_auth .= "<option value=\"$j\">" . $simple_auth_types[$j] . "</option>"; } @@ -253,7 +262,7 @@ else else { // - // Output values of individual + // Output values of individual // fields // for($j = 0; $j < count($forum_auth_fields); $j++) @@ -268,7 +277,7 @@ else $custom_auth[$j] .= $forum_auth_levels[$k]; $custom_auth[$j] .= "</option>"; } - else + else { $custom_auth[$j] .= "<option value=\"" . $forum_auth_const[$k] . "\">". $forum_auth_levels[$k] . "</option>"; } @@ -296,17 +305,17 @@ else $s_hidden_fields = '<input type="hidden" name="' . POST_FORUM_URL . '" value="' . $forum_id . '">'; $template->assign_vars(array( - "FORUM_NAME" => $forum_name, + "FORUM_NAME" => $forum_name, - "L_AUTH_TITLE" => $lang['Forum'] . " " . $lang['Auth_Control'], - "L_AUTH_EXPLAIN" => $lang['Forum_auth_explain'], + "L_AUTH_TITLE" => $lang['Forum'] . " " . $lang['Auth_Control'], + "L_AUTH_EXPLAIN" => $lang['Forum_auth_explain'], "L_SUBMIT_CHANGES" => $lang['Submit_changes'], "L_RESET_CHANGES" => $lang['Reset_changes'], - "U_FORUMAUTH_ACTION" => append_sid("admin_forumauth.$phpEx?" . POST_FORUM_URL . "=$forum_id"), + "U_FORUMAUTH_ACTION" => append_sid("admin_forumauth.$phpEx?" . POST_FORUM_URL . "=$forum_id"), "U_SWITCH_MODE" => $u_switch_mode, - "S_COLUMN_SPAN" => $s_column_span, + "S_COLUMN_SPAN" => $s_column_span, "S_HIDDEN_FIELDS" => $s_hidden_fields) ); diff --git a/phpBB/admin/admin_forums.php b/phpBB/admin/admin_forums.php index 6e17138c95..d84cf665f5 100644 --- a/phpBB/admin/admin_forums.php +++ b/phpBB/admin/admin_forums.php @@ -6,11 +6,20 @@ * copyright : (C) 2001 The phpBB Group * email : support@phpbb.com * - * $Id$ + * $Id$ * * ***************************************************************************/ +/*************************************************************************** + * + * 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. + * + ***************************************************************************/ + if($setmodules==1) { $file = basename(__FILE__); @@ -21,11 +30,11 @@ if($setmodules==1) function check_forum_name($forumname) { global $db; - + $sql = "SELECT * from " . FORUMS_TABLE . "WHERE forum_name = '$forumname'"; $result = $db->sql_query($sql); if( !$result ) - { + { message_die(GENERAL_ERROR, "Couldn't get list of Categories", "", __LINE__, __FILE__, $sql); } if ($db->sql_numrows($result) > 0) @@ -57,7 +66,7 @@ function get_info($mode, $id) 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 ) @@ -86,14 +95,14 @@ function get_list($mode, $id, $select) default: message_die(GENERAL_ERROR, "Wrong mode for generating select list", "", __LINE__, __FILE__); } - + $sql = "SELECT * FROM $table"; if( $select == FALSE) { $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 = ""; @@ -112,7 +121,7 @@ function get_list($mode, $id, $select) function renumber_order($mode, $cat=FALSE) { global $db; - + switch($mode) { case 'category': @@ -130,7 +139,7 @@ function renumber_order($mode, $cat=FALSE) default: message_die(GENERAL_ERROR, "Wrong mode for generating select list", "", __LINE__, __FILE__); } - + $sql = "SELECT * FROM $table"; if( $cat != FALSE) { @@ -138,24 +147,24 @@ function renumber_order($mode, $cat=FALSE) } $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; } - + } // @@ -185,12 +194,12 @@ if(isset($mode)) // Are we supposed to do something? $show_index = TRUE; break; case 'createforum': // Create a forum in the DB - $sql = "SELECT + $sql = "SELECT max(forum_order) as max_order - FROM ".FORUMS_TABLE." + FROM ".FORUMS_TABLE." WHERE cat_id = '".$HTTP_POST_VARS['cat_id']."'"; if( !$result = $db->sql_query($sql) ) - { + { message_die(GENERAL_ERROR, "Couldn't get order number from forums table", "", __LINE__, __FILE__, $sql); } $row = $db->sql_fetchrow($result); @@ -198,7 +207,7 @@ if(isset($mode)) // Are we supposed to do something? $next_order = $max_order + 1; // There is no problem having duplicate forum names so we won't check for it. - $sql = "INSERT + $sql = "INSERT INTO ".FORUMS_TABLE."( forum_name, cat_id, @@ -212,31 +221,31 @@ if(isset($mode)) // Are we supposed to do something? '".$next_order."', '".$HTTP_POST_VARS['forumstatus']."')"; if( !$result = $db->sql_query($sql) ) - { + { message_die(GENERAL_ERROR, "Couldn't insert row in forums table", "", __LINE__, __FILE__, $sql); } $show_index = TRUE; break; case 'modforum': // Modify a forum in the DB - $sql = "UPDATE ".FORUMS_TABLE." SET + $sql = "UPDATE ".FORUMS_TABLE." SET forum_name = '".$HTTP_POST_VARS['forumname']."', cat_id = '".$HTTP_POST_VARS['cat_id']."', forum_desc = '".$HTTP_POST_VARS['forumdesc']."', forum_status = '".$HTTP_POST_VARS['forumstatus']."' WHERE forum_id = '".$HTTP_POST_VARS['forum_id']."'"; if( !$result = $db->sql_query($sql) ) - { + { message_die(GENERAL_ERROR, "Couldn't update forum information", "", __LINE__, __FILE__, $sql); } $show_index = TRUE; break; - + case 'addcat': - $sql = "SELECT + $sql = "SELECT max(cat_order) as max_order FROM ".CATEGORIES_TABLE; if( !$result = $db->sql_query($sql) ) - { + { message_die(GENERAL_ERROR, "Couldn't get order number from categories table", "", __LINE__, __FILE__, $sql); } $row = $db->sql_fetchrow($result); @@ -250,7 +259,7 @@ if(isset($mode)) // Are we supposed to do something? '".$HTTP_POST_VARS['catname']."', '".$next_order."')"; if( !$result = $db->sql_query($sql) ) - { + { message_die(GENERAL_ERROR, "Couldn't insert row in categories table", "", __LINE__, __FILE__, $sql); } $show_index = TRUE; @@ -262,7 +271,7 @@ if(isset($mode)) // Are we supposed to do something? // $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); @@ -282,13 +291,13 @@ if(isset($mode)) // Are we supposed to do something? $forumstatus = FORUM_UNLOCKED; $forum_id = ''; } - + $catlist = get_list('category', $cat_id, TRUE); - + $forumstatus == FORUM_LOCKED ? $forumlocked = "selected" : $forumunlocked = "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") ); @@ -302,17 +311,17 @@ if(isset($mode)) // Are we supposed to do something? 'BUTTONVALUE' => $buttonvalue) ); $template->pparse("body"); - - + + break; case 'editcat': $newmode = 'modcat'; $buttonvalue = 'Change'; - + $cat_id = $HTTP_GET_VARS['cat_id']; $row = get_info('category', $catid); $cat_title = $row['cat_title']; - + $template->set_filenames(array( "body" => "admin/category_edit_body.tpl") ); @@ -323,14 +332,14 @@ if(isset($mode)) // Are we supposed to do something? 'BUTTONVALUE' => $buttonvalue) ); $template->pparse("body"); - + break; case 'modcat': - $sql = "UPDATE ".CATEGORIES_TABLE." SET + $sql = "UPDATE ".CATEGORIES_TABLE." SET cat_title = '".$HTTP_POST_VARS['cat_title']."' WHERE cat_id = '".$HTTP_POST_VARS['cat_id']."'"; if( !$result = $db->sql_query($sql) ) - { + { message_die(GENERAL_ERROR, "Couldn't update forum information", "", __LINE__, __FILE__, $sql); } print "Modforum: ". $HTTP_POST_VARS['forumname']." sql= <pre>$sql</pre>"; @@ -340,19 +349,19 @@ if(isset($mode)) // Are we supposed to do something? $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)"; if( !$result = $db->sql_query($sql) ) - { + { message_die(GENERAL_ERROR, "Couldn't verify existence of forums", "", __LINE__, __FILE__, $sql); } if($db->sql_numrows($result) != 2) { message_die(GENERAL_ERROR, "Ambiguous forum ID's", "", __LINE__, __FILE__); } - + // Either delete or move all posts in a forum if($delete_old == 1) { @@ -361,62 +370,62 @@ if(isset($mode)) // Are we supposed to do something? } else { - $sql = "UPDATE ".TOPICS_TABLE." SET + $sql = "UPDATE ".TOPICS_TABLE." SET forum_id = '$to_id' WHERE forum_id = '$from_id'"; if( !$result = $db->sql_query($sql) ) - { + { message_die(GENERAL_ERROR, "Couldn't move topics to other forum", "", __LINE__, __FILE__, $sql); } - $sql = "UPDATE ".POSTS_TABLE." SET + $sql = "UPDATE ".POSTS_TABLE." SET forum_id = '$to_id' WHERE forum_id = '$from_id'"; if( !$result = $db->sql_query($sql) ) - { + { message_die(GENERAL_ERROR, "Couldn't move posts to other forum", "", __LINE__, __FILE__, $sql); } sync('forum', $to_id); } - + $sql = "DELETE FROM ".FORUMS_TABLE." WHERE forum_id = '$from_id'"; if( !$result = $db->sql_query($sql) ) - { + { message_die(GENERAL_ERROR, "Couldn't delete forum", "", __LINE__, __FILE__, $sql); } - + $show_index = TRUE; break; case 'movedelcat': $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." WHERE cat_id IN ($from_id, $to_id)"; if( !$result = $db->sql_query($sql) ) - { + { message_die(GENERAL_ERROR, "Couldn't verify existence of categories", "", __LINE__, __FILE__, $sql); } if($db->sql_numrows($result) != 2) { message_die(GENERAL_ERROR, "Ambiguous category ID's", "", __LINE__, __FILE__); } - - $sql = "UPDATE ".FORUMS_TABLE." SET + + $sql = "UPDATE ".FORUMS_TABLE." SET cat_id = '$to_id' WHERE cat_id = '$from_id'"; if( !$result = $db->sql_query($sql) ) - { + { message_die(GENERAL_ERROR, "Couldn't move forums to other category", "", __LINE__, __FILE__, $sql); } - + $sql = "DELETE FROM ".CATEGORIES_TABLE." WHERE cat_id = '$from_id'"; if( !$result = $db->sql_query($sql) ) - { + { message_die(GENERAL_ERROR, "Couldn't delete category", "", __LINE__, __FILE__, $sql); } - + $show_index = TRUE; break; case 'deletecat': @@ -427,7 +436,7 @@ if(isset($mode)) // Are we supposed to do something? $newmode = 'movedelcat'; $catinfo = get_info('category', $cat_id); $name = $catinfo['cat_title']; - + $template->set_filenames(array( "body" => "admin/forum_delete_body.tpl") ); @@ -449,7 +458,7 @@ if(isset($mode)) // Are we supposed to do something? $newmode = 'movedelforum'; $foruminfo = get_info('forum', $forum_id); $name = $foruminfo['forum_name']; - + $template->set_filenames(array( "body" => "admin/forum_delete_body.tpl") ); @@ -468,7 +477,7 @@ if(isset($mode)) // Are we supposed to do something? $cat_id = $HTTP_GET_VARS['cat_id']; $sql = "UPDATE ".CATEGORIES_TABLE." SET cat_order = cat_order + $move WHERE cat_id = $cat_id"; if( !$result = $db->sql_query($sql) ) - { + { message_die(GENERAL_ERROR, "Couldn't change category order", "", __LINE__, __FILE__, $sql); } renumber_order('category'); @@ -479,10 +488,10 @@ if(isset($mode)) // Are we supposed to do something? $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']); diff --git a/phpBB/admin/admin_groupauth.php b/phpBB/admin/admin_groupauth.php index ca1f35f66a..e3fe8d3a4c 100644 --- a/phpBB/admin/admin_groupauth.php +++ b/phpBB/admin/admin_groupauth.php @@ -1,15 +1,24 @@ <?php -/*************************************************************************** - * admin_groupauth.php - * ------------------- - * begin : Saturday, Feb 13, 2001 - * copyright : (C) 2001 The phpBB Group - * email : support@phpbb.com - * - * $Id$ - * - * - ***************************************************************************/ +/*************************************************************************** + * admin_groupauth.php + * ------------------- + * begin : Saturday, Feb 13, 2001 + * copyright : (C) 2001 The phpBB Group + * email : support@phpbb.com + * + * $Id$ + * + * + ***************************************************************************/ + +/*************************************************************************** + * + * 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. + * + ***************************************************************************/ if($setmodules == 1) { @@ -30,13 +39,13 @@ require('pagestart.inc'); $forum_auth_fields = array("auth_view", "auth_read", "auth_post", "auth_reply", "auth_edit", "auth_delete", "auth_sticky", "auth_announce"); $auth_field_match = array( - "auth_view" => AUTH_VIEW, - "auth_read" => AUTH_READ, - "auth_post" => AUTH_POST, - "auth_reply" => AUTH_REPLY, - "auth_edit" => AUTH_EDIT, - "auth_delete" => AUTH_DELETE, - "auth_sticky" => AUTH_STICKY, + "auth_view" => AUTH_VIEW, + "auth_read" => AUTH_READ, + "auth_post" => AUTH_POST, + "auth_reply" => AUTH_REPLY, + "auth_edit" => AUTH_EDIT, + "auth_delete" => AUTH_DELETE, + "auth_sticky" => AUTH_STICKY, "auth_announce" => AUTH_ANNOUNCE); $field_names = array( @@ -64,7 +73,7 @@ function a_auth_check_user($type, $key, $u_auth, $is_admin) if(!$single_user) { $single_user = $u_ary['group_single_user']; - + $result = 0; switch($type) { @@ -85,7 +94,7 @@ function a_auth_check_user($type, $key, $u_auth, $is_admin) $auth_user['single_group'] = ($single_user) ? "single" : "group"; } - + return $auth_user; } // @@ -101,13 +110,13 @@ if(isset($HTTP_POST_VARS['submit']) && !empty($HTTP_POST_VARS[POST_GROUPS_URL])) // // This is where things become fun ... // - + // // Get list of user id's for this group_id // - $sql_groupid = "SELECT user_id - FROM " . USER_GROUP_TABLE . " - WHERE group_id = $group_id + $sql_groupid = "SELECT user_id + FROM " . USER_GROUP_TABLE . " + WHERE group_id = $group_id AND user_id <> " . ANONYMOUS; if(!$result = $db->sql_query($sql_groupid)) { @@ -117,23 +126,23 @@ if(isset($HTTP_POST_VARS['submit']) && !empty($HTTP_POST_VARS[POST_GROUPS_URL])) // - // Pull all the auth/group + // Pull all the auth/group // for this user // - $sql = "SELECT aa.*, g2.group_single_user, u.username, u.user_id, g.group_id, g.group_name - FROM " . AUTH_ACCESS_TABLE . " aa, " . AUTH_ACCESS_TABLE . " aa2, " . USER_GROUP_TABLE . " ug, " . USER_GROUP_TABLE . " ug2, " . GROUPS_TABLE . " g, " . GROUPS_TABLE . " g2, " . USERS_TABLE . " u - WHERE g.group_id = $group_id - AND aa.group_id = g.group_id - AND ug.group_id = g.group_id - AND ug2.user_id = ug.user_id - AND u.user_id = ug2.user_id - AND g2.group_id = ug2.group_id + $sql = "SELECT aa.*, g2.group_single_user, u.username, u.user_id, g.group_id, g.group_name + FROM " . AUTH_ACCESS_TABLE . " aa, " . AUTH_ACCESS_TABLE . " aa2, " . USER_GROUP_TABLE . " ug, " . USER_GROUP_TABLE . " ug2, " . GROUPS_TABLE . " g, " . GROUPS_TABLE . " g2, " . USERS_TABLE . " u + WHERE g.group_id = $group_id + AND aa.group_id = g.group_id + AND ug.group_id = g.group_id + AND ug2.user_id = ug.user_id + AND u.user_id = ug2.user_id + AND g2.group_id = ug2.group_id AND aa2.group_id = g2.group_id"; /* - $sql = "SELECT aa.*, g.group_single_user, g.group_id, g.group_name - FROM " . AUTH_ACCESS_TABLE . " aa, " . USER_GROUP_TABLE . " ug, " . GROUPS_TABLE. " g - WHERE g.group_id = $group_id + $sql = "SELECT aa.*, g.group_single_user, g.group_id, g.group_name + FROM " . AUTH_ACCESS_TABLE . " aa, " . USER_GROUP_TABLE . " ug, " . GROUPS_TABLE. " g + WHERE g.group_id = $group_id AND aa.group_id = g.group_id";*/ $ag_result = $db->sql_query($sql); @@ -142,9 +151,9 @@ if(isset($HTTP_POST_VARS['submit']) && !empty($HTTP_POST_VARS[POST_GROUPS_URL])) $g_access = $db->sql_fetchrowset($ag_result); } - $sql = "SELECT f.* - FROM " . FORUMS_TABLE . " f, " . CATEGORIES_TABLE . " c - WHERE c.cat_id = f.cat_id + $sql = "SELECT f.* + FROM " . FORUMS_TABLE . " f, " . CATEGORIES_TABLE . " c + WHERE c.cat_id = f.cat_id ORDER BY c.cat_order ASC, f.forum_order ASC"; $fa_result = $db->sql_query($sql); @@ -181,23 +190,23 @@ if(isset($HTTP_POST_VARS['submit']) && !empty($HTTP_POST_VARS[POST_GROUPS_URL])) } } } - + // // The data above lists access and moderator permissions // for this user given by all the groups they belong to. // These values must be checked against those requested - // by the admin and where necessary the admin is + // by the admin and where necessary the admin is // informed of problems. For example, if a group the user // belongs to already grants the user moderator status // then the user won't have moderator status enabled. - // If the user has a group entry preventing access to a + // If the user has a group entry preventing access to a // forum then again, we must warn the admin that giving // the user access goes against the group permissions // (although in this case we'll go ahead and add the user) // - + + // // - // // $warning_mod_userid = array(); $warning_mod_username = array(); @@ -262,15 +271,15 @@ if(isset($HTTP_POST_VARS['submit']) && !empty($HTTP_POST_VARS[POST_GROUPS_URL])) { if($new_mod_status) { - $valid_auth_mod_sql[$this_forum_id] = "UPDATE " . AUTH_ACCESS_TABLE . " - SET auth_view = 0, auth_read = 0, auth_post = 0, auth_reply = 0, auth_edit = 0, auth_delete = 0, auth_announce = 0, auth_sticky = 0, auth_mod = $new_mod_status - WHERE forum_id = $this_forum_id + $valid_auth_mod_sql[$this_forum_id] = "UPDATE " . AUTH_ACCESS_TABLE . " + SET auth_view = 0, auth_read = 0, auth_post = 0, auth_reply = 0, auth_edit = 0, auth_delete = 0, auth_announce = 0, auth_sticky = 0, auth_mod = $new_mod_status + WHERE forum_id = $this_forum_id AND group_id = $group_id"; } else { - $valid_auth_mod_sql[$this_forum_id] = "DELETE FROM " . AUTH_ACCESS_TABLE . " - WHERE forum_id = $this_forum_id + $valid_auth_mod_sql[$this_forum_id] = "DELETE FROM " . AUTH_ACCESS_TABLE . " + WHERE forum_id = $this_forum_id AND group_id = $group_id"; } $update_mod = TRUE; @@ -280,8 +289,8 @@ if(isset($HTTP_POST_VARS['submit']) && !empty($HTTP_POST_VARS[POST_GROUPS_URL])) if(!$update_mod && $new_mod_status) { - $valid_auth_mod_sql[$this_forum_id] = "INSERT INTO " . AUTH_ACCESS_TABLE . " - (forum_id, group_id, auth_mod) + $valid_auth_mod_sql[$this_forum_id] = "INSERT INTO " . AUTH_ACCESS_TABLE . " + (forum_id, group_id, auth_mod) VALUES ($this_forum_id, $group_id, $new_mod_status)"; $update_mod = TRUE; } @@ -363,8 +372,8 @@ if(isset($HTTP_POST_VARS['submit']) && !empty($HTTP_POST_VARS[POST_GROUPS_URL])) } else { - $valid_auth_prv_sql[$this_forum_id] = "DELETE FROM " . AUTH_ACCESS_TABLE . " - WHERE forum_id = $this_forum_id + $valid_auth_prv_sql[$this_forum_id] = "DELETE FROM " . AUTH_ACCESS_TABLE . " + WHERE forum_id = $this_forum_id AND group_id = $group_id"; } } @@ -474,7 +483,7 @@ if(isset($HTTP_POST_VARS['submit']) && !empty($HTTP_POST_VARS[POST_GROUPS_URL])) ); $template->assign_vars(array( - "MESSAGE_TITLE" => $lang['Conflict_warning'], + "MESSAGE_TITLE" => $lang['Conflict_warning'], "MESSAGE_TEXT" => $warning_list) ); } @@ -489,11 +498,11 @@ else if(empty($HTTP_GET_VARS[POST_GROUPS_URL])) // // Default user selection box // - // This should be altered on the final system + // This should be altered on the final system // - $sql = "SELECT group_id, group_name - FROM " . GROUPS_TABLE . " + $sql = "SELECT group_id, group_name + FROM " . GROUPS_TABLE . " WHERE group_single_user <> " . TRUE; $g_result = $db->sql_query($sql); $group_list = $db->sql_fetchrowset($g_result); @@ -510,12 +519,12 @@ else if(empty($HTTP_GET_VARS[POST_GROUPS_URL])) ); $template->assign_vars(array( - "L_AUTH_TITLE" => $lang['Group'] . " " . $lang['Auth_Control'], - "L_AUTH_EXPLAIN" => $lang['Group_auth_explain'], - "L_AUTH_SELECT" => $lang['Select_a'] . " " . $lang['Group'], - "L_LOOK_UP" => $lang['Look_up'] . " " . $lang['Group'], + "L_AUTH_TITLE" => $lang['Group'] . " " . $lang['Auth_Control'], + "L_AUTH_EXPLAIN" => $lang['Group_auth_explain'], + "L_AUTH_SELECT" => $lang['Select_a'] . " " . $lang['Group'], + "L_LOOK_UP" => $lang['Look_up'] . " " . $lang['Group'], - "S_AUTH_ACTION" => append_sid("admin_groupauth.$phpEx"), + "S_AUTH_ACTION" => append_sid("admin_groupauth.$phpEx"), "S_AUTH_SELECT" => $select_list) ); @@ -539,9 +548,9 @@ else "body" => "admin/auth_ug_body.tpl") ); - $sql = "SELECT f.* - FROM " . FORUMS_TABLE . " f, " . CATEGORIES_TABLE . " c - WHERE c.cat_id = f.cat_id + $sql = "SELECT f.* + FROM " . FORUMS_TABLE . " f, " . CATEGORIES_TABLE . " c + WHERE c.cat_id = f.cat_id ORDER BY c.cat_order ASC, f.forum_order ASC"; $fa_result = $db->sql_query($sql); @@ -566,19 +575,19 @@ else } } } - - $sql = "SELECT u.user_id, u.username, u.user_level, g.group_id, g.group_name, g.group_single_user - FROM " . USERS_TABLE . " u, " . GROUPS_TABLE . " g, " . USER_GROUP_TABLE . " ug - WHERE g.group_id = $group_id + + $sql = "SELECT u.user_id, u.username, u.user_level, g.group_id, g.group_name, g.group_single_user + FROM " . USERS_TABLE . " u, " . GROUPS_TABLE . " g, " . USER_GROUP_TABLE . " ug + WHERE g.group_id = $group_id AND ug.group_id = g.group_id AND u.user_id = ug.user_id"; $g_result = $db->sql_query($sql); $groupinf = $db->sql_fetchrowset($g_result); - $sql = "SELECT aa.* - FROM " . AUTH_ACCESS_TABLE . " aa, " . GROUPS_TABLE. " g - WHERE g.group_id = $group_id - AND aa.group_id = g.group_id + $sql = "SELECT aa.* + FROM " . AUTH_ACCESS_TABLE . " aa, " . GROUPS_TABLE. " g + WHERE g.group_id = $group_id + AND aa.group_id = g.group_id AND g.group_single_user = 0"; $ag_result = $db->sql_query($sql); @@ -625,7 +634,7 @@ else $auth_group[$f_forum_id][$key] = 0; } break; - + case AUTH_MOD: if($num_forum_access[$f_forum_id]) { @@ -761,12 +770,12 @@ else $row_color = "#" . ( ( !($i%2) ) ? $theme['td_color1'] : $theme['td_color2'] ); $template->assign_block_vars("forums", array( - "ROW_COLOR" => $row_color, - "ROW_CLASS" => $row_class, - "FORUM_NAME" => $forum_access[$i]['forum_name'], + "ROW_COLOR" => $row_color, + "ROW_CLASS" => $row_class, + "FORUM_NAME" => $forum_access[$i]['forum_name'], + + "U_FORUM_AUTH" => append_sid("admin_forumauth.$phpEx?f=" . $forum_access[$i]['forum_id']), - "U_FORUM_AUTH" => append_sid("admin_forumauth.$phpEx?f=" . $forum_access[$i]['forum_id']), - "S_MOD_SELECT" => $optionlist_mod) ); @@ -837,29 +846,29 @@ else $s_column_span++; } } - + $switch_mode = "admin_groupauth.$phpEx?" . POST_GROUPS_URL . "=" . $group_id . "&adv="; $switch_mode .= ( !$adv ) ? "1" : "0"; $switch_mode_text = ( !$adv ) ? $lang['Advanced_mode'] : $lang['Simple_mode']; $u_switch_mode = '<a href="' . $switch_mode . '">' . $switch_mode_text . '</a>'; $template->assign_vars(array( - "USERNAME" => $t_groupname, + "USERNAME" => $t_groupname, "USER_GROUP_MEMBERSHIPS" => $lang['Group_has_members'] . ": " . $t_usergroup_list, - "L_USER_OR_GROUPNAME" => $lang['Group_name'], - "L_AUTH_TITLE" => $lang['Group'] . " " . $lang['Auth_Control'], - "L_AUTH_EXPLAIN" => $lang['User_auth_explain'], + "L_USER_OR_GROUPNAME" => $lang['Group_name'], + "L_AUTH_TITLE" => $lang['Group'] . " " . $lang['Auth_Control'], + "L_AUTH_EXPLAIN" => $lang['User_auth_explain'], "L_MODERATOR_STATUS" => $lang['Moderator_status'], - "L_PERMISSIONS" => $lang['Permissions'], + "L_PERMISSIONS" => $lang['Permissions'], "L_SUBMIT_CHANGES" => $lang['Submit_changes'], "L_RESET_CHANGES" => $lang['Reset_changes'], - "U_USER_OR_GROUP" => append_sid("admin_groupauth.$phpEx"), + "U_USER_OR_GROUP" => append_sid("admin_groupauth.$phpEx"), "U_SWITCH_MODE" => $u_switch_mode, - "S_COLUMN_SPAN" => $s_column_span, + "S_COLUMN_SPAN" => $s_column_span, "S_AUTH_ACTION" => append_sid("admin_groupauth.$phpEx"), "S_HIDDEN_FIELDS" => $s_hidden_fields) ); diff --git a/phpBB/admin/admin_groups.php b/phpBB/admin/admin_groups.php index d84f676dba..76259e7f24 100644 --- a/phpBB/admin/admin_groups.php +++ b/phpBB/admin/admin_groups.php @@ -1,15 +1,24 @@ <?php -/*************************************************************************** +/*************************************************************************** * admin_groups.php - * ------------------- - * begin : Saturday, Feb 13, 2001 - * copyright : (C) 2001 The phpBB Group - * email : support@phpbb.com - * - * $Id$ - * - * - ***************************************************************************/ + * ------------------- + * begin : Saturday, Feb 13, 2001 + * copyright : (C) 2001 The phpBB Group + * email : support@phpbb.com + * + * $Id$ + * + * + ***************************************************************************/ + +/*************************************************************************** + * + * 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. + * + ***************************************************************************/ if($setmodules == 1) { @@ -56,7 +65,7 @@ if( (isset($HTTP_POST_VARS['mode']) || isset($HTTP_GET_VARS['mode'])) && empty($ // They're editing. Grab the vars. // $sql = "SELECT * - FROM " . GROUPS_TABLE . " + FROM " . GROUPS_TABLE . " WHERE group_single_user <> " . TRUE . " AND group_id = " . $g; if(!$result = $db->sql_query($sql)) @@ -82,8 +91,8 @@ if( (isset($HTTP_POST_VARS['mode']) || isset($HTTP_GET_VARS['mode'])) && empty($ // // Ok, now we know everything about them, let's show the page. // - $sql = "SELECT user_id, username - FROM " . USERS_TABLE . " + $sql = "SELECT user_id, username + FROM " . USERS_TABLE . " WHERE user_id <> " . ANONYMOUS . " ORDER BY username"; $u_result = $db->sql_query($sql); @@ -114,7 +123,7 @@ if( (isset($HTTP_POST_VARS['mode']) || isset($HTTP_GET_VARS['mode'])) && empty($ $group_closed = "checked=\"checked\""; } $template->assign_vars(array( - "L_GROUP_INFO" => $lang['Group_edit_explain'], + "L_GROUP_INFO" => $lang['Group_edit_explain'], "L_GROUP_NAME" => $lang['group_name'], "L_GROUP_DESCRIPTION" => $lang['group_description'], "L_GROUP_MODERATOR" => $lang['group_moderator'], @@ -159,7 +168,7 @@ else if( $HTTP_POST_VARS['updategroup'] == "update" ) group_moderator = '" . $group_moderator . "' WHERE group_id = '" . $group_id . "'"; break; - + case 'newgroup': $sql = "INSERT INTO " . GROUPS_TABLE . " ( @@ -177,9 +186,9 @@ else if( $HTTP_POST_VARS['updategroup'] == "update" ) '" . $group_moderator . "', '0' )"; - + break; - + case 'default': message_die(GENERAL_ERROR, $lang['Group_mode_not_selected']); break; @@ -228,8 +237,8 @@ else { include("page_header_admin." . $phpEx); - $sql = "SELECT group_id, group_name - FROM " . GROUPS_TABLE . " + $sql = "SELECT group_id, group_name + FROM " . GROUPS_TABLE . " WHERE group_single_user <> " . TRUE . " ORDER BY group_name"; $g_result = $db->sql_query($sql); @@ -248,12 +257,12 @@ else $template->assign_vars(array( "L_GROUP_TITLE" => $lang['Group'] . " " . $lang['Admin'], - "L_GROUP_EXPLAIN" => $lang['Group_admin_explain'], - "L_GROUP_SELECT" => $lang['Select_a'] . " " . $lang['Group'], + "L_GROUP_EXPLAIN" => $lang['Group_admin_explain'], + "L_GROUP_SELECT" => $lang['Select_a'] . " " . $lang['Group'], "L_LOOK_UP" => $lang['Look_up'] . " " . $lang['Group'], "L_GROUP_NEW" => $lang['New_group'], - "S_GROUP_ACTION" => append_sid("admin_groups.$phpEx"), + "S_GROUP_ACTION" => append_sid("admin_groups.$phpEx"), "S_GROUP_SELECT" => $select_list) ); diff --git a/phpBB/admin/admin_smilies.php b/phpBB/admin/admin_smilies.php index 91c6b5bbf9..e0c666b140 100644 --- a/phpBB/admin/admin_smilies.php +++ b/phpBB/admin/admin_smilies.php @@ -1,15 +1,24 @@ <?php /*************************************************************************** -* admin_smilies.php +* admin_smilies.php * ------------------- * begin : Thu May 31, 2001 -* copyright : (C) 2001 The phpBB Group -* email : support@phpbb.com -* +* copyright : (C) 2001 The phpBB Group +* email : support@phpbb.com +* * $Id$ -* +* ****************************************************************************/ - + +/*************************************************************************** + * + * 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. + * + ***************************************************************************/ + /************************************************************************** * This file will be used for modifying the smiley settings for a board. **************************************************************************/ @@ -26,9 +35,9 @@ if($setmodules == 1) } // -// Include required files register $phpEx, and check permisions +// Include required files register $phpEx, and check permisions // -require('pagestart.inc'); +require('pagestart.inc'); // // Check to see what mode we should operate in. @@ -55,7 +64,7 @@ switch($mode) // Get the data that should be passed. // $smiley_id = ($HTTP_GET_VARS['id']) ? $HTTP_GET_VARS['id']: $HTTP_POST_VARS['id']; - $sql = 'DELETE FROM ' . SMILIES_TABLE . ' + $sql = 'DELETE FROM ' . SMILIES_TABLE . ' WHERE smilies_id = ' . $smiley_id; $result = $db->sql_query($sql); if( !$result ) @@ -84,8 +93,8 @@ switch($mode) // Get the data for the selected smiley. // $smiley_id = ($HTTP_GET_VARS['id']) ? $HTTP_GET_VARS['id']: $HTTP_POST_VARS['id']; - $sql = 'SELECT * - FROM ' . SMILIES_TABLE . ' + $sql = 'SELECT * + FROM ' . SMILIES_TABLE . ' WHERE smilies_id = ' . $smiley_id; $result = $db->sql_query($sql); if( !$result ) @@ -116,7 +125,7 @@ switch($mode) { $smiley_selected = ($smiley_images[$i] == $smile_data['smile_url']) ? "SELECTED" : ""; $template->assign_block_vars("smile_images", array( - "FILENAME" => $smiley_images[$i], + "FILENAME" => $smiley_images[$i], "SELECTED" => $smiley_selected) ); } @@ -175,18 +184,18 @@ switch($mode) // // Proceed with updating the smiley table. // - $sql = 'UPDATE ' . SMILIES_TABLE . " - SET code='$smile_code', smile_url='$smile_url', emoticon='$smile_emotion' + $sql = 'UPDATE ' . SMILIES_TABLE . " + SET code='$smile_code', smile_url='$smile_url', emoticon='$smile_emotion' WHERE smilies_id = $smile_id"; $result = $db->sql_query($sql); - if( !$result ) + if( !$result ) { message_die(GENERAL_ERROR, $lang['smile_edit_err'], "", __LINE__, __FILE__, $sql); } $template->set_filenames(array( "body" => "admin/smile_action.tpl") ); - + $template->assign_vars(array( "S_SMILEY_URL" => append_sid("admin_smilies.$phpEx"), "L_SMILEY_TITLE" => $lang['smiley_title'], @@ -213,7 +222,7 @@ switch($mode) // // Save the data to the smiley table. // - $sql = 'INSERT INTO ' . SMILIES_TABLE . " (code, smile_url, emoticon) + $sql = 'INSERT INTO ' . SMILIES_TABLE . " (code, smile_url, emoticon) VALUES ('$smile_code', '$smile_url', '$smile_emotion')"; $result = $db->sql_query($sql); if( !$result ) @@ -242,11 +251,11 @@ switch($mode) // // Get a listing of smileys. // - $sql = 'SELECT * + $sql = 'SELECT * FROM ' . SMILIES_TABLE; $result = $db->sql_query($sql); if( !$result ) - { + { message_die(GENERAL_ERROR, $lang['smile_load_err'], "", __LINE__, __FILE__, $sql); } $smilies = $db->sql_fetchrowset($result); @@ -260,7 +269,7 @@ switch($mode) $my_path = append_sid("admin_smilies.$phpEx"); if(!ereg('\?', $my_path)) { - $my_path .= '?'; + $my_path .= '?'; } $template->assign_vars(array( "S_SMILEY_URL" => $my_path, diff --git a/phpBB/admin/admin_user_ban.php b/phpBB/admin/admin_user_ban.php index b8c8f1de62..8327215093 100644 --- a/phpBB/admin/admin_user_ban.php +++ b/phpBB/admin/admin_user_ban.php @@ -1,15 +1,24 @@ <?php -/*************************************************************************** - * admin_user_ban.php - * ------------------- - * begin : Tuesday, Jul 31, 2001 - * copyright : (C) 2001 The phpBB Group - * email : support@phpbb.com - * - * $Id$ - * - * - ***************************************************************************/ +/*************************************************************************** + * admin_user_ban.php + * ------------------- + * begin : Tuesday, Jul 31, 2001 + * copyright : (C) 2001 The phpBB Group + * email : support@phpbb.com + * + * $Id$ + * + * + ***************************************************************************/ + +/*************************************************************************** + * + * 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. + * + ***************************************************************************/ if($setmodules == 1) { @@ -143,7 +152,7 @@ if( isset($HTTP_POST_VARS['submit']) && isset($HTTP_POST_VARS['bancontrol']) ) for($i = 0; $i < count($email_list_temp); $i++) { // - // This ereg match is based on one by php@unreelpro.com + // This ereg match is based on one by php@unreelpro.com // contained in the annotated php manual at php.com (ereg // section) // @@ -154,7 +163,7 @@ if( isset($HTTP_POST_VARS['submit']) && isset($HTTP_POST_VARS['bancontrol']) ) } } - $sql = "SELECT * + $sql = "SELECT * FROM " . BANLIST_TABLE; if( !$result = $db->sql_query($sql) ) { @@ -179,7 +188,7 @@ if( isset($HTTP_POST_VARS['submit']) && isset($HTTP_POST_VARS['bancontrol']) ) { $kill_session_sql .= ( ($kill_session_sql != "") ? " OR " : "" ) . "session_user_id = $user_list[$i]"; - $sql = "INSERT INTO " . BANLIST_TABLE . " (ban_userid) + $sql = "INSERT INTO " . BANLIST_TABLE . " (ban_userid) VALUES ('" . $user_list[$i] . "')"; if( !$result = $db->sql_query($sql) ) { @@ -212,7 +221,7 @@ if( isset($HTTP_POST_VARS['submit']) && isset($HTTP_POST_VARS['bancontrol']) ) $kill_session_sql .= ( ($kill_session_sql != "") ? " OR " : "" ) . $kill_ip_sql; - $sql = "INSERT INTO " . BANLIST_TABLE . " (ban_ip) + $sql = "INSERT INTO " . BANLIST_TABLE . " (ban_ip) VALUES ('" . $ip_list[$i] . "')"; if( !$result = $db->sql_query($sql) ) { @@ -222,7 +231,7 @@ if( isset($HTTP_POST_VARS['submit']) && isset($HTTP_POST_VARS['bancontrol']) ) } // - // Now we'll delete all entries from the + // Now we'll delete all entries from the // session table with any of the banned // user or IP info just entered into the // ban table ... this will force a session @@ -231,14 +240,14 @@ if( isset($HTTP_POST_VARS['submit']) && isset($HTTP_POST_VARS['bancontrol']) ) // if($kill_session_sql != "") { - $sql = "DELETE FROM " . SESSIONS_TABLE . " + $sql = "DELETE FROM " . SESSIONS_TABLE . " WHERE $kill_session_sql"; if( !$result = $db->sql_query($sql) ) { message_die(GENERAL_ERROR, "Couldn't delete banned sessions from database", "", __LINE__, __FILE__, $sql); } } - + for($i = 0; $i < count($email_list); $i++) { $in_banlist = false; @@ -252,7 +261,7 @@ if( isset($HTTP_POST_VARS['submit']) && isset($HTTP_POST_VARS['bancontrol']) ) if(!$in_banlist) { - $sql = "INSERT INTO " . BANLIST_TABLE . " (ban_email) + $sql = "INSERT INTO " . BANLIST_TABLE . " (ban_email) VALUES ('" . $email_list[$i] . "')"; if( !$result = $db->sql_query($sql) ) { @@ -319,7 +328,7 @@ if( isset($HTTP_POST_VARS['submit']) && isset($HTTP_POST_VARS['bancontrol']) ) if($where_sql != "") { - $sql = "DELETE FROM " . BANLIST_TABLE . " + $sql = "DELETE FROM " . BANLIST_TABLE . " WHERE $where_sql"; if( !$result = $db->sql_query($sql) ) { @@ -336,8 +345,8 @@ else { $userban_count = 0; - $sql = "SELECT user_id, username - FROM " . USERS_TABLE . " + $sql = "SELECT user_id, username + FROM " . USERS_TABLE . " WHERE user_id <> " . ANONYMOUS . " ORDER BY user_id ASC"; $u_result = $db->sql_query($sql); @@ -358,22 +367,22 @@ else $s_hidden_fields = "<input type=\"hidden\" name=\"bancontrol\" value=\"ban\" />"; $template->assign_vars(array( - "L_BAN_TITLE" => $lang['Ban_control'], - "L_BAN_EXPLAIN" => $lang['Ban_explain'], - "L_BAN_EXPLAIN_WARN" => $lang['Ban_explain_warn'], + "L_BAN_TITLE" => $lang['Ban_control'], + "L_BAN_EXPLAIN" => $lang['Ban_explain'], + "L_BAN_EXPLAIN_WARN" => $lang['Ban_explain_warn'], "L_BAN_USER" => $lang['Ban_username'], "L_BAN_USER_EXPLAIN" => $lang['Ban_username_explain'], "L_BAN_IP" => $lang['Ban_IP'], - "L_IP_OR_HOSTNAME" => $lang['IP_hostname'], - "L_BAN_IP_EXPLAIN" => $lang['Ban_IP_explain'], - "L_BAN_EMAIL" => $lang['Ban_email'], + "L_IP_OR_HOSTNAME" => $lang['IP_hostname'], + "L_BAN_IP_EXPLAIN" => $lang['Ban_IP_explain'], + "L_BAN_EMAIL" => $lang['Ban_email'], "L_EMAIL_ADDRESS" => $lang['Email_address'], - "L_BAN_EMAIL_EXPLAIN" => $lang['Ban_email_explain'], - "L_SUBMIT" => $lang['Submit'], - "L_RESET" => $lang['Reset'], - - "S_USERLIST_SELECT" => $select_userlist, - "S_HIDDEN_FIELDS" => $s_hidden_fields, + "L_BAN_EMAIL_EXPLAIN" => $lang['Ban_email_explain'], + "L_SUBMIT" => $lang['Submit'], + "L_RESET" => $lang['Reset'], + + "S_USERLIST_SELECT" => $select_userlist, + "S_HIDDEN_FIELDS" => $s_hidden_fields, "S_BAN_ACTION" => append_sid("admin_user_ban.$phpEx")) ); } @@ -383,10 +392,10 @@ else $ipban_count = 0; $emailban_count = 0; - $sql = "SELECT b.ban_id, u.user_id, u.username + $sql = "SELECT b.ban_id, u.user_id, u.username FROM " . BANLIST_TABLE . " b, " . USERS_TABLE . " u - WHERE u.user_id = b.ban_userid - AND b.ban_userid <> 0 + WHERE u.user_id = b.ban_userid + AND b.ban_userid <> 0 AND u.user_id <> " . ANONYMOUS . " ORDER BY u.user_id ASC"; $u_result = $db->sql_query($sql); @@ -411,7 +420,7 @@ else $select_userlist = "<select name=\"user[]\"" . ( ($userban_count > 1) ? "multiple=\"multiple\" size=\"" . min(5, $userban_count) . "\">" : ">" ) . $select_userlist; $select_userlist .= "</select>"; - $sql = "SELECT ban_id, ban_ip, ban_email + $sql = "SELECT ban_id, ban_ip, ban_email FROM " . BANLIST_TABLE; $b_result = $db->sql_query($sql); $banlist = $db->sql_fetchrowset($b_result); @@ -465,23 +474,23 @@ else $s_hidden_fields = "<input type=\"hidden\" name=\"bancontrol\" value=\"unban\" />"; $template->assign_vars(array( - "L_BAN_TITLE" => $lang['Ban_control'], - "L_BAN_EXPLAIN" => $lang['Ban_explain'], + "L_BAN_TITLE" => $lang['Ban_control'], + "L_BAN_EXPLAIN" => $lang['Ban_explain'], "L_BAN_USER" => $lang['Unban_username'], "L_BAN_USER_EXPLAIN" => $lang['Unban_username_explain'], "L_BAN_IP" => $lang['Unban_IP'], - "L_IP_OR_HOSTNAME" => $lang['IP_hostname'], - "L_BAN_IP_EXPLAIN" => $lang['Unban_IP_explain'], - "L_BAN_EMAIL" => $lang['Unban_email'], + "L_IP_OR_HOSTNAME" => $lang['IP_hostname'], + "L_BAN_IP_EXPLAIN" => $lang['Unban_IP_explain'], + "L_BAN_EMAIL" => $lang['Unban_email'], "L_EMAIL_ADDRESS" => $lang['Email_address'], - "L_BAN_EMAIL_EXPLAIN" => $lang['Unban_email_explain'], - "L_SUBMIT" => $lang['Submit'], - "L_RESET" => $lang['Reset'], - - "S_USERLIST_SELECT" => $select_userlist, - "S_IPLIST_SELECT" => $select_iplist, - "S_EMAILLIST_SELECT" => $select_emaillist, - "S_HIDDEN_FIELDS" => $s_hidden_fields, + "L_BAN_EMAIL_EXPLAIN" => $lang['Unban_email_explain'], + "L_SUBMIT" => $lang['Submit'], + "L_RESET" => $lang['Reset'], + + "S_USERLIST_SELECT" => $select_userlist, + "S_IPLIST_SELECT" => $select_iplist, + "S_EMAILLIST_SELECT" => $select_emaillist, + "S_HIDDEN_FIELDS" => $s_hidden_fields, "S_BAN_ACTION" => append_sid("admin_user_ban.$phpEx")) ); diff --git a/phpBB/admin/admin_userauth.php b/phpBB/admin/admin_userauth.php index 609d5b0021..caae189210 100644 --- a/phpBB/admin/admin_userauth.php +++ b/phpBB/admin/admin_userauth.php @@ -1,15 +1,24 @@ <?php -/*************************************************************************** - * admin_userauth.php - * ------------------- - * begin : Saturday, Feb 13, 2001 - * copyright : (C) 2001 The phpBB Group - * email : support@phpbb.com - * - * $Id$ - * - * - ***************************************************************************/ +/*************************************************************************** + * admin_userauth.php + * ------------------- + * begin : Saturday, Feb 13, 2001 + * copyright : (C) 2001 The phpBB Group + * email : support@phpbb.com + * + * $Id$ + * + * + ***************************************************************************/ + +/*************************************************************************** + * + * 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. + * + ***************************************************************************/ if($setmodules == 1) { @@ -46,13 +55,13 @@ else if( $userdata['user_level'] != ADMIN ) $forum_auth_fields = array("auth_view", "auth_read", "auth_post", "auth_reply", "auth_edit", "auth_delete", "auth_sticky", "auth_announce"); $auth_field_match = array( - "auth_view" => AUTH_VIEW, - "auth_read" => AUTH_READ, - "auth_post" => AUTH_POST, - "auth_reply" => AUTH_REPLY, - "auth_edit" => AUTH_EDIT, - "auth_delete" => AUTH_DELETE, - "auth_sticky" => AUTH_STICKY, + "auth_view" => AUTH_VIEW, + "auth_read" => AUTH_READ, + "auth_post" => AUTH_POST, + "auth_reply" => AUTH_REPLY, + "auth_edit" => AUTH_EDIT, + "auth_delete" => AUTH_DELETE, + "auth_sticky" => AUTH_STICKY, "auth_announce" => AUTH_ANNOUNCE); $field_names = array( @@ -79,7 +88,7 @@ function a_auth_check_user($type, $key, $u_auth, $is_admin) if(!$single_user) { $single_user = $u_ary['group_single_user']; - + $result = 0; switch($type) { @@ -100,7 +109,7 @@ function a_auth_check_user($type, $key, $u_auth, $is_admin) $auth_user['single_group'] = ($single_user) ? "single" : "group"; } - + return $auth_user; } // @@ -119,15 +128,15 @@ if(isset($HTTP_POST_VARS['submit']) && !empty($HTTP_POST_VARS[POST_USERS_URL])) // // This is where things become fun ... // - + // // Get group_id for this user_id // - $sql_groupid = "SELECT ug.group_id, u.user_level - FROM " . USER_GROUP_TABLE . " ug, " . USERS_TABLE . " u, " . GROUPS_TABLE . " g - WHERE u.user_id = $user_id - AND ug.user_id = u.user_id - AND g.group_id = ug.group_id + $sql_groupid = "SELECT ug.group_id, u.user_level + FROM " . USER_GROUP_TABLE . " ug, " . USERS_TABLE . " u, " . GROUPS_TABLE . " g + WHERE u.user_id = $user_id + AND ug.user_id = u.user_id + AND g.group_id = ug.group_id AND g.group_single_user = " . TRUE; if(!$result = $db->sql_query($sql_groupid)) { @@ -148,26 +157,26 @@ if(isset($HTTP_POST_VARS['submit']) && !empty($HTTP_POST_VARS[POST_USERS_URL])) // // Delete any entries granting in auth_access // - $sql = "UPDATE " . AUTH_ACCESS_TABLE . " - SET auth_view = 0, auth_read = 0, auth_post = 0, auth_reply = 0, auth_edit = 0, auth_delete = 0, auth_sticky = 0, auth_announce = 0 + $sql = "UPDATE " . AUTH_ACCESS_TABLE . " + SET auth_view = 0, auth_read = 0, auth_post = 0, auth_reply = 0, auth_edit = 0, auth_delete = 0, auth_sticky = 0, auth_announce = 0 WHERE group_id = " . $ug_info['group_id']; if(!$result = $db->sql_query($sql)) { // Error ... - } + } // // Update users level, reset to USER // - $sql = "UPDATE " . USERS_TABLE . " - SET user_level = " . USER . " + $sql = "UPDATE " . USERS_TABLE . " + SET user_level = " . USER . " WHERE user_id = $user_id"; if(!$result = $db->sql_query($sql)) { // Error ... } } - + header("Location: admin_userauth.$phpEx?" . POST_USERS_URL . "=$user_id"); } @@ -177,28 +186,28 @@ if(isset($HTTP_POST_VARS['submit']) && !empty($HTTP_POST_VARS[POST_USERS_URL])) // // Make user an admin (if already user) // - $sql_userlevel = "UPDATE " . USERS_TABLE . " - SET user_level = " . ADMIN . " + $sql_userlevel = "UPDATE " . USERS_TABLE . " + SET user_level = " . ADMIN . " WHERE user_id = $user_id"; if(!$result = $db->sql_query($sql_userlevel)) { // Error ... } - + // Delete any entries in auth_access, they - // are unrequired if user is becoming an + // are unrequired if user is becoming an // admin // - $sql_unmod = "UPDATE " . AUTH_ACCESS_TABLE . " - SET auth_view = 0, auth_read = 0, auth_post = 0, auth_reply = 0, auth_edit = 0, auth_delete = 0, auth_sticky = 0, auth_announce = 0 + $sql_unmod = "UPDATE " . AUTH_ACCESS_TABLE . " + SET auth_view = 0, auth_read = 0, auth_post = 0, auth_reply = 0, auth_edit = 0, auth_delete = 0, auth_sticky = 0, auth_announce = 0 WHERE group_id = " . $ug_info['group_id']; if(!$result = $db->sql_query($sql_unmod)) { // Error ... - } + } - $sql_unauth = "DELETE FROM " . AUTH_ACCESS_TABLE . " - WHERE group_id = $group_id + $sql_unauth = "DELETE FROM " . AUTH_ACCESS_TABLE . " + WHERE group_id = $group_id AND auth_mod = 0"; if(!$result = $db->sql_query($sql_unauth)) { @@ -211,13 +220,13 @@ if(isset($HTTP_POST_VARS['submit']) && !empty($HTTP_POST_VARS[POST_USERS_URL])) else { // - // Pull all the auth/group + // Pull all the auth/group // for this user // - $sql = "SELECT aa.forum_id, aa.auth_view, aa.auth_read, aa.auth_post, aa.auth_reply, aa.auth_edit, aa.auth_delete, aa.auth_sticky, aa.auth_announce, aa.auth_mod, g.group_single_user, g.group_id, g.group_name - FROM " . AUTH_ACCESS_TABLE . " aa, " . USER_GROUP_TABLE . " ug, " . GROUPS_TABLE. " g - WHERE ug.user_id = $user_id - AND g.group_id = ug.group_id + $sql = "SELECT aa.forum_id, aa.auth_view, aa.auth_read, aa.auth_post, aa.auth_reply, aa.auth_edit, aa.auth_delete, aa.auth_sticky, aa.auth_announce, aa.auth_mod, g.group_single_user, g.group_id, g.group_name + FROM " . AUTH_ACCESS_TABLE . " aa, " . USER_GROUP_TABLE . " ug, " . GROUPS_TABLE. " g + WHERE ug.user_id = $user_id + AND g.group_id = ug.group_id AND aa.group_id = ug.group_id"; $au_result = $db->sql_query($sql); @@ -226,9 +235,9 @@ if(isset($HTTP_POST_VARS['submit']) && !empty($HTTP_POST_VARS[POST_USERS_URL])) $u_access = $db->sql_fetchrowset($au_result); } - $sql = "SELECT f.forum_id, f.forum_name, f.auth_view, f.auth_read, f.auth_post, f.auth_reply, f.auth_edit, f.auth_delete, f.auth_sticky, f.auth_announce - FROM " . FORUMS_TABLE . " f, " . CATEGORIES_TABLE . " c - WHERE c.cat_id = f.cat_id + $sql = "SELECT f.forum_id, f.forum_name, f.auth_view, f.auth_read, f.auth_post, f.auth_reply, f.auth_edit, f.auth_delete, f.auth_sticky, f.auth_announce + FROM " . FORUMS_TABLE . " f, " . CATEGORIES_TABLE . " c + WHERE c.cat_id = f.cat_id ORDER BY c.cat_order ASC, f.forum_order ASC"; $fa_result = $db->sql_query($sql); @@ -265,23 +274,23 @@ if(isset($HTTP_POST_VARS['submit']) && !empty($HTTP_POST_VARS[POST_USERS_URL])) } } } - + // // The data above lists access and moderator permissions // for this user given by all the groups they belong to. // These values must be checked against those requested - // by the admin and where necessary the admin is + // by the admin and where necessary the admin is // informed of problems. For example, if a group the user // belongs to already grants the user moderator status // then the user won't have moderator status enabled. - // If the user has a group entry preventing access to a + // If the user has a group entry preventing access to a // forum then again, we must warn the admin that giving // the user access goes against the group permissions // (although in this case we'll go ahead and add the user) // - + + // // - // // $warning_mod_grpid = array(); $warning_mod_grpname = array(); @@ -342,15 +351,15 @@ if(isset($HTTP_POST_VARS['submit']) && !empty($HTTP_POST_VARS[POST_USERS_URL])) { if($new_mod_status) { - $valid_auth_mod_sql[$this_forum_id] = "UPDATE " . AUTH_ACCESS_TABLE . " - SET auth_view = 0, auth_read = 0, auth_post = 0, auth_reply = 0, auth_edit = 0, auth_delete = 0, auth_announce = 0, auth_sticky = 0, auth_mod = $new_mod_status - WHERE forum_id = $this_forum_id + $valid_auth_mod_sql[$this_forum_id] = "UPDATE " . AUTH_ACCESS_TABLE . " + SET auth_view = 0, auth_read = 0, auth_post = 0, auth_reply = 0, auth_edit = 0, auth_delete = 0, auth_announce = 0, auth_sticky = 0, auth_mod = $new_mod_status + WHERE forum_id = $this_forum_id AND group_id = " . $ug_info['group_id']; } else { - $valid_auth_mod_sql[$this_forum_id] = "DELETE FROM " . AUTH_ACCESS_TABLE . " - WHERE forum_id = $this_forum_id + $valid_auth_mod_sql[$this_forum_id] = "DELETE FROM " . AUTH_ACCESS_TABLE . " + WHERE forum_id = $this_forum_id AND group_id = " . $ug_info['group_id']; } $update_mod = TRUE; @@ -360,8 +369,8 @@ if(isset($HTTP_POST_VARS['submit']) && !empty($HTTP_POST_VARS[POST_USERS_URL])) if(!$update_mod && $new_mod_status) { - $valid_auth_mod_sql[$this_forum_id] = "INSERT INTO " . AUTH_ACCESS_TABLE . " - (forum_id, group_id, auth_mod) + $valid_auth_mod_sql[$this_forum_id] = "INSERT INTO " . AUTH_ACCESS_TABLE . " + (forum_id, group_id, auth_mod) VALUES ($this_forum_id, " . $ug_info['group_id'] . ", $new_mod_status)"; $update_mod = TRUE; } @@ -443,8 +452,8 @@ if(isset($HTTP_POST_VARS['submit']) && !empty($HTTP_POST_VARS[POST_USERS_URL])) } else { - $valid_auth_prv_sql[$this_forum_id] = "DELETE FROM " . AUTH_ACCESS_TABLE . " - WHERE forum_id = $this_forum_id + $valid_auth_prv_sql[$this_forum_id] = "DELETE FROM " . AUTH_ACCESS_TABLE . " + WHERE forum_id = $this_forum_id AND group_id = " . $ug_info['group_id']; } } @@ -556,7 +565,7 @@ if(isset($HTTP_POST_VARS['submit']) && !empty($HTTP_POST_VARS[POST_USERS_URL])) ); $template->assign_vars(array( - "MESSAGE_TITLE" => $lang['Conflict_warning'], + "MESSAGE_TITLE" => $lang['Conflict_warning'], "MESSAGE_TEXT" => $warning_list) ); } @@ -571,11 +580,11 @@ else if(empty($HTTP_GET_VARS[POST_USERS_URL])) // // Default user selection box // - // This should be altered on the final system + // This should be altered on the final system // - $sql = "SELECT user_id, username - FROM " . USERS_TABLE . " + $sql = "SELECT user_id, username + FROM " . USERS_TABLE . " WHERE user_id <> " . ANONYMOUS; $u_result = $db->sql_query($sql); $user_list = $db->sql_fetchrowset($u_result); @@ -594,12 +603,12 @@ else if(empty($HTTP_GET_VARS[POST_USERS_URL])) ); $template->assign_vars(array( - "L_AUTH_TITLE" => $lang['User'] . " " . $lang['Auth_Control'], - "L_AUTH_EXPLAIN" => $lang['User_auth_explain'], - "L_AUTH_SELECT" => $lang['Select_a'] . " " . $lang['User'], - "L_LOOK_UP" => $lang['Look_up'] . " " . $lang['User'], + "L_AUTH_TITLE" => $lang['User'] . " " . $lang['Auth_Control'], + "L_AUTH_EXPLAIN" => $lang['User_auth_explain'], + "L_AUTH_SELECT" => $lang['Select_a'] . " " . $lang['User'], + "L_LOOK_UP" => $lang['Look_up'] . " " . $lang['User'], - "S_AUTH_ACTION" => append_sid("admin_userauth.$phpEx"), + "S_AUTH_ACTION" => append_sid("admin_userauth.$phpEx"), "S_AUTH_SELECT" => $select_list) ); @@ -626,9 +635,9 @@ else "body" => "admin/auth_ug_body.tpl") ); - $sql = "SELECT f.* - FROM " . FORUMS_TABLE . " f, " . CATEGORIES_TABLE . " c - WHERE c.cat_id = f.cat_id + $sql = "SELECT f.* + FROM " . FORUMS_TABLE . " f, " . CATEGORIES_TABLE . " c + WHERE c.cat_id = f.cat_id ORDER BY c.cat_order ASC, f.forum_order ASC"; $fa_result = $db->sql_query($sql); @@ -654,19 +663,19 @@ else } } - $sql = "SELECT u.user_id, u.username, u.user_level, g.group_id, g.group_name, g.group_single_user - FROM " . USERS_TABLE . " u, " . GROUPS_TABLE . " g, " . USER_GROUP_TABLE . " ug - WHERE u.user_id = $user_id - AND ug.user_id = u.user_id + $sql = "SELECT u.user_id, u.username, u.user_level, g.group_id, g.group_name, g.group_single_user + FROM " . USERS_TABLE . " u, " . GROUPS_TABLE . " g, " . USER_GROUP_TABLE . " ug + WHERE u.user_id = $user_id + AND ug.user_id = u.user_id AND g.group_id = ug.group_id"; $u_result = $db->sql_query($sql); $userinf = $db->sql_fetchrowset($u_result); - $sql = "SELECT aa.* - FROM " . AUTH_ACCESS_TABLE . " aa, " . USER_GROUP_TABLE . " ug, " . GROUPS_TABLE. " g - WHERE ug.user_id = $user_id - AND g.group_id = ug.group_id - AND aa.group_id = ug.group_id + $sql = "SELECT aa.* + FROM " . AUTH_ACCESS_TABLE . " aa, " . USER_GROUP_TABLE . " ug, " . GROUPS_TABLE. " g + WHERE ug.user_id = $user_id + AND g.group_id = ug.group_id + AND aa.group_id = ug.group_id AND g.group_single_user = " . TRUE; $au_result = $db->sql_query($sql); @@ -714,7 +723,7 @@ else $auth_user[$f_forum_id][$key] = 0; } break; - + case AUTH_MOD: if($user_id != ANONYMOUS && $num_forum_access[$f_forum_id]) { @@ -850,12 +859,12 @@ else $row_color = ( !($i%2) ) ? $theme['td_color1'] : $theme['td_color2']; $template->assign_block_vars("forums", array( - "ROW_COLOR" => "#" . $row_color, - "ROW_CLASS" => $row_class, - "FORUM_NAME" => $forum_access[$i]['forum_name'], + "ROW_COLOR" => "#" . $row_color, + "ROW_CLASS" => $row_class, + "FORUM_NAME" => $forum_access[$i]['forum_name'], + + "U_FORUM_AUTH" => append_sid("admin_forumauth.$phpEx?f=" . $forum_access[$i]['forum_id']), - "U_FORUM_AUTH" => append_sid("admin_forumauth.$phpEx?f=" . $forum_access[$i]['forum_id']), - "S_MOD_SELECT" => $optionlist_mod) ); @@ -931,31 +940,31 @@ else $s_column_span++; } } - + $switch_mode = "admin_userauth.$phpEx?" . POST_USERS_URL . "=" . $user_id . "&adv="; $switch_mode .= ( empty($adv) ) ? "1" : "0"; $switch_mode_text = ( empty($adv) ) ? $lang['Advanced_mode'] : $lang['Simple_mode']; $u_switch_mode = '<a href="' . $switch_mode . '">' . $switch_mode_text . '</a>'; $template->assign_vars(array( - "USERNAME" => $t_username, + "USERNAME" => $t_username, "USER_GROUP_MEMBERSHIPS" => $lang['This_user_is'] . " " . $s_user_type . " " . $lang['and_belongs_groups'] . ": " . $t_usergroup_list, - "L_USER_OR_GROUPNAME" => $lang['Username'], - "L_USER_OR_GROUP" => $lang['User'], + "L_USER_OR_GROUPNAME" => $lang['Username'], + "L_USER_OR_GROUP" => $lang['User'], - "L_AUTH_TITLE" => $lang['User'] . " " . $lang['Auth_Control'], - "L_AUTH_EXPLAIN" => $lang['User_auth_explain'], + "L_AUTH_TITLE" => $lang['User'] . " " . $lang['Auth_Control'], + "L_AUTH_EXPLAIN" => $lang['User_auth_explain'], "L_MODERATOR_STATUS" => $lang['Moderator_status'], - "L_PERMISSIONS" => $lang['Permissions'], + "L_PERMISSIONS" => $lang['Permissions'], "L_SUBMIT_CHANGES" => $lang['Submit_changes'], "L_RESET_CHANGES" => $lang['Reset_changes'], - "L_MODERATOR_STATUS" => $lang['Moderator_status'], + "L_MODERATOR_STATUS" => $lang['Moderator_status'], - "U_USER_OR_GROUP" => append_sid("admin_userauth.$phpEx"), + "U_USER_OR_GROUP" => append_sid("admin_userauth.$phpEx"), "U_SWITCH_MODE" => $u_switch_mode, - "S_COLUMN_SPAN" => $s_column_span, + "S_COLUMN_SPAN" => $s_column_span, "S_AUTH_ACTION" => append_sid("admin_userauth.$phpEx"), "S_HIDDEN_FIELDS" => $s_hidden_fields) ); diff --git a/phpBB/admin/admin_users.php b/phpBB/admin/admin_users.php index 09b375a34b..caeb895e1e 100644 --- a/phpBB/admin/admin_users.php +++ b/phpBB/admin/admin_users.php @@ -1,15 +1,24 @@ <?php -/*************************************************************************** +/*************************************************************************** * admin_users.php - * ------------------- - * begin : Saturday, Feb 13, 2001 - * copyright : (C) 2001 The phpBB Group - * email : support@phpbb.com - * - * $Id$ - * - * - ***************************************************************************/ + * ------------------- + * begin : Saturday, Feb 13, 2001 + * copyright : (C) 2001 The phpBB Group + * email : support@phpbb.com + * + * $Id$ + * + * + ***************************************************************************/ + +/*************************************************************************** + * + * 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. + * + ***************************************************************************/ if($setmodules == 1) { @@ -50,12 +59,12 @@ if ( isset($HTTP_GET_VARS['submit']) ) { // // This looks familiar doesn't it? It's the user profile page! :) // - + // // Let's find out a little about them... // $userdata = get_userdata_from_id($HTTP_GET_VARS[POST_USERS_URL]); - + // // Now parse and display it as a template // @@ -64,7 +73,7 @@ if ( isset($HTTP_GET_VARS['submit']) ) { $email = $userdata['user_email']; $password = ""; $password_confirm = ""; - + $icq = $userdata['user_icq']; $aim = $userdata['user_aim']; $msn = $userdata['user_msnm']; @@ -75,7 +84,7 @@ if ( isset($HTTP_GET_VARS['submit']) ) { $occupation = $userdata['user_occ']; $interests = $userdata['user_interests']; $signature = $userdata['user_sig']; - + $viewemail = $userdata['user_viewemail']; $notifypm = $userdata['user_notify_pm']; $attachsig = $userdata['user_attachsig']; @@ -90,7 +99,7 @@ if ( isset($HTTP_GET_VARS['submit']) ) { $user_timezone = $userdata['user_timezone']; $user_template = $userdata['user_template']; $user_dateformat = $userdata['user_dateformat']; - + if(!isset($coppa)) { $coppa = FALSE; @@ -104,7 +113,7 @@ if ( isset($HTTP_GET_VARS['submit']) ) { $html_status = ($board_config['allow_html']) ? $lang['ON'] : $lang['OFF']; $bbcode_status = ($board_config['allow_bbcode']) ? $lang['ON'] : $lang['OFF']; $smilies_status = ($board_config['allow_smilies']) ? $lang['ON'] : $lang['OFF']; - + $s_hidden_fields = '<input type="hidden" name="mode" value="' . $mode . '" /><input type="hidden" name="agreed" value="true" /><input type="hidden" name="coppa" value="' . $coppa . '" />'; $s_hidden_fields .= '<input type="hidden" name="user_id" value="' . $userdata['user_id'] . '" />'; // Send the users current email address. If they change it, and account activation is turned on @@ -204,10 +213,10 @@ if ( isset($HTTP_GET_VARS['submit']) ) { "L_HTML_IS" => $lang['HTML'] . " " . $lang['is'], "L_BBCODE_IS" => $lang['BBCode'] . " " . $lang['is'], "L_SMILIES_ARE" => $lang['Smilies'] . " " . $lang['are'], - + "L_DELETE_USER" => $lang['User_delete'], "L_DELETE_USER_EXPLAIN" => $lang['User_delete_explain'], - + "S_ALLOW_AVATAR_UPLOAD" => $board_config['allow_avatar_upload'], "S_ALLOW_AVATAR_LOCAL" => $board_config['allow_avatar_local'], "S_ALLOW_AVATAR_REMOTE" => $board_config['allow_avatar_remote'], @@ -278,7 +287,7 @@ else if($HTTP_POST_VARS[submit] && $HTTP_POST_VARS['user_id']) $allowviewonline = (isset($HTTP_POST_VARS['hideonline'])) ? ( ($HTTP_POST_VARS['hideonline']) ? 0 : 1 ) : 1; $notifypm = (isset($HTTP_POST_VARS['notifypm'])) ? $HTTP_POST_VARS['notifypm'] : 1; $attachsig = (isset($HTTP_POST_VARS['attachsig'])) ? $HTTP_POST_VARS['attachsig'] : 0; - + $allowhtml = (isset($HTTP_POST_VARS['allowhtml'])) ? $HTTP_POST_VARS['allowhtml'] : $board_config['allow_html']; $allowbbcode = (isset($HTTP_POST_VARS['allowbbcode'])) ? $HTTP_POST_VARS['allowbbcode'] : $board_config['allow_bbcode']; $allowsmilies = (isset($HTTP_POST_VARS['allowsmilies'])) ? $HTTP_POST_VARS['allowsmilies'] : $board_config['allow_smilies']; @@ -524,7 +533,7 @@ else if($HTTP_POST_VARS[submit] && $HTTP_POST_VARS['user_id']) if(!$error && $file_size > 0 && $file_size < $board_config['avatar_filesize']) { $avatar_data = substr($avatar_data, strlen($avatar_data) - $file_size, $file_size); - + $tmp_filename = tempnam ("/tmp", $userdata['user_id'] . "-"); $fptr = fopen($tmp_filename, "wb"); $bytes_written = fwrite($fptr, $avatar_data, $file_size); @@ -597,13 +606,13 @@ else if($HTTP_POST_VARS[submit] && $HTTP_POST_VARS['user_id']) } // if ... allow_avatar_upload } } - + if(!$error) { if( $HTTP_POST_VARS['deleteuser'] ) { - $sql = "UPDATE " . POSTS_TABLE . " - SET poster_id = '-1' + $sql = "UPDATE " . POSTS_TABLE . " + SET poster_id = '-1' WHERE poster_id = $user_id"; if( $result = $db->sql_query($sql) ) { @@ -620,12 +629,12 @@ else if($HTTP_POST_VARS[submit] && $HTTP_POST_VARS['user_id']) WHERE user_id = $user_id"; if( $result = $db->sql_query($sql) ) { - + include('page_header_admin.'. $phpEx); $template->set_filenames(array( "body" => "admin/admin_message_body.tpl") ); - + $template->assign_vars(array( "MESSAGE_TITLE" => $lang['User'] . $lang['User_admin'], "MESSAGE_TEXT" => $lang['User_deleted']) @@ -668,7 +677,7 @@ else if($HTTP_POST_VARS[submit] && $HTTP_POST_VARS['user_id']) $template->set_filenames(array( "body" => "admin/admin_message_body.tpl") ); - + $template->assign_vars(array( "MESSAGE_TITLE" => $lang['User'] . $lang['User_admin'], "MESSAGE_TEXT" => $lang['Profile_updated']) @@ -691,11 +700,11 @@ else // // Default user selection box // - // This should be altered on the final system + // This should be altered on the final system // - $sql = "SELECT user_id, username - FROM " . USERS_TABLE . " + $sql = "SELECT user_id, username + FROM " . USERS_TABLE . " WHERE user_id <> " . ANONYMOUS; $u_result = $db->sql_query($sql); $user_list = $db->sql_fetchrowset($u_result); @@ -714,12 +723,12 @@ else ); $template->assign_vars(array( - "L_USER_TITLE" => $lang['User'] . " " . $lang['User_admin'], - "L_USER_EXPLAIN" => $lang['User_admin_explain'], - "L_USER_SELECT" => $lang['Select_a'] . " " . $lang['User'], - "L_LOOK_UP" => $lang['Look_up'] . " " . $lang['User'], + "L_USER_TITLE" => $lang['User'] . " " . $lang['User_admin'], + "L_USER_EXPLAIN" => $lang['User_admin_explain'], + "L_USER_SELECT" => $lang['Select_a'] . " " . $lang['User'], + "L_LOOK_UP" => $lang['Look_up'] . " " . $lang['User'], - "S_USER_ACTION" => append_sid("admin_users.$phpEx"), + "S_USER_ACTION" => append_sid("admin_users.$phpEx"), "S_USER_SELECT" => $select_list) ); $template->pparse('body'); diff --git a/phpBB/admin/index.php b/phpBB/admin/index.php index 130b8aa057..86cd7de512 100644 --- a/phpBB/admin/index.php +++ b/phpBB/admin/index.php @@ -1,15 +1,24 @@ <?php -/*************************************************************************** +/*************************************************************************** * (admin) index.php - * ------------------- - * begin : Saturday, Feb 13, 2001 - * copyright : (C) 2001 The phpBB Group - * email : support@phpbb.com - * - * $Id$ - * - * - ***************************************************************************/ + * ------------------- + * begin : Saturday, Feb 13, 2001 + * copyright : (C) 2001 The phpBB Group + * email : support@phpbb.com + * + * $Id$ + * + * + ***************************************************************************/ + +/*************************************************************************** + * + * 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. + * + ***************************************************************************/ $phpbb_root_path = "./../"; include($phpbb_root_path . 'extension.inc'); @@ -20,7 +29,7 @@ include($phpbb_root_path . 'common.'.$phpEx); // $userdata = session_pagestart($user_ip, PAGE_INDEX, $session_length); init_userprefs($userdata); -// +// // End session management // @@ -57,12 +66,12 @@ if( $HTTP_GET_VARS['pane'] == 'left' ) $template->set_filenames(array( "body" => "admin/index_navigate.tpl") ); - + $template->assign_vars(array( "U_BOARD_INDEX" => append_sid("../index.$phpEx"), "U_ADMIN_INDEX" => append_sid("index.$phpEx?pane=right"), - "L_BOARD_INDEX" => "Board Index", + "L_BOARD_INDEX" => "Board Index", "L_ADMIN_INDEX" => "Admin Index") ); @@ -81,8 +90,8 @@ if( $HTTP_GET_VARS['pane'] == 'left' ) $action = preg_replace("'_'", " ", $action); $template->assign_block_vars("catrow.actionrow", array( - "ROW_COLOR" => $row_color, - "ROW_CLASS" => $row_class, + "ROW_COLOR" => $row_color, + "ROW_CLASS" => $row_class, "ACTIONNAME" => $action, "FILE" => $file) ); @@ -99,29 +108,29 @@ elseif( $HTTP_GET_VARS['pane'] == 'right' ) { include('page_header_admin.'.$phpEx); - + $template->set_filenames(array( "body" => "admin/index_body.tpl") ); $template->assign_vars(array( - "L_WELCOME" => $lang['Welcome_phpBB'], - "L_ADMIN_INTRO" => $lang['Admin_intro'], - "L_FORUM_STATS" => $lang['Forum_stats'], - "L_WHO_IS_ONLINE" => $lang['Who_is_Online'], - "L_LOCATION" => $lang['Location'], + "L_WELCOME" => $lang['Welcome_phpBB'], + "L_ADMIN_INTRO" => $lang['Admin_intro'], + "L_FORUM_STATS" => $lang['Forum_stats'], + "L_WHO_IS_ONLINE" => $lang['Who_is_Online'], + "L_LOCATION" => $lang['Location'], "L_LAST_UPDATE" => $lang['Last_updated'], - "L_IP_ADDRESS" => $lang['IP_Address'], - "L_STATISTIC" => $lang['Statistic'], - "L_VALUE" => $lang['Value'], + "L_IP_ADDRESS" => $lang['IP_Address'], + "L_STATISTIC" => $lang['Statistic'], + "L_VALUE" => $lang['Value'], "L_NUMBER_POSTS" => $lang['Number_posts'], "L_POSTS_PER_DAY" => $lang['Posts_per_day'], "L_NUMBER_TOPICS" => $lang['Number_topics'], - "L_TOPICS_PER_DAY" => $lang['Topics_per_day'], + "L_TOPICS_PER_DAY" => $lang['Topics_per_day'], "L_NUMBER_USERS" => $lang['Number_users'], "L_USERS_PER_DAY" => $lang['Users_per_day'], "L_BOARD_STARTED" => $lang['Board_started'], - "L_AVATAR_DIR_SIZE" => $lang['Avatar_dir_size'], + "L_AVATAR_DIR_SIZE" => $lang['Avatar_dir_size'], "L_DB_SIZE" => $lang['Database_size']) ); @@ -143,7 +152,7 @@ elseif( $HTTP_GET_VARS['pane'] == 'right' ) $avatar_dir_size = 0; if ($avatar_dir = @opendir($phpbb_root_path . $board_config['avatar_path'])) - { + { while($file = readdir($avatar_dir)) { if($file != "." && $file != "..") @@ -164,18 +173,18 @@ elseif( $HTTP_GET_VARS['pane'] == 'right' ) // Borrowed the code from the PHP.net annoted manual, origanally written by: // Jesse (jesse@jess.on.ca) // - if($avatar_dir_size >= 1048576) - { - $avatar_dir_size = round($avatar_dir_size / 1048576 * 100) / 100 . " MB"; - } - else if($avatar_dir_size >= 1024) - { - $avatar_dir_size = round($avatar_dir_size / 1024 * 100) / 100 . " KB"; - } - else - { - $avatar_dir_size = $avatar_dir_size . " Bytes"; - } + if($avatar_dir_size >= 1048576) + { + $avatar_dir_size = round($avatar_dir_size / 1048576 * 100) / 100 . " MB"; + } + else if($avatar_dir_size >= 1024) + { + $avatar_dir_size = round($avatar_dir_size / 1024 * 100) / 100 . " KB"; + } + else + { + $avatar_dir_size = $avatar_dir_size . " Bytes"; + } if($posts_per_day > $total_posts) { @@ -258,7 +267,7 @@ elseif( $HTTP_GET_VARS['pane'] == 'right' ) "POSTS_PER_DAY" => $posts_per_day, "TOPICS_PER_DAY" => $topics_per_day, "USERS_PER_DAY" => $users_per_day, - "AVATAR_DIR_SIZE" => $avatar_dir_size, + "AVATAR_DIR_SIZE" => $avatar_dir_size, "DB_SIZE" => $dbsize) ); // @@ -269,7 +278,7 @@ elseif( $HTTP_GET_VARS['pane'] == 'right' ) // Get users online information. // $sql = "SELECT u.username, u.user_id, u.user_allow_viewonline, s.session_page, s.session_logged_in, s.session_time, s.session_ip - FROM " . USERS_TABLE . " u, " . SESSIONS_TABLE . " s + FROM " . USERS_TABLE . " u, " . SESSIONS_TABLE . " s WHERE u.user_id = s.session_user_id AND s.session_time >= " . (time()-300) . " ORDER BY s.session_time DESC"; @@ -370,14 +379,14 @@ elseif( $HTTP_GET_VARS['pane'] == 'right' ) $row_color = "#" . ( ( !($count % 2) ) ? $theme['td_color1'] : $theme['td_color2']); $row_class = ( !($count % 2) ) ? $theme['td_class1'] : $theme['td_class2']; $count++; - + $ip_address = decode_ip($onlinerow[$i]['session_ip']); - // + // // This resolves the users IP to a host name, but it REALLY slows the page down // //$host_name = gethostbyaddr($ip_address); //$ip_address = $ip_address . " ($host_name)"; - + if(empty($username)) { $username = $lang['Guest']; @@ -403,7 +412,7 @@ elseif( $HTTP_GET_VARS['pane'] == 'right' ) } else -{ +{ // // Generate frameset // @@ -420,7 +429,7 @@ else header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); $template->pparse("body"); - + exit; } diff --git a/phpBB/admin/page_footer_admin.php b/phpBB/admin/page_footer_admin.php index 2d18791fe6..abfc0f989b 100644 --- a/phpBB/admin/page_footer_admin.php +++ b/phpBB/admin/page_footer_admin.php @@ -11,6 +11,15 @@ * ***************************************************************************/ +/*************************************************************************** + * + * 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. + * + ***************************************************************************/ + // // Show the overall footer. // @@ -54,17 +63,17 @@ if($do_gzip_compress) // // Borrowed from php.net! // - $gzip_contents = ob_get_contents(); - ob_end_clean(); + $gzip_contents = ob_get_contents(); + ob_end_clean(); - $gzip_size = strlen($gzip_contents); - $gzip_crc = crc32($gzip_contents); + $gzip_size = strlen($gzip_contents); + $gzip_crc = crc32($gzip_contents); - $gzip_contents = gzcompress($gzip_contents, 9); - $gzip_contents = substr($gzip_contents, 0, strlen($gzip_contents) - 4); + $gzip_contents = gzcompress($gzip_contents, 9); + $gzip_contents = substr($gzip_contents, 0, strlen($gzip_contents) - 4); - echo "\x1f\x8b\x08\x00\x00\x00\x00\x00"; - echo $gzip_contents; + echo "\x1f\x8b\x08\x00\x00\x00\x00\x00"; + echo $gzip_contents; echo pack("V", $gzip_crc); echo pack("V", $gzip_size); } diff --git a/phpBB/admin/page_header_admin.php b/phpBB/admin/page_header_admin.php index 448f85f181..54acccc25d 100644 --- a/phpBB/admin/page_header_admin.php +++ b/phpBB/admin/page_header_admin.php @@ -11,6 +11,15 @@ * ***************************************************************************/ +/*************************************************************************** + * + * 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. + * + ***************************************************************************/ + define(HEADER_INC, TRUE); // @@ -31,18 +40,18 @@ if($board_config['gzip_compress']) else if($phpver > "4.0") { if(strstr($HTTP_SERVER_VARS['HTTP_ACCEPT_ENCODING'], 'gzip')) - { + { $do_gzip_compress = TRUE; ob_start(); - ob_implicit_flush(0); + ob_implicit_flush(0); - header("Content-Encoding: gzip"); + header("Content-Encoding: gzip"); } } } $template->set_filenames(array( - "header" => "admin/page_header.tpl") + "header" => "admin/page_header.tpl") ); // @@ -114,21 +123,21 @@ $template->assign_vars(array( "T_TR_COLOR1" => "#".$theme['tr_color1'], "T_TR_COLOR2" => "#".$theme['tr_color2'], "T_TR_COLOR3" => "#".$theme['tr_color3'], - "T_TR_CLASS1" => $theme['tr_class1'], - "T_TR_CLASS2" => $theme['tr_class2'], - "T_TR_CLASS3" => $theme['tr_class3'], + "T_TR_CLASS1" => $theme['tr_class1'], + "T_TR_CLASS2" => $theme['tr_class2'], + "T_TR_CLASS3" => $theme['tr_class3'], "T_TH_COLOR1" => "#".$theme['th_color1'], "T_TH_COLOR2" => "#".$theme['th_color2'], "T_TH_COLOR3" => "#".$theme['th_color3'], - "T_TH_CLASS1" => $theme['th_class1'], - "T_TH_CLASS2" => $theme['th_class2'], - "T_TH_CLASS3" => $theme['th_class3'], + "T_TH_CLASS1" => $theme['th_class1'], + "T_TH_CLASS2" => $theme['th_class2'], + "T_TH_CLASS3" => $theme['th_class3'], "T_TD_COLOR1" => "#".$theme['td_color1'], "T_TD_COLOR2" => "#".$theme['td_color2'], "T_TD_COLOR3" => "#".$theme['td_color3'], - "T_TD_CLASS1" => $theme['td_class1'], - "T_TD_CLASS2" => $theme['td_class2'], - "T_TD_CLASS3" => $theme['td_class3'], + "T_TD_CLASS1" => $theme['td_class1'], + "T_TD_CLASS2" => $theme['td_class2'], + "T_TD_CLASS3" => $theme['td_class3'], "T_FONTFACE1" => $theme['fontface1'], "T_FONTFACE2" => $theme['fontface2'], "T_FONTFACE3" => $theme['fontface3'], @@ -138,8 +147,8 @@ $template->assign_vars(array( "T_FONTCOLOR1" => "#".$theme['fontcolor1'], "T_FONTCOLOR2" => "#".$theme['fontcolor2'], "T_FONTCOLOR3" => "#".$theme['fontcolor3'], - "T_SPAN_CLASS1" => $theme['span_class1'], - "T_SPAN_CLASS2" => $theme['span_class2'], + "T_SPAN_CLASS1" => $theme['span_class1'], + "T_SPAN_CLASS2" => $theme['span_class2'], "T_SPAN_CLASS3" => $theme['span_class3']) ); diff --git a/phpBB/admin/pagestart.inc b/phpBB/admin/pagestart.inc index 9479a24ba1..dd56651f8f 100644 --- a/phpBB/admin/pagestart.inc +++ b/phpBB/admin/pagestart.inc @@ -11,6 +11,15 @@ * ***************************************************************************/ +/*************************************************************************** + * + * 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. + * + ***************************************************************************/ + $phpbb_root_path = "../"; include($phpbb_root_path . 'extension.inc'); include($phpbb_root_path . 'common.'.$phpEx); |