|
1
|
|
|
<?php |
|
2
|
|
|
$ariadne = ''; |
|
3
|
|
|
|
|
4
|
|
|
function check_php_version() { |
|
5
|
|
|
if (version_compare(PHP_VERSION, '5.6.2', '>=')) { |
|
6
|
|
|
return true; |
|
7
|
|
|
} |
|
8
|
|
|
return false; |
|
9
|
|
|
} |
|
10
|
|
|
|
|
11
|
|
|
function check_database_support() { |
|
12
|
|
|
if (check_mysql() || check_postgresql()) { |
|
13
|
|
|
return true; |
|
14
|
|
|
} |
|
15
|
|
|
return false; |
|
16
|
|
|
} |
|
17
|
|
|
|
|
18
|
|
|
function check_mysql() { |
|
19
|
|
|
if(function_exists('mysqli_connect')) { |
|
20
|
|
|
return true; |
|
21
|
|
|
} |
|
22
|
|
|
return false; |
|
23
|
|
|
} |
|
24
|
|
|
|
|
25
|
|
|
function check_postgresql() { |
|
26
|
|
|
if (function_exists('pg_connect')) { |
|
27
|
|
|
return true; |
|
28
|
|
|
} |
|
29
|
|
|
return false; |
|
30
|
|
|
} |
|
31
|
|
|
|
|
32
|
|
|
function check_apache() { |
|
|
|
|
|
|
33
|
|
|
if (preg_match("/^apache/i", $_SERVER['SERVER_SOFTWARE'])) { |
|
34
|
|
|
return true; |
|
35
|
|
|
} |
|
36
|
|
|
return false; |
|
37
|
|
|
} |
|
38
|
|
|
|
|
39
|
|
|
function check_webserver() { |
|
40
|
|
|
if ( |
|
41
|
|
|
check_apache() |
|
42
|
|
|
// FIXME: Add more compatible webservers. |
|
43
|
|
|
) { |
|
44
|
|
|
return true; |
|
45
|
|
|
} |
|
46
|
|
|
return false; |
|
47
|
|
|
} |
|
48
|
|
|
|
|
49
|
|
|
function check_accept_path_info() { |
|
|
|
|
|
|
50
|
|
|
if ( function_exists('apache_lookup_uri')) { |
|
51
|
|
|
$extrapath = "/test_path_info/"; |
|
52
|
|
|
$object = apache_lookup_uri($_SERVER['REQUEST_URI'] . $extrapath); |
|
53
|
|
|
if ($object->path_info == $extrapath) { |
|
54
|
|
|
return true; |
|
55
|
|
|
} |
|
56
|
|
|
return false; |
|
57
|
|
|
} else { |
|
58
|
|
|
$ariadne = ''; |
|
59
|
|
|
@include("../ariadne.inc"); |
|
60
|
|
|
if ( $ariadne != '' ) { |
|
61
|
|
|
require_once($ariadne . '/ar.php'); |
|
62
|
|
|
|
|
63
|
|
|
// checking if path_info could be available |
|
64
|
|
|
$testuri = new ar_url('http://' . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"]); |
|
65
|
|
|
$testuri->query = ''; |
|
|
|
|
|
|
66
|
|
|
$testuri->path = str_replace('/index.php', '/', $testuri->path)."serverinfo.php"; |
|
|
|
|
|
|
67
|
|
|
$testuri = (string)$testuri; |
|
68
|
|
|
$result1 = json_decode(ar_http::get($testuri),true); |
|
69
|
|
|
$result2 = json_decode(ar_http::get($testuri.'/my/path/info'),true); |
|
70
|
|
|
|
|
71
|
|
|
if ( is_array($result1) && is_array($result2) ) { |
|
72
|
|
|
// self request works |
|
73
|
|
|
// pathinfo could work |
|
74
|
|
|
if( $result2['server']['PATH_INFO'] == '/my/path/info' ) { |
|
75
|
|
|
return true; |
|
76
|
|
|
} else { |
|
77
|
|
|
return false; |
|
78
|
|
|
} |
|
79
|
|
|
} elseif ( is_array($result1) && is_null($result2) ) { |
|
80
|
|
|
// self request works |
|
81
|
|
|
// request with pathinfo fails |
|
82
|
|
|
return false; |
|
83
|
|
|
} else { |
|
84
|
|
|
// self request fails |
|
85
|
|
|
// should return 'check via browser' |
|
86
|
|
|
return false; |
|
87
|
|
|
} |
|
88
|
|
|
} |
|
89
|
|
|
} |
|
90
|
|
|
return false; |
|
91
|
|
|
} |
|
92
|
|
|
|
|
93
|
|
|
function check_zend_compat() { |
|
94
|
|
|
if (!ini_get("zend.ze1_compatibility_mode")) { |
|
95
|
|
|
return true; |
|
96
|
|
|
} |
|
97
|
|
|
return false; |
|
98
|
|
|
} |
|
99
|
|
|
|
|
100
|
|
|
function check_ariadne_inc_read() { |
|
101
|
|
|
if (is_readable("../ariadne.inc")) { |
|
102
|
|
|
return true; |
|
103
|
|
|
} |
|
104
|
|
|
return false; |
|
105
|
|
|
} |
|
106
|
|
|
|
|
107
|
|
|
function check_ariadne_path() { |
|
108
|
|
|
@include("../ariadne.inc"); |
|
109
|
|
|
if (is_readable($ariadne . "/templates/pobject/")) { |
|
|
|
|
|
|
110
|
|
|
return true; |
|
111
|
|
|
} |
|
112
|
|
|
return false; |
|
113
|
|
|
} |
|
114
|
|
|
|
|
115
|
|
|
|
|
116
|
|
|
function check_files_write() { |
|
117
|
|
|
@include("../ariadne.inc"); |
|
118
|
|
|
if (is_writable($ariadne . "/../files/")) { |
|
|
|
|
|
|
119
|
|
|
return true; |
|
120
|
|
|
} |
|
121
|
|
|
return false; |
|
122
|
|
|
} |
|
123
|
|
|
|
|
124
|
|
|
function check_ariadne_phtml_write() { |
|
125
|
|
|
@include("../ariadne.inc"); |
|
126
|
|
|
if (file_exists($ariadne . "/configs/ariadne.phtml")) { |
|
127
|
|
|
if (is_writable($ariadne . "/configs/ariadne.phtml")) { |
|
|
|
|
|
|
128
|
|
|
return true; |
|
129
|
|
|
} |
|
130
|
|
|
} else { |
|
131
|
|
|
if (is_writable($ariadne . "/configs/")) { |
|
132
|
|
|
return true; |
|
133
|
|
|
} |
|
134
|
|
|
} |
|
135
|
|
|
return false; |
|
136
|
|
|
} |
|
137
|
|
|
|
|
138
|
|
|
function check_im_convert() { |
|
139
|
|
|
$bin = find_in_path('convert'); |
|
140
|
|
|
if (is_executable($bin)) { |
|
141
|
|
|
global $found_bins; |
|
142
|
|
|
$found_bins['bin_convert'] = $bin; |
|
143
|
|
|
return true; |
|
144
|
|
|
} |
|
145
|
|
|
return false; |
|
146
|
|
|
} |
|
147
|
|
|
|
|
148
|
|
|
function check_im_mogrify() { |
|
149
|
|
|
$bin = find_in_path('mogrify'); |
|
150
|
|
|
if (is_executable($bin)) { |
|
151
|
|
|
global $found_bins; |
|
152
|
|
|
$found_bins['bin_mogrify'] = $bin; |
|
153
|
|
|
return true; |
|
154
|
|
|
} |
|
155
|
|
|
return false; |
|
156
|
|
|
} |
|
157
|
|
|
|
|
158
|
|
|
function check_im_composite() { |
|
159
|
|
|
$bin = find_in_path('composite'); |
|
160
|
|
|
if (is_executable($bin)) { |
|
161
|
|
|
global $found_bins; |
|
162
|
|
|
$found_bins['bin_composite'] = $bin; |
|
163
|
|
|
return true; |
|
164
|
|
|
} |
|
165
|
|
|
return false; |
|
166
|
|
|
} |
|
167
|
|
|
|
|
168
|
|
|
function check_im_identify() { |
|
169
|
|
|
$bin = find_in_path('identify'); |
|
170
|
|
|
if (is_executable($bin)) { |
|
171
|
|
|
global $found_bins; |
|
172
|
|
|
$found_bins['bin_identify'] = $bin; |
|
173
|
|
|
return true; |
|
174
|
|
|
} |
|
175
|
|
|
return false; |
|
176
|
|
|
} |
|
177
|
|
|
|
|
178
|
|
|
function check_image_magick() { |
|
179
|
|
|
if ( |
|
180
|
|
|
check_im_convert() && |
|
181
|
|
|
check_im_mogrify() && |
|
182
|
|
|
check_im_composite() && |
|
183
|
|
|
check_im_identify() |
|
184
|
|
|
) { |
|
185
|
|
|
return true; |
|
186
|
|
|
} |
|
187
|
|
|
return false; |
|
188
|
|
|
} |
|
189
|
|
|
|
|
190
|
|
|
function check_svn() { |
|
191
|
|
|
if ( |
|
192
|
|
|
check_svn_class() && |
|
193
|
|
|
check_svn_binary() |
|
194
|
|
|
) { |
|
195
|
|
|
return true; |
|
196
|
|
|
} |
|
197
|
|
|
return false; |
|
198
|
|
|
} |
|
199
|
|
|
|
|
200
|
|
|
function check_svn_class() { |
|
201
|
|
|
@include_once("VersionControl/SVN.php"); |
|
202
|
|
|
if (class_exists("VersionControl_SVN")) { |
|
203
|
|
|
return true; |
|
204
|
|
|
} |
|
205
|
|
|
return false; |
|
206
|
|
|
} |
|
207
|
|
|
|
|
208
|
|
|
function check_domdocument_class() { |
|
209
|
|
|
if (class_exists("DOMDocument")) { |
|
210
|
|
|
return true; |
|
211
|
|
|
} |
|
212
|
|
|
return false; |
|
213
|
|
|
} |
|
214
|
|
|
|
|
215
|
|
View Code Duplication |
function check_svn_binary() { |
|
|
|
|
|
|
216
|
|
|
$bin = find_in_path('svn'); |
|
217
|
|
|
if (is_executable($bin)) { |
|
218
|
|
|
global $found_bins; |
|
219
|
|
|
$found_bins['bin_svn'] = $bin; |
|
220
|
|
|
return true; |
|
221
|
|
|
} |
|
222
|
|
|
return false; |
|
223
|
|
|
} |
|
224
|
|
|
|
|
225
|
|
|
function check_svn_write() { |
|
226
|
|
|
@include("../ariadne.inc"); |
|
227
|
|
|
if (is_writeable($ariadne . "/configs/svn/")) { |
|
|
|
|
|
|
228
|
|
|
return true; |
|
229
|
|
|
} |
|
230
|
|
|
return false; |
|
231
|
|
|
} |
|
232
|
|
|
|
|
233
|
|
View Code Duplication |
function check_html_tidy() { |
|
|
|
|
|
|
234
|
|
|
$bin = find_in_path('tidy'); |
|
235
|
|
|
if (is_executable($bin)) { |
|
236
|
|
|
global $found_bins; |
|
237
|
|
|
$found_bins['bin_tidy'] = $bin; |
|
238
|
|
|
return true; |
|
239
|
|
|
} |
|
240
|
|
|
return false; |
|
241
|
|
|
} |
|
242
|
|
|
|
|
243
|
|
View Code Duplication |
function check_grep() { |
|
|
|
|
|
|
244
|
|
|
$bin = find_in_path('grep'); |
|
245
|
|
|
if (is_executable($bin)) { |
|
246
|
|
|
global $found_bins; |
|
247
|
|
|
$found_bins['bin_grep'] = $bin; |
|
248
|
|
|
return true; |
|
249
|
|
|
} |
|
250
|
|
|
return false; |
|
251
|
|
|
} |
|
252
|
|
|
|
|
253
|
|
|
function check_connect_db($conf) { |
|
254
|
|
View Code Duplication |
if ($conf && $conf->dbms) { |
|
255
|
|
|
switch ( $conf->dbms ) { |
|
256
|
|
|
case 'mysql': |
|
257
|
|
|
case 'mysql_workspaces': |
|
258
|
|
|
return check_connect_db_mysql($conf); |
|
259
|
|
|
break; |
|
260
|
|
|
case 'postgresql': |
|
261
|
|
|
return check_connect_db_postgresql($conf); |
|
262
|
|
|
break; |
|
263
|
|
|
} |
|
264
|
|
|
// FIXME: Add postgresql checks too |
|
265
|
|
|
} |
|
266
|
|
|
return false; |
|
267
|
|
|
} |
|
268
|
|
|
|
|
269
|
|
|
function check_select_db($conf) { |
|
270
|
|
View Code Duplication |
if ($conf && $conf->dbms) { |
|
271
|
|
|
switch ( $conf->dbms ) { |
|
272
|
|
|
case 'mysql': |
|
273
|
|
|
case 'mysql_workspaces': |
|
274
|
|
|
return check_select_db_mysql($conf); |
|
275
|
|
|
break; |
|
276
|
|
|
case 'postgresql': |
|
277
|
|
|
return check_select_db_postgresql($conf); |
|
278
|
|
|
break; |
|
279
|
|
|
} |
|
280
|
|
|
} |
|
281
|
|
|
return false; |
|
282
|
|
|
} |
|
283
|
|
|
|
|
284
|
|
|
function check_db_grants($conf) { |
|
285
|
|
View Code Duplication |
if ($conf && $conf->dbms) { |
|
286
|
|
|
switch ( $conf->dbms ) { |
|
287
|
|
|
case 'mysql': |
|
288
|
|
|
case 'mysql_workspaces': |
|
289
|
|
|
return check_db_grants_mysql($conf); |
|
290
|
|
|
break; |
|
291
|
|
|
case 'postgresql': |
|
292
|
|
|
return check_db_grants_postgresql($conf); |
|
293
|
|
|
break; |
|
294
|
|
|
} |
|
295
|
|
|
} |
|
296
|
|
|
return false; |
|
297
|
|
|
} |
|
298
|
|
|
|
|
299
|
|
|
function check_db_charset($conf) { |
|
300
|
|
View Code Duplication |
if ($conf && $conf->dbms) { |
|
301
|
|
|
switch ( $conf->dbms ) { |
|
302
|
|
|
case 'mysql': |
|
303
|
|
|
case 'mysql_workspaces': |
|
304
|
|
|
return check_db_charset_mysql($conf) && check_db_collation_mysql($conf); |
|
305
|
|
|
break; |
|
306
|
|
|
case 'postgresql': |
|
307
|
|
|
return true; // No known issues for postgres |
|
308
|
|
|
break; |
|
309
|
|
|
} |
|
310
|
|
|
} |
|
311
|
|
|
return false; |
|
312
|
|
|
} |
|
313
|
|
|
|
|
314
|
|
|
function check_db_grants_mysql($conf) { |
|
315
|
|
|
$dbh = getConnection($conf); |
|
316
|
|
|
if (!$dbh->connect_errno) { |
|
317
|
|
|
$query = "SHOW GRANTS FOR CURRENT_USER();"; |
|
318
|
|
|
|
|
319
|
|
|
$result = $dbh->query($query); |
|
320
|
|
|
if (!$dbh->errno ) { |
|
321
|
|
|
while ($row = $result->fetch_row()){ |
|
322
|
|
|
if (preg_match("/^GRANT ALL/", $row[0])) { |
|
323
|
|
|
return true; |
|
324
|
|
|
} |
|
325
|
|
|
if ( |
|
326
|
|
|
preg_match("/^GRANT.*?SELECT.*?ON/", $row[0]) && |
|
327
|
|
|
preg_match("/^GRANT.*?INSERT.*?ON/", $row[0]) && |
|
328
|
|
|
preg_match("/^GRANT.*?UPDATE.*?ON/", $row[0]) && |
|
329
|
|
|
preg_match("/^GRANT.*?CREATE.*?ON/", $row[0]) && |
|
330
|
|
|
preg_match("/^GRANT.*?DELETE.*?ON/", $row[0]) |
|
331
|
|
|
) { |
|
332
|
|
|
return true; |
|
333
|
|
|
} |
|
334
|
|
|
} |
|
335
|
|
|
} |
|
336
|
|
|
} |
|
337
|
|
|
return false; |
|
338
|
|
|
} |
|
339
|
|
|
|
|
340
|
|
|
function check_db_grants_postgresql($conf) { |
|
341
|
|
|
if ( check_select_db_postgresql($conf) ) { |
|
342
|
|
|
$query = "SELECT has_database_privilege ( '".$conf->database."', 'CREATE' );"; |
|
343
|
|
|
$result = pg_query( $query ); |
|
344
|
|
|
while ( $row = pg_fetch_row( $result ) ) { |
|
345
|
|
|
if ( $row[0]=='t' ) { |
|
346
|
|
|
return true; |
|
347
|
|
|
} |
|
348
|
|
|
} |
|
349
|
|
|
} |
|
350
|
|
|
return false; |
|
351
|
|
|
} |
|
352
|
|
|
|
|
353
|
|
|
function getConnection($conf){ |
|
354
|
|
|
static $dbh; |
|
355
|
|
|
if(!isset($dbh)) { |
|
356
|
|
|
$dbh = new mysqli($conf->host, $conf->user, $conf->password, $conf->database); |
|
357
|
|
|
} |
|
358
|
|
|
return $dbh; |
|
359
|
|
|
} |
|
360
|
|
|
|
|
361
|
|
|
function check_connect_db_mysql($conf) { |
|
362
|
|
|
$dbh = getConnection($conf); |
|
363
|
|
|
if ($dbh->connect_errno) { |
|
364
|
|
|
return false; |
|
365
|
|
|
} |
|
366
|
|
|
return true; |
|
367
|
|
|
} |
|
368
|
|
|
|
|
369
|
|
|
function check_connect_db_postgresql($conf) { |
|
370
|
|
|
$port = null; |
|
371
|
|
|
$host = $conf->host; |
|
|
|
|
|
|
372
|
|
|
if ( strpos($conf->host,':') !== false) { |
|
373
|
|
|
list($host,$port) = explode($conf->host, ':',2); |
|
|
|
|
|
|
374
|
|
|
} |
|
375
|
|
|
|
|
376
|
|
|
if( $conf->host == ''){ |
|
377
|
|
|
$hoststr = ''; |
|
378
|
|
|
} else { |
|
379
|
|
|
$hoststr = 'host='.$conf->host; |
|
380
|
|
|
} |
|
381
|
|
|
|
|
382
|
|
|
if ($port) { |
|
383
|
|
|
$hoststr = $hoststr .= ' port='.$port; |
|
384
|
|
|
} |
|
385
|
|
|
|
|
386
|
|
|
if( $conf->password != '' ){ |
|
387
|
|
|
$password = ' password='.$conf->password; |
|
388
|
|
|
} |
|
389
|
|
|
|
|
390
|
|
|
$connstring = $hoststr.' dbname='.$conf->database.' user='.$conf->user . ' ' .$password; |
|
|
|
|
|
|
391
|
|
|
$conf->connection = pg_connect($connstring); |
|
392
|
|
|
return (bool) $conf->connection; |
|
393
|
|
|
} |
|
394
|
|
|
|
|
395
|
|
|
function check_select_db_mysql($conf) { |
|
396
|
|
|
return check_connect_db_mysql($conf); //connect also checks database |
|
397
|
|
|
} |
|
398
|
|
|
|
|
399
|
|
|
function check_select_db_postgresql($conf) { |
|
400
|
|
|
return check_connect_db_postgresql($conf); //connect also checks database |
|
401
|
|
|
} |
|
402
|
|
|
|
|
403
|
|
|
|
|
404
|
|
|
function check_db_is_empty($conf) { |
|
405
|
|
|
switch( $conf->dbms ) { |
|
406
|
|
|
case 'mysql': |
|
407
|
|
|
case 'mysql_workspaces': |
|
408
|
|
|
return check_db_is_empty_mysql($conf); |
|
409
|
|
|
break; |
|
410
|
|
|
case 'postgresql': |
|
411
|
|
|
return check_db_is_empty_postgresql($conf); |
|
412
|
|
|
break; |
|
413
|
|
|
} |
|
414
|
|
|
return false; |
|
415
|
|
|
} |
|
416
|
|
|
|
|
417
|
|
|
function check_db_is_empty_mysql($conf) { |
|
418
|
|
|
$dbh = getConnection($conf); |
|
419
|
|
|
if (!$dbh->connect_errno) { |
|
420
|
|
|
$query = "SHOW TABLES;"; |
|
421
|
|
|
$result = $dbh->query($query); |
|
422
|
|
|
if (!$dbh->errno && $result->num_rows == 0) { |
|
423
|
|
|
return true; |
|
424
|
|
|
} |
|
425
|
|
|
} |
|
426
|
|
|
return false; |
|
427
|
|
|
} |
|
428
|
|
|
|
|
429
|
|
View Code Duplication |
function check_db_collation_mysql($conf) { |
|
|
|
|
|
|
430
|
|
|
$dbh = getConnection($conf); |
|
431
|
|
|
if (!$dbh->connect_errno) { |
|
432
|
|
|
$query = "SHOW VARIABLES LIKE 'collation_server'"; |
|
433
|
|
|
$result = $dbh->query($query); |
|
434
|
|
|
if (!$dbh->errno && $result->num_rows) { |
|
435
|
|
|
$vars = mysqli_fetch_row($result); |
|
436
|
|
|
if ($vars && $vars[1] && ($vars[1] == "latin1_swedish_ci")) { |
|
437
|
|
|
return true; |
|
438
|
|
|
} |
|
439
|
|
|
} |
|
440
|
|
|
} |
|
441
|
|
|
return false; |
|
442
|
|
|
} |
|
443
|
|
|
|
|
444
|
|
View Code Duplication |
function check_db_charset_mysql($conf) { |
|
|
|
|
|
|
445
|
|
|
$dbh = getConnection($conf); |
|
446
|
|
|
if (!$dbh->connect_errno) { |
|
447
|
|
|
$query = "SHOW VARIABLES LIKE 'character_set_server'"; |
|
448
|
|
|
$result = $dbh->query($query); |
|
449
|
|
|
if (!$dbh->errno && $result->num_rows) { |
|
450
|
|
|
$vars = mysqli_fetch_row($result); |
|
451
|
|
|
if ($vars && $vars[1] && ($vars[1] == "latin1")) { |
|
452
|
|
|
return true; |
|
453
|
|
|
} |
|
454
|
|
|
} |
|
455
|
|
|
} |
|
456
|
|
|
return false; |
|
457
|
|
|
} |
|
458
|
|
|
|
|
459
|
|
|
function check_db_is_empty_postgresql($conf) { |
|
460
|
|
|
if (check_connect_db_postgresql($conf)) { |
|
461
|
|
|
$query = "SELECT table_name FROM information_schema.tables WHERE table_schema = 'public';"; |
|
462
|
|
|
$result = pg_query($conf->connection, $query); |
|
463
|
|
|
if (pg_num_rows($result) == 0) { |
|
464
|
|
|
return true; |
|
465
|
|
|
} |
|
466
|
|
|
} |
|
467
|
|
|
return false; |
|
468
|
|
|
} |
|
469
|
|
|
|
|
470
|
|
|
function check_file( $file ) { |
|
|
|
|
|
|
471
|
|
|
if (file_exists($file) && is_readable($file)) { |
|
472
|
|
|
return true; |
|
473
|
|
|
} |
|
474
|
|
|
return false; |
|
475
|
|
|
} |
|
476
|
|
|
|
|
477
|
|
|
function check_base_ax() { |
|
478
|
|
|
if (check_file("packages/base.ax")) { |
|
479
|
|
|
return true; |
|
480
|
|
|
} |
|
481
|
|
|
return false; |
|
482
|
|
|
} |
|
483
|
|
|
|
|
484
|
|
|
function check_demo_ax() { |
|
485
|
|
|
if (check_file("packages/demo.ax")) { |
|
486
|
|
|
return true; |
|
487
|
|
|
} |
|
488
|
|
|
return false; |
|
489
|
|
|
} |
|
490
|
|
|
|
|
491
|
|
|
function check_libs_ax() { |
|
492
|
|
|
if (check_file("packages/libs.ax")) { |
|
493
|
|
|
return true; |
|
494
|
|
|
} |
|
495
|
|
|
return false; |
|
496
|
|
|
} |
|
497
|
|
|
|
|
498
|
|
|
function check_docs_ax() { |
|
499
|
|
|
if (check_file("packages/docs.ax")) { |
|
500
|
|
|
return true; |
|
501
|
|
|
} |
|
502
|
|
|
return false; |
|
503
|
|
|
} |
|
504
|
|
|
|
|
505
|
|
|
function check_admin_password($admin_passwords) { |
|
506
|
|
|
if ($admin_passwords[0] && $admin_passwords[1] && $admin_passwords[0] == $admin_passwords[1]) { |
|
507
|
|
|
return true; |
|
508
|
|
|
} |
|
509
|
|
|
return false; |
|
510
|
|
|
} |
|
511
|
|
|
|
|
512
|
|
|
function check_tar_class() { |
|
513
|
|
|
@include_once("Archive/Tar.php"); |
|
514
|
|
|
if (class_exists("Archive_Tar")) { |
|
515
|
|
|
return true; |
|
516
|
|
|
} |
|
517
|
|
|
return false; |
|
518
|
|
|
} |
|
519
|
|
|
|
|
520
|
|
|
function check_exif() { |
|
521
|
|
|
if (function_exists('exif_read_data')) { |
|
522
|
|
|
return true; |
|
523
|
|
|
} |
|
524
|
|
|
return false; |
|
525
|
|
|
} |
|
526
|
|
|
|
|
527
|
|
|
function check_mb_functions() { |
|
528
|
|
|
if (function_exists('mb_substr')) { |
|
529
|
|
|
return true; |
|
530
|
|
|
} |
|
531
|
|
|
return false; |
|
532
|
|
|
} |
|
533
|
|
|
|
|
534
|
|
|
function check_mcrypt() { |
|
535
|
|
|
if (function_exists('mcrypt_encrypt')) { |
|
536
|
|
|
return true; |
|
537
|
|
|
} |
|
538
|
|
|
return false; |
|
539
|
|
|
} |
|
540
|
|
|
|
|
541
|
|
|
function getServerVar( $name ) { |
|
|
|
|
|
|
542
|
|
|
return isset( $_SERVER[$name] ) ? $_SERVER[$name] : null; |
|
543
|
|
|
} |
|
544
|
|
|
|
|
545
|
|
|
function find_in_path($needle,array $extrapath=array()) { |
|
546
|
|
|
$paths = explode(PATH_SEPARATOR,getServerVar('PATH')); |
|
547
|
|
|
$paths = array_merge($paths,$extrapath); |
|
548
|
|
|
|
|
549
|
|
|
$exts = explode(PATH_SEPARATOR, getServerVar('PATHEXT')); |
|
550
|
|
|
|
|
551
|
|
|
foreach($paths as $path){ |
|
552
|
|
|
$file = $path . DIRECTORY_SEPARATOR . $needle; |
|
553
|
|
|
if(file_exists($file)) { |
|
554
|
|
|
return $file; |
|
555
|
|
|
} |
|
556
|
|
|
|
|
557
|
|
|
// W32 needs this |
|
558
|
|
|
foreach ($exts as $ext) { |
|
559
|
|
|
if(file_exists($file.$ext)) { |
|
560
|
|
|
return $file.$ext; |
|
561
|
|
|
} |
|
562
|
|
|
} |
|
563
|
|
|
} |
|
564
|
|
|
} |
|
565
|
|
|
|
|
566
|
|
|
$found_bins = array(); // will be filled by the check functions |
|
567
|
|
|
|
|
568
|
|
|
$required_checks = array( |
|
569
|
|
|
"check_php_version" => check_php_version(), // php => 5.6.2 |
|
570
|
|
|
"check_database_support" => check_database_support(), // MySQL or Postgres |
|
571
|
|
|
"check_webserver" => check_webserver(), // Apache, IIS, NGINX? |
|
572
|
|
|
"check_accept_path_info" => check_accept_path_info(), // Apache config: AcceptPathInfo |
|
573
|
|
|
"check_zend_compat" => check_zend_compat(), // zend.ze1_compatibility_mode = Off |
|
574
|
|
|
"check_ariadne_inc_read" => check_ariadne_inc_read(), // Check if configuration file (ariadne.inc) can be read bij www-data |
|
575
|
|
|
"check_ariadne_path" => check_ariadne_path(), // Check if path in ariadne.inc looks like an Ariadne tree |
|
576
|
|
|
"check_files_write" => check_files_write(), // Check if files dir can be written by www-data |
|
577
|
|
|
"check_base_ax" => check_base_ax(), |
|
578
|
|
|
"check_tar_class" => check_tar_class(), // Check if Archive/Tar class is available to import packages with. |
|
579
|
|
|
"check_mb_functions" => check_mb_functions(), // Check if Archive/Tar class is available to import packages with. |
|
580
|
|
|
"check_domdocument_class" => check_domdocument_class(), |
|
581
|
|
|
); |
|
582
|
|
|
|
|
583
|
|
|
$recommended_checks = array( |
|
584
|
|
|
"check_ariadne_phtml_write" => check_ariadne_phtml_write(), // Check if configuration file (ariadne.phtml) can be written bij www-data |
|
585
|
|
|
"check_exif" => check_exif(), |
|
586
|
|
|
"check_image_magick" => check_image_magick(), |
|
587
|
|
|
"check_svn" => check_svn(), |
|
588
|
|
|
"check_svn_write" => check_svn_write(), |
|
589
|
|
|
"check_html_tidy" => check_html_tidy(), |
|
590
|
|
|
"check_grep" => check_grep(), |
|
591
|
|
|
"check_demo_ax" => check_demo_ax(), |
|
592
|
|
|
"check_mcrypt" => check_mcrypt(), |
|
593
|
|
|
// "check_libs_ax" => check_libs_ax(), |
|
594
|
|
|
// "check_docs_ax" => check_docs_ax() |
|
595
|
|
|
); |
|
596
|
|
|
|
|
597
|
|
|
?> |
|
|
|
|
|
|
598
|
|
|
|
Instead of super-globals, we recommend to explicitly inject the dependencies of your class. This makes your code less dependent on global state and it becomes generally more testable: