-
-
Notifications
You must be signed in to change notification settings - Fork 331
/
init.php
32 lines (29 loc) · 865 Bytes
/
init.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
<?php
try {
// Check PHP version
if (PHP_VERSION_ID < 70100) {
throw new Exception('PHP 7.1 or up is required to use ezXSS');
}
// Load all required files
require __DIR__ . '/system/Autoload.php';
// Display all errors if in debug mode
if (debug) {
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
} else {
ini_set('display_errors', 0);
}
// Start routing
$router = new Router();
echo $router->proccess(path);
} catch (Exception $message) {
// Any unexpected uncatched exception will show an error page
if (!class_exists('View')) {
require_once __DIR__ . '/system/View.php';
}
$view = new View();
$view->setContentType('text/html');
echo $view->renderErrorPage($message->getMessage());
exit();
}