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