-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.php
More file actions
53 lines (44 loc) · 1.17 KB
/
index.php
File metadata and controls
53 lines (44 loc) · 1.17 KB
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
<?php
namespace packages\base;
chdir(__DIR__);
if (!is_file("packages/base/libraries/config/config.php") or !is_readable("packages/base/libraries/config/config.php")){
echo("FATAL ERROR\n");
}
require_once("packages/base/libraries/config/config.php");
require_once("packages/base/libraries/loader/loader.php");
try {
AutoLoader::setDefaultClassMap();
AutoLoader::register();
$api = Loader::sapi();
if ($api == Loader::cgi) {
Http::set();
} elseif ($api == Loader::cli) {
Cli::set();
}
Loader::options();
if ($level = Options::get("packages.base.logging.level")) {
Log::setLevel($level);
}
Log::debug("set 'root_directory' option to ", __DIR__);
Options::set('root_directory', __DIR__);
Log::info("loading packages");
Loader::packages();
Log::reply("Success");
Session::autoStart();
if ($api == Loader::cgi) {
Log::info("loading themes");
Loader::themes();
Log::reply("Success");
}
Log::info("routing");
Router::routing();
Log::reply("Success");
} catch(\Throwable $e) {
header("HTTP/1.0 500 Internal Server Error");
if (Loader::isDebug()) {
echo("Throwable: {$e}\n");
print_r($e);
} else {
echo("An error occured, Please contact support team.");
}
}