sadasd
All checks were successful
Deploy / deploy (push) Successful in 56s

This commit is contained in:
2026-08-19 20:04:01 +02:00
parent c2eaa5c186
commit c567d19deb
13 changed files with 177 additions and 38 deletions

View File

@@ -11,10 +11,12 @@ if (!$userId) {
$communityCfg = require __DIR__ . '/../../../config/community.php';
$access = $pdo ? new \App\CommunityAccess($pdo, $communityCfg) : null;
$community = $pdo ? new \App\Community($pdo, $communityCfg) : null;
$migration = $pdo ? new \App\CommunityMigration($pdo) : null;
$listingCatalog = $pdo ? new \App\ListingCatalog($pdo) : null;
$communityPoints = $community ? $community->computePoints((int)$userId) : 0.0;
if (!$access || !$access->canModerateForum((int)$userId)) {
if (!$access || !$access->canAccessCommunityAdmin((int)$userId, $communityPoints)) {
http_response_code(403);
echo '<main class="section"><div class="container"><div class="card dash-card"><h1>Kein Zugriff</h1><p class="muted">Dieser Bereich ist nur für Community-Admins freigegeben.</p></div></div></main>';
return;
@@ -22,9 +24,10 @@ if (!$access || !$access->canModerateForum((int)$userId)) {
$error = '';
$info = '';
$canModerateForum = $access->canModerateForum((int)$userId);
$canManageApplications = $access->canManageApplications((int)$userId) && $access->supportsApplications();
$canManageRoles = $access->canManageRoles((int)$userId);
$canReviewListings = $listingCatalog !== null && !$access->hasRole((int)$userId, 'owner');
$canReviewListings = $listingCatalog !== null && $access->canReviewListings((int)$userId, $communityPoints);
$roleUserSearchQuery = trim((string)($_GET['role_user_query'] ?? ''));
$roleUserSearchResults = ($canManageRoles || $canManageApplications) && $roleUserSearchQuery !== ''
? $access->searchUsers($roleUserSearchQuery, 12)
@@ -194,34 +197,36 @@ $migrationStatus = ($migration && $canManageApplications) ? $migration->status()
</section>
<?php endif; ?>
<section class="forum-board">
<div class="forum-board__head">
<div>
<h2>Offene Meldungen</h2>
<p class="muted">Gemeldete Inhalte prüfen und abschließen.</p>
<?php if ($canModerateForum): ?>
<section class="forum-board">
<div class="forum-board__head">
<div>
<h2>Offene Meldungen</h2>
<p class="muted">Gemeldete Inhalte prüfen und abschließen.</p>
</div>
</div>
</div>
<div class="forum-admin-list">
<?php foreach ($reports as $report): ?>
<article class="forum-admin-item">
<div>
<strong><?= htmlspecialchars((string)$report['target_type'], ENT_QUOTES) ?> #<?= (int)$report['target_id'] ?></strong>
<p><?= nl2br(htmlspecialchars((string)$report['reason'], ENT_QUOTES)) ?></p>
<p class="muted small">Gemeldet von <?= htmlspecialchars((string)($report['reporter_name'] ?: 'Mitglied'), ENT_QUOTES) ?> am <?= htmlspecialchars((string)$report['created_at'], ENT_QUOTES) ?></p>
</div>
<form method="post" class="forum-admin-item__actions">
<input type="hidden" name="action" value="report_resolve">
<input type="hidden" name="report_id" value="<?= (int)$report['id'] ?>">
<textarea name="moderator_note" class="textarea" rows="3" placeholder="Moderationsnotiz"></textarea>
<button class="btn" type="submit">Als erledigt markieren</button>
</form>
</article>
<?php endforeach; ?>
<?php if (!$reports): ?>
<div class="forum-empty">Keine offenen Meldungen.</div>
<?php endif; ?>
</div>
</section>
<div class="forum-admin-list">
<?php foreach ($reports as $report): ?>
<article class="forum-admin-item">
<div>
<strong><?= htmlspecialchars((string)$report['target_type'], ENT_QUOTES) ?> #<?= (int)$report['target_id'] ?></strong>
<p><?= nl2br(htmlspecialchars((string)$report['reason'], ENT_QUOTES)) ?></p>
<p class="muted small">Gemeldet von <?= htmlspecialchars((string)($report['reporter_name'] ?: 'Mitglied'), ENT_QUOTES) ?> am <?= htmlspecialchars((string)$report['created_at'], ENT_QUOTES) ?></p>
</div>
<form method="post" class="forum-admin-item__actions">
<input type="hidden" name="action" value="report_resolve">
<input type="hidden" name="report_id" value="<?= (int)$report['id'] ?>">
<textarea name="moderator_note" class="textarea" rows="3" placeholder="Moderationsnotiz"></textarea>
<button class="btn" type="submit">Als erledigt markieren</button>
</form>
</article>
<?php endforeach; ?>
<?php if (!$reports): ?>
<div class="forum-empty">Keine offenen Meldungen.</div>
<?php endif; ?>
</div>
</section>
<?php endif; ?>
<?php if ($canManageRoles || $canManageApplications): ?>
<section class="forum-board">

View File

@@ -147,8 +147,10 @@ if (!empty($canManageProfileLevels)) {
}
$showEventTypeChoice = !$editing && (($section ?? 'events') === 'places') && $requestedCreateListingKind === null;
$modalSectionTarget = ($editingListing || ($section ?? '') === 'places') ? 'places' : 'events';
if (!empty($canManageSystemSettings)) {
if (!empty($canManageCategories)) {
$sectionLinks['categories'] = 'Kategorien';
}
if (!empty($canManageSystemSettings)) {
$sectionLinks['system'] = 'System';
}
?>
@@ -951,7 +953,7 @@ if (!empty($canManageSystemSettings)) {
</section>
<?php endif; ?>
<?php if ($section === 'categories' && !empty($canManageSystemSettings)): ?>
<?php if ($section === 'categories' && !empty($canManageCategories)): ?>
<section class="account-panel">
<div class="account-panel__head">
<h2>Kategorien</h2>
@@ -991,6 +993,11 @@ if (!empty($canManageSystemSettings)) {
<button class="btn ghost" type="submit">Zusammenführen</button>
</div>
</form>
<form method="post" style="margin-top:12px;">
<input type="hidden" name="action" value="category_confirm">
<input type="hidden" name="source_category_slug" value="<?= htmlspecialchars((string)$categoryItem['slug'], ENT_QUOTES) ?>">
<button class="btn" type="submit">Bestätigen</button>
</form>
</div>
<?php endforeach; ?>
</div>

View File

@@ -6,6 +6,7 @@ $profileInitial = 'P';
$showAdminLink = false;
$showSystemLink = false;
$showProfileLevelsLink = false;
$showCategoriesLink = false;
if ($isLoggedIn) {
try {
@@ -25,10 +26,13 @@ if ($isLoggedIn) {
$communityCfg = dirname(__DIR__, 2) . '/config/community.php';
if (file_exists($communityCfg)) {
$communityConfig = require $communityCfg;
$community = new \App\Community($pdo, $communityConfig);
$communityAccess = new \App\CommunityAccess($pdo, $communityConfig);
$showAdminLink = $communityAccess->canModerateForum((int)$_SESSION['user_id']);
$navCommunityPoints = $community->computePoints((int)$_SESSION['user_id']);
$showAdminLink = $communityAccess->canAccessCommunityAdmin((int)$_SESSION['user_id'], $navCommunityPoints);
$showSystemLink = $communityAccess->canManageApplications((int)$_SESSION['user_id']);
$showProfileLevelsLink = $communityAccess->canManageRoles((int)$_SESSION['user_id']);
$showCategoriesLink = $communityAccess->canManageCategories((int)$_SESSION['user_id'], $navCommunityPoints);
}
}
} catch (\Throwable) {
@@ -37,6 +41,7 @@ if ($isLoggedIn) {
$showAdminLink = false;
$showSystemLink = false;
$showProfileLevelsLink = false;
$showCategoriesLink = false;
}
}
?>
@@ -68,6 +73,9 @@ if ($isLoggedIn) {
<a href="/dashboard?section=places" role="menuitem">Orte &amp; Veranstaltungen</a>
<a href="/dashboard?section=community" role="menuitem">Community</a>
<a href="/dashboard?section=settings" role="menuitem">Einstellungen</a>
<?php if ($showCategoriesLink): ?>
<a href="/dashboard?section=categories" role="menuitem">Kategorien</a>
<?php endif; ?>
<?php if ($showProfileLevelsLink): ?>
<a href="/dashboard?section=profile-levels" role="menuitem">Profil-Levels</a>
<?php endif; ?>
@@ -98,6 +106,9 @@ if ($isLoggedIn) {
<a class="btn ghost" href="/dashboard?section=places">Orte &amp; Veranstaltungen</a>
<a class="btn ghost" href="/dashboard?section=community">Community</a>
<a class="btn ghost" href="/dashboard?section=settings">Einstellungen</a>
<?php if ($showCategoriesLink): ?>
<a class="btn ghost" href="/dashboard?section=categories">Kategorien</a>
<?php endif; ?>
<?php if ($showProfileLevelsLink): ?>
<a class="btn ghost" href="/dashboard?section=profile-levels">Profil-Levels</a>
<?php endif; ?>