This commit is contained in:
@@ -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">
|
||||
|
||||
Reference in New Issue
Block a user