From c6004589593efcd54ae9e2168d6df1d8c7cb865e Mon Sep 17 00:00:00 2001 From: Lars Gebhardt-Kusche Date: Wed, 4 Mar 2026 23:54:36 +0100 Subject: [PATCH] rebuild --- PROJECT_CONTEXT.md | 4 +- partials/landing/main/home.php | 39 ------------------- .../landingpages/auth/callback.php | 2 +- .../landingpages/auth/login.php | 0 .../landingpages/auth/logout.php | 0 .../landingpages/errorpages}/404.php | 0 .../page => partials/landingpages}/index.php | 0 .../landingpages/modules/index.php | 0 .../landingpages/modules/install.php | 0 .../landingpages/modules/setup.php | 0 .../landingpages/retool}/debug.php | 2 +- .../landingpages/users/index.php | 0 .../landingpages/users}/settings.php | 0 public/.htaccess | 2 +- public/index.php | 32 ++++++++------- src/App/functions.php | 7 ++-- 16 files changed, 26 insertions(+), 62 deletions(-) delete mode 100755 partials/landing/main/home.php rename public/page/auth_callback.php => partials/landingpages/auth/callback.php (95%) rename public/page/auth_login.php => partials/landingpages/auth/login.php (100%) rename public/page/auth_logout.php => partials/landingpages/auth/logout.php (100%) rename {public/page => partials/landingpages/errorpages}/404.php (100%) rename {public/page => partials/landingpages}/index.php (100%) rename public/page/modules.php => partials/landingpages/modules/index.php (100%) rename public/page/modules_install.php => partials/landingpages/modules/install.php (100%) rename public/page/modules_setup.php => partials/landingpages/modules/setup.php (100%) rename {public/page => partials/landingpages/retool}/debug.php (98%) rename public/page/users.php => partials/landingpages/users/index.php (100%) rename {public/page => partials/landingpages/users}/settings.php (100%) diff --git a/PROJECT_CONTEXT.md b/PROJECT_CONTEXT.md index f583545..5b493c9 100644 --- a/PROJECT_CONTEXT.md +++ b/PROJECT_CONTEXT.md @@ -33,7 +33,7 @@ Dateistruktur: /config/: Datenbank-Zugangsdaten und Umgebungsvariablen. Die Subfolder staging/prod spielen keine technische Rolle und müssen so nicht in den Code integriert werden, denn sie werden so auch nicht synchronisiert. Beim Synchronisieren werden die beinhalteten Dateien automatisch in das Config Verzeichnis kopiert, als ob sie direkt drin liegen. -/partials/landing/: Enthält die echten Landingpages, also den kompletten Aufbau der Seite +/partials/landingpages/: Enthält die echten Landingpages, also den kompletten Aufbau der Seite /partials/structure/: Enthält alle wiederverwendbaren Seiteninformationen, wie z.B. Header, Footer, Menue @@ -46,4 +46,4 @@ Frontend: HTML5, CSS (evtl. Tailwind/Bootstrap), JavaScript (Vanilla oder leicht 4. Sicherheits-Vorgaben für den Assistenten IP-Sperre: Der Zugriff ist strikt auf das Heimnetz (192.168.178.0/24) begrenzt (via Nginx). -Pfadtrennung: Code-Generierung muss strikt zwischen dem Logik-Verzeichnis (außerhalb des Roots) und dem Web-Verzeichnis unterscheiden. \ No newline at end of file +Pfadtrennung: Code-Generierung muss strikt zwischen dem Logik-Verzeichnis (außerhalb des Roots) und dem Web-Verzeichnis unterscheiden. diff --git a/partials/landing/main/home.php b/partials/landing/main/home.php deleted file mode 100755 index e50d05d..0000000 --- a/partials/landing/main/home.php +++ /dev/null @@ -1,39 +0,0 @@ -assets()->addStyle('/assets/css/app.css', 'early'); -$app->assets()->addScript('/assets/js/app.js', 'footer', true); - -$flash = $app->flash()->get(); -?> -
-
env:
-

- -

- - -
- : - -
- - -
-
-

Runtime

-
Current URL: request()->currentUrl(), ENT_QUOTES) ?>
-
Client-ID:
-
-
-

Actions

-
- -
-

Flash uses SessionManager, no direct globals.

-
-
-
diff --git a/public/page/auth_callback.php b/partials/landingpages/auth/callback.php similarity index 95% rename from public/page/auth_callback.php rename to partials/landingpages/auth/callback.php index c62d195..b8bdcc7 100644 --- a/public/page/auth_callback.php +++ b/partials/landingpages/auth/callback.php @@ -74,7 +74,7 @@ if (defined('APP_AUTH_DEBUG') && APP_AUTH_DEBUG) { ], 'claim_source' => !empty($groups) ? 'id_token_or_access_token' : 'none', ]; - @file_put_contents(__DIR__ . '/../../debug/oidc_login.log', json_encode($log) . PHP_EOL, FILE_APPEND); + @file_put_contents(__DIR__ . '/../../../debug/oidc_login.log', json_encode($log) . PHP_EOL, FILE_APPEND); } redirect('/'); diff --git a/public/page/auth_login.php b/partials/landingpages/auth/login.php similarity index 100% rename from public/page/auth_login.php rename to partials/landingpages/auth/login.php diff --git a/public/page/auth_logout.php b/partials/landingpages/auth/logout.php similarity index 100% rename from public/page/auth_logout.php rename to partials/landingpages/auth/logout.php diff --git a/public/page/404.php b/partials/landingpages/errorpages/404.php similarity index 100% rename from public/page/404.php rename to partials/landingpages/errorpages/404.php diff --git a/public/page/index.php b/partials/landingpages/index.php similarity index 100% rename from public/page/index.php rename to partials/landingpages/index.php diff --git a/public/page/modules.php b/partials/landingpages/modules/index.php similarity index 100% rename from public/page/modules.php rename to partials/landingpages/modules/index.php diff --git a/public/page/modules_install.php b/partials/landingpages/modules/install.php similarity index 100% rename from public/page/modules_install.php rename to partials/landingpages/modules/install.php diff --git a/public/page/modules_setup.php b/partials/landingpages/modules/setup.php similarity index 100% rename from public/page/modules_setup.php rename to partials/landingpages/modules/setup.php diff --git a/public/page/debug.php b/partials/landingpages/retool/debug.php similarity index 98% rename from public/page/debug.php rename to partials/landingpages/retool/debug.php index a911089..fa51589 100644 --- a/public/page/debug.php +++ b/partials/landingpages/retool/debug.php @@ -18,7 +18,7 @@ if (!defined('APP_DEBUG_TOOL') || !APP_DEBUG_TOOL) { return; } -$debugDir = __DIR__ . '/../../debug'; +$debugDir = __DIR__ . '/../../../debug'; if (!is_dir($debugDir)) { if ($isList || $isRaw) { http_response_code(404); diff --git a/public/page/users.php b/partials/landingpages/users/index.php similarity index 100% rename from public/page/users.php rename to partials/landingpages/users/index.php diff --git a/public/page/settings.php b/partials/landingpages/users/settings.php similarity index 100% rename from public/page/settings.php rename to partials/landingpages/users/settings.php diff --git a/public/.htaccess b/public/.htaccess index 8ca4b75..6459a87 100755 --- a/public/.htaccess +++ b/public/.htaccess @@ -13,7 +13,7 @@ Options -Indexes RewriteRule ^assets/ - [L] # ------------------------------------------------- -# 2) page/ von außen sperren (nur intern per require nutzbar) +# 2) Legacy-Pfad blockieren (frueher public/page) # ------------------------------------------------- RewriteRule ^page/ - [F,L] diff --git a/public/index.php b/public/index.php index e804356..a250507 100755 --- a/public/index.php +++ b/public/index.php @@ -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; } diff --git a/src/App/functions.php b/src/App/functions.php index 56f54b3..4a6e625 100644 --- a/src/App/functions.php +++ b/src/App/functions.php @@ -198,7 +198,7 @@ function module_fn(string $module, string $name, mixed ...$args): mixed * @param string $folder Unterordner in /partials/ * @param array $data Daten, die im Template verfügbar sein sollen */ -function tpl(string $name, string $folder = 'landing', array $data = []): void +function tpl(string $name, string $folder = 'landingpages', array $data = []): void { $base = __DIR__ . '/../../partials/'; @@ -210,9 +210,8 @@ function tpl(string $name, string $folder = 'landing', array $data = []): void } $paths = []; - if ($folder === 'landing') { - $paths[] = $base . 'landing/' . $name . '.php'; - $paths[] = $base . 'landing/main/' . $name . '.php'; + if ($folder === 'landingpages') { + $paths[] = $base . 'landingpages/' . $name . '.php'; } else { $paths[] = $base . 'structure/' . $name . '.php'; }