diff --git a/phpBB/admin/admin_board.php b/phpBB/admin/admin_board.php index 56ddc946d7..ec5d4aeed1 100644 --- a/phpBB/admin/admin_board.php +++ b/phpBB/admin/admin_board.php @@ -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']) ) { - $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']) ) - { - $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'] . "

" . sprintf($lang['Click_return_config'], "", "") . "

" . sprintf($lang['Click_return_admin_index'], "", ""); - - message_die(GENERAL_MESSAGE, $message); + $sql = "UPDATE " . CONFIG_TABLE . " SET + config_value = '" . str_replace("\'", "''", $new[$config_name]) . "' + WHERE config_name = '$config_name'"; + $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'] . "

" . sprintf($lang['Click_return_config'], '', '') . '

' . sprintf($lang['Click_return_admin_index'], '', ''); + + 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('"', '"', $new['site_desc']); -$new['sitename'] = str_replace('"', '"', 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); -?> +?> \ No newline at end of file diff --git a/phpBB/admin/admin_db_utilities.php b/phpBB/admin/admin_db_utilities.php index 00762f567c..e1599fb272 100644 --- a/phpBB/admin/admin_db_utilities.php +++ b/phpBB/admin/admin_db_utilities.php @@ -30,21 +30,20 @@ define('IN_PHPBB', 1); -if( !empty($setmodules) ) +if ( !empty($setmodules) ) { - $filename = basename(__FILE__); - $module['General']['Backup_DB'] = $filename . "?perform=backup"; - if(@phpversion() >= '4.0.0') - { - $file_uploads = @ini_get('file_uploads'); - } - else + if ( !$acl->get_acl_admin('general') ) { - $file_uploads = @get_cfg_var('file_uploads'); + return; } + + $filename = basename(__FILE__); + $module['DB']['DB_Backup'] = $filename . "?perform=backup"; + + $file_uploads = @ini_get('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 = ''; + + page_header($lang['DB']); +?> + +

+ +

+ +
"> + + + + + + + + + + + + + + + + + + + + + + + + + + +
 
+ +assign_vars(array( + "META" => "", + + "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 = ''; + + page_header($lang['DB']); + +?> + +

+ +

+ +
"> + + + + + + +
    
+ += "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
"; + 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; + } +} + +?> + + + + + +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 = ""; - - $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" => "", - - "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 = ""; - - $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
"; - 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); - -?> +?> \ No newline at end of file diff --git a/phpBB/admin/admin_email.php b/phpBB/admin/admin_email.php new file mode 100644 index 0000000000..7faec69d40 --- /dev/null +++ b/phpBB/admin/admin_email.php @@ -0,0 +1,193 @@ +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'] . '

' . sprintf($lang['Click_return_admin_index'], '', ''); + + message_die(MESSAGE, $message); + } +} + +// +// Initial selection +// + +$sql = "SELECT group_id, group_name + FROM ".GROUPS_TABLE; +$result = $db->sql_query($sql); + +$select_list = ''; + +page_header($lang['Users']); + +?> + +

+ +

+ +
"> + + + + + + + + + + + + + + + + + +
+
+ + \ No newline at end of file diff --git a/phpBB/admin/admin_permissions.php b/phpBB/admin/admin_permissions.php index 7dfa0b597e..0c90f8aa34 100644 --- a/phpBB/admin/admin_permissions.php +++ b/phpBB/admin/admin_permissions.php @@ -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 . '&mode=forums'; - $module['General']['Set_Administrators'] = $filename . $SID . '&mode=admins'; + $module['Forums']['Moderators'] = $filename . $SID . '&mode=moderators'; + $module['General']['Administrators'] = $filename . $SID . '&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_list .= ''; + + // + // Generate header + // + page_header($lang['Forums']); + +?> + +

+ +

+ + + +
"> + +

+ + + +

[ ]

+ +

+ + + +

[ ]

+ +

+ + + +

[ ]

+ +

+ + + +

[ ]

+ +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']] .= ''; + } + + $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']] .= ''; + } + +?> + + + + + + + + + + + + + + + +
SettingUsersGroups
+ +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']] .= ''; + } + + $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']] .= ''; + } + +?> + + + + + + + + + + + + + + + +
SettingUsersGroups
  
+ + +
+ + -

+

-

+

-
"> +">
- +
        
diff --git a/phpBB/admin/admin_prune.php b/phpBB/admin/admin_prune.php new file mode 100644 index 0000000000..1660749a1f --- /dev/null +++ b/phpBB/admin/admin_prune.php @@ -0,0 +1,200 @@ +get_acl_admin('forum') ) + { + return; + } + + $filename = basename(__FILE__); + $module['Forums']['Prune'] = $filename . $SID . '&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 .= ''; + for($i = 0; $i < count($forum_rows); $i++) + { + $select_list .= ''; + } + +?> + +

+ +

+ +
"> + + + + + + +
    
+ + ' . $lang['Days']; + + $s_hidden_fields = ''; + +?> + +

+ +

+ +

+ +
"> + + + + + + + + + +
+ + \ No newline at end of file diff --git a/phpBB/admin/admin_search.php b/phpBB/admin/admin_search.php index 6075fe0c2d..6372bcc79c 100644 --- a/phpBB/admin/admin_search.php +++ b/phpBB/admin/admin_search.php @@ -1,6 +1,6 @@ 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 "\n\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)) ) - { - $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); + $result = $db->sql_query($sql); - if( $post_rows ) + if ( $row = $db->sql_fetchrow($result) ) { + do + { - // $sql = "LOCK TABLES ".POST_TEXT_TABLE." WRITE"; - // $result = $db->sql_query($sql); - print "\n

\nRestart from posting $batchstart
\n"; +// print "\n

\nRestart from posting $batchstart
\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 "
Removing common words (words that appear in more than $common_percent of the posts)
\n"; - flush(); - print "Removed ". remove_common("global", $common_percent) ." words that where too common.
"; +// print "
Removing common words (words that appear in more than $common_percent of the posts)
\n"; +// flush(); +// print "Removed ". remove_common("global", $common_percent) ." words that where too common.
"; } } echo "
Done"; + exit; } else if ( isset($HTTP_POST_VARS['cancel']) ) diff --git a/phpBB/admin/admin_styles.php b/phpBB/admin/admin_styles.php index 718726a5a5..af319680c3 100644 --- a/phpBB/admin/admin_styles.php +++ b/phpBB/admin/admin_styles.php @@ -1,937 +1,259 @@ get_acl_admin('styles') ) + { + return; + } + + $filename = basename(__FILE__); + $module['Styles']['Edit_Styles'] = $filename . "$SID&mode=newstyle"; + $module['Styles']['Edit_Templates'] = $filename . "$SID&mode=edittemplate"; + $module['Styles']['Edit_Themes'] = $filename . "$SID&mode=newstyle"; + $module['Styles']['Edit_Imagesets'] = $filename . "$SID&mode=editimageset"; + return; } +define('IN_PHPBB', 1); // -// Load default header +// Include files // -// -// Check if the user has cancled a confirmation message. -// -$phpbb_root_path = "../"; +$phpbb_root_path = '../'; +require($phpbb_root_path . 'extension.inc'); +require('pagestart.' . $phpEx); -$confirm = ( isset($HTTP_POST_VARS['confirm']) ) ? TRUE : FALSE; -$cancel = ( isset($HTTP_POST_VARS['cancel']) ) ? TRUE : FALSE; - -if( empty($HTTP_POST_VARS['send_file']) ) +// +// Do we have styles admin permissions? +// +if ( !$acl->get_acl_admin('styles') ) { - $no_page_header = ( $cancel ) ? TRUE : FALSE; - require($phpbb_root_path . 'extension.inc'); - require('pagestart.' . $phpEx); + message_die(MESSAGE, $lang['No_admin']); } -if( $cancel ) +/* +$dp = opendir($phpbb_root_path . 'templates/cache/'); +while ( $file = readdir($dp) ) { - header("Location: " . append_sid("admin_styles.$phpEx")); + if ( !is_file($phpbb_root_path . 'templates/cache/' . $file) && !is_link($phpbb_root_path . 'templates/cache/' . $file) && $file != '.' && $file != '..' ) + { + $selected = ( $tplroot == $file ) ? ' selected="selected"' : ''; + $tplroot_options .= ''; + } } +closedir($dp); +*/ -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 -{ - $mode = ""; -} +// +// +// +$mode = ( isset($HTTP_GET_VARS['mode']) ) ? $HTTP_GET_VARS['mode'] : $HTTP_POST_VARS['mode']; -switch( $mode ) +if ( $mode == 'editimageset' ) { - case "addnew": - $install_to = ( isset($HTTP_GET_VARS['install_to']) ) ? urldecode($HTTP_GET_VARS['install_to']) : $HTTP_POST_VARS['install_to']; - $style_name = ( isset($HTTP_GET_VARS['style']) ) ? urldecode($HTTP_GET_VARS['style']) : $HTTP_POST_VARS['style']; + $imgroot = ( isset($HTTP_POST_VARS['imgroot']) ) ? $HTTP_POST_VARS['imgroot'] : 'subSilver'; + + if ( isset($HTTP_POST_VARS['img_root']) ) + { + $sql = "SELECT * + FROM " . STYLES_IMAGE_TABLE . " + WHERE imageset_path LIKE '" . $HTTP_POST_VARS['imgroot'] . "'"; + $result = $db->sql_query($sql); + + $images = $db->sql_fetchrow($result); + } + if ( isset($HTTP_POST_VARS['img_addconfig']) ) + { + } + else if ( isset($HTTP_POST_VARS['img_addlocal']) ) + { + } + + $imageset = array('imageset_path', 'post_new', 'post_locked', 'post_pm', 'reply_new', 'reply_pm', 'reply_locked', 'icon_profile', 'icon_pm', 'icon_delete', 'icon_ip', 'icon_quote', 'icon_search', 'icon_edit', 'icon_email', 'icon_www', 'icon_icq', 'icon_aim', 'icon_yim', 'icon_msnm', 'icon_no_email', 'icon_no_www', 'icon_no_icq', 'icon_no_aim', 'icon_no_yim', 'icon_no_msnm', 'goto_post', 'goto_post_new', 'goto_post_latest', 'goto_post_newest', 'forum', 'forum_new', 'forum_locked', 'folder', 'folder_new', 'folder_hot', 'folder_hot_new', 'folder_locked', 'folder_locked_new', 'folder_sticky', 'folder_sticky_new', 'folder_announce', 'folder_announce_new', 'topic_watch', 'topic_unwatch', 'poll_left', 'poll_center', 'poll_right', 'rating'); + + $sql = "SELECT imageset_name, imageset_path + FROM " . STYLES_IMAGE_TABLE . " + ORDER BY imageset_name"; + $result = $db->sql_query($sql); + + $imgroot_options = ''; + while ( $row = $db->sql_fetchrow($result) ) + { + $selected = ( $imgroot == $row['imageset_path'] ) ? ' selected="selected"' : ''; + $imgroot_options .= ''; + } + + $imgname_options = ''; + $dp = opendir($phpbb_root_path . 'imagesets/' . $imgroot . '/'); + while ( $file = readdir($dp) ) + { + if ( preg_match('#\.(gif|png|jpg|jpeg)$#', $file) && is_file($phpbb_root_path . 'imagesets/' . $imgroot . '/' . $file) ) + { + $selected = ( $imgname == $file ) ? ' selected="selected"' : ''; + $imgname_options .= ''; + } + } + closedir($dp); + + // + // Output page + // + page_header($lang['Styles']); + + echo '

'; + + echo '

Edit Imageset

'; + + echo '

Template set:  

'; + + echo '

Use this panel to edit or remove imagesets from the database.

'; + + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; - if( isset($install_to) ) - { + for($i = 0; $i < count($imageset); $i++) + { + $class = ( !($i%2) ) ? 'row1' : 'row2'; - include($phpbb_root_path. "templates/" . $install_to . "/theme_info.cfg"); + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + } - $template_name = $$install_to; - $found = FALSE; - - for($i = 0; $i < count($template_name) && !$found; $i++) - { - if( $template_name[$i]['style_name'] == $style_name ) - { - while(list($key, $val) = each($template_name[$i])) - { - $db_fields[] = $key; - $db_values[] = str_replace("\'", "''" , $val); - } - } - } - - $sql = "INSERT INTO " . THEMES_TABLE . " ("; + echo ''; + echo ''; + echo '
Available images:
ImageSourceWidthHeightBorder 
' . ucfirst(str_replace('_', ' ', $imageset[$i])) . '  
   
'; + echo '
'; - for($i = 0; $i < count($db_fields); $i++) - { - $sql .= $db_fields[$i]; - if($i != (count($db_fields) - 1)) - { - $sql .= ", "; - } - - } - - $sql .= ") VALUES ("; - - for($i = 0; $i < count($db_values); $i++) - { - $sql .= "'" . $db_values[$i] . "'"; - if($i != (count($db_values) - 1)) - { - $sql .= ", "; - } - } - $sql .= ")"; - - if( !$result = $db->sql_query($sql) ) - { - message_die(GENERAL_ERROR, "Could not insert theme data!", "", __LINE__, __FILE__, $sql); - } - - $message = $lang['Theme_installed'] . "

" . sprintf($lang['Click_return_styleadmin'], "", "") . "

" . sprintf($lang['Click_return_admin_index'], "", ""); - - message_die(GENERAL_MESSAGE, $message); - } - else - { - - $installable_themes = array(); - - if( $dir = @opendir($phpbb_root_path. "templates/") ) - { - while( $sub_dir = @readdir($dir) ) - { - if( !is_file($phpbb_root_path . 'templates/' .$sub_dir) && !is_link($phpbb_root_path . 'templates/' .$sub_dir) && $sub_dir != "." && $sub_dir != ".." && $sub_dir != "CVS" ) - { - if( @file_exists($phpbb_root_path. "templates/" . $sub_dir . "/theme_info.cfg") ) - { - include($phpbb_root_path. "templates/" . $sub_dir . "/theme_info.cfg"); - - for($i = 0; $i < count($$sub_dir); $i++) - { - $working_data = $$sub_dir; - - $style_name = $working_data[$i]['style_name']; - - $sql = "SELECT themes_id - FROM " . THEMES_TABLE . " - WHERE style_name = '" . str_replace("\'", "''", $style_name) . "'"; - if(!$result = $db->sql_query($sql)) - { - message_die(GENERAL_ERROR, "Could not query themes table!", "", __LINE__, __FILE__, $sql); - } - - if(!$db->sql_numrows($result)) - { - $installable_themes[] = $working_data[$i]; - } - } - } - } - } - - $template->set_filenames(array( - "body" => "admin/styles_addnew_body.tpl") - ); - - $template->assign_vars(array( - "L_STYLES_TITLE" => $lang['Styles_admin'], - "L_STYLES_ADD_TEXT" => $lang['Styles_addnew_explain'], - "L_STYLE" => $lang['Style'], - "L_TEMPLATE" => $lang['Template'], - "L_INSTALL" => $lang['Install'], - "L_ACTION" => $lang['Action']) - ); - - for($i = 0; $i < count($installable_themes); $i++) - { - $row_color = ( !($i % 2) ) ? $theme['td_color1'] : $theme['td_color2']; - $row_class = ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2']; - - $template->assign_block_vars("styles", array( - "ROW_CLASS" => $row_class, - "ROW_COLOR" => "#" . $row_color, - "STYLE_NAME" => $installable_themes[$i]['style_name'], - "TEMPLATE_NAME" => $installable_themes[$i]['template_name'], - - "U_STYLES_INSTALL" => append_sid("admin_styles.$phpEx?mode=addnew&style=" . urlencode($installable_themes[$i]['style_name']) . "&install_to=" . urlencode($installable_themes[$i]['template_name']))) - ); - - } - $template->pparse("body"); - - } - closedir($dir); - } - break; - - case "create": - case "edit": - $submit = ( isset($HTTP_POST_VARS['submit']) ) ? TRUE : 0; - - if( $submit ) - { - // - // DAMN! Thats alot of data to validate... - // - $updated['style_name'] = $HTTP_POST_VARS['style_name']; - $updated['template_name'] = $HTTP_POST_VARS['template_name']; - $updated['head_stylesheet'] = $HTTP_POST_VARS['head_stylesheet']; - $updated['body_background'] = $HTTP_POST_VARS['body_background']; - $updated['body_bgcolor'] = $HTTP_POST_VARS['body_bgcolor']; - $updated['body_text'] = $HTTP_POST_VARS['body_text']; - $updated['body_link'] = $HTTP_POST_VARS['body_link']; - $updated['body_vlink'] = $HTTP_POST_VARS['body_vlink']; - $updated['body_alink'] = $HTTP_POST_VARS['body_alink']; - $updated['body_hlink'] = $HTTP_POST_VARS['body_hlink']; - $updated['tr_color1'] = $HTTP_POST_VARS['tr_color1']; - $updated_name['tr_color1_name'] = $HTTP_POST_VARS['tr_color1_name']; - $updated['tr_color2'] = $HTTP_POST_VARS['tr_color2']; - $updated_name['tr_color2_name'] = $HTTP_POST_VARS['tr_color2_name']; - $updated['tr_color3'] = $HTTP_POST_VARS['tr_color3']; - $updated_name['tr_color3_name'] = $HTTP_POST_VARS['tr_color3_name']; - $updated['tr_class1'] = $HTTP_POST_VARS['tr_class1']; - $updated_name['tr_class1_name'] = $HTTP_POST_VARS['tr_class1_name']; - $updated['tr_class2'] = $HTTP_POST_VARS['tr_class2']; - $updated_name['tr_class2_name'] = $HTTP_POST_VARS['tr_class2_name']; - $updated['tr_class3'] = $HTTP_POST_VARS['tr_class3']; - $updated_name['tr_class3_name'] = $HTTP_POST_VARS['tr_class3_name']; - $updated['th_color1'] = $HTTP_POST_VARS['th_color1']; - $updated_name['th_color1_name'] = $HTTP_POST_VARS['th_color1_name']; - $updated['th_color2'] = $HTTP_POST_VARS['th_color2']; - $updated_name['th_color2_name'] = $HTTP_POST_VARS['th_color2_name']; - $updated['th_color3'] = $HTTP_POST_VARS['th_color3']; - $updated_name['th_color3_name'] = $HTTP_POST_VARS['th_color3_name']; - $updated['th_class1'] = $HTTP_POST_VARS['th_class1']; - $updated_name['th_class1_name'] = $HTTP_POST_VARS['th_class1_name']; - $updated['th_class2'] = $HTTP_POST_VARS['th_class2']; - $updated_name['th_class2_name'] = $HTTP_POST_VARS['th_class2_name']; - $updated['th_class3'] = $HTTP_POST_VARS['th_class3']; - $updated_name['th_class3_name'] = $HTTP_POST_VARS['th_class3_name']; - $updated['td_color1'] = $HTTP_POST_VARS['td_color1']; - $updated_name['td_color1_name'] = $HTTP_POST_VARS['td_color1_name']; - $updated['td_color2'] = $HTTP_POST_VARS['td_color2']; - $updated_name['td_color2_name'] = $HTTP_POST_VARS['td_color2_name']; - $updated['td_color3'] = $HTTP_POST_VARS['td_color3']; - $updated_name['td_color3_name'] = $HTTP_POST_VARS['td_color3_name']; - $updated['td_class1'] = $HTTP_POST_VARS['td_class1']; - $updated_name['td_class1_name'] = $HTTP_POST_VARS['td_class1_name']; - $updated['td_class2'] = $HTTP_POST_VARS['td_class2']; - $updated_name['td_class2_name'] = $HTTP_POST_VARS['td_class2_name']; - $updated['td_class3'] = $HTTP_POST_VARS['td_class3']; - $updated_name['td_class3_name'] = $HTTP_POST_VARS['td_class3_name']; - $updated['fontface1'] = $HTTP_POST_VARS['fontface1']; - $updated_name['fontface1_name'] = $HTTP_POST_VARS['fontface1_name']; - $updated['fontface2'] = $HTTP_POST_VARS['fontface2']; - $updated_name['fontface2_name'] = $HTTP_POST_VARS['fontface2_name']; - $updated['fontface3'] = $HTTP_POST_VARS['fontface3']; - $updated_name['fontface3_name'] = $HTTP_POST_VARS['fontface3_name']; - $updated['fontsize1'] = intval($HTTP_POST_VARS['fontsize1']); - $updated_name['fontsize1_name'] = $HTTP_POST_VARS['fontsize1_name']; - $updated['fontsize2'] = intval($HTTP_POST_VARS['fontsize2']); - $updated_name['fontsize2_name'] = $HTTP_POST_VARS['fontsize2_name']; - $updated['fontsize3'] = intval($HTTP_POST_VARS['fontsize3']); - $updated_name['fontsize3_name'] = $HTTP_POST_VARS['fontsize3_name']; - $updated['fontcolor1'] = $HTTP_POST_VARS['fontcolor1']; - $updated_name['fontcolor1_name'] = $HTTP_POST_VARS['fontcolor1_name']; - $updated['fontcolor2'] = $HTTP_POST_VARS['fontcolor2']; - $updated_name['fontcolor2_name'] = $HTTP_POST_VARS['fontcolor2_name']; - $updated['fontcolor3'] = $HTTP_POST_VARS['fontcolor3']; - $updated_name['fontcolor3_name'] = $HTTP_POST_VARS['fontcolor3_name']; - $updated['span_class1'] = $HTTP_POST_VARS['span_class1']; - $updated_name['span_class1_name'] = $HTTP_POST_VARS['span_class1_name']; - $updated['span_class2'] = $HTTP_POST_VARS['span_class2']; - $updated_name['span_class2_name'] = $HTTP_POST_VARS['span_class2_name']; - $updated['span_class3'] = $HTTP_POST_VARS['span_class3']; - $updated_name['span_class3_name'] = $HTTP_POST_VARS['span_class3_name']; - $style_id = intval($HTTP_POST_VARS['style_id']); - // - // Wheeeew! Thank heavens for copy and paste and search and replace :D - // - - if($mode == "edit") - { - $sql = "UPDATE " . THEMES_TABLE . " SET "; - $count = 0; - - while(list($key, $val) = each($updated)) - { - if($count != 0) - { - $sql .= ", "; - } - - // - // I don't like this but it'll keep MSSQL from throwing - // an error and save me alot of typing - // - $sql .= ( stristr($key, "fontsize") ) ? "$key = $val" : "$key = '" . str_replace("\'", "''", $val) . "'"; - - $count++; - } - - $sql .= " WHERE themes_id = $style_id"; - - if(!$result = $db->sql_query($sql)) - { - message_die(GENERAL_ERROR, "Could not update themes table!", "", __LINE__, __FILE__, $sql); - } - - // - // Check if there's a names table entry for this style - // - $sql = "SELECT themes_id - FROM " . THEMES_NAME_TABLE . " - WHERE themes_id = $style_id"; - if(!$result = $db->sql_query($sql)) - { - message_die(GENERAL_ERROR, "Could not get data from themes_name table", "", __LINE__, __FILE__, $sql); - } - - if($db->sql_numrows($result) > 0) - { - $sql = "UPDATE " . THEMES_NAME_TABLE . " - SET "; - $count = 0; - while(list($key, $val) = each($updated_name)) - { - if($count != 0) - { - $sql .= ", "; - } - - $sql .= "$key = '$val'"; - - $count++; - } - - $sql .= " WHERE themes_id = $style_id"; - } - else - { - // - // Nope, no names entry so we create a new one. - // - $sql = "INSERT INTO " . THEMES_NAME_TABLE . " (themes_id, "; - while(list($key, $val) = each($updated_name)) - { - $fields[] = $key; - $vals[] = str_replace("\'", "''", $val); - } - - for($i = 0; $i < count($fields); $i++) - { - if($i > 0) - { - $sql .= ", "; - } - $sql .= $fields[$i]; - } - - $sql .= ") VALUES ($style_id, "; - for($i = 0; $i < count($vals); $i++) - { - if($i > 0) - { - $sql .= ", "; - } - $sql .= "'" . $vals[$i] . "'"; - } - - $sql .= ")"; - } - - if(!$result = $db->sql_query($sql)) - { - message_die(GENERAL_ERROR, "Could not update themes name table!", "", __LINE__, __FILE__, $sql); - } - - $message = $lang['Theme_updated'] . "

" . sprintf($lang['Click_return_styleadmin'], "", "") . "

" . sprintf($lang['Click_return_admin_index'], "", ""); - - message_die(GENERAL_MESSAGE, $message); - } - else - { - // - // First, check if we already have a style by this name - // - $sql = "SELECT themes_id - FROM " . THEMES_TABLE . " - WHERE style_name = '" . str_replace("\'", "''", $updated['style_name']) . "'"; - if(!$result = $db->sql_query($sql)) - { - message_die(GENERAL_ERROR, "Could not query themes table", "", __LINE__, __FILE__, $sql); - } - - if($db->sql_numrows($result)) - { - message_die(GENERAL_ERROR, $lang['Style_exists'], $lang['Error']); - } - - while(list($key, $val) = each($updated)) - { - $field_names[] = $key; - - if(stristr($key, "fontsize")) - { - $values[] = "$val"; - } - else - { - $values[] = "'" . str_replace("\'", "''", $val) . "'"; - } - } - - $sql = "INSERT - INTO " . THEMES_TABLE . " ("; - for($i = 0; $i < count($field_names); $i++) - { - if($i != 0) - { - $sql .= ", "; - } - $sql .= $field_names[$i]; - } - - $sql .= ") VALUES ("; - for($i = 0; $i < count($values); $i++) - { - if($i != 0) - { - $sql .= ", "; - } - $sql .= $values[$i]; - } - $sql .= ")"; - - if(!$result = $db->sql_query($sql)) - { - message_die(GENERAL_ERROR, "Could not update themes table!", "", __LINE__, __FILE__, $sql); - } - - $style_id = $db->sql_nextid(); - - // - // Insert names data - // - $sql = "INSERT INTO " . THEMES_NAME_TABLE . " (themes_id, "; - while(list($key, $val) = each($updated_name)) - { - $fields[] = $key; - $vals[] = $val; - } - - for($i = 0; $i < count($fields); $i++) - { - if($i > 0) - { - $sql .= ", "; - } - $sql .= $fields[$i]; - } - - $sql .= ") VALUES ($style_id, "; - for($i = 0; $i < count($vals); $i++) - { - if($i > 0) - { - $sql .= ", "; - } - $sql .= "'" . $vals[$i] . "'"; - } - - $sql .= ")"; - - if(!$result = $db->sql_query($sql)) - { - message_die(GENERAL_ERROR, "Could not insert themes name table!", "", __LINE__, __FILE__, $sql); - } - - $message = $lang['Theme_created'] . "

" . sprintf($lang['Click_return_styleadmin'], "", "") . "

" . sprintf($lang['Click_return_admin_index'], "", ""); - - message_die(GENERAL_MESSAGE, $message); - } - } - else - { - if($mode == "edit") - { - $themes_title = $lang['Edit_theme']; - $themes_explain = $lang['Edit_theme_explain']; - - $style_id = $HTTP_GET_VARS['style_id']; - - $selected_names = array(); - $selected_values = array(); - // - // Fetch the Theme Info from the db - // - $sql = "SELECT * - FROM " . THEMES_TABLE . " - WHERE themes_id = $style_id"; - if(!$result = $db->sql_query($sql)) - { - message_die(GENERAL_ERROR, "Could not get data from themes table", "", __LINE__, __FILE__, $sql); - } - - if ( $selected_values = $db->sql_fetchrow($result) ) - { - while(list($key, $val) = @each($selected_values)) - { - $selected[$key] = $val; - } - } - - // - // Fetch the Themes Name data - // - $sql = "SELECT * - FROM " . THEMES_NAME_TABLE . " - WHERE themes_id = $style_id"; - if(!$result = $db->sql_query($sql)) - { - message_die(GENERAL_ERROR, "Could not get data from themes name table", "", __LINE__, __FILE__, $sql); - } - - if ( $selected_names = $db->sql_fetchrow($result) ) - { - while(list($key, $val) = @each($selected_names)) - { - $selected[$key] = $val; - } - } - - $s_hidden_fields = ''; - } - else - { - $themes_title = $lang['Create_theme']; - $themes_explain = $lang['Create_theme_explain']; - } - - $template->set_filenames(array( - "body" => "admin/styles_edit_body.tpl") - ); - - if( $dir = @opendir($phpbb_root_path . 'templates/') ) - { - $s_template_select = ''; - - $template->assign_vars(array( - "L_THEMES_TITLE" => $themes_title, - "L_THEMES_EXPLAIN" => $themes_explain, - "L_THEME_NAME" => $lang['Theme_name'], - "L_TEMPLATE" => $lang['Template'], - "L_THEME_SETTINGS" => $lang['Theme_settings'], - "L_THEME_ELEMENT" => $lang['Theme_element'], - "L_SIMPLE_NAME" => $lang['Simple_name'], - "L_VALUE" => $lang['Value'], - "L_STYLESHEET" => $lang['Stylesheet'], - "L_BACKGROUND_IMAGE" => $lang['Background_image'], - "L_BACKGROUND_COLOR" => $lang['Background_color'], - "L_BODY_TEXT_COLOR" => $lang['Text_color'], - "L_BODY_LINK_COLOR" => $lang['Link_color'], - "L_BODY_VLINK_COLOR" => $lang['VLink_color'], - "L_BODY_ALINK_COLOR" => $lang['ALink_color'], - "L_BODY_HLINK_COLOR" => $lang['HLink_color'], - "L_TR_COLOR1" => $lang['Tr_color1'], - "L_TR_COLOR2" => $lang['Tr_color2'], - "L_TR_COLOR3" => $lang['Tr_color3'], - "L_TR_CLASS1" => $lang['Tr_class1'], - "L_TR_CLASS2" => $lang['Tr_class2'], - "L_TR_CLASS3" => $lang['Tr_class3'], - "L_TH_COLOR1" => $lang['Th_color1'], - "L_TH_COLOR2" => $lang['Th_color2'], - "L_TH_COLOR3" => $lang['Th_color3'], - "L_TH_CLASS1" => $lang['Th_class1'], - "L_TH_CLASS2" => $lang['Th_class2'], - "L_TH_CLASS3" => $lang['Th_class3'], - "L_TD_COLOR1" => $lang['Td_color1'], - "L_TD_COLOR2" => $lang['Td_color2'], - "L_TD_COLOR3" => $lang['Td_color3'], - "L_TD_CLASS1" => $lang['Td_class1'], - "L_TD_CLASS2" => $lang['Td_class2'], - "L_TD_CLASS3" => $lang['Td_class3'], - "L_FONTFACE_1" => $lang['fontface1'], - "L_FONTFACE_2" => $lang['fontface2'], - "L_FONTFACE_3" => $lang['fontface3'], - "L_FONTSIZE_1" => $lang['fontsize1'], - "L_FONTSIZE_2" => $lang['fontsize2'], - "L_FONTSIZE_3" => $lang['fontsize3'], - "L_FONTCOLOR_1" => $lang['fontcolor1'], - "L_FONTCOLOR_2" => $lang['fontcolor2'], - "L_FONTCOLOR_3" => $lang['fontcolor3'], - "L_SPAN_CLASS_1" => $lang['span_class1'], - "L_SPAN_CLASS_2" => $lang['span_class2'], - "L_SPAN_CLASS_3" => $lang['span_class3'], - "L_SAVE_SETTINGS" => $lang['Save_Settings'], - "THEME_NAME" => $selected['style_name'], - "HEAD_STYLESHEET" => $selected['head_stylesheet'], - "BODY_BACKGROUND" => $selected['body_background'], - "BODY_BGCOLOR" => $selected['body_bgcolor'], - "BODY_TEXT_COLOR" => $selected['body_text'], - "BODY_LINK_COLOR" => $selected['body_link'], - "BODY_VLINK_COLOR" => $selected['body_vlink'], - "BODY_ALINK_COLOR" => $selected['body_alink'], - "BODY_HLINK_COLOR" => $selected['body_hlink'], - "TR_COLOR1" => $selected['tr_color1'], - "TR_COLOR2" => $selected['tr_color2'], - "TR_COLOR3" => $selected['tr_color3'], - "TR_CLASS1" => $selected['tr_class1'], - "TR_CLASS2" => $selected['tr_class2'], - "TR_CLASS3" => $selected['tr_class3'], - "TH_COLOR1" => $selected['th_color1'], - "TH_COLOR2" => $selected['th_color2'], - "TH_COLOR3" => $selected['th_color3'], - "TH_CLASS1" => $selected['th_class1'], - "TH_CLASS2" => $selected['th_class2'], - "TH_CLASS3" => $selected['th_class3'], - "TD_COLOR1" => $selected['td_color1'], - "TD_COLOR2" => $selected['td_color2'], - "TD_COLOR3" => $selected['td_color3'], - "TD_CLASS1" => $selected['td_class1'], - "TD_CLASS2" => $selected['td_class2'], - "TD_CLASS3" => $selected['td_class3'], - "FONTFACE1" => $selected['fontface1'], - "FONTFACE2" => $selected['fontface2'], - "FONTFACE3" => $selected['fontface3'], - "FONTSIZE1" => $selected['fontsize1'], - "FONTSIZE2" => $selected['fontsize2'], - "FONTSIZE3" => $selected['fontsize3'], - "FONTCOLOR1" => $selected['fontcolor1'], - "FONTCOLOR2" => $selected['fontcolor2'], - "FONTCOLOR3" => $selected['fontcolor3'], - "SPAN_CLASS1" => $selected['span_class1'], - "SPAN_CLASS2" => $selected['span_class2'], - "SPAN_CLASS3" => $selected['span_class3'], - - "TR_COLOR1_NAME" => $selected['tr_color1_name'], - "TR_COLOR2_NAME" => $selected['tr_color2_name'], - "TR_COLOR3_NAME" => $selected['tr_color3_name'], - "TR_CLASS1_NAME" => $selected['tr_class1_name'], - "TR_CLASS2_NAME" => $selected['tr_class2_name'], - "TR_CLASS3_NAME" => $selected['tr_class3_name'], - "TH_COLOR1_NAME" => $selected['th_color1_name'], - "TH_COLOR2_NAME" => $selected['th_color2_name'], - "TH_COLOR3_NAME" => $selected['th_color3_name'], - "TH_CLASS1_NAME" => $selected['th_class1_name'], - "TH_CLASS2_NAME" => $selected['th_class2_name'], - "TH_CLASS3_NAME" => $selected['th_class3_name'], - "TD_COLOR1_NAME" => $selected['td_color1_name'], - "TD_COLOR2_NAME" => $selected['td_color2_name'], - "TD_COLOR3_NAME" => $selected['td_color3_name'], - "TD_CLASS1_NAME" => $selected['td_class1_name'], - "TD_CLASS2_NAME" => $selected['td_class2_name'], - "TD_CLASS3_NAME" => $selected['td_class3_name'], - "FONTFACE1_NAME" => $selected['fontface1_name'], - "FONTFACE2_NAME" => $selected['fontface2_name'], - "FONTFACE3_NAME" => $selected['fontface3_name'], - "FONTSIZE1_NAME" => $selected['fontsize1_name'], - "FONTSIZE2_NAME" => $selected['fontsize2_name'], - "FONTSIZE3_NAME" => $selected['fontsize3_name'], - "FONTCOLOR1_NAME" => $selected['fontcolor1_name'], - "FONTCOLOR2_NAME" => $selected['fontcolor2_name'], - "FONTCOLOR3_NAME" => $selected['fontcolor3_name'], - "SPAN_CLASS1_NAME" => $selected['span_class1_name'], - "SPAN_CLASS2_NAME" => $selected['span_class2_name'], - "SPAN_CLASS3_NAME" => $selected['span_class3_name'], - - "S_THEME_ACTION" => append_sid("admin_styles.$phpEx"), - "S_TEMPLATE_SELECT" => $s_template_select, - "S_HIDDEN_FIELDS" => $s_hidden_fields) - ); - - $template->pparse("body"); - } - break; - - case "export"; - if($HTTP_POST_VARS['export_template']) - { - $template_name = $HTTP_POST_VARS['export_template']; - - $sql = "SELECT * - FROM " . THEMES_TABLE . " - WHERE template_name = '$template_name'"; - if(!$result = $db->sql_query($sql)) - { - message_die(GENERAL_ERROR, "Could not get theme data for selected template", "", __LINE__, __FILE__, $sql); - } - - $theme_rowset = $db->sql_fetchrowset($result); - - if( count($theme_rowset) == 0 ) - { - message_die(GENERAL_MESSAGE, $lang['No_themes']); - } - - $theme_data = ''; // Done this to prevent highlighting editors getting confused! - - @umask(0111); - - $fp = @fopen($phpbb_root_path . 'templates/' . $template_name . '/theme_info.cfg', 'w'); - - if( !$fp ) - { - // - // Unable to open the file writeable do something here as an attempt - // to get around that... - // - $s_hidden_fields = ''; - $s_hidden_fields .= ''; - - $download_form = '
' . $s_hidden_fields; - - $template->set_filenames(array( - "body" => "message_body.tpl") - ); - - $template->assign_vars(array( - "MESSAGE_TITLE" => $lang['Export_themes'], - "MESSAGE_TEXT" => $lang['Download_theme_cfg'] . "

" . $download_form) - ); - - $template->pparse('body'); - exit(); - } - - $result = @fputs($fp, $theme_data, strlen($theme_data)); - fclose($fp); - - $message = $lang['Theme_info_saved'] . "

" . sprintf($lang['Click_return_styleadmin'], "", "") . "

" . sprintf($lang['Click_return_admin_index'], "", ""); - - message_die(GENERAL_MESSAGE, $message); - - } - else if($HTTP_POST_VARS['send_file']) - { - - header("Content-Type: text/x-delimtext; name=\"theme_info.cfg\""); - header("Content-disposition: attachment; filename=theme_info.cfg"); - - echo stripslashes($HTTP_POST_VARS['theme_info']); - } - else - { - $template->set_filenames(array( - "body" => "admin/styles_exporter.tpl") - ); - - if( $dir = @opendir($phpbb_root_path . 'templates/') ) - { - $s_template_select = ''; - } - else - { - message_die(GENERAL_MESSAGE, $lang['No_template_dir']); - } - - $template->assign_vars(array( - "L_STYLE_EXPORTER" => $lang['Export_themes'], - "L_EXPORTER_EXPLAIN" => $lang['Export_explain'], - "L_TEMPLATE_SELECT" => $lang['Select_template'], - "L_SUBMIT" => $lang['Submit'], - - "S_EXPORTER_ACTION" => append_sid("admin_styles.$phpEx?mode=export"), - "S_TEMPLATE_SELECT" => $s_template_select) - ); - - $template->pparse("body"); - - } - break; - - case "delete": - $style_id = ( isset($HTTP_GET_VARS['style_id']) ) ? intval($HTTP_GET_VARS['style_id']) : intval($HTTP_POST_VARS['style_id']); - - if( !$confirm ) - { - if($style_id == $board_config['default_style']) - { - message_die(GENERAL_MESSAGE, $lang['Cannot_remove_style']); - } - - $hidden_fields = ''; - - // - // Set template files - // - $template->set_filenames(array( - "confirm" => "confirm_body.tpl") - ); - - $template->assign_vars(array( - "MESSAGE_TITLE" => $lang['Confirm'], - "MESSAGE_TEXT" => $lang['Confirm_delete_style'], - - "L_YES" => $lang['Yes'], - "L_NO" => $lang['No'], - - "S_CONFIRM_ACTION" => append_sid("admin_styles.$phpEx"), - "S_HIDDEN_FIELDS" => $hidden_fields) - ); - - $template->pparse("confirm"); - - } - else - { - // - // The user has confirmed the delete. Remove the style, the style element - // names and update any users who might be using this style - // - $sql = "DELETE FROM " . THEMES_TABLE . " - WHERE themes_id = $style_id"; - if(!$result = $db->sql_query($sql, BEGIN_TRANSACTION)) - { - message_die(GENERAL_ERROR, "Could not remove style data!", "", __LINE__, __FILE__, $sql); - } - - // - // There may not be any theme name data so don't throw an error - // if the SQL dosan't work - // - $sql = "DELETE FROM " . THEMES_NAME_TABLE . " - WHERE themes_id = $style_id"; - $db->sql_query($sql); - - $sql = "UPDATE " . USERS_TABLE . " - SET user_style = " . $board_config['default_style'] . " - WHERE user_style = $style_id"; - if(!$result = $db->sql_query($sql, END_TRANSACTION)) - { - message_die(GENERAL_ERROR, "Could not update user style information", "", __LINE__, __FILE__, $sql); - } - - $message = $lang['Style_removed'] . "

" . sprintf($lang['Click_return_styleadmin'], "", "") . "

" . sprintf($lang['Click_return_admin_index'], "", ""); - - message_die(GENERAL_MESSAGE, $message); - } - break; - - default: - - $sql = "SELECT themes_id, template_name, style_name - FROM " . THEMES_TABLE . " - ORDER BY template_name"; - if(!$result = $db->sql_query($sql)) - { - message_die(GENERAL_ERROR, "Could not get style information!", "", __LINE__, __FILE__, $sql); - } - - $style_rowset = $db->sql_fetchrowset($result); - - $template->set_filenames(array( - "body" => "admin/styles_list_body.tpl") - ); - - $template->assign_vars(array( - "L_STYLES_TITLE" => $lang['Styles_admin'], - "L_STYLES_TEXT" => $lang['Styles_explain'], - "L_STYLE" => $lang['Style'], - "L_TEMPLATE" => $lang['Template'], - "L_EDIT" => $lang['Edit'], - "L_DELETE" => $lang['Delete']) - ); - - for($i = 0; $i < count($style_rowset); $i++) - { - $row_color = ( !($i % 2) ) ? $theme['td_color1'] : $theme['td_color2']; - $row_class = ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2']; - - $template->assign_block_vars("styles", array( - "ROW_CLASS" => $row_class, - "ROW_COLOR" => $row_color, - "STYLE_NAME" => $style_rowset[$i]['style_name'], - "TEMPLATE_NAME" => $style_rowset[$i]['template_name'], - - "U_STYLES_EDIT" => append_sid("admin_styles.$phpEx?mode=edit&style_id=" . $style_rowset[$i]['themes_id']), - "U_STYLES_DELETE" => append_sid("admin_styles.$phpEx?mode=delete&style_id=" . $style_rowset[$i]['themes_id'])) - ); - } - - $template->pparse("body"); - break; } - -if( !$HTTP_POST_VARS['send_file'] ) +else if ( $mode == 'edittemplate' ) { - include('page_footer_admin.'.$phpEx); + $tplcols = ( isset($HTTP_POST_VARS['tplcols']) ) ? max(60, intval($HTTP_POST_VARS['tplcols'])) : 76; + $tplrows = ( isset($HTTP_POST_VARS['tplrows']) ) ? max(4, intval($HTTP_POST_VARS['tplrows'])) : 30; + $tplname = ( isset($HTTP_POST_VARS['tplname']) ) ? $HTTP_POST_VARS['tplname'] : ''; + $tplroot = ( isset($HTTP_POST_VARS['tplroot']) ) ? $HTTP_POST_VARS['tplroot'] : 'subSilver'; + + $str = ''; + if ( isset($HTTP_POST_VARS['tpl_compile']) && !empty($HTTP_POST_VARS['decompile']) ) + { + $str = "compile(stripslashes($HTTP_POST_VARS['decompile'])) . "\n?".">"; + + $fp = fopen($phpbb_root_path . 'templates/cache/' . $tplroot . '/' . $tplname . '.html.' . $phpEx, 'w+'); + fwrite ($fp, $str); + fclose($fp); + + @chmod($phpbb_root_path . 'templates/cache/' . $tplroot . '/' . $tplname . '.html.' . $phpEx, 0644); + + add_admin_log('log_template_edit', $tplname, $tplroot); + + exit; + } + else if ( !empty($tplname) && isset($HTTP_POST_VARS['tpl_name']) ) + { + $fp = fopen($phpbb_root_path . 'templates/cache/' . $tplroot . '/' . $tplname . '.html.' . $phpEx, 'r'); + while ( !feof($fp) ) + { + $str .= fread($fp, 4096); + } + @fclose($fp); + + $template->decompile($str); + } + else + { + $str = ( !empty($HTTP_POST_VARS['decompile']) ) ? stripslashes($HTTP_POST_VARS['decompile']) : ''; + } + + if ( isset($HTTP_POST_VARS['tpl_download']) ) + { + header("Content-Type: text/html; name=\"" . $tplname . ".html\""); + header("Content-disposition: attachment; filename=" . $tplname . ".html"); + echo $str; + exit; + + } + + $tplroot_options = get_templates($tplroot); + + $tplname_options = ''; + $dp = opendir($phpbb_root_path . 'templates/cache/' . $tplroot . '/'); + while ( $file = readdir($dp) ) + { + if ( strstr($file, '.html.' . $phpEx) && is_file($phpbb_root_path . 'templates/cache/' . $tplroot . '/' . $file) ) + { + $tpl = substr($file, 0, strpos($file, '.')); + $selected = ( $tplname == $tpl ) ? ' selected="selected"' : ''; + $tplname_options .= ''; + } + } + closedir($dp); + + // + // + // + page_header($lang['Styles']); + + echo ''; + + echo '

Edit Template

'; + + echo '

Use this panel to edit an existing compiled template set. When you have made the required changes you can recompile the template and (or) download it. Please remember that the existing HTML templates are not altered, only the compiled versions are affected. Therefore you should download any altered files if you wish to keep them for future use and for archival purposes.

'; + + echo '

Template set:  

'; + + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo '
'; + echo ''; + echo ''; + echo ''; + echo ''; + echo '
 Template:   Columns:  Rows:    
   
'; + echo '
'; + + page_footer(); } -?> + +// +// +// +function get_templates($tplroot = '') +{ + global $db; + + $sql = "SELECT template_name, template_path + FROM " . STYLES_TPL_TABLE . " + ORDER BY template_name"; + $result = $db->sql_query($sql); + + $tplroot_options = ''; + while ( $row = $db->sql_fetchrow($result) ) + { + $selected = ( $tplroot == $row['template_path'] ) ? ' selected="selected"' : ''; + $tplroot_options .= ''; + } + + return $tplroot_options; +} + +?> \ No newline at end of file diff --git a/phpBB/admin/admin_users.php b/phpBB/admin/admin_users.php index 86eb875175..752928021b 100644 --- a/phpBB/admin/admin_users.php +++ b/phpBB/admin/admin_users.php @@ -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) ) + $result = $db->sql_query($sql); + + if ( isset($rename_user) ) { - 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); - } - } - $message .= $lang['Admin_user_updated']; - } - else - { - $error = TRUE; - $error_msg .= ( ( isset($error_msg) ) ? '
' : '' ) . $lang['Admin_user_fail']; + $sql = "UPDATE " . GROUPS_TABLE . " + SET group_name = '".str_replace("\'", "''", $rename_user)."' + WHERE group_name = '".str_replace("\'", "''", $this_userdata['username'] )."'"; + $db->sql_query($sql); } + + $message .= $lang['Admin_user_updated']; } - $message .= '

' . sprintf($lang['Click_return_useradmin'], '', '') . '

' . sprintf($lang['Click_return_admin_index'], '', ''); + $message .= '

' . sprintf($lang['Click_return_useradmin'], '', '') . '

' . sprintf($lang['Click_return_admin_index'], '', ''); - 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 = ''; 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, '', ''), + 'BBCODE_STATUS' => sprintf($bbcode_status, '', ''), '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 = ''; while( $row = $db->sql_fetchrow($result) ) { $select_list .= ''; @@ -1059,15 +1039,15 @@ 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&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'); } include('page_footer_admin.'.$phpEx); -?> +?> \ No newline at end of file diff --git a/phpBB/admin/admin_words.php b/phpBB/admin/admin_words.php index 72380a43bb..db17648178 100644 --- a/phpBB/admin/admin_words.php +++ b/phpBB/admin/admin_words.php @@ -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 ) { - $word_id = ( isset($HTTP_GET_VARS['id']) ) ? $HTTP_GET_VARS['id'] : 0; + 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 ) + $s_hidden_fields = ''; + if ( $mode == 'edit' ) { + if ( !$word_id ) + { + message_die(MESSAGE, $lang['No_word_selected']); + } + $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 .= ''; } + + page_header($lang['General']); + +?> + +

+ +

+ +
"> + + + + + + + + + + + + + + +
+ +sql_query($sql); + + $log_action = ( $word_id ) ? 'log_edit_word' : 'log_add_word'; + add_admin_log($log_action, stripslashes($word)); + + $message = ( $word_id ) ? $lang['Word_updated'] : $lang['Word_added']; + $message .= '

' . sprintf($lang['Click_return_wordadmin'], '', '') . '

' . sprintf($lang['Click_return_admin_index'], '', ''); + + 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 { - message_die(GENERAL_MESSAGE, $lang['No_word_selected']); + message_die(MESSAGE, $lang['Must_specify_word']); } - } - $template->assign_vars(array( - "WORD" => $word_info['word'], - "REPLACEMENT" => $word_info['replacement'], - - "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) - ); - - $template->pparse("body"); - - include('page_footer_admin.'.$phpEx); - } - else if( $mode == "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']) : ""; - - if($word == "" || $replacement == "") - { - message_die(GENERAL_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']; - } - - if(!$result = $db->sql_query($sql)) - { - message_die(GENERAL_ERROR, "Could not insert data into words table", $lang['Error'], __LINE__, __FILE__, $sql); - } - - $message .= "

" . sprintf($lang['Click_return_wordadmin'], "", "") . "

" . sprintf($lang['Click_return_admin_index'], "", ""); - - message_die(GENERAL_MESSAGE, $message); - } - else if( $mode == "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; - } - - 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'] . "

" . sprintf($lang['Click_return_wordadmin'], "", "") . "

" . sprintf($lang['Click_return_admin_index'], "", ""); + $message = $lang['Word_removed'] . '

' . sprintf($lang['Click_return_wordadmin'], '', '') . '

' . sprintf($lang['Click_return_admin_index'], '', ''); - message_die(GENERAL_MESSAGE, $message); - } - else - { - message_die(GENERAL_MESSAGE, $lang['Must_specify_word']); - } + message_die(MESSAGE, $message); + break; } + } else { - $template->set_filenames(array( - "body" => "admin/words_list_body.tpl") - ); + + page_header($lang['General']); + +?> + +

+ +

+ +
"> + + + + + + +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); + do + { + $cell_bg = ( $cell_bg == 'row1' ) ? 'row2' : 'row1'; + +?> + + + + + + +sql_fetchrow($result) ); } - $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'], + append_sid("admin_words.$phpEx"), - "S_HIDDEN_FIELDS" => '') - ); - - for($i = 0; $i < $word_count; $i++) - { - $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&id=$word_id"), - "U_WORD_DELETE" => append_sid("admin_words.$phpEx?mode=delete&id=$word_id")) - ); - } } -$template->pparse("body"); - -include('page_footer_admin.'.$phpEx); +page_footer() ?> \ No newline at end of file diff --git a/phpBB/admin/forms.css b/phpBB/admin/forms.css new file mode 100644 index 0000000000..ff9c6dc922 --- /dev/null +++ b/phpBB/admin/forms.css @@ -0,0 +1,13 @@ +/* Fancy form styles for IE */ + +input, textarea, select { + border-width: 1px; +} + +input { + text-indent: 2px; +} + +.postbody { + line-height: 18px +} diff --git a/phpBB/admin/images/cellpic1.gif b/phpBB/admin/images/cellpic1.gif new file mode 100644 index 0000000000..715b8d4aa8 Binary files /dev/null and b/phpBB/admin/images/cellpic1.gif differ diff --git a/phpBB/admin/images/cellpic3.gif b/phpBB/admin/images/cellpic3.gif new file mode 100644 index 0000000000..ecf70e1fd1 Binary files /dev/null and b/phpBB/admin/images/cellpic3.gif differ diff --git a/phpBB/admin/images/header_bg.jpg b/phpBB/admin/images/header_bg.jpg new file mode 100644 index 0000000000..5ecec5360b Binary files /dev/null and b/phpBB/admin/images/header_bg.jpg differ diff --git a/phpBB/admin/images/header_left.jpg b/phpBB/admin/images/header_left.jpg new file mode 100644 index 0000000000..aaebf33c7a Binary files /dev/null and b/phpBB/admin/images/header_left.jpg differ diff --git a/phpBB/admin/index.php b/phpBB/admin/index.php index 79e26edfa2..cfa9e85779 100644 --- a/phpBB/admin/index.php +++ b/phpBB/admin/index.php @@ -1,6 +1,6 @@ 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); +?> + + + + + + +
phpBB Logo      
+ +body {background-color: #98AAB1}'; + 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') - ); + + + + +
+ + + + + + + + + +assign_vars(array( - 'U_FORUM_INDEX' => append_sid("../index.$phpEx"), - 'U_ADMIN_INDEX' => "index.$phpEx$SID&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) - ); +?> + + + + $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'; +?> + + + + $action, - 'U_ADMIN_MODULE' => append_sid($file)) - ); - $row_count++; } } - $template->pparse("body"); +?> +
»
»
+ + +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)) + $result = $db->sql_query($sql); + + $dbsize = 0; + while ( $row = $db->sql_fetchrow($result) ) { - $tabledata_ary = $db->sql_fetchrowset($result); - - $dbsize = 0; - for($i = 0; $i < count($tabledata_ary); $i++) + if ( $row['Type'] != 'MRG_MyISAM' ) { - if( $tabledata_ary[$i]['Type'] != 'MRG_MyISAM' ) + if ( $table_prefix != '' ) { - if( $table_prefix != "" ) + if ( strstr($row['Name'], $table_prefix) ) { - if( strstr($tabledata_ary[$i]['Name'], $table_prefix) ) - { - $dbsize += $tabledata_ary[$i]['Data_length'] + $tabledata_ary[$i]['Index_length']; - } - } - else - { - $dbsize += $tabledata_ary[$i]['Data_length'] + $tabledata_ary[$i]['Index_length']; + $dbsize += $row['Data_length'] + $row['Index_length']; } } + else + { + $dbsize += $row['Data_length'] + $row['Index_length']; + } } - } // Else we couldn't get the table status. + } } else { @@ -255,18 +299,13 @@ 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) ) - { - $dbsize = ( $row = $db->sql_fetchrow($result) ) ? intval($row['dbsize']) : $lang['Not_available']; - } - else - { - $dbsize = $lang['Not_available']; - } + $result = $db->sql_query($sql); + + $dbsize = ( $row = $db->sql_fetchrow($result) ) ? intval($row['dbsize']) : $lang['Not_available']; } else { @@ -275,298 +314,205 @@ elseif( isset($HTTP_GET_VARS['pane']) && $HTTP_GET_VARS['pane'] == 'right' ) if ( is_integer($dbsize) ) { - if( $dbsize >= 1048576 ) - { - $dbsize = sprintf('%.2f MB', ( $dbsize / 1048576 )); - } - else if( $dbsize >= 1024 ) - { - $dbsize = sprintf('%.2f KB', ( $dbsize / 1024 )); - } - else - { - $dbsize = sprintf('%.2f Bytes', $dbsize); - } + $dbsize = ( $dbsize >= 1048576 ) ? sprintf('%.2f MB', ( $dbsize / 1048576 )) : ( ( $dbsize >= 1024 ) ? sprintf('%.2f KB', ( $dbsize / 1024 )) : sprintf('%.2f Bytes', $dbsize) ); } - $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']) - ); - // - // End forum statistics - // + page_header($lang['Admin_Index']); - // - // 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)) +?> + +

+ +

+ +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
::
::
::
::
::
+ +

+ +

+ + + + + + + + + + + + + + + +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)) - { - 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)) +

+ +

+ +
"> + + + + + +sql_query($sql); + + if ( $row = $db->sql_fetchrow($result) ) { - while($forumsrow = $db->sql_fetchrow($forums_result)) + do { - $forum_data[$forumsrow['forum_id']] = $forumsrow['forum_name']; + $cell_bg = ( $cell_bg == 'row1' ) ? 'row2' : 'row1'; +?> + + + + + +sql_fetchrow($result) ); - $reg_userid_ary = array(); - - 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&" . 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&" . POST_USERS_URL . "=" . $onlinerow_reg[$i]['user_id']), - 'U_FORUM_LOCATION' => append_sid($location_url)) - ); - } - } +?> + + + +assign_vars(array( - "L_NO_REGISTERED_USERS_BROWSING" => $lang['No_users_browsing']) - ); + +?> + + + + +
  
     
+ + + + + +
::
+ + + + + + - $template->pparse('body'); +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&pane=left", - 'S_FRAME_MAIN' => "index.$phpEx$SID&pane=right") - ); +?> + + +<?php echo $lang['Admin_title']; ?> + - header ('Expires: ' . gmdate("D, d M Y H:i:s", time()) . ' GMT'); - header ('Last-Modified: ' . gmdate("D, d M Y H:i:s") . ' GMT'); + + " name="title" noresize marginwidth="0" marginheight="0" scrolling="NO"> + + " name="nav" marginwidth="3" marginheight="3" scrolling="yes"> + " name="main" marginwidth="0" marginheight="0" scrolling="auto"> + + + + + <body bgcolor="white" text="#000000"> + <p><?php echo $lang['No_frames']; ?></p> + </body> + + +pparse("body"); exit; } diff --git a/phpBB/admin/page_footer_admin.php b/phpBB/admin/page_footer_admin.php index e181640451..96ba8a40e6 100644 --- a/phpBB/admin/page_footer_admin.php +++ b/phpBB/admin/page_footer_admin.php @@ -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'); +
Powered by phpBB © 2002 phpBB Group
+ +
+ + + +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; diff --git a/phpBB/admin/page_header_admin.php b/phpBB/admin/page_header_admin.php index 7786d464c4..dffbc6cd12 100644 --- a/phpBB/admin/page_header_admin.php +++ b/phpBB/admin/page_header_admin.php @@ -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') -); +header("Content-type: text/html; charset=" . $lang['ENCODING']); -// -// 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, +?> + + + + + $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'], + echo $meta; + +?> + +<?php echo $board_config['sitename'] . ' - ' . $page_title; ?> + + - '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'); + \ No newline at end of file diff --git a/phpBB/admin/pagestart.php b/phpBB/admin/pagestart.php index c6e074a89d..3addac5dd4 100644 --- a/phpBB/admin/pagestart.php +++ b/phpBB/admin/pagestart.php @@ -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'] ) + +// +// Configure style, language, etc. +// +$session->configure($userdata); + +// ----------------------------- +// Functions +// +function page_header($sub_title) { - header("Location: ../" . append_sid("login.$phpEx?redirect=admin/")); -} -else if( $userdata['user_level'] != ADMIN ) -{ - message_die(GENERAL_MESSAGE, $lang['Not_admin']); + global $db, $lang, $phpEx; + + include('page_header_admin.'.$phpEx); + +?> + + + + + +
»   
+ + + + + +

+ + + +
+ + + + + + + + +
phpBB Logo      
+ +

+ + + + + + + + +
+ +
+ +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'] = '' . $row['username'] . ''; + $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 +// ----------------------------- + ?> \ No newline at end of file diff --git a/phpBB/admin/subSilver.css b/phpBB/admin/subSilver.css index 2209e500dd..59818273af 100644 --- a/phpBB/admin/subSilver.css +++ b/phpBB/admin/subSilver.css @@ -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");