aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/common.php
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@gmx.de>2012-12-07 15:50:24 +0100
committerJoas Schilling <nickvergessen@gmx.de>2012-12-07 15:50:24 +0100
commit37530abd394ebc22480a133ffd1ca41276d73b43 (patch)
treed59e135f641a1ed06968ff2e649f3cfc7e138cbb /phpBB/common.php
parent70d23380aa55c2aab33c1c2e5cea57f186314584 (diff)
parentb0948fb3470056b14a743dcfeb59aea0f35d0029 (diff)
downloadforums-37530abd394ebc22480a133ffd1ca41276d73b43.tar
forums-37530abd394ebc22480a133ffd1ca41276d73b43.tar.gz
forums-37530abd394ebc22480a133ffd1ca41276d73b43.tar.bz2
forums-37530abd394ebc22480a133ffd1ca41276d73b43.tar.xz
forums-37530abd394ebc22480a133ffd1ca41276d73b43.zip
Merge branch 'develop' of https://github.com/phpbb/phpbb3 into ticket/10714
* 'develop' of https://github.com/phpbb/phpbb3: (645 commits) [ticket/10679] Update module basename, we added the xcp_ prefix in 3.1 [ticket/10679] Use module_auth to limit access to the module [ticket/10679] Add new permission for changing profile field information [ticket/11219] Coding guidelines and naming consistency changes [ticket/10841] Revert more whitespace changes. [ticket/10841] Revert whitespace changes. [ticket/10841] adding space after if [ticket/10841] removing unnecessary spacing [ticket/10841] changing affectedrows check to COUNT in sql [ticket/10841] Modifying style and language selectors in UCP [ticket/11247] Fix wrong property reference in flock class. [ticket/10602] Avoid a race condition. [ticket/10602] Use last_queue_run for its intended purpose. [ticket/10716] Collect standard error from executed php process. [ticket/10716] Skip test if php is not in PATH. [ticket/10716] Exclude our dependencies from linting. [ticket/10103] New and improved wording. [ticket/10716] Only lint on php 5.3+. [ticket/10103] Assert with messages. [ticket/10103] assertLessThan/assertGreaterThan. ...
Diffstat (limited to 'phpBB/common.php')
-rw-r--r--phpBB/common.php87
1 files changed, 41 insertions, 46 deletions
diff --git a/phpBB/common.php b/phpBB/common.php
index 2d2b31df83..344b83403f 100644
--- a/phpBB/common.php
+++ b/phpBB/common.php
@@ -5,7 +5,7 @@
* @copyright (c) 2005 phpBB Group
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
-* Minimum Requirement: PHP 5.3.2
+* Minimum Requirement: PHP 5.3.3
*/
/**
@@ -15,8 +15,6 @@ if (!defined('IN_PHPBB'))
exit;
}
-use Symfony\Component\EventDispatcher\EventDispatcher;
-
require($phpbb_root_path . 'includes/startup.' . $phpEx);
if (file_exists($phpbb_root_path . 'config.' . $phpEx))
@@ -27,6 +25,8 @@ if (file_exists($phpbb_root_path . 'config.' . $phpEx))
if (!defined('PHPBB_INSTALLED'))
{
// Redirect the user to the installer
+ require($phpbb_root_path . 'includes/functions.' . $phpEx);
+
// 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'));
@@ -39,10 +39,13 @@ if (!defined('PHPBB_INSTALLED'))
$script_name = (!empty($_SERVER['REQUEST_URI'])) ? $_SERVER['REQUEST_URI'] : getenv('REQUEST_URI');
}
+ // $phpbb_root_path accounts for redirects from e.g. /adm
+ $script_path = trim(dirname($script_name)) . '/' . $phpbb_root_path . 'install/index.' . $phpEx;
// 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);
+ // Eliminate . and .. from the path
+ $script_path = phpbb_clean_path($script_path);
$url = (($secure) ? 'https://' : 'http://') . $server_name;
@@ -60,77 +63,69 @@ if (!defined('PHPBB_INSTALLED'))
exit;
}
-// 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);
-
- foreach ($load_extensions as $extension)
- {
- @dl(trim($extension));
- }
-}
-
// Include files
require($phpbb_root_path . 'includes/class_loader.' . $phpEx);
require($phpbb_root_path . 'includes/functions.' . $phpEx);
require($phpbb_root_path . 'includes/functions_content.' . $phpEx);
+require($phpbb_root_path . 'includes/functions_container.' . $phpEx);
require($phpbb_root_path . 'includes/constants.' . $phpEx);
-require($phpbb_root_path . 'includes/db/' . $dbms . '.' . $phpEx);
+require($phpbb_root_path . 'includes/db/' . ltrim($dbms, 'dbal_') . '.' . $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');
// Setup class loader first
-$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 = new phpbb_class_loader('phpbb_', "{$phpbb_root_path}includes/", ".$phpEx");
$phpbb_class_loader->register();
+$phpbb_class_loader_ext = new phpbb_class_loader('phpbb_ext_', "{$phpbb_root_path}ext/", ".$phpEx");
+$phpbb_class_loader_ext->register();
+
+// Set up container
+$phpbb_container = phpbb_create_dumped_container_unless_debug(
+ array(
+ new phpbb_di_extension_config($phpbb_root_path . 'config.' . $phpEx),
+ new phpbb_di_extension_core($phpbb_root_path),
+ ),
+ array(
+ new phpbb_di_pass_collection_pass(),
+ new phpbb_di_pass_kernel_pass(),
+ ),
+ $phpbb_root_path,
+ $phpEx
+);
+
+$phpbb_class_loader->set_cache($phpbb_container->get('cache.driver'));
+$phpbb_class_loader_ext->set_cache($phpbb_container->get('cache.driver'));
// set up caching
-$cache_factory = new phpbb_cache_factory($acm_type);
-$cache = $cache_factory->get_service();
-$phpbb_class_loader_ext->set_cache($cache->get_driver());
-$phpbb_class_loader->set_cache($cache->get_driver());
+$cache = $phpbb_container->get('cache');
// Instantiate some basic classes
-$phpbb_dispatcher = new phpbb_event_dispatcher();
-$request = new phpbb_request();
-$user = new phpbb_user();
-$auth = new phpbb_auth();
-$db = new $sql_db();
+$phpbb_dispatcher = $phpbb_container->get('dispatcher');
+$request = $phpbb_container->get('request');
+$user = $phpbb_container->get('user');
+$auth = $phpbb_container->get('auth');
+$db = $phpbb_container->get('dbal.conn');
// make sure request_var uses this request instance
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);
-
-// We do not need this any longer, unset for safety purposes
-unset($dbpasswd);
-
// Grab global variables, re-cache if necessary
-$config = new phpbb_config_db($db, $cache->get_driver(), CONFIG_TABLE);
+$config = $phpbb_container->get('config');
set_config(null, null, null, $config);
set_config_count(null, null, null, $config);
$phpbb_log = new phpbb_log(LOG_TABLE);
// load extensions
-$phpbb_extension_manager = new phpbb_extension_manager($db, EXT_TABLE, $phpbb_root_path, ".$phpEx", $cache->get_driver());
-
-// Initialize style
-$phpbb_style_resource_locator = new phpbb_style_resource_locator();
-$phpbb_style_path_provider = new phpbb_style_extension_path_provider($phpbb_extension_manager, new phpbb_style_path_provider());
-$template = new phpbb_template($phpbb_root_path, $phpEx, $config, $user, $phpbb_style_resource_locator);
-$phpbb_style = new phpbb_style($phpbb_root_path, $phpEx, $config, $user, $phpbb_style_resource_locator, $phpbb_style_path_provider, $template);
+$phpbb_extension_manager = $phpbb_container->get('ext.manager');
+$phpbb_subscriber_loader = $phpbb_container->get('event.subscriber_loader');
-$phpbb_subscriber_loader = new phpbb_event_extension_subscriber_loader($phpbb_dispatcher, $phpbb_extension_manager);
-$phpbb_subscriber_loader->load();
+$template = $phpbb_container->get('template');
+$phpbb_style = $phpbb_container->get('style');
// Add own hook handler
require($phpbb_root_path . 'includes/hooks/index.' . $phpEx);
@@ -143,7 +138,7 @@ foreach ($cache->obtain_hooks() as $hook)
if (!$config['use_system_cron'])
{
- $cron = new phpbb_cron_manager(new phpbb_cron_task_provider($phpbb_extension_manager), $cache->get_driver());
+ $cron = $phpbb_container->get('cron.manager');
}
/**