This commit is contained in:
@@ -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>
|
||||
|
||||
@@ -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">
|
||||
|
||||
@@ -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; ?>
|
||||
|
||||
@@ -15,6 +15,7 @@ if (!in_array($childGender, ['male', 'female', 'mixed'], true)) {
|
||||
$debugEnabled = defined('APP_DEBUG') && APP_DEBUG === true;
|
||||
$locationTrackingPreference = 'prompt';
|
||||
$showDebugTools = false;
|
||||
$adminSystemNotice = null;
|
||||
if (isset($_SESSION['user_id'])) {
|
||||
try {
|
||||
$pdo = $app->pdo();
|
||||
@@ -25,10 +26,30 @@ if (isset($_SESSION['user_id'])) {
|
||||
$communityConfig = file_exists($communityCfg) ? require $communityCfg : [];
|
||||
$communityAccess = new \App\CommunityAccess($pdo, $communityConfig);
|
||||
$showDebugTools = $debugEnabled && $communityAccess->hasRole((int)$_SESSION['user_id'], 'site_admin');
|
||||
if ($communityAccess->canManageApplications((int)$_SESSION['user_id'])) {
|
||||
$systemSettings = new \App\SystemSettings($pdo);
|
||||
$siteMaintenanceMode = $systemSettings->getBool('site_maintenance_mode');
|
||||
$forumMaintenanceMode = $systemSettings->getBool('forum_maintenance_mode');
|
||||
$googlePlacesEnabled = $systemSettings->getBool('google_places_enabled');
|
||||
$parts = [];
|
||||
if ($siteMaintenanceMode) {
|
||||
$parts[] = 'Seiten-Wartungsmodus aktiv';
|
||||
}
|
||||
if ($forumMaintenanceMode) {
|
||||
$parts[] = 'Forum-Wartungsmodus aktiv';
|
||||
}
|
||||
if ($googlePlacesEnabled) {
|
||||
$parts[] = 'Google-Places-Vorbereitung aktiv';
|
||||
}
|
||||
if ($parts !== []) {
|
||||
$adminSystemNotice = implode(' · ', $parts);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (\Throwable) {
|
||||
$locationTrackingPreference = 'prompt';
|
||||
$showDebugTools = false;
|
||||
$adminSystemNotice = null;
|
||||
}
|
||||
}
|
||||
$debugFiles = [];
|
||||
@@ -105,6 +126,11 @@ if ($debugEnabled) {
|
||||
</script>
|
||||
<?php tpl('matomo', 'structure'); ?>
|
||||
<?php tpl('nav', 'structure'); ?>
|
||||
<?php if ($adminSystemNotice !== null): ?>
|
||||
<div class="container" style="margin-top:14px;">
|
||||
<div class="toast-bar" style="border-color:#d4a857; color:#7c5a17;"><?= htmlspecialchars($adminSystemNotice, ENT_QUOTES) ?></div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<div class="cookie-consent" id="cookieConsentBanner" hidden>
|
||||
<div class="cookie-consent__inner">
|
||||
<div class="cookie-consent__copy">
|
||||
|
||||
@@ -4,6 +4,7 @@ $isLoggedIn = isset($_SESSION['user_id']);
|
||||
$displayName = 'Profil';
|
||||
$profileInitial = 'P';
|
||||
$showAdminLink = false;
|
||||
$showSystemLink = false;
|
||||
|
||||
if ($isLoggedIn) {
|
||||
try {
|
||||
@@ -25,12 +26,14 @@ if ($isLoggedIn) {
|
||||
$communityConfig = require $communityCfg;
|
||||
$communityAccess = new \App\CommunityAccess($pdo, $communityConfig);
|
||||
$showAdminLink = $communityAccess->canModerateForum((int)$_SESSION['user_id']);
|
||||
$showSystemLink = $communityAccess->canManageApplications((int)$_SESSION['user_id']);
|
||||
}
|
||||
}
|
||||
} catch (\Throwable) {
|
||||
$displayName = 'Profil';
|
||||
$profileInitial = 'P';
|
||||
$showAdminLink = false;
|
||||
$showSystemLink = false;
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -61,6 +64,9 @@ if ($isLoggedIn) {
|
||||
<a href="/dashboard?section=events" role="menuitem">Events</a>
|
||||
<a href="/dashboard?section=community" role="menuitem">Community</a>
|
||||
<a href="/dashboard?section=settings" role="menuitem">Einstellungen</a>
|
||||
<?php if ($showSystemLink): ?>
|
||||
<a href="/dashboard?section=system" role="menuitem">System</a>
|
||||
<?php endif; ?>
|
||||
<?php if ($showAdminLink): ?>
|
||||
<a href="/community-admin" role="menuitem">Admin</a>
|
||||
<?php endif; ?>
|
||||
@@ -84,6 +90,9 @@ if ($isLoggedIn) {
|
||||
<a class="btn ghost" href="/dashboard?section=events">Events</a>
|
||||
<a class="btn ghost" href="/dashboard?section=community">Community</a>
|
||||
<a class="btn ghost" href="/dashboard?section=settings">Einstellungen</a>
|
||||
<?php if ($showSystemLink): ?>
|
||||
<a class="btn ghost" href="/dashboard?section=system">System</a>
|
||||
<?php endif; ?>
|
||||
<?php if ($showAdminLink): ?>
|
||||
<a class="btn ghost" href="/community-admin">Admin</a>
|
||||
<?php endif; ?>
|
||||
|
||||
Reference in New Issue
Block a user