-
Notifications
You must be signed in to change notification settings - Fork 4
/
install.php
executable file
·214 lines (167 loc) · 6.64 KB
/
install.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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
<?php
header('Expires: Mon, 12 Dec 1982 06:14:00 GMT');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header('Cache-Control: no-cache, must-revalidate, max-age=0');
header('Pragma: no-cache');
function __errorHandler($errno=NULL, $errstr, $errfile=NULL, $errline=NULL, $errcontext=NULL){
return;
}
if(!defined('PHP_VERSION_ID')){
$version = PHP_VERSION;
define('PHP_VERSION_ID', ($version{0} * 10000 + $version{2} * 100 + $version{4}));
}
if (PHP_VERSION_ID >= 50300){
error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED);
}
else{
error_reporting(E_ALL ^ E_NOTICE);
}
set_error_handler('__errorHandler');
// Show PHP Info
if(isset($_REQUEST['info'])){
phpinfo();
exit();
}
// Set the current timezone, should that not be available
// default to GMT.
if(!date_default_timezone_set(@date_default_timezone_get())) {
date_default_timezone_set('GMT');
}
// Defines
define('kVERSION', '2.2.3');
define('kINSTALL_ASSET_LOCATION', './symphony/assets/installer');
define('kINSTALL_FILENAME', basename(__FILE__));
define('DOCROOT', rtrim(dirname(__FILE__), '\\/'));
// Required system components
require_once(DOCROOT . '/symphony/lib/boot/func.utilities.php');
require_once(DOCROOT . '/symphony/lib/boot/defines.php');
require_once(TOOLKIT . '/class.lang.php');
require_once(TOOLKIT . '/class.general.php');
require_once(CORE . '/class.errorhandler.php');
// Initialize system language
function setLanguage() {
$lang = 'en';
// Fetch language requests
if(!empty($_REQUEST['lang'])){
$lang = preg_replace('/[^a-zA-Z\-]/', NULL, $_REQUEST['lang']);
}
// Set language
try{
Lang::initialize();
Lang::set($lang, false);
}
catch(Exception $s){
return NULL;
}
return true;
}
/***********************
TESTS
************************/
// Check and set language
if(setLanguage() === NULL){
$code = '<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>' . __('Outstanding Requirements') . '</title>
<link rel="stylesheet" type="text/css" href="' . kINSTALL_ASSET_LOCATION . '/main.css"/>
<script type="text/javascript" src="' . kINSTALL_ASSET_LOCATION . '/main.js"></script>
</head>
<body>
<h1>' . __('Install Symphony') . '<em>' . __('Version') . ' ' . kVERSION . '</em></h1>
<h2>' . __('Outstanding Requirements') . '</h2>
<p>' . __('Symphony needs at least one language file to be present before installation can proceed.') . '</p>
</body>
</html>';
die($code);
}
// Check for PHP 5.2+
if(version_compare(phpversion(), '5.2', '<=')){
$code = '<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>' . __('Outstanding Requirements') . '</title>
<link rel="stylesheet" type="text/css" href="' . kINSTALL_ASSET_LOCATION . '/main.css"/>
<script type="text/javascript" src="' . kINSTALL_ASSET_LOCATION . '/main.js"></script>
</head>
<body>
<h1>' . __('Install Symphony') . '<em>' . __('Version') . ' ' . kVERSION . '</em></h1>
<h2>' . __('Outstanding Requirements') . '</h2>
<p>' . __('Symphony needs the following requirements satisfied before installation can proceed.') . '</p>
<dl>
<dt>' . __('%s 5.2 or above', array('<abbr title="PHP: Hypertext Pre-processor">PHP</abbr>')) . '</dt>
<dd>' . __('Symphony needs a recent version of %s.', array('<abbr title="PHP: Hypertext Pre-processor">PHP</abbr>')) . '</dd>
</dl>
</body>
</html>';
die($code);
}
// Make sure the install.sql file exists
if(!file_exists('install.sql') || !is_readable('install.sql')){
$code = '<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>' . __('Missing File') . '</title>
<link rel="stylesheet" type="text/css" href="' . kINSTALL_ASSET_LOCATION . '/main.css"/>
<script type="text/javascript" src="' . kINSTALL_ASSET_LOCATION . '/main.js"></script>
</head>
<body>
<h1>' . __('Install Symphony') . '<em>' . __('Version') . ' ' . kVERSION . '</em></h1>
<h2>' . __('Missing File') . '</h2>
<p>' . __('It appears that <code>install.sql</code> is either missing or not readable. This is required to populate the database and must be uploaded before installation can commence. Ensure that <code>PHP</code> has read permissions.') . '</p>
</body>
</html>';
die($code);
}
// Check if Symphony is already installed
if(file_exists('manifest/config.php')){
$code = '<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>' . __('Existing Installation') . '</title>
<link rel="stylesheet" type="text/css" href="' . kINSTALL_ASSET_LOCATION . '/main.css"/>
<script type="text/javascript" src="' . kINSTALL_ASSET_LOCATION . '/main.js"></script>
</head>
<body>
<h1>' . __('Install Symphony') . '<em>' . __('Version') . ' ' . kVERSION . '</em></h1>
<h2>' . __('Existing Installation') . '</h2>
<p>' . __('It appears that Symphony has already been installed at this location.') . '</p>
</body>
</html>';
die($code);
}
function getDynamicConfiguration(){
$conf = array();
$conf['admin']['max_upload_size'] = '5242880';
$conf['symphony']['pagination_maximum_rows'] = '17';
$conf['symphony']['allow_page_subscription'] = '1';
$conf['symphony']['lang'] = 'en';
$conf['symphony']['pages_table_nest_children'] = 'no';
$conf['symphony']['version'] = '2.2.3';
$conf['log']['archive'] = '1';
$conf['log']['maxsize'] = '102400';
$conf['image']['cache'] = '1';
$conf['image']['quality'] = '90';
$conf['database']['character_set'] = 'utf8';
$conf['database']['character_encoding'] = 'utf8';
$conf['database']['runtime_character_set_alter'] = '1';
$conf['public']['display_event_xml_in_source'] = 'no';
$conf['general']['sitename'] = 'Bootstrap';
$conf['region']['time_format'] = 'g:i a';
$conf['region']['date_format'] = 'd F Y';
$conf['region']['datetime_separator'] = ' ';
$conf['maintenance_mode']['enabled'] = 'no';
return $conf;
}
function getTableSchema(){
return file_get_contents('install.sql');
}
function getWorkspaceData(){
return file_get_contents('workspace/install.sql');
}
define('INSTALL_REQUIREMENTS_PASSED', true);
include_once('./symphony/lib/toolkit/include.install.php');