-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathindex.php
More file actions
67 lines (56 loc) · 2.31 KB
/
Copy pathindex.php
File metadata and controls
67 lines (56 loc) · 2.31 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<?php
/**
* Евгений Ефимченко, efimchenko.com
* Главная точка входа для приложения EE_FrameWork, инициализирует маршрутизацию и выводит отладочную информацию.
* /index.php
*/
define('USE_APDEX_INDEX', false);
if (USE_APDEX_INDEX) {
$start_time = microtime(true);
}
if (version_compare(phpversion(), '8.0', '<') == true) {
die('PHP - Нужна версия 8.0 или выше!');
}
$configPath = __DIR__ . '/inc/configuration.php';
$debug = false;
if (is_file($configPath)) {
$rawConfig = require $configPath;
$debug = is_array($rawConfig) && !empty($rawConfig['ENV_DEBUG']);
}
if ($debug) {
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
}
if ($debug && isset($_GET['phpinfo'])) {
phpinfo();
die;
}
$requestPath = (string) parse_url((string) ($_SERVER['REQUEST_URI'] ?? '/'), PHP_URL_PATH);
if ($requestPath === '/install' || str_starts_with($requestPath, '/install/')) {
require_once __DIR__ . '/inc/installer/index.php';
exit;
}
require_once('inc/bootstrap.php');
ee_bootstrap_runtime();
\classes\system\BotGuard::guard();
$router = new \classes\system\Router();
$router->setPath(ENV_SITE_PATH . ENV_APP_DIRECTORY);
$router->delegate();
if (USE_APDEX_INDEX) {
$end_time = microtime(true);
$response_time = $end_time - $start_time;
$url = $_SERVER['REQUEST_URI'];
\classes\system\SysClass::preFile('apdex', 'USE_APDEX_INDEX', $url, $response_time);
}
if ($debug && !empty($_GET['show_debug'])) {
echo '<div style="width: 100%; position: fixed; bottom: 0; text-align: center; z-index: 100000;"><div>';
echo "Текущее использование памяти: " . (memory_get_usage(true) / 1024 / 1024) . " MB<br/>";
echo "Пиковое использование памяти: " . (memory_get_peak_usage(true) / 1024 / 1024) . " MB<br/>";
echo 'ENV_CONTROLLER_PATH: ' . ENV_CONTROLLER_PATH . '<br/>';
echo 'ENV_CONTROLLER_NAME: ' . ENV_CONTROLLER_NAME . '<br/>';
echo 'ENV_CONTROLLER_ACTION: ' . ENV_CONTROLLER_ACTION . '<br/>';
echo 'ENV_CONTROLLER_ARGS: ' . var_export(ENV_CONTROLLER_ARGS, true) . '<br/>';
echo 'ENV_CONTROLLER_FOLDER: ' . ENV_CONTROLLER_FOLDER . '<br/>';
echo '</div></div>';
}