From fa6e975df43c2ce2e6ea4f81d5fa00e1df80b7d5 Mon Sep 17 00:00:00 2001 From: Lars Gebhardt-Kusche Date: Tue, 4 Aug 2026 00:42:40 +0200 Subject: [PATCH] ycxyxc --- Internal/de/PROJECT_CONTEXT.md | 7 + Internal/de/PROJECT_STRUCTURE.md | 2 + Internal/de/README.md | 3 + Internal/en/PROJECT_CONTEXT.md | 7 + Internal/en/PROJECT_STRUCTURE.md | 2 + Internal/en/README.md | 3 + README.md | 3 + config/fileload.php | 42 +++++ partials/landing/account/dashboard.php | 73 +++++++++ partials/landing/community/index.php | 17 +- partials/landing/community/thread.php | 14 +- partials/structure/layout_start.php | 26 +++ partials/structure/nav.php | 9 ++ schema.sql | 137 ++++++++++++++++ src/App/AccountPages.php | 38 +++++ src/App/ListingCatalog.php | 214 +++++++++++++++++++++++++ src/App/SystemSettings.php | 107 +++++++++++++ 17 files changed, 701 insertions(+), 3 deletions(-) create mode 100644 src/App/ListingCatalog.php create mode 100644 src/App/SystemSettings.php diff --git a/Internal/de/PROJECT_CONTEXT.md b/Internal/de/PROJECT_CONTEXT.md index ee6e9f3..3c979e1 100644 --- a/Internal/de/PROJECT_CONTEXT.md +++ b/Internal/de/PROJECT_CONTEXT.md @@ -12,6 +12,8 @@ Papa-Kind-Treff ist eine PHP-basierte Plattform für Väter. Kernbereiche sind l - Die Community ist hierarchisch aufgebaut: Kategorien -> Boards -> Threads -> Posts. - Moderation ist vom normalen Community-Frontend getrennt. - Standortfunktionen sind relevant für lokale Events, Termine und Treffen. +- Die bestehende `events`-Logik bleibt zunächst aktiv, wird aber künftig von einer allgemeineren Listing-/Ort-/Termin-Struktur abgelöst. +- Seiten-Admins erhalten eine eigene System-Sektion für globale Betriebs- und Diensteschalter. ## Konto / Mitgliederbereich - Profil-Menü aktuell: `Profil`, `Kinder`, `Events`, `Community`, `Einstellungen`, `Abmelden` @@ -26,6 +28,11 @@ Papa-Kind-Treff ist eine PHP-basierte Plattform für Väter. Kernbereiche sind l - Geschäftslogik unter `src/App/` - Globales Frontend vor allem über `public/assets/js/app.js` und `public/assets/css/app.css` +## Neue Ausbaustufe: Termin-/Ort-System +- Neue Tabellenbasis: `listing_places`, `listings`, `listing_occurrences`, `listing_prices`, `listing_benefits`, `listing_categories` +- Ziel: spätere Unterscheidung zwischen eigenem Event, Partner-Angebot, allgemeinem Ort und redaktionellem Termin +- Google ist noch nicht aktiv integriert; das System wird nur vorbereitend über Settings und Datenfelder darauf ausgelegt + ## Pflegehinweis Bei Änderungen immer auch die parallelen Dateien in `Internal/en/` prüfen und inhaltlich gleichziehen. diff --git a/Internal/de/PROJECT_STRUCTURE.md b/Internal/de/PROJECT_STRUCTURE.md index 3ce52bb..68319fd 100644 --- a/Internal/de/PROJECT_STRUCTURE.md +++ b/Internal/de/PROJECT_STRUCTURE.md @@ -16,6 +16,8 @@ Stand: 2026-08-03 - aktive Styles: `src/App/Avatar/Lorelei.php`, `src/App/Avatar/Croodles.php` - Profil-/Kinder-/Event-Logik im Mitgliederbereich: `partials/landing/account/dashboard.php` - Consent- und rechtliche Texte: `public/page/datenschutz.php` +- System-Einstellungen: `src/App/SystemSettings.php` +- neue Listing-/Ort-Basis: `src/App/ListingCatalog.php` ## Dokumentationsregel Kanonische interne Dokumentation: diff --git a/Internal/de/README.md b/Internal/de/README.md index 6ae00f3..dfa6f80 100644 --- a/Internal/de/README.md +++ b/Internal/de/README.md @@ -20,6 +20,8 @@ Papa-Kind-Treff ist eine PHP-basierte Plattform für Väter mit Fokus auf lokale - Konto-E-Mails sowie sensible Profilfelder werden app-seitig verschlüsselt gespeichert - Kinder können angelegt, bearbeitet und gelöscht werden - Profiladresse mit verschlüsselter Straße/Hausnummer, Adresssuche, Browser-Übernahme und Validierung +- System-Sektion für Seiten-Admins mit Wartungs- und Diensteschaltern +- neue Datenbasis für ein späteres Termin-, Ort- und Veranstaltungssystem angelegt ## Wording-Regel - Primärbegriff im Produkt: `Events` @@ -32,6 +34,7 @@ Papa-Kind-Treff ist eine PHP-basierte Plattform für Väter mit Fokus auf lokale - App-Logik: `src/App/` - Assets: `public/assets/` - Datenbankschema: `schema.sql` +- neue Basisklassen: `src/App/SystemSettings.php`, `src/App/ListingCatalog.php` ## Datenschutz und Sicherheit - Passwort-Hashes über Argon2id diff --git a/Internal/en/PROJECT_CONTEXT.md b/Internal/en/PROJECT_CONTEXT.md index 7b1fad2..695954f 100644 --- a/Internal/en/PROJECT_CONTEXT.md +++ b/Internal/en/PROJECT_CONTEXT.md @@ -12,6 +12,8 @@ Papa-Kind-Treff is a PHP-based platform for fathers. Core areas are local events - The community is hierarchical: categories -> boards -> threads -> posts. - Moderation is separated from the normal community frontend. - Location features are important for local discovery. +- The existing `events` logic remains active for now, but future growth should move toward a broader listing, place, and occurrence model. +- Site admins get a dedicated system section for global operating and service flags. ## Account / Member Area - Profile menu currently contains `Profile`, `Children`, `Events`, `Community`, `Settings`, `Logout`. @@ -26,6 +28,11 @@ Papa-Kind-Treff is a PHP-based platform for fathers. Core areas are local events - business logic under `src/App/` - global frontend mainly via `public/assets/js/app.js` and `public/assets/css/app.css` +## New Expansion Stage: Listings and Places +- New table base: `listing_places`, `listings`, `listing_occurrences`, `listing_prices`, `listing_benefits`, `listing_categories` +- Goal: later distinguish between own event, partner offer, general place, and editorial event entry +- Google is not integrated productively yet; the system is only being prepared for it via settings and data fields + ## Maintenance Note - Whenever one of these files changes, the matching files in `Internal/de/` and `Internal/en/` must be kept aligned. - The root `README.md` acts as the startup document for new chats and should be reviewed alongside major context changes. diff --git a/Internal/en/PROJECT_STRUCTURE.md b/Internal/en/PROJECT_STRUCTURE.md index 0ba6bc4..dedd74e 100644 --- a/Internal/en/PROJECT_STRUCTURE.md +++ b/Internal/en/PROJECT_STRUCTURE.md @@ -16,6 +16,8 @@ Updated: 2026-08-03 - active avatar styles: `src/App/Avatar/Lorelei.php`, `src/App/Avatar/Croodles.php` - profile/children/event logic inside member area: `partials/landing/account/dashboard.php` - consent and legal texts: `public/page/datenschutz.php` +- system settings: `src/App/SystemSettings.php` +- new listing/place base: `src/App/ListingCatalog.php` ## Documentation Rule - canonical internal documentation lives in `Internal/de/` and `Internal/en/` diff --git a/Internal/en/README.md b/Internal/en/README.md index 291655a..1d4ed5f 100644 --- a/Internal/en/README.md +++ b/Internal/en/README.md @@ -20,6 +20,8 @@ Papa-Kind-Treff is a PHP-based platform for fathers focused on local events, app - account emails and sensitive profile fields are stored encrypted application-side - children can be created, edited, and deleted - profile address supports encrypted street/house number, address search, browser import, and validation +- system section for site admins with maintenance and service toggles +- new data foundation prepared for a broader event, place, and listing system ## Core Wording Rule - Primary product term: `Events` @@ -31,6 +33,7 @@ Papa-Kind-Treff is a PHP-based platform for fathers focused on local events, app - application logic: `src/App/` - assets: `public/assets/` - database schema: `schema.sql` +- new base classes: `src/App/SystemSettings.php`, `src/App/ListingCatalog.php` ## Privacy and Security - password hashes via Argon2id diff --git a/README.md b/README.md index a1fd8e1..8dc95d1 100644 --- a/README.md +++ b/README.md @@ -27,12 +27,15 @@ Papa-Kind-Treff ist eine PHP-basierte Plattform für Väter mit Fokus auf: - lokale Events, Termine und Treffen - Community-Austausch - geschützten Mitgliederbereich mit Profil, Kinderinfos und eigenen Events +- neue Basis für ein übergreifendes Termin-, Ort- und Veranstaltungssystem ## Wichtige aktuelle Produktregeln - Primärbegriff im Produkt: `Events` - `Termine` und `Treffen` ergänzend in SEO- und Erklärungstexten - Hauptnavigation aktuell: `Home`, `Event Suche`, `Community` - Profil-Menü aktuell: `Profil`, `Kinder`, `Events`, `Community`, `Einstellungen`, `Abmelden` +- neue interne Grundstruktur: `listing_places`, `listings`, `listing_occurrences`, `listing_prices`, `listing_benefits` +- Seiten-Admins haben zusätzlich eine System-Sektion für globale Wartungs- und Diensteschalter ## Datenschutz und Sicherheit - sensible Profilfelder werden app-seitig verschlüsselt gespeichert diff --git a/config/fileload.php b/config/fileload.php index 1d94f93..d1f1bed 100755 --- a/config/fileload.php +++ b/config/fileload.php @@ -37,5 +37,47 @@ $app = \App\App::get(); $app->session()->start(); $clientId = $app->session()->ensureClientId(); +try { + $pdo = $app->pdo(); + if ($pdo) { + $settings = new \App\SystemSettings($pdo); + $settings->ensureSchema(); + if ($settings->getBool('site_maintenance_mode')) { + $isAdminUser = false; + if (isset($_SESSION['user_id'])) { + $communityCfg = __DIR__ . '/community.php'; + $communityConfig = file_exists($communityCfg) ? require $communityCfg : []; + $communityAccess = new \App\CommunityAccess($pdo, $communityConfig); + $isAdminUser = $communityAccess->canManageApplications((int)$_SESSION['user_id']); + } + + $uriPath = parse_url($_SERVER['REQUEST_URI'] ?? '/', PHP_URL_PATH) ?: '/'; + $uriPath = preg_replace('~/{2,}~', '/', $uriPath); + $uriPath = trim($uriPath, '/'); + $maintenanceWhitelist = [ + 'login', + 'logout', + 'verify', + 'reset', + 'impressum', + 'datenschutz', + ]; + + if (!$isAdminUser && !in_array($uriPath, $maintenanceWhitelist, true)) { + http_response_code(503); + header('Retry-After: 600'); + $message = htmlspecialchars( + $settings->get('site_maintenance_message', 'Papa-Kind-Treff ist gerade kurz in Wartung. Bitte versuche es in Kürze erneut.') ?? '', + ENT_QUOTES + ); + echo 'Wartung

Papa-Kind-Treff ist kurz in Wartung

' . $message . '

'; + exit; + } + } + } +} catch (\Throwable) { + // Fail open to avoid locking the whole site on transient settings/schema issues. +} + // Optionally expose a single global for templates if desired $GLOBALS['client_id'] = $clientId; diff --git a/partials/landing/account/dashboard.php b/partials/landing/account/dashboard.php index 705537f..80adee6 100755 --- a/partials/landing/account/dashboard.php +++ b/partials/landing/account/dashboard.php @@ -20,6 +20,9 @@ $sectionLinks = [ 'community' => 'Community', 'settings' => 'Einstellungen', ]; +if (!empty($canManageSystemSettings)) { + $sectionLinks['system'] = 'System'; +} ?>
@@ -336,6 +339,76 @@ $sectionLinks = [ + + + +
diff --git a/partials/landing/community/index.php b/partials/landing/community/index.php index d6434d7..27f5f9a 100644 --- a/partials/landing/community/index.php +++ b/partials/landing/community/index.php @@ -12,6 +12,9 @@ $boardSlug = trim((string)($_GET['board'] ?? '')); $communityCfg = require __DIR__ . '/../../../config/community.php'; $community = $pdo ? new \App\Community($pdo, $communityCfg) : null; $access = $pdo ? new \App\CommunityAccess($pdo, $communityCfg) : null; +$systemSettings = $pdo ? new \App\SystemSettings($pdo) : null; +$forumMaintenanceMode = $systemSettings ? $systemSettings->getBool('forum_maintenance_mode') : false; +$isForumAdmin = ($access && $userId) ? $access->canModerateForum((int)$userId) : false; $forumCategories = $community ? $community->listForumCategories() : []; $selectedBoard = ($community && $boardSlug !== '') ? $community->getBoardBySlug($boardSlug) : null; @@ -23,6 +26,9 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && $community && $access) { if (!$userId) { throw new \RuntimeException('Bitte einloggen, um Themen zu erstellen.'); } + if ($forumMaintenanceMode && !$isForumAdmin) { + throw new \RuntimeException('Die Community ist aktuell im Wartungsmodus. Neue Themen sind vorübergehend deaktiviert.'); + } if (!$access->canCreateThread((int)$userId)) { $state = $access->getRestrictionState((int)$userId); throw new \RuntimeException($state['reason'] ?: 'Du darfst aktuell keine Themen erstellen.'); @@ -67,8 +73,10 @@ $threads = $community
- + + + Einloggen und schreiben @@ -82,6 +90,11 @@ $threads = $community
+ +
+ Die Community ist aktuell im Wartungsmodus. Lesen bleibt möglich, neue Themen und Antworten sind für normale Nutzer vorübergehend deaktiviert. +
+
@@ -239,7 +252,7 @@ $threads = $community
- +