Conditions | 7 |
Paths | 8 |
Total Lines | 22 |
Code Lines | 18 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
7 | require_once 'functions.php'; |
||
8 | |||
9 | if (PHP_SAPI !== 'cli') { |
||
10 | $uri = $_SERVER['REQUEST_URI'] ?? ''; |
||
11 | $publicDir = getenv('CONIA_DOCUMENT_ROOT'); |
||
12 | $url = urldecode(parse_url($uri, PHP_URL_PATH)); |
||
13 | |||
14 | $start = microtime(true); |
||
15 | |||
16 | if ($publicDir) { |
||
17 | // serve existing files as-is |
||
18 | if (is_file($publicDir . $url)) { |
||
19 | /** @psalm-suppress PossiblyInvalidArgument */ |
||
20 | serverEcho(http_response_code() ?: 0, $uri, microtime(true) - $start); |
||
|
|||
21 | |||
22 | return false; |
||
23 | } |
||
24 | |||
25 | if (is_file($publicDir . rtrim($url, '/') . '/index.html')) { |
||
26 | /** @psalm-suppress PossiblyInvalidArgument */ |
||
27 | serverEcho(http_response_code() ?: 0, $uri, microtime(true) - $start); |
||
28 | |||
29 | return false; |
||
55 |