-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
75 lines (55 loc) · 2.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<?php
// ROOT
define('ROOT', rtrim($_SERVER['DOCUMENT_ROOT'] . dirname($_SERVER['PHP_SELF']), '/'));
if (is_dir(ROOT . '/Install/')) {
header('Location: ' . '/Install/');
exit();
}
mb_internal_encoding('UTF-8');
ob_start();
session_start();
error_reporting(E_ALL ^ E_NOTICE);
ini_set('memory_limit', '256M');
ini_set('display_errors', 1);
ini_set('auto_start', 0);
ini_set('opcache.enable', 0);
ini_set('opcache.enable_cli', 0);
@ini_set('session.cookie_secure', 1);
@ini_set('session.use_strict_mode', 1);
@ini_set('session.use_only_cookies ', 1);
@ini_set('session.use_trans_sid ', 0);
@ini_set('session.cookie_httponly', 1);
@ini_set('session.use_cookies ', 1);
@ini_set('session.cookie_domain ', $_SERVER['SERVER_NAME']);
require ROOT . '/Includes/Function.php';
spl_autoload_register(function ($class) {
$path = ROOT . '/Includes/Object/' . implode('/', $_path = explode('\\', $class)) . '.';
$path .= match ($_path[0]) {
'Page' => 'page.php',
'Style' => 'style.php',
'Model' => 'model.php',
'Block' => 'block.php',
'Process' => 'process.php',
'Exception' => 'exception.php',
'Visualization' => 'visualization.php'
};
if (file_exists($path) === false) {
match ($_path[0]) {
'Page' => throw new \Exception\System('Hledaná stránka \'' . $path . '\' neexistuje!'),
'Style' => throw new \Exception\System('Hledaná styl \'' . $path . '\' neexistuje!'),
'Model' => throw new \Exception\System('Hledaný model \'' . $path . '\' neexistuje!'),
'Block' => throw new \Exception\System('Hledaný blok \'' . $path . '\' neexistuje!'),
'Process' => throw new \Exception\System('Hledaný proces \'' . $path . '\' neexistuje!'),
'Exception' => throw new \Exception\System('Hledaná vyjímka \'' . $path . '\' neexistuje!'),
'Visualization' => throw new \Exception\System('Hledaný vizualizátor \'' . $path . '\' neexistuje!')
};
}
require_once($path);
});
set_exception_handler(function ($exception) {
throw new \Exception\System($exception);
});
require ROOT . '/Includes/Constants.php';
$router = new Page\Router();
$router->body();
exit();