-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.php
42 lines (36 loc) · 1.56 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
<?php
/**
* Ok this is what it is all about, start PHPDevShell engine and let the games begin.
*/
// 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);
date_default_timezone_set('America/Los_Angeles'); // this is stupid, but *required* by PHP :( TODO: make it better! if possible...
// 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')) {
require './index.local.php';
} else {
require 'includes/PHPDS.inc.php';
$PHPDS = new PHPDS;
$PHPDS->run();
}
} catch (Exception $e) {
if ($early_debug) {
error_log('Uncaught exception!' . $e);
}
print '<h1>Uncaught exception!</h1>';
print '<p>PHPDevShell encountered a serious error, please check all files and their permissions. Some components could be missing.</p>';
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>";
}
print '<p>You might want to run the <a href="other/service.php">installation script.</a></p>';
}