2026-11-13 00:35:39 +01:00
|
|
|
|
<?php
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* Drink it cold – Front Controller.
|
|
|
|
|
|
* Apache leitet alle nicht vorhandenen Dateien über .htaccess hierher.
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
$appRoot = is_dir(__DIR__ . '/app') ? __DIR__ . '/app' : dirname(__DIR__) . '/app';
|
|
|
|
|
|
require $appRoot . '/bootstrap.php';
|
|
|
|
|
|
|
|
|
|
|
|
$uriPath = (string) parse_url((string) ($_SERVER['REQUEST_URI'] ?? '/'), PHP_URL_PATH);
|
|
|
|
|
|
$basePath = rtrim((string) config('app.base_path', ''), '/');
|
|
|
|
|
|
if ($basePath !== '' && str_starts_with($uriPath, $basePath)) {
|
|
|
|
|
|
$uriPath = substr($uriPath, strlen($basePath));
|
|
|
|
|
|
}
|
|
|
|
|
|
$path = '/' . trim($uriPath, '/');
|
|
|
|
|
|
$method = request_method();
|
|
|
|
|
|
|
2026-11-19 00:01:19 +01:00
|
|
|
|
// HEAD (z. B. curl -I) muss wie GET beantwortet werden, nur ohne Rumpf.
|
|
|
|
|
|
if ($method === 'HEAD') {
|
|
|
|
|
|
$method = 'GET';
|
|
|
|
|
|
ob_start();
|
|
|
|
|
|
register_shutdown_function(static function (): void {
|
|
|
|
|
|
while (ob_get_level() > 0) {
|
|
|
|
|
|
ob_end_clean();
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-11-13 00:35:39 +01:00
|
|
|
|
page_handle($method, $path);
|