This commit is contained in:
@@ -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