Hard-coded HTML into admin modules ... no point in continuing to template this stuff since no one (or few) rarely bother to make use of the feature. Lots of changes for permissions, sessions, etc. some new styling stuff present (inc. editing templates though not complete), lots of bugs and non-functioning stuff ... any 'existing' modules will cause the right hand panel to fail ... remove them. If I catch anyone nicking graphics from here I'll kill 'em ...

git-svn-id: file:///svn/phpbb/trunk@2675 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Paul S. Owen 2002-07-14 14:51:03 +00:00
parent 71707ca5db
commit fad21bcb01
19 changed files with 2112 additions and 2189 deletions

View file

@ -8,120 +8,132 @@
*
* $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.
*
***************************************************************************/
define('IN_PHPBB', 1);
if( !empty($setmodules) )
if ( !empty($setmodules) )
{
if ( !$acl->get_acl_admin('general') )
{
return;
}
$file = basename(__FILE__);
$module['General']['Configuration'] = "$file?mode=config";
$module['General']['Avatar_Setup'] = "$file?mode=avatars";
$module['General']['Basic_Config'] = "$file?mode=basic";
$module['General']['Cookie_Parameters'] = "$file?mode=cookies";
$module['General']['Default_Settings'] = "$file?mode=gendefs";
$module['Users']['Default_Settings'] = "$file?mode=userdefs";
return;
}
//
// Let's set the root dir for phpBB
//
define('IN_PHPBB', 1);
$phpbb_root_path = "../";
require($phpbb_root_path . 'extension.inc');
require('pagestart.' . $phpEx);
include($phpbb_root_path . 'includes/functions_selects.'.$phpEx);
if ( !$acl->get_acl_admin('general') )
{
return;
}
//
// Pull all config data
//
$sql = "SELECT *
FROM " . CONFIG_TABLE;
if(!$result = $db->sql_query($sql))
$result = $db->sql_query($sql);
while ( $row = $db->sql_fetchrow($result) )
{
message_die(CRITICAL_ERROR, "Could not query config information in admin_board", "", __LINE__, __FILE__, $sql);
}
else
{
while( $row = $db->sql_fetchrow($result) )
{
$config_name = $row['config_name'];
$config_value = $row['config_value'];
$default_config[$config_name] = $config_value;
$new[$config_name] = ( isset($HTTP_POST_VARS[$config_name]) ) ? $HTTP_POST_VARS[$config_name] : $default_config[$config_name];
if( isset($HTTP_POST_VARS['submit']) )
if ( isset($HTTP_POST_VARS['submit']) )
{
$sql = "UPDATE " . CONFIG_TABLE . " SET
config_value = '" . str_replace("\'", "''", $new[$config_name]) . "'
WHERE config_name = '$config_name'";
if( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, "Failed to update general configuration for $config_name", "", __LINE__, __FILE__, $sql);
}
}
}
if( isset($HTTP_POST_VARS['submit']) )
{
$message = $lang['Config_updated'] . "<br /><br />" . sprintf($lang['Click_return_config'], "<a href=\"" . append_sid("admin_board.$phpEx") . "\">", "</a>") . "<br /><br />" . sprintf($lang['Click_return_admin_index'], "<a href=\"" . append_sid("index.$phpEx?pane=right") . "\">", "</a>");
message_die(GENERAL_MESSAGE, $message);
$db->sql_query($sql);
}
}
$style_select = style_select($new['default_style'], 'default_style', "../templates");
$lang_select = language_select($new['default_lang'], 'default_lang', "../language");
if ( isset($HTTP_POST_VARS['submit']) )
{
$message = $lang['Config_updated'] . "<br /><br />" . sprintf($lang['Click_return_config'], '<a href="' . "admin_board.$phpEx$SID" . '">', '</a>') . '<br /><br />' . sprintf($lang['Click_return_admin_index'], '<a href="' . "index.$phpEx$SID?pane=right" . '">', '</a>');
message_die(MESSAGE, $message);
}
$style_select = style_select($new['default_style'], 'default_style', '../templates');
$lang_select = language_select($new['default_lang'], 'default_lang', '../language');
$timezone_select = tz_select($new['board_timezone'], 'board_timezone');
$disable_board_yes = ( $new['board_disable'] ) ? "checked=\"checked\"" : "";
$disable_board_no = ( !$new['board_disable'] ) ? "checked=\"checked\"" : "";
$disable_board_yes = ( $new['board_disable'] ) ? 'checked="checked"' : '';
$disable_board_no = ( !$new['board_disable'] ) ? 'checked="checked"' : '';
$cookie_secure_yes = ( $new['cookie_secure'] ) ? "checked=\"checked\"" : "";
$cookie_secure_no = ( !$new['cookie_secure'] ) ? "checked=\"checked\"" : "";
$cookie_secure_yes = ( $new['cookie_secure'] ) ? 'checked="checked"' : '';
$cookie_secure_no = ( !$new['cookie_secure'] ) ? 'checked="checked"' : '';
$html_tags = $new['allow_html_tags'];
$override_user_style_yes = ( $new['override_user_style'] ) ? "checked=\"checked\"" : "";
$override_user_style_no = ( !$new['override_user_style'] ) ? "checked=\"checked\"" : "";
$override_user_style_yes = ( $new['override_user_style'] ) ? 'checked="checked"' : '';
$override_user_style_no = ( !$new['override_user_style'] ) ? 'checked="checked"' : '';
$html_yes = ( $new['allow_html'] ) ? "checked=\"checked\"" : "";
$html_no = ( !$new['allow_html'] ) ? "checked=\"checked\"" : "";
$html_yes = ( $new['allow_html'] ) ? 'checked="checked"' : '';
$html_no = ( !$new['allow_html'] ) ? 'checked="checked"' : '';
$bbcode_yes = ( $new['allow_bbcode'] ) ? "checked=\"checked\"" : "";
$bbcode_no = ( !$new['allow_bbcode'] ) ? "checked=\"checked\"" : "";
$bbcode_yes = ( $new['allow_bbcode'] ) ? 'checked="checked"' : '';
$bbcode_no = ( !$new['allow_bbcode'] ) ? 'checked="checked"' : '';
$activation_none = ( $new['require_activation'] == USER_ACTIVATION_NONE ) ? "checked=\"checked\"" : "";
$activation_user = ( $new['require_activation'] == USER_ACTIVATION_SELF ) ? "checked=\"checked\"" : "";
$activation_admin = ( $new['require_activation'] == USER_ACTIVATION_ADMIN ) ? "checked=\"checked\"" : "";
$activation_none = ( $new['require_activation'] == USER_ACTIVATION_NONE ) ? 'checked="checked"' : '';
$activation_user = ( $new['require_activation'] == USER_ACTIVATION_SELF ) ? 'checked="checked"' : '';
$activation_admin = ( $new['require_activation'] == USER_ACTIVATION_ADMIN ) ? 'checked="checked"' : '';
$board_email_form_yes = ( $new['board_email_form'] ) ? "checked=\"checked\"" : "";
$board_email_form_no = ( !$new['board_email_form'] ) ? "checked=\"checked\"" : "";
$board_email_form_yes = ( $new['board_email_form'] ) ? 'checked="checked"' : '';
$board_email_form_no = ( !$new['board_email_form'] ) ? 'checked="checked"' : '';
$gzip_yes = ( $new['gzip_compress'] ) ? "checked=\"checked\"" : "";
$gzip_no = ( !$new['gzip_compress'] ) ? "checked=\"checked\"" : "";
$gzip_yes = ( $new['gzip_compress'] ) ? 'checked="checked"' : '';
$gzip_no = ( !$new['gzip_compress'] ) ? 'checked="checked"' : '';
$privmsg_on = ( !$new['privmsg_disable'] ) ? "checked=\"checked\"" : "";
$privmsg_off = ( $new['privmsg_disable'] ) ? "checked=\"checked\"" : "";
$privmsg_on = ( !$new['privmsg_disable'] ) ? 'checked="checked"' : '';
$privmsg_off = ( $new['privmsg_disable'] ) ? 'checked="checked"' : '';
$prune_yes = ( $new['prune_enable'] ) ? "checked=\"checked\"" : "";
$prune_no = ( !$new['prune_enable'] ) ? "checked=\"checked\"" : "";
$prune_yes = ( $new['prune_enable'] ) ? 'checked="checked"' : '';
$prune_no = ( !$new['prune_enable'] ) ? 'checked="checked"' : '';
$smile_yes = ( $new['allow_smilies'] ) ? "checked=\"checked\"" : "";
$smile_no = ( !$new['allow_smilies'] ) ? "checked=\"checked\"" : "";
$smile_yes = ( $new['allow_smilies'] ) ? 'checked="checked"' : '';
$smile_no = ( !$new['allow_smilies'] ) ? 'checked="checked"' : '';
$sig_yes = ( $new['allow_sig'] ) ? "checked=\"checked\"" : "";
$sig_no = ( !$new['allow_sig'] ) ? "checked=\"checked\"" : "";
$sig_yes = ( $new['allow_sig'] ) ? 'checked="checked"' : '';
$sig_no = ( !$new['allow_sig'] ) ? 'checked="checked"' : '';
$namechange_yes = ( $new['allow_namechange'] ) ? "checked=\"checked\"" : "";
$namechange_no = ( !$new['allow_namechange'] ) ? "checked=\"checked\"" : "";
$namechange_yes = ( $new['allow_namechange'] ) ? 'checked="checked"' : '';
$namechange_no = ( !$new['allow_namechange'] ) ? 'checked="checked"' : '';
$avatars_local_yes = ( $new['allow_avatar_local'] ) ? "checked=\"checked\"" : "";
$avatars_local_no = ( !$new['allow_avatar_local'] ) ? "checked=\"checked\"" : "";
$avatars_remote_yes = ( $new['allow_avatar_remote'] ) ? "checked=\"checked\"" : "";
$avatars_remote_no = ( !$new['allow_avatar_remote'] ) ? "checked=\"checked\"" : "";
$avatars_upload_yes = ( $new['allow_avatar_upload'] ) ? "checked=\"checked\"" : "";
$avatars_upload_no = ( !$new['allow_avatar_upload'] ) ? "checked=\"checked\"" : "";
$avatars_local_yes = ( $new['allow_avatar_local'] ) ? 'checked="checked"' : '';
$avatars_local_no = ( !$new['allow_avatar_local'] ) ? 'checked="checked"' : '';
$avatars_remote_yes = ( $new['allow_avatar_remote'] ) ? 'checked="checked"' : '';
$avatars_remote_no = ( !$new['allow_avatar_remote'] ) ? 'checked="checked"' : '';
$avatars_upload_yes = ( $new['allow_avatar_upload'] ) ? 'checked="checked"' : '';
$avatars_upload_no = ( !$new['allow_avatar_upload'] ) ? 'checked="checked"' : '';
$smtp_yes = ( $new['smtp_delivery'] ) ? "checked=\"checked\"" : "";
$smtp_no = ( !$new['smtp_delivery'] ) ? "checked=\"checked\"" : "";
$smtp_yes = ( $new['smtp_delivery'] ) ? 'checked="checked"' : '';
$smtp_no = ( !$new['smtp_delivery'] ) ? 'checked="checked"' : '';
$template->set_filenames(array(
"body" => "admin/board_config_body.tpl")
@ -131,10 +143,8 @@ $template->set_filenames(array(
// Escape any quotes in the site description for proper display in the text
// box on the admin page
//
$new['site_desc'] = str_replace('"', '&quot;', $new['site_desc']);
$new['sitename'] = str_replace('"', '&quot;', strip_tags($new['sitename']));
$template->assign_vars(array(
"S_CONFIG_ACTION" => append_sid("admin_board.$phpEx"),
"S_CONFIG_ACTION" => "admin_board.$phpEx$SID",
"L_YES" => $lang['Yes'],
"L_NO" => $lang['No'],
@ -232,8 +242,8 @@ $template->assign_vars(array(
"SERVER_NAME" => $new['server_name'],
"SCRIPT_PATH" => $new['script_path'],
"SERVER_PORT" => $new['server_port'],
"SITENAME" => $new['sitename'],
"SITE_DESCRIPTION" => $new['site_desc'],
"SITENAME" => htmlentities($new['sitename']),
"SITE_DESCRIPTION" => htmlentities($new['site_desc']),
"S_DISABLE_BOARD_YES" => $disable_board_yes,
"S_DISABLE_BOARD_NO" => $disable_board_no,
"ACTIVATION_NONE" => USER_ACTIVATION_NONE,
@ -309,8 +319,6 @@ $template->assign_vars(array(
"COPPA_FAX" => $new['coppa_fax'])
);
$template->pparse("body");
include('page_footer_admin.'.$phpEx);
?>

View file

@ -30,21 +30,20 @@
define('IN_PHPBB', 1);
if( !empty($setmodules) )
if ( !empty($setmodules) )
{
if ( !$acl->get_acl_admin('general') )
{
return;
}
$filename = basename(__FILE__);
$module['General']['Backup_DB'] = $filename . "?perform=backup";
if(@phpversion() >= '4.0.0')
{
$module['DB']['DB_Backup'] = $filename . "?perform=backup";
$file_uploads = @ini_get('file_uploads');
}
else
{
$file_uploads = @get_cfg_var('file_uploads');
}
if( ($file_uploads != 0 || empty($file_uploads)) && (strtolower($file_uploads) != 'off') && (@phpversion() != '4.0.4pl1') )
{
$module['General']['Restore_DB'] = $filename . "?perform=restore";
$module['DB']['DB_Restore'] = $filename . "?perform=restore";
}
return;
@ -57,12 +56,12 @@ $no_page_header = TRUE;
$phpbb_root_path = "../";
require($phpbb_root_path . 'extension.inc');
require('pagestart.' . $phpEx);
include($phpbb_root_path . 'includes/sql_parse.'.$phpEx);
include($phpbb_root_path . 'includes/functions_admin.'.$phpEx);
//
// Set VERBOSE to 1 for debugging info..
//
define("VERBOSE", 0);
if ( !$acl->get_acl_admin('general') )
{
message_die(MESSAGE, $lang['No_admin']);
}
//
// Increase maximum execution time, but don't complain about it if it isn't
@ -70,6 +69,364 @@ define("VERBOSE", 0);
//
@set_time_limit(1200);
//
// Begin program proper
//
if ( isset($HTTP_GET_VARS['perform']) || isset($HTTP_POST_VARS['perform']) )
{
$perform = ( isset($HTTP_POST_VARS['perform']) ) ? $HTTP_POST_VARS['perform'] : $HTTP_GET_VARS['perform'];
switch($perform)
{
case 'backup':
if ( SQL_LAYER == 'oracle' || SQL_LAYER == 'odbc' || SQL_LAYER == 'mssql' )
{
switch ( SQL_LAYER )
{
case 'oracle':
$db_type = 'Oracle';
break;
case 'odbc':
$db_type = 'ODBC';
break;
case 'mssql':
$db_type = 'MSSQL';
break;
}
include('page_header_admin.'.$phpEx);
$template->assign_vars(array(
"MESSAGE_TITLE" => $lang['Information'],
"MESSAGE_TEXT" => $lang['Backups_not_supported'])
);
break;
}
$tables = array('auth_access', 'banlist', 'categories', 'config', 'disallow', 'forums', 'forum_prune', 'groups', 'posts', 'posts_text', 'privmsgs', 'privmsgs_text', 'ranks', 'search_results', 'search_results', 'search_wordlist', 'search_wordmatch', 'sessions', 'smilies', 'themes', 'themes_name', 'topics', 'topics_watch', 'user_group', 'users', 'vote_desc', 'vote_results', 'vote_voters', 'words');
$additional_tables = (isset($HTTP_POST_VARS['additional_tables'])) ? $HTTP_POST_VARS['additional_tables'] : ( ( isset($HTTP_GET_VARS['additional_tables']) ) ? $HTTP_GET_VARS['additional_tables'] : "" );
$backup_type = (isset($HTTP_POST_VARS['backup_type'])) ? $HTTP_POST_VARS['backup_type'] : ( ( isset($HTTP_GET_VARS['backup_type']) ) ? $HTTP_GET_VARS['backup_type'] : "" );
$gzipcompress = (!empty($HTTP_POST_VARS['gzipcompress'])) ? $HTTP_POST_VARS['gzipcompress'] : ( ( !empty($HTTP_GET_VARS['gzipcompress']) ) ? $HTTP_GET_VARS['gzipcompress'] : 0 );
if ( !empty($additional_tables) )
{
if ( ereg(",", $additional_tables))
{
$additional_tables = split(",", $additional_tables);
for($i = 0; $i < count($additional_tables); $i++)
{
$tables[] = trim($additional_tables[$i]);
}
}
else
{
$tables[] = trim($additional_tables);
}
}
if ( !isset($HTTP_POST_VARS['backupstart']) && !isset($HTTP_GET_VARS['backupstart']))
{
$s_hidden_fields = '<input type="hidden" name="perform" value="backup" /><input type="hidden" name="drop" value="1" /><input type="hidden" name="perform" value="$perform" />';
page_header($lang['DB']);
?>
<h1><?php echo $lang['DB_Backup']; ?></h1>
<p><?php echo $lang['Backup_explain']; ?></p>
<form method="post" action="<?php echo "admin_db_utilities.$phpEx$SID"; ?>"><table cellspacing="1" cellpadding="4" border="0" align="center" bgcolor="#98AAB1">
<tr>
<th colspan="2"><?php echo $lang['Backup_options']; ?></th>
</tr>
<tr>
<td class="row2"><?php echo $lang['Full_backup']; ?></td>
<td class="row2"><input type="radio" name="backup_type" value="full" checked /></td>
</tr>
<tr>
<td class="row1"><?php echo $lang['Structure_backup']; ?></td>
<td class="row1"><input type="radio" name="backup_type" value="structure" /></td>
</tr>
<tr>
<td class="row2"><?php echo $lang['Data_backup']; ?></td>
<td class="row2"><input type="radio" name="backup_type" value="data" /></td>
</tr>
<tr>
<td class="row1"><?php echo $lang['Additional_tables']; ?></td>
<td class="row1"><input type="text" name="additional_tables" /></td>
</tr>
<tr>
<td class="row1"><?php echo $lang['Gzip_compress']; ?></td>
<td class="row1"><?php echo $lang['No']; ?> <input type="radio" name="gzipcompress" value="0" checked /> &nbsp;<?php echo $lang['Yes']; ?> <input type="radio" name="gzipcompress" value="1" /></td>
</tr>
<tr>
<td class="cat" colspan="2" align="center"><?php echo $s_hidden_fields; ?><input type="submit" name="backupstart" value="<?php echo $lang['Start_backup']; ?>" class="mainoption" /></td>
</tr>
</table></form>
<?php
break;
}
else if ( !isset($HTTP_POST_VARS['startdownload']) && !isset($HTTP_GET_VARS['startdownload']) )
{
$template->assign_vars(array(
"META" => "<meta http-equiv=\"refresh\" content=\"0;url=admin_db_utilities.$phpEx?perform=backup&amp;additional_tables=" . quotemeta($additional_tables) . "&amp;backup_type=$backup_type&amp;drop=1&amp;backupstart=1&amp;gzipcompress=$gzipcompress&amp;startdownload=1\">",
"MESSAGE_TITLE" => $lang['Database_Utilities'] . " : " . $lang['Backup'],
"MESSAGE_TEXT" => $lang['Backup_download'])
);
include('page_header_admin.php');
include('page_footer_admin.'.$phpEx);
}
header("Pragma: no-cache");
$do_gzip_compress = FALSE;
if( $gzipcompress )
{
$phpver = phpversion();
if($phpver >= "4.0")
{
if(extension_loaded("zlib"))
{
$do_gzip_compress = TRUE;
}
}
}
if($do_gzip_compress)
{
@ob_start();
@ob_implicit_flush(0);
header("Content-Type: text/x-delimtext; name=\"phpbb_db_backup.sql.gz\"");
header("Content-disposition: attachment; filename=phpbb_db_backup.sql.gz");
}
else
{
header("Content-Type: text/x-delimtext; name=\"phpbb_db_backup.sql\"");
header("Content-disposition: attachment; filename=phpbb_db_backup.sql");
}
//
// Build the sql script file...
//
echo "#\n";
echo "# phpBB Backup Script\n";
echo "# Dump of tables for $dbname\n";
echo "#\n# DATE : " . gmdate("d-m-Y H:i:s", time()) . " GMT\n";
echo "#\n";
if(SQL_LAYER == 'postgresql')
{
echo "\n" . pg_get_sequences("\n", $backup_type);
}
for($i = 0; $i < count($tables); $i++)
{
$table_name = $tables[$i];
if(SQL_LAYER != 'mysql4')
{
$table_def_function = "get_table_def_" . SQL_LAYER;
$table_content_function = "get_table_content_" . SQL_LAYER;
}
else
{
$table_def_function = "get_table_def_mysql";
$table_content_function = "get_table_content_mysql";
}
if($backup_type != 'data')
{
echo "#\n# TABLE: " . $table_prefix . $table_name . "\n#\n";
echo $table_def_function($table_prefix . $table_name, "\n") . "\n";
}
if($backup_type != 'structure')
{
$table_content_function($table_prefix . $table_name, "output_table_content");
}
}
if($do_gzip_compress)
{
$Size = ob_get_length();
$Crc = crc32(ob_get_contents());
$contents = gzcompress(ob_get_contents());
ob_end_clean();
echo "\x1f\x8b\x08\x00\x00\x00\x00\x00".substr($contents, 0, strlen($contents) - 4).gzip_PrintFourChars($Crc).gzip_PrintFourChars($Size);
}
exit;
break;
case 'restore':
if ( !isset($restore_start) )
{
$s_hidden_fields = '<input type="hidden" name="perform" value="restore" /><input type="hidden" name="perform" value="$perform" />';
page_header($lang['DB']);
?>
<h1><?php echo $lang['DB_Restore']; ?></h1>
<p><?php echo $lang['Restore_explain']; ?></p>
<form enctype="multipart/form-data" method="post" action="<?php echo "admin_db_utilities.$phpEx$SID"; ?>"><table cellspacing="1" cellpadding="4" border="0" align="center" bgcolor="#98AAB1">
<tr>
<th class="th"><?php echo $lang['Select_file']; ?></th>
</tr>
<tr>
<td class="row1" align="center"><?php echo $s_hidden_fields; ?>&nbsp;<input type="file" name="backup_file">&nbsp;&nbsp;<input type="submit" name="restore_start" value="<?php echo $lang['Start_Restore']; ?>" class="mainoption" />&nbsp;</td>
</tr>
</table></form>
<?php
break;
}
else
{
//
// Handle the file upload ....
// If no file was uploaded report an error...
//
$backup_file_name = (!empty($HTTP_POST_FILES['backup_file']['name'])) ? $HTTP_POST_FILES['backup_file']['name'] : "";
$backup_file_tmpname = ($HTTP_POST_FILES['backup_file']['tmp_name'] != "none") ? $HTTP_POST_FILES['backup_file']['tmp_name'] : "";
$backup_file_type = (!empty($HTTP_POST_FILES['backup_file']['type'])) ? $HTTP_POST_FILES['backup_file']['type'] : "";
if ( $backup_file_tmpname == "" || $backup_file_name == "" )
{
message_die(MESSAGE, $lang['Restore_Error_no_file']);
}
//
// If I file was actually uploaded, check to make sure that we
// are actually passed the name of an uploaded file, and not
// a hackers attempt at getting us to process a local system
// file.
//
if( file_exists($backup_file_tmpname) )
{
if( preg_match("/^(text\/[a-zA-Z]+)|(application\/(x\-)?gzip(\-compressed)?)|(application\/octet-stream)$/is", $backup_file_type) )
{
if( preg_match("/\.gz$/is",$backup_file_name) )
{
$do_gzip_compress = FALSE;
$phpver = phpversion();
if($phpver >= "4.0")
{
if(extension_loaded("zlib"))
{
$do_gzip_compress = TRUE;
}
}
if($do_gzip_compress)
{
$gz_ptr = gzopen($backup_file_tmpname, 'rb');
$sql_query = "";
while( !gzeof($gz_ptr) )
{
$sql_query .= gzgets($gz_ptr, 100000);
}
}
else
{
include('page_header_admin.'.$phpEx);
message_die(ERROR, $lang['Restore_Error_decompress']);
}
}
else
{
$sql_query = fread(fopen($backup_file_tmpname, 'r'), filesize($backup_file_tmpname));
}
//
// Comment this line out to see if this fixes the stuff...
//
//$sql_query = stripslashes($sql_query);
}
else
{
include('page_header_admin.'.$phpEx);
message_die(ERROR, $lang['Restore_Error_filename'] ." $backup_file_type $backup_file_name");
}
}
else
{
include('page_header_admin.'.$phpEx);
message_die(ERROR, $lang['Restore_Error_uploading']);
}
if($sql_query != "")
{
// Strip out sql comments...
$sql_query = remove_remarks($sql_query);
$pieces = split_sql_file($sql_query, ";");
$sql_count = count($pieces);
for($i = 0; $i < $sql_count; $i++)
{
$sql = trim($pieces[$i]);
if(!empty($sql) and $sql[0] != "#")
{
if(DEBUG == 1)
{
echo "Executing: $sql\n<br>";
flush();
}
$result = $db->sql_query($sql);
if(!$result && ( !(SQL_LAYER == 'postgresql' && eregi("drop table", $sql) ) ) )
{
//include('page_header_admin.'.$phpEx);
// echo "~~$sql~~";
message_die(ERROR, "Error importing backup file", "", __LINE__, __FILE__, $sql);
}
}
}
}
include('page_header_admin.'.$phpEx);
$message = $lang['Restore_success'];
$template->assign_vars(array(
"MESSAGE_TITLE" => $lang['Database_Utilities'] . " : " . $lang['Restore'],
"MESSAGE_TEXT" => $message)
);
break;
}
break;
}
}
?>
</td>
</tr>
</table>
<?php
page_footer();
// -----------------------
// The following functions are adapted from phpMyAdmin and upgrade_20.php
//
@ -83,8 +440,6 @@ function gzip_PrintFourChars($Val)
return $return;
}
//
// This function is used for grabbing the sequences for postgres...
//
@ -410,10 +765,6 @@ function get_table_def_mysql($table, $crlf)
// Get any Indexed fields from the database...
//
$result = $db->sql_query($key_query);
if(!$result)
{
message_die(GENERAL_ERROR, "FAILED IN get_table_def (show keys)", "", __LINE__, __FILE__, $key_query);
}
while($row = $db->sql_fetchrow($result))
{
@ -667,358 +1018,4 @@ function output_table_content($content)
// End Functions
// -------------
//
// Begin program proper
//
if( isset($HTTP_GET_VARS['perform']) || isset($HTTP_POST_VARS['perform']) )
{
$perform = (isset($HTTP_POST_VARS['perform'])) ? $HTTP_POST_VARS['perform'] : $HTTP_GET_VARS['perform'];
switch($perform)
{
case 'backup':
if( SQL_LAYER == 'oracle' || SQL_LAYER == 'odbc' || SQL_LAYER == 'mssql' )
{
switch(SQL_LAYER)
{
case 'oracle':
$db_type = "Oracle";
break;
case 'odbc':
$db_type = "ODBC";
break;
case 'mssql':
$db_type = "MSSQL";
break;
}
include('page_header_admin.'.$phpEx);
$template->set_filenames(array(
"body" => "admin/admin_message_body.tpl")
);
$template->assign_vars(array(
"MESSAGE_TITLE" => $lang['Information'],
"MESSAGE_TEXT" => $lang['Backups_not_supported'])
);
$template->pparse("body");
break;
}
$tables = array('auth_access', 'banlist', 'categories', 'config', 'disallow', 'forums', 'forum_prune', 'groups', 'posts', 'posts_text', 'privmsgs', 'privmsgs_text', 'ranks', 'search_results', 'search_results', 'search_wordlist', 'search_wordmatch', 'sessions', 'smilies', 'themes', 'themes_name', 'topics', 'topics_watch', 'user_group', 'users', 'vote_desc', 'vote_results', 'vote_voters', 'words');
$additional_tables = (isset($HTTP_POST_VARS['additional_tables'])) ? $HTTP_POST_VARS['additional_tables'] : ( (isset($HTTP_GET_VARS['additional_tables'])) ? $HTTP_GET_VARS['additional_tables'] : "" );
$backup_type = (isset($HTTP_POST_VARS['backup_type'])) ? $HTTP_POST_VARS['backup_type'] : ( (isset($HTTP_GET_VARS['backup_type'])) ? $HTTP_GET_VARS['backup_type'] : "" );
$gzipcompress = (!empty($HTTP_POST_VARS['gzipcompress'])) ? $HTTP_POST_VARS['gzipcompress'] : ( (!empty($HTTP_GET_VARS['gzipcompress'])) ? $HTTP_GET_VARS['gzipcompress'] : 0 );
if(!empty($additional_tables))
{
if(ereg(",", $additional_tables))
{
$additional_tables = split(",", $additional_tables);
for($i = 0; $i < count($additional_tables); $i++)
{
$tables[] = trim($additional_tables[$i]);
}
}
else
{
$tables[] = trim($additional_tables);
}
}
if( !isset($HTTP_POST_VARS['backupstart']) && !isset($HTTP_GET_VARS['backupstart']))
{
include('page_header_admin.'.$phpEx);
$template->set_filenames(array(
"body" => "admin/db_utils_backup_body.tpl")
);
$s_hidden_fields = "<input type=\"hidden\" name=\"perform\" value=\"backup\" /><input type=\"hidden\" name=\"drop\" value=\"1\" /><input type=\"hidden\" name=\"perform\" value=\"$perform\" />";
$template->assign_vars(array(
"L_DATABASE_BACKUP" => $lang['Database_Utilities'] . " : " . $lang['Backup'],
"L_BACKUP_EXPLAIN" => $lang['Backup_explain'],
"L_FULL_BACKUP" => $lang['Full_backup'],
"L_STRUCTURE_BACKUP" => $lang['Structure_backup'],
"L_DATA_BACKUP" => $lang['Data_backup'],
"L_ADDITIONAL_TABLES" => $lang['Additional_tables'],
"L_START_BACKUP" => $lang['Start_backup'],
"L_BACKUP_OPTIONS" => $lang['Backup_options'],
"L_GZIP_COMPRESS" => $lang['Gzip_compress'],
"L_NO" => $lang['No'],
"L_YES" => $lang['Yes'],
"S_HIDDEN_FIELDS" => $s_hidden_fields,
"S_DBUTILS_ACTION" => append_sid("admin_db_utilities.$phpEx"))
);
$template->pparse("body");
break;
}
else if( !isset($HTTP_POST_VARS['startdownload']) && !isset($HTTP_GET_VARS['startdownload']) )
{
$template->set_filenames(array(
"body" => "admin/admin_message_body.tpl")
);
$template->assign_vars(array(
"META" => "<meta http-equiv=\"refresh\" content=\"0;url=admin_db_utilities.$phpEx?perform=backup&amp;additional_tables=" . quotemeta($additional_tables) . "&amp;backup_type=$backup_type&amp;drop=1&amp;backupstart=1&amp;gzipcompress=$gzipcompress&amp;startdownload=1\">",
"MESSAGE_TITLE" => $lang['Database_Utilities'] . " : " . $lang['Backup'],
"MESSAGE_TEXT" => $lang['Backup_download'])
);
include('page_header_admin.php');
$template->pparse("body");
include('page_footer_admin.'.$phpEx);
}
header("Pragma: no-cache");
$do_gzip_compress = FALSE;
if( $gzipcompress )
{
$phpver = phpversion();
if($phpver >= "4.0")
{
if(extension_loaded("zlib"))
{
$do_gzip_compress = TRUE;
}
}
}
if($do_gzip_compress)
{
@ob_start();
@ob_implicit_flush(0);
header("Content-Type: text/x-delimtext; name=\"phpbb_db_backup.sql.gz\"");
header("Content-disposition: attachment; filename=phpbb_db_backup.sql.gz");
}
else
{
header("Content-Type: text/x-delimtext; name=\"phpbb_db_backup.sql\"");
header("Content-disposition: attachment; filename=phpbb_db_backup.sql");
}
//
// Build the sql script file...
//
echo "#\n";
echo "# phpBB Backup Script\n";
echo "# Dump of tables for $dbname\n";
echo "#\n# DATE : " . gmdate("d-m-Y H:i:s", time()) . " GMT\n";
echo "#\n";
if(SQL_LAYER == 'postgresql')
{
echo "\n" . pg_get_sequences("\n", $backup_type);
}
for($i = 0; $i < count($tables); $i++)
{
$table_name = $tables[$i];
if(SQL_LAYER != 'mysql4')
{
$table_def_function = "get_table_def_" . SQL_LAYER;
$table_content_function = "get_table_content_" . SQL_LAYER;
}
else
{
$table_def_function = "get_table_def_mysql";
$table_content_function = "get_table_content_mysql";
}
if($backup_type != 'data')
{
echo "#\n# TABLE: " . $table_prefix . $table_name . "\n#\n";
echo $table_def_function($table_prefix . $table_name, "\n") . "\n";
}
if($backup_type != 'structure')
{
$table_content_function($table_prefix . $table_name, "output_table_content");
}
}
if($do_gzip_compress)
{
$Size = ob_get_length();
$Crc = crc32(ob_get_contents());
$contents = gzcompress(ob_get_contents());
ob_end_clean();
echo "\x1f\x8b\x08\x00\x00\x00\x00\x00".substr($contents, 0, strlen($contents) - 4).gzip_PrintFourChars($Crc).gzip_PrintFourChars($Size);
}
exit;
break;
case 'restore':
if(!isset($restore_start))
{
//
// Define Template files...
//
include('page_header_admin.'.$phpEx);
$template->set_filenames(array(
"body" => "admin/db_utils_restore_body.tpl")
);
$s_hidden_fields = "<input type=\"hidden\" name=\"perform\" value=\"restore\" /><input type=\"hidden\" name=\"perform\" value=\"$perform\" />";
$template->assign_vars(array(
"L_DATABASE_RESTORE" => $lang['Database_Utilities'] . " : " . $lang['Restore'],
"L_RESTORE_EXPLAIN" => $lang['Restore_explain'],
"L_SELECT_FILE" => $lang['Select_file'],
"L_START_RESTORE" => $lang['Start_Restore'],
"S_DBUTILS_ACTION" => append_sid("admin_db_utilities.$phpEx"),
"S_HIDDEN_FIELDS" => $s_hidden_fields)
);
$template->pparse("body");
break;
}
else
{
//
// Handle the file upload ....
// If no file was uploaded report an error...
//
$backup_file_name = (!empty($HTTP_POST_FILES['backup_file']['name'])) ? $HTTP_POST_FILES['backup_file']['name'] : "";
$backup_file_tmpname = ($HTTP_POST_FILES['backup_file']['tmp_name'] != "none") ? $HTTP_POST_FILES['backup_file']['tmp_name'] : "";
$backup_file_type = (!empty($HTTP_POST_FILES['backup_file']['type'])) ? $HTTP_POST_FILES['backup_file']['type'] : "";
if($backup_file_tmpname == "" || $backup_file_name == "")
{
include('page_header_admin.'.$phpEx);
message_die(GENERAL_MESSAGE, $lang['Restore_Error_no_file']);
}
//
// If I file was actually uploaded, check to make sure that we
// are actually passed the name of an uploaded file, and not
// a hackers attempt at getting us to process a local system
// file.
//
if( file_exists($backup_file_tmpname) )
{
if( preg_match("/^(text\/[a-zA-Z]+)|(application\/(x\-)?gzip(\-compressed)?)|(application\/octet-stream)$/is", $backup_file_type) )
{
if( preg_match("/\.gz$/is",$backup_file_name) )
{
$do_gzip_compress = FALSE;
$phpver = phpversion();
if($phpver >= "4.0")
{
if(extension_loaded("zlib"))
{
$do_gzip_compress = TRUE;
}
}
if($do_gzip_compress)
{
$gz_ptr = gzopen($backup_file_tmpname, 'rb');
$sql_query = "";
while( !gzeof($gz_ptr) )
{
$sql_query .= gzgets($gz_ptr, 100000);
}
}
else
{
include('page_header_admin.'.$phpEx);
message_die(GENERAL_ERROR, $lang['Restore_Error_decompress']);
}
}
else
{
$sql_query = fread(fopen($backup_file_tmpname, 'r'), filesize($backup_file_tmpname));
}
//
// Comment this line out to see if this fixes the stuff...
//
//$sql_query = stripslashes($sql_query);
}
else
{
include('page_header_admin.'.$phpEx);
message_die(GENERAL_ERROR, $lang['Restore_Error_filename'] ." $backup_file_type $backup_file_name");
}
}
else
{
include('page_header_admin.'.$phpEx);
message_die(GENERAL_ERROR, $lang['Restore_Error_uploading']);
}
if($sql_query != "")
{
// Strip out sql comments...
$sql_query = remove_remarks($sql_query);
$pieces = split_sql_file($sql_query, ";");
$sql_count = count($pieces);
for($i = 0; $i < $sql_count; $i++)
{
$sql = trim($pieces[$i]);
if(!empty($sql) and $sql[0] != "#")
{
if(VERBOSE == 1)
{
echo "Executing: $sql\n<br>";
flush();
}
$result = $db->sql_query($sql);
if(!$result && ( !(SQL_LAYER == 'postgresql' && eregi("drop table", $sql) ) ) )
{
//include('page_header_admin.'.$phpEx);
// echo "~~$sql~~";
message_die(GENERAL_ERROR, "Error importing backup file", "", __LINE__, __FILE__, $sql);
}
}
}
}
include('page_header_admin.'.$phpEx);
$template->set_filenames(array(
"body" => "admin/admin_message_body.tpl")
);
$message = $lang['Restore_success'];
$template->assign_vars(array(
"MESSAGE_TITLE" => $lang['Database_Utilities'] . " : " . $lang['Restore'],
"MESSAGE_TEXT" => $message)
);
$template->pparse("body");
break;
}
break;
}
}
include('page_footer_admin.'.$phpEx);
?>

193
phpBB/admin/admin_email.php Normal file
View file

@ -0,0 +1,193 @@
<?php
/***************************************************************************
* admin_email.php
* -------------------
* begin : Thu May 31, 2001
* copyright : (C) 2001 The phpBB Group
* email : support@phpbb.com
*
* $Id$
*
****************************************************************************/
/***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
***************************************************************************/
if ( !empty($setmodules) )
{
if ( !$acl->get_acl_admin('general') )
{
return;
}
$filename = basename(__FILE__);
$module['Users']['Mass_Email'] = $filename;
return;
}
define('IN_PHPBB', 1);
//
// Include files
//
$phpbb_root_path = '../';
require($phpbb_root_path . 'extension.inc');
require('pagestart.' . $phpEx);
//
// Do we have general admin permissions?
//
if ( !$acl->get_acl_admin('general') )
{
return;
}
//
// Set some vars
//
$message = '';
$subject = '';
//
// Do the job ...
//
if ( isset($HTTP_POST_VARS['submit']) )
{
//
// Increase maximum execution time in case of a lot of users, but don't complain about it if it isn't
// allowed.
//
@set_time_limit(1200);
$group_id = intval($HTTP_POST_VARS['g']);
$sql = ( $group_id != -1 ) ? "SELECT u.user_email FROM " . USERS_TABLE . " u, " . USER_GROUP_TABLE . " ug WHERE ug.group_id = $group_id AND ug.user_pending <> " . TRUE . " AND u.user_id = ug.user_id" : "SELECT user_email FROM " . USERS_TABLE;
$result = $db->sql_query($sql);
if ( !($email_list = $db->sql_fetchrowset($g_result)) )
{
//
// Output a relevant GENERAL_MESSAGE about users/group
// not existing
//
}
$subject = stripslashes($HTTP_POST_VARS['subject']);
$message = stripslashes($HTTP_POST_VARS['message']);
//
// Error checking needs to go here ... if no subject and/or
// no message then skip over the send and return to the form
//
$error = FALSE;
if ( !$error )
{
include($phpbb_root_path . 'includes/emailer.'.$phpEx);
//
// Let's do some checking to make sure that mass mail functions
// are working in win32 versions of php.
//
if ( preg_match('/[c-z]:\\\.*/i', getenv('PATH')) && !$board_config['smtp_delivery'])
{
// We are running on windows, force delivery to use
// our smtp functions since php's are broken by default
$board_config['smtp_delivery'] = 1;
$board_config['smtp_host'] = get_cfg_var('SMTP');
}
$emailer = new emailer($board_config['smtp_delivery']);
$email_headers = 'From: ' . $board_config['board_email'] . "\n";
$bcc_list = '';
for($i = 0; $i < count($email_list); $i++)
{
$bcc_list .= ( ( $bcc_list != '' ) ? ', ' : '' ) . $email_list[$i]['user_email'];
}
$email_headers .= "Bcc: $bcc_list\n";
$email_headers .= 'Return-Path: ' . $userdata['board_email'] . "\n";
$email_headers .= 'X-AntiAbuse: Board servername - ' . $server_name . "\n";
$email_headers .= 'X-AntiAbuse: User_id - ' . $userdata['user_id'] . "\n";
$email_headers .= 'X-AntiAbuse: Username - ' . $userdata['username'] . "\n";
$email_headers .= 'X-AntiAbuse: User IP - ' . $user_ip . "\r\n";
$emailer->use_template('admin_send_email');
$emailer->email_address($board_config['board_email']);
$emailer->set_subject($subject);
$emailer->extra_headers($email_headers);
$emailer->assign_vars(array(
'SITENAME' => $board_config['sitename'],
'BOARD_EMAIL' => $board_config['board_email'],
'MESSAGE' => $message)
);
$emailer->send();
$emailer->reset();
$message = $lang['Email_sent'] . '<br /><br />' . sprintf($lang['Click_return_admin_index'], '<a href="' . "index.$phpEx$SID?pane=right" . '">', '</a>');
message_die(MESSAGE, $message);
}
}
//
// Initial selection
//
$sql = "SELECT group_id, group_name
FROM ".GROUPS_TABLE;
$result = $db->sql_query($sql);
$select_list = '<select name = "g"><option value = "-1">' . $lang['All_users'] . '</option>';
if ( $row = $db->sql_fetchrow($result) )
{
do
{
$select_list .= '<option value = "' . $row['group_id'] . '">' . $row['group_name'] . '</option>';
}
while ( $row = $db->sql_fetchrow($result) );
}
$select_list .= '</select>';
page_header($lang['Users']);
?>
<h1><?php echo $lang['Email']; ?></h1>
<p><?php echo $lang['Mass_email_explain']; ?></p>
<form method="post" action="<?php echo "admin_mass_email.$phpEx$SID"; ?>"><table cellspacing="1" cellpadding="4" border="0" align="center" bgcolor="#98AAB1">
<tr>
<th colspan="2"><?php echo $lang['Compose']; ?></th>
</tr>
<tr>
<td class="row1" align="right"><b><?php echo $lang['Recipients']; ?></b></td>
<td class="row2" align="left"><?php echo $select_list; ?></td>
</tr>
<tr>
<td class="row1" align="right"><b><?php echo $lang['Subject']; ?></b></td>
<td class="row2"><span class="gen"><input type="text" name="subject" size="45" maxlength="100" tabindex="2" class="post" value="<?php echo $subject; ?>" /></span></td>
</tr>
<tr>
<td class="row1" align="right" valign="top"><span class="gen"><b><?php echo $lang['Message']; ?></b></span>
<td class="row2"><textarea class="post" name="message" rows="15" cols="35" wrap="virtual" style="width:450px" tabindex="3"><?php echo $message; ?></textarea></td>
</tr>
<tr>
<td class="cat" colspan="2" align="center"><input type="submit" value="<?php echo $lang['Email']; ?>" name="submit" class="mainoption" /></td>
</tr>
</table></form>
<?php
page_footer();
?>

View file

@ -21,14 +21,15 @@
if ( !empty($setmodules) )
{
if ( !$acl->get_acl_admin('forums') )
if ( !$acl->get_acl_admin('auth') )
{
return;
}
$filename = basename(__FILE__);
$module['Forums']['Permissions'] = $filename . $SID . '&amp;mode=forums';
$module['General']['Set_Administrators'] = $filename . $SID . '&amp;mode=admins';
$module['Forums']['Moderators'] = $filename . $SID . '&amp;mode=moderators';
$module['General']['Administrators'] = $filename . $SID . '&amp;mode=administrators';
return;
}
@ -44,7 +45,7 @@ require('pagestart.' . $phpEx);
//
// Do we have forum admin permissions?
//
if ( !$acl->get_acl_admin('forums') )
if ( !$acl->get_acl_admin('auth') )
{
message_die(MESSAGE, $lang['No_admin']);
}
@ -55,7 +56,6 @@ if ( !$acl->get_acl_admin('forums') )
if ( isset($HTTP_GET_VARS['f']) || isset($HTTP_POST_VARS['f']) )
{
$forum_id = ( isset($HTTP_POST_VARS['f']) ) ? intval($HTTP_POST_VARS['f']) : intval($HTTP_GET_VARS['f']);
$forum_sql = " WHERE forum_id = $forum_id";
}
else
@ -64,31 +64,248 @@ else
$forum_sql = '';
}
$mode = ( isset($HTTP_GET_VARS['mode']) ) ? $HTTP_GET_VARS['mode'] : $HTTP_POST_VARS['mode'];
//
// Start program proper
//
switch ( $mode )
{
case 'forums':
$l_title = $lang['Permissions'];
$l_title_explain = $lang['Permissions_explain'];
break;
case 'moderators':
$l_title = $lang['Moderators'];
$l_title_explain = $lang['Moderators_explain'];
break;
case 'administrators':
$l_title = $lang['Administrators'];
$l_title_explain = $lang['Administrators_explain'];
break;
}
//
// Get required information, either all forums if
// no id was specified or just the requsted if it
// was
//
if ( !empty($forum_id) )
if ( !empty($forum_id) || $mode == 'administrators' )
{
//
// Output the selection table if no forum id was
// specified
// Clear some vars, grab some info if relevant ...
//
$template->set_filenames(array(
"body" => "admin/auth_select_body.tpl")
);
$select_list = '<select name=f">';
for($i = 0; $i < count($forum_rows); $i++)
$s_hidden_fields = '';
if ( !empty($forum_id) )
{
$select_list .= '<option value="' . $forum_rows[$i]['forum_id'] . '">' . $forum_rows[$i]['forum_name'] . '</option>';
$sql = "SELECT forum_name
FROM " . FORUMS_TABLE . "
WHERE forum_id = $forum_id";
$result = $db->sql_query($sql);
$forum_info = $db->sql_fetchrow($result);
$l_title .= ' : <i>' . $forum_info['forum_name'] . '</i>';
$s_hidden_fields = '<input type="hidden" name="f" value="' . $forum_id .'" />';
}
$select_list .= '</select>';
//
// Generate header
//
page_header($lang['Forums']);
?>
<h1><?php echo $l_title; ?></h1>
<p><?php echo $l_title_explain; ?></p>
<?php
switch ( $mode )
{
case 'forums':
?>
<form method="post" action="<?php echo "admin_permissions.$phpEx$SID&amp;mode=$mode"; ?>">
<h3><?php echo $lang['Allowed_users']; ?></h3>
<select name="user_allowed"><?php echo $user_allowed_options; ?></select>
<p>[ <a href=""><?php echo $lang['Advanced']; ?></a> ]</p>
<h3><?php echo $lang['Allowed_groups']; ?></h3>
<select name="group_allowed"><?php echo $group_allowed_options; ?></select>
<p>[ <a href=""><?php echo $lang['Advanced']; ?></a> ]</p>
<h3><?php echo $lang['Disallowed_users']; ?></h3>
<select name="user_disallowed"><?php echo $user_disallowed_options; ?></select>
<p>[ <a href=""><?php echo $lang['Advanced']; ?></a> ]</p>
<h3><?php echo $lang['Disallowed_groups']; ?></h3>
<select name="group_disallowed"><?php echo $group_disallowed_options; ?></select>
<p>[ <a href=""><?php echo $lang['Advanced']; ?></a> ]</p>
<?php
break;
case 'moderators':
$sql = "SELECT auth_option
FROM " . ACL_OPTIONS_TABLE . "
WHERE auth_type LIKE 'mod'";
$result = $db->sql_query($sql);
$auth_options = array();
while ( $row = $db->sql_fetchrow($result) )
{
$auth_options[] = $row;
}
$sql = "SELECT u.user_id, u.username, ao.auth_option
FROM " . USERS_TABLE . " u, " . ACL_USERS_TABLE . " au, " . ACL_OPTIONS_TABLE . " ao
WHERE ao.auth_type LIKE 'mod'
AND au.auth_option_id = ao.auth_option_id
AND au.forum_id = $forum_id
AND u.user_id = au.user_id
ORDER BY u.username, u.user_regdate ASC";
$result = $db->sql_query($sql);
$auth_users = array();
while ( $row = $db->sql_fetchrow($result) )
{
$auth_users[$row['auth_option']] .= '<option value="' . $row['user_id'] . '">' . $row['username'] . '</option>';
}
$sql = "SELECT g.group_id, g.group_name, ao.auth_option
FROM " . GROUPS_TABLE . " g, " . ACL_GROUPS_TABLE . " ag, " . ACL_OPTIONS_TABLE . " ao
WHERE ao.auth_type LIKE 'mod'
AND ag.auth_option_id = ao.auth_option_id
AND ag.forum_id = $forum_id
AND g.group_id = ag.group_id
ORDER BY g.group_name ASC";
$result = $db->sql_query($sql);
$auth_groups = array();
while ( $row = $db->sql_fetchrow($result) )
{
$auth_groups[$row['auth_option']] .= '<option value="' . $row['group_id'] . '">' . $row['group_name'] . '</option>';
}
?>
<table class="bg" cellspacing="1" cellpadding="4" border="0" align="center">
<tr>
<th>Setting</th>
<th>Users</th>
<th>Groups</th>
</tr>
<?php
for($i = 0; $i < sizeof($auth_options); $i++)
{
$cell_bg = ( $cell_bg == 'row1' ) ? 'row2' : 'row1';
?>
<tr>
<td class="<?php echo $cell_bg; ?>" align="center"><?php echo $auth_options[$i]['auth_option']; ?></td>
<td class="<?php echo $cell_bg; ?>" align="center"><select name="option[<?php echo $auth_options[$i]['auth_option']; ?>]" multiple="multiple"><?php echo $auth_users[$auth_options[$i]['auth_option']]; ?></select></td>
<td class="<?php echo $cell_bg; ?>" align="center"><select name="option[<?php echo $auth_options[$i]['auth_option']; ?>]" multiple="multiple"><?php echo $auth_groups[$auth_options[$i]['auth_option']]; ?></select></td>
</tr>
<?php
}
?>
</table>
<?php
break;
case 'administrators':
$sql = "SELECT auth_option
FROM " . ACL_OPTIONS_TABLE . "
WHERE auth_type LIKE 'admin'";
$result = $db->sql_query($sql);
$auth_options = array();
while ( $row = $db->sql_fetchrow($result) )
{
$auth_options[] = $row;
}
$sql = "SELECT u.user_id, u.username, ao.auth_option
FROM " . USERS_TABLE . " u, " . ACL_USERS_TABLE . " au, " . ACL_OPTIONS_TABLE . " ao
WHERE ao.auth_type LIKE 'admin'
AND au.auth_option_id = ao.auth_option_id
AND u.user_id = au.user_id
ORDER BY u.username, u.user_regdate ASC";
$result = $db->sql_query($sql);
$auth_users = array();
while ( $row = $db->sql_fetchrow($result) )
{
$auth_users[$row['auth_option']] .= '<option value="' . $row['user_id'] . '">' . $row['username'] . '</option>';
}
$sql = "SELECT g.group_id, g.group_name, ao.auth_option
FROM " . GROUPS_TABLE . " g, " . ACL_GROUPS_TABLE . " ag, " . ACL_OPTIONS_TABLE . " ao
WHERE ao.auth_type LIKE 'admin'
AND ag.auth_option_id = ao.auth_option_id
AND g.group_id = ag.group_id
ORDER BY g.group_name ASC";
$result = $db->sql_query($sql);
$auth_groups = array();
while ( $row = $db->sql_fetchrow($result) )
{
$auth_groups[$row['auth_option']] .= '<option value="' . $row['group_id'] . '">' . ( ( $row['group_name'] == 'ADMINISTRATORS' ) ? $lang['Admin_group'] : $row['group_name'] ) . '</option>';
}
?>
<table class="bg" cellspacing="1" cellpadding="4" border="0" align="center">
<tr>
<th>Setting</th>
<th>Users</th>
<th>Groups</th>
</tr>
<?php
for($i = 0; $i < sizeof($auth_options); $i++)
{
$cell_bg = ( $cell_bg == 'row1' ) ? 'row2' : 'row1';
$l_can_cell = ( !empty($lang['acl_admin_' . $auth_options[$i]['auth_option']]) ) ? $lang['acl_admin_' . $auth_options[$i]['auth_option']] : $auth_options[$i]['auth_option'];
?>
<tr>
<td class="<?php echo $cell_bg; ?>"><?php echo $l_can_cell; ?></td>
<td class="<?php echo $cell_bg; ?>" align="center"><?php if ( !empty($auth_users[$auth_options[$i]['auth_option']]) ) { ?><select name="user_option[<?php echo $auth_options[$i]['auth_option']; ?>]"><?php echo $auth_users[$auth_options[$i]['auth_option']]; ?></select><?php } else { ?>&nbsp;<?php } ?></td>
<td class="<?php echo $cell_bg; ?>" align="center"><?php if ( !empty($auth_groups[$auth_options[$i]['auth_option']]) ) { ?><select name="group_option[<?php echo $auth_options[$i]['auth_option']; ?>]"><?php echo $auth_groups[$auth_options[$i]['auth_option']]; ?></select><?php } else { ?>&nbsp;<?php } ?></td>
</tr>
<?php
}
?>
</table>
<?php
break;
}
?>
<?php echo $s_hidden_fields; ?></form>
<?php
}
else
{
@ -108,16 +325,16 @@ else
?>
<h1><?php echo $lang['Permissions']; ?></h1>
<h1><?php echo $l_title; ?></h1>
<p><?php echo $lang['Permissions_explain']; ?></p>
<p><?php echo $l_title_explain ?></p>
<form method="post" action="<?php echo "admin_permissions.$phpEx$SID"; ?>"><table cellspacing="1" cellpadding="4" border="0" align="center" bgcolor="#98AAB1">
<form method="post" action="<?php echo "admin_permissions.$phpEx$SID&amp;mode=$mode"; ?>"><table class="bg" cellspacing="1" cellpadding="4" border="0" align="center">
<tr>
<th align="center"><?php echo $lang['Select_a_Forum']; ?></th>
</tr>
<tr>
<td class="row1" align="center">&nbsp;<select name="f"><?php echo $select_list; ?></select>&nbsp;&nbsp;<input type="submit" value="<?php echo $lang['Look_up_Forum']; ?>" class="mainoption" />&nbsp;</td>
<td class="row1" align="center">&nbsp;<select name="f"><?php echo $select_list; ?></select> &nbsp;<input type="submit" value="<?php echo $lang['Look_up_Forum']; ?>" class="mainoption" />&nbsp;</td>
</tr>
</table></form>

200
phpBB/admin/admin_prune.php Normal file
View file

@ -0,0 +1,200 @@
<?php
/***************************************************************************
* admin_prune.php
* -------------------
* begin : Mon Jul 31, 2001
* copyright : (C) 2001 The phpBB Group
* email : support@phpbb.com
*
* $Id$
*
****************************************************************************/
/***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
***************************************************************************/
if ( !empty($setmodules) )
{
if ( !$acl->get_acl_admin('forum') )
{
return;
}
$filename = basename(__FILE__);
$module['Forums']['Prune'] = $filename . $SID . '&amp;mode=forums';
return;
}
define('IN_PHPBB', 1);
//
// Include files
//
$phpbb_root_path = '../';
require($phpbb_root_path . 'extension.inc');
require('pagestart.' . $phpEx);
require($phpbb_root_path . 'includes/functions_admin.'.$phpEx);
//
// Do we have forum admin permissions?
//
if ( !$acl->get_acl_admin('forum') )
{
message_die(MESSAGE, $lang['No_admin']);
}
//
// Get the forum ID for pruning
//
if ( isset($HTTP_GET_VARS['f']) || isset($HTTP_POST_VARS['f']) )
{
$forum_id = ( isset($HTTP_POST_VARS['f']) ) ? intval($HTTP_POST_VARS['f']) : intval($HTTP_GET_VARS['f']);
$forum_sql = ( $forum_id == -1 ) ? '' : "AND forum_id = $forum_id";
}
else
{
$forum_id = '';
$forum_sql = '';
}
//
// Get a list of forum's or the data for the forum that we are pruning.
//
$sql = "SELECT f.*
FROM " . FORUMS_TABLE . " f, " . CATEGORIES_TABLE . " c
WHERE c.cat_id = f.cat_id
$forum_sql
ORDER BY c.cat_order ASC, f.forum_order ASC";
$result = $db->sql_query($sql);
$forum_rows = array();
while( $row = $db->sql_fetchrow($result) )
{
$forum_rows[] = $row;
}
//
// Check for submit to be equal to Prune. If so then proceed with the pruning.
//
if ( isset($HTTP_POST_VARS['doprune']) )
{
$prunedays = ( isset($HTTP_POST_VARS['prunedays']) ) ? intval($HTTP_POST_VARS['prunedays']) : 0;
// Convert days to seconds for timestamp functions...
$prunedate = time() - ( $prunedays * 86400 );
$template->set_filenames(array(
'body' => 'admin/forum_prune_result_body.tpl')
);
$log_data = '';
for($i = 0; $i < count($forum_rows); $i++)
{
$p_result = prune($forum_rows[$i]['forum_id'], $prunedate);
sync('forum', $forum_rows[$i]['forum_id']);
$template->assign_block_vars('prune_results', array(
'ROW_COLOR' => '#' . $row_color,
'ROW_CLASS' => $row_class,
'FORUM_NAME' => $forum_rows[$i]['forum_name'],
'FORUM_TOPICS' => $p_result['topics'],
'FORUM_POSTS' => $p_result['posts'])
);
$log_data .= ( ( $log_data != '' ) ? ', ' : '' ) . $forum_rows[$i]['forum_name'];
}
$template->assign_vars(array(
'L_FORUM_PRUNE' => $lang['Forum_Prune'],
'L_FORUM' => $lang['Forum'],
'L_TOPICS_PRUNED' => $lang['Topics_pruned'],
'L_POSTS_PRUNED' => $lang['Posts_pruned'],
'L_PRUNE_RESULT' => $lang['Prune_success'])
);
add_admin_log('log_prune', $log_data);
}
else
{
page_header($lang['Forums']);
//
// If they haven't selected a forum for pruning yet then
// display a select box to use for pruning.
//
if ( empty($forum_id) )
{
//
// Output a selection table if no forum id has been specified.
//
$select_list .= '<option value="-1">' . $lang['All_Forums'] . '</option>';
for($i = 0; $i < count($forum_rows); $i++)
{
$select_list .= '<option value="' . $forum_rows[$i]['forum_id'] . '">' . $forum_rows[$i]['forum_name'] . '</option>';
}
?>
<h1><?php echo $lang['Prune']; ?></h1>
<p><?php echo $lang['Forum_Prune_explain']; ?></p>
<form method="post" action="<?php echo "admin_prune.$phpEx$SID"; ?>"><table cellspacing="1" cellpadding="4" border="0" align="center" bgcolor="#98AAB1">
<tr>
<th align="center"><?php echo $lang['Select_a_Forum']; ?></th>
</tr>
<tr>
<td class="row1" align="center"><?php echo $s_hidden_fields; ?>&nbsp;<select name="f"><?php echo $select_list; ?></select>&nbsp;&nbsp;<input type="submit" value="<?php echo $lang['Look_up_Forum']; ?>" class="mainoption" />&nbsp;</td>
</tr>
</table></form>
<?php
}
else
{
$forum_name = ( $forum_id == -1 ) ? $lang['All_Forums'] : $forum_rows[0]['forum_name'];
$prune_data = $lang['Prune_topics_not_posted'] . " ";
$prune_data .= '<input type="text" name="prunedays" size="4"> ' . $lang['Days'];
$s_hidden_fields = '<input type="hidden" name="f" value="' . $forum_id . '">';
?>
<h1><?php echo $lang['Prune']; ?></h1>
<p><?php echo $lang['Forum_Prune_explain']; ?></p>
<h2><?php echo $lang['Forum'] . ': ' . $forum_name; ?></h2>
<form method="post" action="<?php echo "admin_prune.$phpEx$SID"; ?>"><table cellspacing="1" cellpadding="4" border="0" align="center" bgcolor="#98AAB1">
<tr>
<th class="th"><?php echo $lang['Forum_Prune']; ?></th>
</tr>
<tr>
<td class="row1"><?php echo $prune_data; ?></td>
</tr>
<tr>
<td class="cat" align="center"><?php echo $s_hidden_fields; ?><input type="submit" name="doprune" value="<?php echo $lang['Do_Prune']; ?>" class="mainoption"></td>
</tr>
</table></form>
<?php
}
}
//
// Actually output the page here.
//
page_footer();
?>

View file

@ -32,6 +32,10 @@ if ( !empty($setmodules) )
return;
}
define('IN_PHPBB', 1);
//
// Include files
//
$phpbb_root_path = '../';
require($phpbb_root_path . 'extension.inc');
require('pagestart.' . $phpEx);
@ -48,44 +52,68 @@ if ( !$acl->get_acl_admin('general') )
//
// Start indexing
//
if ( isset($HTTP_POST_VARS['start']) )
if ( isset($HTTP_POST_VARS['start']) || isset($HTTP_GET_VARS['batchstart']) )
{
//
// Do not change anything below this line.
//
set_time_limit(0);
@set_time_limit(0);
$common_percent = 0.4; // Percentage of posts in which a word has to appear to be marked as common
print "<html>\n<body>\n";
//
// Try and load stopword and synonym files
//
// This needs fixing! Shouldn't be hardcoded to English files!
$stopword_array = file($phpbb_root_path . "language/lang_english/search_stopwords.txt");
$synonym_array = file($phpbb_root_path . "language/lang_english/search_synonyms.txt");
$stopword_array = array();
$synonym_array = array();
$dir = opendir($phpbb_root_path . 'language/');
while ( $file = readdir($dir) )
{
if ( ereg('^lang_', $file) && !is_file($phpbb_root_path . 'language/' . $file) && !is_link($phpbb_root_path . 'language/' . $file) )
{
unset($tmp_array);
$tmp_array = @file($phpbb_root_path . 'language/' . $file . '/search_stopwords.txt');
if ( is_array($tmp_array) )
{
$stopword_array = array_merge($stopword_array, $tmp_array);
}
unset($tmp_array);
$tmp_array = @file($phpbb_root_path . 'language/' . $file . '/search_synonyms.txt');
if ( is_array($tmp_array) )
{
$synonym_array = array_merge($synonym_array, $tmp_array);
}
}
}
closedir($dir);
$sql = "UPDATE " . CONFIG_TABLE . "
SET config_value = '1'
WHERE config_name = 'board_disable'";
$db->sql_query($sql);
//
// Fetch a batch of posts_text entries
//
$sql = "SELECT COUNT(*) as total, MAX(post_id) as max_post_id
FROM ". POSTS_TEXT_TABLE;
if ( !($result = $db->sql_query($sql)) )
{
$error = $db->sql_error();
die("Couldn't get maximum post ID :: " . $sql . " :: " . $error['message']);
}
FROM " . POSTS_TEXT_TABLE;
$result = $db->sql_query($sql);
$max_post_id = $db->sql_fetchrow($result);
$totalposts = $max_post_id['total'];
$max_post_id = $max_post_id['max_post_id'];
$postcounter = (!isset($HTTP_GET_VARS['batchstart'])) ? 0 : $HTTP_GET_VARS['batchstart'];
$postcounter = ( !isset($HTTP_GET_VARS['batchstart']) ) ? 0 : $HTTP_GET_VARS['batchstart'];
$batchsize = 200; // Process this many posts per loop
$batchcount = 0;
$batchsize = 200; // Process this many posts per loop
for(;$postcounter <= $max_post_id; $postcounter += $batchsize)
{
$batchstart = $postcounter + 1;
@ -97,35 +125,20 @@ if ( isset($HTTP_POST_VARS['start']) )
WHERE post_id
BETWEEN $batchstart
AND $batchend";
if( !($result = $db->sql_query($sql)) )
$result = $db->sql_query($sql);
if ( $row = $db->sql_fetchrow($result) )
{
$error = $db->sql_error();
die("Couldn't get post_text :: " . $sql . " :: " . $error['message']);
}
$rowset = $db->sql_fetchrowset($result);
$db->sql_freeresult($result);
$post_rows = count($rowset);
if( $post_rows )
do
{
// $sql = "LOCK TABLES ".POST_TEXT_TABLE." WRITE";
// $result = $db->sql_query($sql);
print "\n<p>\n<a href='$PHP_SELF?batchstart=$batchstart'>Restart from posting $batchstart</a><br>\n";
// print "\n<p>\n<a href='$PHP_SELF?batchstart=$batchstart'>Restart from posting $batchstart</a><br>\n";
// For every post in the batch:
for($post_nr = 0; $post_nr < $post_rows; $post_nr++ )
{
print ".";
flush();
$post_id = $rowset[$post_nr]['post_id'];
$post_id = $row['post_id'];
$matches = array();
$matches['text'] = split_words(clean_words("post", $rowset[$post_nr]['post_text'], $stopword_array, $synonym_array));
$matches['title'] = split_words(clean_words("post", $rowset[$post_nr]['post_subject'], $stopword_array, $synonym_array));
$matches['text'] = split_words(clean_words('post', $row['post_text'], $stopword_array, $synonym_array));
$matches['title'] = split_words(clean_words('post', $row['post_subject'], $stopword_array, $synonym_array));
while( list($match_type, $match_ary) = @each($matches) )
{
@ -140,8 +153,7 @@ if ( isset($HTTP_POST_VARS['start']) )
}
// For all words in the posting
$sql_in = "";
$sql_in = '';
$sql_insert = '';
$sql_select = '';
@ -150,8 +162,7 @@ if ( isset($HTTP_POST_VARS['start']) )
for($j = 0; $j < $num_matches; $j++)
{
$this_word = strtolower(trim($match_ary[$j]));
if ( $this_word != '' )
if ( $this_word = strtolower(trim($match_ary[$j])) )
{
$word_count[$this_word] = ( isset($word_count[$this_word]) ) ? $word_count[$this_word] + 1 : 0;
$comma = ($sql_insert != '')? ', ': '';
@ -163,66 +174,48 @@ if ( isset($HTTP_POST_VARS['start']) )
if ( $sql_insert == '' )
{
die("no words found");
message_die(ERROR, 'No words found to index');
}
$sql = 'INSERT IGNORE INTO ' . SEARCH_WORD_TABLE . "
(word_text)
$sql = "INSERT IGNORE INTO " . SEARCH_WORD_TABLE . " (word_text)
VALUES $sql_insert";
if ( !$result = $db->sql_query($sql) )
{
$error = $db->sql_error();
die("Couldn't INSERT words :: " . $sql . " :: " . $error['message']);
}
$db->sql_query($sql);
// Get the word_id's out of the DB (to see if they are already there)
$sql = "SELECT word_id, word_text
FROM " . SEARCH_WORD_TABLE . "
WHERE word_text IN ($sql_select)
GROUP BY word_text";
$result = $db->sql_query($sql);
if ( !$result )
{
$error = $db->sql_error();
die("Couldn't select words :: " . $sql . " :: " . $error['message']);
}
$result2 = $db->sql_query($sql);
$sql_insert = array();
while( $row = $db->sql_fetchrow($result) )
while( $row = $db->sql_fetchrow($result2) )
{
$sql_insert[] = "($post_id, " . $row['word_id'] . ", $title_match)";
}
$db->sql_freeresult($result);
$db->sql_freeresult($result2);
$sql = "INSERT INTO " . SEARCH_MATCH_TABLE . "
(post_id, word_id, title_match)
VALUES " . implode(", ", $sql_insert);
$result = $db->sql_query($sql);
if ( !$result )
{
$error = $db->sql_error();
die("Couldn't insert new word match :: " . $sql . " :: " . $error['message']);
}
$sql = "INSERT INTO " . SEARCH_MATCH_TABLE . " (post_id, word_id, title_match)
VALUES " . implode(', ', $sql_insert);
$db->sql_query($sql);
} // All posts
}
// $sql = "UNLOCK TABLES";
// $result = $db->sql_query($sql);
while ( $row = $db->sql_fetchrow($result) );
}
// Remove common words after the first 2 batches and after every 4th batch after that.
if( $batchcount % 4 == 3 )
if ( $batchcount % 4 == 3 )
{
print "<br>Removing common words (words that appear in more than $common_percent of the posts)<br>\n";
flush();
print "Removed ". remove_common("global", $common_percent) ." words that where too common.<br>";
// print "<br>Removing common words (words that appear in more than $common_percent of the posts)<br>\n";
// flush();
// print "Removed ". remove_common("global", $common_percent) ." words that where too common.<br>";
}
}
echo "<br>Done";
exit;
}
else if ( isset($HTTP_POST_VARS['cancel']) )

File diff suppressed because it is too large Load diff

View file

@ -8,7 +8,6 @@
*
* $Id$
*
*
***************************************************************************/
/***************************************************************************
@ -20,24 +19,38 @@
*
***************************************************************************/
define('IN_PHPBB', 1);
if( !empty($setmodules) )
if ( !empty($setmodules) )
{
if ( !$acl->get_acl_admin('user') )
{
return;
}
$filename = basename(__FILE__);
$module['Users']['Manage'] = $filename;
return;
}
$phpbb_root_path = "../";
define('IN_PHPBB', 1);
//
// Include files
//
$phpbb_root_path = '../';
require($phpbb_root_path . 'extension.inc');
require('pagestart.' . $phpEx);
require($phpbb_root_path . 'includes/bbcode.'.$phpEx);
require($phpbb_root_path . 'includes/functions_post.'.$phpEx);
require($phpbb_root_path . 'includes/functions_selects.'.$phpEx);
require($phpbb_root_path . 'includes/functions_posting.'.$phpEx);
require($phpbb_root_path . 'includes/functions_validate.'.$phpEx);
//
// Do we have forum admin permissions?
//
if ( !$acl->get_acl_admin('user') )
{
return;
}
//
// Set mode
//
@ -53,7 +66,7 @@ else
//
// Begin program
//
if( $mode == 'edit' || $mode == 'save' && ( isset($HTTP_POST_VARS['username']) || isset($HTTP_GET_VARS[POST_USERS_URL]) || isset( $HTTP_POST_VARS[POST_USERS_URL]) ) )
if ( $mode == 'edit' || $mode == 'save' && ( isset($HTTP_POST_VARS['username']) || isset($HTTP_GET_VARS['u']) || isset( $HTTP_POST_VARS['u']) ) )
{
//
// Ok, the profile has been modified and submitted, let's update
@ -65,7 +78,7 @@ if( $mode == 'edit' || $mode == 'save' && ( isset($HTTP_POST_VARS['username']) |
$this_userdata = get_userdata($user_id);
if( !$this_userdata )
{
message_die(GENERAL_MESSAGE, $lang['No_user_id_specified'] );
message_die(MESSAGE, $lang['No_user_id_specified'] );
}
$username = ( !empty($HTTP_POST_VARS['username']) ) ? trim(strip_tags( $HTTP_POST_VARS['username'] ) ) : '';
@ -204,10 +217,7 @@ if( $mode == 'edit' || $mode == 'save' && ( isset($HTTP_POST_VARS['username']) |
// User is (made) inactive. Delete all their sessions.
$sql = "DELETE FROM " . SESSIONS_TABLE . "
WHERE session_user_id = $user_id";
if( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could not delete this users sessions', '', __LINE__, __FILE__, $sql);
}
$db->sql_query($sql);
}
if( $signature != "" )
@ -239,7 +249,7 @@ if( $mode == 'edit' || $mode == 'save' && ( isset($HTTP_POST_VARS['username']) |
//
// Avatar stuff
//
$avatar_sql = "";
$avatar_sql = '';
if( isset($HTTP_POST_VARS['avatardel']) )
{
if( $this_userdata['user_avatar_type'] == USER_AVATAR_UPLOAD && $this_userdata['user_avatar'] != "" )
@ -515,63 +525,44 @@ if( $mode == 'edit' || $mode == 'save' && ( isset($HTTP_POST_VARS['username']) |
WHERE ug.user_id = $user_id
AND g.group_id = ug.group_id
AND g.group_single_user = 1";
if( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not obtain group information for this user', '', __LINE__, __FILE__, $sql);
}
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
$db->sql_transaction();
$sql = "UPDATE " . POSTS_TABLE . "
SET poster_id = " . ANONYMOUS . ", post_username = '$username'
WHERE poster_id = $user_id";
if( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could not update posts for this user', '', __LINE__, __FILE__, $sql);
}
$db->sql_query($sql);
$sql = "UPDATE " . TOPICS_TABLE . "
SET topic_poster = " . ANONYMOUS . "
WHERE topic_poster = $user_id";
if( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could not update topics for this user', '', __LINE__, __FILE__, $sql);
}
$db->sql_query($sql);
$sql = "DELETE FROM " . USERS_TABLE . "
WHERE user_id = $user_id";
if( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could not delete user', '', __LINE__, __FILE__, $sql);
}
$db->sql_query($sql);
$sql = "DELETE FROM " . USER_GROUP_TABLE . "
WHERE user_id = $user_id";
if( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could not delete user from user_group table', '', __LINE__, __FILE__, $sql);
}
$db->sql_query($sql);
$sql = "DELETE FROM " . GROUPS_TABLE . "
WHERE group_id = " . $row['group_id'];
if( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could not delete group for this user', '', __LINE__, __FILE__, $sql);
}
$db->sql_query($sql);
$sql = "DELETE FROM " . AUTH_ACCESS_TABLE . "
WHERE group_id = " . $row['group_id'];
if( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could not delete group for this user', '', __LINE__, __FILE__, $sql);
}
$db->sql_query($sql);
$sql = "DELETE FROM " . TOPICS_WATCH_TABLE . "
WHERE user_id = $user_id";
if ( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could not delete user from topic watch table', '', __LINE__, __FILE__, $sql);
}
$db->sql_query($sql);
$db->sql_transaction('commit');
$message = $lang['User_deleted'];
@ -581,30 +572,22 @@ if( $mode == 'edit' || $mode == 'save' && ( isset($HTTP_POST_VARS['username']) |
$sql = "UPDATE " . USERS_TABLE . "
SET " . $username_sql . $passwd_sql . "user_email = '" . str_replace("\'", "''", $email) . "', user_icq = '" . str_replace("\'", "''", $icq) . "', user_website = '" . str_replace("\'", "''", $website) . "', user_occ = '" . str_replace("\'", "''", $occupation) . "', user_from = '" . str_replace("\'", "''", $location) . "', user_interests = '" . str_replace("\'", "''", $interests) . "', user_sig = '" . str_replace("\'", "''", $signature) . "', user_viewemail = $viewemail, user_aim = '" . str_replace("\'", "''", $aim) . "', user_yim = '" . str_replace("\'", "''", $yim) . "', user_msnm = '" . str_replace("\'", "''", $msn) . "', user_attachsig = $attachsig, user_sig_bbcode_uid = '$signature_bbcode_uid', user_allowsmile = $allowsmilies, user_allowhtml = $allowhtml, user_allowavatar = $user_allowavatar, user_allowbbcode = $allowbbcode, user_allow_viewonline = $allowviewonline, user_notify = $notifyreply, user_allow_pm = $user_allowpm, user_notify_pm = $notifypm, user_popup_pm = $popuppm, user_lang = '" . str_replace("\'", "''", $user_lang) . "', user_style = $user_style, user_timezone = $user_timezone, user_dateformat = '" . str_replace("\'", "''", $user_dateformat) . "', user_active = $user_status, user_rank = $user_rank" . $avatar_sql . "
WHERE user_id = $user_id";
if( $result = $db->sql_query($sql) )
{
if( isset($rename_user) )
$result = $db->sql_query($sql);
if ( isset($rename_user) )
{
$sql = "UPDATE " . GROUPS_TABLE . "
SET group_name = '".str_replace("\'", "''", $rename_user)."'
WHERE group_name = '".str_replace("\'", "''", $this_userdata['username'] )."'";
if( !$result = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could not rename users group', '', __LINE__, __FILE__, $sql);
}
$db->sql_query($sql);
}
$message .= $lang['Admin_user_updated'];
}
else
{
$error = TRUE;
$error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['Admin_user_fail'];
}
}
$message .= '<br /><br />' . sprintf($lang['Click_return_useradmin'], '<a href="' . append_sid("admin_users.$phpEx") . '">', '</a>') . '<br /><br />' . sprintf($lang['Click_return_admin_index'], '<a href="' . append_sid("index.$phpEx?pane=right") . '">', '</a>');
$message .= '<br /><br />' . sprintf($lang['Click_return_useradmin'], '<a href="' . "admin_users.$phpEx$SID" . '">', '</a>') . '<br /><br />' . sprintf($lang['Click_return_admin_index'], '<a href="' . "index.$phpE$SID?pane=right" . '">', '</a>');
message_die(GENERAL_MESSAGE, $message);
message_die(MESSAGE, $message);
}
else
{
@ -646,7 +629,7 @@ if( $mode == 'edit' || $mode == 'save' && ( isset($HTTP_POST_VARS['username']) |
$this_userdata = get_userdata($user_id);
if( !$this_userdata )
{
message_die(GENERAL_MESSAGE, $lang['No_user_id_specified'] );
message_die(MESSAGE, $lang['No_user_id_specified'] );
}
}
else
@ -654,7 +637,7 @@ if( $mode == 'edit' || $mode == 'save' && ( isset($HTTP_POST_VARS['username']) |
$this_userdata = get_userdata( $HTTP_POST_VARS['username'] );
if( !$this_userdata )
{
message_die(GENERAL_MESSAGE, $lang['No_user_id_specified'] );
message_die(MESSAGE, $lang['No_user_id_specified'] );
}
}
@ -870,10 +853,7 @@ if( $mode == 'edit' || $mode == 'save' && ( isset($HTTP_POST_VARS['username']) |
$sql = "SELECT * FROM " . RANKS_TABLE . "
WHERE rank_special = 1
ORDER BY rank_title";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not obtain ranks data', '', __LINE__, __FILE__, $sql);
}
$result = $db->sql_query($sql);
$rank_select_box = '<option value="0">' . $lang['No_assigned_rank'] . '</option>';
while( $row = $db->sql_fetchrow($result) )
@ -1001,7 +981,7 @@ if( $mode == 'edit' || $mode == 'save' && ( isset($HTTP_POST_VARS['username']) |
'S_FORM_ENCTYPE' => $form_enctype,
'HTML_STATUS' => $html_status,
'BBCODE_STATUS' => sprintf($bbcode_status, '<a href="../' . append_sid("faq.$phpEx?mode=bbcode") . '" target="_phpbbcode">', '</a>'),
'BBCODE_STATUS' => sprintf($bbcode_status, '<a href="../' . "faq.$phpEx$SID&amp;mode=bbcode" . '" target="_phpbbcode">', '</a>'),
'SMILIES_STATUS' => $smilies_status,
'L_DELETE_USER' => $lang['User_delete'],
@ -1009,7 +989,7 @@ if( $mode == 'edit' || $mode == 'save' && ( isset($HTTP_POST_VARS['username']) |
'L_SELECT_RANK' => $lang['Rank_title'],
'S_HIDDEN_FIELDS' => $s_hidden_fields,
'S_PROFILE_ACTION' => append_sid("admin_users.$phpEx"))
'S_PROFILE_ACTION' => "admin_users.$phpEx$SID")
);
if( file_exists('./../' . $board_config['avatar_path'] ) )
@ -1027,7 +1007,7 @@ if( $mode == 'edit' || $mode == 'save' && ( isset($HTTP_POST_VARS['username']) |
}
}
$template->pparse('body');
$template->display('body');
}
else
@ -1041,7 +1021,7 @@ else
ORDER BY username";
$result = $db->sql_query($sql);
$select_list = '<select name="' . POST_USERS_URL . '">';
$select_list = '<select name="u">';
while( $row = $db->sql_fetchrow($result) )
{
$select_list .= '<option value="' . $row['user_id'] . '">' . $row['username'] . '</option>';
@ -1059,12 +1039,12 @@ else
'L_LOOK_UP' => $lang['Look_up_user'],
'L_FIND_USERNAME' => $lang['Find_username'],
'U_SEARCH_USER' => append_sid("../search.$phpEx?mode=searchuser"),
'U_SEARCH_USER' => "../search.$phpEx$SID&amp;mode=searchuser",
'S_USER_ACTION' => append_sid("admin_users.$phpEx"),
'S_USER_ACTION' => "admin_users.$phpEx$SID",
'S_USER_SELECT' => $select_list)
);
$template->pparse('body');
$template->display('body');
}

View file

@ -8,7 +8,6 @@
*
* $Id$
*
*
***************************************************************************/
/***************************************************************************
@ -20,216 +19,214 @@
*
***************************************************************************/
define('IN_PHPBB', 1);
if( !empty($setmodules) )
if ( !empty($setmodules) )
{
if ( !$acl->get_acl_admin('general') )
{
return;
}
$file = basename(__FILE__);
$module['General']['Word_Censor'] = "$file";
return;
}
define('IN_PHPBB', 1);
//
// Load default header
// Include files
//
$phpbb_root_path = "../";
$phpbb_root_path = '../';
require($phpbb_root_path . 'extension.inc');
require('pagestart.' . $phpEx);
if( isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode']) )
//
// Do we have forum admin permissions?
//
if ( !$acl->get_acl_admin('general') )
{
$mode = ($HTTP_GET_VARS['mode']) ? $HTTP_GET_VARS['mode'] : $HTTP_POST_VARS['mode'];
return;
}
//
//
//
if ( isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode']) )
{
$mode = ( isset($HTTP_GET_VARS['mode']) ) ? $HTTP_GET_VARS['mode'] : $HTTP_POST_VARS['mode'];
}
else
{
//
// These could be entered via a form button
//
if( isset($HTTP_POST_VARS['add']) )
if ( isset($HTTP_POST_VARS['add']) )
{
$mode = "add";
$mode = 'add';
}
else if( isset($HTTP_POST_VARS['save']) )
else if ( isset($HTTP_POST_VARS['save']) )
{
$mode = "save";
$mode = 'save';
}
else
{
$mode = "";
$mode = '';
}
}
if( $mode != "" )
if( $mode != '' )
{
if( $mode == "edit" || $mode == "add" )
switch ( $mode )
{
case 'edit':
case 'add':
$word_id = ( isset($HTTP_GET_VARS['id']) ) ? $HTTP_GET_VARS['id'] : 0;
$template->set_filenames(array(
"body" => "admin/words_edit_body.tpl")
);
$s_hidden_fields = '';
if ( $mode == 'edit' )
{
if ( !$word_id )
{
message_die(MESSAGE, $lang['No_word_selected']);
}
if( $mode == "edit" )
{
if( $word_id )
{
$sql = "SELECT *
FROM " . WORDS_TABLE . "
WHERE word_id = $word_id";
if(!$result = $db->sql_query($sql))
{
message_die(GENERAL_ERROR, "Could not query words table", "Error", __LINE__, __FILE__, $sql);
}
$result = $db->sql_query($sql);
$word_info = $db->sql_fetchrow($result);
$s_hidden_fields .= '<input type="hidden" name="id" value="' . $word_id . '" />';
}
else
{
message_die(GENERAL_MESSAGE, $lang['No_word_selected']);
}
}
$template->assign_vars(array(
"WORD" => $word_info['word'],
"REPLACEMENT" => $word_info['replacement'],
page_header($lang['General']);
"L_WORDS_TITLE" => $lang['Words_title'],
"L_WORDS_TEXT" => $lang['Words_explain'],
"L_WORD_CENSOR" => $lang['Edit_word_censor'],
"L_WORD" => $lang['Word'],
"L_REPLACEMENT" => $lang['Replacement'],
"L_SUBMIT" => $lang['Submit'],
?>
"S_WORDS_ACTION" => append_sid("admin_words.$phpEx"),
"S_HIDDEN_FIELDS" => $s_hidden_fields)
);
<h1><?php echo $lang['Words_title']; ?></h1>
$template->pparse("body");
<p><?php echo $lang['Words_explain']; ?></p>
include('page_footer_admin.'.$phpEx);
}
else if( $mode == "save" )
{
<form method="post" action="<?php echo "admin_words.$phpEx$SID"; ?>"><table cellspacing="1" cellpadding="4" border="0" align="center" bgcolor="#98AAB1">
<tr>
<th colspan="2"><?php echo $lang['Edit_word_censor']; ?></th>
</tr>
<tr>
<td class="row1"><?php echo $lang['Word']; ?></td>
<td class="row2"><input type="text" name="word" value="<?php echo $word_info['word']; ?>" /></td>
</tr>
<tr>
<td class="row1"><?php echo $lang['Replacement']; ?></td>
<td class="row2"><input type="text" name="replacement" value="<?php echo $word_info['replacement']; ?>" /></td>
</tr>
<tr>
<td class="cat" colspan="2" align="center"><?php echo $s_hidden_fields; ?><input class="mainoption" type="submit" name="save" value="<?php echo $lang['Submit']; ?>" /></td>
</tr>
</table></form>
<?php
break;
case 'save':
$word_id = ( isset($HTTP_POST_VARS['id']) ) ? $HTTP_POST_VARS['id'] : 0;
$word = ( isset($HTTP_POST_VARS['word']) ) ? trim($HTTP_POST_VARS['word']) : "";
$replacement = ( isset($HTTP_POST_VARS['replacement']) ) ? trim($HTTP_POST_VARS['replacement']) : "";
$word = ( isset($HTTP_POST_VARS['word']) ) ? trim($HTTP_POST_VARS['word']) : '';
$replacement = ( isset($HTTP_POST_VARS['replacement']) ) ? trim($HTTP_POST_VARS['replacement']) : '';
if($word == "" || $replacement == "")
if ( $word == '' || $replacement == '' )
{
message_die(GENERAL_MESSAGE, $lang['Must_enter_word']);
message_die(MESSAGE, $lang['Must_enter_word']);
}
if( $word_id )
{
$sql = "UPDATE " . WORDS_TABLE . "
SET word = '" . str_replace("\'", "''", $word) . "', replacement = '" . str_replace("\'", "''", $replacement) . "'
WHERE word_id = $word_id";
$message = $lang['Word_updated'];
}
else
{
$sql = "INSERT INTO " . WORDS_TABLE . " (word, replacement)
VALUES ('" . str_replace("\'", "''", $word) . "', '" . str_replace("\'", "''", $replacement) . "')";
$message = $lang['Word_added'];
}
$sql = ( $word_id ) ? "UPDATE " . WORDS_TABLE . " SET word = '" . str_replace("\'", "''", $word) . "', replacement = '" . str_replace("\'", "''", $replacement) . "' WHERE word_id = $word_id" : "INSERT INTO " . WORDS_TABLE . " (word, replacement) VALUES ('" . str_replace("\'", "''", $word) . "', '" . str_replace("\'", "''", $replacement) . "')";
$db->sql_query($sql);
if(!$result = $db->sql_query($sql))
{
message_die(GENERAL_ERROR, "Could not insert data into words table", $lang['Error'], __LINE__, __FILE__, $sql);
}
$log_action = ( $word_id ) ? 'log_edit_word' : 'log_add_word';
add_admin_log($log_action, stripslashes($word));
$message .= "<br /><br />" . sprintf($lang['Click_return_wordadmin'], "<a href=\"" . append_sid("admin_words.$phpEx") . "\">", "</a>") . "<br /><br />" . sprintf($lang['Click_return_admin_index'], "<a href=\"" . append_sid("index.$phpEx?pane=right") . "\">", "</a>");
$message = ( $word_id ) ? $lang['Word_updated'] : $lang['Word_added'];
$message .= '<br /><br />' . sprintf($lang['Click_return_wordadmin'], '<a href="' . "admin_words.$phpEx$SID" . '">', '</a>') . '<br /><br />' . sprintf($lang['Click_return_admin_index'], '<a href="' . "index.$phpEx$SID&amp;pane=right" . '">', '</a>');
message_die(GENERAL_MESSAGE, $message);
}
else if( $mode == "delete" )
{
if( isset($HTTP_POST_VARS['id']) || isset($HTTP_GET_VARS['id']) )
message_die(MESSAGE, $message);
break;
case 'delete':
if ( isset($HTTP_POST_VARS['id']) || isset($HTTP_GET_VARS['id']) )
{
$word_id = ( isset($HTTP_POST_VARS['id']) ) ? $HTTP_POST_VARS['id'] : $HTTP_GET_VARS['id'];
}
else
{
$word_id = 0;
message_die(MESSAGE, $lang['Must_specify_word']);
}
if( $word_id )
{
$sql = "DELETE FROM " . WORDS_TABLE . "
WHERE word_id = $word_id";
$db->sql_query($sql);
if(!$result = $db->sql_query($sql))
{
message_die(GENERAL_ERROR, "Could not remove data from words table", $lang['Error'], __LINE__, __FILE__, $sql);
add_admin_log('log_delete_word');
$message = $lang['Word_removed'] . '<br /><br />' . sprintf($lang['Click_return_wordadmin'], '<a href="' . "admin_words.$phpEx$SID" . '">', '</a>') . '<br /><br />' . sprintf($lang['Click_return_admin_index'], '<a href="' . "index.$phpEx$SID&amp;pane=right" . '">', '</a>');
message_die(MESSAGE, $message);
break;
}
$message = $lang['Word_removed'] . "<br /><br />" . sprintf($lang['Click_return_wordadmin'], "<a href=\"" . append_sid("admin_words.$phpEx") . "\">", "</a>") . "<br /><br />" . sprintf($lang['Click_return_admin_index'], "<a href=\"" . append_sid("index.$phpEx?pane=right") . "\">", "</a>");
message_die(GENERAL_MESSAGE, $message);
}
else
{
message_die(GENERAL_MESSAGE, $lang['Must_specify_word']);
}
}
}
else
{
$template->set_filenames(array(
"body" => "admin/words_list_body.tpl")
);
page_header($lang['General']);
?>
<h1><?php echo $lang['Words_title']; ?></h1>
<p><?php echo $lang['Words_explain']; ?></p>
<form method="post" action="<?php echo "admin_words.$phpEx$SID"; ?>"><table cellspacing="1" cellpadding="4" border="0" align="center" bgcolor="#98AAB1">
<tr>
<th><?php echo $lang['Word']; ?></th>
<th><?php echo $lang['Replacement']; ?></th>
<th colspan="2"><?php echo $lang['Action']; ?></th>
</tr>
<?php
$sql = "SELECT *
FROM " . WORDS_TABLE . "
ORDER BY word";
if( !$result = $db->sql_query($sql) )
$result = $db->sql_query($sql);
if ( $row = $db->sql_fetchrow($result) )
{
message_die(GENERAL_ERROR, "Could not query words table", $lang['Error'], __LINE__, __FILE__, $sql);
}
$word_rows = $db->sql_fetchrowset($result);
$word_count = count($word_rows);
$template->assign_vars(array(
"L_WORDS_TITLE" => $lang['Words_title'],
"L_WORDS_TEXT" => $lang['Words_explain'],
"L_WORD" => $lang['Word'],
"L_REPLACEMENT" => $lang['Replacement'],
"L_EDIT" => $lang['Edit'],
"L_DELETE" => $lang['Delete'],
"L_ADD_WORD" => $lang['Add_new_word'],
"L_ACTION" => $lang['Action'],
"S_WORDS_ACTION" => append_sid("admin_words.$phpEx"),
"S_HIDDEN_FIELDS" => '')
);
for($i = 0; $i < $word_count; $i++)
do
{
$word = $word_rows[$i]['word'];
$replacement = $word_rows[$i]['replacement'];
$word_id = $word_rows[$i]['word_id'];
$row_color = ( !($i % 2) ) ? $theme['td_color1'] : $theme['td_color2'];
$row_class = ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2'];
$template->assign_block_vars("words", array(
"ROW_COLOR" => "#" . $row_color,
"ROW_CLASS" => $row_class,
"WORD" => $word,
"REPLACEMENT" => $replacement,
"U_WORD_EDIT" => append_sid("admin_words.$phpEx?mode=edit&amp;id=$word_id"),
"U_WORD_DELETE" => append_sid("admin_words.$phpEx?mode=delete&amp;id=$word_id"))
);
}
}
$template->pparse("body");
include('page_footer_admin.'.$phpEx);
$cell_bg = ( $cell_bg == 'row1' ) ? 'row2' : 'row1';
?>
<tr>
<td class="<?php echo $cell_bg; ?>" align="center"><?php echo $row['word']; ?></td>
<td class="<?php echo $cell_bg; ?>" align="center"><?php echo $row['replacement']; ?></td>
<td class="<?php echo $cell_bg; ?>">&nbsp;<a href="<?php echo "admin_words.$phpEx$SID&amp;mode=edit&amp;id=" . $row['word_id']; ?>"><?php echo $lang['Edit']; ?></a>&nbsp;</td>
<td class="<?php echo $cell_bg; ?>">&nbsp;<a href="<?php echo "admin_words.$phpEx$SID&amp;mode=delete&amp;id=" . $row['word_id']; ?>"><?php echo $lang['Delete']; ?></a>&nbsp;</td>
</tr>
<?php
}
while ( $row = $db->sql_fetchrow($result) );
}
?>
<tr>
<td class="cat" colspan="5" height="28" align="center"><?php echo $s_hidden_fields; ?><input class="mainoption" type="submit" name="add" value="<?php echo $lang['Add_new_word']; ?>" /></td>
</tr>
</table></form>
<?php
}
page_footer()
?>

13
phpBB/admin/forms.css Normal file
View file

@ -0,0 +1,13 @@
/* Fancy form styles for IE */
input, textarea, select {
border-width: 1px;
}
input {
text-indent: 2px;
}
.postbody {
line-height: 18px
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 246 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 257 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 385 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

View file

@ -1,6 +1,6 @@
<?php
/***************************************************************************
* (admin) index.php
* index.php [ admin/ ]
* -------------------
* begin : Saturday, Feb 13, 2001
* copyright : (C) 2001 The phpBB Group
@ -8,7 +8,6 @@
*
* $Id$
*
*
***************************************************************************/
/***************************************************************************
@ -21,24 +20,66 @@
***************************************************************************/
define('IN_PHPBB', 1);
$no_page_header = TRUE;
$phpbb_root_path = "../";
//
// Define some vars
//
$pane = ( isset($HTTP_GET_VARS['pane']) ) ? $HTTP_GET_VARS['pane'] : '';
$update = ( $pane == 'right' ) ? true : false;
//
// Include files
//
$phpbb_root_path = '../';
require($phpbb_root_path . 'extension.inc');
require('pagestart.' . $phpEx);
//
// Do we have any admin permissions at all?
//
if ( !$acl->get_acl_admin() )
{
message_die(MESSAGE, 'No_admin');
}
//
// Generate relevant output
//
if( isset($HTTP_GET_VARS['pane']) && $HTTP_GET_VARS['pane'] == 'left' )
if ( isset($HTTP_GET_VARS['pane']) && $HTTP_GET_VARS['pane'] == 'top' )
{
$update = false;
require('pagestart.' . $phpEx);
include('page_header_admin.'.$phpEx);
?>
<table width="100%" cellspacing="0" cellpadding="0" border="0">
<tr>
<td><a href="index.<?php echo $phpEx; ?>?pane=right" target="main"><img src="images/header_left.jpg" width="200" height="60" alt="phpBB Logo" title="phpBB Logo" border="0"/></a></td>
<td width="100%" background="images/header_bg.jpg" height="60" align="right" nowrap="nowrap"><span class="maintitle"><?php echo $lang['Admin_title']; ?></span> &nbsp; &nbsp; &nbsp;</td>
</tr>
</table>
<?php
include('page_footer_admin.'.$phpEx);
}
else if ( isset($HTTP_GET_VARS['pane']) && $HTTP_GET_VARS['pane'] == 'left' )
{
//
// Cheat and use the meta tag to change some stylesheet info
//
$meta = '<style type="text/css">body {background-color: #98AAB1}</style>';
include('page_header_admin.'.$phpEx);
//
// Grab module information using Bart's "neat-o-module" system (tm)
//
$dir = @opendir('.');
$setmodules = 1;
while( $file = @readdir($dir) )
while ( $file = @readdir($dir) )
{
if( preg_match('/^admin_.*?\.' . $phpEx . '$/', $file) )
if ( preg_match('/^admin_(.*?)\.' . $phpEx . '$/', $file) )
{
include($file);
}
@ -48,90 +89,96 @@ if( isset($HTTP_GET_VARS['pane']) && $HTTP_GET_VARS['pane'] == 'left' )
unset($setmodules);
include('page_header_admin.'.$phpEx);
?>
$template->set_filenames(array(
'body' => 'admin/index_navigate.tpl')
);
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td width="100%"><table width="100%" cellpadding="4" cellspacing="1" border="0">
<tr>
<th class="menu" height="25">&#0187; <?php echo $lang['Return_to']; ?></th>
</tr>
<tr>
<td class="row1"><a class="genmed" href="index.<?php echo $phpEx; ?>?pane=right" target="main"><?php echo $lang['Admin_Index']; ?></a></td>
</tr>
<tr>
<td class="row2"><a class="genmed" href="../" target="_top"><?php echo $lang['Forum_index']; ?></a></td>
</tr>
<?php
$template->assign_vars(array(
'U_FORUM_INDEX' => append_sid("../index.$phpEx"),
'U_ADMIN_INDEX' => "index.$phpEx$SID&amp;pane=right",
@ksort($module);
'L_FORUM_INDEX' => $lang['Main_index'],
'L_ADMIN_INDEX' => $lang['Admin_Index'],
'L_PREVIEW_FORUM' => $lang['Preview_forum'])
);
ksort($module);
while( list($cat, $action_array) = each($module) )
foreach ( $module as $cat => $action_ary )
{
$cat = ( !empty($lang[$cat]) ) ? $lang[$cat] : preg_replace('/_/', ' ', $cat);
$template->assign_block_vars('catrow', array(
'ADMIN_CATEGORY' => $cat)
);
?>
<tr>
<th class="menu" height="25">&#0187; <?php echo $cat; ?></th>
</tr>
<?php
ksort($action_array);
ksort($action_ary);
$row_count = 0;
while( list($action, $file) = each($action_array) )
foreach ( $action_ary as $action => $file )
{
$row_color = ( !($row_count%2) ) ? $theme['td_color1'] : $theme['td_color2'];
$row_class = ( !($row_count%2) ) ? $theme['td_class1'] : $theme['td_class2'];
$action = ( !empty($lang[$action]) ) ? $lang[$action] : preg_replace('/_/', ' ', $action);
$template->assign_block_vars('catrow.modulerow', array(
'ROW_COLOR' => "#" . $row_color,
'ROW_CLASS' => $row_class,
$cell_bg = ( $cell_bg == 'row1' ) ? 'row2' : 'row1';
?>
<tr>
<td class="<?php echo $cell_bg; ?>"><a class="genmed" href="<?php echo $file; ?>" target="main"><?php echo $action; ?></a></td>
</tr>
<?php
'ADMIN_MODULE' => $action,
'U_ADMIN_MODULE' => append_sid($file))
);
$row_count++;
}
}
$template->pparse("body");
?>
</table></td>
</tr>
</table>
</body>
</html>
<?php
//
// Output footer but don't include copyright info
//
$ignore_copyright = true;
include('page_footer_admin.'.$phpEx);
}
elseif( isset($HTTP_GET_VARS['pane']) && $HTTP_GET_VARS['pane'] == 'right' )
elseif ( isset($HTTP_GET_VARS['pane']) && $HTTP_GET_VARS['pane'] == 'right' )
{
$update = true;
require('pagestart.' . $phpEx);
if ( ( isset($HTTP_POST_VARS['activate']) || isset($HTTP_POST_VARS['delete']) ) && !empty($HTTP_POST_VARS['mark']) )
{
if ( is_array($HTTP_POST_VARS['mark']) )
{
$in_sql = '';
foreach( $HTTP_POST_VARS['mark'] as $user_id )
{
$in_sql .= ( ( $in_sql != '' ) ? ', ' : '' ) . $user_id;
}
include('page_header_admin.'.$phpEx);
if ( $in_sql != '' )
{
$sql = ( isset($HTTP_POST_VARS['activate']) ) ? "UPDATE " . USERS_TABLE . " SET user_active = 1 WHERE user_id IN ($in_sql)" : "DELETE FROM " . USERS_TABLE . " WHERE user_id IN ($in_sql)";
$db->sql_query($sql);
$template->set_filenames(array(
'body' => 'admin/index_body.tpl')
);
$sql = "UPDATE " . CONFIG_TABLE . "
SET config_value = config_value - " . sizeof($HTTP_POST_VARS['mark']) . "
WHERE config_name = 'num_users'";
$db->sql_query($sql);
$template->assign_vars(array(
'L_WELCOME' => $lang['Welcome_phpBB'],
'L_ADMIN_INTRO' => $lang['Admin_intro'],
'L_FORUM_STATS' => $lang['Forum_stats'],
'L_WHO_IS_ONLINE' => $lang['Who_is_Online'],
'L_LOCATION' => $lang['Location'],
'L_LAST_UPDATE' => $lang['Last_updated'],
'L_IP_ADDRESS' => $lang['IP_Address'],
'L_STATISTIC' => $lang['Statistic'],
'L_VALUE' => $lang['Value'],
'L_NUMBER_POSTS' => $lang['Number_posts'],
'L_POSTS_PER_DAY' => $lang['Posts_per_day'],
'L_NUMBER_TOPICS' => $lang['Number_topics'],
'L_TOPICS_PER_DAY' => $lang['Topics_per_day'],
'L_NUMBER_USERS' => $lang['Number_users'],
'L_USERS_PER_DAY' => $lang['Users_per_day'],
'L_BOARD_STARTED' => $lang['Board_started'],
'L_AVATAR_DIR_SIZE' => $lang['Avatar_dir_size'],
'L_DB_SIZE' => $lang['Database_size'],
'L_FORUM_LOCATION' => $lang['Forum_Location'],
'L_STARTED' => $lang['Login'],
'L_GZIP_COMPRESSION' => $lang['Gzip_compression'])
);
$log_action = ( isset($HTTP_POST_VARS['activate']) ) ? 'log_index_activate' : 'log_index_delete';
add_admin_log($log_action, sizeof($HTTP_POST_VARS['mark']));
}
}
}
else if ( isset($HTTP_POST_VARS['remind']) )
{
}
//
// Get forum statistics
@ -150,11 +197,11 @@ elseif( isset($HTTP_GET_VARS['pane']) && $HTTP_GET_VARS['pane'] == 'right' )
$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 != '..' )
{
$avatar_dir_size += @filesize($phpbb_root_path . $board_config['avatar_path'] . '/' . $file);
}
@ -166,11 +213,11 @@ elseif( isset($HTTP_GET_VARS['pane']) && $HTTP_GET_VARS['pane'] == 'right' )
// Borrowed the code from the PHP.net annoted manual, origanally written by:
// Jesse (jesse@jess.on.ca)
//
if($avatar_dir_size >= 1048576)
if ( $avatar_dir_size >= 1048576 )
{
$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';
}
@ -186,17 +233,17 @@ elseif( isset($HTTP_GET_VARS['pane']) && $HTTP_GET_VARS['pane'] == 'right' )
$avatar_dir_size = $lang['Not_available'];
}
if($posts_per_day > $total_posts)
if ( $posts_per_day > $total_posts )
{
$posts_per_day = $total_posts;
}
if($topics_per_day > $total_topics)
if ( $topics_per_day > $total_topics )
{
$topics_per_day = $total_topics;
}
if($users_per_day > $total_users)
if ( $users_per_day > $total_users )
{
$users_per_day = $total_users;
}
@ -207,43 +254,40 @@ elseif( isset($HTTP_GET_VARS['pane']) && $HTTP_GET_VARS['pane'] == 'right' )
// This code is heavily influenced by a similar routine
// in phpMyAdmin 2.2.0
//
if( preg_match('/^mysql/', SQL_LAYER) )
if ( preg_match('/^mysql/', SQL_LAYER) )
{
$sql = "SELECT VERSION() AS mysql_version";
if($result = $db->sql_query($sql))
$result = $db->sql_query('SELECT VERSION() AS mysql_version');
if ( $row = $db->sql_fetchrow($result) )
{
$row = $db->sql_fetchrow($result);
$version = $row['mysql_version'];
if( preg_match('/^(3\.23|4\.)/', $version) )
if ( preg_match('/^(3\.23|4\.)/', $version) )
{
$db_name = ( preg_match('/^(3\.23\.[6-9])|(3\.23\.[1-9][1-9])|(4\.)/', $version) ) ? "`$dbname`" : $dbname;
$sql = "SHOW TABLE STATUS
FROM " . $db_name;
if($result = $db->sql_query($sql))
{
$tabledata_ary = $db->sql_fetchrowset($result);
$result = $db->sql_query($sql);
$dbsize = 0;
for($i = 0; $i < count($tabledata_ary); $i++)
while ( $row = $db->sql_fetchrow($result) )
{
if( $tabledata_ary[$i]['Type'] != 'MRG_MyISAM' )
if ( $row['Type'] != 'MRG_MyISAM' )
{
if( $table_prefix != "" )
if ( $table_prefix != '' )
{
if( strstr($tabledata_ary[$i]['Name'], $table_prefix) )
if ( strstr($row['Name'], $table_prefix) )
{
$dbsize += $tabledata_ary[$i]['Data_length'] + $tabledata_ary[$i]['Index_length'];
$dbsize += $row['Data_length'] + $row['Index_length'];
}
}
else
{
$dbsize += $tabledata_ary[$i]['Data_length'] + $tabledata_ary[$i]['Index_length'];
$dbsize += $row['Data_length'] + $row['Index_length'];
}
}
}
} // Else we couldn't get the table status.
}
else
{
@ -255,318 +299,220 @@ elseif( isset($HTTP_GET_VARS['pane']) && $HTTP_GET_VARS['pane'] == 'right' )
$dbsize = $lang['Not_available'];
}
}
else if( preg_match('/^mssql/', SQL_LAYER) )
else if ( preg_match('/^mssql/', SQL_LAYER) )
{
$sql = "SELECT ((SUM(size) * 8.0) * 1024.0) as dbsize
FROM sysfiles";
if( $result = $db->sql_query($sql) )
{
$result = $db->sql_query($sql);
$dbsize = ( $row = $db->sql_fetchrow($result) ) ? intval($row['dbsize']) : $lang['Not_available'];
}
else
{
$dbsize = $lang['Not_available'];
}
}
else
{
$dbsize = $lang['Not_available'];
}
if ( is_integer($dbsize) )
{
if( $dbsize >= 1048576 )
{
$dbsize = sprintf('%.2f MB', ( $dbsize / 1048576 ));
$dbsize = ( $dbsize >= 1048576 ) ? sprintf('%.2f MB', ( $dbsize / 1048576 )) : ( ( $dbsize >= 1024 ) ? sprintf('%.2f KB', ( $dbsize / 1024 )) : sprintf('%.2f Bytes', $dbsize) );
}
else if( $dbsize >= 1024 )
page_header($lang['Admin_Index']);
?>
<h1><?php echo $lang['Welcome_phpBB']; ?></h1>
<p><?php echo $lang['Admin_intro']; ?></p>
<h1><?php echo $lang['Forum_stats']; ?></h1>
<table class="bg" width="100%" cellpadding="4" cellspacing="1" border="0">
<tr>
<th width="25%" nowrap="nowrap" height="25"><?php echo $lang['Statistic']; ?></th>
<th width="25%"><?php echo $lang['Value']; ?></th>
<th width="25%" nowrap="nowrap"><?php echo $lang['Statistic']; ?></th>
<th width="25%"><?php echo $lang['Value']; ?></th>
</tr>
<tr>
<td class="row1" nowrap="nowrap"><?php echo $lang['Number_posts']; ?>:</td>
<td class="row2"><b><?php echo $total_posts; ?></b></td>
<td class="row1" nowrap="nowrap"><?php echo $lang['Posts_per_day']; ?>:</td>
<td class="row2"><b><?php echo $posts_per_day; ?></b></td>
</tr>
<tr>
<td class="row1" nowrap="nowrap"><?php echo $lang['Number_topics']; ?>:</td>
<td class="row2"><b><?php echo $total_topics; ?></b></td>
<td class="row1" nowrap="nowrap"><?php echo $lang['Topics_per_day']; ?>:</td>
<td class="row2"><b><?php echo $topics_per_day; ?></b></td>
</tr>
<tr>
<td class="row1" nowrap="nowrap"><?php echo $lang['Number_users']; ?>:</td>
<td class="row2"><b><?php echo $total_users; ?></b></td>
<td class="row1" nowrap="nowrap"><?php echo $lang['Users_per_day']; ?>:</td>
<td class="row2"><b><?php echo $users_per_day; ?></b></td>
</tr>
<tr>
<td class="row1" nowrap="nowrap"><?php echo $lang['Board_started']; ?>:</td>
<td class="row2"><b><?php echo $start_date; ?></b></td>
<td class="row1" nowrap="nowrap"><?php echo $lang['Avatar_dir_size']; ?>:</td>
<td class="row2"><b><?php echo $avatar_dir_size; ?></b></td>
</tr>
<tr>
<td class="row1" nowrap="nowrap"><?php echo $lang['Database_size']; ?>:</td>
<td class="row2"><b><?php echo $dbsize; ?></b></td>
<td class="row1" nowrap="nowrap"><?php echo $lang['Gzip_compression']; ?>:</td>
<td class="row2"><b><?php echo ( $board_config['gzip_compress'] ) ? $lang['ON'] : $lang['OFF']; ?></b></td>
</tr>
</table>
<h1><?php echo $lang['Admin_log']; ?></h1>
<p><?php echo $lang['Admin_log_index_explain']; ?></p>
<table class="bg" width="100%" cellpadding="4" cellspacing="1" border="0">
<tr>
<th width="15%" height="25" nowrap="nowrap"><?php echo $lang['Username']; ?></th>
<th width="15%"><?php echo $lang['IP']; ?></th>
<th width="20%"><?php echo $lang['Time']; ?></th>
<th width="45%" nowrap="nowrap"><?php echo $lang['Action']; ?></th>
</tr>
<?php
$log_data = view_admin_log(5);
for($i = 0; $i < sizeof($log_data); $i++)
{
$dbsize = sprintf('%.2f KB', ( $dbsize / 1024 ));
$cell_bg = ( $cell_bg == 'row1' ) ? 'row2' : 'row1';
?>
<tr>
<td class="<?php echo $cell_bg; ?>"><?php echo $log_data[$i]['username']; ?></td>
<td class="<?php echo $cell_bg; ?>" align="center"><?php echo $log_data[$i]['ip']; ?></td>
<td class="<?php echo $cell_bg; ?>" align="center"><?php echo create_date($board_config['default_dateformat'], $log_data[$i]['time'], $board_config['board_timezone']); ?></td>
<td class="<?php echo $cell_bg; ?>"><?php echo $log_data[$i]['action']; ?></td>
</tr>
<?php
}
?>
</table>
<h1><?php echo $lang['Inactive_users']; ?></h1>
<p><?php echo $lang['Inactive_users_explain']; ?></p>
<form method="post" name="inactive" action="<?php echo "index.$phpEx$SID&amp;pane=right"; ?>"><table class="bg" width="100%" cellpadding="4" cellspacing="1" border="0">
<tr>
<th width="45%" height="25" nowrap="nowrap"><?php echo $lang['Username']; ?></th>
<th width="45%"><?php echo $lang['Joined']; ?></th>
<th width="5%" nowrap="nowrap"><?php echo $lang['Mark']; ?></th>
</tr>
<?php
$sql = "SELECT user_id, username, user_regdate
FROM " . USERS_TABLE . "
WHERE user_active = 0
ORDER BY user_regdate ASC";
$result = $db->sql_query($sql);
if ( $row = $db->sql_fetchrow($result) )
{
do
{
$cell_bg = ( $cell_bg == 'row1' ) ? 'row2' : 'row1';
?>
<tr>
<td class="<?php echo $cell_bg; ?>"><a href="<?php echo 'admin_users.' . $phpEx . $SID . '&amp;u=' . $row['user_id']; ?>"><?php echo $row['username']; ?></a></td>
<td class="<?php echo $cell_bg; ?>"><?php echo create_date($board_config['default_dateformat'], $row['user_regdate'], $board_config['board_timezone']); ?></td>
<td class="<?php echo $cell_bg; ?>">&nbsp;<input type="checkbox" name="mark[]" value="<?php echo $row['user_id']; ?>" />&nbsp;</td>
</tr>
<?php
}
while ( $row = $db->sql_fetchrow($result) );
?>
<tr>
<td class="cat" colspan="3" height="28" align="right"><input class="liteoption" type="submit" name="activate" value="Activate" />&nbsp; <input class="liteoption" type="submit" name="remind" value="Remind" />&nbsp; <input class="liteoption" type="submit" name="delete" value="Delete" />&nbsp;</td>
</tr>
<?php
}
else
{
$dbsize = sprintf('%.2f Bytes', $dbsize);
}
?>
<tr>
<td class="row1" colspan="3" align="center"><?php echo $lang['No_inactive_users']; ?></td>
</tr>
<?php
}
$template->assign_vars(array(
'NUMBER_OF_POSTS' => $total_posts,
'NUMBER_OF_TOPICS' => $total_topics,
'NUMBER_OF_USERS' => $total_users,
'START_DATE' => $start_date,
'POSTS_PER_DAY' => $posts_per_day,
'TOPICS_PER_DAY' => $topics_per_day,
'USERS_PER_DAY' => $users_per_day,
'AVATAR_DIR_SIZE' => $avatar_dir_size,
'DB_SIZE' => $dbsize,
'GZIP_COMPRESSION' => ( $board_config['gzip_compress'] ) ? $lang['ON'] : $lang['OFF'])
);
?>
</table>
<table width="100%" cellspacing="1" cellpadding="4" border="0" align="center">
<tr>
<td align="right" valign="top" nowrap="nowrap"><b><span class="gensmall"><a href="javascript:marklist(true);" class="gensmall"><?php echo $lang['Mark_all']; ?></a> :: <a href="javascript:marklist(false);" class="gensmall"><?php echo $lang['Unmark_all']; ?></a></span></b></td>
</tr>
</table></form>
</td>
</tr>
</table>
<script language="Javascript" type="text/javascript">
//
// End forum statistics
// Should really check the browser to stop this whining ...
//
//
// Get users online information.
//
$sql = "SELECT u.user_id, u.username, u.user_session_time, u.user_session_page, s.session_ip, s.session_start
FROM " . USERS_TABLE . " u, " . SESSIONS_TABLE . " s
WHERE s.session_logged_in = " . TRUE . "
AND u.user_id = s.session_user_id
AND u.user_id <> " . ANONYMOUS . "
AND u.user_session_time >= " . ( time() - 300 ) . "
ORDER BY u.user_session_time DESC";
if(!$result = $db->sql_query($sql))
function marklist(status)
{
message_die(GENERAL_ERROR, "Couldn't obtain regd user/online information.", "", __LINE__, __FILE__, $sql);
}
$onlinerow_reg = $db->sql_fetchrowset($result);
$sql = "SELECT session_page, session_time, session_ip, session_start
FROM " . SESSIONS_TABLE . "
WHERE session_logged_in = 0
AND session_time >= " . ( time() - 300 ) . "
ORDER BY session_time DESC";
if(!$result = $db->sql_query($sql))
for (i = 0; i < document.inactive.length; i++)
{
message_die(GENERAL_ERROR, "Couldn't obtain guest user/online information.", "", __LINE__, __FILE__, $sql);
}
$onlinerow_guest = $db->sql_fetchrowset($result);
$sql = "SELECT forum_name, forum_id
FROM " . FORUMS_TABLE;
if($forums_result = $db->sql_query($sql))
{
while($forumsrow = $db->sql_fetchrow($forums_result))
{
$forum_data[$forumsrow['forum_id']] = $forumsrow['forum_name'];
document.inactive.elements[i].checked = status;
}
}
else
{
message_die(GENERAL_ERROR, "Couldn't obtain user/online forums information.", "", __LINE__, __FILE__, $sql);
}
</script>
$reg_userid_ary = array();
<?php
if( count($onlinerow_reg) )
{
$registered_users = 0;
for($i = 0; $i < count($onlinerow_reg); $i++)
{
if( !inarray($onlinerow_reg[$i]['user_id'], $reg_userid_ary) )
{
$reg_userid_ary[] = $onlinerow_reg[$i]['user_id'];
$username = $onlinerow_reg[$i]['username'];
if( $onlinerow_reg[$i]['user_allow_viewonline'] || $userdata['user_level'] == ADMIN )
{
$registered_users++;
$hidden = FALSE;
}
else
{
$hidden_users++;
$hidden = TRUE;
}
if( $onlinerow_reg[$i]['user_session_page'] < 1 )
{
switch($onlinerow_reg[$i]['user_session_page'])
{
case PAGE_INDEX:
$location = $lang['Forum_index'];
$location_url = "index.$phpEx?pane=right";
break;
case PAGE_POSTING:
$location = $lang['Posting_message'];
$location_url = "index.$phpEx?pane=right";
break;
case PAGE_LOGIN:
$location = $lang['Logging_on'];
$location_url = "index.$phpEx?pane=right";
break;
case PAGE_SEARCH:
$location = $lang['Searching_forums'];
$location_url = "index.$phpEx?pane=right";
break;
case PAGE_PROFILE:
$location = $lang['Viewing_profile'];
$location_url = "index.$phpEx?pane=right";
break;
case PAGE_VIEWONLINE:
$location = $lang['Viewing_online'];
$location_url = "index.$phpEx?pane=right";
break;
case PAGE_VIEWMEMBERS:
$location = $lang['Viewing_member_list'];
$location_url = "index.$phpEx?pane=right";
break;
case PAGE_PRIVMSGS:
$location = $lang['Viewing_priv_msgs'];
$location_url = "index.$phpEx?pane=right";
break;
case PAGE_FAQ:
$location = $lang['Viewing_FAQ'];
$location_url = "index.$phpEx?pane=right";
break;
default:
$location = $lang['Forum_index'];
$location_url = "index.$phpEx?pane=right";
}
}
else
{
$location_url = append_sid("admin_forums.$phpEx?mode=editforum&amp;" . POST_FORUM_URL . "=" . $onlinerow_reg[$i]['user_session_page']);
$location = $forum_data[$onlinerow_reg[$i]['user_session_page']];
}
$row_color = ( $registered_users % 2 ) ? $theme['td_color1'] : $theme['td_color2'];
$row_class = ( $registered_users % 2 ) ? $theme['td_class1'] : $theme['td_class2'];
$reg_ip = $onlinerow_reg[$i]['session_ip'];
$template->assign_block_vars("reg_user_row", array(
'ROW_COLOR' => "#" . $row_color,
'ROW_CLASS' => $row_class,
'USERNAME' => $username,
'STARTED' => create_date($board_config['default_dateformat'], $onlinerow_reg[$i]['session_start'], $board_config['board_timezone']),
'LASTUPDATE' => create_date($board_config['default_dateformat'], $onlinerow_reg[$i]['user_session_time'], $board_config['board_timezone']),
'FORUM_LOCATION' => $location,
'IP_ADDRESS' => $reg_ip,
'U_WHOIS_IP' => "http://www.samspade.org/t/ipwhois?a=$reg_ip",
'U_USER_PROFILE' => append_sid("admin_users.$phpEx?mode=edit&amp;" . POST_USERS_URL . "=" . $onlinerow_reg[$i]['user_id']),
'U_FORUM_LOCATION' => append_sid($location_url))
);
}
}
}
else
{
$template->assign_vars(array(
"L_NO_REGISTERED_USERS_BROWSING" => $lang['No_users_browsing'])
);
}
//
// Guest users
//
if( count($onlinerow_guest) )
{
$guest_users = 0;
for($i = 0; $i < count($onlinerow_guest); $i++)
{
$guest_userip_ary[] = $onlinerow_guest[$i]['session_ip'];
$guest_users++;
if( $onlinerow_guest[$i]['session_page'] < 1 )
{
switch( $onlinerow_guest[$i]['session_page'] )
{
case PAGE_INDEX:
$location = $lang['Forum_index'];
$location_url = "index.$phpEx?pane=right";
break;
case PAGE_POSTING:
$location = $lang['Posting_message'];
$location_url = "index.$phpEx?pane=right";
break;
case PAGE_LOGIN:
$location = $lang['Logging_on'];
$location_url = "index.$phpEx?pane=right";
break;
case PAGE_SEARCH:
$location = $lang['Searching_forums'];
$location_url = "index.$phpEx?pane=right";
break;
case PAGE_PROFILE:
$location = $lang['Viewing_profile'];
$location_url = "index.$phpEx?pane=right";
break;
case PAGE_VIEWONLINE:
$location = $lang['Viewing_online'];
$location_url = "index.$phpEx?pane=right";
break;
case PAGE_VIEWMEMBERS:
$location = $lang['Viewing_member_list'];
$location_url = "index.$phpEx?pane=right";
break;
case PAGE_PRIVMSGS:
$location = $lang['Viewing_priv_msgs'];
$location_url = "index.$phpEx?pane=right";
break;
case PAGE_FAQ:
$location = $lang['Viewing_FAQ'];
$location_url = "index.$phpEx?pane=right";
break;
default:
$location = $lang['Forum_index'];
$location_url = "index.$phpEx?pane=right";
}
}
else
{
$location_url = append_sid("admin_forums.$phpEx?mode=editforum&amp;" . POST_FORUM_URL . "=" . $onlinerow_guest[$i]['session_page']);
$location = $forum_data[$onlinerow_guest[$i]['session_page']];
}
$row_color = ( $guest_users % 2 ) ? $theme['td_color1'] : $theme['td_color2'];
$row_class = ( $guest_users % 2 ) ? $theme['td_class1'] : $theme['td_class2'];
$guest_ip = $onlinerow_guest[$i]['session_ip'];
$template->assign_block_vars('guest_user_row', array(
'ROW_COLOR' => "#" . $row_color,
'ROW_CLASS' => $row_class,
'USERNAME' => $lang['Guest'],
'STARTED' => create_date($board_config['default_dateformat'], $onlinerow_guest[$i]['session_start'], $board_config['board_timezone']),
'LASTUPDATE' => create_date($board_config['default_dateformat'], $onlinerow_guest[$i]['session_time'], $board_config['board_timezone']),
'FORUM_LOCATION' => $location,
'IP_ADDRESS' => $guest_ip,
'U_WHOIS_IP' => "http://www.samspade.org/t/ipwhois?a=$guest_ip",
'U_FORUM_LOCATION' => append_sid($location_url))
);
}
}
else
{
$template->assign_vars(array(
'L_NO_GUESTS_BROWSING' => $lang['No_users_browsing'])
);
}
$template->pparse('body');
include('page_footer_admin.'.$phpEx);
page_footer();
}
else
{
$update = false;
require('pagestart.' . $phpEx);
//
// Generate frameset
// Output the frameset ...
//
$template->set_filenames(array(
"body" => "admin/index_frameset.tpl")
);
header("Expires: " . gmdate("D, d M Y H:i:s", time()) . " GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Content-type: text/html; charset=" . $lang['ENCODING']);
$template->assign_vars(array(
'S_FRAME_NAV' => "index.$phpEx$SID&amp;pane=left",
'S_FRAME_MAIN' => "index.$phpEx$SID&amp;pane=right")
);
?>
<html>
<head>
<title><?php echo $lang['Admin_title']; ?></title>
</head>
header ('Expires: ' . gmdate("D, d M Y H:i:s", time()) . ' GMT');
header ('Last-Modified: ' . gmdate("D, d M Y H:i:s") . ' GMT');
<frameset rows="60, *" border="0" framespacing="0" frameborder="NO">
<frame src="<?php echo "index.$phpEx$SID&amp;pane=top"; ?>" name="title" noresize marginwidth="0" marginheight="0" scrolling="NO">
<frameset cols="155,*" rows="*" border="2" framespacing="0" frameborder="yes">
<frame src="<?php echo "index.$phpEx$SID&amp;pane=left"; ?>" name="nav" marginwidth="3" marginheight="3" scrolling="yes">
<frame src="<?php echo "index.$phpEx$SID&amp;pane=right"; ?>" name="main" marginwidth="0" marginheight="0" scrolling="auto">
</frameset>
</frameset>
<noframes>
<body bgcolor="white" text="#000000">
<p><?php echo $lang['No_frames']; ?></p>
</body>
</noframes>
</html>
<?php
$template->pparse("body");
exit;
}

View file

@ -8,7 +8,6 @@
*
* $Id$
*
*
***************************************************************************/
/***************************************************************************
@ -22,22 +21,23 @@
if ( !defined('IN_PHPBB') )
{
die("Hacking attempt");
die('Hacking attempt');
}
//
// Show the overall footer.
//
$template->set_filenames(array(
'page_footer' => 'admin/page_footer.tpl')
);
if ( !$ignore_copyright )
{
$template->assign_vars(array(
'PHPBB_VERSION' => '2' . $board_config['version'],
'TRANSLATION_INFO' => $lang['TRANSLATION_INFO'])
);
?>
$template->pparse('page_footer');
<div align="center"><span class="copyright">Powered by phpBB <?php echo $board_config['version']; ?> &copy; 2002 <a href="http://www.phpbb.com/" target="_phpbb" class="copyright">phpBB Group</a></span></div>
<br clear="all" />
</body>
</html>
<?php
}
//
// Close our DB connection.
@ -48,7 +48,7 @@ $db->sql_close();
// Compress buffered output if required
// and send to browser
//
if( $do_gzip_compress )
if ( $do_gzip_compress )
{
//
// Borrowed from php.net!
@ -62,10 +62,10 @@ if( $do_gzip_compress )
$gzip_contents = gzcompress($gzip_contents, 9);
$gzip_contents = substr($gzip_contents, 0, strlen($gzip_contents) - 4);
echo '\x1f\x8b\x08\x00\x00\x00\x00\x00';
echo "\x1f\x8b\x08\x00\x00\x00\x00\x00";
echo $gzip_contents;
echo pack('V', $gzip_crc);
echo pack('V', $gzip_size);
echo pack("V", $gzip_crc);
echo pack("V", $gzip_size);
}
exit;

View file

@ -22,7 +22,7 @@
if ( !defined('IN_PHPBB') )
{
die("Hacking attempt");
die('Hacking attempt');
}
define('HEADER_INC', true);
@ -31,124 +31,57 @@ define('HEADER_INC', true);
// gzip_compression
//
$do_gzip_compress = FALSE;
if($board_config['gzip_compress'])
if ( $board_config['gzip_compress'] )
{
$phpver = phpversion();
if($phpver >= '4.0.4pl1')
if ( $phpver >= '4.0.4pl1' && strstr($HTTP_USER_AGENT,'compatible') )
{
if(extension_loaded('zlib'))
if ( extension_loaded('zlib') )
{
ob_start('ob_gzhandler');
}
}
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;
ob_start();
ob_implicit_flush(0);
header('Content-Encoding: gzip');
header("Content-Encoding: gzip");
}
}
}
}
$template->set_filenames(array(
'header' => 'admin/page_header.tpl')
);
//
// The following assigns all _common_ variables that may be used at any point
// in a template. Note that all URL's should be wrapped in append_sid, as
// should all S_x_ACTIONS for forms.
//
$template->assign_vars(array(
'SITENAME' => $board_config['sitename'],
'PAGE_TITLE' => $page_title,
'L_ADMIN' => $lang['Admin'],
'L_USERNAME' => $lang['Username'],
'L_PASSWORD' => $lang['Password'],
'L_INDEX' => $lang['Forum_Index'],
'L_REGISTER' => $lang['Register'],
'L_PROFILE' => $lang['Profile'],
'L_SEARCH' => $lang['Search'],
'L_PRIVATEMSGS' => $lang['Private_msgs'],
'L_MEMBERLIST' => $lang['Memberlist'],
'L_FAQ' => $lang['FAQ'],
'L_USERGROUPS' => $lang['Usergroups'],
'L_FORUM' => $lang['Forum'],
'L_TOPICS' => $lang['Topics'],
'L_REPLIES' => $lang['Replies'],
'L_VIEWS' => $lang['Views'],
'L_POSTS' => $lang['Posts'],
'L_LASTPOST' => $lang['Last_Post'],
'L_MODERATOR' => $lang['Moderator'],
'L_NONEWPOSTS' => $lang['No_new_posts'],
'L_NEWPOSTS' => $lang['New_posts'],
'L_POSTED' => $lang['Posted'],
'L_JOINED' => $lang['Joined'],
'L_AUTHOR' => $lang['Author'],
'L_MESSAGE' => $lang['Message'],
'L_BY' => $lang['by'],
'U_INDEX' => append_sid('../index.'.$phpEx),
'S_TIMEZONE' => sprintf($lang['All_times'], $lang[$board_config['board_timezone']]),
'S_LOGIN_ACTION' => append_sid('../login.'.$phpEx),
'S_JUMPBOX_ACTION' => append_sid('../viewforum.'.$phpEx),
'S_CURRENT_TIME' => sprintf($lang['Current_time'], create_date($board_config['default_dateformat'], time(), $board_config['board_timezone'])),
'S_CONTENT_DIRECTION' => $lang['DIRECTION'],
'S_CONTENT_ENCODING' => $lang['ENCODING'],
'S_CONTENT_DIR_LEFT' => $lang['LEFT'],
'S_CONTENT_DIR_RIGHT' => $lang['RIGHT'],
'T_HEAD_STYLESHEET' => $theme['head_stylesheet'],
'T_BODY_BACKGROUND' => $theme['body_background'],
'T_BODY_BGCOLOR' => '#'.$theme['body_bgcolor'],
'T_BODY_TEXT' => '#'.$theme['body_text'],
'T_BODY_LINK' => '#'.$theme['body_link'],
'T_BODY_VLINK' => '#'.$theme['body_vlink'],
'T_BODY_ALINK' => '#'.$theme['body_alink'],
'T_BODY_HLINK' => '#'.$theme['body_hlink'],
'T_TR_COLOR1' => '#'.$theme['tr_color1'],
'T_TR_COLOR2' => '#'.$theme['tr_color2'],
'T_TR_COLOR3' => '#'.$theme['tr_color3'],
'T_TR_CLASS1' => $theme['tr_class1'],
'T_TR_CLASS2' => $theme['tr_class2'],
'T_TR_CLASS3' => $theme['tr_class3'],
'T_TH_COLOR1' => '#'.$theme['th_color1'],
'T_TH_COLOR2' => '#'.$theme['th_color2'],
'T_TH_COLOR3' => '#'.$theme['th_color3'],
'T_TH_CLASS1' => $theme['th_class1'],
'T_TH_CLASS2' => $theme['th_class2'],
'T_TH_CLASS3' => $theme['th_class3'],
'T_TD_COLOR1' => '#'.$theme['td_color1'],
'T_TD_COLOR2' => '#'.$theme['td_color2'],
'T_TD_COLOR3' => '#'.$theme['td_color3'],
'T_TD_CLASS1' => $theme['td_class1'],
'T_TD_CLASS2' => $theme['td_class2'],
'T_TD_CLASS3' => $theme['td_class3'],
'T_FONTFACE1' => $theme['fontface1'],
'T_FONTFACE2' => $theme['fontface2'],
'T_FONTFACE3' => $theme['fontface3'],
'T_FONTSIZE1' => $theme['fontsize1'],
'T_FONTSIZE2' => $theme['fontsize2'],
'T_FONTSIZE3' => $theme['fontsize3'],
'T_FONTCOLOR1' => '#'.$theme['fontcolor1'],
'T_FONTCOLOR2' => '#'.$theme['fontcolor2'],
'T_FONTCOLOR3' => '#'.$theme['fontcolor3'],
'T_SPAN_CLASS1' => $theme['span_class1'],
'T_SPAN_CLASS2' => $theme['span_class2'],
'T_SPAN_CLASS3' => $theme['span_class3'])
);
$template->pparse('header');
header("Content-type: text/html; charset=" . $lang['ENCODING']);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<link rel="stylesheet" href="subSilver.css" type="text/css">
<?php
echo $meta;
?>
<style type="text/css">
<!--
th { background-image: url('images/cellpic3.gif') }
td.cat { background-image: url('images/cellpic1.gif') }
//-->
</style>
<title><?php echo $board_config['sitename'] . ' - ' . $page_title; ?></title>
</head>
<body>
<a name="top"></a>
<?php
?>

View file

@ -8,7 +8,6 @@
*
* $Id$
*
*
***************************************************************************/
/***************************************************************************
@ -22,35 +21,160 @@
if ( !defined('IN_PHPBB') )
{
die("Hacking attempt");
die('Hacking attempt');
}
define('IN_ADMIN', true);
include($phpbb_root_path . 'common.'.$phpEx);
//
// Start session management
//
$userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata);
$userdata = $session->start($update);
$acl = new auth('admin', $userdata);
//
// End session management
//
if( !$userdata['session_logged_in'] )
{
header("Location: ../" . append_sid("login.$phpEx?redirect=admin/"));
}
else if( $userdata['user_level'] != ADMIN )
{
message_die(GENERAL_MESSAGE, $lang['Not_admin']);
}
if ( empty($no_page_header) )
//
// Configure style, language, etc.
//
$session->configure($userdata);
// -----------------------------
// Functions
//
function page_header($sub_title)
{
// Not including the pageheader can be neccesarry if META tags are
// needed in the calling script.
global $db, $lang, $phpEx;
include('page_header_admin.'.$phpEx);
}
?>
<table width="100%" cellspacing="0" cellpadding="0" border="0">
<tr>
<td colspan="2" height="25" align="right" nowrap="nowrap"><span class="subtitle">&#0187; <i><?php echo $sub_title; ?></i></span> &nbsp;&nbsp;</td>
</tr>
</table>
<table width="95%" cellspacing="0" cellpadding="0" border="0" align="center">
<tr>
<td><br clear="all" />
<?php
}
function page_footer($ignore_copyright = false)
{
global $db, $lang, $phpEx;
?>
</td>
</tr>
</table>
<?php
include('page_footer_admin.'.$phpEx);
}
function page_message($title, $message)
{
global $lang;
?>
<table width="100%" cellspacing="0" cellpadding="0" border="0">
<tr>
<td><a href="../"><img src="images/header_left.jpg" width="200" height="60" alt="phpBB Logo" title="phpBB Logo" border="0"/></a></td>
<td width="100%" background="images/header_bg.jpg" height="60" align="right" nowrap="nowrap"><span class="maintitle"><?php echo $lang['Admin_title']; ?></span> &nbsp; &nbsp; &nbsp;</td>
</tr>
</table>
<br /><br />
<table class="bg" width="80%" cellpadding="4" cellspacing="1" border="0" align="center">
<tr>
<th><?php echo $title; ?></th>
</tr>
<tr>
<td class="row1" align="center"><?php echo $message; ?></td>
</tr>
</table>
<br />
<?php
}
function add_admin_log()
{
global $db, $userdata, $user_ip;
$arguments = func_get_args();
$action = array_shift($arguments);
$data = ( !sizeof($arguments) ) ? '' : serialize($arguments);
$sql = "INSERT INTO " . LOG_ADMIN_TABLE . " (user_id, log_ip, log_time, log_operation, log_data)
VALUES (" . $userdata['user_id'] . ", '$user_ip', " . time() . ", '$action', '$data')";
$db->sql_query($sql);
return;
}
function view_admin_log($limit = 0, $offset = 0, $limit_days = 0, $sort_by = 'l.log_time DESC')
{
global $db, $lang, $phpEx, $SID;
$limit_sql = ( $limit ) ? ( ( $offset ) ? "LIMIT $offset, $limit" : "LIMIT $limit" ) : '';
$sql = "SELECT l.log_id, l.user_id, l.log_ip, l.log_time, l.log_operation, l.log_data, u.username
FROM " . LOG_ADMIN_TABLE . " l, " . USERS_TABLE . " u
WHERE u.user_id = l.user_id
AND l.log_time >= $limit_days
ORDER BY $sort_by
$limit_sql";
$result = $db->sql_query($sql);
$admin_log = array();
if ( $row = $db->sql_fetchrow($result) )
{
$i = 0;
do
{
$admin_log[$i]['id'] = $row['log_id'];
$admin_log[$i]['username'] = '<a href="admin_users.'.$phpEx . $SID . '&amp;u=' . $row['user_id'] . '">' . $row['username'] . '</a>';
$admin_log[$i]['ip'] = $row['log_ip'];
$admin_log[$i]['time'] = $row['log_time'];
$admin_log[$i]['action'] = ( !empty($lang[$row['log_operation']]) ) ? $lang[$row['log_operation']] : ucfirst(str_replace('_', ' ', $row['log_operation']));
if ( !empty($row['log_data']) )
{
$log_data_ary = unserialize($row['log_data']);
foreach ( $log_data_ary as $log_data )
{
$admin_log[$i]['action'] = preg_replace('#%s#', $log_data, $admin_log[$i]['action'], 1);
}
}
$i++;
}
while ( $row = $db->sql_fetchrow($result) );
}
$db->sql_freeresult($result);
return $admin_log;
}
//
// End Functions
// -----------------------------
?>

View file

@ -198,4 +198,4 @@ input.liteoption {
}
/* Import the fancy styles for IE only (NS4.x doesn't use the @import function) */
@import url("formIE.css");
@import url("forms.css");