aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/common.php
diff options
context:
space:
mode:
authorNils Adermann <naderman@naderman.de>2010-03-10 11:09:36 +0100
committerNils Adermann <naderman@naderman.de>2010-09-17 13:50:36 +0200
commit99a3adfba791baabd27f82429fddfbcb82625523 (patch)
tree901a2f9f4c85ee3b303c1cd39cd1ffec2647fa4f /phpBB/common.php
parentcf3f0f825af846da6e7b36a84328475b164ade64 (diff)
downloadforums-99a3adfba791baabd27f82429fddfbcb82625523.tar
forums-99a3adfba791baabd27f82429fddfbcb82625523.tar.gz
forums-99a3adfba791baabd27f82429fddfbcb82625523.tar.bz2
forums-99a3adfba791baabd27f82429fddfbcb82625523.tar.xz
forums-99a3adfba791baabd27f82429fddfbcb82625523.zip
[feature/request-class] Instantiate a global request class instance.
It should at all cost be avoided to rely on this global variable. Instead either use the request_var method (deprecated) or pass the instance to your function as a parameter or to your object as a contructor argument or through a setter function. PHPBB3-9716
Diffstat (limited to 'phpBB/common.php')
-rw-r--r--phpBB/common.php9
1 files changed, 8 insertions, 1 deletions
diff --git a/phpBB/common.php b/phpBB/common.php
index 6cc7abf118..a4be46f987 100644
--- a/phpBB/common.php
+++ b/phpBB/common.php
@@ -195,6 +195,9 @@ require($phpbb_root_path . 'includes/template.' . $phpEx);
require($phpbb_root_path . 'includes/session.' . $phpEx);
require($phpbb_root_path . 'includes/auth.' . $phpEx);
+require($phpbb_root_path . 'includes/request/deactivated_super_global.' . $phpEx);
+require($phpbb_root_path . 'includes/request/request_interface.' . $phpEx);
+require($phpbb_root_path . 'includes/request/request.' . $phpEx);
require($phpbb_root_path . 'includes/functions.' . $phpEx);
require($phpbb_root_path . 'includes/functions_content.' . $phpEx);
@@ -206,6 +209,7 @@ require($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx);
set_error_handler(defined('PHPBB_MSG_HANDLER') ? PHPBB_MSG_HANDLER : 'msg_handler');
// Instantiate some basic classes
+$request = new phpbb_request();
$user = new user();
$auth = new auth();
$template = new template();
@@ -215,6 +219,9 @@ $db = new $sql_db();
$class_loader = new phpbb_class_loader($phpbb_root_path, '.' . $phpEx, $cache);
$class_loader->register();
+// make sure request_var uses this request instance
+request_var($request, 0); // "dependency injection" for a function
+
// Connect to DB
$db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false, defined('PHPBB_DB_NEW_LINK') ? PHPBB_DB_NEW_LINK : false);
@@ -233,4 +240,4 @@ foreach ($cache->obtain_hooks() as $hook)
@include($phpbb_root_path . 'includes/hooks/' . $hook . '.' . $phpEx);
}
-?> \ No newline at end of file
+?>