Re-added GPL disclaimers

git-svn-id: file:///svn/phpbb/trunk@943 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
James Atkinson 2001-08-30 22:20:23 +00:00
parent 8d34f5a0fe
commit 191e52086f
51 changed files with 1674 additions and 1177 deletions

View file

@ -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) if($setmodules == 1)
{ {
$file = basename(__FILE__); $file = basename(__FILE__);

View file

@ -1,15 +1,24 @@
<?php <?php
/*************************************************************************** /***************************************************************************
* admin_db_utilities.php * admin_db_utilities.php
* ------------------- * -------------------
* begin : Thu May 31, 2001 * begin : Thu May 31, 2001
* copyright : (C) 2001 The phpBB Group * copyright : (C) 2001 The phpBB Group
* email : support@phpbb.com * 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.
*
***************************************************************************/
/*************************************************************************** /***************************************************************************
* We will attempt to create a file based backup of all of the data in the * We will attempt to create a file based backup of all of the data in the
* users phpBB database. The resulting file should be able to be imported by * users phpBB database. The resulting file should be able to be imported by
@ -37,7 +46,7 @@ include($phpbb_root_path . 'common.'.$phpEx);
// //
$userdata = session_pagestart($user_ip, PAGE_INDEX, $session_length); $userdata = session_pagestart($user_ip, PAGE_INDEX, $session_length);
init_userprefs($userdata); init_userprefs($userdata);
// //
// End session management // End session management
// //
@ -59,10 +68,10 @@ else if( $userdata['user_level'] != ADMIN )
define("VERBOSE", 0); define("VERBOSE", 0);
// //
// Increase maximum execution time, but don't complain about it if it isn't // Increase maximum execution time, but don't complain about it if it isn't
// allowed. // allowed.
// //
@set_time_limit(600); @set_time_limit(600);
// //
// The following functions are adapted from phpMyAdmin and upgrade_20.php // The following functions are adapted from phpMyAdmin and upgrade_20.php
@ -74,7 +83,7 @@ function pg_get_sequences($crlf, $backup_type)
{ {
global $db; global $db;
$get_seq_sql = "SELECT relname FROM pg_class WHERE NOT relname ~ 'pg_.*' $get_seq_sql = "SELECT relname FROM pg_class WHERE NOT relname ~ 'pg_.*'
AND relkind = 'S' ORDER BY relname"; AND relkind = 'S' ORDER BY relname";
$seq = $db->sql_query($get_seq_sql); $seq = $db->sql_query($get_seq_sql);
@ -105,7 +114,7 @@ function pg_get_sequences($crlf, $backup_type)
if($backup_type == 'structure') if($backup_type == 'structure')
{ {
$row['last_value'] = 1; $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"; $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... } // End function...
// //
// The following functions will return the "CREATE TABLE syntax for the // The following functions will return the "CREATE TABLE syntax for the
// varying DBMS's // varying DBMS's
// //
// This function returns, will return the table def's for postgres... // 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 $sql_get_default = "SELECT d.adsrc AS rowdefault
FROM pg_attrdef d, pg_class c FROM pg_attrdef d, pg_class c
WHERE (c.relname = '$table') WHERE (c.relname = '$table')
AND (c.oid = d.adrelid) AND (c.oid = d.adrelid)
AND d.adnum = " . $row['attnum']; AND d.adnum = " . $row['attnum'];
$def_res = $db->sql_query($sql_get_default); $def_res = $db->sql_query($sql_get_default);
@ -183,7 +192,7 @@ function get_table_def_postgres($table, $crlf)
{ {
unset($row['rowdefault']); unset($row['rowdefault']);
} }
else else
{ {
$row['rowdefault'] = @pg_result($def_res, 0, 'rowdefault'); $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 $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 FROM pg_class bc, pg_class ic, pg_index i, pg_attribute ta, pg_attribute ia
WHERE (bc.oid = i.indrelid) WHERE (bc.oid = i.indrelid)
AND (ic.oid = i.indexrelid) AND (ic.oid = i.indexrelid)
AND (ia.attrelid = i.indexrelid) AND (ia.attrelid = i.indexrelid)
AND (ta.attrelid = bc.oid) AND (ta.attrelid = bc.oid)
AND (bc.relname = '$table') AND (bc.relname = '$table')
AND (ta.attrelid = i.indrelid) AND (ta.attrelid = i.indrelid)
AND (ta.attnum = i.indkey[ia.attnum-1]) AND (ta.attnum = i.indkey[ia.attnum-1])
ORDER BY index_name, tab_name, column_name "; ORDER BY index_name, tab_name, column_name ";
$result = $db->sql_query($sql_pri_keys); $result = $db->sql_query($sql_pri_keys);
@ -287,16 +296,16 @@ function get_table_def_postgres($table, $crlf)
// //
// Generate constraint clauses for CHECK constraints // 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 FROM pg_relcheck, pg_class bc
WHERE rcrelid = bc.oid WHERE rcrelid = bc.oid
AND bc.relname = '$table' AND bc.relname = '$table'
AND NOT EXISTS ( AND NOT EXISTS (
SELECT * SELECT *
FROM pg_relcheck as c, pg_inherits as i FROM pg_relcheck as c, pg_inherits as i
WHERE i.inhrelid = pg_relcheck.rcrelid WHERE i.inhrelid = pg_relcheck.rcrelid
AND c.rcname = pg_relcheck.rcname AND c.rcname = pg_relcheck.rcname
AND c.rcsrc = pg_relcheck.rcsrc AND c.rcsrc = pg_relcheck.rcsrc
AND c.rcrelid = i.inhparent AND c.rcrelid = i.inhparent
)"; )";
$result = $db->sql_query($sql_checks); $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); message_die(GENERAL_ERROR, "Failed in get_table_def (show fields)", "", __LINE__, __FILE__, $sql_checks);
} }
// //
// Add the constraints to the sql file. // 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... // 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; global $drop, $db;
@ -350,7 +359,7 @@ function get_table_def_mysql($table, $crlf)
{ {
$schema_create .= "DROP TABLE IF EXISTS $table;$crlf"; $schema_create .= "DROP TABLE IF EXISTS $table;$crlf";
} }
$schema_create .= "CREATE TABLE $table($crlf"; $schema_create .= "CREATE TABLE $table($crlf";
// //
@ -371,7 +380,7 @@ function get_table_def_mysql($table, $crlf)
$schema_create .= ' DEFAULT \'' . $row['Default'] . '\''; $schema_create .= ' DEFAULT \'' . $row['Default'] . '\'';
} }
if($row['Null'] != "YES") if($row['Null'] != "YES")
{ {
$schema_create .= ' NOT NULL'; $schema_create .= ' NOT NULL';
} }
@ -406,7 +415,7 @@ function get_table_def_mysql($table, $crlf)
$kname = "UNIQUE|$kname"; $kname = "UNIQUE|$kname";
} }
if(!is_array($index[$kname])) if(!is_array($index[$kname]))
{ {
$index[$kname] = array(); $index[$kname] = array();
} }
@ -414,18 +423,18 @@ function get_table_def_mysql($table, $crlf)
$index[$kname][] = $row['Column_name']; $index[$kname][] = $row['Column_name'];
} }
while(list($x, $columns) = @each($index)) while(list($x, $columns) = @each($index))
{ {
$schema_create .= ", $crlf"; $schema_create .= ", $crlf";
if($x == 'PRIMARY') if($x == 'PRIMARY')
{ {
$schema_create .= ' PRIMARY KEY (' . implode($columns, ', ') . ')'; $schema_create .= ' PRIMARY KEY (' . implode($columns, ', ') . ')';
} }
elseif (substr($x,0,6) == 'UNIQUE') elseif (substr($x,0,6) == 'UNIQUE')
{ {
$schema_create .= ' UNIQUE ' . substr($x,7) . ' (' . implode($columns, ', ') . ')'; $schema_create .= ' UNIQUE ' . substr($x,7) . ' (' . implode($columns, ', ') . ')';
} }
else else
{ {
$schema_create .= " KEY $x (" . implode($columns, ', ') . ')'; $schema_create .= " KEY $x (" . implode($columns, ', ') . ')';
@ -434,15 +443,15 @@ function get_table_def_mysql($table, $crlf)
$schema_create .= "$crlf);"; $schema_create .= "$crlf);";
if(get_magic_quotes_runtime()) if(get_magic_quotes_runtime())
{ {
return(stripslashes($schema_create)); return(stripslashes($schema_create));
} }
else else
{ {
return($schema_create); return($schema_create);
} }
} // End get_table_def_mysql } // End get_table_def_mysql
@ -451,7 +460,7 @@ function get_table_def_mysql($table, $crlf)
// statement. // 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... // series of INSERT statements, for each different DBMS...
// After every row a custom callback function $handler gets called. // After every row a custom callback function $handler gets called.
// $handler must accept one parameter ($sql_insert); // $handler must accept one parameter ($sql_insert);
@ -489,7 +498,7 @@ function get_table_content_postgres($table, $handler)
unset($schema_vals); unset($schema_vals);
unset($schema_fields); unset($schema_fields);
unset($schema_insert); unset($schema_insert);
// //
// Build the SQL statement to recreate the data. // Build the SQL statement to recreate the data.
// //
for($i = 0; $i < $i_num_fields; $i++) 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_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"); 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"; $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. // If there is no data for the column set it to null.
// There was a problem here with an extra space causing the // 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 // any table. Should be fixed now :) JLH
// //
$schema_insert .= ' NULL,'; $schema_insert .= ' NULL,';
} }
elseif ($row[$j] != '') elseif ($row[$j] != '')
{ {
$schema_insert .= ' \'' . addslashes($row[$j]) . '\','; $schema_insert .= ' \'' . addslashes($row[$j]) . '\',';
} }
else else
{ {
$schema_insert .= '\'\','; $schema_insert .= '\'\',';
} }
} }
// //
// Get rid of the the last comma. // Get rid of the the last comma.
// //
$schema_insert = ereg_replace(',$', '', $schema_insert); $schema_insert = ereg_replace(',$', '', $schema_insert);
$schema_insert .= ');'; $schema_insert .= ');';
@ -650,14 +659,14 @@ function output_table_content($content)
// //
function remove_remarks($sql) function remove_remarks($sql)
{ {
$i = 0; $i = 0;
while($i < strlen($sql)) while($i < strlen($sql))
{ {
if( $sql[$i] == "#" && ( $sql[$i-1] == "\n" || $i==0 ) ) if( $sql[$i] == "#" && ( $sql[$i-1] == "\n" || $i==0 ) )
{ {
$j = 1; $j = 1;
while( $sql[$i + $j] != "\n" ) while( $sql[$i + $j] != "\n" )
{ {
$j++; $j++;
@ -681,15 +690,15 @@ function split_sql_file($sql, $delimiter)
$last_char = ""; $last_char = "";
$ret = array(); $ret = array();
$in_string = true; $in_string = true;
for($i = 0; $i < strlen($sql); $i++) for($i = 0; $i < strlen($sql); $i++)
{ {
$char = $sql[$i]; $char = $sql[$i];
// //
// if delimiter found, add the parsed part to the returned array // 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); $ret[] = substr($sql, 0, $i);
$sql = substr($sql, $i + 1); $sql = substr($sql, $i + 1);
@ -704,10 +713,10 @@ function split_sql_file($sql, $delimiter)
{ {
$in_string = false; $in_string = false;
} }
if($char == $in_string && $last_char != "\\") if($char == $in_string && $last_char != "\\")
{ {
$in_string = false; $in_string = false;
} }
elseif(!$in_string && ($char == "\"" || $char == "'") && ($last_char != "\\")) elseif(!$in_string && ($char == "\"" || $char == "'") && ($last_char != "\\"))
@ -725,7 +734,7 @@ function split_sql_file($sql, $delimiter)
return($ret); return($ret);
} }
// //
// End Functions // End Functions
// ------------- // -------------
@ -737,7 +746,7 @@ function split_sql_file($sql, $delimiter)
if( isset($HTTP_GET_VARS['perform']) || isset($HTTP_POST_VARS['perform']) ) 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']; $perform = (isset($HTTP_POST_VARS['perform'])) ? $HTTP_POST_VARS['perform'] : $HTTP_GET_VARS['perform'];
switch($perform) switch($perform)
{ {
case 'backup': case 'backup':
@ -764,12 +773,12 @@ if( isset($HTTP_GET_VARS['perform']) || isset($HTTP_POST_VARS['perform']) )
); );
$template->assign_vars(array( $template->assign_vars(array(
"MESSAGE_TITLE" => $lang['Information'], "MESSAGE_TITLE" => $lang['Information'],
"MESSAGE_TEXT" => $lang['Backups_not_supported']) "MESSAGE_TEXT" => $lang['Backups_not_supported'])
); );
$template->pparse("body"); $template->pparse("body");
break; 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 ); $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)) if(ereg(",", $additional_tables))
{ {
@ -810,36 +819,36 @@ if( isset($HTTP_GET_VARS['perform']) || isset($HTTP_POST_VARS['perform']) )
$s_hidden_fields = "<input type=\"hidden\" name=\"perform\" value=\"backup\" /><input type=\"hidden\" name=\"drop\" value=\"1\" /><input type=\"hidden\" name=\"perform\" value=\"$perform\" />"; $s_hidden_fields = "<input type=\"hidden\" name=\"perform\" value=\"backup\" /><input type=\"hidden\" name=\"drop\" value=\"1\" /><input type=\"hidden\" name=\"perform\" value=\"$perform\" />";
$template->assign_vars(array( $template->assign_vars(array(
"L_DATABASE_BACKUP" => $lang['Database_Utilities'] . " : " . $lang['Backup'], "L_DATABASE_BACKUP" => $lang['Database_Utilities'] . " : " . $lang['Backup'],
"L_BACKUP_EXPLAIN" => $lang['Backup_explain'], "L_BACKUP_EXPLAIN" => $lang['Backup_explain'],
"L_FULL_BACKUP" => $lang['Full_backup'], "L_FULL_BACKUP" => $lang['Full_backup'],
"L_STRUCTURE_BACKUP" => $lang['Structure_backup'], "L_STRUCTURE_BACKUP" => $lang['Structure_backup'],
"L_DATA_BACKUP" => $lang['Data_backup'], "L_DATA_BACKUP" => $lang['Data_backup'],
"L_ADDITIONAL_TABLES" => $lang['Additional_tables'], "L_ADDITIONAL_TABLES" => $lang['Additional_tables'],
"L_START_BACKUP" => $lang['Start_backup'], "L_START_BACKUP" => $lang['Start_backup'],
"L_BACKUP_OPTIONS" => $lang['Backup_options'], "L_BACKUP_OPTIONS" => $lang['Backup_options'],
"L_GZIP_COMPRESS" => $lang['Gzip_compress'], "L_GZIP_COMPRESS" => $lang['Gzip_compress'],
"L_NO" => $lang['No'], "L_NO" => $lang['No'],
"L_YES" => $lang['Yes'], "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")) "S_DBUTILS_ACTION" => append_sid("admin_db_utilities.$phpEx"))
); );
$template->pparse("body"); $template->pparse("body");
break; break;
} }
else if( !isset($HTTP_POST_VARS['startdownload']) && !isset($HTTP_GET_VARS['startdownload']) ) else if( !isset($HTTP_POST_VARS['startdownload']) && !isset($HTTP_GET_VARS['startdownload']) )
{ {
$template->set_filenames(array( $template->set_filenames(array(
"body" => "admin/admin_message_body.tpl") "body" => "admin/admin_message_body.tpl")
); );
$template->assign_vars(array(
"META" => "<meta http-equiv=\"refresh\" content=\"0;url=admin_db_utilities.$phpEx?perform=backup&additional_tables=" . quotemeta($additional_tables) . "&backup_type=$backup_type&drop=1&backupstart=1&gzipcompress=$gzipcompress&startdownload=1\">",
"MESSAGE_TITLE" => $lang['Database_Utilities'] . " : " . $lang['Backup'], $template->assign_vars(array(
"META" => "<meta http-equiv=\"refresh\" content=\"0;url=admin_db_utilities.$phpEx?perform=backup&additional_tables=" . quotemeta($additional_tables) . "&backup_type=$backup_type&drop=1&backupstart=1&gzipcompress=$gzipcompress&startdownload=1\">",
"MESSAGE_TITLE" => $lang['Database_Utilities'] . " : " . $lang['Backup'],
"MESSAGE_TEXT" => $lang['Backup_download']) "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 .= "#\n# TABLE: " . $table_prefix . $table_name . "\n#\n";
$backup_sql .= $table_def_function($table_prefix . $table_name, "\n") . "\n"; $backup_sql .= $table_def_function($table_prefix . $table_name, "\n") . "\n";
} }
if($backup_type != 'structure') if($backup_type != 'structure')
{ {
@ -922,9 +931,9 @@ if( isset($HTTP_GET_VARS['perform']) || isset($HTTP_POST_VARS['perform']) )
break; break;
case 'restore': case 'restore':
if(!isset($restore_start)) if(!isset($restore_start))
{ {
// //
// Define Template files... // Define Template files...
// //
include('page_header_admin.'.$phpEx); include('page_header_admin.'.$phpEx);
@ -936,12 +945,12 @@ if( isset($HTTP_GET_VARS['perform']) || isset($HTTP_POST_VARS['perform']) )
$s_hidden_fields = "<input type=\"hidden\" name=\"perform\" value=\"restore\" /><input type=\"hidden\" name=\"perform\" value=\"$perform\" />"; $s_hidden_fields = "<input type=\"hidden\" name=\"perform\" value=\"restore\" /><input type=\"hidden\" name=\"perform\" value=\"$perform\" />";
$template->assign_vars(array( $template->assign_vars(array(
"L_DATABASE_RESTORE" => $lang['Database_Utilities'] . " : " . $lang['Restore'], "L_DATABASE_RESTORE" => $lang['Database_Utilities'] . " : " . $lang['Restore'],
"L_RESTORE_EXPLAIN" => $lang['Restore_explain'], "L_RESTORE_EXPLAIN" => $lang['Restore_explain'],
"L_SELECT_FILE" => $lang['Select_file'], "L_SELECT_FILE" => $lang['Select_file'],
"L_START_RESTORE" => $lang['Start_Restore'], "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) "S_HIDDEN_FIELDS" => $s_hidden_fields)
); );
$template->pparse("body"); $template->pparse("body");
@ -949,8 +958,8 @@ if( isset($HTTP_GET_VARS['perform']) || isset($HTTP_POST_VARS['perform']) )
break; break;
} }
else else
{ {
// //
// Handle the file upload .... // Handle the file upload ....
// If no file was uploaded report an error... // 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']); 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 // are actually passed the name of an uploaded file, and not
// a hackers attempt at getting us to process a local system // a hackers attempt at getting us to process a local system
// file. // file.
@ -1024,7 +1033,7 @@ if( isset($HTTP_GET_VARS['perform']) || isset($HTTP_POST_VARS['perform']) )
$sql_query = trim($sql_query); $sql_query = trim($sql_query);
if($sql_query != "") if($sql_query != "")
{ {
// Strip out sql comments... // Strip out sql comments...
$sql_query = remove_remarks($sql_query); $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]); $sql = trim($pieces[$i]);
if(!empty($sql) and $sql[0] != "#") if(!empty($sql) and $sql[0] != "#")
{ {
if(VERBOSE == 1) if(VERBOSE == 1)
{ {
echo "Executing: $sql\n<br>"; echo "Executing: $sql\n<br>";
flush(); flush();
} }
$result = $db->sql_query($sql); $result = $db->sql_query($sql);
if(!$result && ( !(SQL_LAYER == 'postgres' && eregi("drop table", $sql) ) ) ) if(!$result && ( !(SQL_LAYER == 'postgres' && eregi("drop table", $sql) ) ) )
{ {
include('page_header_admin.'.$phpEx); include('page_header_admin.'.$phpEx);
@ -1060,9 +1069,9 @@ if( isset($HTTP_GET_VARS['perform']) || isset($HTTP_POST_VARS['perform']) )
); );
$message = $lang['Restore_success']; $message = $lang['Restore_success'];
$template->assign_vars(array( $template->assign_vars(array(
"MESSAGE_TITLE" => $lang['Database_Utilities'] . " : " . $lang['Restore'], "MESSAGE_TITLE" => $lang['Database_Utilities'] . " : " . $lang['Restore'],
"MESSAGE_TEXT" => $message) "MESSAGE_TEXT" => $message)
); );
@ -1071,7 +1080,7 @@ if( isset($HTTP_GET_VARS['perform']) || isset($HTTP_POST_VARS['perform']) )
} }
break; break;
} }
} }
include('page_footer_admin.'.$phpEx); include('page_footer_admin.'.$phpEx);

View file

@ -1,17 +1,26 @@
<?php <?php
/*************************************************************************** /***************************************************************************
* admin_forum_prune.php * admin_forum_prune.php
* ------------------- * -------------------
* begin : Mon Jul 31, 2001 * begin : Mon Jul 31, 2001
* copyright : (C) 2001 The phpBB Group * copyright : (C) 2001 The phpBB Group
* email : support@phpbb.com * email : support@phpbb.com
* *
* $Id$ * $Id$
* *
****************************************************************************/ ****************************************************************************/
/*************************************************************************** /***************************************************************************
* This file is for the setup of the auto_pruning and also will allow for *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
***************************************************************************/
/***************************************************************************
* This file is for the setup of the auto_pruning and also will allow for
* immediate forum pruning as well. * immediate forum pruning as well.
***************************************************************************/ ***************************************************************************/
// //
@ -37,13 +46,13 @@ if( $setmodules == 1 )
require('pagestart.inc'); require('pagestart.inc');
include($phpbb_root_path . 'includes/prune.php'); include($phpbb_root_path . 'includes/prune.php');
// //
// Get the forum ID for pruning // Get the forum ID for pruning
// //
if(isset($HTTP_GET_VARS[POST_FORUM_URL]) || isset($HTTP_POST_VARS[POST_FORUM_URL])) 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]; $forum_id = (isset($HTTP_POST_VARS[POST_FORUM_URL])) ? $HTTP_POST_VARS[POST_FORUM_URL] : $HTTP_GET_VARS[POST_FORUM_URL];
if($forum_id == "ALL") if($forum_id == "ALL")
{ {
$forum_sql = ""; $forum_sql = "";
} }
@ -60,10 +69,10 @@ else
// //
// Get a list of forum's or the data for the forum that we are pruning. // Get a list of forum's or the data for the forum that we are pruning.
// //
$sql = "SELECT f.* $sql = "SELECT f.*
FROM " . FORUMS_TABLE . " f, " . CATEGORIES_TABLE . " c FROM " . FORUMS_TABLE . " f, " . CATEGORIES_TABLE . " c
WHERE c.cat_id = f.cat_id WHERE c.cat_id = f.cat_id
$forum_sql $forum_sql
ORDER BY c.cat_order ASC, f.forum_order ASC"; ORDER BY c.cat_order ASC, f.forum_order ASC";
$f_result = $db->sql_query($sql); $f_result = $db->sql_query($sql);
@ -76,7 +85,7 @@ if(isset($HTTP_GET_VARS['submit']) || isset($HTTP_POST_VARS['submit']))
{ {
$submit = (isset($HTTP_POST_VARS['submit'])) ? $HTTP_POST_VARS['submit'] : $HTTP_GET_VARS['submit']; $submit = (isset($HTTP_POST_VARS['submit'])) ? $HTTP_POST_VARS['submit'] : $HTTP_GET_VARS['submit'];
} }
else else
{ {
unset($submit); unset($submit);
} }
@ -115,7 +124,7 @@ if($submit == "Prune")
else 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. // display a select box to use for pruning.
// //
if(empty($forum_id)) if(empty($forum_id))
@ -140,11 +149,11 @@ else
// Assign the template variables. // Assign the template variables.
// //
$template->assign_vars(array( $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) "S_FORUMS_SELECT" => $select_list)
); );
} }
else else
{ {
// //
// Output the form to retrieve Prune information. // Output the form to retrieve Prune information.
@ -152,7 +161,7 @@ else
$template->set_filenames(array( $template->set_filenames(array(
"body" => "admin/forum_prune_body.tpl") "body" => "admin/forum_prune_body.tpl")
); );
$forum_name = ($forum_id == "ALL") ? 'All Forums' : $forum_rows[0]['forum_name']; $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 "; $prune_data = "Prune Topics that haven't been posted to in the last ";

View file

@ -1,15 +1,24 @@
<?php <?php
/*************************************************************************** /***************************************************************************
* admin_forumauth.php * admin_forumauth.php
* ------------------- * -------------------
* begin : Saturday, Feb 13, 2001 * begin : Saturday, Feb 13, 2001
* copyright : (C) 2001 The phpBB Group * copyright : (C) 2001 The phpBB Group
* email : support@phpbb.com * 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) if($setmodules == 1)
{ {
@ -28,13 +37,13 @@ require('pagestart.inc');
// Start program - define vars // Start program - define vars
// //
$simple_auth_ary = array( $simple_auth_ary = array(
0 => array(0, 0, 0, 0, 1, 1, 1, 3), 0 => array(0, 0, 0, 0, 1, 1, 1, 3),
1 => array(0, 0, 1, 1, 1, 1, 1, 3), 1 => array(0, 0, 1, 1, 1, 1, 1, 3),
2 => array(1, 1, 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), 3 => array(0, 2, 2, 2, 2, 2, 2, 3),
4 => array(2, 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), 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'] . "]"); $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 // was
// //
$sql = "SELECT f.* $sql = "SELECT f.*
FROM " . FORUMS_TABLE . " f, " . CATEGORIES_TABLE . " c FROM " . FORUMS_TABLE . " f, " . CATEGORIES_TABLE . " c
WHERE c.cat_id = f.cat_id WHERE c.cat_id = f.cat_id
$forum_sql $forum_sql
ORDER BY c.cat_order ASC, f.forum_order ASC"; ORDER BY c.cat_order ASC, f.forum_order ASC";
$f_result = $db->sql_query($sql); $f_result = $db->sql_query($sql);
@ -171,12 +180,12 @@ if(empty($forum_id))
$select_list .= "</select>"; $select_list .= "</select>";
$template->assign_vars(array( $template->assign_vars(array(
"L_AUTH_TITLE" => $lang['Forum'] . " " . $lang['Auth_Control'], "L_AUTH_TITLE" => $lang['Forum'] . " " . $lang['Auth_Control'],
"L_AUTH_EXPLAIN" => $lang['Forum_auth_explain'], "L_AUTH_EXPLAIN" => $lang['Forum_auth_explain'],
"L_AUTH_SELECT" => $lang['Select_a'] . " " . $lang['Forum'], "L_AUTH_SELECT" => $lang['Select_a'] . " " . $lang['Forum'],
"L_LOOK_UP" => $lang['Look_up'] . " " . $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) "S_AUTH_SELECT" => $select_list)
); );
@ -233,7 +242,7 @@ else
$simple_auth .= $simple_auth_types[$j]; $simple_auth .= $simple_auth_types[$j];
$simple_auth .= "</option>"; $simple_auth .= "</option>";
} }
else else
{ {
$simple_auth .= "<option value=\"$j\">" . $simple_auth_types[$j] . "</option>"; $simple_auth .= "<option value=\"$j\">" . $simple_auth_types[$j] . "</option>";
} }
@ -253,7 +262,7 @@ else
else else
{ {
// //
// Output values of individual // Output values of individual
// fields // fields
// //
for($j = 0; $j < count($forum_auth_fields); $j++) for($j = 0; $j < count($forum_auth_fields); $j++)
@ -268,7 +277,7 @@ else
$custom_auth[$j] .= $forum_auth_levels[$k]; $custom_auth[$j] .= $forum_auth_levels[$k];
$custom_auth[$j] .= "</option>"; $custom_auth[$j] .= "</option>";
} }
else else
{ {
$custom_auth[$j] .= "<option value=\"" . $forum_auth_const[$k] . "\">". $forum_auth_levels[$k] . "</option>"; $custom_auth[$j] .= "<option value=\"" . $forum_auth_const[$k] . "\">". $forum_auth_levels[$k] . "</option>";
} }
@ -296,17 +305,17 @@ else
$s_hidden_fields = '<input type="hidden" name="' . POST_FORUM_URL . '" value="' . $forum_id . '">'; $s_hidden_fields = '<input type="hidden" name="' . POST_FORUM_URL . '" value="' . $forum_id . '">';
$template->assign_vars(array( $template->assign_vars(array(
"FORUM_NAME" => $forum_name, "FORUM_NAME" => $forum_name,
"L_AUTH_TITLE" => $lang['Forum'] . " " . $lang['Auth_Control'], "L_AUTH_TITLE" => $lang['Forum'] . " " . $lang['Auth_Control'],
"L_AUTH_EXPLAIN" => $lang['Forum_auth_explain'], "L_AUTH_EXPLAIN" => $lang['Forum_auth_explain'],
"L_SUBMIT_CHANGES" => $lang['Submit_changes'], "L_SUBMIT_CHANGES" => $lang['Submit_changes'],
"L_RESET_CHANGES" => $lang['Reset_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, "U_SWITCH_MODE" => $u_switch_mode,
"S_COLUMN_SPAN" => $s_column_span, "S_COLUMN_SPAN" => $s_column_span,
"S_HIDDEN_FIELDS" => $s_hidden_fields) "S_HIDDEN_FIELDS" => $s_hidden_fields)
); );

View file

@ -6,11 +6,20 @@
* copyright : (C) 2001 The phpBB Group * copyright : (C) 2001 The phpBB Group
* email : support@phpbb.com * 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) if($setmodules==1)
{ {
$file = basename(__FILE__); $file = basename(__FILE__);
@ -21,11 +30,11 @@ if($setmodules==1)
function check_forum_name($forumname) function check_forum_name($forumname)
{ {
global $db; global $db;
$sql = "SELECT * from " . FORUMS_TABLE . "WHERE forum_name = '$forumname'"; $sql = "SELECT * from " . FORUMS_TABLE . "WHERE forum_name = '$forumname'";
$result = $db->sql_query($sql); $result = $db->sql_query($sql);
if( !$result ) if( !$result )
{ {
message_die(GENERAL_ERROR, "Couldn't get list of Categories", "", __LINE__, __FILE__, $sql); message_die(GENERAL_ERROR, "Couldn't get list of Categories", "", __LINE__, __FILE__, $sql);
} }
if ($db->sql_numrows($result) > 0) if ($db->sql_numrows($result) > 0)
@ -57,7 +66,7 @@ function get_info($mode, $id)
FROM $table FROM $table
WHERE $idfield = $id"; WHERE $idfield = $id";
if( !$result = $db->sql_query($sql) ) if( !$result = $db->sql_query($sql) )
{ {
message_die(GENERAL_ERROR, "Couldn't get Forum/Category information", "", __LINE__, __FILE__, $sql); message_die(GENERAL_ERROR, "Couldn't get Forum/Category information", "", __LINE__, __FILE__, $sql);
} }
if( $db->sql_numrows($result) != 1 ) if( $db->sql_numrows($result) != 1 )
@ -86,14 +95,14 @@ function get_list($mode, $id, $select)
default: default:
message_die(GENERAL_ERROR, "Wrong mode for generating select list", "", __LINE__, __FILE__); message_die(GENERAL_ERROR, "Wrong mode for generating select list", "", __LINE__, __FILE__);
} }
$sql = "SELECT * FROM $table"; $sql = "SELECT * FROM $table";
if( $select == FALSE) if( $select == FALSE)
{ {
$sql .= " WHERE $idfield != '$id'"; $sql .= " WHERE $idfield != '$id'";
} }
if( !$result = $db->sql_query($sql) ) if( !$result = $db->sql_query($sql) )
{ {
message_die(GENERAL_ERROR, "Couldn't get list of Categories/Forums", "", __LINE__, __FILE__, $sql); message_die(GENERAL_ERROR, "Couldn't get list of Categories/Forums", "", __LINE__, __FILE__, $sql);
} }
$cat_list = ""; $cat_list = "";
@ -112,7 +121,7 @@ function get_list($mode, $id, $select)
function renumber_order($mode, $cat=FALSE) function renumber_order($mode, $cat=FALSE)
{ {
global $db; global $db;
switch($mode) switch($mode)
{ {
case 'category': case 'category':
@ -130,7 +139,7 @@ function renumber_order($mode, $cat=FALSE)
default: default:
message_die(GENERAL_ERROR, "Wrong mode for generating select list", "", __LINE__, __FILE__); message_die(GENERAL_ERROR, "Wrong mode for generating select list", "", __LINE__, __FILE__);
} }
$sql = "SELECT * FROM $table"; $sql = "SELECT * FROM $table";
if( $cat != FALSE) if( $cat != FALSE)
{ {
@ -138,24 +147,24 @@ function renumber_order($mode, $cat=FALSE)
} }
$sql .= " ORDER BY $orderfield ASC"; $sql .= " ORDER BY $orderfield ASC";
if( !$result = $db->sql_query($sql) ) if( !$result = $db->sql_query($sql) )
{ {
message_die(GENERAL_ERROR, "Couldn't get list of Categories", "", __LINE__, __FILE__, $sql); message_die(GENERAL_ERROR, "Couldn't get list of Categories", "", __LINE__, __FILE__, $sql);
} }
$i = 10; $i = 10;
$inc = 10; $inc = 10;
while( $row = $db->sql_fetchrow($result) ) while( $row = $db->sql_fetchrow($result) )
{ {
$sql = "UPDATE $table SET $orderfield = $i WHERE $idfield = ".$row["$idfield"]; $sql = "UPDATE $table SET $orderfield = $i WHERE $idfield = ".$row["$idfield"];
if( !$db->sql_query($sql) ) if( !$db->sql_query($sql) )
{ {
message_die(GENERAL_ERROR, "Couldn't update order fields", "", __LINE__, __FILE__, $sql); message_die(GENERAL_ERROR, "Couldn't update order fields", "", __LINE__, __FILE__, $sql);
} }
$i += 10; $i += 10;
} }
} }
// //
@ -185,12 +194,12 @@ if(isset($mode)) // Are we supposed to do something?
$show_index = TRUE; $show_index = TRUE;
break; break;
case 'createforum': // Create a forum in the DB case 'createforum': // Create a forum in the DB
$sql = "SELECT $sql = "SELECT
max(forum_order) as max_order max(forum_order) as max_order
FROM ".FORUMS_TABLE." FROM ".FORUMS_TABLE."
WHERE cat_id = '".$HTTP_POST_VARS['cat_id']."'"; WHERE cat_id = '".$HTTP_POST_VARS['cat_id']."'";
if( !$result = $db->sql_query($sql) ) if( !$result = $db->sql_query($sql) )
{ {
message_die(GENERAL_ERROR, "Couldn't get order number from forums table", "", __LINE__, __FILE__, $sql); message_die(GENERAL_ERROR, "Couldn't get order number from forums table", "", __LINE__, __FILE__, $sql);
} }
$row = $db->sql_fetchrow($result); $row = $db->sql_fetchrow($result);
@ -198,7 +207,7 @@ if(isset($mode)) // Are we supposed to do something?
$next_order = $max_order + 1; $next_order = $max_order + 1;
// There is no problem having duplicate forum names so we won't check for it. // There is no problem having duplicate forum names so we won't check for it.
$sql = "INSERT $sql = "INSERT
INTO ".FORUMS_TABLE."( INTO ".FORUMS_TABLE."(
forum_name, forum_name,
cat_id, cat_id,
@ -212,31 +221,31 @@ if(isset($mode)) // Are we supposed to do something?
'".$next_order."', '".$next_order."',
'".$HTTP_POST_VARS['forumstatus']."')"; '".$HTTP_POST_VARS['forumstatus']."')";
if( !$result = $db->sql_query($sql) ) if( !$result = $db->sql_query($sql) )
{ {
message_die(GENERAL_ERROR, "Couldn't insert row in forums table", "", __LINE__, __FILE__, $sql); message_die(GENERAL_ERROR, "Couldn't insert row in forums table", "", __LINE__, __FILE__, $sql);
} }
$show_index = TRUE; $show_index = TRUE;
break; break;
case 'modforum': // Modify a forum in the DB case 'modforum': // Modify a forum in the DB
$sql = "UPDATE ".FORUMS_TABLE." SET $sql = "UPDATE ".FORUMS_TABLE." SET
forum_name = '".$HTTP_POST_VARS['forumname']."', forum_name = '".$HTTP_POST_VARS['forumname']."',
cat_id = '".$HTTP_POST_VARS['cat_id']."', cat_id = '".$HTTP_POST_VARS['cat_id']."',
forum_desc = '".$HTTP_POST_VARS['forumdesc']."', forum_desc = '".$HTTP_POST_VARS['forumdesc']."',
forum_status = '".$HTTP_POST_VARS['forumstatus']."' forum_status = '".$HTTP_POST_VARS['forumstatus']."'
WHERE forum_id = '".$HTTP_POST_VARS['forum_id']."'"; WHERE forum_id = '".$HTTP_POST_VARS['forum_id']."'";
if( !$result = $db->sql_query($sql) ) if( !$result = $db->sql_query($sql) )
{ {
message_die(GENERAL_ERROR, "Couldn't update forum information", "", __LINE__, __FILE__, $sql); message_die(GENERAL_ERROR, "Couldn't update forum information", "", __LINE__, __FILE__, $sql);
} }
$show_index = TRUE; $show_index = TRUE;
break; break;
case 'addcat': case 'addcat':
$sql = "SELECT $sql = "SELECT
max(cat_order) as max_order max(cat_order) as max_order
FROM ".CATEGORIES_TABLE; FROM ".CATEGORIES_TABLE;
if( !$result = $db->sql_query($sql) ) if( !$result = $db->sql_query($sql) )
{ {
message_die(GENERAL_ERROR, "Couldn't get order number from categories table", "", __LINE__, __FILE__, $sql); message_die(GENERAL_ERROR, "Couldn't get order number from categories table", "", __LINE__, __FILE__, $sql);
} }
$row = $db->sql_fetchrow($result); $row = $db->sql_fetchrow($result);
@ -250,7 +259,7 @@ if(isset($mode)) // Are we supposed to do something?
'".$HTTP_POST_VARS['catname']."', '".$HTTP_POST_VARS['catname']."',
'".$next_order."')"; '".$next_order."')";
if( !$result = $db->sql_query($sql) ) if( !$result = $db->sql_query($sql) )
{ {
message_die(GENERAL_ERROR, "Couldn't insert row in categories table", "", __LINE__, __FILE__, $sql); message_die(GENERAL_ERROR, "Couldn't insert row in categories table", "", __LINE__, __FILE__, $sql);
} }
$show_index = TRUE; $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 determines if we are going to INSERT or UPDATE after posting?
$newmode = 'modforum'; $newmode = 'modforum';
$buttonvalue = 'Change'; $buttonvalue = 'Change';
$forum_id = $HTTP_GET_VARS['forum_id']; $forum_id = $HTTP_GET_VARS['forum_id'];
$row = get_info('forum', $forum_id); $row = get_info('forum', $forum_id);
@ -282,13 +291,13 @@ if(isset($mode)) // Are we supposed to do something?
$forumstatus = FORUM_UNLOCKED; $forumstatus = FORUM_UNLOCKED;
$forum_id = ''; $forum_id = '';
} }
$catlist = get_list('category', $cat_id, TRUE); $catlist = get_list('category', $cat_id, TRUE);
$forumstatus == FORUM_LOCKED ? $forumlocked = "selected" : $forumunlocked = "selected"; $forumstatus == FORUM_LOCKED ? $forumlocked = "selected" : $forumunlocked = "selected";
$statuslist = "<OPTION VALUE=\"".FORUM_UNLOCKED."\" $forumunlocked>Unlocked</OPTION>\n"; $statuslist = "<OPTION VALUE=\"".FORUM_UNLOCKED."\" $forumunlocked>Unlocked</OPTION>\n";
$statuslist .= "<OPTION VALUE=\"".FORUM_LOCKED."\" $forumlocked>Locked</OPTION>\n"; $statuslist .= "<OPTION VALUE=\"".FORUM_LOCKED."\" $forumlocked>Locked</OPTION>\n";
$template->set_filenames(array( $template->set_filenames(array(
"body" => "admin/forum_edit_body.tpl") "body" => "admin/forum_edit_body.tpl")
); );
@ -302,17 +311,17 @@ if(isset($mode)) // Are we supposed to do something?
'BUTTONVALUE' => $buttonvalue) 'BUTTONVALUE' => $buttonvalue)
); );
$template->pparse("body"); $template->pparse("body");
break; break;
case 'editcat': case 'editcat':
$newmode = 'modcat'; $newmode = 'modcat';
$buttonvalue = 'Change'; $buttonvalue = 'Change';
$cat_id = $HTTP_GET_VARS['cat_id']; $cat_id = $HTTP_GET_VARS['cat_id'];
$row = get_info('category', $catid); $row = get_info('category', $catid);
$cat_title = $row['cat_title']; $cat_title = $row['cat_title'];
$template->set_filenames(array( $template->set_filenames(array(
"body" => "admin/category_edit_body.tpl") "body" => "admin/category_edit_body.tpl")
); );
@ -323,14 +332,14 @@ if(isset($mode)) // Are we supposed to do something?
'BUTTONVALUE' => $buttonvalue) 'BUTTONVALUE' => $buttonvalue)
); );
$template->pparse("body"); $template->pparse("body");
break; break;
case 'modcat': case 'modcat':
$sql = "UPDATE ".CATEGORIES_TABLE." SET $sql = "UPDATE ".CATEGORIES_TABLE." SET
cat_title = '".$HTTP_POST_VARS['cat_title']."' cat_title = '".$HTTP_POST_VARS['cat_title']."'
WHERE cat_id = '".$HTTP_POST_VARS['cat_id']."'"; WHERE cat_id = '".$HTTP_POST_VARS['cat_id']."'";
if( !$result = $db->sql_query($sql) ) if( !$result = $db->sql_query($sql) )
{ {
message_die(GENERAL_ERROR, "Couldn't update forum information", "", __LINE__, __FILE__, $sql); message_die(GENERAL_ERROR, "Couldn't update forum information", "", __LINE__, __FILE__, $sql);
} }
print "Modforum: ". $HTTP_POST_VARS['forumname']." sql= <pre>$sql</pre>"; print "Modforum: ". $HTTP_POST_VARS['forumname']." sql= <pre>$sql</pre>";
@ -340,19 +349,19 @@ if(isset($mode)) // Are we supposed to do something?
$from_id = $HTTP_POST_VARS['from_id']; $from_id = $HTTP_POST_VARS['from_id'];
$to_id = $HTTP_POST_VARS['to_id']; $to_id = $HTTP_POST_VARS['to_id'];
$delete_old = $HTTP_POST_VARS['delete_old']; $delete_old = $HTTP_POST_VARS['delete_old'];
print "move '$from_id' to '$to_id'"; print "move '$from_id' to '$to_id'";
$sql = "SELECT * FROM ".FORUMS_TABLE." WHERE forum_id IN ($from_id, $to_id)"; $sql = "SELECT * FROM ".FORUMS_TABLE." WHERE forum_id IN ($from_id, $to_id)";
if( !$result = $db->sql_query($sql) ) if( !$result = $db->sql_query($sql) )
{ {
message_die(GENERAL_ERROR, "Couldn't verify existence of forums", "", __LINE__, __FILE__, $sql); message_die(GENERAL_ERROR, "Couldn't verify existence of forums", "", __LINE__, __FILE__, $sql);
} }
if($db->sql_numrows($result) != 2) if($db->sql_numrows($result) != 2)
{ {
message_die(GENERAL_ERROR, "Ambiguous forum ID's", "", __LINE__, __FILE__); message_die(GENERAL_ERROR, "Ambiguous forum ID's", "", __LINE__, __FILE__);
} }
// Either delete or move all posts in a forum // Either delete or move all posts in a forum
if($delete_old == 1) if($delete_old == 1)
{ {
@ -361,62 +370,62 @@ if(isset($mode)) // Are we supposed to do something?
} }
else else
{ {
$sql = "UPDATE ".TOPICS_TABLE." SET $sql = "UPDATE ".TOPICS_TABLE." SET
forum_id = '$to_id' forum_id = '$to_id'
WHERE forum_id = '$from_id'"; WHERE forum_id = '$from_id'";
if( !$result = $db->sql_query($sql) ) if( !$result = $db->sql_query($sql) )
{ {
message_die(GENERAL_ERROR, "Couldn't move topics to other forum", "", __LINE__, __FILE__, $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' forum_id = '$to_id'
WHERE forum_id = '$from_id'"; WHERE forum_id = '$from_id'";
if( !$result = $db->sql_query($sql) ) if( !$result = $db->sql_query($sql) )
{ {
message_die(GENERAL_ERROR, "Couldn't move posts to other forum", "", __LINE__, __FILE__, $sql); message_die(GENERAL_ERROR, "Couldn't move posts to other forum", "", __LINE__, __FILE__, $sql);
} }
sync('forum', $to_id); sync('forum', $to_id);
} }
$sql = "DELETE FROM ".FORUMS_TABLE." $sql = "DELETE FROM ".FORUMS_TABLE."
WHERE forum_id = '$from_id'"; WHERE forum_id = '$from_id'";
if( !$result = $db->sql_query($sql) ) if( !$result = $db->sql_query($sql) )
{ {
message_die(GENERAL_ERROR, "Couldn't delete forum", "", __LINE__, __FILE__, $sql); message_die(GENERAL_ERROR, "Couldn't delete forum", "", __LINE__, __FILE__, $sql);
} }
$show_index = TRUE; $show_index = TRUE;
break; break;
case 'movedelcat': case 'movedelcat':
$from_id = $HTTP_POST_VARS['from_id']; $from_id = $HTTP_POST_VARS['from_id'];
$to_id = $HTTP_POST_VARS['to_id']; $to_id = $HTTP_POST_VARS['to_id'];
print "move '$from_id' to '$to_id'"; print "move '$from_id' to '$to_id'";
$sql = "SELECT * FROM ".CATEGORIES_TABLE." WHERE cat_id IN ($from_id, $to_id)"; $sql = "SELECT * FROM ".CATEGORIES_TABLE." WHERE cat_id IN ($from_id, $to_id)";
if( !$result = $db->sql_query($sql) ) if( !$result = $db->sql_query($sql) )
{ {
message_die(GENERAL_ERROR, "Couldn't verify existence of categories", "", __LINE__, __FILE__, $sql); message_die(GENERAL_ERROR, "Couldn't verify existence of categories", "", __LINE__, __FILE__, $sql);
} }
if($db->sql_numrows($result) != 2) if($db->sql_numrows($result) != 2)
{ {
message_die(GENERAL_ERROR, "Ambiguous category ID's", "", __LINE__, __FILE__); message_die(GENERAL_ERROR, "Ambiguous category ID's", "", __LINE__, __FILE__);
} }
$sql = "UPDATE ".FORUMS_TABLE." SET $sql = "UPDATE ".FORUMS_TABLE." SET
cat_id = '$to_id' cat_id = '$to_id'
WHERE cat_id = '$from_id'"; WHERE cat_id = '$from_id'";
if( !$result = $db->sql_query($sql) ) if( !$result = $db->sql_query($sql) )
{ {
message_die(GENERAL_ERROR, "Couldn't move forums to other category", "", __LINE__, __FILE__, $sql); message_die(GENERAL_ERROR, "Couldn't move forums to other category", "", __LINE__, __FILE__, $sql);
} }
$sql = "DELETE FROM ".CATEGORIES_TABLE." $sql = "DELETE FROM ".CATEGORIES_TABLE."
WHERE cat_id = '$from_id'"; WHERE cat_id = '$from_id'";
if( !$result = $db->sql_query($sql) ) if( !$result = $db->sql_query($sql) )
{ {
message_die(GENERAL_ERROR, "Couldn't delete category", "", __LINE__, __FILE__, $sql); message_die(GENERAL_ERROR, "Couldn't delete category", "", __LINE__, __FILE__, $sql);
} }
$show_index = TRUE; $show_index = TRUE;
break; break;
case 'deletecat': case 'deletecat':
@ -427,7 +436,7 @@ if(isset($mode)) // Are we supposed to do something?
$newmode = 'movedelcat'; $newmode = 'movedelcat';
$catinfo = get_info('category', $cat_id); $catinfo = get_info('category', $cat_id);
$name = $catinfo['cat_title']; $name = $catinfo['cat_title'];
$template->set_filenames(array( $template->set_filenames(array(
"body" => "admin/forum_delete_body.tpl") "body" => "admin/forum_delete_body.tpl")
); );
@ -449,7 +458,7 @@ if(isset($mode)) // Are we supposed to do something?
$newmode = 'movedelforum'; $newmode = 'movedelforum';
$foruminfo = get_info('forum', $forum_id); $foruminfo = get_info('forum', $forum_id);
$name = $foruminfo['forum_name']; $name = $foruminfo['forum_name'];
$template->set_filenames(array( $template->set_filenames(array(
"body" => "admin/forum_delete_body.tpl") "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']; $cat_id = $HTTP_GET_VARS['cat_id'];
$sql = "UPDATE ".CATEGORIES_TABLE." SET cat_order = cat_order + $move WHERE cat_id = $cat_id"; $sql = "UPDATE ".CATEGORIES_TABLE." SET cat_order = cat_order + $move WHERE cat_id = $cat_id";
if( !$result = $db->sql_query($sql) ) if( !$result = $db->sql_query($sql) )
{ {
message_die(GENERAL_ERROR, "Couldn't change category order", "", __LINE__, __FILE__, $sql); message_die(GENERAL_ERROR, "Couldn't change category order", "", __LINE__, __FILE__, $sql);
} }
renumber_order('category'); renumber_order('category');
@ -479,10 +488,10 @@ if(isset($mode)) // Are we supposed to do something?
$forum_id = $HTTP_GET_VARS['forum_id']; $forum_id = $HTTP_GET_VARS['forum_id'];
$forum_info = get_info('forum', $forum_id); $forum_info = get_info('forum', $forum_id);
$cat_id = $forum_info['cat_id']; $cat_id = $forum_info['cat_id'];
$sql = "UPDATE ".FORUMS_TABLE." SET forum_order = forum_order + $move WHERE forum_id = $forum_id"; $sql = "UPDATE ".FORUMS_TABLE." SET forum_order = forum_order + $move WHERE forum_id = $forum_id";
if( !$result = $db->sql_query($sql) ) if( !$result = $db->sql_query($sql) )
{ {
message_die(GENERAL_ERROR, "Couldn't change category order", "", __LINE__, __FILE__, $sql); message_die(GENERAL_ERROR, "Couldn't change category order", "", __LINE__, __FILE__, $sql);
} }
renumber_order('forum', $forum_info['cat_id']); renumber_order('forum', $forum_info['cat_id']);

View file

@ -1,15 +1,24 @@
<?php <?php
/*************************************************************************** /***************************************************************************
* admin_groupauth.php * admin_groupauth.php
* ------------------- * -------------------
* begin : Saturday, Feb 13, 2001 * begin : Saturday, Feb 13, 2001
* copyright : (C) 2001 The phpBB Group * copyright : (C) 2001 The phpBB Group
* email : support@phpbb.com * 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) if($setmodules == 1)
{ {
@ -30,13 +39,13 @@ require('pagestart.inc');
$forum_auth_fields = array("auth_view", "auth_read", "auth_post", "auth_reply", "auth_edit", "auth_delete", "auth_sticky", "auth_announce"); $forum_auth_fields = array("auth_view", "auth_read", "auth_post", "auth_reply", "auth_edit", "auth_delete", "auth_sticky", "auth_announce");
$auth_field_match = array( $auth_field_match = array(
"auth_view" => AUTH_VIEW, "auth_view" => AUTH_VIEW,
"auth_read" => AUTH_READ, "auth_read" => AUTH_READ,
"auth_post" => AUTH_POST, "auth_post" => AUTH_POST,
"auth_reply" => AUTH_REPLY, "auth_reply" => AUTH_REPLY,
"auth_edit" => AUTH_EDIT, "auth_edit" => AUTH_EDIT,
"auth_delete" => AUTH_DELETE, "auth_delete" => AUTH_DELETE,
"auth_sticky" => AUTH_STICKY, "auth_sticky" => AUTH_STICKY,
"auth_announce" => AUTH_ANNOUNCE); "auth_announce" => AUTH_ANNOUNCE);
$field_names = array( $field_names = array(
@ -64,7 +73,7 @@ function a_auth_check_user($type, $key, $u_auth, $is_admin)
if(!$single_user) if(!$single_user)
{ {
$single_user = $u_ary['group_single_user']; $single_user = $u_ary['group_single_user'];
$result = 0; $result = 0;
switch($type) 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"; $auth_user['single_group'] = ($single_user) ? "single" : "group";
} }
return $auth_user; 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 ... // This is where things become fun ...
// //
// //
// Get list of user id's for this group_id // Get list of user id's for this group_id
// //
$sql_groupid = "SELECT user_id $sql_groupid = "SELECT user_id
FROM " . USER_GROUP_TABLE . " FROM " . USER_GROUP_TABLE . "
WHERE group_id = $group_id WHERE group_id = $group_id
AND user_id <> " . ANONYMOUS; AND user_id <> " . ANONYMOUS;
if(!$result = $db->sql_query($sql_groupid)) 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 // for this user
// //
$sql = "SELECT aa.*, g2.group_single_user, u.username, u.user_id, g.group_id, g.group_name $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 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 WHERE g.group_id = $group_id
AND aa.group_id = g.group_id AND aa.group_id = g.group_id
AND ug.group_id = g.group_id AND ug.group_id = g.group_id
AND ug2.user_id = ug.user_id AND ug2.user_id = ug.user_id
AND u.user_id = ug2.user_id AND u.user_id = ug2.user_id
AND g2.group_id = ug2.group_id AND g2.group_id = ug2.group_id
AND aa2.group_id = g2.group_id"; AND aa2.group_id = g2.group_id";
/* /*
$sql = "SELECT aa.*, g.group_single_user, g.group_id, g.group_name $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 FROM " . AUTH_ACCESS_TABLE . " aa, " . USER_GROUP_TABLE . " ug, " . GROUPS_TABLE. " g
WHERE g.group_id = $group_id WHERE g.group_id = $group_id
AND aa.group_id = g.group_id";*/ AND aa.group_id = g.group_id";*/
$ag_result = $db->sql_query($sql); $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); $g_access = $db->sql_fetchrowset($ag_result);
} }
$sql = "SELECT f.* $sql = "SELECT f.*
FROM " . FORUMS_TABLE . " f, " . CATEGORIES_TABLE . " c FROM " . FORUMS_TABLE . " f, " . CATEGORIES_TABLE . " c
WHERE c.cat_id = f.cat_id WHERE c.cat_id = f.cat_id
ORDER BY c.cat_order ASC, f.forum_order ASC"; ORDER BY c.cat_order ASC, f.forum_order ASC";
$fa_result = $db->sql_query($sql); $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 // The data above lists access and moderator permissions
// for this user given by all the groups they belong to. // for this user given by all the groups they belong to.
// These values must be checked against those requested // 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 // informed of problems. For example, if a group the user
// belongs to already grants the user moderator status // belongs to already grants the user moderator status
// then the user won't have moderator status enabled. // 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 // forum then again, we must warn the admin that giving
// the user access goes against the group permissions // the user access goes against the group permissions
// (although in this case we'll go ahead and add the user) // (although in this case we'll go ahead and add the user)
// //
//
// //
//
// //
$warning_mod_userid = array(); $warning_mod_userid = array();
$warning_mod_username = 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) if($new_mod_status)
{ {
$valid_auth_mod_sql[$this_forum_id] = "UPDATE " . AUTH_ACCESS_TABLE . " $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 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 WHERE forum_id = $this_forum_id
AND group_id = $group_id"; AND group_id = $group_id";
} }
else else
{ {
$valid_auth_mod_sql[$this_forum_id] = "DELETE FROM " . AUTH_ACCESS_TABLE . " $valid_auth_mod_sql[$this_forum_id] = "DELETE FROM " . AUTH_ACCESS_TABLE . "
WHERE forum_id = $this_forum_id WHERE forum_id = $this_forum_id
AND group_id = $group_id"; AND group_id = $group_id";
} }
$update_mod = TRUE; $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) if(!$update_mod && $new_mod_status)
{ {
$valid_auth_mod_sql[$this_forum_id] = "INSERT INTO " . AUTH_ACCESS_TABLE . " $valid_auth_mod_sql[$this_forum_id] = "INSERT INTO " . AUTH_ACCESS_TABLE . "
(forum_id, group_id, auth_mod) (forum_id, group_id, auth_mod)
VALUES ($this_forum_id, $group_id, $new_mod_status)"; VALUES ($this_forum_id, $group_id, $new_mod_status)";
$update_mod = TRUE; $update_mod = TRUE;
} }
@ -363,8 +372,8 @@ if(isset($HTTP_POST_VARS['submit']) && !empty($HTTP_POST_VARS[POST_GROUPS_URL]))
} }
else else
{ {
$valid_auth_prv_sql[$this_forum_id] = "DELETE FROM " . AUTH_ACCESS_TABLE . " $valid_auth_prv_sql[$this_forum_id] = "DELETE FROM " . AUTH_ACCESS_TABLE . "
WHERE forum_id = $this_forum_id WHERE forum_id = $this_forum_id
AND group_id = $group_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( $template->assign_vars(array(
"MESSAGE_TITLE" => $lang['Conflict_warning'], "MESSAGE_TITLE" => $lang['Conflict_warning'],
"MESSAGE_TEXT" => $warning_list) "MESSAGE_TEXT" => $warning_list)
); );
} }
@ -489,11 +498,11 @@ else if(empty($HTTP_GET_VARS[POST_GROUPS_URL]))
// //
// Default user selection box // 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 $sql = "SELECT group_id, group_name
FROM " . GROUPS_TABLE . " FROM " . GROUPS_TABLE . "
WHERE group_single_user <> " . TRUE; WHERE group_single_user <> " . TRUE;
$g_result = $db->sql_query($sql); $g_result = $db->sql_query($sql);
$group_list = $db->sql_fetchrowset($g_result); $group_list = $db->sql_fetchrowset($g_result);
@ -510,12 +519,12 @@ else if(empty($HTTP_GET_VARS[POST_GROUPS_URL]))
); );
$template->assign_vars(array( $template->assign_vars(array(
"L_AUTH_TITLE" => $lang['Group'] . " " . $lang['Auth_Control'], "L_AUTH_TITLE" => $lang['Group'] . " " . $lang['Auth_Control'],
"L_AUTH_EXPLAIN" => $lang['Group_auth_explain'], "L_AUTH_EXPLAIN" => $lang['Group_auth_explain'],
"L_AUTH_SELECT" => $lang['Select_a'] . " " . $lang['Group'], "L_AUTH_SELECT" => $lang['Select_a'] . " " . $lang['Group'],
"L_LOOK_UP" => $lang['Look_up'] . " " . $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) "S_AUTH_SELECT" => $select_list)
); );
@ -539,9 +548,9 @@ else
"body" => "admin/auth_ug_body.tpl") "body" => "admin/auth_ug_body.tpl")
); );
$sql = "SELECT f.* $sql = "SELECT f.*
FROM " . FORUMS_TABLE . " f, " . CATEGORIES_TABLE . " c FROM " . FORUMS_TABLE . " f, " . CATEGORIES_TABLE . " c
WHERE c.cat_id = f.cat_id WHERE c.cat_id = f.cat_id
ORDER BY c.cat_order ASC, f.forum_order ASC"; ORDER BY c.cat_order ASC, f.forum_order ASC";
$fa_result = $db->sql_query($sql); $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 $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 FROM " . USERS_TABLE . " u, " . GROUPS_TABLE . " g, " . USER_GROUP_TABLE . " ug
WHERE g.group_id = $group_id WHERE g.group_id = $group_id
AND ug.group_id = g.group_id AND ug.group_id = g.group_id
AND u.user_id = ug.user_id"; AND u.user_id = ug.user_id";
$g_result = $db->sql_query($sql); $g_result = $db->sql_query($sql);
$groupinf = $db->sql_fetchrowset($g_result); $groupinf = $db->sql_fetchrowset($g_result);
$sql = "SELECT aa.* $sql = "SELECT aa.*
FROM " . AUTH_ACCESS_TABLE . " aa, " . GROUPS_TABLE. " g FROM " . AUTH_ACCESS_TABLE . " aa, " . GROUPS_TABLE. " g
WHERE g.group_id = $group_id WHERE g.group_id = $group_id
AND aa.group_id = g.group_id AND aa.group_id = g.group_id
AND g.group_single_user = 0"; AND g.group_single_user = 0";
$ag_result = $db->sql_query($sql); $ag_result = $db->sql_query($sql);
@ -625,7 +634,7 @@ else
$auth_group[$f_forum_id][$key] = 0; $auth_group[$f_forum_id][$key] = 0;
} }
break; break;
case AUTH_MOD: case AUTH_MOD:
if($num_forum_access[$f_forum_id]) if($num_forum_access[$f_forum_id])
{ {
@ -761,12 +770,12 @@ else
$row_color = "#" . ( ( !($i%2) ) ? $theme['td_color1'] : $theme['td_color2'] ); $row_color = "#" . ( ( !($i%2) ) ? $theme['td_color1'] : $theme['td_color2'] );
$template->assign_block_vars("forums", array( $template->assign_block_vars("forums", array(
"ROW_COLOR" => $row_color, "ROW_COLOR" => $row_color,
"ROW_CLASS" => $row_class, "ROW_CLASS" => $row_class,
"FORUM_NAME" => $forum_access[$i]['forum_name'], "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) "S_MOD_SELECT" => $optionlist_mod)
); );
@ -837,29 +846,29 @@ else
$s_column_span++; $s_column_span++;
} }
} }
$switch_mode = "admin_groupauth.$phpEx?" . POST_GROUPS_URL . "=" . $group_id . "&adv="; $switch_mode = "admin_groupauth.$phpEx?" . POST_GROUPS_URL . "=" . $group_id . "&adv=";
$switch_mode .= ( !$adv ) ? "1" : "0"; $switch_mode .= ( !$adv ) ? "1" : "0";
$switch_mode_text = ( !$adv ) ? $lang['Advanced_mode'] : $lang['Simple_mode']; $switch_mode_text = ( !$adv ) ? $lang['Advanced_mode'] : $lang['Simple_mode'];
$u_switch_mode = '<a href="' . $switch_mode . '">' . $switch_mode_text . '</a>'; $u_switch_mode = '<a href="' . $switch_mode . '">' . $switch_mode_text . '</a>';
$template->assign_vars(array( $template->assign_vars(array(
"USERNAME" => $t_groupname, "USERNAME" => $t_groupname,
"USER_GROUP_MEMBERSHIPS" => $lang['Group_has_members'] . ": " . $t_usergroup_list, "USER_GROUP_MEMBERSHIPS" => $lang['Group_has_members'] . ": " . $t_usergroup_list,
"L_USER_OR_GROUPNAME" => $lang['Group_name'], "L_USER_OR_GROUPNAME" => $lang['Group_name'],
"L_AUTH_TITLE" => $lang['Group'] . " " . $lang['Auth_Control'], "L_AUTH_TITLE" => $lang['Group'] . " " . $lang['Auth_Control'],
"L_AUTH_EXPLAIN" => $lang['User_auth_explain'], "L_AUTH_EXPLAIN" => $lang['User_auth_explain'],
"L_MODERATOR_STATUS" => $lang['Moderator_status'], "L_MODERATOR_STATUS" => $lang['Moderator_status'],
"L_PERMISSIONS" => $lang['Permissions'], "L_PERMISSIONS" => $lang['Permissions'],
"L_SUBMIT_CHANGES" => $lang['Submit_changes'], "L_SUBMIT_CHANGES" => $lang['Submit_changes'],
"L_RESET_CHANGES" => $lang['Reset_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, "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_AUTH_ACTION" => append_sid("admin_groupauth.$phpEx"),
"S_HIDDEN_FIELDS" => $s_hidden_fields) "S_HIDDEN_FIELDS" => $s_hidden_fields)
); );

View file

@ -1,15 +1,24 @@
<?php <?php
/*************************************************************************** /***************************************************************************
* admin_groups.php * admin_groups.php
* ------------------- * -------------------
* begin : Saturday, Feb 13, 2001 * begin : Saturday, Feb 13, 2001
* copyright : (C) 2001 The phpBB Group * copyright : (C) 2001 The phpBB Group
* email : support@phpbb.com * 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) if($setmodules == 1)
{ {
@ -56,7 +65,7 @@ if( (isset($HTTP_POST_VARS['mode']) || isset($HTTP_GET_VARS['mode'])) && empty($
// They're editing. Grab the vars. // They're editing. Grab the vars.
// //
$sql = "SELECT * $sql = "SELECT *
FROM " . GROUPS_TABLE . " FROM " . GROUPS_TABLE . "
WHERE group_single_user <> " . TRUE . " WHERE group_single_user <> " . TRUE . "
AND group_id = " . $g; AND group_id = " . $g;
if(!$result = $db->sql_query($sql)) 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. // Ok, now we know everything about them, let's show the page.
// //
$sql = "SELECT user_id, username $sql = "SELECT user_id, username
FROM " . USERS_TABLE . " FROM " . USERS_TABLE . "
WHERE user_id <> " . ANONYMOUS . " WHERE user_id <> " . ANONYMOUS . "
ORDER BY username"; ORDER BY username";
$u_result = $db->sql_query($sql); $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\""; $group_closed = "checked=\"checked\"";
} }
$template->assign_vars(array( $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_NAME" => $lang['group_name'],
"L_GROUP_DESCRIPTION" => $lang['group_description'], "L_GROUP_DESCRIPTION" => $lang['group_description'],
"L_GROUP_MODERATOR" => $lang['group_moderator'], "L_GROUP_MODERATOR" => $lang['group_moderator'],
@ -159,7 +168,7 @@ else if( $HTTP_POST_VARS['updategroup'] == "update" )
group_moderator = '" . $group_moderator . "' group_moderator = '" . $group_moderator . "'
WHERE group_id = '" . $group_id . "'"; WHERE group_id = '" . $group_id . "'";
break; break;
case 'newgroup': case 'newgroup':
$sql = "INSERT INTO " . GROUPS_TABLE . " $sql = "INSERT INTO " . GROUPS_TABLE . "
( (
@ -177,9 +186,9 @@ else if( $HTTP_POST_VARS['updategroup'] == "update" )
'" . $group_moderator . "', '" . $group_moderator . "',
'0' '0'
)"; )";
break; break;
case 'default': case 'default':
message_die(GENERAL_ERROR, $lang['Group_mode_not_selected']); message_die(GENERAL_ERROR, $lang['Group_mode_not_selected']);
break; break;
@ -228,8 +237,8 @@ else
{ {
include("page_header_admin." . $phpEx); include("page_header_admin." . $phpEx);
$sql = "SELECT group_id, group_name $sql = "SELECT group_id, group_name
FROM " . GROUPS_TABLE . " FROM " . GROUPS_TABLE . "
WHERE group_single_user <> " . TRUE . " WHERE group_single_user <> " . TRUE . "
ORDER BY group_name"; ORDER BY group_name";
$g_result = $db->sql_query($sql); $g_result = $db->sql_query($sql);
@ -248,12 +257,12 @@ else
$template->assign_vars(array( $template->assign_vars(array(
"L_GROUP_TITLE" => $lang['Group'] . " " . $lang['Admin'], "L_GROUP_TITLE" => $lang['Group'] . " " . $lang['Admin'],
"L_GROUP_EXPLAIN" => $lang['Group_admin_explain'], "L_GROUP_EXPLAIN" => $lang['Group_admin_explain'],
"L_GROUP_SELECT" => $lang['Select_a'] . " " . $lang['Group'], "L_GROUP_SELECT" => $lang['Select_a'] . " " . $lang['Group'],
"L_LOOK_UP" => $lang['Look_up'] . " " . $lang['Group'], "L_LOOK_UP" => $lang['Look_up'] . " " . $lang['Group'],
"L_GROUP_NEW" => $lang['New_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) "S_GROUP_SELECT" => $select_list)
); );

View file

@ -1,15 +1,24 @@
<?php <?php
/*************************************************************************** /***************************************************************************
* admin_smilies.php * admin_smilies.php
* ------------------- * -------------------
* begin : Thu May 31, 2001 * begin : Thu May 31, 2001
* copyright : (C) 2001 The phpBB Group * copyright : (C) 2001 The phpBB Group
* email : support@phpbb.com * 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.
*
***************************************************************************/
/************************************************************************** /**************************************************************************
* This file will be used for modifying the smiley settings for a board. * This file will be used for modifying the smiley settings for a board.
**************************************************************************/ **************************************************************************/
@ -26,9 +35,9 @@ if($setmodules == 1)
} }
// //
// Include required files register $phpEx, and check permisions // Include required files register $phpEx, and check permisions
// //
require('pagestart.inc'); require('pagestart.inc');
// //
// Check to see what mode we should operate in. // Check to see what mode we should operate in.
@ -55,7 +64,7 @@ switch($mode)
// Get the data that should be passed. // Get the data that should be passed.
// //
$smiley_id = ($HTTP_GET_VARS['id']) ? $HTTP_GET_VARS['id']: $HTTP_POST_VARS['id']; $smiley_id = ($HTTP_GET_VARS['id']) ? $HTTP_GET_VARS['id']: $HTTP_POST_VARS['id'];
$sql = 'DELETE FROM ' . SMILIES_TABLE . ' $sql = 'DELETE FROM ' . SMILIES_TABLE . '
WHERE smilies_id = ' . $smiley_id; WHERE smilies_id = ' . $smiley_id;
$result = $db->sql_query($sql); $result = $db->sql_query($sql);
if( !$result ) if( !$result )
@ -84,8 +93,8 @@ switch($mode)
// Get the data for the selected smiley. // Get the data for the selected smiley.
// //
$smiley_id = ($HTTP_GET_VARS['id']) ? $HTTP_GET_VARS['id']: $HTTP_POST_VARS['id']; $smiley_id = ($HTTP_GET_VARS['id']) ? $HTTP_GET_VARS['id']: $HTTP_POST_VARS['id'];
$sql = 'SELECT * $sql = 'SELECT *
FROM ' . SMILIES_TABLE . ' FROM ' . SMILIES_TABLE . '
WHERE smilies_id = ' . $smiley_id; WHERE smilies_id = ' . $smiley_id;
$result = $db->sql_query($sql); $result = $db->sql_query($sql);
if( !$result ) if( !$result )
@ -116,7 +125,7 @@ switch($mode)
{ {
$smiley_selected = ($smiley_images[$i] == $smile_data['smile_url']) ? "SELECTED" : ""; $smiley_selected = ($smiley_images[$i] == $smile_data['smile_url']) ? "SELECTED" : "";
$template->assign_block_vars("smile_images", array( $template->assign_block_vars("smile_images", array(
"FILENAME" => $smiley_images[$i], "FILENAME" => $smiley_images[$i],
"SELECTED" => $smiley_selected) "SELECTED" => $smiley_selected)
); );
} }
@ -175,18 +184,18 @@ switch($mode)
// //
// Proceed with updating the smiley table. // Proceed with updating the smiley table.
// //
$sql = 'UPDATE ' . SMILIES_TABLE . " $sql = 'UPDATE ' . SMILIES_TABLE . "
SET code='$smile_code', smile_url='$smile_url', emoticon='$smile_emotion' SET code='$smile_code', smile_url='$smile_url', emoticon='$smile_emotion'
WHERE smilies_id = $smile_id"; WHERE smilies_id = $smile_id";
$result = $db->sql_query($sql); $result = $db->sql_query($sql);
if( !$result ) if( !$result )
{ {
message_die(GENERAL_ERROR, $lang['smile_edit_err'], "", __LINE__, __FILE__, $sql); message_die(GENERAL_ERROR, $lang['smile_edit_err'], "", __LINE__, __FILE__, $sql);
} }
$template->set_filenames(array( $template->set_filenames(array(
"body" => "admin/smile_action.tpl") "body" => "admin/smile_action.tpl")
); );
$template->assign_vars(array( $template->assign_vars(array(
"S_SMILEY_URL" => append_sid("admin_smilies.$phpEx"), "S_SMILEY_URL" => append_sid("admin_smilies.$phpEx"),
"L_SMILEY_TITLE" => $lang['smiley_title'], "L_SMILEY_TITLE" => $lang['smiley_title'],
@ -213,7 +222,7 @@ switch($mode)
// //
// Save the data to the smiley table. // 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')"; VALUES ('$smile_code', '$smile_url', '$smile_emotion')";
$result = $db->sql_query($sql); $result = $db->sql_query($sql);
if( !$result ) if( !$result )
@ -242,11 +251,11 @@ switch($mode)
// //
// Get a listing of smileys. // Get a listing of smileys.
// //
$sql = 'SELECT * $sql = 'SELECT *
FROM ' . SMILIES_TABLE; FROM ' . SMILIES_TABLE;
$result = $db->sql_query($sql); $result = $db->sql_query($sql);
if( !$result ) if( !$result )
{ {
message_die(GENERAL_ERROR, $lang['smile_load_err'], "", __LINE__, __FILE__, $sql); message_die(GENERAL_ERROR, $lang['smile_load_err'], "", __LINE__, __FILE__, $sql);
} }
$smilies = $db->sql_fetchrowset($result); $smilies = $db->sql_fetchrowset($result);
@ -260,7 +269,7 @@ switch($mode)
$my_path = append_sid("admin_smilies.$phpEx"); $my_path = append_sid("admin_smilies.$phpEx");
if(!ereg('\?', $my_path)) if(!ereg('\?', $my_path))
{ {
$my_path .= '?'; $my_path .= '?';
} }
$template->assign_vars(array( $template->assign_vars(array(
"S_SMILEY_URL" => $my_path, "S_SMILEY_URL" => $my_path,

View file

@ -1,15 +1,24 @@
<?php <?php
/*************************************************************************** /***************************************************************************
* admin_user_ban.php * admin_user_ban.php
* ------------------- * -------------------
* begin : Tuesday, Jul 31, 2001 * begin : Tuesday, Jul 31, 2001
* copyright : (C) 2001 The phpBB Group * copyright : (C) 2001 The phpBB Group
* email : support@phpbb.com * 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) if($setmodules == 1)
{ {
@ -143,7 +152,7 @@ if( isset($HTTP_POST_VARS['submit']) && isset($HTTP_POST_VARS['bancontrol']) )
for($i = 0; $i < count($email_list_temp); $i++) for($i = 0; $i < count($email_list_temp); $i++)
{ {
// //
// This ereg match is based on one by php@unreelpro.com // This ereg match is based on one by php@unreelpro.com
// contained in the annotated php manual at php.com (ereg // contained in the annotated php manual at php.com (ereg
// section) // section)
// //
@ -154,7 +163,7 @@ if( isset($HTTP_POST_VARS['submit']) && isset($HTTP_POST_VARS['bancontrol']) )
} }
} }
$sql = "SELECT * $sql = "SELECT *
FROM " . BANLIST_TABLE; FROM " . BANLIST_TABLE;
if( !$result = $db->sql_query($sql) ) if( !$result = $db->sql_query($sql) )
{ {
@ -179,7 +188,7 @@ if( isset($HTTP_POST_VARS['submit']) && isset($HTTP_POST_VARS['bancontrol']) )
{ {
$kill_session_sql .= ( ($kill_session_sql != "") ? " OR " : "" ) . "session_user_id = $user_list[$i]"; $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] . "')"; VALUES ('" . $user_list[$i] . "')";
if( !$result = $db->sql_query($sql) ) 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; $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] . "')"; VALUES ('" . $ip_list[$i] . "')";
if( !$result = $db->sql_query($sql) ) 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 // session table with any of the banned
// user or IP info just entered into the // user or IP info just entered into the
// ban table ... this will force a session // 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 != "") if($kill_session_sql != "")
{ {
$sql = "DELETE FROM " . SESSIONS_TABLE . " $sql = "DELETE FROM " . SESSIONS_TABLE . "
WHERE $kill_session_sql"; WHERE $kill_session_sql";
if( !$result = $db->sql_query($sql) ) if( !$result = $db->sql_query($sql) )
{ {
message_die(GENERAL_ERROR, "Couldn't delete banned sessions from database", "", __LINE__, __FILE__, $sql); message_die(GENERAL_ERROR, "Couldn't delete banned sessions from database", "", __LINE__, __FILE__, $sql);
} }
} }
for($i = 0; $i < count($email_list); $i++) for($i = 0; $i < count($email_list); $i++)
{ {
$in_banlist = false; $in_banlist = false;
@ -252,7 +261,7 @@ if( isset($HTTP_POST_VARS['submit']) && isset($HTTP_POST_VARS['bancontrol']) )
if(!$in_banlist) if(!$in_banlist)
{ {
$sql = "INSERT INTO " . BANLIST_TABLE . " (ban_email) $sql = "INSERT INTO " . BANLIST_TABLE . " (ban_email)
VALUES ('" . $email_list[$i] . "')"; VALUES ('" . $email_list[$i] . "')";
if( !$result = $db->sql_query($sql) ) if( !$result = $db->sql_query($sql) )
{ {
@ -319,7 +328,7 @@ if( isset($HTTP_POST_VARS['submit']) && isset($HTTP_POST_VARS['bancontrol']) )
if($where_sql != "") if($where_sql != "")
{ {
$sql = "DELETE FROM " . BANLIST_TABLE . " $sql = "DELETE FROM " . BANLIST_TABLE . "
WHERE $where_sql"; WHERE $where_sql";
if( !$result = $db->sql_query($sql) ) if( !$result = $db->sql_query($sql) )
{ {
@ -336,8 +345,8 @@ else
{ {
$userban_count = 0; $userban_count = 0;
$sql = "SELECT user_id, username $sql = "SELECT user_id, username
FROM " . USERS_TABLE . " FROM " . USERS_TABLE . "
WHERE user_id <> " . ANONYMOUS . " WHERE user_id <> " . ANONYMOUS . "
ORDER BY user_id ASC"; ORDER BY user_id ASC";
$u_result = $db->sql_query($sql); $u_result = $db->sql_query($sql);
@ -358,22 +367,22 @@ else
$s_hidden_fields = "<input type=\"hidden\" name=\"bancontrol\" value=\"ban\" />"; $s_hidden_fields = "<input type=\"hidden\" name=\"bancontrol\" value=\"ban\" />";
$template->assign_vars(array( $template->assign_vars(array(
"L_BAN_TITLE" => $lang['Ban_control'], "L_BAN_TITLE" => $lang['Ban_control'],
"L_BAN_EXPLAIN" => $lang['Ban_explain'], "L_BAN_EXPLAIN" => $lang['Ban_explain'],
"L_BAN_EXPLAIN_WARN" => $lang['Ban_explain_warn'], "L_BAN_EXPLAIN_WARN" => $lang['Ban_explain_warn'],
"L_BAN_USER" => $lang['Ban_username'], "L_BAN_USER" => $lang['Ban_username'],
"L_BAN_USER_EXPLAIN" => $lang['Ban_username_explain'], "L_BAN_USER_EXPLAIN" => $lang['Ban_username_explain'],
"L_BAN_IP" => $lang['Ban_IP'], "L_BAN_IP" => $lang['Ban_IP'],
"L_IP_OR_HOSTNAME" => $lang['IP_hostname'], "L_IP_OR_HOSTNAME" => $lang['IP_hostname'],
"L_BAN_IP_EXPLAIN" => $lang['Ban_IP_explain'], "L_BAN_IP_EXPLAIN" => $lang['Ban_IP_explain'],
"L_BAN_EMAIL" => $lang['Ban_email'], "L_BAN_EMAIL" => $lang['Ban_email'],
"L_EMAIL_ADDRESS" => $lang['Email_address'], "L_EMAIL_ADDRESS" => $lang['Email_address'],
"L_BAN_EMAIL_EXPLAIN" => $lang['Ban_email_explain'], "L_BAN_EMAIL_EXPLAIN" => $lang['Ban_email_explain'],
"L_SUBMIT" => $lang['Submit'], "L_SUBMIT" => $lang['Submit'],
"L_RESET" => $lang['Reset'], "L_RESET" => $lang['Reset'],
"S_USERLIST_SELECT" => $select_userlist, "S_USERLIST_SELECT" => $select_userlist,
"S_HIDDEN_FIELDS" => $s_hidden_fields, "S_HIDDEN_FIELDS" => $s_hidden_fields,
"S_BAN_ACTION" => append_sid("admin_user_ban.$phpEx")) "S_BAN_ACTION" => append_sid("admin_user_ban.$phpEx"))
); );
} }
@ -383,10 +392,10 @@ else
$ipban_count = 0; $ipban_count = 0;
$emailban_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 FROM " . BANLIST_TABLE . " b, " . USERS_TABLE . " u
WHERE u.user_id = b.ban_userid WHERE u.user_id = b.ban_userid
AND b.ban_userid <> 0 AND b.ban_userid <> 0
AND u.user_id <> " . ANONYMOUS . " AND u.user_id <> " . ANONYMOUS . "
ORDER BY u.user_id ASC"; ORDER BY u.user_id ASC";
$u_result = $db->sql_query($sql); $u_result = $db->sql_query($sql);
@ -411,7 +420,7 @@ else
$select_userlist = "<select name=\"user[]\"" . ( ($userban_count > 1) ? "multiple=\"multiple\" size=\"" . min(5, $userban_count) . "\">" : ">" ) . $select_userlist; $select_userlist = "<select name=\"user[]\"" . ( ($userban_count > 1) ? "multiple=\"multiple\" size=\"" . min(5, $userban_count) . "\">" : ">" ) . $select_userlist;
$select_userlist .= "</select>"; $select_userlist .= "</select>";
$sql = "SELECT ban_id, ban_ip, ban_email $sql = "SELECT ban_id, ban_ip, ban_email
FROM " . BANLIST_TABLE; FROM " . BANLIST_TABLE;
$b_result = $db->sql_query($sql); $b_result = $db->sql_query($sql);
$banlist = $db->sql_fetchrowset($b_result); $banlist = $db->sql_fetchrowset($b_result);
@ -465,23 +474,23 @@ else
$s_hidden_fields = "<input type=\"hidden\" name=\"bancontrol\" value=\"unban\" />"; $s_hidden_fields = "<input type=\"hidden\" name=\"bancontrol\" value=\"unban\" />";
$template->assign_vars(array( $template->assign_vars(array(
"L_BAN_TITLE" => $lang['Ban_control'], "L_BAN_TITLE" => $lang['Ban_control'],
"L_BAN_EXPLAIN" => $lang['Ban_explain'], "L_BAN_EXPLAIN" => $lang['Ban_explain'],
"L_BAN_USER" => $lang['Unban_username'], "L_BAN_USER" => $lang['Unban_username'],
"L_BAN_USER_EXPLAIN" => $lang['Unban_username_explain'], "L_BAN_USER_EXPLAIN" => $lang['Unban_username_explain'],
"L_BAN_IP" => $lang['Unban_IP'], "L_BAN_IP" => $lang['Unban_IP'],
"L_IP_OR_HOSTNAME" => $lang['IP_hostname'], "L_IP_OR_HOSTNAME" => $lang['IP_hostname'],
"L_BAN_IP_EXPLAIN" => $lang['Unban_IP_explain'], "L_BAN_IP_EXPLAIN" => $lang['Unban_IP_explain'],
"L_BAN_EMAIL" => $lang['Unban_email'], "L_BAN_EMAIL" => $lang['Unban_email'],
"L_EMAIL_ADDRESS" => $lang['Email_address'], "L_EMAIL_ADDRESS" => $lang['Email_address'],
"L_BAN_EMAIL_EXPLAIN" => $lang['Unban_email_explain'], "L_BAN_EMAIL_EXPLAIN" => $lang['Unban_email_explain'],
"L_SUBMIT" => $lang['Submit'], "L_SUBMIT" => $lang['Submit'],
"L_RESET" => $lang['Reset'], "L_RESET" => $lang['Reset'],
"S_USERLIST_SELECT" => $select_userlist, "S_USERLIST_SELECT" => $select_userlist,
"S_IPLIST_SELECT" => $select_iplist, "S_IPLIST_SELECT" => $select_iplist,
"S_EMAILLIST_SELECT" => $select_emaillist, "S_EMAILLIST_SELECT" => $select_emaillist,
"S_HIDDEN_FIELDS" => $s_hidden_fields, "S_HIDDEN_FIELDS" => $s_hidden_fields,
"S_BAN_ACTION" => append_sid("admin_user_ban.$phpEx")) "S_BAN_ACTION" => append_sid("admin_user_ban.$phpEx"))
); );

View file

@ -1,15 +1,24 @@
<?php <?php
/*************************************************************************** /***************************************************************************
* admin_userauth.php * admin_userauth.php
* ------------------- * -------------------
* begin : Saturday, Feb 13, 2001 * begin : Saturday, Feb 13, 2001
* copyright : (C) 2001 The phpBB Group * copyright : (C) 2001 The phpBB Group
* email : support@phpbb.com * 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) if($setmodules == 1)
{ {
@ -46,13 +55,13 @@ else if( $userdata['user_level'] != ADMIN )
$forum_auth_fields = array("auth_view", "auth_read", "auth_post", "auth_reply", "auth_edit", "auth_delete", "auth_sticky", "auth_announce"); $forum_auth_fields = array("auth_view", "auth_read", "auth_post", "auth_reply", "auth_edit", "auth_delete", "auth_sticky", "auth_announce");
$auth_field_match = array( $auth_field_match = array(
"auth_view" => AUTH_VIEW, "auth_view" => AUTH_VIEW,
"auth_read" => AUTH_READ, "auth_read" => AUTH_READ,
"auth_post" => AUTH_POST, "auth_post" => AUTH_POST,
"auth_reply" => AUTH_REPLY, "auth_reply" => AUTH_REPLY,
"auth_edit" => AUTH_EDIT, "auth_edit" => AUTH_EDIT,
"auth_delete" => AUTH_DELETE, "auth_delete" => AUTH_DELETE,
"auth_sticky" => AUTH_STICKY, "auth_sticky" => AUTH_STICKY,
"auth_announce" => AUTH_ANNOUNCE); "auth_announce" => AUTH_ANNOUNCE);
$field_names = array( $field_names = array(
@ -79,7 +88,7 @@ function a_auth_check_user($type, $key, $u_auth, $is_admin)
if(!$single_user) if(!$single_user)
{ {
$single_user = $u_ary['group_single_user']; $single_user = $u_ary['group_single_user'];
$result = 0; $result = 0;
switch($type) 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"; $auth_user['single_group'] = ($single_user) ? "single" : "group";
} }
return $auth_user; 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 ... // This is where things become fun ...
// //
// //
// Get group_id for this user_id // Get group_id for this user_id
// //
$sql_groupid = "SELECT ug.group_id, u.user_level $sql_groupid = "SELECT ug.group_id, u.user_level
FROM " . USER_GROUP_TABLE . " ug, " . USERS_TABLE . " u, " . GROUPS_TABLE . " g FROM " . USER_GROUP_TABLE . " ug, " . USERS_TABLE . " u, " . GROUPS_TABLE . " g
WHERE u.user_id = $user_id WHERE u.user_id = $user_id
AND ug.user_id = u.user_id AND ug.user_id = u.user_id
AND g.group_id = ug.group_id AND g.group_id = ug.group_id
AND g.group_single_user = " . TRUE; AND g.group_single_user = " . TRUE;
if(!$result = $db->sql_query($sql_groupid)) 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 // Delete any entries granting in auth_access
// //
$sql = "UPDATE " . AUTH_ACCESS_TABLE . " $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 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']; WHERE group_id = " . $ug_info['group_id'];
if(!$result = $db->sql_query($sql)) if(!$result = $db->sql_query($sql))
{ {
// Error ... // Error ...
} }
// //
// Update users level, reset to USER // Update users level, reset to USER
// //
$sql = "UPDATE " . USERS_TABLE . " $sql = "UPDATE " . USERS_TABLE . "
SET user_level = " . USER . " SET user_level = " . USER . "
WHERE user_id = $user_id"; WHERE user_id = $user_id";
if(!$result = $db->sql_query($sql)) if(!$result = $db->sql_query($sql))
{ {
// Error ... // Error ...
} }
} }
header("Location: admin_userauth.$phpEx?" . POST_USERS_URL . "=$user_id"); 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) // Make user an admin (if already user)
// //
$sql_userlevel = "UPDATE " . USERS_TABLE . " $sql_userlevel = "UPDATE " . USERS_TABLE . "
SET user_level = " . ADMIN . " SET user_level = " . ADMIN . "
WHERE user_id = $user_id"; WHERE user_id = $user_id";
if(!$result = $db->sql_query($sql_userlevel)) if(!$result = $db->sql_query($sql_userlevel))
{ {
// Error ... // Error ...
} }
// Delete any entries in auth_access, they // Delete any entries in auth_access, they
// are unrequired if user is becoming an // are unrequired if user is becoming an
// admin // admin
// //
$sql_unmod = "UPDATE " . AUTH_ACCESS_TABLE . " $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 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']; WHERE group_id = " . $ug_info['group_id'];
if(!$result = $db->sql_query($sql_unmod)) if(!$result = $db->sql_query($sql_unmod))
{ {
// Error ... // Error ...
} }
$sql_unauth = "DELETE FROM " . AUTH_ACCESS_TABLE . " $sql_unauth = "DELETE FROM " . AUTH_ACCESS_TABLE . "
WHERE group_id = $group_id WHERE group_id = $group_id
AND auth_mod = 0"; AND auth_mod = 0";
if(!$result = $db->sql_query($sql_unauth)) 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 else
{ {
// //
// Pull all the auth/group // Pull all the auth/group
// for this user // 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 $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 FROM " . AUTH_ACCESS_TABLE . " aa, " . USER_GROUP_TABLE . " ug, " . GROUPS_TABLE. " g
WHERE ug.user_id = $user_id WHERE ug.user_id = $user_id
AND g.group_id = ug.group_id AND g.group_id = ug.group_id
AND aa.group_id = ug.group_id"; AND aa.group_id = ug.group_id";
$au_result = $db->sql_query($sql); $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); $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 $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 FROM " . FORUMS_TABLE . " f, " . CATEGORIES_TABLE . " c
WHERE c.cat_id = f.cat_id WHERE c.cat_id = f.cat_id
ORDER BY c.cat_order ASC, f.forum_order ASC"; ORDER BY c.cat_order ASC, f.forum_order ASC";
$fa_result = $db->sql_query($sql); $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 // The data above lists access and moderator permissions
// for this user given by all the groups they belong to. // for this user given by all the groups they belong to.
// These values must be checked against those requested // 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 // informed of problems. For example, if a group the user
// belongs to already grants the user moderator status // belongs to already grants the user moderator status
// then the user won't have moderator status enabled. // 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 // forum then again, we must warn the admin that giving
// the user access goes against the group permissions // the user access goes against the group permissions
// (although in this case we'll go ahead and add the user) // (although in this case we'll go ahead and add the user)
// //
//
// //
//
// //
$warning_mod_grpid = array(); $warning_mod_grpid = array();
$warning_mod_grpname = 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) if($new_mod_status)
{ {
$valid_auth_mod_sql[$this_forum_id] = "UPDATE " . AUTH_ACCESS_TABLE . " $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 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 WHERE forum_id = $this_forum_id
AND group_id = " . $ug_info['group_id']; AND group_id = " . $ug_info['group_id'];
} }
else else
{ {
$valid_auth_mod_sql[$this_forum_id] = "DELETE FROM " . AUTH_ACCESS_TABLE . " $valid_auth_mod_sql[$this_forum_id] = "DELETE FROM " . AUTH_ACCESS_TABLE . "
WHERE forum_id = $this_forum_id WHERE forum_id = $this_forum_id
AND group_id = " . $ug_info['group_id']; AND group_id = " . $ug_info['group_id'];
} }
$update_mod = TRUE; $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) if(!$update_mod && $new_mod_status)
{ {
$valid_auth_mod_sql[$this_forum_id] = "INSERT INTO " . AUTH_ACCESS_TABLE . " $valid_auth_mod_sql[$this_forum_id] = "INSERT INTO " . AUTH_ACCESS_TABLE . "
(forum_id, group_id, auth_mod) (forum_id, group_id, auth_mod)
VALUES ($this_forum_id, " . $ug_info['group_id'] . ", $new_mod_status)"; VALUES ($this_forum_id, " . $ug_info['group_id'] . ", $new_mod_status)";
$update_mod = TRUE; $update_mod = TRUE;
} }
@ -443,8 +452,8 @@ if(isset($HTTP_POST_VARS['submit']) && !empty($HTTP_POST_VARS[POST_USERS_URL]))
} }
else else
{ {
$valid_auth_prv_sql[$this_forum_id] = "DELETE FROM " . AUTH_ACCESS_TABLE . " $valid_auth_prv_sql[$this_forum_id] = "DELETE FROM " . AUTH_ACCESS_TABLE . "
WHERE forum_id = $this_forum_id WHERE forum_id = $this_forum_id
AND group_id = " . $ug_info['group_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( $template->assign_vars(array(
"MESSAGE_TITLE" => $lang['Conflict_warning'], "MESSAGE_TITLE" => $lang['Conflict_warning'],
"MESSAGE_TEXT" => $warning_list) "MESSAGE_TEXT" => $warning_list)
); );
} }
@ -571,11 +580,11 @@ else if(empty($HTTP_GET_VARS[POST_USERS_URL]))
// //
// Default user selection box // 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 $sql = "SELECT user_id, username
FROM " . USERS_TABLE . " FROM " . USERS_TABLE . "
WHERE user_id <> " . ANONYMOUS; WHERE user_id <> " . ANONYMOUS;
$u_result = $db->sql_query($sql); $u_result = $db->sql_query($sql);
$user_list = $db->sql_fetchrowset($u_result); $user_list = $db->sql_fetchrowset($u_result);
@ -594,12 +603,12 @@ else if(empty($HTTP_GET_VARS[POST_USERS_URL]))
); );
$template->assign_vars(array( $template->assign_vars(array(
"L_AUTH_TITLE" => $lang['User'] . " " . $lang['Auth_Control'], "L_AUTH_TITLE" => $lang['User'] . " " . $lang['Auth_Control'],
"L_AUTH_EXPLAIN" => $lang['User_auth_explain'], "L_AUTH_EXPLAIN" => $lang['User_auth_explain'],
"L_AUTH_SELECT" => $lang['Select_a'] . " " . $lang['User'], "L_AUTH_SELECT" => $lang['Select_a'] . " " . $lang['User'],
"L_LOOK_UP" => $lang['Look_up'] . " " . $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) "S_AUTH_SELECT" => $select_list)
); );
@ -626,9 +635,9 @@ else
"body" => "admin/auth_ug_body.tpl") "body" => "admin/auth_ug_body.tpl")
); );
$sql = "SELECT f.* $sql = "SELECT f.*
FROM " . FORUMS_TABLE . " f, " . CATEGORIES_TABLE . " c FROM " . FORUMS_TABLE . " f, " . CATEGORIES_TABLE . " c
WHERE c.cat_id = f.cat_id WHERE c.cat_id = f.cat_id
ORDER BY c.cat_order ASC, f.forum_order ASC"; ORDER BY c.cat_order ASC, f.forum_order ASC";
$fa_result = $db->sql_query($sql); $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 $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 FROM " . USERS_TABLE . " u, " . GROUPS_TABLE . " g, " . USER_GROUP_TABLE . " ug
WHERE u.user_id = $user_id WHERE u.user_id = $user_id
AND ug.user_id = u.user_id AND ug.user_id = u.user_id
AND g.group_id = ug.group_id"; AND g.group_id = ug.group_id";
$u_result = $db->sql_query($sql); $u_result = $db->sql_query($sql);
$userinf = $db->sql_fetchrowset($u_result); $userinf = $db->sql_fetchrowset($u_result);
$sql = "SELECT aa.* $sql = "SELECT aa.*
FROM " . AUTH_ACCESS_TABLE . " aa, " . USER_GROUP_TABLE . " ug, " . GROUPS_TABLE. " g FROM " . AUTH_ACCESS_TABLE . " aa, " . USER_GROUP_TABLE . " ug, " . GROUPS_TABLE. " g
WHERE ug.user_id = $user_id WHERE ug.user_id = $user_id
AND g.group_id = ug.group_id AND g.group_id = ug.group_id
AND aa.group_id = ug.group_id AND aa.group_id = ug.group_id
AND g.group_single_user = " . TRUE; AND g.group_single_user = " . TRUE;
$au_result = $db->sql_query($sql); $au_result = $db->sql_query($sql);
@ -714,7 +723,7 @@ else
$auth_user[$f_forum_id][$key] = 0; $auth_user[$f_forum_id][$key] = 0;
} }
break; break;
case AUTH_MOD: case AUTH_MOD:
if($user_id != ANONYMOUS && $num_forum_access[$f_forum_id]) 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']; $row_color = ( !($i%2) ) ? $theme['td_color1'] : $theme['td_color2'];
$template->assign_block_vars("forums", array( $template->assign_block_vars("forums", array(
"ROW_COLOR" => "#" . $row_color, "ROW_COLOR" => "#" . $row_color,
"ROW_CLASS" => $row_class, "ROW_CLASS" => $row_class,
"FORUM_NAME" => $forum_access[$i]['forum_name'], "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) "S_MOD_SELECT" => $optionlist_mod)
); );
@ -931,31 +940,31 @@ else
$s_column_span++; $s_column_span++;
} }
} }
$switch_mode = "admin_userauth.$phpEx?" . POST_USERS_URL . "=" . $user_id . "&adv="; $switch_mode = "admin_userauth.$phpEx?" . POST_USERS_URL . "=" . $user_id . "&adv=";
$switch_mode .= ( empty($adv) ) ? "1" : "0"; $switch_mode .= ( empty($adv) ) ? "1" : "0";
$switch_mode_text = ( empty($adv) ) ? $lang['Advanced_mode'] : $lang['Simple_mode']; $switch_mode_text = ( empty($adv) ) ? $lang['Advanced_mode'] : $lang['Simple_mode'];
$u_switch_mode = '<a href="' . $switch_mode . '">' . $switch_mode_text . '</a>'; $u_switch_mode = '<a href="' . $switch_mode . '">' . $switch_mode_text . '</a>';
$template->assign_vars(array( $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, "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_GROUPNAME" => $lang['Username'],
"L_USER_OR_GROUP" => $lang['User'], "L_USER_OR_GROUP" => $lang['User'],
"L_AUTH_TITLE" => $lang['User'] . " " . $lang['Auth_Control'], "L_AUTH_TITLE" => $lang['User'] . " " . $lang['Auth_Control'],
"L_AUTH_EXPLAIN" => $lang['User_auth_explain'], "L_AUTH_EXPLAIN" => $lang['User_auth_explain'],
"L_MODERATOR_STATUS" => $lang['Moderator_status'], "L_MODERATOR_STATUS" => $lang['Moderator_status'],
"L_PERMISSIONS" => $lang['Permissions'], "L_PERMISSIONS" => $lang['Permissions'],
"L_SUBMIT_CHANGES" => $lang['Submit_changes'], "L_SUBMIT_CHANGES" => $lang['Submit_changes'],
"L_RESET_CHANGES" => $lang['Reset_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, "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_AUTH_ACTION" => append_sid("admin_userauth.$phpEx"),
"S_HIDDEN_FIELDS" => $s_hidden_fields) "S_HIDDEN_FIELDS" => $s_hidden_fields)
); );

View file

@ -1,15 +1,24 @@
<?php <?php
/*************************************************************************** /***************************************************************************
* admin_users.php * admin_users.php
* ------------------- * -------------------
* begin : Saturday, Feb 13, 2001 * begin : Saturday, Feb 13, 2001
* copyright : (C) 2001 The phpBB Group * copyright : (C) 2001 The phpBB Group
* email : support@phpbb.com * 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) if($setmodules == 1)
{ {
@ -50,12 +59,12 @@ if ( isset($HTTP_GET_VARS['submit']) ) {
// //
// This looks familiar doesn't it? It's the user profile page! :) // This looks familiar doesn't it? It's the user profile page! :)
// //
// //
// Let's find out a little about them... // Let's find out a little about them...
// //
$userdata = get_userdata_from_id($HTTP_GET_VARS[POST_USERS_URL]); $userdata = get_userdata_from_id($HTTP_GET_VARS[POST_USERS_URL]);
// //
// Now parse and display it as a template // Now parse and display it as a template
// //
@ -64,7 +73,7 @@ if ( isset($HTTP_GET_VARS['submit']) ) {
$email = $userdata['user_email']; $email = $userdata['user_email'];
$password = ""; $password = "";
$password_confirm = ""; $password_confirm = "";
$icq = $userdata['user_icq']; $icq = $userdata['user_icq'];
$aim = $userdata['user_aim']; $aim = $userdata['user_aim'];
$msn = $userdata['user_msnm']; $msn = $userdata['user_msnm'];
@ -75,7 +84,7 @@ if ( isset($HTTP_GET_VARS['submit']) ) {
$occupation = $userdata['user_occ']; $occupation = $userdata['user_occ'];
$interests = $userdata['user_interests']; $interests = $userdata['user_interests'];
$signature = $userdata['user_sig']; $signature = $userdata['user_sig'];
$viewemail = $userdata['user_viewemail']; $viewemail = $userdata['user_viewemail'];
$notifypm = $userdata['user_notify_pm']; $notifypm = $userdata['user_notify_pm'];
$attachsig = $userdata['user_attachsig']; $attachsig = $userdata['user_attachsig'];
@ -90,7 +99,7 @@ if ( isset($HTTP_GET_VARS['submit']) ) {
$user_timezone = $userdata['user_timezone']; $user_timezone = $userdata['user_timezone'];
$user_template = $userdata['user_template']; $user_template = $userdata['user_template'];
$user_dateformat = $userdata['user_dateformat']; $user_dateformat = $userdata['user_dateformat'];
if(!isset($coppa)) if(!isset($coppa))
{ {
$coppa = FALSE; $coppa = FALSE;
@ -104,7 +113,7 @@ if ( isset($HTTP_GET_VARS['submit']) ) {
$html_status = ($board_config['allow_html']) ? $lang['ON'] : $lang['OFF']; $html_status = ($board_config['allow_html']) ? $lang['ON'] : $lang['OFF'];
$bbcode_status = ($board_config['allow_bbcode']) ? $lang['ON'] : $lang['OFF']; $bbcode_status = ($board_config['allow_bbcode']) ? $lang['ON'] : $lang['OFF'];
$smilies_status = ($board_config['allow_smilies']) ? $lang['ON'] : $lang['OFF']; $smilies_status = ($board_config['allow_smilies']) ? $lang['ON'] : $lang['OFF'];
$s_hidden_fields = '<input type="hidden" name="mode" value="' . $mode . '" /><input type="hidden" name="agreed" value="true" /><input type="hidden" name="coppa" value="' . $coppa . '" />'; $s_hidden_fields = '<input type="hidden" name="mode" value="' . $mode . '" /><input type="hidden" name="agreed" value="true" /><input type="hidden" name="coppa" value="' . $coppa . '" />';
$s_hidden_fields .= '<input type="hidden" name="user_id" value="' . $userdata['user_id'] . '" />'; $s_hidden_fields .= '<input type="hidden" name="user_id" value="' . $userdata['user_id'] . '" />';
// Send the users current email address. If they change it, and account activation is turned on // 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_HTML_IS" => $lang['HTML'] . " " . $lang['is'],
"L_BBCODE_IS" => $lang['BBCode'] . " " . $lang['is'], "L_BBCODE_IS" => $lang['BBCode'] . " " . $lang['is'],
"L_SMILIES_ARE" => $lang['Smilies'] . " " . $lang['are'], "L_SMILIES_ARE" => $lang['Smilies'] . " " . $lang['are'],
"L_DELETE_USER" => $lang['User_delete'], "L_DELETE_USER" => $lang['User_delete'],
"L_DELETE_USER_EXPLAIN" => $lang['User_delete_explain'], "L_DELETE_USER_EXPLAIN" => $lang['User_delete_explain'],
"S_ALLOW_AVATAR_UPLOAD" => $board_config['allow_avatar_upload'], "S_ALLOW_AVATAR_UPLOAD" => $board_config['allow_avatar_upload'],
"S_ALLOW_AVATAR_LOCAL" => $board_config['allow_avatar_local'], "S_ALLOW_AVATAR_LOCAL" => $board_config['allow_avatar_local'],
"S_ALLOW_AVATAR_REMOTE" => $board_config['allow_avatar_remote'], "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; $allowviewonline = (isset($HTTP_POST_VARS['hideonline'])) ? ( ($HTTP_POST_VARS['hideonline']) ? 0 : 1 ) : 1;
$notifypm = (isset($HTTP_POST_VARS['notifypm'])) ? $HTTP_POST_VARS['notifypm'] : 1; $notifypm = (isset($HTTP_POST_VARS['notifypm'])) ? $HTTP_POST_VARS['notifypm'] : 1;
$attachsig = (isset($HTTP_POST_VARS['attachsig'])) ? $HTTP_POST_VARS['attachsig'] : 0; $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']; $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']; $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']; $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']) if(!$error && $file_size > 0 && $file_size < $board_config['avatar_filesize'])
{ {
$avatar_data = substr($avatar_data, strlen($avatar_data) - $file_size, $file_size); $avatar_data = substr($avatar_data, strlen($avatar_data) - $file_size, $file_size);
$tmp_filename = tempnam ("/tmp", $userdata['user_id'] . "-"); $tmp_filename = tempnam ("/tmp", $userdata['user_id'] . "-");
$fptr = fopen($tmp_filename, "wb"); $fptr = fopen($tmp_filename, "wb");
$bytes_written = fwrite($fptr, $avatar_data, $file_size); $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 ... allow_avatar_upload
} }
} }
if(!$error) if(!$error)
{ {
if( $HTTP_POST_VARS['deleteuser'] ) if( $HTTP_POST_VARS['deleteuser'] )
{ {
$sql = "UPDATE " . POSTS_TABLE . " $sql = "UPDATE " . POSTS_TABLE . "
SET poster_id = '-1' SET poster_id = '-1'
WHERE poster_id = $user_id"; WHERE poster_id = $user_id";
if( $result = $db->sql_query($sql) ) 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"; WHERE user_id = $user_id";
if( $result = $db->sql_query($sql) ) if( $result = $db->sql_query($sql) )
{ {
include('page_header_admin.'. $phpEx); include('page_header_admin.'. $phpEx);
$template->set_filenames(array( $template->set_filenames(array(
"body" => "admin/admin_message_body.tpl") "body" => "admin/admin_message_body.tpl")
); );
$template->assign_vars(array( $template->assign_vars(array(
"MESSAGE_TITLE" => $lang['User'] . $lang['User_admin'], "MESSAGE_TITLE" => $lang['User'] . $lang['User_admin'],
"MESSAGE_TEXT" => $lang['User_deleted']) "MESSAGE_TEXT" => $lang['User_deleted'])
@ -668,7 +677,7 @@ else if($HTTP_POST_VARS[submit] && $HTTP_POST_VARS['user_id'])
$template->set_filenames(array( $template->set_filenames(array(
"body" => "admin/admin_message_body.tpl") "body" => "admin/admin_message_body.tpl")
); );
$template->assign_vars(array( $template->assign_vars(array(
"MESSAGE_TITLE" => $lang['User'] . $lang['User_admin'], "MESSAGE_TITLE" => $lang['User'] . $lang['User_admin'],
"MESSAGE_TEXT" => $lang['Profile_updated']) "MESSAGE_TEXT" => $lang['Profile_updated'])
@ -691,11 +700,11 @@ else
// //
// Default user selection box // 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 $sql = "SELECT user_id, username
FROM " . USERS_TABLE . " FROM " . USERS_TABLE . "
WHERE user_id <> " . ANONYMOUS; WHERE user_id <> " . ANONYMOUS;
$u_result = $db->sql_query($sql); $u_result = $db->sql_query($sql);
$user_list = $db->sql_fetchrowset($u_result); $user_list = $db->sql_fetchrowset($u_result);
@ -714,12 +723,12 @@ else
); );
$template->assign_vars(array( $template->assign_vars(array(
"L_USER_TITLE" => $lang['User'] . " " . $lang['User_admin'], "L_USER_TITLE" => $lang['User'] . " " . $lang['User_admin'],
"L_USER_EXPLAIN" => $lang['User_admin_explain'], "L_USER_EXPLAIN" => $lang['User_admin_explain'],
"L_USER_SELECT" => $lang['Select_a'] . " " . $lang['User'], "L_USER_SELECT" => $lang['Select_a'] . " " . $lang['User'],
"L_LOOK_UP" => $lang['Look_up'] . " " . $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) "S_USER_SELECT" => $select_list)
); );
$template->pparse('body'); $template->pparse('body');

View file

@ -1,15 +1,24 @@
<?php <?php
/*************************************************************************** /***************************************************************************
* (admin) index.php * (admin) index.php
* ------------------- * -------------------
* begin : Saturday, Feb 13, 2001 * begin : Saturday, Feb 13, 2001
* copyright : (C) 2001 The phpBB Group * copyright : (C) 2001 The phpBB Group
* email : support@phpbb.com * 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.
*
***************************************************************************/
$phpbb_root_path = "./../"; $phpbb_root_path = "./../";
include($phpbb_root_path . 'extension.inc'); include($phpbb_root_path . 'extension.inc');
@ -20,7 +29,7 @@ include($phpbb_root_path . 'common.'.$phpEx);
// //
$userdata = session_pagestart($user_ip, PAGE_INDEX, $session_length); $userdata = session_pagestart($user_ip, PAGE_INDEX, $session_length);
init_userprefs($userdata); init_userprefs($userdata);
// //
// End session management // End session management
// //
@ -57,12 +66,12 @@ if( $HTTP_GET_VARS['pane'] == 'left' )
$template->set_filenames(array( $template->set_filenames(array(
"body" => "admin/index_navigate.tpl") "body" => "admin/index_navigate.tpl")
); );
$template->assign_vars(array( $template->assign_vars(array(
"U_BOARD_INDEX" => append_sid("../index.$phpEx"), "U_BOARD_INDEX" => append_sid("../index.$phpEx"),
"U_ADMIN_INDEX" => append_sid("index.$phpEx?pane=right"), "U_ADMIN_INDEX" => append_sid("index.$phpEx?pane=right"),
"L_BOARD_INDEX" => "Board Index", "L_BOARD_INDEX" => "Board Index",
"L_ADMIN_INDEX" => "Admin Index") "L_ADMIN_INDEX" => "Admin Index")
); );
@ -81,8 +90,8 @@ if( $HTTP_GET_VARS['pane'] == 'left' )
$action = preg_replace("'_'", " ", $action); $action = preg_replace("'_'", " ", $action);
$template->assign_block_vars("catrow.actionrow", array( $template->assign_block_vars("catrow.actionrow", array(
"ROW_COLOR" => $row_color, "ROW_COLOR" => $row_color,
"ROW_CLASS" => $row_class, "ROW_CLASS" => $row_class,
"ACTIONNAME" => $action, "ACTIONNAME" => $action,
"FILE" => $file) "FILE" => $file)
); );
@ -99,29 +108,29 @@ elseif( $HTTP_GET_VARS['pane'] == 'right' )
{ {
include('page_header_admin.'.$phpEx); include('page_header_admin.'.$phpEx);
$template->set_filenames(array( $template->set_filenames(array(
"body" => "admin/index_body.tpl") "body" => "admin/index_body.tpl")
); );
$template->assign_vars(array( $template->assign_vars(array(
"L_WELCOME" => $lang['Welcome_phpBB'], "L_WELCOME" => $lang['Welcome_phpBB'],
"L_ADMIN_INTRO" => $lang['Admin_intro'], "L_ADMIN_INTRO" => $lang['Admin_intro'],
"L_FORUM_STATS" => $lang['Forum_stats'], "L_FORUM_STATS" => $lang['Forum_stats'],
"L_WHO_IS_ONLINE" => $lang['Who_is_Online'], "L_WHO_IS_ONLINE" => $lang['Who_is_Online'],
"L_LOCATION" => $lang['Location'], "L_LOCATION" => $lang['Location'],
"L_LAST_UPDATE" => $lang['Last_updated'], "L_LAST_UPDATE" => $lang['Last_updated'],
"L_IP_ADDRESS" => $lang['IP_Address'], "L_IP_ADDRESS" => $lang['IP_Address'],
"L_STATISTIC" => $lang['Statistic'], "L_STATISTIC" => $lang['Statistic'],
"L_VALUE" => $lang['Value'], "L_VALUE" => $lang['Value'],
"L_NUMBER_POSTS" => $lang['Number_posts'], "L_NUMBER_POSTS" => $lang['Number_posts'],
"L_POSTS_PER_DAY" => $lang['Posts_per_day'], "L_POSTS_PER_DAY" => $lang['Posts_per_day'],
"L_NUMBER_TOPICS" => $lang['Number_topics'], "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_NUMBER_USERS" => $lang['Number_users'],
"L_USERS_PER_DAY" => $lang['Users_per_day'], "L_USERS_PER_DAY" => $lang['Users_per_day'],
"L_BOARD_STARTED" => $lang['Board_started'], "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']) "L_DB_SIZE" => $lang['Database_size'])
); );
@ -143,7 +152,7 @@ elseif( $HTTP_GET_VARS['pane'] == 'right' )
$avatar_dir_size = 0; $avatar_dir_size = 0;
if ($avatar_dir = @opendir($phpbb_root_path . $board_config['avatar_path'])) if ($avatar_dir = @opendir($phpbb_root_path . $board_config['avatar_path']))
{ {
while($file = readdir($avatar_dir)) while($file = readdir($avatar_dir))
{ {
if($file != "." && $file != "..") 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: // Borrowed the code from the PHP.net annoted manual, origanally written by:
// Jesse (jesse@jess.on.ca) // Jesse (jesse@jess.on.ca)
// //
if($avatar_dir_size >= 1048576) if($avatar_dir_size >= 1048576)
{ {
$avatar_dir_size = round($avatar_dir_size / 1048576 * 100) / 100 . " MB"; $avatar_dir_size = round($avatar_dir_size / 1048576 * 100) / 100 . " MB";
} }
else if($avatar_dir_size >= 1024) else if($avatar_dir_size >= 1024)
{ {
$avatar_dir_size = round($avatar_dir_size / 1024 * 100) / 100 . " KB"; $avatar_dir_size = round($avatar_dir_size / 1024 * 100) / 100 . " KB";
} }
else else
{ {
$avatar_dir_size = $avatar_dir_size . " Bytes"; $avatar_dir_size = $avatar_dir_size . " Bytes";
} }
if($posts_per_day > $total_posts) if($posts_per_day > $total_posts)
{ {
@ -258,7 +267,7 @@ elseif( $HTTP_GET_VARS['pane'] == 'right' )
"POSTS_PER_DAY" => $posts_per_day, "POSTS_PER_DAY" => $posts_per_day,
"TOPICS_PER_DAY" => $topics_per_day, "TOPICS_PER_DAY" => $topics_per_day,
"USERS_PER_DAY" => $users_per_day, "USERS_PER_DAY" => $users_per_day,
"AVATAR_DIR_SIZE" => $avatar_dir_size, "AVATAR_DIR_SIZE" => $avatar_dir_size,
"DB_SIZE" => $dbsize) "DB_SIZE" => $dbsize)
); );
// //
@ -269,7 +278,7 @@ elseif( $HTTP_GET_VARS['pane'] == 'right' )
// Get users online information. // 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 $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 WHERE u.user_id = s.session_user_id
AND s.session_time >= " . (time()-300) . " AND s.session_time >= " . (time()-300) . "
ORDER BY s.session_time DESC"; 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_color = "#" . ( ( !($count % 2) ) ? $theme['td_color1'] : $theme['td_color2']);
$row_class = ( !($count % 2) ) ? $theme['td_class1'] : $theme['td_class2']; $row_class = ( !($count % 2) ) ? $theme['td_class1'] : $theme['td_class2'];
$count++; $count++;
$ip_address = decode_ip($onlinerow[$i]['session_ip']); $ip_address = decode_ip($onlinerow[$i]['session_ip']);
// //
// This resolves the users IP to a host name, but it REALLY slows the page down // This resolves the users IP to a host name, but it REALLY slows the page down
// //
//$host_name = gethostbyaddr($ip_address); //$host_name = gethostbyaddr($ip_address);
//$ip_address = $ip_address . " ($host_name)"; //$ip_address = $ip_address . " ($host_name)";
if(empty($username)) if(empty($username))
{ {
$username = $lang['Guest']; $username = $lang['Guest'];
@ -403,7 +412,7 @@ elseif( $HTTP_GET_VARS['pane'] == 'right' )
} }
else else
{ {
// //
// Generate frameset // Generate frameset
// //
@ -420,7 +429,7 @@ else
header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
$template->pparse("body"); $template->pparse("body");
exit; exit;
} }

View file

@ -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. // Show the overall footer.
// //
@ -54,17 +63,17 @@ if($do_gzip_compress)
// //
// Borrowed from php.net! // Borrowed from php.net!
// //
$gzip_contents = ob_get_contents(); $gzip_contents = ob_get_contents();
ob_end_clean(); ob_end_clean();
$gzip_size = strlen($gzip_contents); $gzip_size = strlen($gzip_contents);
$gzip_crc = crc32($gzip_contents); $gzip_crc = crc32($gzip_contents);
$gzip_contents = gzcompress($gzip_contents, 9); $gzip_contents = gzcompress($gzip_contents, 9);
$gzip_contents = substr($gzip_contents, 0, strlen($gzip_contents) - 4); $gzip_contents = substr($gzip_contents, 0, strlen($gzip_contents) - 4);
echo "\x1f\x8b\x08\x00\x00\x00\x00\x00"; echo "\x1f\x8b\x08\x00\x00\x00\x00\x00";
echo $gzip_contents; echo $gzip_contents;
echo pack("V", $gzip_crc); echo pack("V", $gzip_crc);
echo pack("V", $gzip_size); echo pack("V", $gzip_size);
} }

View file

@ -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); define(HEADER_INC, TRUE);
// //
@ -31,18 +40,18 @@ if($board_config['gzip_compress'])
else if($phpver > "4.0") else if($phpver > "4.0")
{ {
if(strstr($HTTP_SERVER_VARS['HTTP_ACCEPT_ENCODING'], 'gzip')) if(strstr($HTTP_SERVER_VARS['HTTP_ACCEPT_ENCODING'], 'gzip'))
{ {
$do_gzip_compress = TRUE; $do_gzip_compress = TRUE;
ob_start(); ob_start();
ob_implicit_flush(0); ob_implicit_flush(0);
header("Content-Encoding: gzip"); header("Content-Encoding: gzip");
} }
} }
} }
$template->set_filenames(array( $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_COLOR1" => "#".$theme['tr_color1'],
"T_TR_COLOR2" => "#".$theme['tr_color2'], "T_TR_COLOR2" => "#".$theme['tr_color2'],
"T_TR_COLOR3" => "#".$theme['tr_color3'], "T_TR_COLOR3" => "#".$theme['tr_color3'],
"T_TR_CLASS1" => $theme['tr_class1'], "T_TR_CLASS1" => $theme['tr_class1'],
"T_TR_CLASS2" => $theme['tr_class2'], "T_TR_CLASS2" => $theme['tr_class2'],
"T_TR_CLASS3" => $theme['tr_class3'], "T_TR_CLASS3" => $theme['tr_class3'],
"T_TH_COLOR1" => "#".$theme['th_color1'], "T_TH_COLOR1" => "#".$theme['th_color1'],
"T_TH_COLOR2" => "#".$theme['th_color2'], "T_TH_COLOR2" => "#".$theme['th_color2'],
"T_TH_COLOR3" => "#".$theme['th_color3'], "T_TH_COLOR3" => "#".$theme['th_color3'],
"T_TH_CLASS1" => $theme['th_class1'], "T_TH_CLASS1" => $theme['th_class1'],
"T_TH_CLASS2" => $theme['th_class2'], "T_TH_CLASS2" => $theme['th_class2'],
"T_TH_CLASS3" => $theme['th_class3'], "T_TH_CLASS3" => $theme['th_class3'],
"T_TD_COLOR1" => "#".$theme['td_color1'], "T_TD_COLOR1" => "#".$theme['td_color1'],
"T_TD_COLOR2" => "#".$theme['td_color2'], "T_TD_COLOR2" => "#".$theme['td_color2'],
"T_TD_COLOR3" => "#".$theme['td_color3'], "T_TD_COLOR3" => "#".$theme['td_color3'],
"T_TD_CLASS1" => $theme['td_class1'], "T_TD_CLASS1" => $theme['td_class1'],
"T_TD_CLASS2" => $theme['td_class2'], "T_TD_CLASS2" => $theme['td_class2'],
"T_TD_CLASS3" => $theme['td_class3'], "T_TD_CLASS3" => $theme['td_class3'],
"T_FONTFACE1" => $theme['fontface1'], "T_FONTFACE1" => $theme['fontface1'],
"T_FONTFACE2" => $theme['fontface2'], "T_FONTFACE2" => $theme['fontface2'],
"T_FONTFACE3" => $theme['fontface3'], "T_FONTFACE3" => $theme['fontface3'],
@ -138,8 +147,8 @@ $template->assign_vars(array(
"T_FONTCOLOR1" => "#".$theme['fontcolor1'], "T_FONTCOLOR1" => "#".$theme['fontcolor1'],
"T_FONTCOLOR2" => "#".$theme['fontcolor2'], "T_FONTCOLOR2" => "#".$theme['fontcolor2'],
"T_FONTCOLOR3" => "#".$theme['fontcolor3'], "T_FONTCOLOR3" => "#".$theme['fontcolor3'],
"T_SPAN_CLASS1" => $theme['span_class1'], "T_SPAN_CLASS1" => $theme['span_class1'],
"T_SPAN_CLASS2" => $theme['span_class2'], "T_SPAN_CLASS2" => $theme['span_class2'],
"T_SPAN_CLASS3" => $theme['span_class3']) "T_SPAN_CLASS3" => $theme['span_class3'])
); );

View file

@ -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 = "../"; $phpbb_root_path = "../";
include($phpbb_root_path . 'extension.inc'); include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx); include($phpbb_root_path . 'common.'.$phpEx);

View file

@ -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 error_reporting (E_ERROR | E_WARNING | E_PARSE); // This will NOT report uninitialized variables
set_magic_quotes_runtime(0); // Disable magic_quotes_runtime set_magic_quotes_runtime(0); // Disable magic_quotes_runtime

View file

@ -1,18 +1,27 @@
<?php <?php
/*************************************************************************** /***************************************************************************
* config.php * config.php
* ------------------- * -------------------
* begin : Saturday, Feb 13, 2001 * begin : Saturday, Feb 13, 2001
* copyright : (C) 2001 The phpBB Group * copyright : (C) 2001 The phpBB Group
* email : support@phpbb.com * 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.
*
***************************************************************************/
// DB connection config // DB connection config
// //
// Uncomment the relevant entry // Uncomment the relevant entry
// and fill in the required details // and fill in the required details
// //
@ -41,7 +50,7 @@ $dbpasswd = "";
/* /*
// //
// MSSQL // MSSQL
// //
$dbms = "mssql"; $dbms = "mssql";
$dbhost = ""; $dbhost = "";

View file

@ -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")) if(!defined("SQL_LAYER"))
{ {
@ -114,10 +123,10 @@ class sql_db
// performance compared to an 'in-built' limit // performance compared to an 'in-built' limit
// //
// Another issue is the 'lack' of a returned true value when a query is valid but has // Another issue is the 'lack' of a returned true value when a query is valid but has
// no result set (as with all the other DB interfaces). It seems though that it's // no result set (as with all the other DB interfaces). It seems though that it's
// 'fair' to say that if a query returns a false result (ie. no resource id) then the // 'fair' to say that if a query returns a false result (ie. no resource id) then the
// SQL was valid but had no result set. If the query returns nothing but the rowcount // SQL was valid but had no result set. If the query returns nothing but the rowcount
// returns something then there's a problem. This may well be a false assumption though // returns something then there's a problem. This may well be a false assumption though
// ... needs checking under Windows itself. // ... needs checking under Windows itself.
// //
if(eregi("LIMIT", $query)) if(eregi("LIMIT", $query))
@ -135,7 +144,7 @@ class sql_db
$row_offset = 0; $row_offset = 0;
$num_rows = $limits[2]; $num_rows = $limits[2];
} }
// $this->query_array[] = $query; // $this->query_array[] = $query;
@mssql_query("SET ROWCOUNT ".($row_offset + $num_rows)); @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_offset[$this->query_result] = -1;
$this->query_limit_numrows[$this->query_result] = -1; $this->query_limit_numrows[$this->query_result] = -1;
} }
else else
{ {
// $this->query_array[] = $query; // $this->query_array[] = $query;
@ -259,7 +268,7 @@ class sql_db
$result = @mssql_num_rows($query_id) - $this->query_limit_offset[$query_id]; $result = @mssql_num_rows($query_id) - $this->query_limit_offset[$query_id];
} }
else else
{ {
$result = @mssql_num_rows($query_id); $result = @mssql_num_rows($query_id);
} }
return $result; return $result;
@ -340,7 +349,7 @@ class sql_db
} }
if($query_id) if($query_id)
{ {
if($this->query_limit_offset[$query_id] > 0) if($this->query_limit_offset[$query_id] > 0)
{ {
if($this->query_limit_success) if($this->query_limit_success)

View file

@ -1,6 +1,6 @@
<?php <?php
/*************************************************************************** /***************************************************************************
* mysql.php * mysql.php
* ------------------- * -------------------
* begin : Saturday, Feb 13, 2001 * begin : Saturday, Feb 13, 2001
* copyright : (C) 2001 The phpBB Group * copyright : (C) 2001 The phpBB Group
@ -10,6 +10,15 @@
* *
***************************************************************************/ ***************************************************************************/
/***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
***************************************************************************/
if(!defined("SQL_LAYER")) if(!defined("SQL_LAYER"))
{ {
@ -38,7 +47,7 @@ class sql_db
if($this->persistency) if($this->persistency)
{ {
$this->db_connect_id = @mysql_pconnect($this->server, $this->user, $this->password); $this->db_connect_id = @mysql_pconnect($this->server, $this->user, $this->password);
} }
else else
{ {
$this->db_connect_id = @mysql_connect($this->server, $this->user, $this->password); $this->db_connect_id = @mysql_connect($this->server, $this->user, $this->password);

View file

@ -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")) if(!defined("SQL_LAYER"))
{ {
@ -130,7 +139,7 @@ class sql_db
if(eregi("LIMIT", $query)) if(eregi("LIMIT", $query))
{ {
preg_match("/^(.*)LIMIT ([0-9]+)[, ]*([0-9]+)*/s", $query, $limits); preg_match("/^(.*)LIMIT ([0-9]+)[, ]*([0-9]+)*/s", $query, $limits);
$query = $limits[1]; $query = $limits[1];
if($limits[3]) if($limits[3])
{ {

View file

@ -1,6 +1,6 @@
<?php <?php
/*************************************************************************** /***************************************************************************
* oracle.php * oracle.php
* ------------------- * -------------------
* begin : Thrusday Feb 15, 2001 * begin : Thrusday Feb 15, 2001
* copyright : (C) 2001 The phpBB Group * copyright : (C) 2001 The phpBB Group
@ -10,6 +10,15 @@
* *
***************************************************************************/ ***************************************************************************/
/***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
***************************************************************************/
if(!defined("SQL_LAYER")) if(!defined("SQL_LAYER"))
{ {
@ -17,12 +26,12 @@ define("SQL_LAYER","oracle");
class sql_db class sql_db
{ {
var $db_connect_id; var $db_connect_id;
var $query_result; var $query_result;
var $row; var $row;
var $num_queries = 0; var $num_queries = 0;
// //
// Constructor // Constructor
// //
@ -33,11 +42,11 @@ class sql_db
$this->password = $sqlpassword; $this->password = $sqlpassword;
$this->server = $sqlserver; $this->server = $sqlserver;
$this->dbname = $database; $this->dbname = $database;
if($this->persistency) if($this->persistency)
{ {
$this->db_connect_id = @OCIPLogon($this->user, $this->password, $this->server); $this->db_connect_id = @OCIPLogon($this->user, $this->password, $this->server);
} }
else else
{ {
$this->db_connect_id = @OCINLogon($this->user, $this->password, $this->server); $this->db_connect_id = @OCINLogon($this->user, $this->password, $this->server);
@ -99,7 +108,7 @@ class sql_db
$num_rows = $limits[2]; $num_rows = $limits[2];
} }
} }
if(eregi("^(INSERT|UPDATE) ", $query)) if(eregi("^(INSERT|UPDATE) ", $query))
{ {
$query = preg_replace("/\\\'/s", "''", $query); $query = preg_replace("/\\\'/s", "''", $query);
@ -246,10 +255,10 @@ class sql_db
{ {
$rows = @OCIFetchStatement($query_id, $results); $rows = @OCIFetchStatement($query_id, $results);
@OCIExecute($query_id); @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); @OCIFetchInto($query_id, $tmp_result, OCI_ASSOC+OCI_RETURN_NULLS);
for($j = 0; $j < count($tmp_result); $j++) for($j = 0; $j < count($tmp_result); $j++)
{ {
list($key, $val) = each($tmp_result); list($key, $val) = each($tmp_result);
@ -351,7 +360,7 @@ class sql_db
return false; return false;
} }
} }
function sql_nextid() function sql_nextid()
{ {
if($this->db_connect_id) if($this->db_connect_id)

View file

@ -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")) if(!defined("SQL_LAYER"))
{ {
@ -19,7 +28,7 @@ class sql_db
{ {
var $db_connect_id; var $db_connect_id;
var $query_result; var $query_result;
var $in_transaction = 0; var $in_transaction = 0;
var $row; var $row;
var $rownum = array(); var $rownum = array();

View file

@ -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 = "./"; $phpbb_root_path = "./";
include($phpbb_root_path . 'extension.inc'); include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx); include($phpbb_root_path . 'common.'.$phpEx);
@ -24,8 +33,8 @@ init_userprefs($userdata);
// End session management // 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);
?> ?>

View file

@ -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 = "./"; $phpbb_root_path = "./";
include($phpbb_root_path . 'extension.inc'); include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx); include($phpbb_root_path . 'common.'.$phpEx);

View file

@ -1,19 +1,28 @@
<?php <?php
/*************************************************************************** /***************************************************************************
* auth.php * auth.php
* ------------------- * -------------------
* begin : Saturday, Feb 13, 2001 * begin : Saturday, Feb 13, 2001
* copyright : (C) 2001 The phpBB Group * copyright : (C) 2001 The phpBB Group
* email : support@phpbb.com * 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.
*
***************************************************************************/
/* /*
$type's accepted (pre-pend with AUTH_): $type's accepted (pre-pend with AUTH_):
VIEW, READ, POST, REPLY, EDIT, DELETE, STICKY, ANNOUNCE, VOTE, VOTECREATE, VIEW, READ, POST, REPLY, EDIT, DELETE, STICKY, ANNOUNCE, VOTE, VOTECREATE,
ATTACH ATTACH
$types pending (for future versions, pre-pend with AUTH_): $types pending (for future versions, pre-pend with AUTH_):
@ -21,7 +30,7 @@
Possible options ($type/forum_id combinations): Possible options ($type/forum_id combinations):
* If you include a type and forum_id then a specific lookup will be done and * If you include a type and forum_id then a specific lookup will be done and
the single result returned the single result returned
* If you set type to AUTH_ALL and specify a forum_id an array of all auth types * If you set type to AUTH_ALL and specify a forum_id an array of all auth types
@ -30,8 +39,8 @@
* If you provide a forum_id a specific lookup on that forum will be done * If you provide a forum_id a specific lookup on that forum will be done
* If you set forum_id to AUTH_LIST_ALL and specify a type an array listing the * If you set forum_id to AUTH_LIST_ALL and specify a type an array listing the
results for all forums will be returned results for all forums will be returned
* If you set forum_id to AUTH_LIST_ALL and type to AUTH_ALL a multidimensional * If you set forum_id to AUTH_LIST_ALL and type to AUTH_ALL a multidimensional
array containing the auth permissions for all types and all forums for that array containing the auth permissions for all types and all forums for that
user is returned user is returned
@ -115,8 +124,8 @@ function auth($type, $forum_id, $userdata, $f_access = -1)
{ {
$forum_match_sql = ($forum_id != AUTH_LIST_ALL) ? "WHERE a.forum_id = $forum_id" : ""; $forum_match_sql = ($forum_id != AUTH_LIST_ALL) ? "WHERE a.forum_id = $forum_id" : "";
$sql = "SELECT a.forum_id, $a_sql $sql = "SELECT a.forum_id, $a_sql
FROM " . FORUMS_TABLE . " a FROM " . FORUMS_TABLE . " a
$forum_match_sql"; $forum_match_sql";
$af_result = $db->sql_query($sql); $af_result = $db->sql_query($sql);
@ -148,23 +157,23 @@ function auth($type, $forum_id, $userdata, $f_access = -1)
{ {
$forum_match_sql = ($forum_id != AUTH_LIST_ALL) ? "AND a.forum_id = $forum_id" : ""; $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 /* $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 FROM " . AUTH_ACCESS_TABLE . " au, " . USER_GROUP_TABLE . " ug, " . GROUPS_TABLE. " g
WHERE ug.user_id = " . $userdata['user_id'] . " WHERE ug.user_id = " . $userdata['user_id'] . "
AND g.group_id = ug.group_id AND g.group_id = ug.group_id
AND ( AND (
( au.user_id = ug.user_id ( au.user_id = ug.user_id
AND g.group_id = 0 ) AND g.group_id = 0 )
OR OR
( au.group_id = ug.group_id ( au.group_id = ug.group_id
AND g.group_id <> 0 ) AND g.group_id <> 0 )
) )
$forum_match_sql";*/ $forum_match_sql";*/
$sql = "SELECT a.forum_id, $a_sql, a.auth_mod, g.group_single_user $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 FROM " . AUTH_ACCESS_TABLE . " a, " . USER_GROUP_TABLE . " ug, " . GROUPS_TABLE . " g
WHERE ug.user_id = ".$userdata['user_id']. " WHERE ug.user_id = ".$userdata['user_id']. "
AND g.group_id = ug.group_id AND g.group_id = ug.group_id
AND a.group_id = ug.group_id AND a.group_id = ug.group_id
$forum_match_sql"; $forum_match_sql";
$a_result = $db->sql_query($sql); $a_result = $db->sql_query($sql);
if(!$a_result) 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] = ( $userdata['session_logged_in'] ) ? auth_check_user(AUTH_ACL, $key, $u_access, $is_admin) : 0;
$auth_user[$key . '_type'] = $lang['Users_granted_access']; $auth_user[$key . '_type'] = $lang['Users_granted_access'];
break; break;
case AUTH_MOD: 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] = ( $userdata['session_logged_in'] ) ? auth_check_user(AUTH_MOD, 'auth_mod', $u_access, $is_admin) : 0;
$auth_user[$key . '_type'] = $lang['Moderators']; $auth_user[$key . '_type'] = $lang['Moderators'];
break; break;
case AUTH_ADMIN: case AUTH_ADMIN:
$auth_user[$key] = $is_admin; $auth_user[$key] = $is_admin;
$auth_user[$key . '_type'] = $lang['Administrators']; $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] = ( $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']; $auth_user[$f_forum_id][$key . '_type'] = $lang['Users_granted_access'];
break; break;
case AUTH_MOD: 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] = ( $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']; $auth_user[$f_forum_id][$key . '_type'] = $lang['Moderators'];
break; break;
case AUTH_ADMIN: case AUTH_ADMIN:
$auth_user[$f_forum_id][$key] = $is_admin; $auth_user[$f_forum_id][$key] = $is_admin;
$auth_user[$f_forum_id][$key . '_type'] = $lang['Administrators']; $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) if(!$single_user)
{ {
$single_user = $u_access[$j]['group_single_user']; $single_user = $u_access[$j]['group_single_user'];
$result = 0; $result = 0;
switch($type) switch($type)
{ {
@ -353,7 +362,7 @@ function auth_check_user($type, $key, $u_access, $is_admin)
{ {
$auth_user = $is_admin; $auth_user = $is_admin;
} }
return $auth_user; return $auth_user;
} }

View file

@ -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); define("BBCODE_UID_LEN", 10);
/** /**

View file

@ -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 // Constants
// //

View file

@ -1,15 +1,24 @@
<?php <?php
/*************************************************************************** /***************************************************************************
* db.php * db.php
* ------------------- * -------------------
* begin : Saturday, Feb 13, 2001 * begin : Saturday, Feb 13, 2001
* copyright : (C) 2001 The phpBB Group * copyright : (C) 2001 The phpBB Group
* email : support@phpbb.com * 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.
*
***************************************************************************/
switch($dbms) switch($dbms)
{ {
@ -36,7 +45,7 @@ switch($dbms)
// Make the database connection. // Make the database connection.
$db = new sql_db($dbhost, $dbuser, $dbpasswd, $dbname, false); $db = new sql_db($dbhost, $dbuser, $dbpasswd, $dbname, false);
if(!$db->db_connect_id) if(!$db->db_connect_id)
{ {
message_die(CRITICAL_ERROR, "Could not connect to the database"); message_die(CRITICAL_ERROR, "Could not connect to the database");
} }

View file

@ -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 // 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 // in the 2.0 release but we can probable find some way of using it in a future

View file

@ -11,7 +11,6 @@
* *
***************************************************************************/ ***************************************************************************/
/*************************************************************************** /***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify * 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) function make_forum_box($box_name, $default_forum = -1)
{ {
global $db; global $db;
$limit_forums = ""; $limit_forums = "";
$sql = "SELECT forum_id, forum_name $sql = "SELECT forum_id, forum_name
@ -218,7 +217,7 @@ function make_forum_box($box_name, $default_forum = -1)
} }
return($boxstring); return($boxstring);
} }
// //
// Initialise user settings on page load // Initialise user settings on page load
function init_userprefs($userdata) function init_userprefs($userdata)
@ -461,7 +460,7 @@ function generate_pagination($base_url, $num_items, $per_page, $start_item, $add
function validate_email($email) function validate_email($email)
{ {
global $db; global $db;
if($email != "") if($email != "")
{ {
$sql = "SELECT ban_email $sql = "SELECT ban_email
@ -480,7 +479,7 @@ function validate_email($email)
} }
} }
$sql = "SELECT user_email $sql = "SELECT user_email
FROM " . USERS_TABLE . " FROM " . USERS_TABLE . "
WHERE user_email = '" . $email . "'"; WHERE user_email = '" . $email . "'";
if(!$result = $db->sql_query($sql)) if(!$result = $db->sql_query($sql))
{ {
@ -516,10 +515,10 @@ function validate_username($username)
// So we have to use two queries // So we have to use two queries
case 'mysql': case 'mysql':
$sql_users = "SELECT u.username, g.group_name $sql_users = "SELECT u.username, g.group_name
FROM " . USERS_TABLE . " u, " . GROUPS_TABLE . " g, " . USER_GROUP_TABLE . " ug FROM " . USERS_TABLE . " u, " . GROUPS_TABLE . " g, " . USER_GROUP_TABLE . " ug
WHERE ug.user_id = u.user_id WHERE ug.user_id = u.user_id
AND g.group_id = ug.group_id AND g.group_id = ug.group_id
AND ( LOWER(u.username) = '" . strtolower($username) . "' AND ( LOWER(u.username) = '" . strtolower($username) . "'
OR LOWER(g.group_name) = '" . strtolower($username) . "' )"; OR LOWER(g.group_name) = '" . strtolower($username) . "' )";
$sql_disallow = "SELECT disallow_username $sql_disallow = "SELECT disallow_username
FROM " . DISALLOW_TABLE . " FROM " . DISALLOW_TABLE . "
@ -542,12 +541,12 @@ function validate_username($username)
default: default:
$sql = "SELECT u.username, g.group_name $sql = "SELECT u.username, g.group_name
FROM " . USERS_TABLE . " u, " . GROUPS_TABLE . " g, " . USER_GROUP_TABLE . " ug FROM " . USERS_TABLE . " u, " . GROUPS_TABLE . " g, " . USER_GROUP_TABLE . " ug
WHERE ug.user_id = u.user_id WHERE ug.user_id = u.user_id
AND g.group_id = ug.group_id AND g.group_id = ug.group_id
AND ( LOWER(u.username) = '" . strtolower($username) . "' AND ( LOWER(u.username) = '" . strtolower($username) . "'
OR LOWER(g.group_name) = '" . strtolower($username) . "' ) OR LOWER(g.group_name) = '" . strtolower($username) . "' )
UNION UNION
SELECT disallow_username, NULL SELECT disallow_username, NULL
FROM " . DISALLOW_TABLE . " FROM " . DISALLOW_TABLE . "
WHERE disallow_username = '$username'"; WHERE disallow_username = '$username'";
@ -565,11 +564,11 @@ function validate_username($username)
} }
function sync($type, $id) function sync($type, $id)
{ {
global $db; global $db;
switch($type) switch($type)
{ {
case 'forum': 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; $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; $last_post = 0;
} }
$sql = "SELECT count(post_id) AS total FROM ".POSTS_TABLE." WHERE forum_id = $id"; $sql = "SELECT count(post_id) AS total FROM ".POSTS_TABLE." WHERE forum_id = $id";
if(!$result = $db->sql_query($sql)) if(!$result = $db->sql_query($sql))
{ {
@ -595,7 +594,7 @@ function sync($type, $id)
{ {
$total_posts = $rowset[0]['total']; $total_posts = $rowset[0]['total'];
} }
$sql = "SELECT count(topic_id) AS total FROM ".TOPICS_TABLE." WHERE forum_id = $id"; $sql = "SELECT count(topic_id) AS total FROM ".TOPICS_TABLE." WHERE forum_id = $id";
if(!$result = $db->sql_query($sql, $db)) if(!$result = $db->sql_query($sql, $db))
{ {
@ -605,7 +604,7 @@ function sync($type, $id)
{ {
$total_topics = $rowset[0]['total']; $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"; $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)) if(!$result = $db->sql_query($sql))
{ {
@ -623,7 +622,7 @@ function sync($type, $id)
{ {
$last_post = $row[0]["last_post"]; $last_post = $row[0]["last_post"];
} }
$sql = "SELECT count(post_id) AS total FROM ".POSTS_TABLE." WHERE topic_id = $id"; $sql = "SELECT count(post_id) AS total FROM ".POSTS_TABLE." WHERE topic_id = $id";
if(!$result = $db->sql_query($sql)) if(!$result = $db->sql_query($sql))
{ {
@ -729,7 +728,7 @@ function theme_select($default)
global $db, $board_config, $lang; global $db, $board_config, $lang;
$sql = "SELECT themes_id, themes_name $sql = "SELECT themes_id, themes_name
FROM " . THEMES_TABLE . " FROM " . THEMES_TABLE . "
WHERE themes_name LIKE '" . $board_config['default_template'] . "-%' WHERE themes_name LIKE '" . $board_config['default_template'] . "-%'
ORDER BY themes_name"; ORDER BY themes_name";
if($result = $db->sql_query($sql)) if($result = $db->sql_query($sql))
@ -756,7 +755,7 @@ function theme_select($default)
} }
else else
{ {
$theme_select = "<select name=\"theme\"><option value=\"-1\">" . $lang['No_themes'] . "</option></select>"; $theme_select = "<select name=\"theme\"><option value=\"-1\">" . $lang['No_themes'] . "</option></select>";
} }
} }
else else
@ -832,7 +831,7 @@ function smilies_pass($message)
if(empty($smilies)) if(empty($smilies))
{ {
$sql = "SELECT code, smile_url $sql = "SELECT code, smile_url
FROM " . SMILIES_TABLE; FROM " . SMILIES_TABLE;
if($result = $db->sql_query($sql)) if($result = $db->sql_query($sql))
{ {

View file

@ -1,20 +1,29 @@
<?php <?php
/*************************************************************************** /***************************************************************************
* message.php * message.php
* ------------------- * -------------------
* begin : Saturday, Feb 13, 2001 * begin : Saturday, Feb 13, 2001
* copyright : (C) 2001 The phpBB Group * copyright : (C) 2001 The phpBB Group
* email : support@phpbb.com * 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.
*
***************************************************************************/
// //
// This function gets called to output any message or error // This function gets called to output any message or error
// that doesn't require additional output from the calling // that doesn't require additional output from the calling
// page. // page.
// //
// $msg_code takes one of four constant values: // $msg_code takes one of four constant values:
// //
@ -31,12 +40,12 @@
// board configuration data is available // board configuration data is available
// //
// CRITICAL_ERROR -> Used whenever a DB connection cannot be // CRITICAL_ERROR -> Used whenever a DB connection cannot be
// guaranteed and/or we've been unable to obtain basic board // guaranteed and/or we've been unable to obtain basic board
// configuration data. Shouldn't be used in general // 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) // 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 $db, $template, $board_config, $theme, $lang, $phpEx, $phpbb_root_path;
global $userdata, $user_ip, $session_length; global $userdata, $user_ip, $session_length;

View file

@ -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); define(HEADER_INC, TRUE);
// //
@ -31,14 +40,14 @@ if($board_config['gzip_compress'])
else if($phpver > "4.0") else if($phpver > "4.0")
{ {
if(strstr($HTTP_SERVER_VARS['HTTP_ACCEPT_ENCODING'], 'gzip')) if(strstr($HTTP_SERVER_VARS['HTTP_ACCEPT_ENCODING'], 'gzip'))
{ {
if(extension_loaded("zlib")) if(extension_loaded("zlib"))
{ {
$do_gzip_compress = TRUE; $do_gzip_compress = TRUE;
ob_start(); 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 // Get basic (usernames + totals) online
// situation // 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 FROM ".USERS_TABLE." u, ".SESSIONS_TABLE." s
WHERE u.user_id = s.session_user_id WHERE u.user_id = s.session_user_id
AND s.session_time >= ".( time() - 300 ); 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']) if($userdata['session_logged_in'])
{ {
$sql = "SELECT COUNT(privmsgs_type) AS new_messages $sql = "SELECT COUNT(privmsgs_type) AS new_messages
FROM " . PRIVMSGS_TABLE . " FROM " . PRIVMSGS_TABLE . "
WHERE privmsgs_type = " . PRIVMSGS_NEW_MAIL . " WHERE privmsgs_type = " . PRIVMSGS_NEW_MAIL . "
AND privmsgs_to_userid = " . $userdata['user_id']; AND privmsgs_to_userid = " . $userdata['user_id'];
$result_pm = $db->sql_query($sql); $result_pm = $db->sql_query($sql);
if(!$result_pm) if(!$result_pm)
@ -187,7 +196,7 @@ $template->assign_vars(array(
"L_PROFILE" => $lang['Profile'], "L_PROFILE" => $lang['Profile'],
"L_SEARCH" => $lang['Search'], "L_SEARCH" => $lang['Search'],
"L_PRIVATEMSGS" => $lang['Private_msgs'], "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_MEMBERLIST" => $lang['Memberlist'],
"L_FAQ" => $lang['FAQ'], "L_FAQ" => $lang['FAQ'],
"L_USERGROUPS" => $lang['Usergroups'], "L_USERGROUPS" => $lang['Usergroups'],
@ -202,7 +211,7 @@ $template->assign_vars(array(
"L_NEWPOSTS" => $lang['New_posts'], "L_NEWPOSTS" => $lang['New_posts'],
"L_NONEWPOSTS_HOT" => $lang['No_new_posts_hot'], "L_NONEWPOSTS_HOT" => $lang['No_new_posts_hot'],
"L_NEWPOSTS_HOT" => $lang['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_POSTED" => $lang['Posted'],
"L_JOINED" => $lang['Joined'], "L_JOINED" => $lang['Joined'],
"L_AUTO_LOGIN" => $lang['Log_me_in'], "L_AUTO_LOGIN" => $lang['Log_me_in'],
@ -240,21 +249,21 @@ $template->assign_vars(array(
"T_TR_COLOR1" => "#".$theme['tr_color1'], "T_TR_COLOR1" => "#".$theme['tr_color1'],
"T_TR_COLOR2" => "#".$theme['tr_color2'], "T_TR_COLOR2" => "#".$theme['tr_color2'],
"T_TR_COLOR3" => "#".$theme['tr_color3'], "T_TR_COLOR3" => "#".$theme['tr_color3'],
"T_TR_CLASS1" => $theme['tr_class1'], "T_TR_CLASS1" => $theme['tr_class1'],
"T_TR_CLASS2" => $theme['tr_class2'], "T_TR_CLASS2" => $theme['tr_class2'],
"T_TR_CLASS3" => $theme['tr_class3'], "T_TR_CLASS3" => $theme['tr_class3'],
"T_TH_COLOR1" => "#".$theme['th_color1'], "T_TH_COLOR1" => "#".$theme['th_color1'],
"T_TH_COLOR2" => "#".$theme['th_color2'], "T_TH_COLOR2" => "#".$theme['th_color2'],
"T_TH_COLOR3" => "#".$theme['th_color3'], "T_TH_COLOR3" => "#".$theme['th_color3'],
"T_TH_CLASS1" => $theme['th_class1'], "T_TH_CLASS1" => $theme['th_class1'],
"T_TH_CLASS2" => $theme['th_class2'], "T_TH_CLASS2" => $theme['th_class2'],
"T_TH_CLASS3" => $theme['th_class3'], "T_TH_CLASS3" => $theme['th_class3'],
"T_TD_COLOR1" => "#".$theme['td_color1'], "T_TD_COLOR1" => "#".$theme['td_color1'],
"T_TD_COLOR2" => "#".$theme['td_color2'], "T_TD_COLOR2" => "#".$theme['td_color2'],
"T_TD_COLOR3" => "#".$theme['td_color3'], "T_TD_COLOR3" => "#".$theme['td_color3'],
"T_TD_CLASS1" => $theme['td_class1'], "T_TD_CLASS1" => $theme['td_class1'],
"T_TD_CLASS2" => $theme['td_class2'], "T_TD_CLASS2" => $theme['td_class2'],
"T_TD_CLASS3" => $theme['td_class3'], "T_TD_CLASS3" => $theme['td_class3'],
"T_FONTFACE1" => $theme['fontface1'], "T_FONTFACE1" => $theme['fontface1'],
"T_FONTFACE2" => $theme['fontface2'], "T_FONTFACE2" => $theme['fontface2'],
"T_FONTFACE3" => $theme['fontface3'], "T_FONTFACE3" => $theme['fontface3'],
@ -264,8 +273,8 @@ $template->assign_vars(array(
"T_FONTCOLOR1" => "#".$theme['fontcolor1'], "T_FONTCOLOR1" => "#".$theme['fontcolor1'],
"T_FONTCOLOR2" => "#".$theme['fontcolor2'], "T_FONTCOLOR2" => "#".$theme['fontcolor2'],
"T_FONTCOLOR3" => "#".$theme['fontcolor3'], "T_FONTCOLOR3" => "#".$theme['fontcolor3'],
"T_SPAN_CLASS1" => $theme['span_class1'], "T_SPAN_CLASS1" => $theme['span_class1'],
"T_SPAN_CLASS2" => $theme['span_class2'], "T_SPAN_CLASS2" => $theme['span_class2'],
"T_SPAN_CLASS3" => $theme['span_class3']) "T_SPAN_CLASS3" => $theme['span_class3'])
); );

View file

@ -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. // Show the overall footer.
// //
@ -65,17 +74,17 @@ if($do_gzip_compress)
// //
// Borrowed from php.net! // Borrowed from php.net!
// //
$gzip_contents = ob_get_contents(); $gzip_contents = ob_get_contents();
ob_end_clean(); ob_end_clean();
$gzip_size = strlen($gzip_contents); $gzip_size = strlen($gzip_contents);
$gzip_crc = crc32($gzip_contents); $gzip_crc = crc32($gzip_contents);
$gzip_contents = gzcompress($gzip_contents, 9); $gzip_contents = gzcompress($gzip_contents, 9);
$gzip_contents = substr($gzip_contents, 0, strlen($gzip_contents) - 4); $gzip_contents = substr($gzip_contents, 0, strlen($gzip_contents) - 4);
echo "\x1f\x8b\x08\x00\x00\x00\x00\x00"; echo "\x1f\x8b\x08\x00\x00\x00\x00\x00";
echo $gzip_contents; echo $gzip_contents;
echo pack("V", $gzip_crc); echo pack("V", $gzip_crc);
echo pack("V", $gzip_size); echo pack("V", $gzip_size);
} }

View file

@ -1,18 +1,27 @@
<?php <?php
/*************************************************************************** /***************************************************************************
*
* -------------------
* begin : Saturday, Feb 13, 2001
* copyright : (C) 2001 The phpBB Group
* email : support@phpbb.com
* *
* -------------------
* begin : Saturday, Feb 13, 2001
* copyright : (C) 2001 The phpBB Group
* email : support@phpbb.com
*
* $Id$ * $Id$
* *
* *
***************************************************************************/ ***************************************************************************/
/***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
***************************************************************************/
// //
// This function will prepare a posted message for // This function will prepare a posted message for
// entry into the database. // entry into the database.
// //
function prepare_message($message, $html_on, $bbcode_on, $smile_on, $bbcode_uid = 0) function prepare_message($message, $html_on, $bbcode_on, $smile_on, $bbcode_uid = 0)
@ -53,7 +62,7 @@ function prepare_message($message, $html_on, $bbcode_on, $smile_on, $bbcode_uid
} }
} }
if($length && !$tagallowed) if($length && !$tagallowed)
{ {
$message = str_replace(substr($message, $start, $length), htmlspecialchars(substr($message, $start, $length)), $message); $message = str_replace(substr($message, $start, $length), htmlspecialchars(substr($message, $start, $length)), $message);
} }

View file

@ -1,29 +1,38 @@
<?php <?php
/*************************************************************************** /***************************************************************************
* prune.php * prune.php
* ------------------- * -------------------
* begin : Thursday, June 14, 2001 * begin : Thursday, June 14, 2001
* copyright : (C) 2001 The phpBB Group * copyright : (C) 2001 The phpBB Group
* email : support@phpbb.com * 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.
*
***************************************************************************/
function prune($forum_id, $prune_date) function prune($forum_id, $prune_date)
{ {
global $db, $lang; global $db, $lang;
$sql = "SELECT t.topic_id $sql = "SELECT t.topic_id
FROM " . POSTS_TABLE . " p, " . TOPICS_TABLE . " t FROM " . POSTS_TABLE . " p, " . TOPICS_TABLE . " t
WHERE t.forum_id = $forum_id WHERE t.forum_id = $forum_id
AND t.topic_type = " . POST_NORMAL . " AND t.topic_type = " . POST_NORMAL . "
AND p.post_id = t.topic_last_post_id"; AND p.post_id = t.topic_last_post_id";
// Do we want to delete everything in the forum? // Do we want to delete everything in the forum?
if ($prune_date != FALSE) if ($prune_date != FALSE)
{ {
$sql .= " AND p.post_time < $prune_date"; $sql .= " AND p.post_time < $prune_date";
} }
if(!$result_topics = $db->sql_query($sql)) if(!$result_topics = $db->sql_query($sql))
{ {
@ -31,15 +40,15 @@ function prune($forum_id, $prune_date)
} }
$pruned_topics = $db->sql_numrows($result_topics); $pruned_topics = $db->sql_numrows($result_topics);
$sql = "SELECT p.post_id $sql = "SELECT p.post_id
FROM " . POSTS_TABLE . " p, " . TOPICS_TABLE . " t FROM " . POSTS_TABLE . " p, " . TOPICS_TABLE . " t
WHERE p.forum_id = $forum_id WHERE p.forum_id = $forum_id
AND t.topic_id = p.topic_id AND t.topic_id = p.topic_id
AND t.topic_type = " . POST_NORMAL; AND t.topic_type = " . POST_NORMAL;
// Do we want to delete everything in the forum? // Do we want to delete everything in the forum?
if ($prune_date != FALSE) 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)) 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_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)) if(!$result = $db->sql_query($sql_post_text, BEGIN_TRANSACTION))
{ {
@ -110,8 +119,8 @@ function prune($forum_id, $prune_date)
} }
} }
$sql = "UPDATE " . FORUMS_TABLE . " $sql = "UPDATE " . FORUMS_TABLE . "
SET forum_topics = forum_topics - $pruned_topics, forum_posts = forum_posts - $pruned_posts SET forum_topics = forum_topics - $pruned_topics, forum_posts = forum_posts - $pruned_posts
WHERE forum_id = $forum_id"; WHERE forum_id = $forum_id";
if(!$result = $db->sql_query($sql)) if(!$result = $db->sql_query($sql))
{ {
@ -138,10 +147,10 @@ function auto_prune($forum_id = 0)
$one_day = 60 * 60 * 24; $one_day = 60 * 60 * 24;
$sql = "SELECT * $sql = "SELECT *
FROM " . PRUNE_TABLE . " FROM " . PRUNE_TABLE . "
WHERE forum_id = $forum_id"; WHERE forum_id = $forum_id";
if(!$result = $db->sql_query($sql)) if(!$result = $db->sql_query($sql))
{ {
message_die(GENERAL_ERROR, "Auto-Prune: Couldn't read auto_prune table.", __LINE__, __FILE__); message_die(GENERAL_ERROR, "Auto-Prune: Couldn't read auto_prune table.", __LINE__, __FILE__);

View file

@ -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() // session_begin()
// //

View file

@ -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 * This script should be included if the admin has configured the board for
* smtp mail instead of standard sendmail. It includes a function smtpmail * 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 * Description: This funtion processes the smtp server's response codes
* Usage: This function is only used interanally by the smtpmail * Usage: This function is only used interanally by the smtpmail
* function. It takes two arguments the first a socket pointer * 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. * response code you are looking for.
****************************************************************************/ ****************************************************************************/
function server_parse($socket, $response) function server_parse($socket, $response)
@ -38,19 +47,19 @@ function server_parse($socket, $response)
/**************************************************************************** /****************************************************************************
* Function: smtpmail * 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. * function, that uses smtp.
* Usage: The usage for this function is identical to that of php's * Usage: The usage for this function is identical to that of php's
* built in mail function. * 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 // For now I'm using an array based $smtp_vars to hold the smtp server
// info, but it should probably change to $board_config... // 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']. // $board_config['smtp_port'].
global $board_config; global $board_config;
// //
// Fix any bare linefeeds in the message to make it RFC821 Compliant. // 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) if(sizeof($headers) > 1)
{ {
$headers = join("\r\n", $headers); $headers = join("\r\n", $headers);
} }
else else
{ {
$headers = $headers[0]; $headers = $headers[0];
@ -71,7 +80,7 @@ function smtpmail($mail_to, $subject, $message, $headers = "")
} }
$headers = chop($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); $headers = ereg_replace("[^\r]\n", "\r\n", $headers);
} }
if(trim($mail_to) == "") 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__); message_die(GENERAL_ERROR, "Could not connect to smtp host : $errno : $errstr", "", __LINE__, __FILE__);
} }
server_parse($socket, "220"); server_parse($socket, "220");
// Send the RFC821 specified HELO. // Send the RFC821 specified HELO.
fputs($socket, "HELO " . $board_config['smtp_host'] . "\r\n"); fputs($socket, "HELO " . $board_config['smtp_host'] . "\r\n");
// From this point onward most server response codes should be 250 // From this point onward most server response codes should be 250
server_parse($socket, "250"); server_parse($socket, "250");
// Specify who the mail is from.... // Specify who the mail is from....
fputs($socket, "MAIL FROM: $email_from\r\n"); fputs($socket, "MAIL FROM: $email_from\r\n");
server_parse($socket, "250"); server_parse($socket, "250");
@ -116,10 +125,10 @@ function smtpmail($mail_to, $subject, $message, $headers = "")
server_parse($socket, "250"); server_parse($socket, "250");
$to_header .= "<$mail_to_address>, "; $to_header .= "<$mail_to_address>, ";
} }
// Ok now we tell the server we are ready to start sending data // Ok now we tell the server we are ready to start sending data
fputs($socket, "DATA\r\n"); fputs($socket, "DATA\r\n");
// This is the last response code we look for until the end of the message. // This is the last response code we look for until the end of the message.
server_parse($socket, "354"); server_parse($socket, "354");
@ -131,7 +140,7 @@ function smtpmail($mail_to, $subject, $message, $headers = "")
// Now any custom headers.... // Now any custom headers....
fputs($socket, "$headers\r\n\r\n"); fputs($socket, "$headers\r\n\r\n");
// Ok now we are ready for the message... // Ok now we are ready for the message...
fputs($socket, "$message\r\n"); fputs($socket, "$message\r\n");

View file

@ -1,21 +1,30 @@
<?php <?php
/*************************************************************************** /***************************************************************************
* template.inc * template.inc
* ------------------- * -------------------
* begin : Saturday, Feb 13, 2001 * begin : Saturday, Feb 13, 2001
* copyright : (C) 2001 The phpBB Group * copyright : (C) 2001 The phpBB Group
* email : support@phpbb.com * 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.
*
***************************************************************************/
/** /**
* Template class. By Nathan Codding of the phpBB group. * Template class. By Nathan Codding of the phpBB group.
* The interface was originally inspired by PHPLib templates, * The interface was originally inspired by PHPLib templates,
* and the template file formats are quite similar. * and the template file formats are quite similar.
* *
*/ */
class Template { class Template {
@ -29,24 +38,24 @@ class Template {
// if it's a root-level variable, it'll be like this: // if it's a root-level variable, it'll be like this:
// $this->_tpldata[.][0][varname] == value // $this->_tpldata[.][0][varname] == value
var $_tpldata = array(); var $_tpldata = array();
// Hash of filenames for each template handle. // Hash of filenames for each template handle.
var $files = array(); var $files = array();
// Root template directory. // Root template directory.
var $root = ""; var $root = "";
// this will hash handle names to the compiled code for that handle. // this will hash handle names to the compiled code for that handle.
var $compiled_code = array(); var $compiled_code = array();
// This will hold the uncompiled code for that handle. // This will hold the uncompiled code for that handle.
var $uncompiled_code = array(); var $uncompiled_code = array();
/** /**
* Constructor. Simply sets the root dir. * Constructor. Simply sets the root dir.
* *
*/ */
function Template($root = ".") function Template($root = ".")
{ {
$this->set_rootdir($root); $this->set_rootdir($root);
} }
@ -62,39 +71,39 @@ class Template {
/** /**
* Sets the template root directory for this Template object. * 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; return false;
} }
$this->root = $dir; $this->root = $dir;
return true; return true;
} }
/** /**
* Sets the template filenames for handles. $filename_array * Sets the template filenames for handles. $filename_array
* should be a hash of handle => filename pairs. * should be a hash of handle => filename pairs.
*/ */
function set_filenames($filename_array) function set_filenames($filename_array)
{ {
if (!is_array($filename_array)) if (!is_array($filename_array))
{ {
return false; return false;
} }
reset($filename_array); reset($filename_array);
while(list($handle, $filename) = each($filename_array)) while(list($handle, $filename) = each($filename_array))
{ {
$this->files[$handle] = $this->make_filename($filename); $this->files[$handle] = $this->make_filename($filename);
} }
return true; return true;
} }
/** /**
* Load the file for the handle, compile the file, * Load the file for the handle, compile the file,
* and run the compiled code. This will print out * and run the compiled code. This will print out
@ -104,26 +113,26 @@ class Template {
{ {
if (!$this->loadfile($handle)) 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. // actually compile the template now.
if (!isset($this->compiled_code[$handle]) || empty($this->compiled_code[$handle])) if (!isset($this->compiled_code[$handle]) || empty($this->compiled_code[$handle]))
{ {
// Actually compile the code now. // Actually compile the code now.
$this->compiled_code[$handle] = $this->compile($this->uncompiled_code[$handle]); $this->compiled_code[$handle] = $this->compile($this->uncompiled_code[$handle]);
} }
// Run the compiled code. // Run the compiled code.
eval($this->compiled_code[$handle]); eval($this->compiled_code[$handle]);
return true; return true;
} }
/** /**
* Inserts the uncompiled code for $handle as the * Inserts the uncompiled code for $handle as the
* value of $varname in the root-level. This can be used * 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. * template.
* Note that all desired assignments to the variables in $handle should be done * Note that all desired assignments to the variables in $handle should be done
* BEFORE calling this function. * BEFORE calling this function.
@ -132,33 +141,33 @@ class Template {
{ {
if (!$this->loadfile($handle)) 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. // Compile it, with the "no echo statements" option on.
$code = $this->compile($this->uncompiled_code[$handle], true); $code = $this->compile($this->uncompiled_code[$handle], true);
// turn it into a variable assignment. // turn it into a variable assignment.
$code = '$_str = \'' . $code . '\';'; $code = '$_str = \'' . $code . '\';';
// evaluate the variable assignment. // evaluate the variable assignment.
eval($code); eval($code);
// assign the value of the generated variable to the given varname. // assign the value of the generated variable to the given varname.
$this->assign_var($varname, $_str); $this->assign_var($varname, $_str);
return true; return true;
} }
/** /**
* Block-level variable assignment. Adds a new block iteration with the given * 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. * iteration.
*/ */
function assign_block_vars($blockname, $vararray) function assign_block_vars($blockname, $vararray)
{ {
if (strstr($blockname, '.')) if (strstr($blockname, '.'))
{ {
// Nested block. // Nested block.
$blocks = explode('.', $blockname); $blocks = explode('.', $blockname);
$blockcount = sizeof($blocks) - 1; $blockcount = sizeof($blocks) - 1;
$str = '$this->_tpldata'; $str = '$this->_tpldata';
@ -172,7 +181,7 @@ class Template {
// We're adding a new iteration to this block with the given // We're adding a new iteration to this block with the given
// variable assignments. // variable assignments.
$str .= '[\'' . $blocks[$blockcount] . '.\'][] = $vararray;'; $str .= '[\'' . $blocks[$blockcount] . '.\'][] = $vararray;';
// Now we evaluate this assignment we've built up. // Now we evaluate this assignment we've built up.
eval($str); eval($str);
} }
@ -183,10 +192,10 @@ class Template {
// we were given. // we were given.
$this->_tpldata[$blockname . '.'][] = $vararray; $this->_tpldata[$blockname . '.'][] = $vararray;
} }
return true; return true;
} }
/** /**
* Root-level variable assignment. Adds to current assignments, overriding * Root-level variable assignment. Adds to current assignments, overriding
* any existing variable assignment with the same name. * any existing variable assignment with the same name.
@ -196,12 +205,12 @@ class Template {
reset ($vararray); reset ($vararray);
while (list($key, $val) = each($vararray)) while (list($key, $val) = each($vararray))
{ {
$this->_tpldata['.'][0][$key] = $val; $this->_tpldata['.'][0][$key] = $val;
} }
return true; return true;
} }
/** /**
* Root-level variable assignment. Adds to current assignments, overriding * Root-level variable assignment. Adds to current assignments, overriding
* any existing variable assignment with the same name. * any existing variable assignment with the same name.
@ -209,38 +218,38 @@ class Template {
function assign_var($varname, $varval) function assign_var($varname, $varval)
{ {
$this->_tpldata['.'][0][$varname] = $varval; $this->_tpldata['.'][0][$varname] = $varval;
return true; return true;
} }
/** /**
* Generates a full path+filename for the given filename, which can either * 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 * be an absolute name, or a name relative to the rootdir for this Template
* object. * object.
*/ */
function make_filename($filename) function make_filename($filename)
{ {
// Check if it's an absolute or relative path. // Check if it's an absolute or relative path.
if (substr($filename, 0, 1) != '/') if (substr($filename, 0, 1) != '/')
{ {
$filename = $this->root . '/' . $filename; $filename = $this->root . '/' . $filename;
} }
if (!file_exists($filename)) if (!file_exists($filename))
{ {
die("Template->make_filename(): Error - file $filename does not exist"); die("Template->make_filename(): Error - file $filename does not exist");
} }
return $filename; return $filename;
} }
/** /**
* If not already done, load the file for the given handle and populate * If not already done, load the file for the given handle and populate
* the uncompiled_code[] hash with its code. Do not compile. * 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 the file for this handle is already loaded and compiled, do nothing.
if (isset($this->uncompiled_code[$handle]) && !empty($this->uncompiled_code[$handle])) 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 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"); die("Template->loadfile(): No file specified for handle $handle");
} }
$filename = $this->files[$handle]; $filename = $this->files[$handle];
$str = implode("", @file($filename)); $str = implode("", @file($filename));
if (empty($str)) if (empty($str))
{ {
die("Template->loadfile(): File $filename for handle $handle is empty"); die("Template->loadfile(): File $filename for handle $handle is empty");
} }
$this->uncompiled_code[$handle] = $str; $this->uncompiled_code[$handle] = $str;
return true; return true;
} }
/** /**
* Compiles the given string of code, and returns * Compiles the given string of code, and returns
* the result in a string. * the result in a string.
* If "do_not_echo" is true, the returned code will not be directly * 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(). * for use in assign_code_from_handle().
*/ */
function compile($code, $do_not_echo = false) function compile($code, $do_not_echo = false)
@ -281,9 +290,9 @@ class Template {
// replace \ with \\ and then ' with \'. // replace \ with \\ and then ' with \'.
$code = str_replace('\\', '\\\\', $code); $code = str_replace('\\', '\\\\', $code);
$code = str_replace('\'', '\\\'', $code); $code = str_replace('\'', '\\\'', $code);
// change template varrefs into PHP varrefs // change template varrefs into PHP varrefs
// This one will handle varrefs WITH namespaces // This one will handle varrefs WITH namespaces
$varrefs = array(); $varrefs = array();
preg_match_all('#\{(([a-z0-9\-_]+?\.)+?)([a-z0-9\-_]+?)\}#is', $code, $varrefs); preg_match_all('#\{(([a-z0-9\-_]+?\.)+?)([a-z0-9\-_]+?)\}#is', $code, $varrefs);
@ -293,20 +302,20 @@ class Template {
$namespace = $varrefs[1][$i]; $namespace = $varrefs[1][$i];
$varname = $varrefs[3][$i]; $varname = $varrefs[3][$i];
$new = $this->generate_block_varref($namespace, $varname); $new = $this->generate_block_varref($namespace, $varname);
$code = str_replace($varrefs[0][$i], $new, $code); $code = str_replace($varrefs[0][$i], $new, $code);
} }
// This will handle the remaining root-level varrefs // This will handle the remaining root-level varrefs
$code = preg_replace('#\{([a-z0-9\-_]*?)\}#is', '\' . $this->_tpldata[\'.\'][0][\'\1\'] . \'', $code); $code = preg_replace('#\{([a-z0-9\-_]*?)\}#is', '\' . $this->_tpldata[\'.\'][0][\'\1\'] . \'', $code);
// Break it up into lines. // Break it up into lines.
$code_lines = explode("\n", $code); $code_lines = explode("\n", $code);
$block_nesting_level = 0; $block_nesting_level = 0;
$block_names = array(); $block_names = array();
$block_names[0] = "."; $block_names[0] = ".";
// Second: prepend echo ', append ' . "\n"; to each line. // Second: prepend echo ', append ' . "\n"; to each line.
$line_count = sizeof($code_lines); $line_count = sizeof($code_lines);
for ($i = 0; $i < $line_count; $i++) for ($i = 0; $i < $line_count; $i++)
@ -332,12 +341,12 @@ class Template {
else else
{ {
// This block is nested. // This block is nested.
// Generate a namespace string for this block. // Generate a namespace string for this block.
$namespace = implode('.', $block_names); $namespace = implode('.', $block_names);
// strip leading period from root level.. // strip leading period from root level..
$namespace = substr($namespace, 2); $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. // current indices of all parent blocks.
$varref = $this->generate_block_data_ref($namespace, false); $varref = $this->generate_block_data_ref($namespace, false);
// Create the for loop code to iterate over this block. // 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" . 'for ($_' . $n[1] . '_i = 0; $_' . $n[1] . '_i < $_' . $n[1] . '_count; $_' . $n[1] . '_i++)';
$code_lines[$i] .= "\n" . '{'; $code_lines[$i] .= "\n" . '{';
} }
// We have the end of a block. // We have the end of a block.
unset($block_names[$block_nesting_level]); unset($block_names[$block_nesting_level]);
$block_nesting_level--; $block_nesting_level--;
@ -368,19 +377,19 @@ class Template {
else else
{ {
// This block is nested. // This block is nested.
// Generate a namespace string for this block. // Generate a namespace string for this block.
$namespace = implode('.', $block_names); $namespace = implode('.', $block_names);
// strip leading period from root level.. // strip leading period from root level..
$namespace = substr($namespace, 2); $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. // current indices of all parent blocks.
$varref = $this->generate_block_data_ref($namespace, false); $varref = $this->generate_block_data_ref($namespace, false);
// Create the for loop code to iterate over this block. // Create the for loop code to iterate over this block.
$code_lines[$i] = '$_' . $m[1] . '_count = sizeof(' . $varref . ');'; $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" . 'for ($_' . $m[1] . '_i = 0; $_' . $m[1] . '_i < $_' . $m[1] . '_count; $_' . $m[1] . '_i++)';
$code_lines[$i] .= "\n" . '{'; $code_lines[$i] .= "\n" . '{';
} }
} }
} }
else if (preg_match('#<!-- END (.*?) -->#', $code_lines[$i], $m)) else if (preg_match('#<!-- END (.*?) -->#', $code_lines[$i], $m))
@ -399,14 +408,14 @@ class Template {
} }
} }
} }
// Bring it back into a single string of lines of code. // Bring it back into a single string of lines of code.
$code = implode("\n", $code_lines); $code = implode("\n", $code_lines);
return $code ; return $code ;
} }
/** /**
* Generates a reference to the given variable inside the given (possibly nested) * Generates a reference to the given variable inside the given (possibly nested)
* block namespace. This is a string of the form: * block namespace. This is a string of the form:
@ -418,21 +427,21 @@ class Template {
{ {
// Strip the trailing period. // Strip the trailing period.
$namespace = substr($namespace, 0, strlen($namespace) - 1); $namespace = substr($namespace, 0, strlen($namespace) - 1);
// Get a reference to the data block for this namespace. // Get a reference to the data block for this namespace.
$varref = $this->generate_block_data_ref($namespace, true); $varref = $this->generate_block_data_ref($namespace, true);
// Prepend the necessary code to stick this in an echo line. // Prepend the necessary code to stick this in an echo line.
$varref = '\' . ' . $varref; $varref = '\' . ' . $varref;
// Append the variable reference. // Append the variable reference.
$varref .= '[\'' . $varname . '\'] . \''; $varref .= '[\'' . $varname . '\'] . \'';
return $varref; 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: * (possibly nested) block namespace. This is a string of the form:
* $this->_tpldata['parent'][$_parent_i]['$child1'][$_child1_i]['$child2'][$_child2_i]...['$childN'] * $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. // Build up the string with everything but the last child.
for ($i = 0; $i < $blockcount; $i++) 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. // Add the block reference for the last child.
$varref .= '[\'' . $blocks[$blockcount] . '.\']'; $varref .= '[\'' . $blocks[$blockcount] . '.\']';
@ -457,7 +466,7 @@ class Template {
{ {
$varref .= '[$_' . $blocks[$blockcount] . '_i]'; $varref .= '[$_' . $blocks[$blockcount] . '_i]';
} }
return $varref; return $varref;
} }

View file

@ -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 = "./"; $phpbb_root_path = "./";
include($phpbb_root_path . 'extension.inc'); include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx); 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 " : ""; $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 $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 WHERE f.forum_last_post_id = p.post_id
AND p.post_id = t.topic_last_post_id AND p.post_id = t.topic_last_post_id
AND p.poster_id = u.user_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 " : ""; $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 $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(+) WHERE f.forum_last_post_id = p.post_id(+)
AND p.post_id = t.topic_last_post_id(+) AND p.post_id = t.topic_last_post_id(+)
AND p.poster_id = u.user_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); $forum_rows = $db->sql_fetchrowset($q_forums);
$sql = "SELECT f.forum_id, t.topic_id, p.post_time $sql = "SELECT f.forum_id, t.topic_id, p.post_time
FROM " . FORUMS_TABLE . " f, " . TOPICS_TABLE . " t, " . POSTS_TABLE . " p FROM " . FORUMS_TABLE . " f, " . TOPICS_TABLE . " t, " . POSTS_TABLE . " p
WHERE t.forum_id = f.forum_id WHERE t.forum_id = f.forum_id
AND p.post_id = t.topic_last_post_id AND p.post_id = t.topic_last_post_id
AND p.post_time > " . $userdata['session_last_visit']; AND p.post_time > " . $userdata['session_last_visit'];
if(!$new_topic_ids = $db->sql_query($sql)) 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 // 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 $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 FROM " . AUTH_ACCESS_TABLE . " aa, " . USER_GROUP_TABLE . " ug, " . GROUPS_TABLE . " g, " . USERS_TABLE . " u
WHERE aa.auth_mod = " . TRUE . " WHERE aa.auth_mod = " . TRUE . "
AND ug.group_id = aa.group_id AND ug.group_id = aa.group_id
AND g.group_id = aa.group_id AND g.group_id = aa.group_id
AND u.user_id = ug.user_id AND u.user_id = ug.user_id
ORDER BY aa.forum_id, g.group_id, u.user_id"; ORDER BY aa.forum_id, g.group_id, u.user_id";
if(!$q_forum_mods = $db->sql_query($sql)) if(!$q_forum_mods = $db->sql_query($sql))
{ {
message_die(GENERAL_ERROR, "Could not query forum moderator information", "", __LINE__, __FILE__, $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, "NEWEST_UID" => $newest_uid,
"USERS_BROWSING" => $users_browsing, "USERS_BROWSING" => $users_browsing,
"L_FORUM_LOCKED" => $lang['Forum_is_locked'], "L_FORUM_LOCKED" => $lang['Forum_is_locked'],
"L_MARK_FORUMS_READ" => $lang['Mark_all_forums'], "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&amp;" . POST_USERS_URL . "=$newest_uid")) "U_NEWEST_USER_PROFILE" => append_sid("profile.$phpEx?mode=viewprofile&amp;" . POST_USERS_URL . "=$newest_uid"))
); );
@ -310,7 +319,7 @@ if($total_categories = $db->sql_numrows($q_categories))
{ {
$moderators_links .= "<a href=\"" . append_sid("profile.$phpEx?mode=viewprofile&amp;" . POST_USERS_URL . "=" . $forum_mods_id[$forum_id][$mods]) . "\">" . $forum_mods_name[$forum_id][$mods] . "</a>"; $moderators_links .= "<a href=\"" . append_sid("profile.$phpEx?mode=viewprofile&amp;" . POST_USERS_URL . "=" . $forum_mods_id[$forum_id][$mods]) . "\">" . $forum_mods_name[$forum_id][$mods] . "</a>";
} }
else else
{ {
$moderators_links .= "<a href=\"" . append_sid("groupcp.$phpEx?" . POST_GROUPS_URL . "=" . $forum_mods_id[$forum_id][$mods]) . "\">" . $forum_mods_name[$forum_id][$mods] . "</a>"; $moderators_links .= "<a href=\"" . append_sid("groupcp.$phpEx?" . POST_GROUPS_URL . "=" . $forum_mods_id[$forum_id][$mods]) . "\">" . $forum_mods_name[$forum_id][$mods] . "</a>";
} }
@ -329,7 +338,7 @@ if($total_categories = $db->sql_numrows($q_categories))
$template->assign_block_vars("catrow.forumrow", array( $template->assign_block_vars("catrow.forumrow", array(
"ROW_COLOR" => "#" . $row_color, "ROW_COLOR" => "#" . $row_color,
"ROW_CLASS" => $row_class, "ROW_CLASS" => $row_class,
"FOLDER" => $folder_image, "FOLDER" => $folder_image,
"FORUM_NAME" => stripslashes($forum_rows[$j]['forum_name']), "FORUM_NAME" => stripslashes($forum_rows[$j]['forum_name']),
"FORUM_DESC" => stripslashes($forum_rows[$j]['forum_desc']), "FORUM_DESC" => stripslashes($forum_rows[$j]['forum_desc']),

View file

@ -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: // The future format of this file will be:
// //

View file

@ -1,15 +1,24 @@
<?php <?php
/*************************************************************************** /***************************************************************************
* login.php * login.php
* ------------------- * -------------------
* begin : Saturday, Feb 13, 2001 * begin : Saturday, Feb 13, 2001
* copyright : (C) 2001 The phpBB Group * copyright : (C) 2001 The phpBB Group
* email : support@phpbb.com * 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.
*
***************************************************************************/
$phpbb_root_path = "./"; $phpbb_root_path = "./";
include($phpbb_root_path . 'extension.inc'); include($phpbb_root_path . 'extension.inc');
@ -40,12 +49,12 @@ if(isset($HTTP_POST_VARS['submit']) || isset($HTTP_GET_VARS['submit']))
{ {
message_die(GENERAL_ERROR, "Error in obtaining userdata : login", __LINE__, __FILE__, $sql); message_die(GENERAL_ERROR, "Error in obtaining userdata : login", __LINE__, __FILE__, $sql);
} }
$rowresult = $db->sql_fetchrow($result); $rowresult = $db->sql_fetchrow($result);
if(count($rowresult)) if(count($rowresult))
{ {
if((md5($password) == $rowresult['user_password']) && $rowresult['user_active'] != 0) if((md5($password) == $rowresult['user_password']) && $rowresult['user_active'] != 0)
{ {
$autologin = (isset($HTTP_POST_VARS['autologin'])) ? TRUE : FALSE; $autologin = (isset($HTTP_POST_VARS['autologin'])) ? TRUE : FALSE;
$session_id = session_begin($rowresult['user_id'], $user_ip, PAGE_INDEX, $session_length, TRUE, $autologin); $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'])) if(isset($HTTP_POST_VARS['forward_page']) || isset($HTTP_GET_VARS['forward_page']))
{ {
$forward_to = $HTTP_SERVER_VARS['QUERY_STRING']; $forward_to = $HTTP_SERVER_VARS['QUERY_STRING'];
if(preg_match("/^forward_page=(.*)(&sid=[0-9]*)$|^forward_page=(.*)$/si", $forward_to, $forward_matches)) 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]; $forward_to = ($forward_matches[3]) ? $forward_matches[3] : $forward_matches[1];
@ -153,7 +162,7 @@ else
} }
$username = ($userdata['user_id'] != ANONYMOUS) ? $userdata['username'] : ""; $username = ($userdata['user_id'] != ANONYMOUS) ? $userdata['username'] : "";
$template->assign_vars(array( $template->assign_vars(array(
"FORWARD_PAGE" => $forward_page, "FORWARD_PAGE" => $forward_page,
"USERNAME" => $username, "USERNAME" => $username,

View file

@ -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 = "./"; $phpbb_root_path = "./";
include($phpbb_root_path . 'extension.inc'); include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx); include($phpbb_root_path . 'common.'.$phpEx);
@ -82,9 +91,9 @@ else
{ {
$order_by = "user_regdate $sort_order LIMIT $start, " . $board_config['topics_per_page']; $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 $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 . " FROM " . USERS_TABLE . "
WHERE user_id <> " . ANONYMOUS . " WHERE user_id <> " . ANONYMOUS . "
ORDER BY $order_by"; ORDER BY $order_by";
// //
@ -128,32 +137,32 @@ if(($selected_members = $db->sql_numrows($result)) > 0)
$jumpbox = make_jumpbox(); $jumpbox = make_jumpbox();
$template->assign_vars(array( $template->assign_vars(array(
"L_GO" => $lang['Go'], "L_GO" => $lang['Go'],
"L_JUMP_TO" => $lang['Jump_to'], "L_JUMP_TO" => $lang['Jump_to'],
"L_SELECT_FORUM" => $lang['Select_forum'], "L_SELECT_FORUM" => $lang['Select_forum'],
"JUMPBOX_LIST" => $jumpbox, "JUMPBOX_LIST" => $jumpbox,
"SELECT_NAME" => POST_FORUM_URL) "SELECT_NAME" => POST_FORUM_URL)
); );
$template->assign_var_from_handle("JUMPBOX", "jumpbox"); $template->assign_var_from_handle("JUMPBOX", "jumpbox");
$template->assign_vars(array( $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_EMAIL" => $lang['Email'],
"L_WEBSITE" => $lang['Website'], "L_WEBSITE" => $lang['Website'],
"L_FROM" => $lang['From'], "L_FROM" => $lang['From'],
"L_ORDER" => $lang['Order'], "L_ORDER" => $lang['Order'],
"L_SORT" => $lang['Sort'], "L_SORT" => $lang['Sort'],
"L_SUBMIT" => $lang['Sort'], "L_SUBMIT" => $lang['Sort'],
"L_AIM" => $lang['AIM'], "L_AIM" => $lang['AIM'],
"L_YIM" => $lang['YIM'], "L_YIM" => $lang['YIM'],
"L_MSNM" => $lang['MSNM'], "L_MSNM" => $lang['MSNM'],
"L_ICQ" => $lang['ICQ'], "L_ICQ" => $lang['ICQ'],
"S_MODE_SELECT" => $select_sort_mode, "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")) "S_MODE_ACTION" => append_sid("memberlist.$phpEx"))
); );
$members = $db->sql_fetchrowset($result); $members = $db->sql_fetchrowset($result);
for($i = 0; $i < $selected_members; $i++) 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']); $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; $posts = ($members[$i]['user_posts']) ? $members[$i]['user_posts'] : 0;
if($members[$i]['user_avatar'] != "" && $user_id != ANONYMOUS) if($members[$i]['user_avatar'] != "" && $user_id != ANONYMOUS)
{ {
$poster_avatar = (strstr("http", $members[$i]['user_avatar']) && $board_config['allow_avatar_remote']) ? "<img src=\"" . $members[$i]['user_avatar'] . "\" alt=\"\" />" : "<img src=\"" . $board_config['avatar_path'] . "/" . $members[$i]['user_avatar'] . "\" alt=\"\" />"; $poster_avatar = (strstr("http", $members[$i]['user_avatar']) && $board_config['allow_avatar_remote']) ? "<img src=\"" . $members[$i]['user_avatar'] . "\" alt=\"\" />" : "<img src=\"" . $board_config['avatar_path'] . "/" . $members[$i]['user_avatar'] . "\" alt=\"\" />";
@ -187,7 +196,7 @@ if(($selected_members = $db->sql_numrows($result)) > 0)
} }
$pm_img = "<a href=\"" . append_sid("privmsg.$phpEx?mode=post&amp;" . POST_USERS_URL . "=" . $members[$i]['user_id']) . "\"><img src=\"" . $images['icon_pm'] . "\" border=\"0\" alt=\"" . $lang['Send_private_message'] . "\" /></a>"; $pm_img = "<a href=\"" . append_sid("privmsg.$phpEx?mode=post&amp;" . POST_USERS_URL . "=" . $members[$i]['user_id']) . "\"><img src=\"" . $images['icon_pm'] . "\" border=\"0\" alt=\"" . $lang['Send_private_message'] . "\" /></a>";
if($members[$i]['user_website'] != "") if($members[$i]['user_website'] != "")
{ {
$www_img = "<a href=\"" . stripslashes($members[$i]['user_website']) . "\" target=\"_userwww\"><img src=\"" . $images['icon_www'] . "\" border=\"0\" alt=\"" . $lang['Visit_website'] . "\" /></a>"; $www_img = "<a href=\"" . stripslashes($members[$i]['user_website']) . "\" target=\"_userwww\"><img src=\"" . $images['icon_www'] . "\" border=\"0\" alt=\"" . $lang['Visit_website'] . "\" /></a>";
@ -221,32 +230,32 @@ if(($selected_members = $db->sql_numrows($result)) > 0)
$row_class = (!($i % 2)) ? $theme['td_class1'] : $theme['td_class2']; $row_class = (!($i % 2)) ? $theme['td_class1'] : $theme['td_class2'];
$template->assign_block_vars("memberrow", array( $template->assign_block_vars("memberrow", array(
"U_VIEWPROFILE" => append_sid("profile.$phpEx?mode=viewprofile&amp;" . POST_USERS_URL . "=" . $user_id), "U_VIEWPROFILE" => append_sid("profile.$phpEx?mode=viewprofile&amp;" . POST_USERS_URL . "=" . $user_id),
"ROW_COLOR" => $row_color, "ROW_COLOR" => $row_color,
"ROW_CLASS" => $row_class, "ROW_CLASS" => $row_class,
"USERNAME" => $username, "USERNAME" => $username,
"FROM" => $from, "FROM" => $from,
"JOINED" => $joined, "JOINED" => $joined,
"POSTS" => $posts, "POSTS" => $posts,
"AVATAR_IMG" => $poster_avatar, "AVATAR_IMG" => $poster_avatar,
"EMAIL_IMG" => $email_img, "EMAIL_IMG" => $email_img,
"PM_IMG" => $pm_img, "PM_IMG" => $pm_img,
"WWW_IMG" => $www_img, "WWW_IMG" => $www_img,
"ICQ_STATUS_IMG" => $icq_status_img, "ICQ_STATUS_IMG" => $icq_status_img,
"ICQ_ADD_IMG" => $icq_add_img, "ICQ_ADD_IMG" => $icq_add_img,
"AIM_IMG" => $aim_img, "AIM_IMG" => $aim_img,
"YIM_IMG" => $yim_img, "YIM_IMG" => $yim_img,
"MSN_IMG" => $msn_img, "MSN_IMG" => $msn_img,
"SEARCH_IMG" => $search) "SEARCH_IMG" => $search)
); );
} }
if($mode != "topten" || $board_config['topics_per_page'] < 10) if($mode != "topten" || $board_config['topics_per_page'] < 10)
{ {
$sql = "SELECT count(*) AS total $sql = "SELECT count(*) AS total
FROM " . USERS_TABLE . " FROM " . USERS_TABLE . "
WHERE user_id <> " . ANONYMOUS; WHERE user_id <> " . ANONYMOUS;
if(!$count_result = $db->sql_query($sql)) if(!$count_result = $db->sql_query($sql))
@ -263,14 +272,14 @@ if(($selected_members = $db->sql_numrows($result)) > 0)
} }
else else
{ {
$pagination = "&nbsp;"; $pagination = "&nbsp;";
$total_members = 10; $total_members = 10;
} }
$template->assign_vars(array( $template->assign_vars(array(
"PAGINATION" => $pagination, "PAGINATION" => $pagination,
"ON_PAGE" => ( floor( $start / $board_config['topics_per_page'] ) + 1 ), "ON_PAGE" => ( floor( $start / $board_config['topics_per_page'] ) + 1 ),
"TOTAL_PAGES" => ceil( $total_members / $board_config['topics_per_page'] ), "TOTAL_PAGES" => ceil( $total_members / $board_config['topics_per_page'] ),
"L_OF" => $lang['of'], "L_OF" => $lang['of'],
"L_PAGE" => $lang['Page'], "L_PAGE" => $lang['Page'],
"L_GOTO_PAGE" => $lang['Goto_page']) "L_GOTO_PAGE" => $lang['Goto_page'])

View file

@ -11,6 +11,15 @@
* *
***************************************************************************/ ***************************************************************************/
/***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
***************************************************************************/
/** /**
* Moderator Control Panel * Moderator Control Panel
* *
@ -31,6 +40,8 @@ $page_title = "Modertator Control Panel";
$forum_id = ($HTTP_POST_VARS[POST_FORUM_URL]) ? $HTTP_POST_VARS[POST_FORUM_URL] : $HTTP_GET_VARS[POST_FORUM_URL]; $forum_id = ($HTTP_POST_VARS[POST_FORUM_URL]) ? $HTTP_POST_VARS[POST_FORUM_URL] : $HTTP_GET_VARS[POST_FORUM_URL];
$topic_id = ($HTTP_POST_VARS[POST_TOPIC_URL]) ? $HTTP_POST_VARS[POST_TOPIC_URL] : $HTTP_GET_VARS[POST_TOPIC_URL]; $topic_id = ($HTTP_POST_VARS[POST_TOPIC_URL]) ? $HTTP_POST_VARS[POST_TOPIC_URL] : $HTTP_GET_VARS[POST_TOPIC_URL];
if(empty($forum_id) || !isset($forum_id)) if(empty($forum_id) || !isset($forum_id))
{ {
$sql = "SELECT f.forum_id, f.forum_name, f.forum_topics $sql = "SELECT f.forum_id, f.forum_name, f.forum_topics
@ -104,6 +115,7 @@ include($phpbb_root_path . 'includes/page_header.'.$phpEx);
$template->set_filenames(array( $template->set_filenames(array(
"body" => "modcp_body.tpl", "body" => "modcp_body.tpl",
"confirm" => "confirm_body.tpl", "confirm" => "confirm_body.tpl",
"viewip" => "modcp_viewip.tpl",
"split_body" => "split_body.tpl") "split_body" => "split_body.tpl")
); );
@ -717,7 +729,61 @@ switch($mode)
$template->pparse("split_body"); $template->pparse("split_body");
} }
} }
break; break;
case 'ip':
$post_id = $HTTP_GET_VARS[POST_POST_URL];
if(!$post_id)
{
message_die(GENERAL_ERROR, "Error, no post id found", "Error", __LINE__, __FILE__);
}
// Look up relevent data for this post
$sql = "SELECT poster_ip, poster_id, post_username FROM ".POSTS_TABLE." WHERE post_id = $post_id";
if(!$result = $db->sql_query($sql))
{
message_die(GENERAL_ERROR, "Could not get poster IP information", "Error", __LINE__, __FILE__, $sql);
}
$post_row = $db->sql_fetchrow($result);
// Get other users who've posted under this IP
$sql = "SELECT u.username, u.user_id FROM " . USERS_TABLE ." u, " . POSTS_TABLE . " p WHERE p.poster_id = u.user_id AND p.poster_ip = '".$post_row['poster_ip']."'";
if(!$result = $db->sql_query($sql))
{
message_die(GENERAL_ERROR, "Could not get posters information based on IP", "Error", __LINE__, __FILE__, $sql);
}
$poster_ids = $db->sql_fetchrowset($result);
sort($poster_ids);
echo "<pre>";
var_dump($poster_ids);
echo "</pre>";
$posts = 0;
while(list($null, $userdata) = each($poster_ids))
{
$username = $userdata['username'];
$user_id = $userdata['user_id'];
if($username != $last_username && !empty($last_username))
{
$other_users[] = array("username" => "$last_username", "user_id" => "$last_user_id", "posts" => "$posts");
$posts = 1;
}
else
{
$posts += 1;
}
$last_username = $username;
$last_user_ip = $user_id;
}
echo "<pre>";
var_dump($other_users);
echo "</pre>";
break;
default: default:

View file

@ -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 = "./"; $phpbb_root_path = "./";
include($phpbb_root_path . 'extension.inc'); include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx); include($phpbb_root_path . 'common.'.$phpEx);
@ -29,7 +38,7 @@ init_userprefs($userdata);
// //
// Set initial conditions // 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]; $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']) ) 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 else
{ {
$sql = "SELECT * $sql = "SELECT *
FROM " . TOPICS_WATCH_TABLE . " FROM " . TOPICS_WATCH_TABLE . "
WHERE topic_id = $topic_id WHERE topic_id = $topic_id
AND user_id = " . $userdata['user_id']; AND user_id = " . $userdata['user_id'];
if( !$result = $db->sql_query($sql) ) 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 // Doing it here prevents spoofing (eg. faking forum_id, topic_id or post_id
// //
if( $mode != "newtopic" ) if( $mode != "newtopic" )
@ -145,19 +154,19 @@ if( $mode != "newtopic" )
{ {
if($mode == "reply" && !empty($topic_id) ) if($mode == "reply" && !empty($topic_id) )
{ {
$sql = "SELECT f.forum_id, f.forum_status, t.topic_status $sql = "SELECT f.forum_id, f.forum_status, t.topic_status
FROM " . FORUMS_TABLE . " f, " . TOPICS_TABLE . " t FROM " . FORUMS_TABLE . " f, " . TOPICS_TABLE . " t
WHERE t.topic_id = $topic_id WHERE t.topic_id = $topic_id
AND f.forum_id = t.forum_id"; AND f.forum_id = t.forum_id";
$msg = $lang['No_topic_id']; $msg = $lang['No_topic_id'];
} }
else if( !empty($post_id) ) else if( !empty($post_id) )
{ {
$sql = "SELECT f.forum_id, f.forum_status, t.topic_id, t.topic_status $sql = "SELECT f.forum_id, f.forum_status, t.topic_id, t.topic_status
FROM " . POSTS_TABLE . " p, " . TOPICS_TABLE . " t, " . FORUMS_TABLE . " f FROM " . POSTS_TABLE . " p, " . TOPICS_TABLE . " t, " . FORUMS_TABLE . " f
WHERE p.post_id = $post_id WHERE p.post_id = $post_id
AND t.topic_id = p.topic_id AND t.topic_id = p.topic_id
AND f.forum_id = t.forum_id"; AND f.forum_id = t.forum_id";
$msg = $lang['No_post_id']; $msg = $lang['No_post_id'];
@ -171,12 +180,12 @@ if( $mode != "newtopic" )
{ {
if( isset($post_id) ) 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 $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 FROM " . POSTS_TABLE . " p, " . TOPICS_TABLE . " t, " . FORUMS_TABLE . " f
WHERE t.topic_id = $topic_id WHERE t.topic_id = $topic_id
AND p.topic_id = t.topic_id AND p.topic_id = t.topic_id
AND f.forum_id = t.forum_id AND f.forum_id = t.forum_id
ORDER BY p.post_time ASC ORDER BY p.post_time ASC
LIMIT 1"; LIMIT 1";
} }
else else
@ -194,14 +203,14 @@ if( $mode != "newtopic" )
$check_row = $db->sql_fetchrow($result); $check_row = $db->sql_fetchrow($result);
$forum_id = $check_row['forum_id']; $forum_id = $check_row['forum_id'];
$topic_status = $check_row['topic_status']; $topic_status = $check_row['topic_status'];
$forum_status = $check_row['forum_status']; $forum_status = $check_row['forum_status'];
if( $mode == "editpost" ) if( $mode == "editpost" )
{ {
$is_first_post = ($check_row['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 = ($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_last_post_forum = ($check_row['forum_last_post_id'] == $post_id) ? TRUE : 0;
} }
else else
{ {
@ -221,8 +230,8 @@ if( $mode != "newtopic" )
} }
else else
{ {
$sql = "SELECT forum_status $sql = "SELECT forum_status
FROM " . FORUMS_TABLE . " f FROM " . FORUMS_TABLE . " f
WHERE forum_id = $forum_id"; WHERE forum_id = $forum_id";
if($result = $db->sql_query($sql)) 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 // ... 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); $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]"; $message .= (ereg(" $", $message)) ? "[addsig]" : " [addsig]";
} }
} }
else else
{ {
$message = stripslashes(trim($HTTP_POST_VARS['message'])); $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 ) ) 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)"; 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") if($mode == "reply")
{ {
@ -498,12 +507,12 @@ if( ($mode == "newtopic" || $mode == "reply") && $topic_status == TOPIC_UNLOCKED
{ {
$new_post_id = $db->sql_nextid(); $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')"; VALUES ($new_post_id, '$subject', '$message')";
if($db->sql_query($sql)) if($db->sql_query($sql))
{ {
$sql = "UPDATE " . TOPICS_TABLE . " $sql = "UPDATE " . TOPICS_TABLE . "
SET topic_last_post_id = $new_post_id"; SET topic_last_post_id = $new_post_id";
if($mode == "reply") if($mode == "reply")
{ {
@ -513,7 +522,7 @@ if( ($mode == "newtopic" || $mode == "reply") && $topic_status == TOPIC_UNLOCKED
if($db->sql_query($sql)) 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"; SET forum_last_post_id = $new_post_id, forum_posts = forum_posts + 1";
if($mode == "newtopic") if($mode == "newtopic")
{ {
@ -523,8 +532,8 @@ if( ($mode == "newtopic" || $mode == "reply") && $topic_status == TOPIC_UNLOCKED
if($db->sql_query($sql)) if($db->sql_query($sql))
{ {
$sql = "UPDATE " . USERS_TABLE . " $sql = "UPDATE " . USERS_TABLE . "
SET user_posts = user_posts + 1 SET user_posts = user_posts + 1
WHERE user_id = " . $userdata['user_id']; WHERE user_id = " . $userdata['user_id'];
if($db->sql_query($sql, END_TRANSACTION)) if($db->sql_query($sql, END_TRANSACTION))
@ -536,13 +545,13 @@ if( ($mode == "newtopic" || $mode == "reply") && $topic_status == TOPIC_UNLOCKED
// //
if($mode == "reply") if($mode == "reply")
{ {
$sql = "SELECT u.user_id, u.username, u.user_email, t.topic_title $sql = "SELECT u.user_id, u.username, u.user_email, t.topic_title
FROM " . TOPICS_WATCH_TABLE . " tw, " . TOPICS_TABLE . " t, " . USERS_TABLE . " u FROM " . TOPICS_WATCH_TABLE . " tw, " . TOPICS_TABLE . " t, " . USERS_TABLE . " u
WHERE tw.topic_id = $new_topic_id WHERE tw.topic_id = $new_topic_id
AND tw.user_id <> " . $userdata['user_id'] . " AND tw.user_id <> " . $userdata['user_id'] . "
AND tw.user_id <> " . ANONYMOUS . " AND tw.user_id <> " . ANONYMOUS . "
AND tw.notify_status = " . TOPIC_WATCH_UN_NOTIFIED . " AND tw.notify_status = " . TOPIC_WATCH_UN_NOTIFIED . "
AND t.topic_id = tw.topic_id AND t.topic_id = tw.topic_id
AND u.user_id = tw.user_id"; AND u.user_id = tw.user_id";
if( $result = $db->sql_query($sql) ) 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']); $path = (dirname($HTTP_SERVER_VARS['REQUEST_URI']) == "/") ? "" : dirname($HTTP_SERVER_VARS['REQUEST_URI']);
$emailer->assign_vars(array( $emailer->assign_vars(array(
"USERNAME" => $email_set[$i]['username'], "USERNAME" => $email_set[$i]['username'],
"SITENAME" => $board_config['sitename'], "SITENAME" => $board_config['sitename'],
"TOPIC_TITLE" => $email_set[$i]['topic_title'], "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", "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']) "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 .= " 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 != "") if($update_watched_sql != "")
{ {
$sql = "UPDATE " . TOPICS_WATCH_TABLE . " $sql = "UPDATE " . TOPICS_WATCH_TABLE . "
SET notify_status = " . TOPIC_WATCH_NOTIFIED . " SET notify_status = " . TOPIC_WATCH_NOTIFIED . "
WHERE topic_id = $new_topic_id WHERE topic_id = $new_topic_id
AND $update_watched_sql"; AND $update_watched_sql";
$db->sql_query($sql); $db->sql_query($sql);
} }
@ -601,9 +610,9 @@ if( ($mode == "newtopic" || $mode == "reply") && $topic_status == TOPIC_UNLOCKED
{ {
if($mode == "reply") if($mode == "reply")
{ {
$sql = "SELECT * $sql = "SELECT *
FROM " . TOPICS_WATCH_TABLE . " FROM " . TOPICS_WATCH_TABLE . "
WHERE topic_id = $new_topic_id WHERE topic_id = $new_topic_id
AND user_id = " . $userdata['user_id']; AND user_id = " . $userdata['user_id'];
if( !$result = $db->sql_query($sql) ) if( !$result = $db->sql_query($sql) )
{ {
@ -614,8 +623,8 @@ if( ($mode == "newtopic" || $mode == "reply") && $topic_status == TOPIC_UNLOCKED
{ {
if( !$notify ) if( !$notify )
{ {
$sql = "DELETE FROM " . TOPICS_WATCH_TABLE . " $sql = "DELETE FROM " . TOPICS_WATCH_TABLE . "
WHERE topic_id = $new_topic_id WHERE topic_id = $new_topic_id
AND user_id = " . $userdata['user_id']; AND user_id = " . $userdata['user_id'];
if( !$result = $db->sql_query($sql) ) if( !$result = $db->sql_query($sql) )
{ {
@ -625,7 +634,7 @@ if( ($mode == "newtopic" || $mode == "reply") && $topic_status == TOPIC_UNLOCKED
} }
else if( $notify ) 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)"; VALUES (" . $userdata['user_id'] . ", $new_topic_id, 0)";
if( !$result = $db->sql_query($sql) ) if( !$result = $db->sql_query($sql) )
{ {
@ -635,7 +644,7 @@ if( ($mode == "newtopic" || $mode == "reply") && $topic_status == TOPIC_UNLOCKED
} }
else if( $notify ) 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)"; VALUES (" . $userdata['user_id'] . ", $new_topic_id, 0)";
if( !$result = $db->sql_query($sql) ) if( !$result = $db->sql_query($sql) )
{ {
@ -681,7 +690,7 @@ if( ($mode == "newtopic" || $mode == "reply") && $topic_status == TOPIC_UNLOCKED
{ {
if(SQL_LAYER == "mysql") if(SQL_LAYER == "mysql")
{ {
$sql = "DELETE FROM " . POSTS_TABLE . " $sql = "DELETE FROM " . POSTS_TABLE . "
WHERE post_id = $new_post_id"; WHERE post_id = $new_post_id";
if( !$db->sql_query($sql) ) if( !$db->sql_query($sql) )
{ {
@ -707,11 +716,11 @@ else if($mode == "quote" && !$preview && $topic_status == TOPIC_UNLOCKED)
if( isset($post_id) ) 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 $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 FROM " . POSTS_TABLE . " p, " . USERS_TABLE . " u, " . TOPICS_TABLE . " t, " . POSTS_TEXT_TABLE . " pt
WHERE p.post_id = $post_id WHERE p.post_id = $post_id
AND pt.post_id = p.post_id AND pt.post_id = p.post_id
AND p.topic_id = t.topic_id AND p.topic_id = t.topic_id
AND p.poster_id = u.user_id"; AND p.poster_id = u.user_id";
if($result = $db->sql_query($sql)) if($result = $db->sql_query($sql))
{ {
@ -732,7 +741,7 @@ else if($mode == "quote" && !$preview && $topic_status == TOPIC_UNLOCKED)
$message = str_replace("<br />", "\n", $message); $message = str_replace("<br />", "\n", $message);
$message = undo_htmlspecialchars($message); $message = undo_htmlspecialchars($message);
// Special handling for </textarea> tags in the message, which can break the editing form.. // Special handling for </textarea> tags in the message, which can break the editing form..
$message = preg_replace('#</textarea>#si', '&lt;/TEXTAREA&gt;', $message); $message = preg_replace('#</textarea>#si', '&lt;/TEXTAREA&gt;', $message);
@ -756,12 +765,12 @@ else if( $mode == "editpost" && $topic_status == TOPIC_UNLOCKED )
$page_title = " " . $lang['Edit_post']; $page_title = " " . $lang['Edit_post'];
$section_title = $lang['Edit_post_in']; $section_title = $lang['Edit_post_in'];
if( ( isset($HTTP_POST_VARS['submit']) || isset($HTTP_GET_VARS['confirm']) || isset($HTTP_POST_VARS['confirm']) ) && if( ( isset($HTTP_POST_VARS['submit']) || isset($HTTP_GET_VARS['confirm']) || isset($HTTP_POST_VARS['confirm']) ) &&
!$error && !$preview ) !$error && !$preview )
{ {
$sql = "SELECT poster_id $sql = "SELECT poster_id
FROM " . POSTS_TABLE . " FROM " . POSTS_TABLE . "
WHERE post_id = $post_id"; WHERE post_id = $post_id";
if($result = $db->sql_query($sql)) if($result = $db->sql_query($sql))
@ -775,16 +784,16 @@ else if( $mode == "editpost" && $topic_status == TOPIC_UNLOCKED )
message_die(GENERAL_MESSAGE, $msg); message_die(GENERAL_MESSAGE, $msg);
} }
} }
if( ( isset($HTTP_POST_VARS['delete']) || isset($HTTP_GET_VARS['delete']) ) && if( ( isset($HTTP_POST_VARS['delete']) || isset($HTTP_GET_VARS['delete']) ) &&
( $is_last_post || $is_auth['auth_mod'] ) ) ( $is_last_post || $is_auth['auth_mod'] ) )
{ {
// //
// Output a confirmation message, unless we've over-ridden it on the posting_body form ( // Output a confirmation message, unless we've over-ridden it on the posting_body form (
// override_confirm set ), this is so people can implement JavaScript checkers if they wish // override_confirm set ), this is so people can implement JavaScript checkers if they wish
// //
if( isset($HTTP_POST_VARS['delete']) && if( isset($HTTP_POST_VARS['delete']) &&
!isset($HTTP_POST_VARS['override_confirm']) && !isset($HTTP_POST_VARS['override_confirm']) &&
!isset($HTTP_GET_VARS['confirm']) && !isset($HTTP_POST_VARS['confirm'])) !isset($HTTP_GET_VARS['confirm']) && !isset($HTTP_POST_VARS['confirm']))
{ {
@ -800,12 +809,12 @@ else if( $mode == "editpost" && $topic_status == TOPIC_UNLOCKED )
); );
$template->assign_vars(array( $template->assign_vars(array(
"MESSAGE_TITLE" => $lang['Information'], "MESSAGE_TITLE" => $lang['Information'],
"MESSAGE_TEXT" => $lang['Confirm_delete'], "MESSAGE_TEXT" => $lang['Confirm_delete'],
"L_YES" => $lang['Yes'], "L_YES" => $lang['Yes'],
"L_NO" => $lang['No'], "L_NO" => $lang['No'],
"S_CONFIRM_ACTION" => append_sid("posting.$phpEx"), "S_CONFIRM_ACTION" => append_sid("posting.$phpEx"),
"S_HIDDEN_FIELDS" => $s_hidden_fields) "S_HIDDEN_FIELDS" => $s_hidden_fields)
); );
$template->pparse("confirm_body"); $template->pparse("confirm_body");
@ -813,16 +822,16 @@ else if( $mode == "editpost" && $topic_status == TOPIC_UNLOCKED )
include($phpbb_root_path . 'includes/page_tail.'.$phpEx); include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
} }
else if( isset($HTTP_GET_VARS['confirm']) || isset($HTTP_POST_VARS['confirm']) || else if( isset($HTTP_GET_VARS['confirm']) || isset($HTTP_POST_VARS['confirm']) ||
isset($HTTP_POST_VARS['override_confirm']) ) isset($HTTP_POST_VARS['override_confirm']) )
{ {
$sql = "DELETE FROM " . POSTS_TEXT_TABLE . " $sql = "DELETE FROM " . POSTS_TEXT_TABLE . "
WHERE post_id = $post_id"; WHERE post_id = $post_id";
if($db->sql_query($sql, BEGIN_TRANSACTION)) if($db->sql_query($sql, BEGIN_TRANSACTION))
{ {
$sql = "DELETE FROM " . POSTS_TABLE . " $sql = "DELETE FROM " . POSTS_TABLE . "
WHERE post_id = $post_id"; WHERE post_id = $post_id";
if($is_last_post && $is_first_post) if($is_last_post && $is_first_post)
@ -833,10 +842,10 @@ else if( $mode == "editpost" && $topic_status == TOPIC_UNLOCKED )
// //
if($db->sql_query($sql)) if($db->sql_query($sql))
{ {
$sql = "DELETE FROM " . TOPICS_TABLE . " $sql = "DELETE FROM " . TOPICS_TABLE . "
WHERE topic_id = $topic_id"; WHERE topic_id = $topic_id";
$sql_forum_upd = "forum_posts = forum_posts - 1, forum_topics = forum_topics - 1"; $sql_forum_upd = "forum_posts = forum_posts - 1, forum_topics = forum_topics - 1";
$if_die_msg = "Couldn't delete from topics table"; $if_die_msg = "Couldn't delete from topics table";
} }
@ -857,16 +866,16 @@ else if( $mode == "editpost" && $topic_status == TOPIC_UNLOCKED )
// //
if($db->sql_query($sql)) if($db->sql_query($sql))
{ {
$sql = "SELECT MAX(post_id) AS new_last_post_id $sql = "SELECT MAX(post_id) AS new_last_post_id
FROM " . POSTS_TABLE . " FROM " . POSTS_TABLE . "
WHERE topic_id = $topic_id"; WHERE topic_id = $topic_id";
if($result = $db->sql_query($sql)) if($result = $db->sql_query($sql))
{ {
list($new_last_post_id) = $db->sql_fetchrow($result); list($new_last_post_id) = $db->sql_fetchrow($result);
$sql = "UPDATE " . TOPICS_TABLE . " $sql = "UPDATE " . TOPICS_TABLE . "
SET topic_replies = topic_replies - 1, topic_last_post_id = $new_last_post_id SET topic_replies = topic_replies - 1, topic_last_post_id = $new_last_post_id
WHERE topic_id = $topic_id"; WHERE topic_id = $topic_id";
$sql_forum_upd = "forum_posts = forum_posts - 1"; $sql_forum_upd = "forum_posts = forum_posts - 1";
@ -891,7 +900,7 @@ else if( $mode == "editpost" && $topic_status == TOPIC_UNLOCKED )
message_die(GENERAL_ERROR, "Error deleting from post table", "", __LINE__, __FILE__, $sql); message_die(GENERAL_ERROR, "Error deleting from post table", "", __LINE__, __FILE__, $sql);
} }
} }
else if($is_auth['auth_mod']) else if($is_auth['auth_mod'])
{ {
// //
// It's not last and it's not both first and last so it's somewhere in // It's not last and it's not both first and last so it's somewhere in
@ -902,7 +911,7 @@ else if( $mode == "editpost" && $topic_status == TOPIC_UNLOCKED )
$if_die_msg = "Couldn't delete from posts table"; $if_die_msg = "Couldn't delete from posts table";
} }
// //
// Updating the forum is common to all three possibilities, // Updating the forum is common to all three possibilities,
// _remember_ we're still in a transaction here! // _remember_ we're still in a transaction here!
@ -911,10 +920,10 @@ else if( $mode == "editpost" && $topic_status == TOPIC_UNLOCKED )
{ {
if($is_last_post_forum) if($is_last_post_forum)
{ {
$sql = "SELECT MAX(post_id) AS new_last_post_id $sql = "SELECT MAX(post_id) AS new_last_post_id
FROM " . POSTS_TABLE . " FROM " . POSTS_TABLE . "
WHERE forum_id = $forum_id"; WHERE forum_id = $forum_id";
if($result = $db->sql_query($sql)) if($result = $db->sql_query($sql))
{ {
list($new_last_post_id) = $db->sql_fetchrow($result); list($new_last_post_id) = $db->sql_fetchrow($result);
@ -931,8 +940,8 @@ else if( $mode == "editpost" && $topic_status == TOPIC_UNLOCKED )
$new_last_sql = ""; $new_last_sql = "";
} }
$sql = "UPDATE " . FORUMS_TABLE . " $sql = "UPDATE " . FORUMS_TABLE . "
SET " . $sql_forum_upd . $new_last_sql . " SET " . $sql_forum_upd . $new_last_sql . "
WHERE forum_id = $forum_id"; WHERE forum_id = $forum_id";
if($db->sql_query($sql, END_TRANSACTION)) if($db->sql_query($sql, END_TRANSACTION))
@ -941,7 +950,7 @@ else if( $mode == "editpost" && $topic_status == TOPIC_UNLOCKED )
// If we get here the post has been deleted successfully. // If we get here the post has been deleted successfully.
// //
$msg = $lang['Deleted']; $msg = $lang['Deleted'];
if(!$is_last_post || !$is_first_post) if(!$is_last_post || !$is_first_post)
{ {
$msg .= "<br /><br />" . $lang['Click'] . " <a href=\"" . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id") . "\">" . $lang['Here'] . "</a> " . $lang['to_return_topic']; $msg .= "<br /><br />" . $lang['Click'] . " <a href=\"" . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id") . "\">" . $lang['Here'] . "</a> " . $lang['to_return_topic'];
@ -1001,14 +1010,14 @@ else if( $mode == "editpost" && $topic_status == TOPIC_UNLOCKED )
$edited_sql = ""; $edited_sql = "";
} }
$sql = "UPDATE " . POSTS_TABLE . " $sql = "UPDATE " . POSTS_TABLE . "
SET bbcode_uid = '$bbcode_uid', enable_bbcode = $bbcode_on, enable_html = $html_on, enable_smilies = $smilies_on" . $edited_sql . " SET bbcode_uid = '$bbcode_uid', enable_bbcode = $bbcode_on, enable_html = $html_on, enable_smilies = $smilies_on" . $edited_sql . "
WHERE post_id = $post_id"; WHERE post_id = $post_id";
if($db->sql_query($sql, BEGIN_TRANSACTION)) if($db->sql_query($sql, BEGIN_TRANSACTION))
{ {
$sql = "UPDATE " . POSTS_TEXT_TABLE . " $sql = "UPDATE " . POSTS_TEXT_TABLE . "
SET post_text = '$message', post_subject = '$subject' SET post_text = '$message', post_subject = '$subject'
WHERE post_id = $post_id"; WHERE post_id = $post_id";
if($is_first_post) if($is_first_post)
@ -1018,8 +1027,8 @@ else if( $mode == "editpost" && $topic_status == TOPIC_UNLOCKED )
// //
// Update topics table here, set notification level and such // Update topics table here, set notification level and such
// //
$sql = "UPDATE " . TOPICS_TABLE . " $sql = "UPDATE " . TOPICS_TABLE . "
SET topic_title = '$subject', topic_type = '".$topic_type."' SET topic_title = '$subject', topic_type = '".$topic_type."'
WHERE topic_id = $topic_id"; WHERE topic_id = $topic_id";
if($db->sql_query($sql, END_TRANSACTION)) if($db->sql_query($sql, END_TRANSACTION))
@ -1088,11 +1097,11 @@ else if( $mode == "editpost" && $topic_status == TOPIC_UNLOCKED )
{ {
if( !empty($post_id) ) if( !empty($post_id) )
{ {
$sql = "SELECT p.*, pt.post_text, pt.post_subject, u.username, u.user_id, u.user_sig, t.topic_title, t.topic_type $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 FROM " . POSTS_TABLE . " p, " . USERS_TABLE . " u, " . TOPICS_TABLE . " t, " . POSTS_TEXT_TABLE . " pt
WHERE p.post_id = $post_id WHERE p.post_id = $post_id
AND pt.post_id = p.post_id AND pt.post_id = p.post_id
AND p.topic_id = t.topic_id AND p.topic_id = t.topic_id
AND p.poster_id = u.user_id"; AND p.poster_id = u.user_id";
if($result = $db->sql_query($sql)) if($result = $db->sql_query($sql))
@ -1127,7 +1136,7 @@ else if( $mode == "editpost" && $topic_status == TOPIC_UNLOCKED )
$message = str_replace("<br />", "\n", $message); $message = str_replace("<br />", "\n", $message);
$message = undo_htmlspecialchars($message); $message = undo_htmlspecialchars($message);
// Special handling for </textarea> tags in the message, which can break the editing form.. // Special handling for </textarea> tags in the message, which can break the editing form..
$message = preg_replace('#</textarea>#si', '&lt;/TEXTAREA&gt;', $message); $message = preg_replace('#</textarea>#si', '&lt;/TEXTAREA&gt;', $message);
@ -1202,7 +1211,7 @@ if(empty($username))
} }
// //
// Define a signature, this is in practice only used for // Define a signature, this is in practice only used for
// preview but doing this here allows us to use it as a // preview but doing this here allows us to use it as a
// check for attach_sig later // check for attach_sig later
// //
@ -1234,7 +1243,7 @@ if($preview && !$error)
// //
// Define censored word matches // Define censored word matches
// //
$sql = "SELECT word, replacement $sql = "SELECT word, replacement
FROM " . WORDS_TABLE; FROM " . WORDS_TABLE;
if( !$words_result = $db->sql_query($sql) ) if( !$words_result = $db->sql_query($sql) )
{ {
@ -1287,7 +1296,7 @@ if($preview && !$error)
$preview_message = bbencode_second_pass($preview_message, $bbcode_uid); $preview_message = bbencode_second_pass($preview_message, $bbcode_uid);
// //
// This compensates for bbcode's rather agressive (but I guess necessary) // This compensates for bbcode's rather agressive (but I guess necessary)
// HTML handling // HTML handling
// //
if( !$html_on ) if( !$html_on )
@ -1324,12 +1333,12 @@ if($preview && !$error)
"preview" => "posting_preview.tpl") "preview" => "posting_preview.tpl")
); );
$template->assign_vars(array( $template->assign_vars(array(
"TOPIC_TITLE" => $preview_subject, "TOPIC_TITLE" => $preview_subject,
"POST_SUBJECT" => $preview_subject, "POST_SUBJECT" => $preview_subject,
"POSTER_NAME" => stripslashes($username), "POSTER_NAME" => stripslashes($username),
"POST_DATE" => create_date($board_config['default_dateformat'], time(), $board_config['default_timezone']), "POST_DATE" => create_date($board_config['default_dateformat'], time(), $board_config['default_timezone']),
"MESSAGE" => $preview_message, "MESSAGE" => $preview_message,
"L_PREVIEW" => $lang['Preview'], "L_PREVIEW" => $lang['Preview'],
"L_POSTED" => $lang['Posted']) "L_POSTED" => $lang['Posted'])
); );
@ -1558,27 +1567,27 @@ $template->assign_vars(array(
"L_OPTIONS" => $lang['Options'], "L_OPTIONS" => $lang['Options'],
"L_PREVIEW" => $lang['Preview'], "L_PREVIEW" => $lang['Preview'],
"L_SUBMIT" => $lang['Submit_post'], "L_SUBMIT" => $lang['Submit_post'],
"L_CANCEL" => $lang['Cancel_post'], "L_CANCEL" => $lang['Cancel_post'],
"L_CONFIRM_DELETE" => $lang['Confirm_delete'], "L_CONFIRM_DELETE" => $lang['Confirm_delete'],
"L_POST_A" => $post_a, "L_POST_A" => $post_a,
"L_HTML_IS" => $lang['HTML'] . " " . $lang['is'], "L_HTML_IS" => $lang['HTML'] . " " . $lang['is'],
"L_BBCODE_IS" => $lang['BBCode'] . " " . $lang['is'], "L_BBCODE_IS" => $lang['BBCode'] . " " . $lang['is'],
"L_SMILIES_ARE" => $lang['Smilies'] . " " . $lang['are'], "L_SMILIES_ARE" => $lang['Smilies'] . " " . $lang['are'],
"L_DISABLE_HTML" => $lang['Disable'] . $lang['HTML'] . $lang['in_this_post'], "L_DISABLE_HTML" => $lang['Disable'] . $lang['HTML'] . $lang['in_this_post'],
"L_DISABLE_BBCODE" => $lang['Disable'] . $lang['BBCode'] . $lang['in_this_post'], "L_DISABLE_BBCODE" => $lang['Disable'] . $lang['BBCode'] . $lang['in_this_post'],
"L_DISABLE_SMILIES" => $lang['Disable'] . $lang['Smilies'] . $lang['in_this_post'], "L_DISABLE_SMILIES" => $lang['Disable'] . $lang['Smilies'] . $lang['in_this_post'],
"L_ATTACH_SIGNATURE" => $lang['Attach_signature'], "L_ATTACH_SIGNATURE" => $lang['Attach_signature'],
"L_NOTIFY_ON_REPLY" => $lang['Notify'], "L_NOTIFY_ON_REPLY" => $lang['Notify'],
"L_DELETE_POST" => $lang['Delete_post'], "L_DELETE_POST" => $lang['Delete_post'],
"S_HTML_CHECKED" => (!$html_on) ? "checked=\"checked\"" : "", "S_HTML_CHECKED" => (!$html_on) ? "checked=\"checked\"" : "",
"S_BBCODE_CHECKED" => (!$bbcode_on) ? "checked=\"checked\"" : "", "S_BBCODE_CHECKED" => (!$bbcode_on) ? "checked=\"checked\"" : "",
"S_SMILIES_CHECKED" => (!$smilies_on) ? "checked=\"checked\"" : "", "S_SMILIES_CHECKED" => (!$smilies_on) ? "checked=\"checked\"" : "",
"S_SIGNATURE_CHECKED" => ($attach_sig) ? "checked=\"checked\"" : "", "S_SIGNATURE_CHECKED" => ($attach_sig) ? "checked=\"checked\"" : "",
"S_NOTIFY_CHECKED" => ($notify) ? "checked=\"checked\"" : "", "S_NOTIFY_CHECKED" => ($notify) ? "checked=\"checked\"" : "",
"S_TYPE_TOGGLE" => $topic_type_toggle, "S_TYPE_TOGGLE" => $topic_type_toggle,
"S_TOPIC_ID" => $topic_id, "S_TOPIC_ID" => $topic_id,
"S_POST_ACTION" => append_sid("posting.$phpEx"), "S_POST_ACTION" => append_sid("posting.$phpEx"),
"S_HIDDEN_FORM_FIELDS" => $hidden_form_fields) "S_HIDDEN_FORM_FIELDS" => $hidden_form_fields)

View file

@ -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 = "./"; $phpbb_root_path = "./";
include($phpbb_root_path . 'extension.inc'); include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx); include($phpbb_root_path . 'common.'.$phpEx);

View file

@ -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 = "./"; $phpbb_root_path = "./";
include($phpbb_root_path . 'extension.inc'); include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx); include($phpbb_root_path . 'common.'.$phpEx);

View file

@ -11,6 +11,15 @@
* *
***************************************************************************/ ***************************************************************************/
/***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
***************************************************************************/
// //
// Massive overhaul for phpBB2, // Massive overhaul for phpBB2,
// originally based on search code // originally based on search code
@ -37,8 +46,8 @@ function gensearch_sql($searchstring, $override_all = 0)
$searchstring = stripslashes(trim(preg_replace($searchchars, $replacechars, preg_quote(strip_tags($searchstring))))); $searchstring = stripslashes(trim(preg_replace($searchchars, $replacechars, preg_quote(strip_tags($searchstring)))));
// //
// Here could go a file containing words to ignore, // Here could go a file containing words to ignore,
// eg. common words such as the, a, to, etc. or // eg. common words such as the, a, to, etc. or
// specific words which should not be search on // specific words which should not be search on
// //
// This is what I actually use on the Typhoon site. The // This is what I actually use on the Typhoon site. The
@ -165,17 +174,17 @@ function gensearch_sql($searchstring, $override_all = 0)
// //
// Search for words (OR AND and NOT arrays) // Search for words (OR AND and NOT arrays)
// //
$searchstring = ""; $searchstring = "";
for($i=0;$i<count($binsearchtype);$i++) for($i=0;$i<count($binsearchtype);$i++)
{ {
if($binsearchtype[$i] == "AND" && count($searchlistandtype["AND"])) if($binsearchtype[$i] == "AND" && count($searchlistandtype["AND"]))
{ {
if($i > 0) if($i > 0)
$searchstring .= ") AND ("; $searchstring .= ") AND (";
for($j=0;$j<count($searchlistandtype["AND"]);$j++) for($j=0;$j<count($searchlistandtype["AND"]);$j++)
{ {
if($j != 0) if($j != 0)
$searchstring .= " AND "; $searchstring .= " AND ";
$findword = addslashes($searchlistandtype["AND"][$j]); $findword = addslashes($searchlistandtype["AND"][$j]);
$is_phrase_word = $searchlist_isphrase["AND"][$j]; $is_phrase_word = $searchlist_isphrase["AND"][$j];
@ -191,11 +200,11 @@ function gensearch_sql($searchstring, $override_all = 0)
} }
elseif($binsearchtype[$i] == "OR" && count($searchlistandtype["OR"])) elseif($binsearchtype[$i] == "OR" && count($searchlistandtype["OR"]))
{ {
if($i > 0) if($i > 0)
$searchstring .= ") AND ("; $searchstring .= ") AND (";
for($j=0;$j<count($searchlistandtype["OR"]);$j++) for($j=0;$j<count($searchlistandtype["OR"]);$j++)
{ {
if($j != 0) if($j != 0)
$searchstring .= " OR "; $searchstring .= " OR ";
$findword = addslashes($searchlistandtype["OR"][$j]); $findword = addslashes($searchlistandtype["OR"][$j]);
$is_phrase_word = $searchlist_isphrase["OR"][$j]; $is_phrase_word = $searchlist_isphrase["OR"][$j];
@ -211,11 +220,11 @@ function gensearch_sql($searchstring, $override_all = 0)
} }
elseif($binsearchtype[$i] == "NOT" && count($searchlistandtype["NOT"])) elseif($binsearchtype[$i] == "NOT" && count($searchlistandtype["NOT"]))
{ {
if($i > 0) if($i > 0)
$searchstring .= ") AND ("; $searchstring .= ") AND (";
for($j=0;$j<count($searchlistandtype["NOT"]);$j++) for($j=0;$j<count($searchlistandtype["NOT"]);$j++)
{ {
if($j != 0) if($j != 0)
$searchstring .= " AND "; $searchstring .= " AND ";
$findword = addslashes($searchlistandtype["NOT"][$j]); $findword = addslashes($searchlistandtype["NOT"][$j]);
$is_phrase_word = $searchlist_isphrase["NOT"][$j]; $is_phrase_word = $searchlist_isphrase["NOT"][$j];
@ -284,7 +293,7 @@ $querystring = (isset($HTTP_POST_VARS['querystring'])) ? $HTTP_POST_VARS['querys
$authorstring = (isset($HTTP_POST_VARS['authorstring'])) ? $HTTP_POST_VARS['authorstring'] : ( (!empty($HTTP_GET_VARS['a'])) ? stripslashes($HTTP_GET_VARS['a']) : "" ); $authorstring = (isset($HTTP_POST_VARS['authorstring'])) ? $HTTP_POST_VARS['authorstring'] : ( (!empty($HTTP_GET_VARS['a'])) ? stripslashes($HTTP_GET_VARS['a']) : "" );
$return_chars = ($HTTP_POST_VARS['charsreqd'] != "all") ? $HTTP_POST_VARS['charsreqd'] : -1; $return_chars = ($HTTP_POST_VARS['charsreqd'] != "all") ? $HTTP_POST_VARS['charsreqd'] : -1;
$return_chars = (isset($HTTP_GET_VARS['c'])) ? ( ($HTTP_GET_VARS['c'] != "all") ? $HTTP_GET_VARS['c'] : -1 ) : $return_chars; $return_chars = (isset($HTTP_GET_VARS['c'])) ? ( ($HTTP_GET_VARS['c'] != "all") ? $HTTP_GET_VARS['c'] : -1 ) : $return_chars;
$searchall = ($HTTP_POST_VARS['addterms'] == "all") ? 1 : ( ($HTTP_GET_VARS['m'] == "all") ? 1 : 0 ); $searchall = ($HTTP_POST_VARS['addterms'] == "all") ? 1 : ( ($HTTP_GET_VARS['m'] == "all") ? 1 : 0 );
$searchforum = (isset($HTTP_POST_VARS['searchforum'])) ? $HTTP_POST_VARS['searchforum'] : $HTTP_GET_VARS['f'] ; $searchforum = (isset($HTTP_POST_VARS['searchforum'])) ? $HTTP_POST_VARS['searchforum'] : $HTTP_GET_VARS['f'] ;
$sortby = (isset($HTTP_POST_VARS['sortby'])) ? $HTTP_POST_VARS['sortby'] : $HTTP_GET_VARS['b']; $sortby = (isset($HTTP_POST_VARS['sortby'])) ? $HTTP_POST_VARS['sortby'] : $HTTP_GET_VARS['b'];
@ -304,11 +313,11 @@ if((isset($HTTP_POST_VARS['dosearch']) || isset($HTTP_GET_VARS['dosearch'])) &&
// forums // forums
// //
$is_auth_ary = auth(AUTH_READ, AUTH_LIST_ALL, $userdata); $is_auth_ary = auth(AUTH_READ, AUTH_LIST_ALL, $userdata);
// //
// Start building appropriate SQL query // Start building appropriate SQL query
// //
$sql = "SELECT pt.post_text, pt.post_subject, p.forum_id, p.post_id, p.topic_id, p.post_time, f.forum_name, t.topic_title, t.topic_replies, t.topic_views, u.username, u.user_id $sql = "SELECT pt.post_text, pt.post_subject, p.forum_id, p.post_id, p.topic_id, p.post_time, f.forum_name, t.topic_title, t.topic_replies, t.topic_views, u.username, u.user_id
FROM ".FORUMS_TABLE." f, ".TOPICS_TABLE." t, ".USERS_TABLE." u, ".POSTS_TEXT_TABLE." pt, ".POSTS_TABLE." p "; FROM ".FORUMS_TABLE." f, ".TOPICS_TABLE." t, ".USERS_TABLE." u, ".POSTS_TEXT_TABLE." pt, ".POSTS_TABLE." p ";
// //
@ -338,10 +347,10 @@ if((isset($HTTP_POST_VARS['dosearch']) || isset($HTTP_GET_VARS['dosearch'])) &&
if(!ereg("\([ ]*\)",$search_sql)) if(!ereg("\([ ]*\)",$search_sql))
{ {
$sql .= "WHERE $search_sql $sql .= "WHERE $search_sql
AND (pt.post_id = p.post_id) AND (pt.post_id = p.post_id)
AND (f.forum_id = p.forum_id) AND (f.forum_id = p.forum_id)
AND (p.topic_id = t.topic_id) AND (p.topic_id = t.topic_id)
AND (p.poster_id = u.user_id)"; AND (p.poster_id = u.user_id)";
if($searchforum != "all") if($searchforum != "all")
@ -358,7 +367,7 @@ if((isset($HTTP_POST_VARS['dosearch']) || isset($HTTP_GET_VARS['dosearch'])) &&
} }
$sql .= " ORDER BY ".$sortby_sql[$sortby]." $sortby_dir"; $sql .= " ORDER BY ".$sortby_sql[$sortby]." $sortby_dir";
$result = $db->sql_query($sql); $result = $db->sql_query($sql);
if(!$result) if(!$result)
{ {
@ -371,7 +380,7 @@ if((isset($HTTP_POST_VARS['dosearch']) || isset($HTTP_GET_VARS['dosearch'])) &&
// //
// Output header // Output header
// //
include($phpbb_root_path . 'includes/page_header.'.$phpEx); include($phpbb_root_path . 'includes/page_header.'.$phpEx);
$template->set_filenames(array( $template->set_filenames(array(
"body" => "search_results_body.tpl", "body" => "search_results_body.tpl",
@ -413,7 +422,7 @@ if((isset($HTTP_POST_VARS['dosearch']) || isset($HTTP_GET_VARS['dosearch'])) &&
{ {
$message = (strlen($message) > $return_chars) ? substr($message, 0, $return_chars) . " ..." : $message; $message = (strlen($message) > $return_chars) ? substr($message, 0, $return_chars) . " ..." : $message;
} }
$message = strip_tags($message); $message = strip_tags($message);
// //
// Remove BBCode // Remove BBCode
@ -435,8 +444,8 @@ if((isset($HTTP_POST_VARS['dosearch']) || isset($HTTP_GET_VARS['dosearch'])) &&
$template->assign_block_vars("searchresults", array( $template->assign_block_vars("searchresults", array(
"TOPIC_TITLE" => stripslashes($searchset[$i]['topic_title']), "TOPIC_TITLE" => stripslashes($searchset[$i]['topic_title']),
"FORUM_NAME" => stripslashes($searchset[$i]['forum_name']), "FORUM_NAME" => stripslashes($searchset[$i]['forum_name']),
"POST_SUBJECT" => stripslashes($searchset[$i]['post_subject']), "POST_SUBJECT" => stripslashes($searchset[$i]['post_subject']),
"POST_DATE" => $post_date, "POST_DATE" => $post_date,
"POSTER_NAME" => stripslashes($searchset[$i]['username']), "POSTER_NAME" => stripslashes($searchset[$i]['username']),
"TOPIC_REPLIES" => $searchset[$i]['topic_replies'], "TOPIC_REPLIES" => $searchset[$i]['topic_replies'],
"TOPIC_VIEWS" => $searchset[$i]['topic_views'], "TOPIC_VIEWS" => $searchset[$i]['topic_views'],
@ -456,7 +465,7 @@ if((isset($HTTP_POST_VARS['dosearch']) || isset($HTTP_GET_VARS['dosearch'])) &&
"PAGINATION" => generate_pagination($base_url, count($searchset), $board_config['posts_per_page'], $start), "PAGINATION" => generate_pagination($base_url, count($searchset), $board_config['posts_per_page'], $start),
"ON_PAGE" => (floor($start/$board_config['posts_per_page'])+1), "ON_PAGE" => (floor($start/$board_config['posts_per_page'])+1),
"TOTAL_PAGES" => ceil((count($searchset))/$board_config['posts_per_page']), "TOTAL_PAGES" => ceil((count($searchset))/$board_config['posts_per_page']),
"L_OF" => $lang['of'], "L_OF" => $lang['of'],
"L_PAGE" => $lang['Page'], "L_PAGE" => $lang['Page'],
"L_GOTO_PAGE" => $lang['Goto_page']) "L_GOTO_PAGE" => $lang['Goto_page'])
@ -475,7 +484,7 @@ if((isset($HTTP_POST_VARS['dosearch']) || isset($HTTP_GET_VARS['dosearch'])) &&
// an auth function return of // an auth function return of
// all accessible forums ... I think // all accessible forums ... I think
// //
$sql = "SELECT forum_name, forum_id $sql = "SELECT forum_name, forum_id
FROM " . FORUMS_TABLE . " FROM " . FORUMS_TABLE . "
ORDER BY cat_id, forum_order"; ORDER BY cat_id, forum_order";
$result = $db->sql_query($sql); $result = $db->sql_query($sql);
@ -532,12 +541,12 @@ $template->assign_vars(array(
"L_SEARCH_AUTHOR" => $lang['Search_author'], "L_SEARCH_AUTHOR" => $lang['Search_author'],
"L_LIMIT_CHARACTERS" => $lang['Limit_chars'], "L_LIMIT_CHARACTERS" => $lang['Limit_chars'],
"L_SORT_BY" => $lang['Sort_by'], "L_SORT_BY" => $lang['Sort_by'],
"L_SORT_ASCENDING" => $lang['Sort_Ascending'], "L_SORT_ASCENDING" => $lang['Sort_Ascending'],
"L_SORT_DECENDING" => $lang['Sort_Decending'], "L_SORT_DECENDING" => $lang['Sort_Decending'],
"S_SEARCH_ACTION" => append_sid("search.$phpEx"), "S_SEARCH_ACTION" => append_sid("search.$phpEx"),
"S_CHARACTER_OPTIONS" => $s_characters, "S_CHARACTER_OPTIONS" => $s_characters,
"S_FORUM_OPTIONS" => $s_forums, "S_FORUM_OPTIONS" => $s_forums,
"S_SORT_OPTIONS" => $s_sortby, "S_SORT_OPTIONS" => $s_sortby,
"S_HIDDEN_FIELDS" => $s_hidden_fields) "S_HIDDEN_FIELDS" => $s_hidden_fields)
); );

View file

@ -3,13 +3,22 @@
* upgrade_20.php * upgrade_20.php
* ------------------- * -------------------
* begin : Sat Oct 14 2000 * begin : Sat Oct 14 2000
* copyright : (C) 2001 The phpBB Group * copyright : (C) 2001 The phpBB Group
* email : support@phpbb.com * email : support@phpbb.com
* *
* $id upgrade_20.php,v 1.9 2001/03/23 01:32:41 psotfx Exp $ * $id upgrade_20.php,v 1.9 2001/03/23 01:32:41 psotfx Exp $
* *
****************************************************************************/ ****************************************************************************/
/***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
***************************************************************************/
include('extension.inc'); include('extension.inc');
include('config.'.$phpEx); include('config.'.$phpEx);
include('includes/constants.'.$phpEx); include('includes/constants.'.$phpEx);
@ -44,19 +53,19 @@ function common_footer()
} }
function convert_ip($ip) function convert_ip($ip)
{ {
if (strstr($ip, ".")) if (strstr($ip, "."))
{ {
$ip_sep = explode(".", $ip); $ip_sep = explode(".", $ip);
$return = (( $ip_sep[0] * 0xFFFFFF + $ip_sep[0] ) + ( $ip_sep[1] * 0xFFFF + $ip_sep[1] ) + ( $ip_sep[2] * 0xFF + $ip_sep[2] ) + ( $ip_sep[3] ) ); $return = (( $ip_sep[0] * 0xFFFFFF + $ip_sep[0] ) + ( $ip_sep[1] * 0xFFFF + $ip_sep[1] ) + ( $ip_sep[2] * 0xFF + $ip_sep[2] ) + ( $ip_sep[3] ) );
} }
else else
{ {
$return = sprintf( "%d.%d.%d.%d", ( ( $ip >> 24 ) & 0xFF ), ( ( $ip >> 16 ) & 0xFF ), ( ( $ip >> 8 ) & 0xFF ), ( ( $ip ) & 0xFF ) ); $return = sprintf( "%d.%d.%d.%d", ( ( $ip >> 24 ) & 0xFF ), ( ( $ip >> 16 ) & 0xFF ), ( ( $ip >> 8 ) & 0xFF ), ( ( $ip ) & 0xFF ) );
} }
return($return); return($return);
} }
function convert_date($date_in) function convert_date($date_in)
{ {
@ -67,7 +76,7 @@ function convert_date($date_in)
// Original phpBB format // Original phpBB format
list($year, $month, $day) = split("-", $date); list($year, $month, $day) = split("-", $date);
list($hours, $minutes) = split(":", $time); list($hours, $minutes) = split(":", $time);
$timestamp = gmmktime($hours, $minutes, 0, $month, $day, $year); $timestamp = gmmktime($hours, $minutes, 0, $month, $day, $year);
return($timestamp); return($timestamp);
} }
@ -75,7 +84,7 @@ function convert_date($date_in)
// //
// Following functions adapted from phpMyAdmin // Following functions adapted from phpMyAdmin
// //
// Return table's CREATE definition // Return table's CREATE definition
// Returns a string containing the CREATE statement on success // Returns a string containing the CREATE statement on success
// //
function get_table_def($db, $table, $crlf) { function get_table_def($db, $table, $crlf) {
@ -91,7 +100,7 @@ function get_table_def($db, $table, $crlf) {
} }
while ($row = $db->sql_fetchrow($result)) { while ($row = $db->sql_fetchrow($result)) {
$schema_create .= " $row[Field] $row[Type]"; $schema_create .= " $row[Field] $row[Type]";
if (!empty($row["Default"])){ if (!empty($row["Default"])){
$schema_create .= " DEFAULT '$row[Default]'"; $schema_create .= " DEFAULT '$row[Default]'";
} }
@ -101,7 +110,7 @@ function get_table_def($db, $table, $crlf) {
if ($row["Extra"] != ""){ if ($row["Extra"] != ""){
$schema_create .= " $row[Extra]"; $schema_create .= " $row[Extra]";
} }
$schema_create .= ",$crlf"; $schema_create .= ",$crlf";
} }
@ -112,10 +121,10 @@ function get_table_def($db, $table, $crlf) {
$error = $db->sql_error(); $error = $db->sql_error();
error_die($db, GENERAL_ERROR, "Failed in get_table_content (show keys) : ".$error["message"]); error_die($db, GENERAL_ERROR, "Failed in get_table_content (show keys) : ".$error["message"]);
} }
while ($row = $db->sql_fetchrow($result)){ while ($row = $db->sql_fetchrow($result)){
$kname=$row['Key_name']; $kname=$row['Key_name'];
if (($kname != "PRIMARY") && ($row['Non_unique'] == 0)){ if (($kname != "PRIMARY") && ($row['Non_unique'] == 0)){
$kname="UNIQUE|$kname"; $kname="UNIQUE|$kname";
} }
@ -135,11 +144,11 @@ function get_table_def($db, $table, $crlf) {
$schema_create .= " KEY $x (" . implode($columns, ", ") . ")"; $schema_create .= " KEY $x (" . implode($columns, ", ") . ")";
} }
} }
$schema_create .= "$crlf);"; $schema_create .= "$crlf);";
return (stripslashes($schema_create)); return (stripslashes($schema_create));
} }
// //
// Get the content of table as a series of INSERT statements. // Get the content of table as a series of INSERT statements.
@ -155,9 +164,9 @@ function get_table_content($db, $table, $handler) {
error_die($db, GENERAL_ERROR, "Failed in get_table_content (select * ) : ".$error["message"]); error_die($db, GENERAL_ERROR, "Failed in get_table_content (select * ) : ".$error["message"]);
} }
$i = 0; $i = 0;
while ($row = $db->sql_fetchrow($result)) { while ($row = $db->sql_fetchrow($result)) {
$schema_insert = "INSERT INTO $table VALUES("; $schema_insert = "INSERT INTO $table VALUES(";
for ($j=0; $j<$db->sql_numfields($result);$j++) { for ($j=0; $j<$db->sql_numfields($result);$j++) {
@ -180,7 +189,7 @@ function get_table_content($db, $table, $handler) {
function output_table_content($content){ function output_table_content($content){
echo $content."\n"; echo $content."\n";
return; return;
} }
@ -200,17 +209,17 @@ function bbdecode($message) {
$quote_end_html = "</BLOCKQUOTE></FONT></TD></TR><TR><TD><HR></TD></TR></TABLE><!-- BBCode Quote End -->"; $quote_end_html = "</BLOCKQUOTE></FONT></TD></TR><TR><TD><HR></TD></TR></TABLE><!-- BBCode Quote End -->";
$message = str_replace($quote_start_html, "[quote]", $message); $message = str_replace($quote_start_html, "[quote]", $message);
$message = str_replace($quote_end_html, "[/quote]", $message); $message = str_replace($quote_end_html, "[/quote]", $message);
// Undo [b] and [i] // Undo [b] and [i]
$message = preg_replace("#<!-- BBCode Start --><B>(.*?)</B><!-- BBCode End -->#s", "[b]\\1[/b]", $message); $message = preg_replace("#<!-- BBCode Start --><B>(.*?)</B><!-- BBCode End -->#s", "[b]\\1[/b]", $message);
$message = preg_replace("#<!-- BBCode Start --><I>(.*?)</I><!-- BBCode End -->#s", "[i]\\1[/i]", $message); $message = preg_replace("#<!-- BBCode Start --><I>(.*?)</I><!-- BBCode End -->#s", "[i]\\1[/i]", $message);
// Undo [url] (long form) // Undo [url] (long form)
$message = preg_replace("#<!-- BBCode u2 Start --><A HREF=\"([a-z]+?://)(.*?)\" TARGET=\"_blank\">(.*?)</A><!-- BBCode u2 End -->#s", "[url=\\1\\2]\\3[/url]", $message); $message = preg_replace("#<!-- BBCode u2 Start --><A HREF=\"([a-z]+?://)(.*?)\" TARGET=\"_blank\">(.*?)</A><!-- BBCode u2 End -->#s", "[url=\\1\\2]\\3[/url]", $message);
// Undo [url] (short form) // Undo [url] (short form)
$message = preg_replace("#<!-- BBCode u1 Start --><A HREF=\"([a-z]+?://)(.*?)\" TARGET=\"_blank\">(.*?)</A><!-- BBCode u1 End -->#s", "[url]\\3[/url]", $message); $message = preg_replace("#<!-- BBCode u1 Start --><A HREF=\"([a-z]+?://)(.*?)\" TARGET=\"_blank\">(.*?)</A><!-- BBCode u1 End -->#s", "[url]\\3[/url]", $message);
// Undo [email] // Undo [email]
$message = preg_replace("#<!-- BBCode Start --><A HREF=\"mailto:(.*?)\">(.*?)</A><!-- BBCode End -->#s", "[email]\\1[/email]", $message); $message = preg_replace("#<!-- BBCode Start --><A HREF=\"mailto:(.*?)\">(.*?)</A><!-- BBCode End -->#s", "[email]\\1[/email]", $message);
@ -218,16 +227,16 @@ function bbdecode($message) {
$message = preg_replace("#<!-- BBCode Start --><IMG SRC=\"(.*?)\" BORDER=\"0\"><!-- BBCode End -->#s", "[img]\\1[/img]", $message); $message = preg_replace("#<!-- BBCode Start --><IMG SRC=\"(.*?)\" BORDER=\"0\"><!-- BBCode End -->#s", "[img]\\1[/img]", $message);
// Undo lists (unordered/ordered) // Undo lists (unordered/ordered)
// <li> tags: // <li> tags:
$message = str_replace("<!-- BBCode --><LI>", "[*]", $message); $message = str_replace("<!-- BBCode --><LI>", "[*]", $message);
// [list] tags: // [list] tags:
$message = str_replace("<!-- BBCode ulist Start --><UL>", "[list]", $message); $message = str_replace("<!-- BBCode ulist Start --><UL>", "[list]", $message);
// [list=x] tags: // [list=x] tags:
$message = preg_replace("#<!-- BBCode olist Start --><OL TYPE=([A1])>#si", "[list=\\1]", $message); $message = preg_replace("#<!-- BBCode olist Start --><OL TYPE=([A1])>#si", "[list=\\1]", $message);
// [/list] tags: // [/list] tags:
$message = str_replace("</UL><!-- BBCode ulist End -->", "[/list]", $message); $message = str_replace("</UL><!-- BBCode ulist End -->", "[/list]", $message);
$message = str_replace("</OL><!-- BBCode olist End -->", "[/list]", $message); $message = str_replace("</OL><!-- BBCode olist End -->", "[/list]", $message);
@ -242,14 +251,14 @@ function bbdecode($message) {
* - Does not distinguish between "www.xxxx.yyyy" and "http://aaaa.bbbb" type URLs. * - Does not distinguish between "www.xxxx.yyyy" and "http://aaaa.bbbb" type URLs.
* *
*/ */
function undo_make_clickable($text) { function undo_make_clickable($text) {
$text = preg_replace("#<!-- BBCode auto-link start --><a href=\"(.*?)\" target=\"_blank\">.*?</a><!-- BBCode auto-link end -->#i", "\\1", $text); $text = preg_replace("#<!-- BBCode auto-link start --><a href=\"(.*?)\" target=\"_blank\">.*?</a><!-- BBCode auto-link end -->#i", "\\1", $text);
$text = preg_replace("#<!-- BBcode auto-mailto start --><a href=\"mailto:(.*?)\">.*?</a><!-- BBCode auto-mailto end -->#i", "\\1", $text); $text = preg_replace("#<!-- BBcode auto-mailto start --><a href=\"mailto:(.*?)\">.*?</a><!-- BBCode auto-mailto end -->#i", "\\1", $text);
return $text; return $text;
} }
// //
@ -260,9 +269,9 @@ function undo_make_clickable($text) {
?> ?>
<?php <?php
if(isset($next)) if(isset($next))
{ {
switch($next) switch($next)
{ {
case 'backup': case 'backup':
@ -388,9 +397,9 @@ if(isset($next))
{ {
while($row = $db->sql_fetchrow($result)) while($row = $db->sql_fetchrow($result))
{ {
$sql = "INSERT INTO phpbb_banlist $sql = "INSERT INTO phpbb_banlist
(ban_id, ban_userid, ban_ip, ban_start, ban_end, ban_time_type) (ban_id, ban_userid, ban_ip, ban_start, ban_end, ban_time_type)
VALUES VALUES
('".$row["ban_id"]."', '".$row["ban_userid"]."', '".convert_ip($row["ban_ip"])."', '".$row["ban_start"]."', '".$row["ban_end"]."', '".$row["ban_time_type"]."')"; ('".$row["ban_id"]."', '".$row["ban_userid"]."', '".convert_ip($row["ban_ip"])."', '".$row["ban_start"]."', '".$row["ban_end"]."', '".$row["ban_time_type"]."')";
$insert_result = $db->sql_query($sql); $insert_result = $db->sql_query($sql);
if(!$insert_result) if(!$insert_result)
@ -458,7 +467,7 @@ if(isset($next))
{ {
while($row = $db->sql_fetchrow($result)) while($row = $db->sql_fetchrow($result))
{ {
$sql = "INSERT INTO phpbb_config $sql = "INSERT INTO phpbb_config
(config_id, sitename, allow_html, allow_bbcode, allow_sig, allow_namechange, selected, posts_per_page, hot_threshold, topics_per_page, allow_theme_create, override_themes, email_sig, email_from, default_lang) (config_id, sitename, allow_html, allow_bbcode, allow_sig, allow_namechange, selected, posts_per_page, hot_threshold, topics_per_page, allow_theme_create, override_themes, email_sig, email_from, default_lang)
VALUES VALUES
('".$row["config_id"]."', '".$row["sitename"]."', '".$row["allow_html"]."', '".$row["allow_bbcode"]."', '".$row["allow_sig"]."', '".$row["allow_namechange"]."', '".$row["selected"]."', '".$row["posts_per_page"]."', '".$row["hot_threshold"]."', '".$row["topics_per_page"]."', '".$row["allow_theme_create"]."', '".$row["override_themes"]."', '".$row["email_sig"]."', '".$row["email_from"]."', '".$row["default_lang"]."')"; ('".$row["config_id"]."', '".$row["sitename"]."', '".$row["allow_html"]."', '".$row["allow_bbcode"]."', '".$row["allow_sig"]."', '".$row["allow_namechange"]."', '".$row["selected"]."', '".$row["posts_per_page"]."', '".$row["hot_threshold"]."', '".$row["topics_per_page"]."', '".$row["allow_theme_create"]."', '".$row["override_themes"]."', '".$row["email_sig"]."', '".$row["email_from"]."', '".$row["default_lang"]."')";
@ -843,7 +852,7 @@ if(isset($next))
// do 2.x first-pass encoding.. // do 2.x first-pass encoding..
$row['post_text'] = bbencode_first_pass($row['post_text'], $uid); $row['post_text'] = bbencode_first_pass($row['post_text'], $uid);
$row['post_text'] = addslashes($row['post_text']); $row['post_text'] = addslashes($row['post_text']);
$sql = "INSERT INTO phpbb_posts $sql = "INSERT INTO phpbb_posts
(post_id, topic_id, forum_id, poster_id, post_time, poster_ip, bbcode_uid) (post_id, topic_id, forum_id, poster_id, post_time, poster_ip, bbcode_uid)
VALUES VALUES
@ -975,7 +984,7 @@ if(isset($next))
} // switch } // switch
} // if next } // if next
else else
{ {
common_header(); common_header();
?> ?>
@ -994,7 +1003,7 @@ else
<INPUT TYPE="HIDDEN" NAME="next" VALUE="backup"> <INPUT TYPE="HIDDEN" NAME="next" VALUE="backup">
<INPUT TYPE="SUBMIT" VALUE="Next >"> <INPUT TYPE="SUBMIT" VALUE="Next >">
</FORM> </FORM>
<?php <?php
} }
?> ?>
</BODY> </BODY>

View file

@ -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 = "./"; $phpbb_root_path = "./";
include($phpbb_root_path . 'extension.inc'); include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx); include($phpbb_root_path . 'common.'.$phpEx);
@ -245,7 +254,7 @@ $sql = "SELECT t.*, u.username, u.user_id, u2.username as user2, u2.user_id as i
AND t.topic_poster = u.user_id AND t.topic_poster = u.user_id
AND p.post_id = t.topic_last_post_id AND p.post_id = t.topic_last_post_id
AND p.poster_id = u2.user_id AND p.poster_id = u2.user_id
AND t.topic_type = " . POST_ANNOUNCE . " AND t.topic_type = " . POST_ANNOUNCE . "
ORDER BY p.post_time DESC"; ORDER BY p.post_time DESC";
if(!$ta_result = $db->sql_query($sql)) if(!$ta_result = $db->sql_query($sql))
{ {

View file

@ -1,15 +1,24 @@
<?php <?php
/*************************************************************************** /***************************************************************************
* viewonline.php * viewonline.php
* ------------------- * -------------------
* begin : Saturday, Feb 13, 2001 * begin : Saturday, Feb 13, 2001
* copyright : (C) 2001 The phpBB Group * copyright : (C) 2001 The phpBB Group
* email : support@phpbb.com * 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.
*
***************************************************************************/
$phpbb_root_path = "./"; $phpbb_root_path = "./";
include($phpbb_root_path . 'extension.inc'); include($phpbb_root_path . 'extension.inc');
@ -38,9 +47,9 @@ $template->set_filenames(array(
$jumpbox = make_jumpbox(); $jumpbox = make_jumpbox();
$template->assign_vars(array( $template->assign_vars(array(
"L_GO" => $lang['Go'], "L_GO" => $lang['Go'],
"L_JUMP_TO" => $lang['Jump_to'], "L_JUMP_TO" => $lang['Jump_to'],
"L_SELECT_FORUM" => $lang['Select_forum'], "L_SELECT_FORUM" => $lang['Select_forum'],
"JUMPBOX_LIST" => $jumpbox, "JUMPBOX_LIST" => $jumpbox,
"SELECT_NAME" => POST_FORUM_URL) "SELECT_NAME" => POST_FORUM_URL)
); );
@ -50,11 +59,11 @@ $template->assign_var_from_handle("JUMPBOX", "jumpbox");
// //
$sql = "SELECT u.user_id, u.username, u.user_allow_viewonline, s.session_page, s.session_logged_in, s.session_time $sql = "SELECT u.user_id, u.username, u.user_allow_viewonline, s.session_page, s.session_logged_in, s.session_time
FROM " . USERS_TABLE . " u, " . SESSIONS_TABLE . " s FROM " . USERS_TABLE . " u, " . SESSIONS_TABLE . " s
WHERE u.user_id <> " . ANONYMOUS . " WHERE u.user_id <> " . ANONYMOUS . "
AND u.user_id = s.session_user_id AND u.user_id = s.session_user_id
AND s.session_time >= " . ( time() - 300 ) . " AND s.session_time >= " . ( time() - 300 ) . "
AND s.session_logged_in = " . TRUE . " AND s.session_logged_in = " . TRUE . "
ORDER BY s.session_time DESC"; ORDER BY s.session_time DESC";
if(!$result = $db->sql_query($sql)) if(!$result = $db->sql_query($sql))
{ {
@ -64,7 +73,7 @@ $onlinerow_reg = $db->sql_fetchrowset($result);
$sql = "SELECT session_page, session_logged_in, session_time $sql = "SELECT session_page, session_logged_in, session_time
FROM " . SESSIONS_TABLE . " FROM " . SESSIONS_TABLE . "
WHERE session_logged_in = 0 WHERE session_logged_in = 0
AND session_time >= " . ( time() - 300 ) . " AND session_time >= " . ( time() - 300 ) . "
ORDER BY session_time DESC"; ORDER BY session_time DESC";
if(!$result = $db->sql_query($sql)) if(!$result = $db->sql_query($sql))
@ -89,7 +98,7 @@ else
$template->assign_vars(array( $template->assign_vars(array(
"L_WHOSONLINE" => $lang['Who_is_online'], "L_WHOSONLINE" => $lang['Who_is_online'],
"L_ONLINE_EXPLAIN" => $lang['Online_explain'], "L_ONLINE_EXPLAIN" => $lang['Online_explain'],
"L_USERNAME" => $lang['Username'], "L_USERNAME" => $lang['Username'],
"L_LOCATION" => $lang['Location'], "L_LOCATION" => $lang['Location'],
"L_LAST_UPDATE" => $lang['Last_updated']) "L_LAST_UPDATE" => $lang['Last_updated'])
@ -120,7 +129,7 @@ if( count($onlinerow_reg) )
$hidden = FALSE; $hidden = FALSE;
$registered_users++; $registered_users++;
} }
else else
{ {
$displayed_userid_list .= "," . $onlinerow_reg[$i]['user_id']; $displayed_userid_list .= "," . $onlinerow_reg[$i]['user_id'];
@ -204,14 +213,14 @@ if( count($onlinerow_reg) )
$l_is_are = ($registered_users == 1) ? $lang['is'] : $lang['are']; $l_is_are = ($registered_users == 1) ? $lang['is'] : $lang['are'];
$template->assign_vars(array( $template->assign_vars(array(
"TOTAL_REGISTERED_USERS_ONLINE" => $lang['There'] . " $l_is_are $logged_visible_online " . $lang['Registered'] . " $l_r_user_s " . $lang['and'] . " $logged_hidden_online " . $lang['Hidden'] . " $l_h_user_s " . $lang['online']) "TOTAL_REGISTERED_USERS_ONLINE" => $lang['There'] . " $l_is_are $logged_visible_online " . $lang['Registered'] . " $l_r_user_s " . $lang['and'] . " $logged_hidden_online " . $lang['Hidden'] . " $l_h_user_s " . $lang['online'])
); );
} }
else else
{ {
$template->assign_vars(array( $template->assign_vars(array(
"TOTAL_REGISTERED_USERS_ONLINE" => $lang['There'] . " " . $lang['are'] . " 0 " . $lang['Registered'] . " " . $lang['Users'] . " " . $lang['and'] . " 0 " . $lang['Hidden'] . " " . $lang['Users'] . " " . $lang['online'], "TOTAL_REGISTERED_USERS_ONLINE" => $lang['There'] . " " . $lang['are'] . " 0 " . $lang['Registered'] . " " . $lang['Users'] . " " . $lang['and'] . " 0 " . $lang['Hidden'] . " " . $lang['Users'] . " " . $lang['online'],
"L_NO_REGISTERED_USERS_BROWSING" => $lang['No_users_browsing']) "L_NO_REGISTERED_USERS_BROWSING" => $lang['No_users_browsing'])
); );
} }
@ -296,14 +305,14 @@ if( count($onlinerow_guest) )
$l_is_are = ($guest_users == 1) ? $lang['is'] : $lang['are']; $l_is_are = ($guest_users == 1) ? $lang['is'] : $lang['are'];
$template->assign_vars(array( $template->assign_vars(array(
"TOTAL_GUEST_USERS_ONLINE" => $lang['There'] . " $l_is_are $guests_online " . $lang['Guest'] . " $l_g_user_s " . $lang['online']) "TOTAL_GUEST_USERS_ONLINE" => $lang['There'] . " $l_is_are $guests_online " . $lang['Guest'] . " $l_g_user_s " . $lang['online'])
); );
} }
else else
{ {
$template->assign_vars(array( $template->assign_vars(array(
"TOTAL_GUEST_USERS_ONLINE" => $lang['There'] . " " . $lang['are'] . " 0 " . $lang['Guest'] . " " . $lang['Users'] . " " . $lang['online'], "TOTAL_GUEST_USERS_ONLINE" => $lang['There'] . " " . $lang['are'] . " 0 " . $lang['Guest'] . " " . $lang['Users'] . " " . $lang['online'],
"L_NO_GUESTS_BROWSING" => $lang['No_guests_browsing']) "L_NO_GUESTS_BROWSING" => $lang['No_guests_browsing'])
); );
} }

View file

@ -164,7 +164,7 @@ if(!$is_auth['auth_view'] || !$is_auth['auth_read'])
// //
// //
// Is user watching this thread? This could potentially // Is user watching this thread? This could potentially
// be combined into the above query but the LEFT JOIN causes // be combined into the above query but the LEFT JOIN causes
// a number of problems which will probably end up in this // a number of problems which will probably end up in this
// solution being practically as fast and certainly simpler! // solution being practically as fast and certainly simpler!
@ -173,9 +173,9 @@ if($userdata['user_id'] != ANONYMOUS)
{ {
$can_watch_topic = TRUE; $can_watch_topic = TRUE;
$sql = "SELECT notify_status $sql = "SELECT notify_status
FROM " . TOPICS_WATCH_TABLE . " FROM " . TOPICS_WATCH_TABLE . "
WHERE topic_id = $topic_id WHERE topic_id = $topic_id
AND user_id = " . $userdata['user_id']; AND user_id = " . $userdata['user_id'];
if( !$result = $db->sql_query($sql) ) if( !$result = $db->sql_query($sql) )
{ {
@ -190,8 +190,8 @@ if($userdata['user_id'] != ANONYMOUS)
$is_watching_topic = 0; $is_watching_topic = 0;
$sql_priority = (SQL_LAYER == "mysql") ? "LOW_PRIORITY" : ""; $sql_priority = (SQL_LAYER == "mysql") ? "LOW_PRIORITY" : "";
$sql = "DELETE $sql_priority FROM " . TOPICS_WATCH_TABLE . " $sql = "DELETE $sql_priority FROM " . TOPICS_WATCH_TABLE . "
WHERE topic_id = $topic_id WHERE topic_id = $topic_id
AND user_id = " . $userdata['user_id']; AND user_id = " . $userdata['user_id'];
if( !$result = $db->sql_query($sql) ) if( !$result = $db->sql_query($sql) )
{ {
@ -208,9 +208,9 @@ if($userdata['user_id'] != ANONYMOUS)
if( $watch_data['notify_status'] ) if( $watch_data['notify_status'] )
{ {
$sql_priority = (SQL_LAYER == "mysql") ? "LOW_PRIORITY" : ""; $sql_priority = (SQL_LAYER == "mysql") ? "LOW_PRIORITY" : "";
$sql = "UPDATE $sql_priority " . TOPICS_WATCH_TABLE . " $sql = "UPDATE $sql_priority " . TOPICS_WATCH_TABLE . "
SET notify_status = 0 SET notify_status = 0
WHERE topic_id = $topic_id WHERE topic_id = $topic_id
AND user_id = " . $userdata['user_id']; AND user_id = " . $userdata['user_id'];
if( !$result = $db->sql_query($sql) ) if( !$result = $db->sql_query($sql) )
{ {
@ -228,7 +228,7 @@ if($userdata['user_id'] != ANONYMOUS)
$is_watching_topic = TRUE; $is_watching_topic = TRUE;
$sql_priority = (SQL_LAYER == "mysql") ? "LOW_PRIORITY" : ""; $sql_priority = (SQL_LAYER == "mysql") ? "LOW_PRIORITY" : "";
$sql = "INSERT $sql_priority INTO " . TOPICS_WATCH_TABLE . " (user_id, topic_id, notify_status) $sql = "INSERT $sql_priority INTO " . TOPICS_WATCH_TABLE . " (user_id, topic_id, notify_status)
VALUES (" . $userdata['user_id'] . ", $topic_id, 0)"; VALUES (" . $userdata['user_id'] . ", $topic_id, 0)";
if( !$result = $db->sql_query($sql) ) if( !$result = $db->sql_query($sql) )
{ {
@ -362,7 +362,7 @@ $ranksrow = $db->sql_fetchrowset($ranksresult);
// //
// Define censored word matches // Define censored word matches
// //
$sql = "SELECT word, replacement $sql = "SELECT word, replacement
FROM " . WORDS_TABLE; FROM " . WORDS_TABLE;
if( !$words_result = $db->sql_query($sql) ) if( !$words_result = $db->sql_query($sql) )
{ {
@ -413,8 +413,8 @@ $template->assign_vars(array(
"TOPIC_ID" => $topic_id, "TOPIC_ID" => $topic_id,
"TOPIC_TITLE" => $topic_title, "TOPIC_TITLE" => $topic_title,
"L_DISPLAY_POSTS" => $lang['Display_posts'], "L_DISPLAY_POSTS" => $lang['Display_posts'],
"L_RETURN_TO_TOP" => $lang['Return_to_top'], "L_RETURN_TO_TOP" => $lang['Return_to_top'],
"S_SELECT_POST_DAYS" => $select_post_days, "S_SELECT_POST_DAYS" => $select_post_days,
"S_SELECT_POST_ORDER" => $select_post_order, "S_SELECT_POST_ORDER" => $select_post_order,
@ -594,11 +594,11 @@ for($i = 0; $i < $total_posts; $i++)
if( $is_auth['auth_mod'] ) if( $is_auth['auth_mod'] )
{ {
$ip_img = "<a href=\"" . append_sid("modcp.$phpEx?mode=viewip&amp;" . POST_POST_URL . "=" . $post_id) . "\"><img src=\"" . $images['icon_ip'] . "\" alt=\"" . $lang['View_IP'] . "\" border=\"0\" /></a>"; $ip_img = "<a href=\"" . append_sid("modcp.$phpEx?mode=ip&amp;" . POST_POST_URL . "=" . $postrow[$i]['post_id'] . "&" . POST_TOPIC_URL . "=$topic_id") . "\"><img src=\"" . $images['icon_ip'] . "\" alt=\"" . $lang['View_IP'] . "\" border=\"0\" /></a>";
$delpost_img = "<a href=\"" . append_sid("topicadmin.$phpEx?mode=delpost&amp;" . POST_POST_URL . "=" . $postrow[$i]['post_id']) . "\"><img src=\"" . $images['icon_delpost'] . "\" alt=\"" . $lang['Delete_post'] . "\" border=\"0\" /></a>"; $delpost_img = "<a href=\"" . append_sid("topicadmin.$phpEx?mode=delpost&amp;" . POST_POST_URL . "=" . $postrow[$i]['post_id']) . "\"><img src=\"" . $images['icon_delpost'] . "\" alt=\"" . $lang['Delete_post'] . "\" border=\"0\" /></a>";
} }
$message = stripslashes($postrow[$i]['post_text']); $message = stripslashes($postrow[$i]['post_text']);
$post_subject = ($postrow[$i]['post_subject'] != "") ? stripslashes($postrow[$i]['post_subject']) : $topic_title; $post_subject = ($postrow[$i]['post_subject'] != "") ? stripslashes($postrow[$i]['post_subject']) : $topic_title;
@ -627,7 +627,7 @@ for($i = 0; $i < $total_posts; $i++)
$message = bbencode_second_pass($message, $bbcode_uid); $message = bbencode_second_pass($message, $bbcode_uid);
// //
// This compensates for bbcode's rather agressive (but I guess necessary) // This compensates for bbcode's rather agressive (but I guess necessary)
// HTML handling // HTML handling
// //
if(!$postrow[$i]['enable_html'] || ($postrow[$i]['enable_html'] && !$board_config['allow_html']) ) if(!$postrow[$i]['enable_html'] || ($postrow[$i]['enable_html'] && !$board_config['allow_html']) )
@ -771,15 +771,15 @@ $template->assign_vars(array(
"ON_PAGE" => ( floor( $start / $board_config['posts_per_page'] ) + 1 ), "ON_PAGE" => ( floor( $start / $board_config['posts_per_page'] ) + 1 ),
"TOTAL_PAGES" => ceil( $total_replies / $board_config['posts_per_page'] ), "TOTAL_PAGES" => ceil( $total_replies / $board_config['posts_per_page'] ),
"S_AUTH_LIST" => $s_auth_can, "S_AUTH_LIST" => $s_auth_can,
"S_AUTH_READ_IMG" => $s_auth_read_img, "S_AUTH_READ_IMG" => $s_auth_read_img,
"S_AUTH_POST_IMG" => $s_auth_post_img, "S_AUTH_POST_IMG" => $s_auth_post_img,
"S_AUTH_REPLY_IMG" => $s_auth_reply_img, "S_AUTH_REPLY_IMG" => $s_auth_reply_img,
"S_AUTH_EDIT_IMG" => $s_auth_edit_img, "S_AUTH_EDIT_IMG" => $s_auth_edit_img,
"S_AUTH_MOD_IMG" => $s_auth_mod_img, "S_AUTH_MOD_IMG" => $s_auth_mod_img,
"S_TOPIC_ADMIN" => $topic_mod, "S_TOPIC_ADMIN" => $topic_mod,
"S_WATCH_TOPIC" => $s_watching_topic, "S_WATCH_TOPIC" => $s_watching_topic,
"S_WATCH_TOPIC_IMG" => $s_watching_topic_img, "S_WATCH_TOPIC_IMG" => $s_watching_topic_img,
"L_OF" => $lang['of'], "L_OF" => $lang['of'],
"L_PAGE" => $lang['Page'], "L_PAGE" => $lang['Page'],