This commit is contained in:
2025-12-21 01:11:30 +01:00
parent d3efe34ff4
commit a97f4f77ba
29 changed files with 986 additions and 622 deletions

40
public/index.php Normal file
View File

@@ -0,0 +1,40 @@
<?php
declare(strict_types=1);
require_once __DIR__ . '/fileload.php';
$uriPath = parse_url($_SERVER['REQUEST_URI'] ?? '/', PHP_URL_PATH) ?: '/';
$uriPath = preg_replace('~/{2,}~', '/', $uriPath);
$uriPath = trim($uriPath, '/');
// Sicherheitscheck
if (str_contains($uriPath, '..')) {
http_response_code(400);
exit('Bad request');
}
// Root → page/index.php
if ($uriPath === '' || $uriPath === 'index' || $uriPath === 'index.php') {
$target = __DIR__ . '/page/index.php';
} else {
$base = __DIR__ . '/page/' . $uriPath;
// 1) Verzeichnis mit index.php
if (is_dir($base) && is_file($base . '/index.php')) {
$target = $base . '/index.php';
}
// 2) Datei
elseif (is_file($base . '.php')) {
$target = $base . '.php';
}
// 3) 404
else {
http_response_code(404);
$target = __DIR__ . '/page/404.php';
}
}
// Zentrale Ausgabe
tpl('layout_start', 'structure');
require $target;
tpl('layout_end', 'structure');