diff --git a/phpBB/common.php b/phpBB/common.php index 9b6913e95f..6cc7abf118 100644 --- a/phpBB/common.php +++ b/phpBB/common.php @@ -188,6 +188,7 @@ if (!empty($load_extensions) && function_exists('dl')) } // Include files +require($phpbb_root_path . 'includes/class_loader.' . $phpEx); require($phpbb_root_path . 'includes/acm/acm_' . $acm_type . '.' . $phpEx); require($phpbb_root_path . 'includes/cache.' . $phpEx); require($phpbb_root_path . 'includes/template.' . $phpEx); @@ -211,6 +212,9 @@ $template = new template(); $cache = new cache(); $db = new $sql_db(); +$class_loader = new phpbb_class_loader($phpbb_root_path, '.' . $phpEx, $cache); +$class_loader->register(); + // Connect to DB $db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false, defined('PHPBB_DB_NEW_LINK') ? PHPBB_DB_NEW_LINK : false); diff --git a/phpBB/includes/auth/auth_db.php b/phpBB/includes/auth/auth_db.php index 73c4f92976..b672e212bf 100644 --- a/phpBB/includes/auth/auth_db.php +++ b/phpBB/includes/auth/auth_db.php @@ -69,7 +69,7 @@ function login_db(&$username, &$password) if ($show_captcha) { // Visual Confirmation handling - if (!class_exists('phpbb_captcha_factory')) + if (!class_exists('phpbb_captcha_factory', false)) { global $phpbb_root_path, $phpEx; include ($phpbb_root_path . 'includes/captcha/captcha_factory.' . $phpEx); @@ -90,7 +90,7 @@ function login_db(&$username, &$password) { $captcha->reset(); } - + } // If the password convert flag is set we need to convert it diff --git a/phpBB/includes/captcha/plugins/phpbb_captcha_gd_plugin.php b/phpBB/includes/captcha/plugins/phpbb_captcha_gd_plugin.php index 6e899adc16..a326074c14 100644 --- a/phpBB/includes/captcha/plugins/phpbb_captcha_gd_plugin.php +++ b/phpBB/includes/captcha/plugins/phpbb_captcha_gd_plugin.php @@ -19,7 +19,7 @@ if (!defined('IN_PHPBB')) /** * Placeholder for autoload */ -if (!class_exists('phpbb_default_captcha')) +if (!class_exists('phpbb_default_captcha', false)) { include($phpbb_root_path . 'includes/captcha/plugins/captcha_abstract.' . $phpEx); } diff --git a/phpBB/includes/captcha/plugins/phpbb_captcha_gd_wave_plugin.php b/phpBB/includes/captcha/plugins/phpbb_captcha_gd_wave_plugin.php index 2f55d15efd..8ac0262302 100644 --- a/phpBB/includes/captcha/plugins/phpbb_captcha_gd_wave_plugin.php +++ b/phpBB/includes/captcha/plugins/phpbb_captcha_gd_wave_plugin.php @@ -19,7 +19,7 @@ if (!defined('IN_PHPBB')) /** * Placeholder for autoload */ -if (!class_exists('phpbb_default_captcha')) +if (!class_exists('phpbb_default_captcha', false)) { include($phpbb_root_path . 'includes/captcha/plugins/captcha_abstract.' . $phpEx); } diff --git a/phpBB/includes/captcha/plugins/phpbb_captcha_nogd_plugin.php b/phpBB/includes/captcha/plugins/phpbb_captcha_nogd_plugin.php index ac30ed4297..834d2a7f12 100644 --- a/phpBB/includes/captcha/plugins/phpbb_captcha_nogd_plugin.php +++ b/phpBB/includes/captcha/plugins/phpbb_captcha_nogd_plugin.php @@ -19,7 +19,7 @@ if (!defined('IN_PHPBB')) /** * Placeholder for autoload */ -if (!class_exists('phpbb_default_captcha')) +if (!class_exists('phpbb_default_captcha', false)) { include($phpbb_root_path . 'includes/captcha/plugins/captcha_abstract.' . $phpEx); } diff --git a/phpBB/includes/captcha/plugins/phpbb_captcha_qa_plugin.php b/phpBB/includes/captcha/plugins/phpbb_captcha_qa_plugin.php index 49a64b9339..c0cdc83fa1 100644 --- a/phpBB/includes/captcha/plugins/phpbb_captcha_qa_plugin.php +++ b/phpBB/includes/captcha/plugins/phpbb_captcha_qa_plugin.php @@ -87,7 +87,7 @@ class phpbb_captcha_qa } $db->sql_freeresult($result); } - + // okay, if there is a confirm_id, we try to load that confirm's state. If not, we try to find one if (!$this->load_answer() && (!$this->load_confirm_id() || !$this->load_answer())) { @@ -113,7 +113,7 @@ class phpbb_captcha_qa { global $db, $phpbb_root_path, $phpEx; - if (!class_exists('phpbb_db_tools')) + if (!class_exists('phpbb_db_tools', false)) { include("$phpbb_root_path/includes/db/db_tools.$phpEx"); } @@ -365,12 +365,12 @@ class phpbb_captcha_qa global $config, $db, $user; $error = ''; - + if (!sizeof($this->question_ids)) { return false; } - + if (!$this->confirm_id) { $error = $user->lang['CONFIRM_QUESTION_WRONG']; @@ -434,7 +434,7 @@ class phpbb_captcha_qa function reselect_question() { global $db, $user; - + if (!sizeof($this->question_ids)) { return false; @@ -482,8 +482,8 @@ class phpbb_captcha_qa global $db, $user; $sql = 'SELECT confirm_id - FROM ' . CAPTCHA_QA_CONFIRM_TABLE . " - WHERE + FROM ' . CAPTCHA_QA_CONFIRM_TABLE . " + WHERE session_id = '" . $db->sql_escape($user->session_id) . "' AND lang_iso = '" . $db->sql_escape($this->question_lang) . "' AND confirm_type = " . $this->type; @@ -505,7 +505,7 @@ class phpbb_captcha_qa function load_answer() { global $db, $user; - + if (!strlen($this->confirm_id) || !sizeof($this->question_ids)) { return false; @@ -990,9 +990,9 @@ class phpbb_captcha_qa return $langs; } - - - + + + /** * See if there is a question other than the one we have */ diff --git a/phpBB/includes/captcha/plugins/phpbb_recaptcha_plugin.php b/phpBB/includes/captcha/plugins/phpbb_recaptcha_plugin.php index 0f0bfc4156..dad39867dc 100644 --- a/phpBB/includes/captcha/plugins/phpbb_recaptcha_plugin.php +++ b/phpBB/includes/captcha/plugins/phpbb_recaptcha_plugin.php @@ -16,7 +16,7 @@ if (!defined('IN_PHPBB')) exit; } -if (!class_exists('phpbb_default_captcha')) +if (!class_exists('phpbb_default_captcha', false)) { // we need the classic captcha code for tracking solutions and attempts include($phpbb_root_path . 'includes/captcha/plugins/captcha_abstract.' . $phpEx); diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 3f097f171f..d88960ff1d 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -2840,7 +2840,7 @@ function login_box($redirect = '', $l_explain = '', $l_success = '', $admin = fa { global $db, $user, $template, $auth, $phpEx, $phpbb_root_path, $config; - if (!class_exists('phpbb_captcha_factory')) + if (!class_exists('phpbb_captcha_factory', false)) { include($phpbb_root_path . 'includes/captcha/captcha_factory.' . $phpEx); } diff --git a/phpBB/includes/session.php b/phpBB/includes/session.php index 37c62c130c..ec7d1e149b 100644 --- a/phpBB/includes/session.php +++ b/phpBB/includes/session.php @@ -983,7 +983,7 @@ class session } // only called from CRON; should be a safe workaround until the infrastructure gets going - if (!class_exists('phpbb_captcha_factory')) + if (!class_exists('phpbb_captcha_factory', false)) { include($phpbb_root_path . "includes/captcha/captcha_factory." . $phpEx); } diff --git a/phpBB/install/index.php b/phpBB/install/index.php index eb51ca5fb2..03b19d1c12 100644 --- a/phpBB/install/index.php +++ b/phpBB/install/index.php @@ -152,6 +152,7 @@ else @ini_set('memory_limit', $mem_limit); // Include essential scripts +require($phpbb_root_path . 'includes/class_loader.' . $phpEx); require($phpbb_root_path . 'includes/functions.' . $phpEx); if (file_exists($phpbb_root_path . 'includes/functions_content.' . $phpEx)) @@ -168,6 +169,9 @@ include($phpbb_root_path . 'includes/functions_admin.' . $phpEx); include($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx); require($phpbb_root_path . 'includes/functions_install.' . $phpEx); +$class_loader = new phpbb_class_loader($phpbb_root_path, '.' . $phpEx); +$class_loader->register(); + // Try and load an appropriate language if required $language = basename(request_var('language', ''));