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 = '';
+
+ //
+ // Generate header
+ //
+ page_header($lang['Forums']);
+
+?>
+
+
+
+
+
+
+
+
+
+
-
+
-
+
-