ycxyxc
All checks were successful
Deploy / deploy (push) Successful in 1m3s

This commit is contained in:
2026-08-04 00:42:40 +02:00
parent fc34e87622
commit fa6e975df4
17 changed files with 701 additions and 3 deletions

View File

@@ -20,6 +20,9 @@ $sectionLinks = [
'community' => 'Community',
'settings' => 'Einstellungen',
];
if (!empty($canManageSystemSettings)) {
$sectionLinks['system'] = 'System';
}
?>
<main class="section">
<div class="container" style="display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:12px;">
@@ -336,6 +339,76 @@ $sectionLinks = [
</section>
<?php endif; ?>
<?php if ($section === 'system' && !empty($canManageSystemSettings)): ?>
<section class="account-panel">
<div class="account-panel__head">
<h2>System-Einstellungen</h2>
<p class="muted">Globale Schalter für Wartung, externe Ortsdaten und die neue Termin-/Ort-Basis.</p>
</div>
<div class="account-panel__body">
<form method="post" class="stack gap-12">
<input type="hidden" name="action" value="system_settings_update">
<div class="card">
<strong>Wartung und Verfügbarkeit</strong>
<div class="stack gap-10" style="margin-top:12px;">
<label class="chip" style="cursor:pointer; align-items:flex-start;">
<input type="checkbox" name="forum_maintenance_mode" value="1" <?= !empty($systemSettingsValues['forum_maintenance_mode']) && $systemSettingsValues['forum_maintenance_mode'] === '1' ? 'checked' : '' ?> style="margin-right:8px; margin-top:4px;">
<span>Forum-Wartungsmodus aktivieren
<span class="muted small" style="display:block;">Die Community bleibt sichtbar, aber neue Themen und Antworten werden für normale Nutzer gesperrt.</span>
</span>
</label>
<label class="chip" style="cursor:pointer; align-items:flex-start;">
<input type="checkbox" name="site_maintenance_mode" value="1" <?= !empty($systemSettingsValues['site_maintenance_mode']) && $systemSettingsValues['site_maintenance_mode'] === '1' ? 'checked' : '' ?> style="margin-right:8px; margin-top:4px;">
<span>Seiten-Wartungsmodus aktivieren
<span class="muted small" style="display:block;">Normale Nutzer sehen dann statt der Website eine Wartungsseite. Seiten-Admins bleiben weiterhin im System.</span>
</span>
</label>
<div class="stack gap-6">
<label class="label" for="siteMaintenanceMessage">Wartungshinweis</label>
<textarea id="siteMaintenanceMessage" name="site_maintenance_message" class="textarea" rows="3"><?= htmlspecialchars((string)($systemSettingsValues['site_maintenance_message'] ?? ''), ENT_QUOTES) ?></textarea>
</div>
</div>
</div>
<div class="card">
<strong>Orts- und Bewertungsdienste</strong>
<div class="stack gap-10" style="margin-top:12px;">
<label class="chip" style="cursor:pointer; align-items:flex-start;">
<input type="checkbox" name="google_places_enabled" value="1" <?= !empty($systemSettingsValues['google_places_enabled']) && $systemSettingsValues['google_places_enabled'] === '1' ? 'checked' : '' ?> style="margin-right:8px; margin-top:4px;">
<span>Google Places vorbereitend aktivieren
<span class="muted small" style="display:block;">Aktuell noch ohne produktive Anbindung. Der Schalter ist als technische Vorbereitung für spätere Place-ID-, Bewertungs- und Review-Anreicherung gedacht.</span>
</span>
</label>
<div class="stack gap-6">
<label class="label" for="placeDataProvider">Standardanbieter für Ortsdaten</label>
<select id="placeDataProvider" name="place_data_provider" class="select">
<option value="osm" <?= (($systemSettingsValues['place_data_provider'] ?? 'osm') === 'osm') ? 'selected' : '' ?>>OpenStreetMap / Nominatim</option>
<option value="osm_google_optional" <?= (($systemSettingsValues['place_data_provider'] ?? 'osm') === 'osm_google_optional') ? 'selected' : '' ?>>OpenStreetMap primär, Google optional</option>
</select>
<p class="muted small">So bleibt eine kostenfreie Basis aktiv, während Google später zusätzlich vorbereitet werden kann.</p>
</div>
</div>
</div>
<div class="flex gap-12">
<button class="btn" type="submit">System-Einstellungen speichern</button>
</div>
</form>
<div class="card" style="margin-top:18px;">
<strong>Status der neuen Termin-/Ort-Basis</strong>
<ul class="dash-list" style="margin-top:12px;">
<li>Neue Tabellenbasis: <?= !empty($listingCatalogStatus['complete']) ? 'Vollständig initialisiert' : 'Noch unvollständig' ?></li>
<li>Geplante Grundtypen: Event, Partner-Angebot, Ort, redaktioneller Termin</li>
<li>Geplante Zusatzlogik: Kategorien, Serientermine, Preise, Gutscheine, Kapazitäten</li>
<li>Fehlende Tabellen: <?= !empty($listingCatalogStatus['missing']) ? htmlspecialchars(implode(', ', $listingCatalogStatus['missing']), ENT_QUOTES) : 'Keine' ?></li>
</ul>
</div>
</div>
</section>
<?php endif; ?>
</div>
</div>
</div>

View File

@@ -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
</div>
</form>
<div class="forum-hero__cta">
<?php if ($userId): ?>
<?php if ($userId && !$forumMaintenanceMode): ?>
<button class="btn" type="button" data-modal-open="modalThread">Neues Thema</button>
<?php elseif ($userId): ?>
<button class="btn ghost" type="button" disabled>Wartungsmodus aktiv</button>
<?php else: ?>
<a class="btn" href="/login">Einloggen und schreiben</a>
<?php endif; ?>
@@ -82,6 +90,11 @@ $threads = $community
<?php if ($info): ?>
<div class="toast-bar" style="margin-top:14px;"><?= htmlspecialchars($info, ENT_QUOTES) ?></div>
<?php endif; ?>
<?php if ($forumMaintenanceMode): ?>
<div class="toast-bar" style="margin-top:14px; border-color:#d4a857; color:#7c5a17;">
Die Community ist aktuell im Wartungsmodus. Lesen bleibt möglich, neue Themen und Antworten sind für normale Nutzer vorübergehend deaktiviert.
</div>
<?php endif; ?>
<?php if ($selectedBoard): ?>
<div class="forum-shell">
@@ -239,7 +252,7 @@ $threads = $community
</div>
</main>
<?php if ($userId): ?>
<?php if ($userId && !$forumMaintenanceMode): ?>
<div class="modal" id="modalThread">
<div class="panel">
<div class="head flex between center-y">

View File

@@ -12,6 +12,8 @@ $editPostId = (int)($_GET['edit_post'] ?? 0);
$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;
$forumCategories = $community ? $community->listForumCategories() : [];
if ($_SERVER['REQUEST_METHOD'] === 'POST' && $community && $access) {
@@ -21,6 +23,9 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && $community && $access) {
if (!$userId) {
throw new \RuntimeException('Bitte einloggen, um zu antworten.');
}
if ($forumMaintenanceMode && !($access && $access->canModerateForum((int)$userId))) {
throw new \RuntimeException('Die Community ist aktuell im Wartungsmodus. Antworten sind vorübergehend deaktiviert.');
}
if (!$access->canReply((int)$userId)) {
$state = $access->getRestrictionState((int)$userId);
throw new \RuntimeException($state['reason'] ?: 'Du darfst aktuell nicht antworten.');
@@ -151,6 +156,11 @@ $userVotes = ($access && $userId) ? $access->getUserPostVotes((int)$userId, $pos
<?php if ($info): ?>
<div class="toast-bar" style="margin-bottom:14px;"><?= htmlspecialchars($info, ENT_QUOTES) ?></div>
<?php endif; ?>
<?php if ($forumMaintenanceMode): ?>
<div class="toast-bar" style="margin-bottom:14px; border-color:#d4a857; color:#7c5a17;">
Die Community ist aktuell im Wartungsmodus. Lesen bleibt möglich, neue Antworten nur für Admins.
</div>
<?php endif; ?>
<article class="forum-post forum-post--lead">
<aside class="forum-post__author">
@@ -290,7 +300,7 @@ $userVotes = ($access && $userId) ? $access->getUserPostVotes((int)$userId, $pos
<?php endif; ?>
</div>
<?php if ($userId): ?>
<?php if ($userId && !$forumMaintenanceMode): ?>
<?php if ($userRestrictions['reply_blocked']): ?>
<div class="forum-login-note">Du darfst aktuell keine Antworten schreiben. <?= !empty($userRestrictions['reason']) ? htmlspecialchars((string)$userRestrictions['reason'], ENT_QUOTES) : '' ?></div>
<?php else: ?>
@@ -303,6 +313,8 @@ $userVotes = ($access && $userId) ? $access->getUserPostVotes((int)$userId, $pos
<button class="btn" type="submit">Antwort senden</button>
</form>
<?php endif; ?>
<?php elseif ($userId): ?>
<div class="forum-login-note">Die Community ist aktuell im Wartungsmodus. Antworten sind vorübergehend deaktiviert.</div>
<?php else: ?>
<div class="forum-login-note">Bitte <a href="/login">einloggen</a>, um zu antworten.</div>
<?php endif; ?>