feat(legal): AGB als öffentliche Seite und Stilllegung des alten Deploys

- /agb ist ohne Anmeldung erreichbar (legal.php, views/legal.php,
  views/legal_agb.php), Verlinkung auf der Startseite und in der Sitemap.
- Stilllegung: app.retired_url zeigt nur noch einen Umzugsvermerk
  (retired_notice() in util.php, Prüfung in bootstrap.php); Bausteine in
  tools/retire/ und Anleitung in docs/stilllegung-programmschmiede.md.
This commit is contained in:
torsten 2026-11-30 15:40:34 +01:00
parent 11db919406
commit 11bb83c66c
9 changed files with 258 additions and 18 deletions

View file

@ -78,16 +78,26 @@ function legal_phone_href(string $phone): string
/** Öffentliche Rechtsseiten, die ohne Anmeldung und ohne Session erreichbar sind. */
function legal_is_public_path(string $path): bool
{
return in_array($path, ['/impressum', '/datenschutz'], true);
return in_array($path, ['/impressum', '/datenschutz', '/agb'], true);
}
function legal_page_titles(): array
{
return [
'impressum' => 'Impressum',
'datenschutz' => 'Datenschutz',
'agb' => 'Mietbedingungen',
];
}
function legal_page(string $page): void
{
if (!in_array($page, ['impressum', 'datenschutz'], true)) {
$titles = legal_page_titles();
if (!array_key_exists($page, $titles)) {
abort_page(404, 'Diese Seite gibt es nicht.');
}
render_standalone('legal', [
'page' => $page,
'info' => legal_data(),
], $page === 'impressum' ? 'Impressum' : 'Datenschutz');
], $titles[$page]);
}

View file

@ -45,6 +45,44 @@ function security_headers(bool $indexable = false): void
}
}
/**
* Stilllegung: Zeigt nur einen Umzugsvermerk und beendet die Anfrage.
*
* Wird über `app.retired_url` in config.local.php aktiviert – gedacht für ein
* abgelöstes Deployment (z. B. den alten Test-Deploy), das noch erreichbar ist,
* aber keine Anmeldung mehr zulassen soll.
*/
function retired_notice(string $url): void
{
header('Content-Type: text/html; charset=utf-8');
header('Cache-Control: no-store');
header('X-Robots-Tag: noindex, nofollow, noarchive');
header('X-Frame-Options: DENY');
header('X-Content-Type-Options: nosniff');
header('Referrer-Policy: no-referrer');
if (is_https()) {
header('Strict-Transport-Security: max-age=15552000');
}
$target = e($url);
echo '<!doctype html><html lang="de"><head><meta charset="utf-8">'
. '<meta name="viewport" content="width=device-width, initial-scale=1">'
. '<meta name="robots" content="noindex, nofollow">'
. '<title>Umgezogen · ' . e((string) config('legal.business_name', 'Drink it cold')) . '</title>'
. '<style>body{margin:0;min-height:100vh;display:grid;place-items:center;background:#eef6fd;color:#0e1b26;'
. 'padding:1.5rem;font-family:Manrope,"Segoe UI",system-ui,-apple-system,sans-serif}'
. 'main{max-width:34rem;background:#fff;border-radius:1.25rem;padding:2.5rem 2rem;text-align:center;'
. 'box-shadow:0 1.5rem 3rem rgba(14,27,38,.12)}h1{margin:0 0 1rem;font-size:1.6rem;line-height:1.25}'
. 'p{margin:0 0 1rem;line-height:1.6;color:#38505f}a.btn{display:inline-block;margin-top:.5rem;'
. 'padding:.85rem 1.6rem;border-radius:.7rem;background:#196abc;color:#fff;font-weight:700;'
. 'text-decoration:none}a.btn:hover{background:#12518f}</style></head><body><main>'
. '<h1>Diese Adresse ist umgezogen</h1>'
. '<p>Die Terminplanung finden Sie ab sofort unter <strong>' . $target . '</strong>. '
. 'Diese Adresse wird nicht mehr genutzt.</p>'
. '<p><a class="btn" href="' . $target . '">Weiter zur aktuellen Seite</a></p>'
. '</main></body></html>';
}
function start_session(): void
{
if (session_status() === PHP_SESSION_ACTIVE) {
@ -92,7 +130,7 @@ function url(string $path = '/'): string
}
/** Cache-Buster: bei Änderungen an app.css/app.js erhöhen. */
const DIC_ASSET_VERSION = '27';
const DIC_ASSET_VERSION = '29';
function asset(string $path): string
{