-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
41 lines (31 loc) · 1.03 KB
/
Copy pathindex.php
File metadata and controls
41 lines (31 loc) · 1.03 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
<?php
declare(strict_types=1);
/**
* LiteNote root entry.
*/
define('APP_START', microtime(true));
define('BASE_PATH', __DIR__);
require_once BASE_PATH . '/core/app/Core/StaticAssetServer.php';
$__requestPath = parse_url($_SERVER['REQUEST_URI'] ?? '/', PHP_URL_PATH) ?: '/';
$__requestPath = rawurldecode($__requestPath);
$__adminRequest = $__requestPath === '/admin' || str_starts_with($__requestPath, '/admin/');
if ($__requestPath !== '/' && \App\Core\StaticAssetServer::serve(BASE_PATH, $__requestPath)) {
exit;
}
if ($__adminRequest) {
define('IS_ADMIN', true);
require BASE_PATH . '/core/app/bootstrap.php';
$request = new \App\Core\Request();
$router = new \App\Core\Router();
require BASE_PATH . '/core/routes/admin.php';
$router->dispatch($request);
exit;
}
require BASE_PATH . '/core/app/bootstrap.php';
$request = new \App\Core\Request();
$router = new \App\Core\Router();
$routeFile = BASE_PATH . '/core/routes/web.php';
if (is_file($routeFile)) {
require $routeFile;
}
$router->dispatch($request);