forked from phpbb/quickinstall
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.php
153 lines (128 loc) · 4.34 KB
/
index.php
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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
<?php
/**
*
* @package quickinstall
* @copyright (c) 2007 phpBB Group
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/
/**
* @ignore
*/
define('IN_PHPBB', true);
define('IN_QUICKINSTALL', true);
define('IN_INSTALL', true);
$quickinstall_path = './';
$phpbb_root_path = $quickinstall_path . 'sources/phpBB3/';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
// Report all errors, except notices
//error_reporting(E_ALL);
$level = E_ALL ^ E_NOTICE;
if (version_compare(PHP_VERSION, '5.4.0-dev', '>='))
{
// PHP 5.4 adds E_STRICT to E_ALL.
// Our utf8 normalizer triggers E_STRICT output on PHP 5.4.
// Unfortunately it cannot be made E_STRICT-clean while
// continuing to work on PHP 4.
// Therefore, in phpBB 3.0.x we disable E_STRICT on PHP 5.4+,
// while phpBB 3.1 will fix utf8 normalizer.
// E_STRICT is defined starting with PHP 5
if (!defined('E_STRICT'))
{
define('E_STRICT', 2048);
}
$level &= ~E_STRICT;
}
error_reporting($level);
if (version_compare(PHP_VERSION, '5.2.0', '<'))
{
die('You are running an unsupported PHP version. phpBB QuickInstall only supports PHP version 5.2.0 and newer.');
}
// 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
{
define('STRIP', (get_magic_quotes_gpc()) ? true : false);
}
// Try to override some limits - maybe it helps some...
@set_time_limit(0);
@ini_set('memory_limit', '128M');
// Include scripts for quickinstall
require($quickinstall_path . 'includes/qi_constants.' . $phpEx);
require($quickinstall_path . 'includes/functions_quickinstall.' . $phpEx);
require($quickinstall_path . 'includes/class_qi_settings.' . $phpEx);
require($quickinstall_path . 'includes/qi_functions.' . $phpEx);
require($quickinstall_path . 'includes/functions_files.' . $phpEx);
require($quickinstall_path . 'includes/functions_module.' . $phpEx);
require($quickinstall_path . 'includes/template.' . $phpEx);
// Set PHP error handler to ours
set_error_handler(array('qi', 'msg_handler'), E_ALL);
// Make sure we have phpBB.
if (!file_exists($quickinstall_path . 'sources/phpBB3/common.' . $phpEx))
{
trigger_error('phpBB not found. You need to download phpBB3 and extract it in sources/');
}
// We need some phpBB functions too.
require($phpbb_root_path . 'includes/functions.' . $phpEx);
require($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx);
$page = request_var('page', 'main');
$mode = request_var('mode', '');
$profile = request_var('qi_profile', '');
$delete_profile = (isset($_POST['delete-profile'])) ? true : false;
// Let's get the config.
$settings = new settings($profile, $mode);
// Need to set prefix here before constants.php are included.
$table_prefix = $settings->get_config('table_prefix');
require($phpbb_root_path . 'includes/constants.' . $phpEx);
require($phpbb_root_path . 'includes/auth.' . $phpEx);
require($phpbb_root_path . 'includes/acm/acm_file.' . $phpEx);
require($phpbb_root_path . 'includes/cache.' . $phpEx);
require($phpbb_root_path . 'includes/functions_install.' . $phpEx);
require($phpbb_root_path . 'includes/session.' . $phpEx);
// We need to set the template here.
$template = new template();
$template->set_custom_template('style', 'qi');
// Create the user.
$user = new user();
// If there is a language selected in the dropdown menu in settings it's sent as GET, then igonre the hidden POST field.
if (isset($_GET['lang']))
{
$language = request_var('lang', '');
}
else if (!empty($_POST['sel_lang']))
{
$language = request_var('sel_lang', '');
}
else
{
$language = '';
}
$settings->apply_language($language);
// Probably best place to validate the settings
$settings->validate();
$error = $settings->get_error();
$page = (empty($error)) ? $page : 'settings';
if ($settings->install || $settings->is_converted || $mode == 'update_settings' || $page == 'settings')
{
$page = 'settings';
require($quickinstall_path . 'includes/qi_settings.' . $phpEx);
}
// now create a module_handler object
$auth = new auth();
$cache = new cache();
$module = new module_handler($quickinstall_path . 'modules/', 'qi_');
// Set some standard variables we want to force
$config = array(
'load_tplcompile' => '1',
);
// overwrite
$cache->cache_dir = $settings->get_cache_dir();
$template->cachepath = $cache->cache_dir . 'tpl_qi_';
// Load the main module
$module->load($page, 'qi_main');