From 85055ac97fa57ca339924cef719115d85bdf6c2e Mon Sep 17 00:00:00 2001 From: David M Date: Thu, 3 Jan 2008 17:00:40 +0000 Subject: oh boy... - Migrate code base to PHP 5.1+ git-svn-id: file:///svn/phpbb/trunk@8295 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/common.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'phpBB/common.php') diff --git a/phpBB/common.php b/phpBB/common.php index ebffd46228..3e880076bf 100644 --- a/phpBB/common.php +++ b/phpBB/common.php @@ -20,7 +20,7 @@ $starttime = explode(' ', microtime()); $starttime = $starttime[1] + $starttime[0]; // Report all errors, except notices -error_reporting(E_ALL ^ E_NOTICE); +error_reporting(E_ALL | E_STRICT); /* * Remove variables created by register_globals from the global scope @@ -199,7 +199,7 @@ set_error_handler(defined('PHPBB_MSG_HANDLER') ? PHPBB_MSG_HANDLER : 'msg_handle $user = new user(); $auth = new auth(); $template = new template(); -$cache = new cache(); +$cache = new acm(); $db = new $sql_db(); // Connect to DB @@ -209,13 +209,13 @@ $db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false, defined(' unset($dbpasswd); // Grab global variables, re-cache if necessary -$config = $cache->obtain_config(); +$config = cache::obtain_config(); // Add own hook handler require($phpbb_root_path . 'includes/hooks/index.' . $phpEx); $phpbb_hook = new phpbb_hook(array('exit_handler', 'phpbb_user_session_handler', 'append_sid', array('template', 'display'))); -foreach ($cache->obtain_hooks() as $hook) +foreach (cache::obtain_hooks() as $hook) { @include($phpbb_root_path . 'includes/hooks/' . $hook . '.' . $phpEx); } -- cgit v1.2.1 From 4b1b95006835ce0d84e29b4541b3bfba0a6bd225 Mon Sep 17 00:00:00 2001 From: David M Date: Thu, 3 Jan 2008 17:10:17 +0000 Subject: uncomment the second one for ultra debugging power :P git-svn-id: file:///svn/phpbb/trunk@8296 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/common.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'phpBB/common.php') diff --git a/phpBB/common.php b/phpBB/common.php index 3e880076bf..19ec820cfb 100644 --- a/phpBB/common.php +++ b/phpBB/common.php @@ -20,7 +20,8 @@ $starttime = explode(' ', microtime()); $starttime = $starttime[1] + $starttime[0]; // Report all errors, except notices -error_reporting(E_ALL | E_STRICT); +error_reporting(E_ALL ^ E_NOTICE); +//error_reporting(E_ALL | E_STRICT); /* * Remove variables created by register_globals from the global scope -- cgit v1.2.1 From 140746089594307c9bc2ad084ea2355dcbddbe16 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Tue, 29 Jan 2008 15:57:56 +0000 Subject: Merging revisions #r8346, #r8347 and #r8348 git-svn-id: file:///svn/phpbb/trunk@8349 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/common.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'phpBB/common.php') diff --git a/phpBB/common.php b/phpBB/common.php index 19ec820cfb..b91fd01706 100644 --- a/phpBB/common.php +++ b/phpBB/common.php @@ -132,7 +132,7 @@ if (!defined('PHPBB_INSTALLED')) // Redirect the user to the installer // We have to generate a full HTTP/1.1 header here since we can't guarantee to have any of the information // available as used by the redirect function - $server_name = (!empty($_SERVER['SERVER_NAME'])) ? $_SERVER['SERVER_NAME'] : getenv('SERVER_NAME'); + $server_name = (!empty($_SERVER['HTTP_HOST'])) ? strtolower($_SERVER['HTTP_HOST']) : ((!empty($_SERVER['SERVER_NAME'])) ? $_SERVER['SERVER_NAME'] : getenv('SERVER_NAME')); $server_port = (!empty($_SERVER['SERVER_PORT'])) ? (int) $_SERVER['SERVER_PORT'] : (int) getenv('SERVER_PORT'); $secure = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 1 : 0; @@ -151,7 +151,11 @@ if (!defined('PHPBB_INSTALLED')) if ($server_port && (($secure && $server_port <> 443) || (!$secure && $server_port <> 80))) { - $url .= ':' . $server_port; + // HTTP HOST can carry a port number... + if (strpos($server_name, ':') === false) + { + $url .= ':' . $server_port; + } } $url .= $script_path; -- cgit v1.2.1 From 5417ec5c4d2e1b7fd1a6b9935a294e7f2af9b793 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Mon, 24 Mar 2008 00:59:39 +0000 Subject: - add error_reporting to style.php (merge from r8464) - let the error handler deal with E_STRICT (same as E_WARNING/E_NOTICE) and E_RECOVERABLE_ERROR (same as E_USER_ERROR) git-svn-id: file:///svn/phpbb/trunk@8466 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/common.php | 1 - 1 file changed, 1 deletion(-) (limited to 'phpBB/common.php') diff --git a/phpBB/common.php b/phpBB/common.php index b91fd01706..5f4216d1d7 100644 --- a/phpBB/common.php +++ b/phpBB/common.php @@ -21,7 +21,6 @@ $starttime = $starttime[1] + $starttime[0]; // Report all errors, except notices error_reporting(E_ALL ^ E_NOTICE); -//error_reporting(E_ALL | E_STRICT); /* * Remove variables created by register_globals from the global scope -- cgit v1.2.1 From 6a30daeb5958bec5e0a814bc2ce732d1e3c502e3 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Mon, 24 Mar 2008 01:04:27 +0000 Subject: not sure what the implications of this quick fix are, especially when upgrading from earlier versions we either have to use a different timezone depending on the server or fix timestamps on update, though shouldn't they be gmt already? git-svn-id: file:///svn/phpbb/trunk@8467 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/common.php | 1 + 1 file changed, 1 insertion(+) (limited to 'phpBB/common.php') diff --git a/phpBB/common.php b/phpBB/common.php index 5f4216d1d7..02b18d6aa1 100644 --- a/phpBB/common.php +++ b/phpBB/common.php @@ -21,6 +21,7 @@ $starttime = $starttime[1] + $starttime[0]; // Report all errors, except notices error_reporting(E_ALL ^ E_NOTICE); +date_default_timezone_set('UTC'); /* * Remove variables created by register_globals from the global scope -- cgit v1.2.1 From 0c1fa73423b230401eff5c1aeeeffeaefd97a1ac Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Mon, 26 May 2008 12:03:22 +0000 Subject: git-svn-id: file:///svn/phpbb/trunk@8569 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/common.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/common.php') diff --git a/phpBB/common.php b/phpBB/common.php index 02b18d6aa1..285bc3a7ad 100644 --- a/phpBB/common.php +++ b/phpBB/common.php @@ -6,7 +6,7 @@ * @copyright (c) 2005 phpBB Group * @license http://opensource.org/licenses/gpl-license.php GNU Public License * -* Minimum Requirement: PHP 4.3.3 +* Minimum Requirement: PHP 5.2.0+ */ /** -- cgit v1.2.1 From 2f4a618900e2c3b6ea14c68cbeb5897cd2ac1a04 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Thu, 29 May 2008 12:25:56 +0000 Subject: ok... i hope i haven't messed too much with the code and everything is still working. Changes: - Ascraeus now uses constants for the phpbb root path and the php extension. This ensures more security for external applications and modifications (no more overwriting of root path and extension possible through insecure mods and register globals enabled) as well as no more globalizing needed. - A second change implemented here is an additional short-hand-notation for append_sid(). It is allowed to omit the root path and extension now (for example calling append_sid('memberlist')) - in this case the root path and extension get added automatically. The hook is called after these are added. git-svn-id: file:///svn/phpbb/trunk@8572 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/common.php | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) (limited to 'phpBB/common.php') diff --git a/phpBB/common.php b/phpBB/common.php index 285bc3a7ad..de4d41beae 100644 --- a/phpBB/common.php +++ b/phpBB/common.php @@ -117,15 +117,15 @@ else if (defined('IN_CRON')) { - $phpbb_root_path = dirname(__FILE__) . DIRECTORY_SEPARATOR; + @define('PHPBB_ROOT_PATH', dirname(__FILE__) . DIRECTORY_SEPARATOR); } -if (!file_exists($phpbb_root_path . 'config.' . $phpEx)) +if (!file_exists(PHPBB_ROOT_PATH . 'config.' . PHP_EXT)) { - die("

The config.$phpEx file could not be found.

Click here to install phpBB

"); + die('

The config.' . PHP_EXT . ' file could not be found.

Click here to install phpBB

'); } -require($phpbb_root_path . 'config.' . $phpEx); +require(PHPBB_ROOT_PATH . 'config.' . PHP_EXT); if (!defined('PHPBB_INSTALLED')) { @@ -144,7 +144,7 @@ if (!defined('PHPBB_INSTALLED')) // Replace any number of consecutive backslashes and/or slashes with a single slash // (could happen on some proxy setups and/or Windows servers) - $script_path = trim(dirname($script_name)) . '/install/index.' . $phpEx; + $script_path = trim(dirname($script_name)) . '/install/index.' . PHP_EXT; $script_path = preg_replace('#[\\\\/]{2,}#', '/', $script_path); $url = (($secure) ? 'https://' : 'http://') . $server_name; @@ -184,18 +184,18 @@ if (!empty($load_extensions)) } // Include files -require($phpbb_root_path . 'includes/acm/acm_' . $acm_type . '.' . $phpEx); -require($phpbb_root_path . 'includes/cache.' . $phpEx); -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/acm/acm_' . $acm_type . '.' . PHP_EXT); +require(PHPBB_ROOT_PATH . 'includes/cache.' . PHP_EXT); +require(PHPBB_ROOT_PATH . 'includes/template.' . PHP_EXT); +require(PHPBB_ROOT_PATH . 'includes/session.' . PHP_EXT); +require(PHPBB_ROOT_PATH . 'includes/auth.' . PHP_EXT); -require($phpbb_root_path . 'includes/functions.' . $phpEx); -require($phpbb_root_path . 'includes/functions_content.' . $phpEx); +require(PHPBB_ROOT_PATH . 'includes/functions.' . PHP_EXT); +require(PHPBB_ROOT_PATH . 'includes/functions_content.' . PHP_EXT); -require($phpbb_root_path . 'includes/constants.' . $phpEx); -require($phpbb_root_path . 'includes/db/' . $dbms . '.' . $phpEx); -require($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx); +require(PHPBB_ROOT_PATH . 'includes/constants.' . PHP_EXT); +require(PHPBB_ROOT_PATH . 'includes/db/' . $dbms . '.' . PHP_EXT); +require(PHPBB_ROOT_PATH . 'includes/utf/utf_tools.' . PHP_EXT); // Set PHP error handler to ours set_error_handler(defined('PHPBB_MSG_HANDLER') ? PHPBB_MSG_HANDLER : 'msg_handler'); @@ -217,12 +217,12 @@ unset($dbpasswd); $config = cache::obtain_config(); // Add own hook handler -require($phpbb_root_path . 'includes/hooks/index.' . $phpEx); +require(PHPBB_ROOT_PATH . 'includes/hooks/index.' . PHP_EXT); $phpbb_hook = new phpbb_hook(array('exit_handler', 'phpbb_user_session_handler', 'append_sid', array('template', 'display'))); foreach (cache::obtain_hooks() as $hook) { - @include($phpbb_root_path . 'includes/hooks/' . $hook . '.' . $phpEx); + @include(PHPBB_ROOT_PATH . 'includes/hooks/' . $hook . '.' . PHP_EXT); } ?> \ No newline at end of file -- cgit v1.2.1 From 4235be4bcb07a121afd0b6a202fb7b3823dcce67 Mon Sep 17 00:00:00 2001 From: "Marek A. R" Date: Fri, 15 Aug 2008 13:00:20 +0000 Subject: PHP5.3 compatibility. git-svn-id: file:///svn/phpbb/trunk@8759 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/common.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/common.php') diff --git a/phpBB/common.php b/phpBB/common.php index de4d41beae..97c02d4a23 100644 --- a/phpBB/common.php +++ b/phpBB/common.php @@ -104,7 +104,7 @@ if (version_compare(PHP_VERSION, '6.0.0-dev', '>=')) } else { - set_magic_quotes_runtime(0); + @set_magic_quotes_runtime(0); // Be paranoid with passed vars if (@ini_get('register_globals') == '1' || strtolower(@ini_get('register_globals')) == 'on' || !function_exists('ini_get')) -- cgit v1.2.1 From 07e9b83a3de0264916a058b9cf180b91b297604f Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Mon, 24 Nov 2008 00:20:33 +0000 Subject: - updated all code to use the request class instead of any direct access to super globals - disabled super globals in common.php. See commit r9101 for more information - cleaned up/simplified a few lines along the way. git-svn-id: file:///svn/phpbb/trunk@9102 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/common.php | 3 +++ 1 file changed, 3 insertions(+) (limited to 'phpBB/common.php') diff --git a/phpBB/common.php b/phpBB/common.php index 97c02d4a23..882e782ebb 100644 --- a/phpBB/common.php +++ b/phpBB/common.php @@ -200,6 +200,9 @@ require(PHPBB_ROOT_PATH . 'includes/utf/utf_tools.' . PHP_EXT); // Set PHP error handler to ours set_error_handler(defined('PHPBB_MSG_HANDLER') ? PHPBB_MSG_HANDLER : 'msg_handler'); +// enforce the use of the request class +request::disable_super_globals(); + // Instantiate some basic classes $user = new user(); $auth = new auth(); -- cgit v1.2.1 From 3cd007c49d776b4e76f939dbd7d7c328bd09abe9 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Wed, 24 Dec 2008 14:44:19 +0000 Subject: change cache:: to phpbb_cache:: git-svn-id: file:///svn/phpbb/trunk@9226 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/common.php | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) (limited to 'phpBB/common.php') diff --git a/phpBB/common.php b/phpBB/common.php index 882e782ebb..8e4bf8a331 100644 --- a/phpBB/common.php +++ b/phpBB/common.php @@ -217,15 +217,6 @@ $db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false, defined(' unset($dbpasswd); // Grab global variables, re-cache if necessary -$config = cache::obtain_config(); - -// Add own hook handler -require(PHPBB_ROOT_PATH . 'includes/hooks/index.' . PHP_EXT); -$phpbb_hook = new phpbb_hook(array('exit_handler', 'phpbb_user_session_handler', 'append_sid', array('template', 'display'))); - -foreach (cache::obtain_hooks() as $hook) -{ - @include(PHPBB_ROOT_PATH . 'includes/hooks/' . $hook . '.' . PHP_EXT); -} +$config = phpbb_cache::obtain_config(); ?> \ No newline at end of file -- cgit v1.2.1 From 5b9a3c9a7d8f8e4590dddf4440ac82c30ef3f730 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Thu, 25 Dec 2008 14:47:57 +0000 Subject: add nils' request and super globals class rename request:: to phpbb_request:: git-svn-id: file:///svn/phpbb/trunk@9230 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/common.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/common.php') diff --git a/phpBB/common.php b/phpBB/common.php index 8e4bf8a331..2123158861 100644 --- a/phpBB/common.php +++ b/phpBB/common.php @@ -201,7 +201,7 @@ require(PHPBB_ROOT_PATH . 'includes/utf/utf_tools.' . PHP_EXT); set_error_handler(defined('PHPBB_MSG_HANDLER') ? PHPBB_MSG_HANDLER : 'msg_handler'); // enforce the use of the request class -request::disable_super_globals(); +phpbb_request::disable_super_globals(); // Instantiate some basic classes $user = new user(); -- cgit v1.2.1 From 705d706a7f229857b0627c320b7cfe7f8432b51c Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Fri, 26 Dec 2008 16:29:21 +0000 Subject: Add core bootstrap. Also change common.php to use it. git-svn-id: file:///svn/phpbb/trunk@9231 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/common.php | 189 +++++++++++-------------------------------------------- 1 file changed, 36 insertions(+), 153 deletions(-) (limited to 'phpBB/common.php') diff --git a/phpBB/common.php b/phpBB/common.php index 2123158861..c954df414d 100644 --- a/phpBB/common.php +++ b/phpBB/common.php @@ -7,6 +7,8 @@ * @license http://opensource.org/licenses/gpl-license.php GNU Public License * * Minimum Requirement: PHP 5.2.0+ +* +* Within this file the framework with all components as well as all phpBB-specific things will be loaded */ /** @@ -16,118 +18,11 @@ if (!defined('IN_PHPBB')) exit; } -$starttime = explode(' ', microtime()); -$starttime = $starttime[1] + $starttime[0]; - -// Report all errors, except notices -error_reporting(E_ALL ^ E_NOTICE); -date_default_timezone_set('UTC'); - -/* -* Remove variables created by register_globals from the global scope -* Thanks to Matt Kavanagh -*/ -function deregister_globals() -{ - $not_unset = array( - 'GLOBALS' => true, - '_GET' => true, - '_POST' => true, - '_COOKIE' => true, - '_REQUEST' => true, - '_SERVER' => true, - '_SESSION' => true, - '_ENV' => true, - '_FILES' => true, - 'phpEx' => true, - 'phpbb_root_path' => true - ); - - // Not only will array_merge and array_keys give a warning if - // a parameter is not an array, array_merge will actually fail. - // So we check if _SESSION has been initialised. - if (!isset($_SESSION) || !is_array($_SESSION)) - { - $_SESSION = array(); - } - - // Merge all into one extremely huge array; unset this later - $input = array_merge( - array_keys($_GET), - array_keys($_POST), - array_keys($_COOKIE), - array_keys($_SERVER), - array_keys($_SESSION), - array_keys($_ENV), - array_keys($_FILES) - ); - - foreach ($input as $varname) - { - if (isset($not_unset[$varname])) - { - // Hacking attempt. No point in continuing unless it's a COOKIE - if ($varname !== 'GLOBALS' || isset($_GET['GLOBALS']) || isset($_POST['GLOBALS']) || isset($_SERVER['GLOBALS']) || isset($_SESSION['GLOBALS']) || isset($_ENV['GLOBALS']) || isset($_FILES['GLOBALS'])) - { - exit; - } - else - { - $cookie = &$_COOKIE; - while (isset($cookie['GLOBALS'])) - { - foreach ($cookie['GLOBALS'] as $registered_var => $value) - { - if (!isset($not_unset[$registered_var])) - { - unset($GLOBALS[$registered_var]); - } - } - $cookie = &$cookie['GLOBALS']; - } - } - } - - unset($GLOBALS[$varname]); - } - - unset($input); -} - -// If we are on PHP >= 6.0.0 we do not need some code -if (version_compare(PHP_VERSION, '6.0.0-dev', '>=')) -{ - /** - * @ignore - */ - define('STRIP', false); -} -else -{ - @set_magic_quotes_runtime(0); - - // Be paranoid with passed vars - if (@ini_get('register_globals') == '1' || strtolower(@ini_get('register_globals')) == 'on' || !function_exists('ini_get')) - { - deregister_globals(); - } - - define('STRIP', (get_magic_quotes_gpc()) ? true : false); -} - -if (defined('IN_CRON')) -{ - @define('PHPBB_ROOT_PATH', dirname(__FILE__) . DIRECTORY_SEPARATOR); -} - -if (!file_exists(PHPBB_ROOT_PATH . 'config.' . PHP_EXT)) -{ - die('

The config.' . PHP_EXT . ' file could not be found.

Click here to install phpBB

'); -} - -require(PHPBB_ROOT_PATH . 'config.' . PHP_EXT); +// Init Framework +require PHPBB_ROOT_PATH . 'includes/core/bootstrap.' . PHP_EXT; -if (!defined('PHPBB_INSTALLED')) +// Run through remaining Framework states +if (defined('PHPBB_CONFIG_MISSING') || !defined('PHPBB_INSTALLED')) { // Redirect the user to the installer // We have to generate a full HTTP/1.1 header here since we can't guarantee to have any of the information @@ -163,60 +58,48 @@ if (!defined('PHPBB_INSTALLED')) exit; } -if (defined('DEBUG_EXTRA')) +// Set PHP error handler to ours +set_error_handler(defined('PHPBB_MSG_HANDLER') ? PHPBB_MSG_HANDLER : 'msg_handler'); + +// enforce the use of the request class +phpbb_request::disable_super_globals(); + +// @todo Syndicate config variables somehow and check them here. It would be also nice to not have so many global vars from the config file (means: re-think layout of config file, maybe require phpbb:: to be set) + +if (!empty($dbms)) { - $base_memory_usage = 0; - if (function_exists('memory_get_usage')) - { - $base_memory_usage = memory_get_usage(); - } + // Register DB object. + phpbb::assign('db', phpbb_db_dbal::connect($dbms, $dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false, defined('PHPBB_DB_NEW_LINK') ? PHPBB_DB_NEW_LINK : false)); } -// Load Extensions -if (!empty($load_extensions)) +// We do not need the db password any longer, unset for safety purposes +if (!empty($dbpasswd)) { - $load_extensions = explode(',', $load_extensions); - - foreach ($load_extensions as $extension) - { - @dl(trim($extension)); - } + unset($dbpasswd); } -// Include files -require(PHPBB_ROOT_PATH . 'includes/acm/acm_' . $acm_type . '.' . PHP_EXT); -require(PHPBB_ROOT_PATH . 'includes/cache.' . PHP_EXT); -require(PHPBB_ROOT_PATH . 'includes/template.' . PHP_EXT); -require(PHPBB_ROOT_PATH . 'includes/session.' . PHP_EXT); -require(PHPBB_ROOT_PATH . 'includes/auth.' . PHP_EXT); - -require(PHPBB_ROOT_PATH . 'includes/functions.' . PHP_EXT); -require(PHPBB_ROOT_PATH . 'includes/functions_content.' . PHP_EXT); +// Register Cache Manager +phpbb::register('acm'); -require(PHPBB_ROOT_PATH . 'includes/constants.' . PHP_EXT); -require(PHPBB_ROOT_PATH . 'includes/db/' . $dbms . '.' . PHP_EXT); -require(PHPBB_ROOT_PATH . 'includes/utf/utf_tools.' . PHP_EXT); +// Grab global variables +phpbb_cache::obtain_config(); -// Set PHP error handler to ours -set_error_handler(defined('PHPBB_MSG_HANDLER') ? PHPBB_MSG_HANDLER : 'msg_handler'); +// Register Template +phpbb::register('template'); -// enforce the use of the request class -phpbb_request::disable_super_globals(); +// Register permission class +phpbb::register('acl'); -// Instantiate some basic classes -$user = new user(); -$auth = new auth(); -$template = new template(); -$cache = new acm(); -$db = new $sql_db(); +// Register user object +phpbb::register('user', false, false, phpbb::$config['auth_method']); -// Connect to DB -$db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false, defined('PHPBB_DB_NEW_LINK') ? PHPBB_DB_NEW_LINK : false); +// Register API +phpbb::register('api'); -// We do not need this any longer, unset for safety purposes -unset($dbpasswd); +// Register Plugins +phpbb::$plugins->init(PHPBB_ROOT_PATH . 'plugins/'); -// Grab global variables, re-cache if necessary -$config = phpbb_cache::obtain_config(); +// Setup Plugins +phpbb::$plugins->setup(); ?> \ No newline at end of file -- cgit v1.2.1 From fbaf2baa8d683a2afdd3cf98ea1e7c035369f1a3 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Sun, 28 Dec 2008 10:53:28 +0000 Subject: document plugin-support move language path declaration to object instantiation git-svn-id: file:///svn/phpbb/trunk@9239 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/common.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/common.php') diff --git a/phpBB/common.php b/phpBB/common.php index c954df414d..328125999c 100644 --- a/phpBB/common.php +++ b/phpBB/common.php @@ -91,7 +91,7 @@ phpbb::register('template'); phpbb::register('acl'); // Register user object -phpbb::register('user', false, false, phpbb::$config['auth_method']); +phpbb::register('user', false, false, phpbb::$config['auth_method'], PHPBB_ROOT_PATH . 'languages/'); // Register API phpbb::register('api'); -- cgit v1.2.1 From 889fa871402814874d5d4f01b2f1c829d8206eb9 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Sun, 28 Dec 2008 13:27:58 +0000 Subject: implement new phpbb::$acm object, replacing $cache global git-svn-id: file:///svn/phpbb/trunk@9240 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/common.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/common.php') diff --git a/phpBB/common.php b/phpBB/common.php index 328125999c..b898effead 100644 --- a/phpBB/common.php +++ b/phpBB/common.php @@ -69,7 +69,7 @@ phpbb_request::disable_super_globals(); if (!empty($dbms)) { // Register DB object. - phpbb::assign('db', phpbb_db_dbal::connect($dbms, $dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false, defined('PHPBB_DB_NEW_LINK') ? PHPBB_DB_NEW_LINK : false)); + //phpbb::assign('db', phpbb_db_dbal::connect($dbms, $dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false, defined('PHPBB_DB_NEW_LINK') ? PHPBB_DB_NEW_LINK : false)); } // We do not need the db password any longer, unset for safety purposes -- cgit v1.2.1 From 11e76473aaf0120a96edb4d3a96800603bffcc48 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Tue, 30 Dec 2008 17:20:50 +0000 Subject: fix some functions git-svn-id: file:///svn/phpbb/trunk@9245 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/common.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'phpBB/common.php') diff --git a/phpBB/common.php b/phpBB/common.php index b898effead..bacaf2e7a7 100644 --- a/phpBB/common.php +++ b/phpBB/common.php @@ -69,7 +69,7 @@ phpbb_request::disable_super_globals(); if (!empty($dbms)) { // Register DB object. - //phpbb::assign('db', phpbb_db_dbal::connect($dbms, $dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false, defined('PHPBB_DB_NEW_LINK') ? PHPBB_DB_NEW_LINK : false)); + phpbb::assign('db', phpbb_db_dbal::connect($dbms, $dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false, defined('PHPBB_DB_NEW_LINK') ? PHPBB_DB_NEW_LINK : false)); } // We do not need the db password any longer, unset for safety purposes @@ -91,10 +91,10 @@ phpbb::register('template'); phpbb::register('acl'); // Register user object -phpbb::register('user', false, false, phpbb::$config['auth_method'], PHPBB_ROOT_PATH . 'languages/'); +phpbb::register('user', false, false, phpbb::$config['auth_method'], PHPBB_ROOT_PATH . 'language/'); // Register API -phpbb::register('api'); +// phpbb::register('api'); // Register Plugins phpbb::$plugins->init(PHPBB_ROOT_PATH . 'plugins/'); -- cgit v1.2.1 From 4a58254120574c8c7317f45af982152a2ed13650 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Tue, 13 Jan 2009 18:29:58 +0000 Subject: in case we do: include(bootstrap) ... include(common) git-svn-id: file:///svn/phpbb/trunk@9260 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/common.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/common.php') diff --git a/phpBB/common.php b/phpBB/common.php index bacaf2e7a7..5e1bfedf38 100644 --- a/phpBB/common.php +++ b/phpBB/common.php @@ -19,7 +19,7 @@ if (!defined('IN_PHPBB')) } // Init Framework -require PHPBB_ROOT_PATH . 'includes/core/bootstrap.' . PHP_EXT; +require_once PHPBB_ROOT_PATH . 'includes/core/bootstrap.' . PHP_EXT; // Run through remaining Framework states if (defined('PHPBB_CONFIG_MISSING') || !defined('PHPBB_INSTALLED')) -- cgit v1.2.1 From 2a38e4d283175c280cefdf4b7c09a58396548f68 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Tue, 13 Jan 2009 18:32:51 +0000 Subject: erm, revert last commit and add relevant comment. ;) This actually allows us to do far more... for example call a config file which was non-existent before. git-svn-id: file:///svn/phpbb/trunk@9261 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/common.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'phpBB/common.php') diff --git a/phpBB/common.php b/phpBB/common.php index 5e1bfedf38..b0db9ad5b2 100644 --- a/phpBB/common.php +++ b/phpBB/common.php @@ -18,8 +18,8 @@ if (!defined('IN_PHPBB')) exit; } -// Init Framework -require_once PHPBB_ROOT_PATH . 'includes/core/bootstrap.' . PHP_EXT; +// Init Framework - do not change to require_once ;) +require PHPBB_ROOT_PATH . 'includes/core/bootstrap.' . PHP_EXT; // Run through remaining Framework states if (defined('PHPBB_CONFIG_MISSING') || !defined('PHPBB_INSTALLED')) -- cgit v1.2.1 From cd4091af43fa2d7d3dbe5ad0d583c63f1d96c903 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Tue, 20 Jan 2009 16:54:15 +0000 Subject: i am not sure if people will like the config layout i test here... it requires the framework at least being present git-svn-id: file:///svn/phpbb/trunk@9281 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/common.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'phpBB/common.php') diff --git a/phpBB/common.php b/phpBB/common.php index b0db9ad5b2..aa72b83612 100644 --- a/phpBB/common.php +++ b/phpBB/common.php @@ -22,7 +22,7 @@ if (!defined('IN_PHPBB')) require PHPBB_ROOT_PATH . 'includes/core/bootstrap.' . PHP_EXT; // Run through remaining Framework states -if (defined('PHPBB_CONFIG_MISSING') || !defined('PHPBB_INSTALLED')) +if (!phpbb::$base_config['config_set'] || !phpbb::$base_config['installed']) { // Redirect the user to the installer // We have to generate a full HTTP/1.1 header here since we can't guarantee to have any of the information @@ -66,16 +66,16 @@ phpbb_request::disable_super_globals(); // @todo Syndicate config variables somehow and check them here. It would be also nice to not have so many global vars from the config file (means: re-think layout of config file, maybe require phpbb:: to be set) -if (!empty($dbms)) +if (!empty(phpbb::$base_config['dbms'])) { // Register DB object. - phpbb::assign('db', phpbb_db_dbal::connect($dbms, $dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false, defined('PHPBB_DB_NEW_LINK') ? PHPBB_DB_NEW_LINK : false)); + phpbb::assign('db', phpbb_db_dbal::connect(phpbb::$base_config['dbms'], phpbb::$base_config['dbhost'], phpbb::$base_config['dbuser'], phpbb::$base_config['dbpasswd'], phpbb::$base_config['dbname'], phpbb::$base_config['dbport'], false, defined('PHPBB_DB_NEW_LINK') ? PHPBB_DB_NEW_LINK : false)); } // We do not need the db password any longer, unset for safety purposes -if (!empty($dbpasswd)) +if (!empty(phpbb::$base_config['dbpasswd'])) { - unset($dbpasswd); + unset(phpbb::$base_config['dbpasswd']); } // Register Cache Manager -- cgit v1.2.1 From bf8ac19eaa8d74f9dfd6d597190f5664e7339382 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Sun, 4 Oct 2009 18:13:59 +0000 Subject: Move trunk/phpBB to old_trunk/phpBB git-svn-id: file:///svn/phpbb/trunk@10210 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/common.php | 105 ------------------------------------------------------- 1 file changed, 105 deletions(-) delete mode 100644 phpBB/common.php (limited to 'phpBB/common.php') diff --git a/phpBB/common.php b/phpBB/common.php deleted file mode 100644 index aa72b83612..0000000000 --- a/phpBB/common.php +++ /dev/null @@ -1,105 +0,0 @@ - 443) || (!$secure && $server_port <> 80))) - { - // HTTP HOST can carry a port number... - if (strpos($server_name, ':') === false) - { - $url .= ':' . $server_port; - } - } - - $url .= $script_path; - header('Location: ' . $url); - exit; -} - -// Set PHP error handler to ours -set_error_handler(defined('PHPBB_MSG_HANDLER') ? PHPBB_MSG_HANDLER : 'msg_handler'); - -// enforce the use of the request class -phpbb_request::disable_super_globals(); - -// @todo Syndicate config variables somehow and check them here. It would be also nice to not have so many global vars from the config file (means: re-think layout of config file, maybe require phpbb:: to be set) - -if (!empty(phpbb::$base_config['dbms'])) -{ - // Register DB object. - phpbb::assign('db', phpbb_db_dbal::connect(phpbb::$base_config['dbms'], phpbb::$base_config['dbhost'], phpbb::$base_config['dbuser'], phpbb::$base_config['dbpasswd'], phpbb::$base_config['dbname'], phpbb::$base_config['dbport'], false, defined('PHPBB_DB_NEW_LINK') ? PHPBB_DB_NEW_LINK : false)); -} - -// We do not need the db password any longer, unset for safety purposes -if (!empty(phpbb::$base_config['dbpasswd'])) -{ - unset(phpbb::$base_config['dbpasswd']); -} - -// Register Cache Manager -phpbb::register('acm'); - -// Grab global variables -phpbb_cache::obtain_config(); - -// Register Template -phpbb::register('template'); - -// Register permission class -phpbb::register('acl'); - -// Register user object -phpbb::register('user', false, false, phpbb::$config['auth_method'], PHPBB_ROOT_PATH . 'language/'); - -// Register API -// phpbb::register('api'); - -// Register Plugins -phpbb::$plugins->init(PHPBB_ROOT_PATH . 'plugins/'); - -// Setup Plugins -phpbb::$plugins->setup(); - -?> \ No newline at end of file -- cgit v1.2.1 From 2e17e448deed073f8614bb555a8ef20c57291c2a Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Sun, 4 Oct 2009 18:14:59 +0000 Subject: Copy 3.0.x branch to trunk git-svn-id: file:///svn/phpbb/trunk@10211 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/common.php | 227 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 227 insertions(+) create mode 100644 phpBB/common.php (limited to 'phpBB/common.php') diff --git a/phpBB/common.php b/phpBB/common.php new file mode 100644 index 0000000000..c4a3160102 --- /dev/null +++ b/phpBB/common.php @@ -0,0 +1,227 @@ + true, + '_GET' => true, + '_POST' => true, + '_COOKIE' => true, + '_REQUEST' => true, + '_SERVER' => true, + '_SESSION' => true, + '_ENV' => true, + '_FILES' => true, + 'phpEx' => true, + 'phpbb_root_path' => true + ); + + // Not only will array_merge and array_keys give a warning if + // a parameter is not an array, array_merge will actually fail. + // So we check if _SESSION has been initialised. + if (!isset($_SESSION) || !is_array($_SESSION)) + { + $_SESSION = array(); + } + + // Merge all into one extremely huge array; unset this later + $input = array_merge( + array_keys($_GET), + array_keys($_POST), + array_keys($_COOKIE), + array_keys($_SERVER), + array_keys($_SESSION), + array_keys($_ENV), + array_keys($_FILES) + ); + + foreach ($input as $varname) + { + if (isset($not_unset[$varname])) + { + // Hacking attempt. No point in continuing unless it's a COOKIE + if ($varname !== 'GLOBALS' || isset($_GET['GLOBALS']) || isset($_POST['GLOBALS']) || isset($_SERVER['GLOBALS']) || isset($_SESSION['GLOBALS']) || isset($_ENV['GLOBALS']) || isset($_FILES['GLOBALS'])) + { + exit; + } + else + { + $cookie = &$_COOKIE; + while (isset($cookie['GLOBALS'])) + { + foreach ($cookie['GLOBALS'] as $registered_var => $value) + { + if (!isset($not_unset[$registered_var])) + { + unset($GLOBALS[$registered_var]); + } + } + $cookie = &$cookie['GLOBALS']; + } + } + } + + unset($GLOBALS[$varname]); + } + + unset($input); +} + +// If we are on PHP >= 6.0.0 we do not need some code +if (version_compare(PHP_VERSION, '6.0.0-dev', '>=')) +{ + /** + * @ignore + */ + define('STRIP', false); +} +else +{ + @set_magic_quotes_runtime(0); + + // Be paranoid with passed vars + if (@ini_get('register_globals') == '1' || strtolower(@ini_get('register_globals')) == 'on' || !function_exists('ini_get')) + { + deregister_globals(); + } + + define('STRIP', (get_magic_quotes_gpc()) ? true : false); +} + +if (defined('IN_CRON')) +{ + $phpbb_root_path = dirname(__FILE__) . DIRECTORY_SEPARATOR; +} + +if (!file_exists($phpbb_root_path . 'config.' . $phpEx)) +{ + die("

The config.$phpEx file could not be found.

Click here to install phpBB

"); +} + +require($phpbb_root_path . 'config.' . $phpEx); + +if (!defined('PHPBB_INSTALLED')) +{ + // Redirect the user to the installer + // We have to generate a full HTTP/1.1 header here since we can't guarantee to have any of the information + // available as used by the redirect function + $server_name = (!empty($_SERVER['HTTP_HOST'])) ? strtolower($_SERVER['HTTP_HOST']) : ((!empty($_SERVER['SERVER_NAME'])) ? $_SERVER['SERVER_NAME'] : getenv('SERVER_NAME')); + $server_port = (!empty($_SERVER['SERVER_PORT'])) ? (int) $_SERVER['SERVER_PORT'] : (int) getenv('SERVER_PORT'); + $secure = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 1 : 0; + + $script_name = (!empty($_SERVER['PHP_SELF'])) ? $_SERVER['PHP_SELF'] : getenv('PHP_SELF'); + if (!$script_name) + { + $script_name = (!empty($_SERVER['REQUEST_URI'])) ? $_SERVER['REQUEST_URI'] : getenv('REQUEST_URI'); + } + + // Replace any number of consecutive backslashes and/or slashes with a single slash + // (could happen on some proxy setups and/or Windows servers) + $script_path = trim(dirname($script_name)) . '/install/index.' . $phpEx; + $script_path = preg_replace('#[\\\\/]{2,}#', '/', $script_path); + + $url = (($secure) ? 'https://' : 'http://') . $server_name; + + if ($server_port && (($secure && $server_port <> 443) || (!$secure && $server_port <> 80))) + { + // HTTP HOST can carry a port number... + if (strpos($server_name, ':') === false) + { + $url .= ':' . $server_port; + } + } + + $url .= $script_path; + header('Location: ' . $url); + exit; +} + +if (defined('DEBUG_EXTRA')) +{ + $base_memory_usage = 0; + if (function_exists('memory_get_usage')) + { + $base_memory_usage = memory_get_usage(); + } +} + +// Load Extensions +if (!empty($load_extensions)) +{ + $load_extensions = explode(',', $load_extensions); + + foreach ($load_extensions as $extension) + { + @dl(trim($extension)); + } +} + +// Include files +require($phpbb_root_path . 'includes/acm/acm_' . $acm_type . '.' . $phpEx); +require($phpbb_root_path . 'includes/cache.' . $phpEx); +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/functions.' . $phpEx); +require($phpbb_root_path . 'includes/functions_content.' . $phpEx); + +require($phpbb_root_path . 'includes/constants.' . $phpEx); +require($phpbb_root_path . 'includes/db/' . $dbms . '.' . $phpEx); +require($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx); + +// Set PHP error handler to ours +set_error_handler(defined('PHPBB_MSG_HANDLER') ? PHPBB_MSG_HANDLER : 'msg_handler'); + +// Instantiate some basic classes +$user = new user(); +$auth = new auth(); +$template = new template(); +$cache = new cache(); +$db = new $sql_db(); + +// Connect to DB +$db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false, defined('PHPBB_DB_NEW_LINK') ? PHPBB_DB_NEW_LINK : false); + +// We do not need this any longer, unset for safety purposes +unset($dbpasswd); + +// Grab global variables, re-cache if necessary +$config = $cache->obtain_config(); + +// Add own hook handler +require($phpbb_root_path . 'includes/hooks/index.' . $phpEx); +$phpbb_hook = new phpbb_hook(array('exit_handler', 'phpbb_user_session_handler', 'append_sid', array('template', 'display'))); + +foreach ($cache->obtain_hooks() as $hook) +{ + @include($phpbb_root_path . 'includes/hooks/' . $hook . '.' . $phpEx); +} + +?> \ No newline at end of file -- cgit v1.2.1 From b68de2323d6444b4b3685a98bbcb9500a38e45cb Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Wed, 16 Dec 2009 15:48:23 +0000 Subject: merge changes from 3.0.x branch git-svn-id: file:///svn/phpbb/trunk@10342 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/common.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'phpBB/common.php') diff --git a/phpBB/common.php b/phpBB/common.php index c4a3160102..9b6913e95f 100644 --- a/phpBB/common.php +++ b/phpBB/common.php @@ -19,8 +19,12 @@ if (!defined('IN_PHPBB')) $starttime = explode(' ', microtime()); $starttime = $starttime[1] + $starttime[0]; -// Report all errors, except notices -error_reporting(E_ALL ^ E_NOTICE); +// Report all errors, except notices and deprecation messages +if (!defined('E_DEPRECATED')) +{ + define('E_DEPRECATED', 8192); +} +error_reporting(E_ALL ^ E_NOTICE ^ E_DEPRECATED); /* * Remove variables created by register_globals from the global scope @@ -172,7 +176,8 @@ if (defined('DEBUG_EXTRA')) } // Load Extensions -if (!empty($load_extensions)) +// dl() is deprecated and disabled by default as of PHP 5.3. +if (!empty($load_extensions) && function_exists('dl')) { $load_extensions = explode(',', $load_extensions); -- cgit v1.2.1 From dea1d660fb63b07451f1a43310de359251462644 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Fri, 25 Jun 2010 14:38:53 +0200 Subject: [feature/auto-loading] Added autoloader to common and ensured compatability The autoloader is registered in install without caching, since caching is set up during installation. This provides the same functionality, performance is not a concern during installation anyway. In common.php the autoloader is instantiated after the cache is initialised and is started with the standard cache backend used for other cached values. A few places in the code using class_exists had to be updated to explicitly avoid autoloading, since they are used to check whether a file needs to be included which does not (yet) follow the naming scheme the autoloader follows. PHPBB3-9682 --- phpBB/common.php | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'phpBB/common.php') 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); -- cgit v1.2.1 From 99a3adfba791baabd27f82429fddfbcb82625523 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Wed, 10 Mar 2010 11:09:36 +0100 Subject: [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 --- phpBB/common.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'phpBB/common.php') 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 +?> -- cgit v1.2.1 From 0ae7df8a51129f2ece86f959e2e155d988feb081 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Sat, 13 Mar 2010 11:28:41 +0100 Subject: [feature/request-class] Request class test now uses a type cast helper mock. Removed the dependency of the request class test on having an actual phpbb_type_cast_helper instance, by replacing it with an object mocking the phpbb_type_cast_helper_interface. PHPBB3-9716 --- phpBB/common.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'phpBB/common.php') diff --git a/phpBB/common.php b/phpBB/common.php index a4be46f987..57a1384ee4 100644 --- a/phpBB/common.php +++ b/phpBB/common.php @@ -195,6 +195,8 @@ 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/type_cast_helper_interface.' . $phpEx); +require($phpbb_root_path . 'includes/request/type_cast_helper.' . $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); @@ -209,7 +211,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(); +$request = new phpbb_request(new phpbb_type_cast_helper()); $user = new user(); $auth = new auth(); $template = new template(); @@ -220,7 +222,7 @@ $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 +request_var('', 0, false, false, $request); // "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); -- cgit v1.2.1 From 456de639123ae3da6320bed6140ab69ac9925e74 Mon Sep 17 00:00:00 2001 From: Igor Wiedler Date: Tue, 31 Aug 2010 21:26:50 +0200 Subject: [feature/request-class] Refactor request classes to use autoloading All class names have been adjusted to use a phpbb_request prefix, allowing them to be autoloaded. Also introduces some improvements to autoloading in general. PHPBB3-9716 --- phpBB/common.php | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'phpBB/common.php') diff --git a/phpBB/common.php b/phpBB/common.php index 57a1384ee4..41df3049a1 100644 --- a/phpBB/common.php +++ b/phpBB/common.php @@ -195,11 +195,6 @@ 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/type_cast_helper_interface.' . $phpEx); -require($phpbb_root_path . 'includes/request/type_cast_helper.' . $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); @@ -210,12 +205,18 @@ require($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx); // Set PHP error handler to ours set_error_handler(defined('PHPBB_MSG_HANDLER') ? PHPBB_MSG_HANDLER : 'msg_handler'); +// Cache must be loaded before class loader +$cache = new cache(); + +// Setup class loader first +$class_loader = new phpbb_class_loader($phpbb_root_path, '.' . $phpEx, $cache); +$class_loader->register(); + // Instantiate some basic classes -$request = new phpbb_request(new phpbb_type_cast_helper()); +$request = new phpbb_request(); $user = new user(); $auth = new auth(); $template = new template(); -$cache = new cache(); $db = new $sql_db(); $class_loader = new phpbb_class_loader($phpbb_root_path, '.' . $phpEx, $cache); -- cgit v1.2.1 From 986935c4745195f45cbff74e541ffc98ecac714e Mon Sep 17 00:00:00 2001 From: Igor Wiedler Date: Mon, 27 Sep 2010 22:50:25 +0200 Subject: [feature/request-class] Adjust some trailing newlines PHPBB3-9716 --- phpBB/common.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/common.php') diff --git a/phpBB/common.php b/phpBB/common.php index 41df3049a1..2eba85383d 100644 --- a/phpBB/common.php +++ b/phpBB/common.php @@ -243,4 +243,4 @@ foreach ($cache->obtain_hooks() as $hook) @include($phpbb_root_path . 'includes/hooks/' . $hook . '.' . $phpEx); } -?> +?> \ No newline at end of file -- cgit v1.2.1 From 5de4924c4beabad4100f329ade0af8e7c03c5eff Mon Sep 17 00:00:00 2001 From: Igor Wiedler Date: Wed, 13 Oct 2010 23:10:15 +0200 Subject: [feature/request-class] Remove duplicate class loader from common.php PHPBB3-9716 --- phpBB/common.php | 3 --- 1 file changed, 3 deletions(-) (limited to 'phpBB/common.php') diff --git a/phpBB/common.php b/phpBB/common.php index 2eba85383d..d0955c41a9 100644 --- a/phpBB/common.php +++ b/phpBB/common.php @@ -219,9 +219,6 @@ $auth = new auth(); $template = new template(); $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('', 0, false, false, $request); // "dependency injection" for a function -- cgit v1.2.1 From af5b9a96409d788733fcb1ff367e0c7fb0583702 Mon Sep 17 00:00:00 2001 From: Igor Wiedler Date: Tue, 9 Nov 2010 08:59:25 +0100 Subject: [ticket/9556] Drop php closing tags, add trailing newline Closing tags converted using Oleg's script. remove-php-end-tags.py -a . Trailing newlines added using the following where $ext is file extension. find . -type f -name "*.$ext" -print | xargs printf "e %s\nw\n" | ed -s; Extensions: php, css, html, js, xml. PHPBB3-9556 --- phpBB/common.php | 2 -- 1 file changed, 2 deletions(-) (limited to 'phpBB/common.php') diff --git a/phpBB/common.php b/phpBB/common.php index 1729729a61..96b782a229 100644 --- a/phpBB/common.php +++ b/phpBB/common.php @@ -237,5 +237,3 @@ foreach ($cache->obtain_hooks() as $hook) { @include($phpbb_root_path . 'includes/hooks/' . $hook . '.' . $phpEx); } - -?> \ No newline at end of file -- cgit v1.2.1 From 9329b16ab13f3a4caf107df358c3c58bda2dcd8a Mon Sep 17 00:00:00 2001 From: Igor Wiedler Date: Wed, 3 Nov 2010 18:35:31 +0100 Subject: [task/acm-refactor] Refactor the ACM classes to have a common interface. They are now refered to as cache drivers rather than ACM classes. The additional utility functions from the original cache class have been moved to the cache_service. The class loader is now instantiated without a cache instance and passed one as soon as it is constructed to allow autoloading the cache classes. PHPBB3-9983 --- phpBB/common.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'phpBB/common.php') diff --git a/phpBB/common.php b/phpBB/common.php index 96b782a229..fc6009eb21 100644 --- a/phpBB/common.php +++ b/phpBB/common.php @@ -187,8 +187,6 @@ 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); require($phpbb_root_path . 'includes/session.' . $phpEx); require($phpbb_root_path . 'includes/auth.' . $phpEx); @@ -203,13 +201,15 @@ require($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx); // Set PHP error handler to ours set_error_handler(defined('PHPBB_MSG_HANDLER') ? PHPBB_MSG_HANDLER : 'msg_handler'); -// Cache must be loaded before class loader -$cache = new cache(); - // Setup class loader first -$class_loader = new phpbb_class_loader($phpbb_root_path, '.' . $phpEx, $cache); +$class_loader = new phpbb_class_loader($phpbb_root_path, '.' . $phpEx); $class_loader->register(); +// set up caching +$acm = phpbb_cache_factory::create($acm_type)->get_acm(); +$class_loader->set_acm($acm); +$cache = new phpbb_cache_service($acm); + // Instantiate some basic classes $request = new phpbb_request(); $user = new user(); -- cgit v1.2.1 From 1aef7eb20ee195c7f21d6c5b78653b7c43e669ec Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Sun, 9 Jan 2011 21:09:56 +0100 Subject: [task/acm-refactor] Cleaning up left over mentions of ACM and fixing tests. PHPBB3-9983 --- phpBB/common.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'phpBB/common.php') diff --git a/phpBB/common.php b/phpBB/common.php index fc6009eb21..7b6a407c94 100644 --- a/phpBB/common.php +++ b/phpBB/common.php @@ -206,9 +206,9 @@ $class_loader = new phpbb_class_loader($phpbb_root_path, '.' . $phpEx); $class_loader->register(); // set up caching -$acm = phpbb_cache_factory::create($acm_type)->get_acm(); -$class_loader->set_acm($acm); -$cache = new phpbb_cache_service($acm); +$cache_factory = new phpbb_cache_factory($acm_type); +$class_loader->set_cache($cache_factory->get_driver()); +$cache = $cache_factory->get_service(); // Instantiate some basic classes $request = new phpbb_request(); -- cgit v1.2.1 From fb2642bbc6360dacfd4a3cc9f7e9447b02cb46a1 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Mon, 10 Jan 2011 02:27:18 +0100 Subject: [task/config-class] Implemented a config class to replace the global array. There is a phpbb_config class which simply holds an array and does not persist any data. It implements ArrayAccess, Countable and IteratorAggregate to allow regular use of configuration as if it was still an array. The phpbb_config_db class depends on an instance of the dbal and a cache driver. It obtains the configuration data from cache and database as necessary and persists data to the database. The functions set_config and set_config_count remain for backward compatability but they only call methods on the new config class now instead of directly manipulating the database and cache. PHPBB3-9988 --- phpBB/common.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'phpBB/common.php') diff --git a/phpBB/common.php b/phpBB/common.php index 7b6a407c94..0116516213 100644 --- a/phpBB/common.php +++ b/phpBB/common.php @@ -227,7 +227,9 @@ $db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false, defined(' unset($dbpasswd); // Grab global variables, re-cache if necessary -$config = $cache->obtain_config(); +$config = new phpbb_config_db($db, $cache_factory->get_driver()); +set_config(null, null, null, $config); +set_config_count(null, null, null, $config); // Add own hook handler require($phpbb_root_path . 'includes/hooks/index.' . $phpEx); -- cgit v1.2.1 From 6b1e343d8dae618afd0cb04173749f005c10e376 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Tue, 11 Jan 2011 23:25:51 +0100 Subject: [task/config-class] Always specify the config table to use. PHPBB3-9988 --- phpBB/common.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/common.php') 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); -- cgit v1.2.1 From f11579549d0250733f4a2bd1759adc2db6d587d3 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Wed, 12 Jan 2011 00:28:12 +0100 Subject: [task/config-class] Do not create multiple cache driver instances. Retrieve the driver from the service instead of creating new ones over and over from the factory. PHPBB3-9988 --- phpBB/common.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'phpBB/common.php') diff --git a/phpBB/common.php b/phpBB/common.php index 0c052ae415..0ac7cbbd86 100644 --- a/phpBB/common.php +++ b/phpBB/common.php @@ -207,8 +207,8 @@ $class_loader->register(); // set up caching $cache_factory = new phpbb_cache_factory($acm_type); -$class_loader->set_cache($cache_factory->get_driver()); $cache = $cache_factory->get_service(); +$class_loader->set_cache($cache->get_driver()); // Instantiate some basic classes $request = new phpbb_request(); @@ -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_TABLE); +$config = new phpbb_config_db($db, $cache->get_driver(), CONFIG_TABLE); set_config(null, null, null, $config); set_config_count(null, null, null, $config); -- cgit v1.2.1 From 77d7238eef84f498fc024fa8b9e06f187dd0f2a6 Mon Sep 17 00:00:00 2001 From: Oleg Pudeyev Date: Wed, 14 Apr 2010 16:14:32 -0400 Subject: [feature/system-cron] WIP on making cron tasks runnable via system cron PHPBB3-9596 --- phpBB/common.php | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'phpBB/common.php') diff --git a/phpBB/common.php b/phpBB/common.php index 0ac7cbbd86..3586031c36 100644 --- a/phpBB/common.php +++ b/phpBB/common.php @@ -239,3 +239,9 @@ foreach ($cache->obtain_hooks() as $hook) { @include($phpbb_root_path . 'includes/hooks/' . $hook . '.' . $phpEx); } + +if (!$config['use_system_cron']) +{ + require($phpbb_root_path . 'includes/cron.' . $phpEx); + $cron = new cron(); +} -- cgit v1.2.1 From 8f567a21a3fe5c4ceeaed8c38c6bcf8251821e3a Mon Sep 17 00:00:00 2001 From: Oleg Pudeyev Date: Sat, 17 Apr 2010 07:05:54 -0400 Subject: [feature/system-cron] Updated includes after moving files. PHPBB3-9596 --- phpBB/common.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/common.php') diff --git a/phpBB/common.php b/phpBB/common.php index 3586031c36..e2300f0bd5 100644 --- a/phpBB/common.php +++ b/phpBB/common.php @@ -242,6 +242,6 @@ foreach ($cache->obtain_hooks() as $hook) if (!$config['use_system_cron']) { - require($phpbb_root_path . 'includes/cron.' . $phpEx); + include($phpbb_root_path . 'includes/cron/cron_manager.' . $phpEx); $cron = new cron(); } -- cgit v1.2.1 From 763dc86c166ab850007fea8da4622e4cd1eeafc8 Mon Sep 17 00:00:00 2001 From: Oleg Pudeyev Date: Sun, 18 Apr 2010 13:48:32 -0400 Subject: [feature/system-cron] Fixes to make cron actually run. PHPBB3-9596 --- phpBB/common.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/common.php') diff --git a/phpBB/common.php b/phpBB/common.php index e2300f0bd5..cbd8399206 100644 --- a/phpBB/common.php +++ b/phpBB/common.php @@ -243,5 +243,5 @@ foreach ($cache->obtain_hooks() as $hook) if (!$config['use_system_cron']) { include($phpbb_root_path . 'includes/cron/cron_manager.' . $phpEx); - $cron = new cron(); + $cron = new cron_manager(); } -- cgit v1.2.1 From 5a075c3dca431797fd21420e6bdeb25bbc08bee6 Mon Sep 17 00:00:00 2001 From: Igor Wiedler Date: Thu, 28 Oct 2010 21:48:58 +0200 Subject: [feature/system-cron] remove more includes, adjust path PHPBB3-9596 --- phpBB/common.php | 1 - 1 file changed, 1 deletion(-) (limited to 'phpBB/common.php') diff --git a/phpBB/common.php b/phpBB/common.php index cbd8399206..c4c1d2979a 100644 --- a/phpBB/common.php +++ b/phpBB/common.php @@ -242,6 +242,5 @@ foreach ($cache->obtain_hooks() as $hook) if (!$config['use_system_cron']) { - include($phpbb_root_path . 'includes/cron/cron_manager.' . $phpEx); $cron = new cron_manager(); } -- cgit v1.2.1 From a9e0f9947d1d71779a6c02dbc4c40f70f6a98723 Mon Sep 17 00:00:00 2001 From: Igor Wiedler Date: Thu, 28 Oct 2010 22:26:49 +0200 Subject: [feature/system-cron] add phpbb_ prefix to all class names PHPBB3-9596 --- phpBB/common.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/common.php') diff --git a/phpBB/common.php b/phpBB/common.php index c4c1d2979a..00fc1a5cb7 100644 --- a/phpBB/common.php +++ b/phpBB/common.php @@ -242,5 +242,5 @@ foreach ($cache->obtain_hooks() as $hook) if (!$config['use_system_cron']) { - $cron = new cron_manager(); + $cron = new phpbb_cron_manager(); } -- cgit v1.2.1 From 7a8233020bdeb872dad6057b7799c43c1543aba4 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Thu, 13 Jan 2011 00:07:40 +0100 Subject: [feature/system-cron] Use a RecursiveDirectoryIterator instead of readdir. PHPBB3-9596 --- phpBB/common.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/common.php') diff --git a/phpBB/common.php b/phpBB/common.php index 00fc1a5cb7..e099a324bf 100644 --- a/phpBB/common.php +++ b/phpBB/common.php @@ -242,5 +242,5 @@ foreach ($cache->obtain_hooks() as $hook) if (!$config['use_system_cron']) { - $cron = new phpbb_cron_manager(); + $cron = new phpbb_cron_manager($phpbb_root_path, $phpEx); } -- cgit v1.2.1 From 09b136272b9ec25824f1c72d0148bdfe43a43603 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Thu, 13 Jan 2011 00:51:32 +0100 Subject: [feature/system-cron] Cache cron's task names. Instead of using a path relative to phpbb_root_path the path to the task directory is directly passed to the cron manager. Dummy tasks are now in the tests directory directly. PHPBB3-9596 --- phpBB/common.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/common.php') diff --git a/phpBB/common.php b/phpBB/common.php index e099a324bf..68be033578 100644 --- a/phpBB/common.php +++ b/phpBB/common.php @@ -242,5 +242,5 @@ foreach ($cache->obtain_hooks() as $hook) if (!$config['use_system_cron']) { - $cron = new phpbb_cron_manager($phpbb_root_path, $phpEx); + $cron = new phpbb_cron_manager($phpbb_root_path . 'includes/cron/task', $phpEx, $cache->get_driver()); } -- cgit v1.2.1 From 87832d06cca520e27c5dbed1c36ab9c12240ae3d Mon Sep 17 00:00:00 2001 From: Oleg Pudeyev Date: Sun, 1 May 2011 04:03:06 -0400 Subject: [feature/template-engine] Delete template class, use phpbb_template instead. PHPBB3-9726 --- phpBB/common.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/common.php') diff --git a/phpBB/common.php b/phpBB/common.php index ccd043ba70..a6ae7dff75 100644 --- a/phpBB/common.php +++ b/phpBB/common.php @@ -209,7 +209,7 @@ $class_loader->set_cache($cache->get_driver()); $request = new phpbb_request(); $user = new user(); $auth = new auth(); -$template = new template(); +$template = new phpbb_template(); $db = new $sql_db(); // make sure request_var uses this request instance -- cgit v1.2.1 From d2ac05aa74d3a1c9723be41a4c0ffe86542f223f Mon Sep 17 00:00:00 2001 From: Oleg Pudeyev Date: Thu, 12 May 2011 18:08:36 -0400 Subject: [feature/template-engine] Replaced globals with dependency injection. PHPBB3-9726 --- phpBB/common.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'phpBB/common.php') diff --git a/phpBB/common.php b/phpBB/common.php index a6ae7dff75..46f78a7926 100644 --- a/phpBB/common.php +++ b/phpBB/common.php @@ -209,7 +209,6 @@ $class_loader->set_cache($cache->get_driver()); $request = new phpbb_request(); $user = new user(); $auth = new auth(); -$template = new phpbb_template(); $db = new $sql_db(); // make sure request_var uses this request instance @@ -226,6 +225,8 @@ $config = new phpbb_config_db($db, $cache->get_driver(), CONFIG_TABLE); set_config(null, null, null, $config); set_config_count(null, null, null, $config); +$template = new phpbb_template($phpbb_root_path, $phpEx, $config, $user); + // Add own hook handler require($phpbb_root_path . 'includes/hooks/index.' . $phpEx); $phpbb_hook = new phpbb_hook(array('exit_handler', 'phpbb_user_session_handler', 'append_sid', array('template', 'display'))); -- cgit v1.2.1 From f7b06ca12db9da519d49ce334eaf96573d003c0f Mon Sep 17 00:00:00 2001 From: Igor Wiedler Date: Sat, 9 Jul 2011 23:33:44 +0200 Subject: [feature/template-engine] Move template.php to includes/template This allows making use of autoloading. PHPBB3-9726 --- phpBB/common.php | 1 - 1 file changed, 1 deletion(-) (limited to 'phpBB/common.php') diff --git a/phpBB/common.php b/phpBB/common.php index 46f78a7926..67fb5cf6ae 100644 --- a/phpBB/common.php +++ b/phpBB/common.php @@ -182,7 +182,6 @@ if (!empty($load_extensions) && function_exists('dl')) // Include files require($phpbb_root_path . 'includes/class_loader.' . $phpEx); -require($phpbb_root_path . 'includes/template.' . $phpEx); require($phpbb_root_path . 'includes/session.' . $phpEx); require($phpbb_root_path . 'includes/auth.' . $phpEx); -- cgit v1.2.1 From 541a7db1016560d77590b9265c63c10cdd7e01a5 Mon Sep 17 00:00:00 2001 From: Igor Wiedler Date: Wed, 13 Jul 2011 09:51:09 +0200 Subject: [ticket/7090] Update documented minimum PHP version to 5.2.0 PHPBB3-7090 --- phpBB/common.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/common.php') diff --git a/phpBB/common.php b/phpBB/common.php index 9697ed57ee..54e7093c76 100644 --- a/phpBB/common.php +++ b/phpBB/common.php @@ -6,7 +6,7 @@ * @copyright (c) 2005 phpBB Group * @license http://opensource.org/licenses/gpl-license.php GNU Public License * -* Minimum Requirement: PHP 4.3.3 +* Minimum Requirement: PHP 5.2.0 */ /** -- cgit v1.2.1 From acb767f14d6300ebff793f87b1a62ebbb4bde82a Mon Sep 17 00:00:00 2001 From: Oleg Pudeyev Date: Tue, 9 Aug 2011 23:28:40 -0400 Subject: [feature/template-engine] Dependency inject locator into template. PHPBB3-9726 --- phpBB/common.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'phpBB/common.php') diff --git a/phpBB/common.php b/phpBB/common.php index 67fb5cf6ae..f206dc70fd 100644 --- a/phpBB/common.php +++ b/phpBB/common.php @@ -224,7 +224,8 @@ $config = new phpbb_config_db($db, $cache->get_driver(), CONFIG_TABLE); set_config(null, null, null, $config); set_config_count(null, null, null, $config); -$template = new phpbb_template($phpbb_root_path, $phpEx, $config, $user); +$template_locator = new phpbb_template_locator(); +$template = new phpbb_template($phpbb_root_path, $phpEx, $config, $user, $template_locator); // Add own hook handler require($phpbb_root_path . 'includes/hooks/index.' . $phpEx); -- cgit v1.2.1 From 14f1e581faa3b66e7689c55c1e9c0485c0872b1e Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Thu, 9 Jun 2011 05:13:26 +0200 Subject: [feature/extension-manager] Extension Manager & Finder Extensions RFC: http://area51.phpbb.com/phpBB/viewtopic.php?f=84&t=41499 Ticket: http://tracker.phpbb.com/browse/PHPBB3-10323 PHPBB3-10323 --- phpBB/common.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/common.php') diff --git a/phpBB/common.php b/phpBB/common.php index 524c05ae70..7ff06e68d7 100644 --- a/phpBB/common.php +++ b/phpBB/common.php @@ -96,7 +96,7 @@ require($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx); set_error_handler(defined('PHPBB_MSG_HANDLER') ? PHPBB_MSG_HANDLER : 'msg_handler'); // Setup class loader first -$class_loader = new phpbb_class_loader($phpbb_root_path, '.' . $phpEx); +$class_loader = new phpbb_class_loader($phpbb_root_path . 'includes/', $phpbb_root_path . 'ext/', '.' . $phpEx); $class_loader->register(); // set up caching -- cgit v1.2.1 From fb943d4d6b39cea9825aab78e397eefe26cf7bdf Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Mon, 15 Aug 2011 19:34:30 -0400 Subject: [feature/extension-manager] Load the extension manager on all pages PHPBB3-10323 --- phpBB/common.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'phpBB/common.php') diff --git a/phpBB/common.php b/phpBB/common.php index 7ff06e68d7..cc33b29a09 100644 --- a/phpBB/common.php +++ b/phpBB/common.php @@ -124,6 +124,9 @@ $config = new phpbb_config_db($db, $cache->get_driver(), CONFIG_TABLE); set_config(null, null, null, $config); set_config_count(null, null, null, $config); +// load extensions +$phpbb_extension_manager = new phpbb_extension_manager($db, EXT_TABLE, $phpbb_root_path, ".$phpEx", $cache->get_driver()); + $template_locator = new phpbb_template_locator(); $template = new phpbb_template($phpbb_root_path, $phpEx, $config, $user, $template_locator); @@ -138,5 +141,5 @@ foreach ($cache->obtain_hooks() as $hook) if (!$config['use_system_cron']) { - $cron = new phpbb_cron_manager($phpbb_root_path . 'includes/cron/task', $phpEx, $cache->get_driver()); + $cron = new phpbb_cron_manager($phpbb_extension_manager, $cache->get_driver()); } -- cgit v1.2.1 From 96209e022477d97b581b79cabace4caddd19501b Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Mon, 15 Aug 2011 21:38:47 -0400 Subject: [feature/extension-manager] The class loader no longer knows about extensions Instead the class loader is instantiated twice. Once with the phpbb_ prefix and once with the phpbb_ext_ prefix. PHPBB3-10323 --- phpBB/common.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'phpBB/common.php') diff --git a/phpBB/common.php b/phpBB/common.php index cc33b29a09..61817972f9 100644 --- a/phpBB/common.php +++ b/phpBB/common.php @@ -96,13 +96,16 @@ require($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx); set_error_handler(defined('PHPBB_MSG_HANDLER') ? PHPBB_MSG_HANDLER : 'msg_handler'); // Setup class loader first -$class_loader = new phpbb_class_loader($phpbb_root_path . 'includes/', $phpbb_root_path . 'ext/', '.' . $phpEx); -$class_loader->register(); +$phpbb_class_loader_ext = new phpbb_class_loader('phpbb_ext_', $phpbb_root_path . 'ext/', ".$phpEx"); +$phpbb_class_loader_ext->register(); +$phpbb_class_loader = new phpbb_class_loader('phpbb_', $phpbb_root_path . 'includes/', ".$phpEx"); +$phpbb_class_loader->register(); // set up caching $cache_factory = new phpbb_cache_factory($acm_type); $cache = $cache_factory->get_service(); -$class_loader->set_cache($cache->get_driver()); +$phpbb_class_loader_ext->set_cache($cache->get_driver()); +$phpbb_class_loader->set_cache($cache->get_driver()); // Instantiate some basic classes $request = new phpbb_request(); -- cgit v1.2.1 From 5d5030a48be3d65df85d78e26690085c0889c6e3 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Sun, 21 Aug 2011 02:57:01 -0400 Subject: [feature/extension-manager] Remove cron's dependency on the extension manager. Instead a separate cron provider supplies the manager with tasks from the extension finder. PHPBB3-10323 --- phpBB/common.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/common.php') diff --git a/phpBB/common.php b/phpBB/common.php index 61817972f9..3cc9e57e46 100644 --- a/phpBB/common.php +++ b/phpBB/common.php @@ -144,5 +144,5 @@ foreach ($cache->obtain_hooks() as $hook) if (!$config['use_system_cron']) { - $cron = new phpbb_cron_manager($phpbb_extension_manager, $cache->get_driver()); + $cron = new phpbb_cron_manager(new phpbb_cron_provider($phpbb_extension_manager), $cache->get_driver()); } -- cgit v1.2.1 From ea46feb11542a9cf54ce083ee0ad03f4c5e02a1e Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Tue, 30 Aug 2011 01:32:11 -0400 Subject: [feature/extension-manager] Add support for templates in extensions. This commit adds a template path provider to separate the process of locating (cached) paths in extensions from the template engine. The locator is supplied with a list of paths from the path provider. Admin templates can now be created in ext//adm/style/ and regular templates go into ext//styles/