aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/core/bootstrap.php
blob: 4d604dadcc8f7d01e82e354b06c2207e8fc62a51 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
<?php
/**
*
* @package core
* @version $Id: bootstrap.php 9216 2008-12-23 18:40:33Z acydburn $
* @copyright (c) 2008 phpBB Group
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
* Within this file only the framework with all components but no phpBB-specific things will be loaded
*/

/**
*/
if (!defined('IN_PHPBB'))
{
	exit;
}

$starttime = explode(' ', microtime());
$starttime = $starttime[1] + $starttime[0];

// Report all errors, except notices
error_reporting(E_ALL | E_STRICT); // ^ E_NOTICE
date_default_timezone_set('UTC');

// Initialize some standard variables, constants and classes we need
require_once PHPBB_ROOT_PATH . 'includes/core/core.' . PHP_EXT;
require_once PHPBB_ROOT_PATH . 'plugins/bootstrap.' . PHP_EXT;

// Define STRIP if it is not already defined
if (!defined('STRIP'))
{
	// 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);

		// We do not allow register globals set
		if (@ini_get('register_globals') == '1' || strtolower(@ini_get('register_globals')) == 'on' || !function_exists('ini_get'))
		{
			die('phpBB will not work with register globals turned on. Please turn register globals off.');
		}

		define('STRIP', (@get_magic_quotes_gpc()) ? true : false);
	}
}

// we check for the cron script and change the root path
if (defined('IN_CRON'))
{
	@define('PHPBB_ROOT_PATH', dirname(__FILE__) . DIRECTORY_SEPARATOR);
}

// Set some default configuration parameter if the config file does not exist
if (!file_exists(PHPBB_ROOT_PATH . 'config.' . PHP_EXT))
{
	define('CONFIG_ADM_FOLDER', 'adm');
	define('CONFIG_ACM_TYPE', 'file');

	// This allows common.php or an installation script to do specific actions if the configuration is missing
	define('PHPBB_CONFIG_MISSING', true);
}
else
{
	require PHPBB_ROOT_PATH . 'config.' . PHP_EXT;
}

// Set default configuration variables if phpBB is not installed
if (!defined('PHPBB_INSTALLED'))
{
	$dbms = $dbhost = $dbport = $dbname = $dbuser = $dbpasswd = '';
	$table_prefix = 'phpbb_';
}

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));
	}
}

// Register autoload function
spl_autoload_register('__phpbb_autoload');

// Set error handler before a real one is there
set_error_handler(array('phpbb', 'error_handler'));

// Add constants
include_once PHPBB_ROOT_PATH . 'includes/constants.' . PHP_EXT;

// Add global functions
// @todo remove functions_content, trim down functions.php
require_once PHPBB_ROOT_PATH . 'includes/functions.' . PHP_EXT;
require_once PHPBB_ROOT_PATH . 'includes/functions_content.' . PHP_EXT;

// Add UTF8 tools
require_once PHPBB_ROOT_PATH . 'includes/utf/utf_tools.' . PHP_EXT;

// Add pre-defined system core files
require_once PHPBB_ROOT_PATH . 'includes/core/request.' . PHP_EXT;

phpbb::register('security', false, 'core/security');
phpbb::register('url', false, 'core/url');
phpbb::register('system', false, 'core/system');
phpbb::register('server-vars', 'phpbb_system_info', 'core/system_info');

// Make plugins structure available
phpbb::register('plugins');

?>