rebuild
This commit is contained in:
@@ -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.
|
/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
|
/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
|
4. Sicherheits-Vorgaben für den Assistenten
|
||||||
IP-Sperre: Der Zugriff ist strikt auf das Heimnetz (192.168.178.0/24) begrenzt (via Nginx).
|
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.
|
Pfadtrennung: Code-Generierung muss strikt zwischen dem Logik-Verzeichnis (außerhalb des Roots) und dem Web-Verzeichnis unterscheiden.
|
||||||
|
|||||||
@@ -1,39 +0,0 @@
|
|||||||
<?php
|
|
||||||
$app = app();
|
|
||||||
|
|
||||||
// Example: register assets from inside a landing template
|
|
||||||
$app->assets()->addStyle('/assets/css/app.css', 'early');
|
|
||||||
$app->assets()->addScript('/assets/js/app.js', 'footer', true);
|
|
||||||
|
|
||||||
$flash = $app->flash()->get();
|
|
||||||
?>
|
|
||||||
<div class="card">
|
|
||||||
<div class="pill">env: <?= htmlspecialchars(defined('APP_ENV') ? APP_ENV : 'local', ENT_QUOTES) ?></div>
|
|
||||||
<h1 style="margin-top: .75rem;"><?= htmlspecialchars(t('common.title'), ENT_QUOTES) ?></h1>
|
|
||||||
|
|
||||||
<p class="muted"><?= htmlspecialchars(t('common.intro'), ENT_QUOTES) ?></p>
|
|
||||||
|
|
||||||
<?php if ($flash): ?>
|
|
||||||
<div style="margin: 1rem 0; padding: .75rem 1rem; border: 1px solid #ddd; border-radius: 12px;">
|
|
||||||
<strong><?= htmlspecialchars($flash['type'], ENT_QUOTES) ?>:</strong>
|
|
||||||
<?= htmlspecialchars($flash['message'], ENT_QUOTES) ?>
|
|
||||||
</div>
|
|
||||||
<?php endif; ?>
|
|
||||||
|
|
||||||
<div class="grid" style="margin-top: 1rem;">
|
|
||||||
<div>
|
|
||||||
<h3 style="margin: 0 0 .5rem 0;">Runtime</h3>
|
|
||||||
<div><strong>Current URL:</strong> <?= htmlspecialchars($app->request()->currentUrl(), ENT_QUOTES) ?></div>
|
|
||||||
<div><strong>Client-ID:</strong> <code><?= htmlspecialchars($GLOBALS['client_id'] ?? '', ENT_QUOTES) ?></code></div>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<h3 style="margin: 0 0 .5rem 0;">Actions</h3>
|
|
||||||
<form method="post" action="/action/flash">
|
|
||||||
<button type="submit" style="padding:.6rem 1rem; border-radius: 12px; border: 1px solid #ddd; background: white; cursor:pointer;">
|
|
||||||
Set flash message
|
|
||||||
</button>
|
|
||||||
</form>
|
|
||||||
<p class="muted" style="margin-top:.5rem;">Flash uses SessionManager, no direct globals.</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
@@ -74,7 +74,7 @@ if (defined('APP_AUTH_DEBUG') && APP_AUTH_DEBUG) {
|
|||||||
],
|
],
|
||||||
'claim_source' => !empty($groups) ? 'id_token_or_access_token' : 'none',
|
'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('/');
|
redirect('/');
|
||||||
@@ -18,7 +18,7 @@ if (!defined('APP_DEBUG_TOOL') || !APP_DEBUG_TOOL) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$debugDir = __DIR__ . '/../../debug';
|
$debugDir = __DIR__ . '/../../../debug';
|
||||||
if (!is_dir($debugDir)) {
|
if (!is_dir($debugDir)) {
|
||||||
if ($isList || $isRaw) {
|
if ($isList || $isRaw) {
|
||||||
http_response_code(404);
|
http_response_code(404);
|
||||||
@@ -13,7 +13,7 @@ Options -Indexes
|
|||||||
RewriteRule ^assets/ - [L]
|
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]
|
RewriteRule ^page/ - [F,L]
|
||||||
|
|
||||||
|
|||||||
@@ -42,24 +42,28 @@ if (str_contains($uriPath, '..')) {
|
|||||||
exit('Bad request');
|
exit('Bad request');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Basispfad fuer Landingpages
|
||||||
|
$pagesBase = realpath(__DIR__ . '/../partials/landingpages') ?: (__DIR__ . '/../partials/landingpages');
|
||||||
|
$page404 = $pagesBase . '/errorpages/404.php';
|
||||||
|
|
||||||
// Spezialrouten für Module
|
// Spezialrouten für Module
|
||||||
if (str_starts_with($uriPath, 'modules/install')) {
|
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/')) {
|
} elseif (str_starts_with($uriPath, 'modules/setup/')) {
|
||||||
$_GET['module'] = trim(substr($uriPath, strlen('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') {
|
} elseif ($uriPath === 'auth/login') {
|
||||||
$target = __DIR__ . '/page/auth_login.php';
|
$target = $pagesBase . '/auth/login.php';
|
||||||
} elseif ($uriPath === 'auth/callback') {
|
} elseif ($uriPath === 'auth/callback') {
|
||||||
$target = __DIR__ . '/page/auth_callback.php';
|
$target = $pagesBase . '/auth/callback.php';
|
||||||
} elseif ($uriPath === 'auth/logout') {
|
} elseif ($uriPath === 'auth/logout') {
|
||||||
$target = __DIR__ . '/page/auth_logout.php';
|
$target = $pagesBase . '/auth/logout.php';
|
||||||
} elseif ($uriPath === 'settings') {
|
} elseif ($uriPath === 'settings') {
|
||||||
$target = __DIR__ . '/page/settings.php';
|
$target = $pagesBase . '/users/settings.php';
|
||||||
} elseif ($uriPath === 'users') {
|
} elseif ($uriPath === 'users') {
|
||||||
$target = __DIR__ . '/page/users.php';
|
$target = $pagesBase . '/users/index.php';
|
||||||
} elseif ($uriPath === 'debug') {
|
} elseif ($uriPath === 'debug') {
|
||||||
$target = __DIR__ . '/page/debug.php';
|
$target = $pagesBase . '/retool/debug.php';
|
||||||
} elseif (preg_match('~^module/([a-zA-Z0-9_-]+)(?:/(.+))?$~', $uriPath, $m)) {
|
} elseif (preg_match('~^module/([a-zA-Z0-9_-]+)(?:/(.+))?$~', $uriPath, $m)) {
|
||||||
$module = $m[1];
|
$module = $m[1];
|
||||||
$page = isset($m[2]) && $m[2] !== '' ? trim($m[2], '/') : 'index';
|
$page = isset($m[2]) && $m[2] !== '' ? trim($m[2], '/') : 'index';
|
||||||
@@ -68,12 +72,12 @@ if (str_starts_with($uriPath, 'modules/install')) {
|
|||||||
$target = $modulePage;
|
$target = $modulePage;
|
||||||
} else {
|
} else {
|
||||||
http_response_code(404);
|
http_response_code(404);
|
||||||
$target = __DIR__ . '/page/404.php';
|
$target = $page404;
|
||||||
}
|
}
|
||||||
} elseif ($uriPath === '' || $uriPath === 'index' || $uriPath === 'index.php') {
|
} elseif ($uriPath === '' || $uriPath === 'index' || $uriPath === 'index.php') {
|
||||||
$target = __DIR__ . '/page/index.php';
|
$target = $pagesBase . '/index.php';
|
||||||
} else {
|
} else {
|
||||||
$base = __DIR__ . '/page/' . $uriPath;
|
$base = $pagesBase . '/' . $uriPath;
|
||||||
// 1) Verzeichnis mit index.php
|
// 1) Verzeichnis mit index.php
|
||||||
if (is_dir($base) && is_file($base . '/index.php')) {
|
if (is_dir($base) && is_file($base . '/index.php')) {
|
||||||
$target = $base . '/index.php';
|
$target = $base . '/index.php';
|
||||||
@@ -91,7 +95,7 @@ if (str_starts_with($uriPath, 'modules/install')) {
|
|||||||
// 3) 404
|
// 3) 404
|
||||||
else {
|
else {
|
||||||
http_response_code(404);
|
http_response_code(404);
|
||||||
$target = __DIR__ . '/page/404.php';
|
$target = $page404;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// ------------------------------------
|
// ------------------------------------
|
||||||
@@ -99,9 +103,9 @@ if (str_starts_with($uriPath, 'modules/install')) {
|
|||||||
// ------------------------------------
|
// ------------------------------------
|
||||||
$skipLayout = false;
|
$skipLayout = false;
|
||||||
$targetReal = realpath($target);
|
$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)) {
|
if ($targetReal && $retoolBase && str_starts_with($targetReal, $retoolBase)) {
|
||||||
$skipLayout = true;
|
$skipLayout = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -198,7 +198,7 @@ function module_fn(string $module, string $name, mixed ...$args): mixed
|
|||||||
* @param string $folder Unterordner in /partials/
|
* @param string $folder Unterordner in /partials/
|
||||||
* @param array $data Daten, die im Template verfügbar sein sollen
|
* @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/';
|
$base = __DIR__ . '/../../partials/';
|
||||||
|
|
||||||
@@ -210,9 +210,8 @@ function tpl(string $name, string $folder = 'landing', array $data = []): void
|
|||||||
}
|
}
|
||||||
|
|
||||||
$paths = [];
|
$paths = [];
|
||||||
if ($folder === 'landing') {
|
if ($folder === 'landingpages') {
|
||||||
$paths[] = $base . 'landing/' . $name . '.php';
|
$paths[] = $base . 'landingpages/' . $name . '.php';
|
||||||
$paths[] = $base . 'landing/main/' . $name . '.php';
|
|
||||||
} else {
|
} else {
|
||||||
$paths[] = $base . 'structure/' . $name . '.php';
|
$paths[] = $base . 'structure/' . $name . '.php';
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user