-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
executable file
·77 lines (75 loc) · 1.93 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
<?php
use APP\Engine\AppException;
use APP\Engine\Logger;
@error_reporting(E_ALL);
@ini_set('display_errors', -1);
if (version_compare(PHP_VERSION, '5.3.0', '<'))
{
throw new Exception('Requires PHP version 5.3 or higher.');
}
define('SIMPLE_APP', true);
define('APP_DS', DIRECTORY_SEPARATOR);
define('APP_ROOT_PATH', dirname(__FILE__) . APP_DS);
define('APP_PATH', APP_ROOT_PATH . "Application" . APP_DS);
define('APP_PATH_SETTING', APP_PATH . 'Setting' . APP_DS);
define('APP_PATH_LIB', APP_ROOT_PATH . 'Library' . APP_DS);
require_once APP_PATH_SETTING . 'Loader.php';
ob_start('system_gzhandler');
if (!session_id())
{
session_start();
}
try
{
if(HAS_CONFIG_FILE == false){
header('Location:install.php');
exit;
}
$mainApp = new APP\Engine\Application($_CONF);
$mainApp->execute();
} catch (Exception $ex)
{
if ($mainApp instanceof APP\Engine\Application)
{
if ($mainApp->isAjaxCall())
{
system_display_result(array(
'code' => $ex->getCode(),
'message' => $ex->getMessage(),
));
}
}
if (($ex instanceof AppException))
{
$sSystemCode = $ex->hashCode();
} else
{
$sSystemCode = (new AppException())->hashCode();
}
$sTrace = $ex->getTraceAsString();
$mDisplay = array(
'code' => $ex->getCode(),
'message' => $ex->getMessage(),
'trace' => $sTrace,
'system_code' => $sSystemCode,
);
if ($ex->getCode() == HTTP_CODE_NOT_FOUND)
{
$sTemplateErrorCode = "Notfound";
} else
{
$sTemplateErrorCode = "Error";
}
Logger::error($ex, $sSystemCode);
if (APP\Engine\Application::getInstance()->template)
{
echo
APP\Engine\Application::getInstance()->template->
setParams($mDisplay)->render($sTemplateErrorCode);
} else
{
system_display_result($mDisplay);
}
}
ob_end_flush();
?>