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,15 +1,24 @@
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 = "";
$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" => "",
- "MESSAGE_TITLE" => $lang['Database_Utilities'] . " : " . $lang['Backup'],
+ $template->assign_vars(array(
+ "META" => "",
+
+ "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 = "";
$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
";
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 @@
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 @@
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 .= "";
$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 .= "";
}
- else
+ else
{
$simple_auth .= "";
}
@@ -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] .= "";
}
- else
+ else
{
$custom_auth[$j] .= "";
}
@@ -296,17 +305,17 @@ else
$s_hidden_fields = '';
$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 = "\n";
$statuslist .= "\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=
$sql"; @@ -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 @@ 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 = '' . $switch_mode_text . ''; $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 @@ " . 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 @@ 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 @@ 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 = ""; $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 = ""; - $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 = ""; $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 @@ 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 = '' . $switch_mode_text . ''; $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 @@ '; $s_hidden_fields .= ''; // 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 = ""; + $theme_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 @@ 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 @@ 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 @@ _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('##', $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 .= "" . $forum_mods_name[$forum_id][$mods] . ""; } - else + else { $moderators_links .= "" . $forum_mods_name[$forum_id][$mods] . ""; } @@ -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 @@ 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']) ? "
"; + var_dump($poster_ids); + echo ""; + + $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 "
"; + var_dump($other_users); + echo ""; + + + 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("