From 6b1e343d8dae618afd0cb04173749f005c10e376 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Tue, 11 Jan 2011 23:25:51 +0100 Subject: [PATCH] [task/config-class] Always specify the config table to use. PHPBB3-9988 --- phpBB/common.php | 2 +- phpBB/download/file.php | 2 +- .../plugins/phpbb_captcha_gd_plugin.php | 2 +- phpBB/install/database_update.php | 2 +- phpBB/install/install_convert.php | 12 +++++-- phpBB/install/install_install.php | 36 ++++++------------- phpBB/install/install_update.php | 4 ++- phpBB/style.php | 2 +- 8 files changed, 28 insertions(+), 34 deletions(-) diff --git a/phpBB/common.php b/phpBB/common.php index 0116516213..0c052ae415 100644 --- a/phpBB/common.php +++ b/phpBB/common.php @@ -227,7 +227,7 @@ $db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false, defined(' unset($dbpasswd); // Grab global variables, re-cache if necessary -$config = new phpbb_config_db($db, $cache_factory->get_driver()); +$config = new phpbb_config_db($db, $cache_factory->get_driver(), CONFIG_TABLE); set_config(null, null, null, $config); set_config_count(null, null, null, $config); diff --git a/phpBB/download/file.php b/phpBB/download/file.php index 985a24e572..84abd3538e 100644 --- a/phpBB/download/file.php +++ b/phpBB/download/file.php @@ -70,7 +70,7 @@ if (isset($_GET['avatar'])) // worst-case default $browser = (!empty($_SERVER['HTTP_USER_AGENT'])) ? htmlspecialchars((string) $_SERVER['HTTP_USER_AGENT']) : 'msie 6.0'; - $config = new phpbb_config_db($db, $cache_factory->get_driver()); + $config = new phpbb_config_db($db, $cache_factory->get_driver(), CONFIG_TABLE); set_config(null, null, null, $config); set_config_count(null, null, null, $config); diff --git a/phpBB/includes/captcha/plugins/phpbb_captcha_gd_plugin.php b/phpBB/includes/captcha/plugins/phpbb_captcha_gd_plugin.php index 1c82065a90..add8c3959f 100644 --- a/phpBB/includes/captcha/plugins/phpbb_captcha_gd_plugin.php +++ b/phpBB/includes/captcha/plugins/phpbb_captcha_gd_plugin.php @@ -154,7 +154,7 @@ class phpbb_captcha_gd extends phpbb_default_captcha $config_old = $config; $config = new phpbb_config(array()); - foreach ($old_config as $key => $value) + foreach ($config_old as $key => $value) { $config->set($key, $value); } diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index cecd565fa5..0969654084 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -165,7 +165,7 @@ include($phpbb_root_path . 'language/' . $language . '/install.' . $phpEx); $inline_update = (request_var('type', 0)) ? true : false; // To let set_config() calls succeed, we need to make the config array available globally -$config = new phpbb_config_db($db, $cache_factory->get_driver()); +$config = new phpbb_config_db($db, $cache_factory->get_driver(), CONFIG_TABLE); set_config(null, null, null, $config); set_config_count(null, null, null, $config); diff --git a/phpBB/install/install_convert.php b/phpBB/install/install_convert.php index 7aae5bf28c..7837353cfa 100644 --- a/phpBB/install/install_convert.php +++ b/phpBB/install/install_convert.php @@ -130,7 +130,9 @@ class install_convert extends module unset($dbpasswd); // We need to fill the config to let internal functions correctly work - $config = new phpbb_config_db($db, new phpbb_cache_driver_null); + $config = new phpbb_config_db($db, new phpbb_cache_driver_null, CONFIG_TABLE); + set_config(null, null, null, $config); + set_config_count(null, null, null, $config); // Detect if there is already a conversion in progress at this point and offer to resume // It's quite possible that the user will get disconnected during a large conversion so they need to be able to resume it @@ -341,7 +343,9 @@ class install_convert extends module $this->page_title = $lang['STAGE_SETTINGS']; // We need to fill the config to let internal functions correctly work - $config = new phpbb_config_db($db, new phpbb_cache_driver_null); + $config = new phpbb_config_db($db, new phpbb_cache_driver_null, CONFIG_TABLE); + set_config(null, null, null, $config); + set_config_count(null, null, null, $config); $convertor_tag = request_var('tag', ''); @@ -580,7 +584,9 @@ class install_convert extends module unset($dbpasswd); // We need to fill the config to let internal functions correctly work - $config = new phpbb_config_db($db, new phpbb_cache_driver_null); + $config = new phpbb_config_db($db, new phpbb_cache_driver_null, CONFIG_TABLE); + set_config(null, null, null, $config); + set_config_count(null, null, null, $config); // Override a couple of config variables for the duration $config['max_quote_depth'] = 0; diff --git a/phpBB/install/install_install.php b/phpBB/install/install_install.php index e47c8b8c01..01ed223c27 100644 --- a/phpBB/install/install_install.php +++ b/phpBB/install/install_install.php @@ -1461,7 +1461,9 @@ class install_install extends module include_once($phpbb_root_path . 'includes/search/fulltext_native.' . $phpEx); // We need to fill the config to let internal functions correctly work - $config = new phpbb_config_db($db, new phpbb_cache_driver_null); + $config = new phpbb_config_db($db, new phpbb_cache_driver_null, CONFIG_TABLE); + set_config(null, null, null, $config); + set_config_count(null, null, null, $config); $error = false; $search = new fulltext_native($error); @@ -1821,17 +1823,10 @@ class install_install extends module // Obtain any submitted data $data = $this->get_submitted_data(); - // Fill the config array - it is needed by those functions we call - $sql = 'SELECT * - FROM ' . CONFIG_TABLE; - $result = $db->sql_query($sql); - - $config = array(); - while ($row = $db->sql_fetchrow($result)) - { - $config[$row['config_name']] = $row['config_value']; - } - $db->sql_freeresult($result); + // We need to fill the config to let internal functions correctly work + $config = new phpbb_config_db($db, new phpbb_cache_driver_null, CONFIG_TABLE); + set_config(null, null, null, $config); + set_config_count(null, null, null, $config); $sql = 'SELECT group_id FROM ' . GROUPS_TABLE . " @@ -1898,19 +1893,10 @@ class install_install extends module $this->page_title = $lang['STAGE_FINAL']; - // Obtain any submitted data - $data = $this->get_submitted_data(); - - $sql = 'SELECT * - FROM ' . CONFIG_TABLE; - $result = $db->sql_query($sql); - - $config = array(); - while ($row = $db->sql_fetchrow($result)) - { - $config[$row['config_name']] = $row['config_value']; - } - $db->sql_freeresult($result); + // We need to fill the config to let internal functions correctly work + $config = new phpbb_config_db($db, new phpbb_cache_driver_null, CONFIG_TABLE); + set_config(null, null, null, $config); + set_config_count(null, null, null, $config); $user->session_begin(); $auth->login($data['admin_name'], $data['admin_pass1'], false, true, true); diff --git a/phpBB/install/install_update.php b/phpBB/install/install_update.php index 7c91b112a2..5c3a38d237 100644 --- a/phpBB/install/install_update.php +++ b/phpBB/install/install_update.php @@ -102,7 +102,9 @@ class install_update extends module unset($dbpasswd); // We need to fill the config to let internal functions correctly work - $config = new phpbb_config_db($db, new phpbb_cache_driver_null); + $config = new phpbb_config_db($db, new phpbb_cache_driver_null, CONFIG_TABLE); + set_config(null, null, null, $config); + set_config_count(null, null, null, $config); // Force template recompile $config['load_tplcompile'] = 1; diff --git a/phpBB/style.php b/phpBB/style.php index 09340992c5..88b6a54cbc 100644 --- a/phpBB/style.php +++ b/phpBB/style.php @@ -82,7 +82,7 @@ if ($id) } unset($dbpasswd); - $config = new phpbb_config_db($db, $cache_factory->get_driver()); + $config = new phpbb_config_db($db, $cache_factory->get_driver(), CONFIG_TABLE); set_config(null, null, null, $config); set_config_count(null, null, null, $config);