diff options
51 files changed, 1674 insertions, 1177 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); diff --git a/phpBB/common.php b/phpBB/common.php index 894cfd3fc4..35691cfec8 100644 --- a/phpBB/common.php +++ b/phpBB/common.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. + * + ***************************************************************************/ + error_reporting (E_ERROR | E_WARNING | E_PARSE); // This will NOT report uninitialized variables set_magic_quotes_runtime(0); // Disable magic_quotes_runtime diff --git a/phpBB/config.php b/phpBB/config.php index e9e6ef120c..b8cee67675 100644 --- a/phpBB/config.php +++ b/phpBB/config.php @@ -1,18 +1,27 @@ <?php -/*************************************************************************** - * config.php - * ------------------- - * begin : Saturday, Feb 13, 2001 - * copyright : (C) 2001 The phpBB Group - * email : support@phpbb.com - * - * $Id$ - * - * - ***************************************************************************/ +/*************************************************************************** + * config.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. + * + ***************************************************************************/ // DB connection config -// +// // Uncomment the relevant entry // and fill in the required details // @@ -41,7 +50,7 @@ $dbpasswd = ""; /* // -// MSSQL +// MSSQL // $dbms = "mssql"; $dbhost = ""; diff --git a/phpBB/db/mssql.php b/phpBB/db/mssql.php index 393f5fdd24..abde3268cf 100644 --- a/phpBB/db/mssql.php +++ b/phpBB/db/mssql.php @@ -10,6 +10,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(!defined("SQL_LAYER")) { @@ -114,10 +123,10 @@ class sql_db // performance compared to an 'in-built' limit // // Another issue is the 'lack' of a returned true value when a query is valid but has - // no result set (as with all the other DB interfaces). It seems though that it's + // no result set (as with all the other DB interfaces). It seems though that it's // 'fair' to say that if a query returns a false result (ie. no resource id) then the // SQL was valid but had no result set. If the query returns nothing but the rowcount - // returns something then there's a problem. This may well be a false assumption though + // returns something then there's a problem. This may well be a false assumption though // ... needs checking under Windows itself. // if(eregi("LIMIT", $query)) @@ -135,7 +144,7 @@ class sql_db $row_offset = 0; $num_rows = $limits[2]; } - + // $this->query_array[] = $query; @mssql_query("SET ROWCOUNT ".($row_offset + $num_rows)); @@ -185,7 +194,7 @@ class sql_db $this->query_limit_offset[$this->query_result] = -1; $this->query_limit_numrows[$this->query_result] = -1; } - else + else { // $this->query_array[] = $query; @@ -259,7 +268,7 @@ class sql_db $result = @mssql_num_rows($query_id) - $this->query_limit_offset[$query_id]; } else - { + { $result = @mssql_num_rows($query_id); } return $result; @@ -340,7 +349,7 @@ class sql_db } if($query_id) { - + if($this->query_limit_offset[$query_id] > 0) { if($this->query_limit_success) diff --git a/phpBB/db/mysql.php b/phpBB/db/mysql.php index ab558892e3..9922bc0615 100644 --- a/phpBB/db/mysql.php +++ b/phpBB/db/mysql.php @@ -1,6 +1,6 @@ <?php /*************************************************************************** - * mysql.php + * mysql.php * ------------------- * begin : Saturday, Feb 13, 2001 * copyright : (C) 2001 The phpBB Group @@ -10,6 +10,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(!defined("SQL_LAYER")) { @@ -38,7 +47,7 @@ class sql_db if($this->persistency) { $this->db_connect_id = @mysql_pconnect($this->server, $this->user, $this->password); - } + } else { $this->db_connect_id = @mysql_connect($this->server, $this->user, $this->password); diff --git a/phpBB/db/odbc.php b/phpBB/db/odbc.php index ee6ca446d5..4922939ee7 100644 --- a/phpBB/db/odbc.php +++ b/phpBB/db/odbc.php @@ -10,6 +10,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(!defined("SQL_LAYER")) { @@ -130,7 +139,7 @@ class sql_db if(eregi("LIMIT", $query)) { preg_match("/^(.*)LIMIT ([0-9]+)[, ]*([0-9]+)*/s", $query, $limits); - + $query = $limits[1]; if($limits[3]) { diff --git a/phpBB/db/oracle.php b/phpBB/db/oracle.php index 8879567513..5c1c85fb84 100644 --- a/phpBB/db/oracle.php +++ b/phpBB/db/oracle.php @@ -1,6 +1,6 @@ <?php /*************************************************************************** - * oracle.php + * oracle.php * ------------------- * begin : Thrusday Feb 15, 2001 * copyright : (C) 2001 The phpBB Group @@ -10,6 +10,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(!defined("SQL_LAYER")) { @@ -17,12 +26,12 @@ define("SQL_LAYER","oracle"); class sql_db { - + var $db_connect_id; var $query_result; var $row; var $num_queries = 0; - + // // Constructor // @@ -33,11 +42,11 @@ class sql_db $this->password = $sqlpassword; $this->server = $sqlserver; $this->dbname = $database; - + if($this->persistency) { $this->db_connect_id = @OCIPLogon($this->user, $this->password, $this->server); - } + } else { $this->db_connect_id = @OCINLogon($this->user, $this->password, $this->server); @@ -99,7 +108,7 @@ class sql_db $num_rows = $limits[2]; } } - + if(eregi("^(INSERT|UPDATE) ", $query)) { $query = preg_replace("/\\\'/s", "''", $query); @@ -246,10 +255,10 @@ class sql_db { $rows = @OCIFetchStatement($query_id, $results); @OCIExecute($query_id); - for($i = 0; $i <= $rows; $i++) + for($i = 0; $i <= $rows; $i++) { @OCIFetchInto($query_id, $tmp_result, OCI_ASSOC+OCI_RETURN_NULLS); - + for($j = 0; $j < count($tmp_result); $j++) { list($key, $val) = each($tmp_result); @@ -351,7 +360,7 @@ class sql_db return false; } } - + function sql_nextid() { if($this->db_connect_id) diff --git a/phpBB/db/postgres7.php b/phpBB/db/postgres7.php index b06123b167..fefc1fc01d 100644 --- a/phpBB/db/postgres7.php +++ b/phpBB/db/postgres7.php @@ -10,6 +10,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(!defined("SQL_LAYER")) { @@ -19,7 +28,7 @@ class sql_db { var $db_connect_id; - var $query_result; + var $query_result; var $in_transaction = 0; var $row; var $rownum = array(); diff --git a/phpBB/faq.php b/phpBB/faq.php index 53d867430f..574689ee2b 100644 --- a/phpBB/faq.php +++ b/phpBB/faq.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. + * + ***************************************************************************/ + $phpbb_root_path = "./"; include($phpbb_root_path . 'extension.inc'); include($phpbb_root_path . 'common.'.$phpEx); @@ -24,8 +33,8 @@ init_userprefs($userdata); // End session management // -include($phpbb_root_path . 'includes/page_header.'.$phpEx); +include($phpbb_root_path . 'includes/page_header.'.$phpEx); -include($phpbb_root_path . 'includes/page_tail.'.$phpEx); +include($phpbb_root_path . 'includes/page_tail.'.$phpEx); ?>
\ No newline at end of file diff --git a/phpBB/groupcp.php b/phpBB/groupcp.php index 870549048c..3291db901d 100644 --- a/phpBB/groupcp.php +++ b/phpBB/groupcp.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. + * + ***************************************************************************/ + $phpbb_root_path = "./"; include($phpbb_root_path . 'extension.inc'); include($phpbb_root_path . 'common.'.$phpEx); diff --git a/phpBB/includes/auth.php b/phpBB/includes/auth.php index 8da22c1671..575574f9e1 100644 --- a/phpBB/includes/auth.php +++ b/phpBB/includes/auth.php @@ -1,19 +1,28 @@ <?php -/*************************************************************************** +/*************************************************************************** * auth.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. + * + ***************************************************************************/ /* $type's accepted (pre-pend with AUTH_): - VIEW, READ, POST, REPLY, EDIT, DELETE, STICKY, ANNOUNCE, VOTE, VOTECREATE, + VIEW, READ, POST, REPLY, EDIT, DELETE, STICKY, ANNOUNCE, VOTE, VOTECREATE, ATTACH $types pending (for future versions, pre-pend with AUTH_): @@ -21,7 +30,7 @@ Possible options ($type/forum_id combinations): - * If you include a type and forum_id then a specific lookup will be done and + * If you include a type and forum_id then a specific lookup will be done and the single result returned * If you set type to AUTH_ALL and specify a forum_id an array of all auth types @@ -30,8 +39,8 @@ * If you provide a forum_id a specific lookup on that forum will be done * If you set forum_id to AUTH_LIST_ALL and specify a type an array listing the - results for all forums will be returned - + results for all forums will be returned + * If you set forum_id to AUTH_LIST_ALL and type to AUTH_ALL a multidimensional array containing the auth permissions for all types and all forums for that user is returned @@ -115,8 +124,8 @@ function auth($type, $forum_id, $userdata, $f_access = -1) { $forum_match_sql = ($forum_id != AUTH_LIST_ALL) ? "WHERE a.forum_id = $forum_id" : ""; - $sql = "SELECT a.forum_id, $a_sql - FROM " . FORUMS_TABLE . " a + $sql = "SELECT a.forum_id, $a_sql + FROM " . FORUMS_TABLE . " a $forum_match_sql"; $af_result = $db->sql_query($sql); @@ -148,23 +157,23 @@ function auth($type, $forum_id, $userdata, $f_access = -1) { $forum_match_sql = ($forum_id != AUTH_LIST_ALL) ? "AND a.forum_id = $forum_id" : ""; -/* $sql = "SELECT au.forum_id, $a_sql, au.auth_mod, g.group_single_user - FROM " . AUTH_ACCESS_TABLE . " au, " . USER_GROUP_TABLE . " ug, " . GROUPS_TABLE. " g - WHERE ug.user_id = " . $userdata['user_id'] . " - AND g.group_id = ug.group_id - AND ( - ( au.user_id = ug.user_id - AND g.group_id = 0 ) - OR +/* $sql = "SELECT au.forum_id, $a_sql, au.auth_mod, g.group_single_user + FROM " . AUTH_ACCESS_TABLE . " au, " . USER_GROUP_TABLE . " ug, " . GROUPS_TABLE. " g + WHERE ug.user_id = " . $userdata['user_id'] . " + AND g.group_id = ug.group_id + AND ( + ( au.user_id = ug.user_id + AND g.group_id = 0 ) + OR ( au.group_id = ug.group_id AND g.group_id <> 0 ) ) $forum_match_sql";*/ - $sql = "SELECT a.forum_id, $a_sql, a.auth_mod, g.group_single_user - FROM " . AUTH_ACCESS_TABLE . " a, " . USER_GROUP_TABLE . " ug, " . GROUPS_TABLE . " g - WHERE ug.user_id = ".$userdata['user_id']. " - AND g.group_id = ug.group_id - AND a.group_id = ug.group_id + $sql = "SELECT a.forum_id, $a_sql, a.auth_mod, g.group_single_user + FROM " . AUTH_ACCESS_TABLE . " a, " . USER_GROUP_TABLE . " ug, " . GROUPS_TABLE . " g + WHERE ug.user_id = ".$userdata['user_id']. " + AND g.group_id = ug.group_id + AND a.group_id = ug.group_id $forum_match_sql"; $a_result = $db->sql_query($sql); if(!$a_result) @@ -239,12 +248,12 @@ function auth($type, $forum_id, $userdata, $f_access = -1) $auth_user[$key] = ( $userdata['session_logged_in'] ) ? auth_check_user(AUTH_ACL, $key, $u_access, $is_admin) : 0; $auth_user[$key . '_type'] = $lang['Users_granted_access']; break; - + case AUTH_MOD: $auth_user[$key] = ( $userdata['session_logged_in'] ) ? auth_check_user(AUTH_MOD, 'auth_mod', $u_access, $is_admin) : 0; $auth_user[$key . '_type'] = $lang['Moderators']; break; - + case AUTH_ADMIN: $auth_user[$key] = $is_admin; $auth_user[$key . '_type'] = $lang['Administrators']; @@ -278,12 +287,12 @@ function auth($type, $forum_id, $userdata, $f_access = -1) $auth_user[$f_forum_id][$key] = ( $userdata['session_logged_in'] ) ? auth_check_user(AUTH_ACL, $key, $u_access[$f_forum_id], $is_admin) : 0; $auth_user[$f_forum_id][$key . '_type'] = $lang['Users_granted_access']; break; - + case AUTH_MOD: $auth_user[$f_forum_id][$key] = ( $userdata['session_logged_in'] ) ? auth_check_user(AUTH_MOD, 'auth_mod', $u_access[$f_forum_id], $is_admin) : 0; $auth_user[$f_forum_id][$key . '_type'] = $lang['Moderators']; break; - + case AUTH_ADMIN: $auth_user[$f_forum_id][$key] = $is_admin; $auth_user[$f_forum_id][$key . '_type'] = $lang['Administrators']; @@ -329,7 +338,7 @@ function auth_check_user($type, $key, $u_access, $is_admin) if(!$single_user) { $single_user = $u_access[$j]['group_single_user']; - + $result = 0; switch($type) { @@ -353,7 +362,7 @@ function auth_check_user($type, $key, $u_access, $is_admin) { $auth_user = $is_admin; } - + return $auth_user; } diff --git a/phpBB/includes/bbcode.php b/phpBB/includes/bbcode.php index 03e0f0fab4..45c6774d6c 100644 --- a/phpBB/includes/bbcode.php +++ b/phpBB/includes/bbcode.php @@ -10,6 +10,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("BBCODE_UID_LEN", 10); /** diff --git a/phpBB/includes/constants.php b/phpBB/includes/constants.php index 3a6d881b38..9124fcdd47 100644 --- a/phpBB/includes/constants.php +++ b/phpBB/includes/constants.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. + * + ***************************************************************************/ + // // Constants // diff --git a/phpBB/includes/db.php b/phpBB/includes/db.php index dba00ce7ef..1e885d56fa 100644 --- a/phpBB/includes/db.php +++ b/phpBB/includes/db.php @@ -1,15 +1,24 @@ <?php -/*************************************************************************** +/*************************************************************************** * db.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. + * + ***************************************************************************/ switch($dbms) { @@ -36,7 +45,7 @@ switch($dbms) // Make the database connection. $db = new sql_db($dbhost, $dbuser, $dbpasswd, $dbname, false); -if(!$db->db_connect_id) +if(!$db->db_connect_id) { message_die(CRITICAL_ERROR, "Could not connect to the database"); } diff --git a/phpBB/includes/emailer.php b/phpBB/includes/emailer.php index 6859f33bb2..b739a71a4d 100755 --- a/phpBB/includes/emailer.php +++ b/phpBB/includes/emailer.php @@ -10,6 +10,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. + * + ***************************************************************************/ + // // The emailer class has support for attaching files, that isn't implemented // in the 2.0 release but we can probable find some way of using it in a future diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 1245e9f311..1b47e1a8f3 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -11,7 +11,6 @@ * ***************************************************************************/ - /*************************************************************************** * * This program is free software; you can redistribute it and/or modify @@ -184,8 +183,8 @@ function make_jumpbox() function make_forum_box($box_name, $default_forum = -1) { - global $db; - + global $db; + $limit_forums = ""; $sql = "SELECT forum_id, forum_name @@ -218,7 +217,7 @@ function make_forum_box($box_name, $default_forum = -1) } return($boxstring); -} +} // // Initialise user settings on page load function init_userprefs($userdata) @@ -461,7 +460,7 @@ function generate_pagination($base_url, $num_items, $per_page, $start_item, $add function validate_email($email) { global $db; - + if($email != "") { $sql = "SELECT ban_email @@ -480,7 +479,7 @@ function validate_email($email) } } $sql = "SELECT user_email - FROM " . USERS_TABLE . " + FROM " . USERS_TABLE . " WHERE user_email = '" . $email . "'"; if(!$result = $db->sql_query($sql)) { @@ -516,10 +515,10 @@ function validate_username($username) // So we have to use two queries case 'mysql': $sql_users = "SELECT u.username, g.group_name - FROM " . USERS_TABLE . " u, " . GROUPS_TABLE . " g, " . USER_GROUP_TABLE . " ug - WHERE ug.user_id = u.user_id - AND g.group_id = ug.group_id - AND ( LOWER(u.username) = '" . strtolower($username) . "' + FROM " . USERS_TABLE . " u, " . GROUPS_TABLE . " g, " . USER_GROUP_TABLE . " ug + WHERE ug.user_id = u.user_id + AND g.group_id = ug.group_id + AND ( LOWER(u.username) = '" . strtolower($username) . "' OR LOWER(g.group_name) = '" . strtolower($username) . "' )"; $sql_disallow = "SELECT disallow_username FROM " . DISALLOW_TABLE . " @@ -542,12 +541,12 @@ function validate_username($username) default: $sql = "SELECT u.username, g.group_name - FROM " . USERS_TABLE . " u, " . GROUPS_TABLE . " g, " . USER_GROUP_TABLE . " ug - WHERE ug.user_id = u.user_id - AND g.group_id = ug.group_id - AND ( LOWER(u.username) = '" . strtolower($username) . "' + FROM " . USERS_TABLE . " u, " . GROUPS_TABLE . " g, " . USER_GROUP_TABLE . " ug + WHERE ug.user_id = u.user_id + AND g.group_id = ug.group_id + AND ( LOWER(u.username) = '" . strtolower($username) . "' OR LOWER(g.group_name) = '" . strtolower($username) . "' ) - UNION + UNION SELECT disallow_username, NULL FROM " . DISALLOW_TABLE . " WHERE disallow_username = '$username'"; @@ -565,11 +564,11 @@ function validate_username($username) } -function sync($type, $id) +function sync($type, $id) { global $db; - - switch($type) + + switch($type) { case 'forum': $sql = "SELECT max(p.post_id) AS last_post FROM ".POSTS_TABLE." p, ".TOPICS_TABLE." t WHERE p.forum_id = $id AND p.topic_id = t.topic_id AND t.topic_status <> ".TOPIC_MOVED; @@ -585,7 +584,7 @@ function sync($type, $id) { $last_post = 0; } - + $sql = "SELECT count(post_id) AS total FROM ".POSTS_TABLE." WHERE forum_id = $id"; if(!$result = $db->sql_query($sql)) { @@ -595,7 +594,7 @@ function sync($type, $id) { $total_posts = $rowset[0]['total']; } - + $sql = "SELECT count(topic_id) AS total FROM ".TOPICS_TABLE." WHERE forum_id = $id"; if(!$result = $db->sql_query($sql, $db)) { @@ -605,7 +604,7 @@ function sync($type, $id) { $total_topics = $rowset[0]['total']; } - + $sql = "UPDATE ".FORUMS_TABLE." SET forum_last_post_id = '$last_post', forum_posts = $total_posts, forum_topics = $total_topics WHERE forum_id = $id"; if(!$result = $db->sql_query($sql)) { @@ -623,7 +622,7 @@ function sync($type, $id) { $last_post = $row[0]["last_post"]; } - + $sql = "SELECT count(post_id) AS total FROM ".POSTS_TABLE." WHERE topic_id = $id"; if(!$result = $db->sql_query($sql)) { @@ -729,7 +728,7 @@ function theme_select($default) global $db, $board_config, $lang; $sql = "SELECT themes_id, themes_name - FROM " . THEMES_TABLE . " + FROM " . THEMES_TABLE . " WHERE themes_name LIKE '" . $board_config['default_template'] . "-%' ORDER BY themes_name"; if($result = $db->sql_query($sql)) @@ -756,7 +755,7 @@ function theme_select($default) } else { - $theme_select = "<select name=\"theme\"><option value=\"-1\">" . $lang['No_themes'] . "</option></select>"; + $theme_select = "<select name=\"theme\"><option value=\"-1\">" . $lang['No_themes'] . "</option></select>"; } } else @@ -832,7 +831,7 @@ function smilies_pass($message) if(empty($smilies)) { - $sql = "SELECT code, smile_url + $sql = "SELECT code, smile_url FROM " . SMILIES_TABLE; if($result = $db->sql_query($sql)) { diff --git a/phpBB/includes/message.php b/phpBB/includes/message.php index 3ede14e842..856b9e706d 100644 --- a/phpBB/includes/message.php +++ b/phpBB/includes/message.php @@ -1,20 +1,29 @@ <?php -/*************************************************************************** +/*************************************************************************** * message.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. + * + ***************************************************************************/ // // This function gets called to output any message or error -// that doesn't require additional output from the calling -// page. +// that doesn't require additional output from the calling +// page. // // $msg_code takes one of four constant values: // @@ -31,12 +40,12 @@ // board configuration data is available // // CRITICAL_ERROR -> Used whenever a DB connection cannot be -// guaranteed and/or we've been unable to obtain basic board +// guaranteed and/or we've been unable to obtain basic board // configuration data. Shouldn't be used in general -// pages/functions (it results in a simple echo'd statement, +// pages/functions (it results in a simple echo'd statement, // no templates are used) // -function message_die($msg_code, $msg_text = "", $msg_title = "", $err_line = "", $err_file = "", $sql = "") +function message_die($msg_code, $msg_text = "", $msg_title = "", $err_line = "", $err_file = "", $sql = "") { global $db, $template, $board_config, $theme, $lang, $phpEx, $phpbb_root_path; global $userdata, $user_ip, $session_length; diff --git a/phpBB/includes/page_header.php b/phpBB/includes/page_header.php index 5bc749cdd7..b28d84fca2 100644 --- a/phpBB/includes/page_header.php +++ b/phpBB/includes/page_header.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,14 +40,14 @@ if($board_config['gzip_compress']) else if($phpver > "4.0") { if(strstr($HTTP_SERVER_VARS['HTTP_ACCEPT_ENCODING'], 'gzip')) - { + { if(extension_loaded("zlib")) { $do_gzip_compress = TRUE; ob_start(); - ob_implicit_flush(0); + ob_implicit_flush(0); - header("Content-Encoding: gzip"); + header("Content-Encoding: gzip"); } } } @@ -71,7 +80,7 @@ $s_last_visit = create_date($board_config['default_dateformat'], $userdata['sess // Get basic (usernames + totals) online // situation // -$sql = "SELECT u.username, u.user_id, u.user_allow_viewonline, s.session_logged_in, s.session_ip +$sql = "SELECT u.username, u.user_id, u.user_allow_viewonline, s.session_logged_in, s.session_ip FROM ".USERS_TABLE." u, ".SESSIONS_TABLE." s WHERE u.user_id = s.session_user_id AND s.session_time >= ".( time() - 300 ); @@ -137,9 +146,9 @@ $online_userlist = ($logged_visible_online > 0) ? $lang['Registered'] . " $l_r_u // if($userdata['session_logged_in']) { - $sql = "SELECT COUNT(privmsgs_type) AS new_messages - FROM " . PRIVMSGS_TABLE . " - WHERE privmsgs_type = " . PRIVMSGS_NEW_MAIL . " + $sql = "SELECT COUNT(privmsgs_type) AS new_messages + FROM " . PRIVMSGS_TABLE . " + WHERE privmsgs_type = " . PRIVMSGS_NEW_MAIL . " AND privmsgs_to_userid = " . $userdata['user_id']; $result_pm = $db->sql_query($sql); if(!$result_pm) @@ -187,7 +196,7 @@ $template->assign_vars(array( "L_PROFILE" => $lang['Profile'], "L_SEARCH" => $lang['Search'], "L_PRIVATEMSGS" => $lang['Private_msgs'], - "L_WHO_IS_ONLINE" => $lang['Who_is_Online'], + "L_WHO_IS_ONLINE" => $lang['Who_is_Online'], "L_MEMBERLIST" => $lang['Memberlist'], "L_FAQ" => $lang['FAQ'], "L_USERGROUPS" => $lang['Usergroups'], @@ -202,7 +211,7 @@ $template->assign_vars(array( "L_NEWPOSTS" => $lang['New_posts'], "L_NONEWPOSTS_HOT" => $lang['No_new_posts_hot'], "L_NEWPOSTS_HOT" => $lang['New_posts_hot'], - "L_TOPIC_IS_LOCKED" => $lang['Topic_is_locked'], + "L_TOPIC_IS_LOCKED" => $lang['Topic_is_locked'], "L_POSTED" => $lang['Posted'], "L_JOINED" => $lang['Joined'], "L_AUTO_LOGIN" => $lang['Log_me_in'], @@ -240,21 +249,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'], @@ -264,8 +273,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/includes/page_tail.php b/phpBB/includes/page_tail.php index 88f034863f..12fb490384 100644 --- a/phpBB/includes/page_tail.php +++ b/phpBB/includes/page_tail.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. // @@ -65,17 +74,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/includes/post.php b/phpBB/includes/post.php index 09b83ef0f6..9d41b85f28 100644 --- a/phpBB/includes/post.php +++ b/phpBB/includes/post.php @@ -1,18 +1,27 @@ <?php -/*************************************************************************** +/*************************************************************************** + * + * ------------------- + * begin : Saturday, Feb 13, 2001 + * copyright : (C) 2001 The phpBB Group + * email : support@phpbb.com * - * ------------------- - * 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. + * + ***************************************************************************/ // -// This function will prepare a posted message for +// This function will prepare a posted message for // entry into the database. // function prepare_message($message, $html_on, $bbcode_on, $smile_on, $bbcode_uid = 0) @@ -53,7 +62,7 @@ function prepare_message($message, $html_on, $bbcode_on, $smile_on, $bbcode_uid } } - if($length && !$tagallowed) + if($length && !$tagallowed) { $message = str_replace(substr($message, $start, $length), htmlspecialchars(substr($message, $start, $length)), $message); } diff --git a/phpBB/includes/prune.php b/phpBB/includes/prune.php index 4163c49b43..b820f24359 100644 --- a/phpBB/includes/prune.php +++ b/phpBB/includes/prune.php @@ -1,29 +1,38 @@ <?php /*************************************************************************** * prune.php -* ------------------- -* begin : Thursday, June 14, 2001 -* copyright : (C) 2001 The phpBB Group -* email : support@phpbb.com -* +* ------------------- +* begin : Thursday, June 14, 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. + * + ***************************************************************************/ function prune($forum_id, $prune_date) { global $db, $lang; - $sql = "SELECT t.topic_id - FROM " . POSTS_TABLE . " p, " . TOPICS_TABLE . " t - WHERE t.forum_id = $forum_id - AND t.topic_type = " . POST_NORMAL . " + $sql = "SELECT t.topic_id + FROM " . POSTS_TABLE . " p, " . TOPICS_TABLE . " t + WHERE t.forum_id = $forum_id + AND t.topic_type = " . POST_NORMAL . " AND p.post_id = t.topic_last_post_id"; // Do we want to delete everything in the forum? if ($prune_date != FALSE) { - $sql .= " AND p.post_time < $prune_date"; + $sql .= " AND p.post_time < $prune_date"; } if(!$result_topics = $db->sql_query($sql)) { @@ -31,15 +40,15 @@ function prune($forum_id, $prune_date) } $pruned_topics = $db->sql_numrows($result_topics); - $sql = "SELECT p.post_id - FROM " . POSTS_TABLE . " p, " . TOPICS_TABLE . " t - WHERE p.forum_id = $forum_id - AND t.topic_id = p.topic_id + $sql = "SELECT p.post_id + FROM " . POSTS_TABLE . " p, " . TOPICS_TABLE . " t + WHERE p.forum_id = $forum_id + AND t.topic_id = p.topic_id AND t.topic_type = " . POST_NORMAL; // Do we want to delete everything in the forum? if ($prune_date != FALSE) { - $sql .= " AND p.post_time < $prune_date"; + $sql .= " AND p.post_time < $prune_date"; } if(!$result_posts = $db->sql_query($sql)) { @@ -95,7 +104,7 @@ function prune($forum_id, $prune_date) } $sql_post_text = "DELETE FROM " . POSTS_TEXT_TABLE . " WHERE " . $sql_post_text; - $sql_post = "DELETE FROM " . POSTS_TABLE . " WHERE " . $sql_post; + $sql_post = "DELETE FROM " . POSTS_TABLE . " WHERE " . $sql_post; if(!$result = $db->sql_query($sql_post_text, BEGIN_TRANSACTION)) { @@ -110,8 +119,8 @@ function prune($forum_id, $prune_date) } } - $sql = "UPDATE " . FORUMS_TABLE . " - SET forum_topics = forum_topics - $pruned_topics, forum_posts = forum_posts - $pruned_posts + $sql = "UPDATE " . FORUMS_TABLE . " + SET forum_topics = forum_topics - $pruned_topics, forum_posts = forum_posts - $pruned_posts WHERE forum_id = $forum_id"; if(!$result = $db->sql_query($sql)) { @@ -138,10 +147,10 @@ function auto_prune($forum_id = 0) $one_day = 60 * 60 * 24; - $sql = "SELECT * - FROM " . PRUNE_TABLE . " + $sql = "SELECT * + FROM " . PRUNE_TABLE . " WHERE forum_id = $forum_id"; - + if(!$result = $db->sql_query($sql)) { message_die(GENERAL_ERROR, "Auto-Prune: Couldn't read auto_prune table.", __LINE__, __FILE__); diff --git a/phpBB/includes/sessions.php b/phpBB/includes/sessions.php index 59a52f17fe..d0c05ddd97 100644 --- a/phpBB/includes/sessions.php +++ b/phpBB/includes/sessions.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. + * + ***************************************************************************/ + // // session_begin() // diff --git a/phpBB/includes/smtp.php b/phpBB/includes/smtp.php index a05e6fe0f0..d508031582 100644 --- a/phpBB/includes/smtp.php +++ b/phpBB/includes/smtp.php @@ -10,6 +10,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. + * + ***************************************************************************/ + /**************************************************************************** * This script should be included if the admin has configured the board for * smtp mail instead of standard sendmail. It includes a function smtpmail @@ -21,7 +30,7 @@ * Description: This funtion processes the smtp server's response codes * Usage: This function is only used interanally by the smtpmail * function. It takes two arguments the first a socket pointer -* to the opened socket to the server and the second the +* to the opened socket to the server and the second the * response code you are looking for. ****************************************************************************/ function server_parse($socket, $response) @@ -38,19 +47,19 @@ function server_parse($socket, $response) /**************************************************************************** * Function: smtpmail -* Description: This is a functional replacement for php's builtin mail +* Description: This is a functional replacement for php's builtin mail * function, that uses smtp. * Usage: The usage for this function is identical to that of php's * built in mail function. ****************************************************************************/ -function smtpmail($mail_to, $subject, $message, $headers = "") +function smtpmail($mail_to, $subject, $message, $headers = "") { // For now I'm using an array based $smtp_vars to hold the smtp server // info, but it should probably change to $board_config... - // then the relevant info would be $board_config['smtp_host'] and + // then the relevant info would be $board_config['smtp_host'] and // $board_config['smtp_port']. global $board_config; - + // // Fix any bare linefeeds in the message to make it RFC821 Compliant. // @@ -63,7 +72,7 @@ function smtpmail($mail_to, $subject, $message, $headers = "") if(sizeof($headers) > 1) { $headers = join("\r\n", $headers); - } + } else { $headers = $headers[0]; @@ -71,7 +80,7 @@ function smtpmail($mail_to, $subject, $message, $headers = "") } $headers = chop($headers); - // Make sure there are no bare linefeeds in the headers + // Make sure there are no bare linefeeds in the headers $headers = ereg_replace("[^\r]\n", "\r\n", $headers); } if(trim($mail_to) == "") @@ -97,13 +106,13 @@ function smtpmail($mail_to, $subject, $message, $headers = "") message_die(GENERAL_ERROR, "Could not connect to smtp host : $errno : $errstr", "", __LINE__, __FILE__); } server_parse($socket, "220"); - + // Send the RFC821 specified HELO. fputs($socket, "HELO " . $board_config['smtp_host'] . "\r\n"); // From this point onward most server response codes should be 250 server_parse($socket, "250"); - + // Specify who the mail is from.... fputs($socket, "MAIL FROM: $email_from\r\n"); server_parse($socket, "250"); @@ -116,10 +125,10 @@ function smtpmail($mail_to, $subject, $message, $headers = "") server_parse($socket, "250"); $to_header .= "<$mail_to_address>, "; } - + // Ok now we tell the server we are ready to start sending data fputs($socket, "DATA\r\n"); - + // This is the last response code we look for until the end of the message. server_parse($socket, "354"); @@ -131,7 +140,7 @@ function smtpmail($mail_to, $subject, $message, $headers = "") // Now any custom headers.... fputs($socket, "$headers\r\n\r\n"); - + // Ok now we are ready for the message... fputs($socket, "$message\r\n"); diff --git a/phpBB/includes/template.php b/phpBB/includes/template.php index 105dcb5867..b043749721 100644 --- a/phpBB/includes/template.php +++ b/phpBB/includes/template.php @@ -1,21 +1,30 @@ <?php -/*************************************************************************** +/*************************************************************************** * template.inc - * ------------------- - * begin : Saturday, Feb 13, 2001 - * copyright : (C) 2001 The phpBB Group - * email : support@phpbb.com - * + * ------------------- + * 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. + * + ***************************************************************************/ /** * Template class. By Nathan Codding of the phpBB group. * The interface was originally inspired by PHPLib templates, * and the template file formats are quite similar. - * + * */ class Template { @@ -29,24 +38,24 @@ class Template { // if it's a root-level variable, it'll be like this: // $this->_tpldata[.][0][varname] == value var $_tpldata = array(); - + // Hash of filenames for each template handle. var $files = array(); // Root template directory. var $root = ""; - + // this will hash handle names to the compiled code for that handle. var $compiled_code = array(); - + // This will hold the uncompiled code for that handle. var $uncompiled_code = array(); - + /** * Constructor. Simply sets the root dir. - * + * */ - function Template($root = ".") + function Template($root = ".") { $this->set_rootdir($root); } @@ -62,39 +71,39 @@ class Template { /** * Sets the template root directory for this Template object. - */ - function set_rootdir($dir) + */ + function set_rootdir($dir) { - if (!is_dir($dir)) + if (!is_dir($dir)) { return false; } - + $this->root = $dir; return true; } - /** + /** * Sets the template filenames for handles. $filename_array * should be a hash of handle => filename pairs. */ - function set_filenames($filename_array) + function set_filenames($filename_array) { if (!is_array($filename_array)) { - return false; + return false; } - + reset($filename_array); - while(list($handle, $filename) = each($filename_array)) + while(list($handle, $filename) = each($filename_array)) { $this->files[$handle] = $this->make_filename($filename); } - + return true; } - + /** * Load the file for the handle, compile the file, * and run the compiled code. This will print out @@ -104,26 +113,26 @@ class Template { { if (!$this->loadfile($handle)) { - die("Template->pparse(): Couldn't load template file for handle $handle"); + die("Template->pparse(): Couldn't load template file for handle $handle"); } - + // actually compile the template now. if (!isset($this->compiled_code[$handle]) || empty($this->compiled_code[$handle])) { // Actually compile the code now. $this->compiled_code[$handle] = $this->compile($this->uncompiled_code[$handle]); } - + // Run the compiled code. eval($this->compiled_code[$handle]); return true; } - + /** * Inserts the uncompiled code for $handle as the * value of $varname in the root-level. This can be used - * to effectively include a template in the middle of another + * to effectively include a template in the middle of another * template. * Note that all desired assignments to the variables in $handle should be done * BEFORE calling this function. @@ -132,33 +141,33 @@ class Template { { if (!$this->loadfile($handle)) { - die("Template->assign_var_from_handle(): Couldn't load template file for handle $handle"); + die("Template->assign_var_from_handle(): Couldn't load template file for handle $handle"); } - + // Compile it, with the "no echo statements" option on. $code = $this->compile($this->uncompiled_code[$handle], true); // turn it into a variable assignment. $code = '$_str = \'' . $code . '\';'; - + // evaluate the variable assignment. eval($code); - + // assign the value of the generated variable to the given varname. $this->assign_var($varname, $_str); - + return true; } - + /** * Block-level variable assignment. Adds a new block iteration with the given - * variable assignments. Note that this should only be called once per block + * variable assignments. Note that this should only be called once per block * iteration. */ function assign_block_vars($blockname, $vararray) { if (strstr($blockname, '.')) { - // Nested block. + // Nested block. $blocks = explode('.', $blockname); $blockcount = sizeof($blocks) - 1; $str = '$this->_tpldata'; @@ -172,7 +181,7 @@ class Template { // We're adding a new iteration to this block with the given // variable assignments. $str .= '[\'' . $blocks[$blockcount] . '.\'][] = $vararray;'; - + // Now we evaluate this assignment we've built up. eval($str); } @@ -183,10 +192,10 @@ class Template { // we were given. $this->_tpldata[$blockname . '.'][] = $vararray; } - + return true; } - + /** * Root-level variable assignment. Adds to current assignments, overriding * any existing variable assignment with the same name. @@ -196,12 +205,12 @@ class Template { reset ($vararray); while (list($key, $val) = each($vararray)) { - $this->_tpldata['.'][0][$key] = $val; + $this->_tpldata['.'][0][$key] = $val; } return true; } - + /** * Root-level variable assignment. Adds to current assignments, overriding * any existing variable assignment with the same name. @@ -209,38 +218,38 @@ class Template { function assign_var($varname, $varval) { $this->_tpldata['.'][0][$varname] = $varval; - - return true; + + return true; } - - - /** + + + /** * Generates a full path+filename for the given filename, which can either * be an absolute name, or a name relative to the rootdir for this Template * object. */ - function make_filename($filename) + function make_filename($filename) { // Check if it's an absolute or relative path. if (substr($filename, 0, 1) != '/') { $filename = $this->root . '/' . $filename; } - + if (!file_exists($filename)) { die("Template->make_filename(): Error - file $filename does not exist"); } - + return $filename; } - - + + /** * If not already done, load the file for the given handle and populate * the uncompiled_code[] hash with its code. Do not compile. */ - function loadfile($handle) + function loadfile($handle) { // If the file for this handle is already loaded and compiled, do nothing. if (isset($this->uncompiled_code[$handle]) && !empty($this->uncompiled_code[$handle])) @@ -249,31 +258,31 @@ class Template { } // If we don't have a file assigned to this handle, die. - if (!isset($this->files[$handle])) + if (!isset($this->files[$handle])) { die("Template->loadfile(): No file specified for handle $handle"); } - + $filename = $this->files[$handle]; $str = implode("", @file($filename)); - if (empty($str)) + if (empty($str)) { die("Template->loadfile(): File $filename for handle $handle is empty"); } - + $this->uncompiled_code[$handle] = $str; - + return true; } - - - + + + /** * Compiles the given string of code, and returns * the result in a string. * If "do_not_echo" is true, the returned code will not be directly - * executable, but can be used as part of a variable assignment + * executable, but can be used as part of a variable assignment * for use in assign_code_from_handle(). */ function compile($code, $do_not_echo = false) @@ -281,9 +290,9 @@ class Template { // replace \ with \\ and then ' with \'. $code = str_replace('\\', '\\\\', $code); $code = str_replace('\'', '\\\'', $code); - + // change template varrefs into PHP varrefs - + // This one will handle varrefs WITH namespaces $varrefs = array(); preg_match_all('#\{(([a-z0-9\-_]+?\.)+?)([a-z0-9\-_]+?)\}#is', $code, $varrefs); @@ -293,20 +302,20 @@ class Template { $namespace = $varrefs[1][$i]; $varname = $varrefs[3][$i]; $new = $this->generate_block_varref($namespace, $varname); - + $code = str_replace($varrefs[0][$i], $new, $code); } - + // This will handle the remaining root-level varrefs $code = preg_replace('#\{([a-z0-9\-_]*?)\}#is', '\' . $this->_tpldata[\'.\'][0][\'\1\'] . \'', $code); - + // Break it up into lines. $code_lines = explode("\n", $code); - + $block_nesting_level = 0; $block_names = array(); $block_names[0] = "."; - + // Second: prepend echo ', append ' . "\n"; to each line. $line_count = sizeof($code_lines); for ($i = 0; $i < $line_count; $i++) @@ -332,12 +341,12 @@ class Template { else { // This block is nested. - + // Generate a namespace string for this block. $namespace = implode('.', $block_names); // strip leading period from root level.. $namespace = substr($namespace, 2); - // Get a reference to the data array for this block that depends on the + // Get a reference to the data array for this block that depends on the // current indices of all parent blocks. $varref = $this->generate_block_data_ref($namespace, false); // Create the for loop code to iterate over this block. @@ -345,7 +354,7 @@ class Template { $code_lines[$i] .= "\n" . 'for ($_' . $n[1] . '_i = 0; $_' . $n[1] . '_i < $_' . $n[1] . '_count; $_' . $n[1] . '_i++)'; $code_lines[$i] .= "\n" . '{'; } - + // We have the end of a block. unset($block_names[$block_nesting_level]); $block_nesting_level--; @@ -368,19 +377,19 @@ class Template { else { // This block is nested. - + // Generate a namespace string for this block. $namespace = implode('.', $block_names); // strip leading period from root level.. $namespace = substr($namespace, 2); - // Get a reference to the data array for this block that depends on the + // Get a reference to the data array for this block that depends on the // current indices of all parent blocks. $varref = $this->generate_block_data_ref($namespace, false); // Create the for loop code to iterate over this block. $code_lines[$i] = '$_' . $m[1] . '_count = sizeof(' . $varref . ');'; $code_lines[$i] .= "\n" . 'for ($_' . $m[1] . '_i = 0; $_' . $m[1] . '_i < $_' . $m[1] . '_count; $_' . $m[1] . '_i++)'; $code_lines[$i] .= "\n" . '{'; - } + } } } else if (preg_match('#<!-- END (.*?) -->#', $code_lines[$i], $m)) @@ -399,14 +408,14 @@ class Template { } } } - + // Bring it back into a single string of lines of code. - $code = implode("\n", $code_lines); + $code = implode("\n", $code_lines); return $code ; - + } - - + + /** * Generates a reference to the given variable inside the given (possibly nested) * block namespace. This is a string of the form: @@ -418,21 +427,21 @@ class Template { { // Strip the trailing period. $namespace = substr($namespace, 0, strlen($namespace) - 1); - + // Get a reference to the data block for this namespace. $varref = $this->generate_block_data_ref($namespace, true); // Prepend the necessary code to stick this in an echo line. $varref = '\' . ' . $varref; // Append the variable reference. $varref .= '[\'' . $varname . '\'] . \''; - + return $varref; - + } - - + + /** - * Generates a reference to the array of data values for the given + * Generates a reference to the array of data values for the given * (possibly nested) block namespace. This is a string of the form: * $this->_tpldata['parent'][$_parent_i]['$child1'][$_child1_i]['$child2'][$_child2_i]...['$childN'] * @@ -448,7 +457,7 @@ class Template { // Build up the string with everything but the last child. for ($i = 0; $i < $blockcount; $i++) { - $varref .= '[\'' . $blocks[$i] . '.\'][$_' . $blocks[$i] . '_i]'; + $varref .= '[\'' . $blocks[$i] . '.\'][$_' . $blocks[$i] . '_i]'; } // Add the block reference for the last child. $varref .= '[\'' . $blocks[$blockcount] . '.\']'; @@ -457,7 +466,7 @@ class Template { { $varref .= '[$_' . $blocks[$blockcount] . '_i]'; } - + return $varref; } diff --git a/phpBB/index.php b/phpBB/index.php index 8fe6949070..56d5dc9dd3 100644 --- a/phpBB/index.php +++ b/phpBB/index.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. + * + ***************************************************************************/ + $phpbb_root_path = "./"; include($phpbb_root_path . 'extension.inc'); include($phpbb_root_path . 'common.'.$phpEx); @@ -76,7 +85,7 @@ if($total_categories = $db->sql_numrows($q_categories)) $limit_forums = ($viewcat != -1) ? "AND f.cat_id = $viewcat " : ""; $sql = "SELECT f.*, t.topic_id, t.topic_replies, t.topic_last_post_id, u.username, u.user_id, p.post_time, p.post_username - FROM " . FORUMS_TABLE . " f, " . TOPICS_TABLE . " t, " . POSTS_TABLE . " p, " . USERS_TABLE . " u + FROM " . FORUMS_TABLE . " f, " . TOPICS_TABLE . " t, " . POSTS_TABLE . " p, " . USERS_TABLE . " u WHERE f.forum_last_post_id = p.post_id AND p.post_id = t.topic_last_post_id AND p.poster_id = u.user_id @@ -97,7 +106,7 @@ if($total_categories = $db->sql_numrows($q_categories)) $limit_forums = ($viewcat != -1) ? "AND f.cat_id = $viewcat " : ""; $sql = "SELECT f.*, t.topic_id, t.topic_replies, t.topic_last_post_id, u.username, u.user_id, p.post_time, p.post_username - FROM " . FORUMS_TABLE . " f, " . POSTS_TABLE . " p, " . TOPICS_TABLE . " t, " . USERS_TABLE . " u + FROM " . FORUMS_TABLE . " f, " . POSTS_TABLE . " p, " . TOPICS_TABLE . " t, " . USERS_TABLE . " u WHERE f.forum_last_post_id = p.post_id(+) AND p.post_id = t.topic_last_post_id(+) AND p.poster_id = u.user_id(+) @@ -128,10 +137,10 @@ if($total_categories = $db->sql_numrows($q_categories)) } $forum_rows = $db->sql_fetchrowset($q_forums); - $sql = "SELECT f.forum_id, t.topic_id, p.post_time - FROM " . FORUMS_TABLE . " f, " . TOPICS_TABLE . " t, " . POSTS_TABLE . " p - WHERE t.forum_id = f.forum_id - AND p.post_id = t.topic_last_post_id + $sql = "SELECT f.forum_id, t.topic_id, p.post_time + FROM " . FORUMS_TABLE . " f, " . TOPICS_TABLE . " t, " . POSTS_TABLE . " p + WHERE t.forum_id = f.forum_id + AND p.post_id = t.topic_last_post_id AND p.post_time > " . $userdata['session_last_visit']; if(!$new_topic_ids = $db->sql_query($sql)) { @@ -146,14 +155,14 @@ if($total_categories = $db->sql_numrows($q_categories)) // // Obtain list of moderators of each forum // - $sql = "SELECT aa.forum_id, g.group_name, g.group_id, g.group_single_user, u.user_id, u.username - FROM " . AUTH_ACCESS_TABLE . " aa, " . USER_GROUP_TABLE . " ug, " . GROUPS_TABLE . " g, " . USERS_TABLE . " u - WHERE aa.auth_mod = " . TRUE . " - AND ug.group_id = aa.group_id - AND g.group_id = aa.group_id - AND u.user_id = ug.user_id + $sql = "SELECT aa.forum_id, g.group_name, g.group_id, g.group_single_user, u.user_id, u.username + FROM " . AUTH_ACCESS_TABLE . " aa, " . USER_GROUP_TABLE . " ug, " . GROUPS_TABLE . " g, " . USERS_TABLE . " u + WHERE aa.auth_mod = " . TRUE . " + AND ug.group_id = aa.group_id + AND g.group_id = aa.group_id + AND u.user_id = ug.user_id ORDER BY aa.forum_id, g.group_id, u.user_id"; - + if(!$q_forum_mods = $db->sql_query($sql)) { message_die(GENERAL_ERROR, "Could not query forum moderator information", "", __LINE__, __FILE__, $sql); @@ -195,10 +204,10 @@ if($total_categories = $db->sql_numrows($q_categories)) "NEWEST_UID" => $newest_uid, "USERS_BROWSING" => $users_browsing, - "L_FORUM_LOCKED" => $lang['Forum_is_locked'], - "L_MARK_FORUMS_READ" => $lang['Mark_all_forums'], + "L_FORUM_LOCKED" => $lang['Forum_is_locked'], + "L_MARK_FORUMS_READ" => $lang['Mark_all_forums'], - "U_MARK_READ" => append_sid("index.$phpEx?mark=forums"), + "U_MARK_READ" => append_sid("index.$phpEx?mark=forums"), "U_NEWEST_USER_PROFILE" => append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=$newest_uid")) ); @@ -310,7 +319,7 @@ if($total_categories = $db->sql_numrows($q_categories)) { $moderators_links .= "<a href=\"" . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=" . $forum_mods_id[$forum_id][$mods]) . "\">" . $forum_mods_name[$forum_id][$mods] . "</a>"; } - else + else { $moderators_links .= "<a href=\"" . append_sid("groupcp.$phpEx?" . POST_GROUPS_URL . "=" . $forum_mods_id[$forum_id][$mods]) . "\">" . $forum_mods_name[$forum_id][$mods] . "</a>"; } @@ -329,7 +338,7 @@ if($total_categories = $db->sql_numrows($q_categories)) $template->assign_block_vars("catrow.forumrow", array( "ROW_COLOR" => "#" . $row_color, - "ROW_CLASS" => $row_class, + "ROW_CLASS" => $row_class, "FOLDER" => $folder_image, "FORUM_NAME" => stripslashes($forum_rows[$j]['forum_name']), "FORUM_DESC" => stripslashes($forum_rows[$j]['forum_desc']), diff --git a/phpBB/language/lang_english.php b/phpBB/language/lang_english.php index 09028bf1f3..b36a0a16f0 100755 --- a/phpBB/language/lang_english.php +++ b/phpBB/language/lang_english.php @@ -10,6 +10,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. + * + ***************************************************************************/ + // // The future format of this file will be: // diff --git a/phpBB/login.php b/phpBB/login.php index 51cf27f76a..b560073137 100644 --- a/phpBB/login.php +++ b/phpBB/login.php @@ -1,15 +1,24 @@ <?php -/*************************************************************************** +/*************************************************************************** * login.php - * ------------------- - * begin : Saturday, Feb 13, 2001 - * copyright : (C) 2001 The phpBB Group - * email : support@phpbb.com - * + * ------------------- + * 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'); @@ -40,12 +49,12 @@ if(isset($HTTP_POST_VARS['submit']) || isset($HTTP_GET_VARS['submit'])) { message_die(GENERAL_ERROR, "Error in obtaining userdata : login", __LINE__, __FILE__, $sql); } - + $rowresult = $db->sql_fetchrow($result); if(count($rowresult)) { if((md5($password) == $rowresult['user_password']) && $rowresult['user_active'] != 0) - { + { $autologin = (isset($HTTP_POST_VARS['autologin'])) ? TRUE : FALSE; $session_id = session_begin($rowresult['user_id'], $user_ip, PAGE_INDEX, $session_length, TRUE, $autologin); @@ -121,7 +130,7 @@ else if(isset($HTTP_POST_VARS['forward_page']) || isset($HTTP_GET_VARS['forward_page'])) { $forward_to = $HTTP_SERVER_VARS['QUERY_STRING']; - + if(preg_match("/^forward_page=(.*)(&sid=[0-9]*)$|^forward_page=(.*)$/si", $forward_to, $forward_matches)) { $forward_to = ($forward_matches[3]) ? $forward_matches[3] : $forward_matches[1]; @@ -153,7 +162,7 @@ else } $username = ($userdata['user_id'] != ANONYMOUS) ? $userdata['username'] : ""; - + $template->assign_vars(array( "FORWARD_PAGE" => $forward_page, "USERNAME" => $username, diff --git a/phpBB/memberlist.php b/phpBB/memberlist.php index e0e8f71464..317bdbb37d 100644 --- a/phpBB/memberlist.php +++ b/phpBB/memberlist.php @@ -10,6 +10,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); @@ -82,9 +91,9 @@ else { $order_by = "user_regdate $sort_order LIMIT $start, " . $board_config['topics_per_page']; } -$sql = "SELECT username, user_id, user_viewemail, user_posts, user_regdate, user_from, user_website, user_email, user_icq, user_aim, user_yim, user_msnm, user_avatar - FROM " . USERS_TABLE . " - WHERE user_id <> " . ANONYMOUS . " +$sql = "SELECT username, user_id, user_viewemail, user_posts, user_regdate, user_from, user_website, user_email, user_icq, user_aim, user_yim, user_msnm, user_avatar + FROM " . USERS_TABLE . " + WHERE user_id <> " . ANONYMOUS . " ORDER BY $order_by"; // @@ -128,32 +137,32 @@ if(($selected_members = $db->sql_numrows($result)) > 0) $jumpbox = make_jumpbox(); $template->assign_vars(array( - "L_GO" => $lang['Go'], - "L_JUMP_TO" => $lang['Jump_to'], - "L_SELECT_FORUM" => $lang['Select_forum'], + "L_GO" => $lang['Go'], + "L_JUMP_TO" => $lang['Jump_to'], + "L_SELECT_FORUM" => $lang['Select_forum'], "JUMPBOX_LIST" => $jumpbox, "SELECT_NAME" => POST_FORUM_URL) ); $template->assign_var_from_handle("JUMPBOX", "jumpbox"); $template->assign_vars(array( - "L_SELECT_SORT_METHOD" => $lang['Select_sort_method'], + "L_SELECT_SORT_METHOD" => $lang['Select_sort_method'], "L_EMAIL" => $lang['Email'], "L_WEBSITE" => $lang['Website'], - "L_FROM" => $lang['From'], - "L_ORDER" => $lang['Order'], - "L_SORT" => $lang['Sort'], - "L_SUBMIT" => $lang['Sort'], - "L_AIM" => $lang['AIM'], - "L_YIM" => $lang['YIM'], - "L_MSNM" => $lang['MSNM'], - "L_ICQ" => $lang['ICQ'], + "L_FROM" => $lang['From'], + "L_ORDER" => $lang['Order'], + "L_SORT" => $lang['Sort'], + "L_SUBMIT" => $lang['Sort'], + "L_AIM" => $lang['AIM'], + "L_YIM" => $lang['YIM'], + "L_MSNM" => $lang['MSNM'], + "L_ICQ" => $lang['ICQ'], "S_MODE_SELECT" => $select_sort_mode, - "S_ORDER_SELECT" => $select_sort_order, + "S_ORDER_SELECT" => $select_sort_order, "S_MODE_ACTION" => append_sid("memberlist.$phpEx")) ); - + $members = $db->sql_fetchrowset($result); for($i = 0; $i < $selected_members; $i++) @@ -166,7 +175,7 @@ if(($selected_members = $db->sql_numrows($result)) > 0) $joined = create_date($board_config['default_dateformat'], $members[$i]['user_regdate'], $board_config['default_timezone']); $posts = ($members[$i]['user_posts']) ? $members[$i]['user_posts'] : 0; - + if($members[$i]['user_avatar'] != "" && $user_id != ANONYMOUS) { $poster_avatar = (strstr("http", $members[$i]['user_avatar']) && $board_config['allow_avatar_remote']) ? "<img src=\"" . $members[$i]['user_avatar'] . "\" alt=\"\" />" : "<img src=\"" . $board_config['avatar_path'] . "/" . $members[$i]['user_avatar'] . "\" alt=\"\" />"; @@ -187,7 +196,7 @@ if(($selected_members = $db->sql_numrows($result)) > 0) } $pm_img = "<a href=\"" . append_sid("privmsg.$phpEx?mode=post&" . POST_USERS_URL . "=" . $members[$i]['user_id']) . "\"><img src=\"" . $images['icon_pm'] . "\" border=\"0\" alt=\"" . $lang['Send_private_message'] . "\" /></a>"; - + if($members[$i]['user_website'] != "") { $www_img = "<a href=\"" . stripslashes($members[$i]['user_website']) . "\" target=\"_userwww\"><img src=\"" . $images['icon_www'] . "\" border=\"0\" alt=\"" . $lang['Visit_website'] . "\" /></a>"; @@ -221,32 +230,32 @@ if(($selected_members = $db->sql_numrows($result)) > 0) $row_class = (!($i % 2)) ? $theme['td_class1'] : $theme['td_class2']; $template->assign_block_vars("memberrow", array( - "U_VIEWPROFILE" => append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=" . $user_id), - - "ROW_COLOR" => $row_color, - "ROW_CLASS" => $row_class, + "U_VIEWPROFILE" => append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=" . $user_id), + + "ROW_COLOR" => $row_color, + "ROW_CLASS" => $row_class, "USERNAME" => $username, "FROM" => $from, "JOINED" => $joined, "POSTS" => $posts, - "AVATAR_IMG" => $poster_avatar, + "AVATAR_IMG" => $poster_avatar, "EMAIL_IMG" => $email_img, "PM_IMG" => $pm_img, "WWW_IMG" => $www_img, - "ICQ_STATUS_IMG" => $icq_status_img, - "ICQ_ADD_IMG" => $icq_add_img, - "AIM_IMG" => $aim_img, - "YIM_IMG" => $yim_img, - "MSN_IMG" => $msn_img, + "ICQ_STATUS_IMG" => $icq_status_img, + "ICQ_ADD_IMG" => $icq_add_img, + "AIM_IMG" => $aim_img, + "YIM_IMG" => $yim_img, + "MSN_IMG" => $msn_img, "SEARCH_IMG" => $search) ); } - + if($mode != "topten" || $board_config['topics_per_page'] < 10) { - $sql = "SELECT count(*) AS total - FROM " . USERS_TABLE . " + $sql = "SELECT count(*) AS total + FROM " . USERS_TABLE . " WHERE user_id <> " . ANONYMOUS; if(!$count_result = $db->sql_query($sql)) @@ -263,14 +272,14 @@ if(($selected_members = $db->sql_numrows($result)) > 0) } else { - $pagination = " "; + $pagination = " "; $total_members = 10; } $template->assign_vars(array( "PAGINATION" => $pagination, "ON_PAGE" => ( floor( $start / $board_config['topics_per_page'] ) + 1 ), "TOTAL_PAGES" => ceil( $total_members / $board_config['topics_per_page'] ), - + "L_OF" => $lang['of'], "L_PAGE" => $lang['Page'], "L_GOTO_PAGE" => $lang['Goto_page']) diff --git a/phpBB/modcp.php b/phpBB/modcp.php index ac7857d7f3..6d18f1882b 100644 --- a/phpBB/modcp.php +++ b/phpBB/modcp.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. + * + ***************************************************************************/ + /** * Moderator Control Panel * @@ -31,6 +40,8 @@ $page_title = "Modertator Control Panel"; $forum_id = ($HTTP_POST_VARS[POST_FORUM_URL]) ? $HTTP_POST_VARS[POST_FORUM_URL] : $HTTP_GET_VARS[POST_FORUM_URL]; $topic_id = ($HTTP_POST_VARS[POST_TOPIC_URL]) ? $HTTP_POST_VARS[POST_TOPIC_URL] : $HTTP_GET_VARS[POST_TOPIC_URL]; + + if(empty($forum_id) || !isset($forum_id)) { $sql = "SELECT f.forum_id, f.forum_name, f.forum_topics @@ -104,6 +115,7 @@ include($phpbb_root_path . 'includes/page_header.'.$phpEx); $template->set_filenames(array( "body" => "modcp_body.tpl", "confirm" => "confirm_body.tpl", + "viewip" => "modcp_viewip.tpl", "split_body" => "split_body.tpl") ); @@ -717,7 +729,61 @@ switch($mode) $template->pparse("split_body"); } } - break; + break; + case 'ip': + $post_id = $HTTP_GET_VARS[POST_POST_URL]; + if(!$post_id) + { + message_die(GENERAL_ERROR, "Error, no post id found", "Error", __LINE__, __FILE__); + } + + // Look up relevent data for this post + $sql = "SELECT poster_ip, poster_id, post_username FROM ".POSTS_TABLE." WHERE post_id = $post_id"; + if(!$result = $db->sql_query($sql)) + { + message_die(GENERAL_ERROR, "Could not get poster IP information", "Error", __LINE__, __FILE__, $sql); + } + + $post_row = $db->sql_fetchrow($result); + + // Get other users who've posted under this IP + $sql = "SELECT u.username, u.user_id FROM " . USERS_TABLE ." u, " . POSTS_TABLE . " p WHERE p.poster_id = u.user_id AND p.poster_ip = '".$post_row['poster_ip']."'"; + if(!$result = $db->sql_query($sql)) + { + message_die(GENERAL_ERROR, "Could not get posters information based on IP", "Error", __LINE__, __FILE__, $sql); + } + + $poster_ids = $db->sql_fetchrowset($result); + sort($poster_ids); + echo "<pre>"; + var_dump($poster_ids); + echo "</pre>"; + + $posts = 0; + while(list($null, $userdata) = each($poster_ids)) + { + $username = $userdata['username']; + $user_id = $userdata['user_id']; + + if($username != $last_username && !empty($last_username)) + { + $other_users[] = array("username" => "$last_username", "user_id" => "$last_user_id", "posts" => "$posts"); + $posts = 1; + } + else + { + $posts += 1; + } + $last_username = $username; + $last_user_ip = $user_id; + } + + echo "<pre>"; + var_dump($other_users); + echo "</pre>"; + + + break; default: diff --git a/phpBB/posting.php b/phpBB/posting.php index 184aedebbf..a9ddb08991 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.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. + * + ***************************************************************************/ + $phpbb_root_path = "./"; include($phpbb_root_path . 'extension.inc'); include($phpbb_root_path . 'common.'.$phpEx); @@ -29,7 +38,7 @@ init_userprefs($userdata); // // Set initial conditions // -if( isset($HTTP_GET_VARS[POST_FORUM_URL]) || isset($HTTP_POST_VARS[POST_FORUM_URL]) ) +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]; } @@ -92,13 +101,13 @@ if($mode == "reply" && !empty($topic_id) ) { if( isset($HTTP_POST_VARS['submit']) || isset($HTTP_POST_VARS['preview']) ) { - $notify = ( !empty($HTTP_POST_VARS['notify']) ) ? TRUE : 0; + $notify = ( !empty($HTTP_POST_VARS['notify']) ) ? TRUE : 0; } else { - $sql = "SELECT * - FROM " . TOPICS_WATCH_TABLE . " - WHERE topic_id = $topic_id + $sql = "SELECT * + FROM " . TOPICS_WATCH_TABLE . " + WHERE topic_id = $topic_id AND user_id = " . $userdata['user_id']; if( !$result = $db->sql_query($sql) ) { @@ -136,7 +145,7 @@ else } // -// Here we do various lookups to find topic_id, forum_id, post_id etc. +// Here we do various lookups to find topic_id, forum_id, post_id etc. // Doing it here prevents spoofing (eg. faking forum_id, topic_id or post_id // if( $mode != "newtopic" ) @@ -145,19 +154,19 @@ if( $mode != "newtopic" ) { if($mode == "reply" && !empty($topic_id) ) { - $sql = "SELECT f.forum_id, f.forum_status, t.topic_status - FROM " . FORUMS_TABLE . " f, " . TOPICS_TABLE . " t - WHERE t.topic_id = $topic_id + $sql = "SELECT f.forum_id, f.forum_status, t.topic_status + FROM " . FORUMS_TABLE . " f, " . TOPICS_TABLE . " t + WHERE t.topic_id = $topic_id AND f.forum_id = t.forum_id"; $msg = $lang['No_topic_id']; } else if( !empty($post_id) ) { - $sql = "SELECT f.forum_id, f.forum_status, t.topic_id, t.topic_status - FROM " . POSTS_TABLE . " p, " . TOPICS_TABLE . " t, " . FORUMS_TABLE . " f - WHERE p.post_id = $post_id - AND t.topic_id = p.topic_id + $sql = "SELECT f.forum_id, f.forum_status, t.topic_id, t.topic_status + FROM " . POSTS_TABLE . " p, " . TOPICS_TABLE . " t, " . FORUMS_TABLE . " f + WHERE p.post_id = $post_id + AND t.topic_id = p.topic_id AND f.forum_id = t.forum_id"; $msg = $lang['No_post_id']; @@ -171,12 +180,12 @@ if( $mode != "newtopic" ) { if( isset($post_id) ) { - $sql = "SELECT p.post_id, t.forum_id, t.topic_status, t.topic_last_post_id, f.forum_last_post_id, f.forum_status - FROM " . POSTS_TABLE . " p, " . TOPICS_TABLE . " t, " . FORUMS_TABLE . " f - WHERE t.topic_id = $topic_id - AND p.topic_id = t.topic_id - AND f.forum_id = t.forum_id - ORDER BY p.post_time ASC + $sql = "SELECT p.post_id, t.forum_id, t.topic_status, t.topic_last_post_id, f.forum_last_post_id, f.forum_status + FROM " . POSTS_TABLE . " p, " . TOPICS_TABLE . " t, " . FORUMS_TABLE . " f + WHERE t.topic_id = $topic_id + AND p.topic_id = t.topic_id + AND f.forum_id = t.forum_id + ORDER BY p.post_time ASC LIMIT 1"; } else @@ -194,14 +203,14 @@ if( $mode != "newtopic" ) $check_row = $db->sql_fetchrow($result); $forum_id = $check_row['forum_id']; - $topic_status = $check_row['topic_status']; + $topic_status = $check_row['topic_status']; $forum_status = $check_row['forum_status']; if( $mode == "editpost" ) { - $is_first_post = ($check_row['post_id'] == $post_id) ? TRUE : 0; - $is_last_post = ($check_row['topic_last_post_id'] == $post_id) ? TRUE : 0; - $is_last_post_forum = ($check_row['forum_last_post_id'] == $post_id) ? TRUE : 0; + $is_first_post = ($check_row['post_id'] == $post_id) ? TRUE : 0; + $is_last_post = ($check_row['topic_last_post_id'] == $post_id) ? TRUE : 0; + $is_last_post_forum = ($check_row['forum_last_post_id'] == $post_id) ? TRUE : 0; } else { @@ -221,8 +230,8 @@ if( $mode != "newtopic" ) } else { - $sql = "SELECT forum_status - FROM " . FORUMS_TABLE . " f + $sql = "SELECT forum_status + FROM " . FORUMS_TABLE . " f WHERE forum_id = $forum_id"; if($result = $db->sql_query($sql)) { @@ -423,7 +432,7 @@ if( ( isset($HTTP_POST_VARS['submit']) || $preview ) && $topic_status == TOPIC_U } // - // prepare_message returns a bbcode parsed html parsed and slashed result + // prepare_message returns a bbcode parsed html parsed and slashed result // ... note that we send NOT'ed version of the disable vars to the function // $message = prepare_message(stripslashes($HTTP_POST_VARS['message']), $html_on, $bbcode_on, $smilies_on, $bbcode_uid); @@ -433,7 +442,7 @@ if( ( isset($HTTP_POST_VARS['submit']) || $preview ) && $topic_status == TOPIC_U $message .= (ereg(" $", $message)) ? "[addsig]" : " [addsig]"; } } - else + else { $message = stripslashes(trim($HTTP_POST_VARS['message'])); } @@ -483,7 +492,7 @@ if( ($mode == "newtopic" || $mode == "reply") && $topic_status == TOPIC_UNLOCKED if($mode == "reply" || ( $mode == "newtopic" && $result ) ) { - $sql = "INSERT INTO " . POSTS_TABLE . " (topic_id, forum_id, poster_id, post_username, post_time, poster_ip, bbcode_uid, enable_bbcode, enable_html, enable_smilies) + $sql = "INSERT INTO " . POSTS_TABLE . " (topic_id, forum_id, poster_id, post_username, post_time, poster_ip, bbcode_uid, enable_bbcode, enable_html, enable_smilies) VALUES ($new_topic_id, $forum_id, " . $userdata['user_id'] . ", '$username', $topic_time, '$user_ip', '$bbcode_uid', $bbcode_on, $html_on, $smilies_on)"; if($mode == "reply") { @@ -498,12 +507,12 @@ if( ($mode == "newtopic" || $mode == "reply") && $topic_status == TOPIC_UNLOCKED { $new_post_id = $db->sql_nextid(); - $sql = "INSERT INTO " . POSTS_TEXT_TABLE . " (post_id, post_subject, post_text) + $sql = "INSERT INTO " . POSTS_TEXT_TABLE . " (post_id, post_subject, post_text) VALUES ($new_post_id, '$subject', '$message')"; if($db->sql_query($sql)) { - $sql = "UPDATE " . TOPICS_TABLE . " + $sql = "UPDATE " . TOPICS_TABLE . " SET topic_last_post_id = $new_post_id"; if($mode == "reply") { @@ -513,7 +522,7 @@ if( ($mode == "newtopic" || $mode == "reply") && $topic_status == TOPIC_UNLOCKED if($db->sql_query($sql)) { - $sql = "UPDATE " . FORUMS_TABLE . " + $sql = "UPDATE " . FORUMS_TABLE . " SET forum_last_post_id = $new_post_id, forum_posts = forum_posts + 1"; if($mode == "newtopic") { @@ -523,8 +532,8 @@ if( ($mode == "newtopic" || $mode == "reply") && $topic_status == TOPIC_UNLOCKED if($db->sql_query($sql)) { - $sql = "UPDATE " . USERS_TABLE . " - SET user_posts = user_posts + 1 + $sql = "UPDATE " . USERS_TABLE . " + SET user_posts = user_posts + 1 WHERE user_id = " . $userdata['user_id']; if($db->sql_query($sql, END_TRANSACTION)) @@ -536,13 +545,13 @@ if( ($mode == "newtopic" || $mode == "reply") && $topic_status == TOPIC_UNLOCKED // if($mode == "reply") { - $sql = "SELECT u.user_id, u.username, u.user_email, t.topic_title - FROM " . TOPICS_WATCH_TABLE . " tw, " . TOPICS_TABLE . " t, " . USERS_TABLE . " u - WHERE tw.topic_id = $new_topic_id - AND tw.user_id <> " . $userdata['user_id'] . " - AND tw.user_id <> " . ANONYMOUS . " - AND tw.notify_status = " . TOPIC_WATCH_UN_NOTIFIED . " - AND t.topic_id = tw.topic_id + $sql = "SELECT u.user_id, u.username, u.user_email, t.topic_title + FROM " . TOPICS_WATCH_TABLE . " tw, " . TOPICS_TABLE . " t, " . USERS_TABLE . " u + WHERE tw.topic_id = $new_topic_id + AND tw.user_id <> " . $userdata['user_id'] . " + AND tw.user_id <> " . ANONYMOUS . " + AND tw.notify_status = " . TOPIC_WATCH_UN_NOTIFIED . " + AND t.topic_id = tw.topic_id AND u.user_id = tw.user_id"; if( $result = $db->sql_query($sql) ) { @@ -563,10 +572,10 @@ if( ($mode == "newtopic" || $mode == "reply") && $topic_status == TOPIC_UNLOCKED $path = (dirname($HTTP_SERVER_VARS['REQUEST_URI']) == "/") ? "" : dirname($HTTP_SERVER_VARS['REQUEST_URI']); $emailer->assign_vars(array( - "USERNAME" => $email_set[$i]['username'], + "USERNAME" => $email_set[$i]['username'], "SITENAME" => $board_config['sitename'], "TOPIC_TITLE" => $email_set[$i]['topic_title'], - "TOPIC_URL" => "http://" . $HTTP_SERVER_VARS['SERVER_NAME'] . $path . "/viewtopic.$phpEx?" . POST_POST_URL . "=$new_post_id#$new_post_id", + "TOPIC_URL" => "http://" . $HTTP_SERVER_VARS['SERVER_NAME'] . $path . "/viewtopic.$phpEx?" . POST_POST_URL . "=$new_post_id#$new_post_id", "UN_WATCH_URL" => "http://" . $HTTP_SERVER_VARS['SERVER_NAME'] . $path . "/viewtopic.$phpEx?" . POST_TOPIC_URL . "=$new_topic_id&unwatch=topic", "EMAIL_SIG" => $board_config['board_email']) ); @@ -578,15 +587,15 @@ if( ($mode == "newtopic" || $mode == "reply") && $topic_status == TOPIC_UNLOCKED { $update_watched_sql .= " OR "; } - $update_watched_sql .= "user_id = " . $email_set[$i]['user_id']; + $update_watched_sql .= "user_id = " . $email_set[$i]['user_id']; } } if($update_watched_sql != "") { $sql = "UPDATE " . TOPICS_WATCH_TABLE . " - SET notify_status = " . TOPIC_WATCH_NOTIFIED . " - WHERE topic_id = $new_topic_id + SET notify_status = " . TOPIC_WATCH_NOTIFIED . " + WHERE topic_id = $new_topic_id AND $update_watched_sql"; $db->sql_query($sql); } @@ -601,9 +610,9 @@ if( ($mode == "newtopic" || $mode == "reply") && $topic_status == TOPIC_UNLOCKED { if($mode == "reply") { - $sql = "SELECT * - FROM " . TOPICS_WATCH_TABLE . " - WHERE topic_id = $new_topic_id + $sql = "SELECT * + FROM " . TOPICS_WATCH_TABLE . " + WHERE topic_id = $new_topic_id AND user_id = " . $userdata['user_id']; if( !$result = $db->sql_query($sql) ) { @@ -614,8 +623,8 @@ if( ($mode == "newtopic" || $mode == "reply") && $topic_status == TOPIC_UNLOCKED { if( !$notify ) { - $sql = "DELETE FROM " . TOPICS_WATCH_TABLE . " - WHERE topic_id = $new_topic_id + $sql = "DELETE FROM " . TOPICS_WATCH_TABLE . " + WHERE topic_id = $new_topic_id AND user_id = " . $userdata['user_id']; if( !$result = $db->sql_query($sql) ) { @@ -625,7 +634,7 @@ if( ($mode == "newtopic" || $mode == "reply") && $topic_status == TOPIC_UNLOCKED } else if( $notify ) { - $sql = "INSERT INTO " . TOPICS_WATCH_TABLE . " (user_id, topic_id, notify_status) + $sql = "INSERT INTO " . TOPICS_WATCH_TABLE . " (user_id, topic_id, notify_status) VALUES (" . $userdata['user_id'] . ", $new_topic_id, 0)"; if( !$result = $db->sql_query($sql) ) { @@ -635,7 +644,7 @@ if( ($mode == "newtopic" || $mode == "reply") && $topic_status == TOPIC_UNLOCKED } else if( $notify ) { - $sql = "INSERT INTO " . TOPICS_WATCH_TABLE . " (user_id, topic_id, notify_status) + $sql = "INSERT INTO " . TOPICS_WATCH_TABLE . " (user_id, topic_id, notify_status) VALUES (" . $userdata['user_id'] . ", $new_topic_id, 0)"; if( !$result = $db->sql_query($sql) ) { @@ -681,7 +690,7 @@ if( ($mode == "newtopic" || $mode == "reply") && $topic_status == TOPIC_UNLOCKED { if(SQL_LAYER == "mysql") { - $sql = "DELETE FROM " . POSTS_TABLE . " + $sql = "DELETE FROM " . POSTS_TABLE . " WHERE post_id = $new_post_id"; if( !$db->sql_query($sql) ) { @@ -707,11 +716,11 @@ else if($mode == "quote" && !$preview && $topic_status == TOPIC_UNLOCKED) if( isset($post_id) ) { - $sql = "SELECT p.*, pt.post_text, pt.post_subject, u.username, u.user_id, u.user_sig, t.topic_title, t.topic_type - FROM " . POSTS_TABLE . " p, " . USERS_TABLE . " u, " . TOPICS_TABLE . " t, " . POSTS_TEXT_TABLE . " pt - WHERE p.post_id = $post_id - AND pt.post_id = p.post_id - AND p.topic_id = t.topic_id + $sql = "SELECT p.*, pt.post_text, pt.post_subject, u.username, u.user_id, u.user_sig, t.topic_title, t.topic_type + FROM " . POSTS_TABLE . " p, " . USERS_TABLE . " u, " . TOPICS_TABLE . " t, " . POSTS_TEXT_TABLE . " pt + WHERE p.post_id = $post_id + AND pt.post_id = p.post_id + AND p.topic_id = t.topic_id AND p.poster_id = u.user_id"; if($result = $db->sql_query($sql)) { @@ -732,7 +741,7 @@ else if($mode == "quote" && !$preview && $topic_status == TOPIC_UNLOCKED) $message = str_replace("<br />", "\n", $message); $message = undo_htmlspecialchars($message); - + // Special handling for </textarea> tags in the message, which can break the editing form.. $message = preg_replace('#</textarea>#si', '</TEXTAREA>', $message); @@ -756,12 +765,12 @@ else if( $mode == "editpost" && $topic_status == TOPIC_UNLOCKED ) $page_title = " " . $lang['Edit_post']; $section_title = $lang['Edit_post_in']; - if( ( isset($HTTP_POST_VARS['submit']) || isset($HTTP_GET_VARS['confirm']) || isset($HTTP_POST_VARS['confirm']) ) && + if( ( isset($HTTP_POST_VARS['submit']) || isset($HTTP_GET_VARS['confirm']) || isset($HTTP_POST_VARS['confirm']) ) && !$error && !$preview ) { - - $sql = "SELECT poster_id - FROM " . POSTS_TABLE . " + + $sql = "SELECT poster_id + FROM " . POSTS_TABLE . " WHERE post_id = $post_id"; if($result = $db->sql_query($sql)) @@ -775,16 +784,16 @@ else if( $mode == "editpost" && $topic_status == TOPIC_UNLOCKED ) message_die(GENERAL_MESSAGE, $msg); } } - - if( ( isset($HTTP_POST_VARS['delete']) || isset($HTTP_GET_VARS['delete']) ) && + + if( ( isset($HTTP_POST_VARS['delete']) || isset($HTTP_GET_VARS['delete']) ) && ( $is_last_post || $is_auth['auth_mod'] ) ) { - // + // // Output a confirmation message, unless we've over-ridden it on the posting_body form ( // override_confirm set ), this is so people can implement JavaScript checkers if they wish // - if( isset($HTTP_POST_VARS['delete']) && - !isset($HTTP_POST_VARS['override_confirm']) && + if( isset($HTTP_POST_VARS['delete']) && + !isset($HTTP_POST_VARS['override_confirm']) && !isset($HTTP_GET_VARS['confirm']) && !isset($HTTP_POST_VARS['confirm'])) { @@ -800,12 +809,12 @@ else if( $mode == "editpost" && $topic_status == TOPIC_UNLOCKED ) ); $template->assign_vars(array( "MESSAGE_TITLE" => $lang['Information'], - "MESSAGE_TEXT" => $lang['Confirm_delete'], + "MESSAGE_TEXT" => $lang['Confirm_delete'], + + "L_YES" => $lang['Yes'], + "L_NO" => $lang['No'], - "L_YES" => $lang['Yes'], - "L_NO" => $lang['No'], - - "S_CONFIRM_ACTION" => append_sid("posting.$phpEx"), + "S_CONFIRM_ACTION" => append_sid("posting.$phpEx"), "S_HIDDEN_FIELDS" => $s_hidden_fields) ); $template->pparse("confirm_body"); @@ -813,16 +822,16 @@ else if( $mode == "editpost" && $topic_status == TOPIC_UNLOCKED ) include($phpbb_root_path . 'includes/page_tail.'.$phpEx); } - else if( isset($HTTP_GET_VARS['confirm']) || isset($HTTP_POST_VARS['confirm']) || + else if( isset($HTTP_GET_VARS['confirm']) || isset($HTTP_POST_VARS['confirm']) || isset($HTTP_POST_VARS['override_confirm']) ) { - - $sql = "DELETE FROM " . POSTS_TEXT_TABLE . " + + $sql = "DELETE FROM " . POSTS_TEXT_TABLE . " WHERE post_id = $post_id"; if($db->sql_query($sql, BEGIN_TRANSACTION)) { - $sql = "DELETE FROM " . POSTS_TABLE . " + $sql = "DELETE FROM " . POSTS_TABLE . " WHERE post_id = $post_id"; if($is_last_post && $is_first_post) @@ -833,10 +842,10 @@ else if( $mode == "editpost" && $topic_status == TOPIC_UNLOCKED ) // if($db->sql_query($sql)) { - $sql = "DELETE FROM " . TOPICS_TABLE . " + $sql = "DELETE FROM " . TOPICS_TABLE . " WHERE topic_id = $topic_id"; - $sql_forum_upd = "forum_posts = forum_posts - 1, forum_topics = forum_topics - 1"; + $sql_forum_upd = "forum_posts = forum_posts - 1, forum_topics = forum_topics - 1"; $if_die_msg = "Couldn't delete from topics table"; } @@ -857,16 +866,16 @@ else if( $mode == "editpost" && $topic_status == TOPIC_UNLOCKED ) // if($db->sql_query($sql)) { - $sql = "SELECT MAX(post_id) AS new_last_post_id - FROM " . POSTS_TABLE . " + $sql = "SELECT MAX(post_id) AS new_last_post_id + FROM " . POSTS_TABLE . " WHERE topic_id = $topic_id"; - + if($result = $db->sql_query($sql)) { list($new_last_post_id) = $db->sql_fetchrow($result); - $sql = "UPDATE " . TOPICS_TABLE . " - SET topic_replies = topic_replies - 1, topic_last_post_id = $new_last_post_id + $sql = "UPDATE " . TOPICS_TABLE . " + SET topic_replies = topic_replies - 1, topic_last_post_id = $new_last_post_id WHERE topic_id = $topic_id"; $sql_forum_upd = "forum_posts = forum_posts - 1"; @@ -891,7 +900,7 @@ else if( $mode == "editpost" && $topic_status == TOPIC_UNLOCKED ) message_die(GENERAL_ERROR, "Error deleting from post table", "", __LINE__, __FILE__, $sql); } } - else if($is_auth['auth_mod']) + else if($is_auth['auth_mod']) { // // It's not last and it's not both first and last so it's somewhere in @@ -902,7 +911,7 @@ else if( $mode == "editpost" && $topic_status == TOPIC_UNLOCKED ) $if_die_msg = "Couldn't delete from posts table"; } - + // // Updating the forum is common to all three possibilities, // _remember_ we're still in a transaction here! @@ -911,10 +920,10 @@ else if( $mode == "editpost" && $topic_status == TOPIC_UNLOCKED ) { if($is_last_post_forum) { - $sql = "SELECT MAX(post_id) AS new_last_post_id - FROM " . POSTS_TABLE . " + $sql = "SELECT MAX(post_id) AS new_last_post_id + FROM " . POSTS_TABLE . " WHERE forum_id = $forum_id"; - + if($result = $db->sql_query($sql)) { list($new_last_post_id) = $db->sql_fetchrow($result); @@ -931,8 +940,8 @@ else if( $mode == "editpost" && $topic_status == TOPIC_UNLOCKED ) $new_last_sql = ""; } - $sql = "UPDATE " . FORUMS_TABLE . " - SET " . $sql_forum_upd . $new_last_sql . " + $sql = "UPDATE " . FORUMS_TABLE . " + SET " . $sql_forum_upd . $new_last_sql . " WHERE forum_id = $forum_id"; if($db->sql_query($sql, END_TRANSACTION)) @@ -941,7 +950,7 @@ else if( $mode == "editpost" && $topic_status == TOPIC_UNLOCKED ) // If we get here the post has been deleted successfully. // $msg = $lang['Deleted']; - + if(!$is_last_post || !$is_first_post) { $msg .= "<br /><br />" . $lang['Click'] . " <a href=\"" . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id") . "\">" . $lang['Here'] . "</a> " . $lang['to_return_topic']; @@ -1001,14 +1010,14 @@ else if( $mode == "editpost" && $topic_status == TOPIC_UNLOCKED ) $edited_sql = ""; } - $sql = "UPDATE " . POSTS_TABLE . " - SET bbcode_uid = '$bbcode_uid', enable_bbcode = $bbcode_on, enable_html = $html_on, enable_smilies = $smilies_on" . $edited_sql . " + $sql = "UPDATE " . POSTS_TABLE . " + SET bbcode_uid = '$bbcode_uid', enable_bbcode = $bbcode_on, enable_html = $html_on, enable_smilies = $smilies_on" . $edited_sql . " WHERE post_id = $post_id"; if($db->sql_query($sql, BEGIN_TRANSACTION)) { - $sql = "UPDATE " . POSTS_TEXT_TABLE . " - SET post_text = '$message', post_subject = '$subject' + $sql = "UPDATE " . POSTS_TEXT_TABLE . " + SET post_text = '$message', post_subject = '$subject' WHERE post_id = $post_id"; if($is_first_post) @@ -1018,8 +1027,8 @@ else if( $mode == "editpost" && $topic_status == TOPIC_UNLOCKED ) // // Update topics table here, set notification level and such // - $sql = "UPDATE " . TOPICS_TABLE . " - SET topic_title = '$subject', topic_type = '".$topic_type."' + $sql = "UPDATE " . TOPICS_TABLE . " + SET topic_title = '$subject', topic_type = '".$topic_type."' WHERE topic_id = $topic_id"; if($db->sql_query($sql, END_TRANSACTION)) @@ -1088,11 +1097,11 @@ else if( $mode == "editpost" && $topic_status == TOPIC_UNLOCKED ) { if( !empty($post_id) ) { - $sql = "SELECT p.*, pt.post_text, pt.post_subject, u.username, u.user_id, u.user_sig, t.topic_title, t.topic_type - FROM " . POSTS_TABLE . " p, " . USERS_TABLE . " u, " . TOPICS_TABLE . " t, " . POSTS_TEXT_TABLE . " pt - WHERE p.post_id = $post_id - AND pt.post_id = p.post_id - AND p.topic_id = t.topic_id + $sql = "SELECT p.*, pt.post_text, pt.post_subject, u.username, u.user_id, u.user_sig, t.topic_title, t.topic_type + FROM " . POSTS_TABLE . " p, " . USERS_TABLE . " u, " . TOPICS_TABLE . " t, " . POSTS_TEXT_TABLE . " pt + WHERE p.post_id = $post_id + AND pt.post_id = p.post_id + AND p.topic_id = t.topic_id AND p.poster_id = u.user_id"; if($result = $db->sql_query($sql)) @@ -1127,7 +1136,7 @@ else if( $mode == "editpost" && $topic_status == TOPIC_UNLOCKED ) $message = str_replace("<br />", "\n", $message); $message = undo_htmlspecialchars($message); - + // Special handling for </textarea> tags in the message, which can break the editing form.. $message = preg_replace('#</textarea>#si', '</TEXTAREA>', $message); @@ -1202,7 +1211,7 @@ if(empty($username)) } // -// Define a signature, this is in practice only used for +// Define a signature, this is in practice only used for // preview but doing this here allows us to use it as a // check for attach_sig later // @@ -1234,7 +1243,7 @@ if($preview && !$error) // // Define censored word matches // - $sql = "SELECT word, replacement + $sql = "SELECT word, replacement FROM " . WORDS_TABLE; if( !$words_result = $db->sql_query($sql) ) { @@ -1287,7 +1296,7 @@ if($preview && !$error) $preview_message = bbencode_second_pass($preview_message, $bbcode_uid); // - // This compensates for bbcode's rather agressive (but I guess necessary) + // This compensates for bbcode's rather agressive (but I guess necessary) // HTML handling // if( !$html_on ) @@ -1324,12 +1333,12 @@ if($preview && !$error) "preview" => "posting_preview.tpl") ); $template->assign_vars(array( - "TOPIC_TITLE" => $preview_subject, - "POST_SUBJECT" => $preview_subject, + "TOPIC_TITLE" => $preview_subject, + "POST_SUBJECT" => $preview_subject, "POSTER_NAME" => stripslashes($username), "POST_DATE" => create_date($board_config['default_dateformat'], time(), $board_config['default_timezone']), "MESSAGE" => $preview_message, - + "L_PREVIEW" => $lang['Preview'], "L_POSTED" => $lang['Posted']) ); @@ -1558,27 +1567,27 @@ $template->assign_vars(array( "L_OPTIONS" => $lang['Options'], "L_PREVIEW" => $lang['Preview'], "L_SUBMIT" => $lang['Submit_post'], - "L_CANCEL" => $lang['Cancel_post'], - "L_CONFIRM_DELETE" => $lang['Confirm_delete'], + "L_CANCEL" => $lang['Cancel_post'], + "L_CONFIRM_DELETE" => $lang['Confirm_delete'], "L_POST_A" => $post_a, "L_HTML_IS" => $lang['HTML'] . " " . $lang['is'], "L_BBCODE_IS" => $lang['BBCode'] . " " . $lang['is'], "L_SMILIES_ARE" => $lang['Smilies'] . " " . $lang['are'], - "L_DISABLE_HTML" => $lang['Disable'] . $lang['HTML'] . $lang['in_this_post'], - "L_DISABLE_BBCODE" => $lang['Disable'] . $lang['BBCode'] . $lang['in_this_post'], - "L_DISABLE_SMILIES" => $lang['Disable'] . $lang['Smilies'] . $lang['in_this_post'], - "L_ATTACH_SIGNATURE" => $lang['Attach_signature'], - "L_NOTIFY_ON_REPLY" => $lang['Notify'], - "L_DELETE_POST" => $lang['Delete_post'], - - "S_HTML_CHECKED" => (!$html_on) ? "checked=\"checked\"" : "", - "S_BBCODE_CHECKED" => (!$bbcode_on) ? "checked=\"checked\"" : "", - "S_SMILIES_CHECKED" => (!$smilies_on) ? "checked=\"checked\"" : "", - "S_SIGNATURE_CHECKED" => ($attach_sig) ? "checked=\"checked\"" : "", - "S_NOTIFY_CHECKED" => ($notify) ? "checked=\"checked\"" : "", - "S_TYPE_TOGGLE" => $topic_type_toggle, - "S_TOPIC_ID" => $topic_id, + "L_DISABLE_HTML" => $lang['Disable'] . $lang['HTML'] . $lang['in_this_post'], + "L_DISABLE_BBCODE" => $lang['Disable'] . $lang['BBCode'] . $lang['in_this_post'], + "L_DISABLE_SMILIES" => $lang['Disable'] . $lang['Smilies'] . $lang['in_this_post'], + "L_ATTACH_SIGNATURE" => $lang['Attach_signature'], + "L_NOTIFY_ON_REPLY" => $lang['Notify'], + "L_DELETE_POST" => $lang['Delete_post'], + + "S_HTML_CHECKED" => (!$html_on) ? "checked=\"checked\"" : "", + "S_BBCODE_CHECKED" => (!$bbcode_on) ? "checked=\"checked\"" : "", + "S_SMILIES_CHECKED" => (!$smilies_on) ? "checked=\"checked\"" : "", + "S_SIGNATURE_CHECKED" => ($attach_sig) ? "checked=\"checked\"" : "", + "S_NOTIFY_CHECKED" => ($notify) ? "checked=\"checked\"" : "", + "S_TYPE_TOGGLE" => $topic_type_toggle, + "S_TOPIC_ID" => $topic_id, "S_POST_ACTION" => append_sid("posting.$phpEx"), "S_HIDDEN_FORM_FIELDS" => $hidden_form_fields) diff --git a/phpBB/privmsg.php b/phpBB/privmsg.php index f603050dad..f914dcfe13 100644 --- a/phpBB/privmsg.php +++ b/phpBB/privmsg.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. + * + ***************************************************************************/ + $phpbb_root_path = "./"; include($phpbb_root_path . 'extension.inc'); include($phpbb_root_path . 'common.'.$phpEx); diff --git a/phpBB/profile.php b/phpBB/profile.php index 02b593e137..7b45f1ad03 100644 --- a/phpBB/profile.php +++ b/phpBB/profile.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. + * + ***************************************************************************/ + $phpbb_root_path = "./"; include($phpbb_root_path . 'extension.inc'); include($phpbb_root_path . 'common.'.$phpEx); diff --git a/phpBB/search.php b/phpBB/search.php index 0a82d307ac..f636f23992 100644 --- a/phpBB/search.php +++ b/phpBB/search.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. + * + ***************************************************************************/ + // // Massive overhaul for phpBB2, // originally based on search code @@ -37,8 +46,8 @@ function gensearch_sql($searchstring, $override_all = 0) $searchstring = stripslashes(trim(preg_replace($searchchars, $replacechars, preg_quote(strip_tags($searchstring))))); // - // Here could go a file containing words to ignore, - // eg. common words such as the, a, to, etc. or + // Here could go a file containing words to ignore, + // eg. common words such as the, a, to, etc. or // specific words which should not be search on // // This is what I actually use on the Typhoon site. The @@ -165,17 +174,17 @@ function gensearch_sql($searchstring, $override_all = 0) // // Search for words (OR AND and NOT arrays) - // + // $searchstring = ""; for($i=0;$i<count($binsearchtype);$i++) { if($binsearchtype[$i] == "AND" && count($searchlistandtype["AND"])) { - if($i > 0) + if($i > 0) $searchstring .= ") AND ("; for($j=0;$j<count($searchlistandtype["AND"]);$j++) { - if($j != 0) + if($j != 0) $searchstring .= " AND "; $findword = addslashes($searchlistandtype["AND"][$j]); $is_phrase_word = $searchlist_isphrase["AND"][$j]; @@ -191,11 +200,11 @@ function gensearch_sql($searchstring, $override_all = 0) } elseif($binsearchtype[$i] == "OR" && count($searchlistandtype["OR"])) { - if($i > 0) + if($i > 0) $searchstring .= ") AND ("; for($j=0;$j<count($searchlistandtype["OR"]);$j++) { - if($j != 0) + if($j != 0) $searchstring .= " OR "; $findword = addslashes($searchlistandtype["OR"][$j]); $is_phrase_word = $searchlist_isphrase["OR"][$j]; @@ -211,11 +220,11 @@ function gensearch_sql($searchstring, $override_all = 0) } elseif($binsearchtype[$i] == "NOT" && count($searchlistandtype["NOT"])) { - if($i > 0) + if($i > 0) $searchstring .= ") AND ("; for($j=0;$j<count($searchlistandtype["NOT"]);$j++) { - if($j != 0) + if($j != 0) $searchstring .= " AND "; $findword = addslashes($searchlistandtype["NOT"][$j]); $is_phrase_word = $searchlist_isphrase["NOT"][$j]; @@ -284,7 +293,7 @@ $querystring = (isset($HTTP_POST_VARS['querystring'])) ? $HTTP_POST_VARS['querys $authorstring = (isset($HTTP_POST_VARS['authorstring'])) ? $HTTP_POST_VARS['authorstring'] : ( (!empty($HTTP_GET_VARS['a'])) ? stripslashes($HTTP_GET_VARS['a']) : "" ); $return_chars = ($HTTP_POST_VARS['charsreqd'] != "all") ? $HTTP_POST_VARS['charsreqd'] : -1; -$return_chars = (isset($HTTP_GET_VARS['c'])) ? ( ($HTTP_GET_VARS['c'] != "all") ? $HTTP_GET_VARS['c'] : -1 ) : $return_chars; +$return_chars = (isset($HTTP_GET_VARS['c'])) ? ( ($HTTP_GET_VARS['c'] != "all") ? $HTTP_GET_VARS['c'] : -1 ) : $return_chars; $searchall = ($HTTP_POST_VARS['addterms'] == "all") ? 1 : ( ($HTTP_GET_VARS['m'] == "all") ? 1 : 0 ); $searchforum = (isset($HTTP_POST_VARS['searchforum'])) ? $HTTP_POST_VARS['searchforum'] : $HTTP_GET_VARS['f'] ; $sortby = (isset($HTTP_POST_VARS['sortby'])) ? $HTTP_POST_VARS['sortby'] : $HTTP_GET_VARS['b']; @@ -304,11 +313,11 @@ if((isset($HTTP_POST_VARS['dosearch']) || isset($HTTP_GET_VARS['dosearch'])) && // forums // $is_auth_ary = auth(AUTH_READ, AUTH_LIST_ALL, $userdata); - + // // Start building appropriate SQL query // - $sql = "SELECT pt.post_text, pt.post_subject, p.forum_id, p.post_id, p.topic_id, p.post_time, f.forum_name, t.topic_title, t.topic_replies, t.topic_views, u.username, u.user_id + $sql = "SELECT pt.post_text, pt.post_subject, p.forum_id, p.post_id, p.topic_id, p.post_time, f.forum_name, t.topic_title, t.topic_replies, t.topic_views, u.username, u.user_id FROM ".FORUMS_TABLE." f, ".TOPICS_TABLE." t, ".USERS_TABLE." u, ".POSTS_TEXT_TABLE." pt, ".POSTS_TABLE." p "; // @@ -338,10 +347,10 @@ if((isset($HTTP_POST_VARS['dosearch']) || isset($HTTP_GET_VARS['dosearch'])) && if(!ereg("\([ ]*\)",$search_sql)) { - $sql .= "WHERE $search_sql - AND (pt.post_id = p.post_id) - AND (f.forum_id = p.forum_id) - AND (p.topic_id = t.topic_id) + $sql .= "WHERE $search_sql + AND (pt.post_id = p.post_id) + AND (f.forum_id = p.forum_id) + AND (p.topic_id = t.topic_id) AND (p.poster_id = u.user_id)"; if($searchforum != "all") @@ -358,7 +367,7 @@ if((isset($HTTP_POST_VARS['dosearch']) || isset($HTTP_GET_VARS['dosearch'])) && } $sql .= " ORDER BY ".$sortby_sql[$sortby]." $sortby_dir"; - + $result = $db->sql_query($sql); if(!$result) { @@ -371,7 +380,7 @@ if((isset($HTTP_POST_VARS['dosearch']) || isset($HTTP_GET_VARS['dosearch'])) && // // Output header // - include($phpbb_root_path . 'includes/page_header.'.$phpEx); + include($phpbb_root_path . 'includes/page_header.'.$phpEx); $template->set_filenames(array( "body" => "search_results_body.tpl", @@ -413,7 +422,7 @@ if((isset($HTTP_POST_VARS['dosearch']) || isset($HTTP_GET_VARS['dosearch'])) && { $message = (strlen($message) > $return_chars) ? substr($message, 0, $return_chars) . " ..." : $message; } - + $message = strip_tags($message); // // Remove BBCode @@ -435,8 +444,8 @@ if((isset($HTTP_POST_VARS['dosearch']) || isset($HTTP_GET_VARS['dosearch'])) && $template->assign_block_vars("searchresults", array( "TOPIC_TITLE" => stripslashes($searchset[$i]['topic_title']), "FORUM_NAME" => stripslashes($searchset[$i]['forum_name']), - "POST_SUBJECT" => stripslashes($searchset[$i]['post_subject']), - "POST_DATE" => $post_date, + "POST_SUBJECT" => stripslashes($searchset[$i]['post_subject']), + "POST_DATE" => $post_date, "POSTER_NAME" => stripslashes($searchset[$i]['username']), "TOPIC_REPLIES" => $searchset[$i]['topic_replies'], "TOPIC_VIEWS" => $searchset[$i]['topic_views'], @@ -456,7 +465,7 @@ if((isset($HTTP_POST_VARS['dosearch']) || isset($HTTP_GET_VARS['dosearch'])) && "PAGINATION" => generate_pagination($base_url, count($searchset), $board_config['posts_per_page'], $start), "ON_PAGE" => (floor($start/$board_config['posts_per_page'])+1), "TOTAL_PAGES" => ceil((count($searchset))/$board_config['posts_per_page']), - + "L_OF" => $lang['of'], "L_PAGE" => $lang['Page'], "L_GOTO_PAGE" => $lang['Goto_page']) @@ -475,7 +484,7 @@ if((isset($HTTP_POST_VARS['dosearch']) || isset($HTTP_GET_VARS['dosearch'])) && // an auth function return of // all accessible forums ... I think // -$sql = "SELECT forum_name, forum_id +$sql = "SELECT forum_name, forum_id FROM " . FORUMS_TABLE . " ORDER BY cat_id, forum_order"; $result = $db->sql_query($sql); @@ -532,12 +541,12 @@ $template->assign_vars(array( "L_SEARCH_AUTHOR" => $lang['Search_author'], "L_LIMIT_CHARACTERS" => $lang['Limit_chars'], "L_SORT_BY" => $lang['Sort_by'], - "L_SORT_ASCENDING" => $lang['Sort_Ascending'], + "L_SORT_ASCENDING" => $lang['Sort_Ascending'], "L_SORT_DECENDING" => $lang['Sort_Decending'], "S_SEARCH_ACTION" => append_sid("search.$phpEx"), "S_CHARACTER_OPTIONS" => $s_characters, - "S_FORUM_OPTIONS" => $s_forums, + "S_FORUM_OPTIONS" => $s_forums, "S_SORT_OPTIONS" => $s_sortby, "S_HIDDEN_FIELDS" => $s_hidden_fields) ); diff --git a/phpBB/upgrade_20.php b/phpBB/upgrade_20.php index 22c5e84b19..7da6be2186 100644 --- a/phpBB/upgrade_20.php +++ b/phpBB/upgrade_20.php @@ -3,13 +3,22 @@ * upgrade_20.php * ------------------- * begin : Sat Oct 14 2000 -* copyright : (C) 2001 The phpBB Group -* email : support@phpbb.com -* +* copyright : (C) 2001 The phpBB Group +* email : support@phpbb.com +* * $id upgrade_20.php,v 1.9 2001/03/23 01:32:41 psotfx Exp $ -* +* ****************************************************************************/ - + +/*************************************************************************** + * + * 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. + * + ***************************************************************************/ + include('extension.inc'); include('config.'.$phpEx); include('includes/constants.'.$phpEx); @@ -44,19 +53,19 @@ function common_footer() } -function convert_ip($ip) +function convert_ip($ip) { - if (strstr($ip, ".")) + if (strstr($ip, ".")) { $ip_sep = explode(".", $ip); $return = (( $ip_sep[0] * 0xFFFFFF + $ip_sep[0] ) + ( $ip_sep[1] * 0xFFFF + $ip_sep[1] ) + ( $ip_sep[2] * 0xFF + $ip_sep[2] ) + ( $ip_sep[3] ) ); } - else + else { $return = sprintf( "%d.%d.%d.%d", ( ( $ip >> 24 ) & 0xFF ), ( ( $ip >> 16 ) & 0xFF ), ( ( $ip >> 8 ) & 0xFF ), ( ( $ip ) & 0xFF ) ); } return($return); -} +} function convert_date($date_in) { @@ -67,7 +76,7 @@ function convert_date($date_in) // Original phpBB format list($year, $month, $day) = split("-", $date); list($hours, $minutes) = split(":", $time); - $timestamp = gmmktime($hours, $minutes, 0, $month, $day, $year); + $timestamp = gmmktime($hours, $minutes, 0, $month, $day, $year); return($timestamp); } @@ -75,7 +84,7 @@ function convert_date($date_in) // // Following functions adapted from phpMyAdmin // -// Return table's CREATE definition +// Return table's CREATE definition // Returns a string containing the CREATE statement on success // function get_table_def($db, $table, $crlf) { @@ -91,7 +100,7 @@ function get_table_def($db, $table, $crlf) { } while ($row = $db->sql_fetchrow($result)) { $schema_create .= " $row[Field] $row[Type]"; - + if (!empty($row["Default"])){ $schema_create .= " DEFAULT '$row[Default]'"; } @@ -101,7 +110,7 @@ function get_table_def($db, $table, $crlf) { if ($row["Extra"] != ""){ $schema_create .= " $row[Extra]"; } - + $schema_create .= ",$crlf"; } @@ -112,10 +121,10 @@ function get_table_def($db, $table, $crlf) { $error = $db->sql_error(); error_die($db, GENERAL_ERROR, "Failed in get_table_content (show keys) : ".$error["message"]); } - + while ($row = $db->sql_fetchrow($result)){ $kname=$row['Key_name']; - + if (($kname != "PRIMARY") && ($row['Non_unique'] == 0)){ $kname="UNIQUE|$kname"; } @@ -135,11 +144,11 @@ function get_table_def($db, $table, $crlf) { $schema_create .= " KEY $x (" . implode($columns, ", ") . ")"; } } - + $schema_create .= "$crlf);"; - + return (stripslashes($schema_create)); -} +} // // Get the content of table as a series of INSERT statements. @@ -155,9 +164,9 @@ function get_table_content($db, $table, $handler) { error_die($db, GENERAL_ERROR, "Failed in get_table_content (select * ) : ".$error["message"]); } $i = 0; - + while ($row = $db->sql_fetchrow($result)) { - + $schema_insert = "INSERT INTO $table VALUES("; for ($j=0; $j<$db->sql_numfields($result);$j++) { @@ -180,7 +189,7 @@ function get_table_content($db, $table, $handler) { function output_table_content($content){ echo $content."\n"; - + return; } @@ -200,17 +209,17 @@ function bbdecode($message) { $quote_end_html = "</BLOCKQUOTE></FONT></TD></TR><TR><TD><HR></TD></TR></TABLE><!-- BBCode Quote End -->"; $message = str_replace($quote_start_html, "[quote]", $message); $message = str_replace($quote_end_html, "[/quote]", $message); - + // Undo [b] and [i] $message = preg_replace("#<!-- BBCode Start --><B>(.*?)</B><!-- BBCode End -->#s", "[b]\\1[/b]", $message); $message = preg_replace("#<!-- BBCode Start --><I>(.*?)</I><!-- BBCode End -->#s", "[i]\\1[/i]", $message); - + // Undo [url] (long form) $message = preg_replace("#<!-- BBCode u2 Start --><A HREF=\"([a-z]+?://)(.*?)\" TARGET=\"_blank\">(.*?)</A><!-- BBCode u2 End -->#s", "[url=\\1\\2]\\3[/url]", $message); - + // Undo [url] (short form) $message = preg_replace("#<!-- BBCode u1 Start --><A HREF=\"([a-z]+?://)(.*?)\" TARGET=\"_blank\">(.*?)</A><!-- BBCode u1 End -->#s", "[url]\\3[/url]", $message); - + // Undo [email] $message = preg_replace("#<!-- BBCode Start --><A HREF=\"mailto:(.*?)\">(.*?)</A><!-- BBCode End -->#s", "[email]\\1[/email]", $message); @@ -218,16 +227,16 @@ function bbdecode($message) { $message = preg_replace("#<!-- BBCode Start --><IMG SRC=\"(.*?)\" BORDER=\"0\"><!-- BBCode End -->#s", "[img]\\1[/img]", $message); // Undo lists (unordered/ordered) - + // <li> tags: $message = str_replace("<!-- BBCode --><LI>", "[*]", $message); - + // [list] tags: $message = str_replace("<!-- BBCode ulist Start --><UL>", "[list]", $message); - + // [list=x] tags: $message = preg_replace("#<!-- BBCode olist Start --><OL TYPE=([A1])>#si", "[list=\\1]", $message); - + // [/list] tags: $message = str_replace("</UL><!-- BBCode ulist End -->", "[/list]", $message); $message = str_replace("</OL><!-- BBCode olist End -->", "[/list]", $message); @@ -242,14 +251,14 @@ function bbdecode($message) { * - Does not distinguish between "www.xxxx.yyyy" and "http://aaaa.bbbb" type URLs. * */ - + function undo_make_clickable($text) { - + $text = preg_replace("#<!-- BBCode auto-link start --><a href=\"(.*?)\" target=\"_blank\">.*?</a><!-- BBCode auto-link end -->#i", "\\1", $text); $text = preg_replace("#<!-- BBcode auto-mailto start --><a href=\"mailto:(.*?)\">.*?</a><!-- BBCode auto-mailto end -->#i", "\\1", $text); - + return $text; - + } // @@ -260,9 +269,9 @@ function undo_make_clickable($text) { ?> <?php -if(isset($next)) +if(isset($next)) { - switch($next) + switch($next) { case 'backup': @@ -388,9 +397,9 @@ if(isset($next)) { while($row = $db->sql_fetchrow($result)) { - $sql = "INSERT INTO phpbb_banlist - (ban_id, ban_userid, ban_ip, ban_start, ban_end, ban_time_type) - VALUES + $sql = "INSERT INTO phpbb_banlist + (ban_id, ban_userid, ban_ip, ban_start, ban_end, ban_time_type) + VALUES ('".$row["ban_id"]."', '".$row["ban_userid"]."', '".convert_ip($row["ban_ip"])."', '".$row["ban_start"]."', '".$row["ban_end"]."', '".$row["ban_time_type"]."')"; $insert_result = $db->sql_query($sql); if(!$insert_result) @@ -458,7 +467,7 @@ if(isset($next)) { while($row = $db->sql_fetchrow($result)) { - $sql = "INSERT INTO phpbb_config + $sql = "INSERT INTO phpbb_config (config_id, sitename, allow_html, allow_bbcode, allow_sig, allow_namechange, selected, posts_per_page, hot_threshold, topics_per_page, allow_theme_create, override_themes, email_sig, email_from, default_lang) VALUES ('".$row["config_id"]."', '".$row["sitename"]."', '".$row["allow_html"]."', '".$row["allow_bbcode"]."', '".$row["allow_sig"]."', '".$row["allow_namechange"]."', '".$row["selected"]."', '".$row["posts_per_page"]."', '".$row["hot_threshold"]."', '".$row["topics_per_page"]."', '".$row["allow_theme_create"]."', '".$row["override_themes"]."', '".$row["email_sig"]."', '".$row["email_from"]."', '".$row["default_lang"]."')"; @@ -843,7 +852,7 @@ if(isset($next)) // do 2.x first-pass encoding.. $row['post_text'] = bbencode_first_pass($row['post_text'], $uid); $row['post_text'] = addslashes($row['post_text']); - + $sql = "INSERT INTO phpbb_posts (post_id, topic_id, forum_id, poster_id, post_time, poster_ip, bbcode_uid) VALUES @@ -975,7 +984,7 @@ if(isset($next)) } // switch } // if next -else +else { common_header(); ?> @@ -994,7 +1003,7 @@ else <INPUT TYPE="HIDDEN" NAME="next" VALUE="backup"> <INPUT TYPE="SUBMIT" VALUE="Next >"> </FORM> -<?php +<?php } ?> </BODY> diff --git a/phpBB/viewforum.php b/phpBB/viewforum.php index 4832b7076d..d727803c8f 100644 --- a/phpBB/viewforum.php +++ b/phpBB/viewforum.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. + * + ***************************************************************************/ + $phpbb_root_path = "./"; include($phpbb_root_path . 'extension.inc'); include($phpbb_root_path . 'common.'.$phpEx); @@ -245,7 +254,7 @@ $sql = "SELECT t.*, u.username, u.user_id, u2.username as user2, u2.user_id as i AND t.topic_poster = u.user_id AND p.post_id = t.topic_last_post_id AND p.poster_id = u2.user_id - AND t.topic_type = " . POST_ANNOUNCE . " + AND t.topic_type = " . POST_ANNOUNCE . " ORDER BY p.post_time DESC"; if(!$ta_result = $db->sql_query($sql)) { diff --git a/phpBB/viewonline.php b/phpBB/viewonline.php index 3fd3ff6aa7..e04196dc89 100644 --- a/phpBB/viewonline.php +++ b/phpBB/viewonline.php @@ -1,15 +1,24 @@ <?php -/*************************************************************************** +/*************************************************************************** * viewonline.php - * ------------------- - * begin : Saturday, Feb 13, 2001 - * copyright : (C) 2001 The phpBB Group - * email : support@phpbb.com - * + * ------------------- + * 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'); @@ -38,9 +47,9 @@ $template->set_filenames(array( $jumpbox = make_jumpbox(); $template->assign_vars(array( - "L_GO" => $lang['Go'], - "L_JUMP_TO" => $lang['Jump_to'], - "L_SELECT_FORUM" => $lang['Select_forum'], + "L_GO" => $lang['Go'], + "L_JUMP_TO" => $lang['Jump_to'], + "L_SELECT_FORUM" => $lang['Select_forum'], "JUMPBOX_LIST" => $jumpbox, "SELECT_NAME" => POST_FORUM_URL) ); @@ -50,11 +59,11 @@ $template->assign_var_from_handle("JUMPBOX", "jumpbox"); // $sql = "SELECT u.user_id, u.username, u.user_allow_viewonline, s.session_page, s.session_logged_in, s.session_time - FROM " . USERS_TABLE . " u, " . SESSIONS_TABLE . " s - WHERE u.user_id <> " . ANONYMOUS . " + FROM " . USERS_TABLE . " u, " . SESSIONS_TABLE . " s + WHERE u.user_id <> " . ANONYMOUS . " AND u.user_id = s.session_user_id - AND s.session_time >= " . ( time() - 300 ) . " - AND s.session_logged_in = " . TRUE . " + AND s.session_time >= " . ( time() - 300 ) . " + AND s.session_logged_in = " . TRUE . " ORDER BY s.session_time DESC"; if(!$result = $db->sql_query($sql)) { @@ -64,7 +73,7 @@ $onlinerow_reg = $db->sql_fetchrowset($result); $sql = "SELECT session_page, session_logged_in, session_time FROM " . SESSIONS_TABLE . " - WHERE session_logged_in = 0 + WHERE session_logged_in = 0 AND session_time >= " . ( time() - 300 ) . " ORDER BY session_time DESC"; if(!$result = $db->sql_query($sql)) @@ -89,7 +98,7 @@ else $template->assign_vars(array( "L_WHOSONLINE" => $lang['Who_is_online'], - "L_ONLINE_EXPLAIN" => $lang['Online_explain'], + "L_ONLINE_EXPLAIN" => $lang['Online_explain'], "L_USERNAME" => $lang['Username'], "L_LOCATION" => $lang['Location'], "L_LAST_UPDATE" => $lang['Last_updated']) @@ -120,7 +129,7 @@ if( count($onlinerow_reg) ) $hidden = FALSE; $registered_users++; } - else + else { $displayed_userid_list .= "," . $onlinerow_reg[$i]['user_id']; @@ -204,14 +213,14 @@ if( count($onlinerow_reg) ) $l_is_are = ($registered_users == 1) ? $lang['is'] : $lang['are']; $template->assign_vars(array( - "TOTAL_REGISTERED_USERS_ONLINE" => $lang['There'] . " $l_is_are $logged_visible_online " . $lang['Registered'] . " $l_r_user_s " . $lang['and'] . " $logged_hidden_online " . $lang['Hidden'] . " $l_h_user_s " . $lang['online']) + "TOTAL_REGISTERED_USERS_ONLINE" => $lang['There'] . " $l_is_are $logged_visible_online " . $lang['Registered'] . " $l_r_user_s " . $lang['and'] . " $logged_hidden_online " . $lang['Hidden'] . " $l_h_user_s " . $lang['online']) ); } else { $template->assign_vars(array( - "TOTAL_REGISTERED_USERS_ONLINE" => $lang['There'] . " " . $lang['are'] . " 0 " . $lang['Registered'] . " " . $lang['Users'] . " " . $lang['and'] . " 0 " . $lang['Hidden'] . " " . $lang['Users'] . " " . $lang['online'], + "TOTAL_REGISTERED_USERS_ONLINE" => $lang['There'] . " " . $lang['are'] . " 0 " . $lang['Registered'] . " " . $lang['Users'] . " " . $lang['and'] . " 0 " . $lang['Hidden'] . " " . $lang['Users'] . " " . $lang['online'], "L_NO_REGISTERED_USERS_BROWSING" => $lang['No_users_browsing']) ); } @@ -296,14 +305,14 @@ if( count($onlinerow_guest) ) $l_is_are = ($guest_users == 1) ? $lang['is'] : $lang['are']; $template->assign_vars(array( - "TOTAL_GUEST_USERS_ONLINE" => $lang['There'] . " $l_is_are $guests_online " . $lang['Guest'] . " $l_g_user_s " . $lang['online']) + "TOTAL_GUEST_USERS_ONLINE" => $lang['There'] . " $l_is_are $guests_online " . $lang['Guest'] . " $l_g_user_s " . $lang['online']) ); } else { $template->assign_vars(array( - "TOTAL_GUEST_USERS_ONLINE" => $lang['There'] . " " . $lang['are'] . " 0 " . $lang['Guest'] . " " . $lang['Users'] . " " . $lang['online'], + "TOTAL_GUEST_USERS_ONLINE" => $lang['There'] . " " . $lang['are'] . " 0 " . $lang['Guest'] . " " . $lang['Users'] . " " . $lang['online'], "L_NO_GUESTS_BROWSING" => $lang['No_guests_browsing']) ); } diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 0982d2e912..1d14d33023 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -164,7 +164,7 @@ if(!$is_auth['auth_view'] || !$is_auth['auth_read']) // // -// Is user watching this thread? This could potentially +// Is user watching this thread? This could potentially // be combined into the above query but the LEFT JOIN causes // a number of problems which will probably end up in this // solution being practically as fast and certainly simpler! @@ -173,9 +173,9 @@ if($userdata['user_id'] != ANONYMOUS) { $can_watch_topic = TRUE; - $sql = "SELECT notify_status - FROM " . TOPICS_WATCH_TABLE . " - WHERE topic_id = $topic_id + $sql = "SELECT notify_status + FROM " . TOPICS_WATCH_TABLE . " + WHERE topic_id = $topic_id AND user_id = " . $userdata['user_id']; if( !$result = $db->sql_query($sql) ) { @@ -190,8 +190,8 @@ if($userdata['user_id'] != ANONYMOUS) $is_watching_topic = 0; $sql_priority = (SQL_LAYER == "mysql") ? "LOW_PRIORITY" : ""; - $sql = "DELETE $sql_priority FROM " . TOPICS_WATCH_TABLE . " - WHERE topic_id = $topic_id + $sql = "DELETE $sql_priority FROM " . TOPICS_WATCH_TABLE . " + WHERE topic_id = $topic_id AND user_id = " . $userdata['user_id']; if( !$result = $db->sql_query($sql) ) { @@ -208,9 +208,9 @@ if($userdata['user_id'] != ANONYMOUS) if( $watch_data['notify_status'] ) { $sql_priority = (SQL_LAYER == "mysql") ? "LOW_PRIORITY" : ""; - $sql = "UPDATE $sql_priority " . TOPICS_WATCH_TABLE . " - SET notify_status = 0 - WHERE topic_id = $topic_id + $sql = "UPDATE $sql_priority " . TOPICS_WATCH_TABLE . " + SET notify_status = 0 + WHERE topic_id = $topic_id AND user_id = " . $userdata['user_id']; if( !$result = $db->sql_query($sql) ) { @@ -228,7 +228,7 @@ if($userdata['user_id'] != ANONYMOUS) $is_watching_topic = TRUE; $sql_priority = (SQL_LAYER == "mysql") ? "LOW_PRIORITY" : ""; - $sql = "INSERT $sql_priority INTO " . TOPICS_WATCH_TABLE . " (user_id, topic_id, notify_status) + $sql = "INSERT $sql_priority INTO " . TOPICS_WATCH_TABLE . " (user_id, topic_id, notify_status) VALUES (" . $userdata['user_id'] . ", $topic_id, 0)"; if( !$result = $db->sql_query($sql) ) { @@ -362,7 +362,7 @@ $ranksrow = $db->sql_fetchrowset($ranksresult); // // Define censored word matches // -$sql = "SELECT word, replacement +$sql = "SELECT word, replacement FROM " . WORDS_TABLE; if( !$words_result = $db->sql_query($sql) ) { @@ -413,8 +413,8 @@ $template->assign_vars(array( "TOPIC_ID" => $topic_id, "TOPIC_TITLE" => $topic_title, - "L_DISPLAY_POSTS" => $lang['Display_posts'], - "L_RETURN_TO_TOP" => $lang['Return_to_top'], + "L_DISPLAY_POSTS" => $lang['Display_posts'], + "L_RETURN_TO_TOP" => $lang['Return_to_top'], "S_SELECT_POST_DAYS" => $select_post_days, "S_SELECT_POST_ORDER" => $select_post_order, @@ -594,11 +594,11 @@ for($i = 0; $i < $total_posts; $i++) if( $is_auth['auth_mod'] ) { - $ip_img = "<a href=\"" . append_sid("modcp.$phpEx?mode=viewip&" . POST_POST_URL . "=" . $post_id) . "\"><img src=\"" . $images['icon_ip'] . "\" alt=\"" . $lang['View_IP'] . "\" border=\"0\" /></a>"; + $ip_img = "<a href=\"" . append_sid("modcp.$phpEx?mode=ip&" . POST_POST_URL . "=" . $postrow[$i]['post_id'] . "&" . POST_TOPIC_URL . "=$topic_id") . "\"><img src=\"" . $images['icon_ip'] . "\" alt=\"" . $lang['View_IP'] . "\" border=\"0\" /></a>"; $delpost_img = "<a href=\"" . append_sid("topicadmin.$phpEx?mode=delpost&" . POST_POST_URL . "=" . $postrow[$i]['post_id']) . "\"><img src=\"" . $images['icon_delpost'] . "\" alt=\"" . $lang['Delete_post'] . "\" border=\"0\" /></a>"; } - + $message = stripslashes($postrow[$i]['post_text']); $post_subject = ($postrow[$i]['post_subject'] != "") ? stripslashes($postrow[$i]['post_subject']) : $topic_title; @@ -627,7 +627,7 @@ for($i = 0; $i < $total_posts; $i++) $message = bbencode_second_pass($message, $bbcode_uid); // - // This compensates for bbcode's rather agressive (but I guess necessary) + // This compensates for bbcode's rather agressive (but I guess necessary) // HTML handling // if(!$postrow[$i]['enable_html'] || ($postrow[$i]['enable_html'] && !$board_config['allow_html']) ) @@ -771,15 +771,15 @@ $template->assign_vars(array( "ON_PAGE" => ( floor( $start / $board_config['posts_per_page'] ) + 1 ), "TOTAL_PAGES" => ceil( $total_replies / $board_config['posts_per_page'] ), - "S_AUTH_LIST" => $s_auth_can, - "S_AUTH_READ_IMG" => $s_auth_read_img, - "S_AUTH_POST_IMG" => $s_auth_post_img, - "S_AUTH_REPLY_IMG" => $s_auth_reply_img, - "S_AUTH_EDIT_IMG" => $s_auth_edit_img, + "S_AUTH_LIST" => $s_auth_can, + "S_AUTH_READ_IMG" => $s_auth_read_img, + "S_AUTH_POST_IMG" => $s_auth_post_img, + "S_AUTH_REPLY_IMG" => $s_auth_reply_img, + "S_AUTH_EDIT_IMG" => $s_auth_edit_img, "S_AUTH_MOD_IMG" => $s_auth_mod_img, - "S_TOPIC_ADMIN" => $topic_mod, - "S_WATCH_TOPIC" => $s_watching_topic, - "S_WATCH_TOPIC_IMG" => $s_watching_topic_img, + "S_TOPIC_ADMIN" => $topic_mod, + "S_WATCH_TOPIC" => $s_watching_topic, + "S_WATCH_TOPIC_IMG" => $s_watching_topic_img, "L_OF" => $lang['of'], "L_PAGE" => $lang['Page'], |