-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.php
61 lines (55 loc) · 2 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
<?php
/**
* Ok this is what it is all about, start PHPDevShell engine and let the games begin.
*
* PHP version 5
*
* @category PHP
* @package PHPDevShel
* @author jason <[email protected]>
* @author greg <[email protected]>
* @license LGPL
* @version Release: 3.5.0
* @link http://www.phpdevshell.org
*/
// Enable this only if you are debugging the early stages of PHPDS's initialization.
// Really only used for core PHPDevShell development.
$early_debug = false;
$start_time = microtime(true);
// this is stupid, but *required* by PHP :( TODO: make it better! if possible...
date_default_timezone_set('America/Los_Angeles');
// Super high level exception if all else truly fails.
try {
define('BASEPATH', realpath(dirname(__FILE__) . DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR);
$includes = array('/includes/', '/includes/legacy/', '/includes/local');
foreach ($includes as $path) {
ini_set('include_path', ini_get('include_path') . PATH_SEPARATOR . realpath(BASEPATH . $path));
}
if (file_exists('./index.local.php')) {
/** @noinspection PhpIncludeInspection */
include './index.local.php';
} else {
include 'includes/PHPDS.inc.php';
$PHPDS = new PHPDS;
$PHPDS->run();
}
} catch (Exception $e) {
if ($early_debug) {
error_log('Uncaught exception!' . $e);
}
print <<<EOH
<h1>Uncaught exception!</h1>
<p>PHPDevShell encountered a serious error, please check all files and their permissions.
Some components could be missing.</p>
EOH;
print '<div style="color: red">'.$e->getMessage()
. ' in '.$e->getFile().' on line '.$e->getLine().'</div>';
if (!empty($PHPDS) && (is_a($PHPDS, 'PHPDS'))) {
$config = $PHPDS->PHPDS_configuration();
if (!empty($config['error']['display'])) {
print "<pre>$e</pre>";
}
}
//todo: be smarter about the path
print '<p>You might want to run the <a href="/other/service/install.php">installation script.</a></p>';
}