aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/common.php
diff options
context:
space:
mode:
authorMaat <maat-pub@mageia.biz>2020-05-08 21:52:11 +0200
committerMaat <maat-pub@mageia.biz>2020-05-08 21:52:11 +0200
commit8ea437e30605e0f66b5220bf904a61d7c1d11ddd (patch)
treee0db2bb4a012d5b06a633160b19f62f4868ecd28 /phpBB/common.php
parent36bc1870f21fac04736a1049c1d5b8e127d729f4 (diff)
parent2fdd46b36431ae0f58bb2e78e42553168db9a0ff (diff)
downloadforums-8ea437e30605e0f66b5220bf904a61d7c1d11ddd.tar
forums-8ea437e30605e0f66b5220bf904a61d7c1d11ddd.tar.gz
forums-8ea437e30605e0f66b5220bf904a61d7c1d11ddd.tar.bz2
forums-8ea437e30605e0f66b5220bf904a61d7c1d11ddd.tar.xz
forums-8ea437e30605e0f66b5220bf904a61d7c1d11ddd.zip
Merge remote-tracking branch 'upstream/prep-release-3.2.9'
Diffstat (limited to 'phpBB/common.php')
-rw-r--r--phpBB/common.php48
1 files changed, 39 insertions, 9 deletions
diff --git a/phpBB/common.php b/phpBB/common.php
index 71d501e926..172503f078 100644
--- a/phpBB/common.php
+++ b/phpBB/common.php
@@ -12,7 +12,7 @@
*/
/**
-* Minimum Requirement: PHP 5.3.3
+* Minimum Requirement: PHP 5.4.0
*/
if (!defined('IN_PHPBB'))
@@ -29,6 +29,11 @@ $phpbb_class_loader->register();
$phpbb_config_php_file = new \phpbb\config_php_file($phpbb_root_path, $phpEx);
extract($phpbb_config_php_file->get_all());
+if (!defined('PHPBB_ENVIRONMENT'))
+{
+ @define('PHPBB_ENVIRONMENT', 'production');
+}
+
if (!defined('PHPBB_INSTALLED'))
{
// Redirect the user to the installer
@@ -53,14 +58,14 @@ if (!defined('PHPBB_INSTALLED'))
}
// $phpbb_root_path accounts for redirects from e.g. /adm
- $script_path = trim(dirname($script_name)) . '/' . $phpbb_root_path . 'install/index.' . $phpEx;
+ $script_path = trim(dirname($script_name)) . '/' . $phpbb_root_path . 'install/app.' . $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 = preg_replace('#[\\\\/]{2,}#', '/', $script_path);
// Eliminate . and .. from the path
require($phpbb_root_path . 'phpbb/filesystem.' . $phpEx);
- $phpbb_filesystem = new phpbb\filesystem();
+ $phpbb_filesystem = new phpbb\filesystem\filesystem();
$script_path = $phpbb_filesystem->clean_path($script_path);
$url = (($secure) ? 'https://' : 'http://') . $server_name;
@@ -91,26 +96,51 @@ include($phpbb_root_path . 'includes/functions_compatibility.' . $phpEx);
require($phpbb_root_path . 'includes/constants.' . $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');
+if (PHPBB_ENVIRONMENT === 'development')
+{
+ \phpbb\debug\debug::enable();
+}
+else
+{
+ set_error_handler(defined('PHPBB_MSG_HANDLER') ? PHPBB_MSG_HANDLER : 'msg_handler');
+}
$phpbb_class_loader_ext = new \phpbb\class_loader('\\', "{$phpbb_root_path}ext/", $phpEx);
$phpbb_class_loader_ext->register();
-phpbb_load_extensions_autoloaders($phpbb_root_path);
-
// Set up container
-$phpbb_container_builder = new \phpbb\di\container_builder($phpbb_config_php_file, $phpbb_root_path, $phpEx);
-$phpbb_container = $phpbb_container_builder->get_container();
+try
+{
+ $phpbb_container_builder = new \phpbb\di\container_builder($phpbb_root_path, $phpEx);
+ $phpbb_container = $phpbb_container_builder->with_config($phpbb_config_php_file)->get_container();
+}
+catch (InvalidArgumentException $e)
+{
+ if (PHPBB_ENVIRONMENT !== 'development')
+ {
+ trigger_error(
+ 'The requested environment ' . PHPBB_ENVIRONMENT . ' is not available.',
+ E_USER_ERROR
+ );
+ }
+ else
+ {
+ throw $e;
+ }
+}
$phpbb_class_loader->set_cache($phpbb_container->get('cache.driver'));
$phpbb_class_loader_ext->set_cache($phpbb_container->get('cache.driver'));
require($phpbb_root_path . 'includes/compatibility_globals.' . $phpEx);
+register_compatibility_globals();
+
// 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')));
+
+/* @var $phpbb_hook_finder \phpbb\hook\finder */
$phpbb_hook_finder = $phpbb_container->get('hook_finder');
foreach ($phpbb_hook_finder->find() as $hook)