This commit is contained in:
2026-03-04 23:54:36 +01:00
parent 7d73c570c9
commit c600458959
16 changed files with 26 additions and 62 deletions

View File

@@ -42,24 +42,28 @@ if (str_contains($uriPath, '..')) {
exit('Bad request');
}
// Basispfad fuer Landingpages
$pagesBase = realpath(__DIR__ . '/../partials/landingpages') ?: (__DIR__ . '/../partials/landingpages');
$page404 = $pagesBase . '/errorpages/404.php';
// Spezialrouten für Module
if (str_starts_with($uriPath, 'modules/install')) {
$target = __DIR__ . '/page/modules_install.php';
$target = $pagesBase . '/modules/install.php';
} elseif (str_starts_with($uriPath, 'modules/setup/')) {
$_GET['module'] = trim(substr($uriPath, strlen('modules/setup/')), '/');
$target = __DIR__ . '/page/modules_setup.php';
$target = $pagesBase . '/modules/setup.php';
} elseif ($uriPath === 'auth/login') {
$target = __DIR__ . '/page/auth_login.php';
$target = $pagesBase . '/auth/login.php';
} elseif ($uriPath === 'auth/callback') {
$target = __DIR__ . '/page/auth_callback.php';
$target = $pagesBase . '/auth/callback.php';
} elseif ($uriPath === 'auth/logout') {
$target = __DIR__ . '/page/auth_logout.php';
$target = $pagesBase . '/auth/logout.php';
} elseif ($uriPath === 'settings') {
$target = __DIR__ . '/page/settings.php';
$target = $pagesBase . '/users/settings.php';
} elseif ($uriPath === 'users') {
$target = __DIR__ . '/page/users.php';
$target = $pagesBase . '/users/index.php';
} elseif ($uriPath === 'debug') {
$target = __DIR__ . '/page/debug.php';
$target = $pagesBase . '/retool/debug.php';
} elseif (preg_match('~^module/([a-zA-Z0-9_-]+)(?:/(.+))?$~', $uriPath, $m)) {
$module = $m[1];
$page = isset($m[2]) && $m[2] !== '' ? trim($m[2], '/') : 'index';
@@ -68,12 +72,12 @@ if (str_starts_with($uriPath, 'modules/install')) {
$target = $modulePage;
} else {
http_response_code(404);
$target = __DIR__ . '/page/404.php';
$target = $page404;
}
} elseif ($uriPath === '' || $uriPath === 'index' || $uriPath === 'index.php') {
$target = __DIR__ . '/page/index.php';
$target = $pagesBase . '/index.php';
} else {
$base = __DIR__ . '/page/' . $uriPath;
$base = $pagesBase . '/' . $uriPath;
// 1) Verzeichnis mit index.php
if (is_dir($base) && is_file($base . '/index.php')) {
$target = $base . '/index.php';
@@ -91,7 +95,7 @@ if (str_starts_with($uriPath, 'modules/install')) {
// 3) 404
else {
http_response_code(404);
$target = __DIR__ . '/page/404.php';
$target = $page404;
}
}
// ------------------------------------
@@ -99,9 +103,9 @@ if (str_starts_with($uriPath, 'modules/install')) {
// ------------------------------------
$skipLayout = false;
$targetReal = realpath($target);
$retoolBase = realpath(__DIR__ . '/page/retool');
$retoolBase = realpath($pagesBase . '/retool/raw');
// Beispiel: alles unter /page/raw/* ohne Layout
// Beispiel: alles unter landingpages/retool/* ohne Layout
if ($targetReal && $retoolBase && str_starts_with($targetReal, $retoolBase)) {
$skipLayout = true;
}