asdasd
All checks were successful
Deploy / deploy (push) Successful in 51s

This commit is contained in:
2026-07-24 20:40:49 +02:00
parent cbecbef830
commit d507ae7bc7
3 changed files with 15 additions and 43 deletions

View File

@@ -13,9 +13,6 @@ $sectionLinks = [
'community' => 'Community',
'settings' => 'Einstellungen',
];
if (in_array('admin', $allowedSections ?? [], true)) {
$sectionLinks['admin'] = 'Admin';
}
?>
<main class="section">
<div class="container" style="display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:12px;">
@@ -277,33 +274,6 @@ if (in_array('admin', $allowedSections ?? [], true)) {
</section>
<?php endif; ?>
<?php if ($section === 'admin' && in_array('admin', $allowedSections ?? [], true)): ?>
<section class="account-panel">
<div class="account-panel__head">
<h2>Community-Verwaltung</h2>
<p class="muted">Moderation, Bewerbungen, Rollen und Migration.</p>
</div>
<div class="account-panel__body">
<div class="flex gap-12" style="margin:0 0 16px 0; flex-wrap:wrap;">
<a class="btn" href="/community-admin">Zum Admin-Bereich</a>
</div>
<?php if ($communityMigrationStatus): ?>
<ul class="dash-list">
<li>Status: <?= !empty($communityMigrationStatus['complete']) ? 'Vollständig eingerichtet' : 'Migration noch offen' ?></li>
<li>Fehlende Bausteine: <?= !empty($communityMigrationStatus['missing']) ? htmlspecialchars(implode(', ', $communityMigrationStatus['missing']), ENT_QUOTES) : 'Keine' ?></li>
</ul>
<?php else: ?>
<p class="muted small">Migrationsstatus konnte nicht ermittelt werden.</p>
<?php endif; ?>
<?php if (!empty($communityIsSiteAdmin)): ?>
<form method="post" style="margin-top:12px;">
<input type="hidden" name="action" value="community_migrate">
<button class="btn" type="submit">Community-Migration ausführen</button>
</form>
<?php endif; ?>
</div>
</section>
<?php endif; ?>
</div>
</div>
</div>

View File

@@ -3,6 +3,7 @@ $app = app();
$isLoggedIn = isset($_SESSION['user_id']);
$displayName = 'Profil';
$profileInitial = 'P';
$showAdminLink = false;
if ($isLoggedIn) {
try {
@@ -16,10 +17,18 @@ if ($isLoggedIn) {
if ($firstChar !== '') {
$profileInitial = mb_strtoupper($firstChar);
}
$communityCfg = dirname(__DIR__, 2) . '/config/community.php';
if (file_exists($communityCfg)) {
$communityConfig = require $communityCfg;
$communityAccess = new \App\CommunityAccess($pdo, $communityConfig);
$showAdminLink = $communityAccess->canModerateForum((int)$_SESSION['user_id']);
}
}
} catch (\Throwable) {
$displayName = 'Profil';
$profileInitial = 'P';
$showAdminLink = false;
}
}
?>
@@ -50,6 +59,9 @@ if ($isLoggedIn) {
<a href="/dashboard?section=events" role="menuitem">Termine</a>
<a href="/dashboard?section=community" role="menuitem">Community</a>
<a href="/dashboard?section=settings" role="menuitem">Einstellungen</a>
<?php if ($showAdminLink): ?>
<a href="/community-admin" role="menuitem">Admin</a>
<?php endif; ?>
<a href="/logout" role="menuitem">Abmelden</a>
</div>
</div>
@@ -70,6 +82,9 @@ if ($isLoggedIn) {
<a class="btn ghost" href="/dashboard?section=events">Termine</a>
<a class="btn ghost" href="/dashboard?section=community">Community</a>
<a class="btn ghost" href="/dashboard?section=settings">Einstellungen</a>
<?php if ($showAdminLink): ?>
<a class="btn ghost" href="/community-admin">Admin</a>
<?php endif; ?>
<a class="btn block" href="/logout">Abmelden</a>
<?php else: ?>
<a class="btn ghost" href="/login">Anmelden</a>