This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
<div class="container site-footer__inner">
|
||||
<nav class="site-footer__links" aria-label="Footer">
|
||||
<a href="/impressum">Impressum</a>
|
||||
<a href="/datenschutz">Datenschutz & Cookies</a>
|
||||
<a href="/ueber-uns">Über uns</a>
|
||||
<button class="site-footer__link-button" type="button" data-consent-open>Cookie-Einstellungen</button>
|
||||
</nav>
|
||||
|
||||
@@ -14,15 +14,21 @@ if (!in_array($childGender, ['male', 'female', 'mixed'], true)) {
|
||||
|
||||
$debugEnabled = defined('APP_DEBUG') && APP_DEBUG === true;
|
||||
$locationTrackingPreference = 'prompt';
|
||||
$showDebugTools = false;
|
||||
if (isset($_SESSION['user_id'])) {
|
||||
try {
|
||||
$pdo = $app->pdo();
|
||||
if ($pdo) {
|
||||
$profileSettings = new \App\ProfileSettings($pdo);
|
||||
$locationTrackingPreference = $profileSettings->getLocationTrackingPreference((int)$_SESSION['user_id']);
|
||||
$communityCfg = dirname(__DIR__, 2) . '/config/community.php';
|
||||
$communityConfig = file_exists($communityCfg) ? require $communityCfg : [];
|
||||
$communityAccess = new \App\CommunityAccess($pdo, $communityConfig);
|
||||
$showDebugTools = $debugEnabled && $communityAccess->hasRole((int)$_SESSION['user_id'], 'site_admin');
|
||||
}
|
||||
} catch (\Throwable) {
|
||||
$locationTrackingPreference = 'prompt';
|
||||
$showDebugTools = false;
|
||||
}
|
||||
}
|
||||
$debugFiles = [];
|
||||
@@ -158,7 +164,7 @@ if ($debugEnabled) {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if ($debugEnabled): ?>
|
||||
<?php if ($showDebugTools): ?>
|
||||
<style>
|
||||
.debug-fab { position: fixed; right: 18px; bottom: 18px; z-index: 200; background:#111827; color:#fff; border:none; border-radius: 999px; width: 52px; height:52px; display:flex; align-items:center; justify-content:center; font-size:24px; box-shadow:0 10px 30px rgba(0,0,0,0.2); cursor:pointer; }
|
||||
.debug-modal { position:fixed; inset:0; background: rgba(0,0,0,0.4); display:none; align-items:center; justify-content:center; z-index: 210; padding:16px; }
|
||||
|
||||
@@ -1,7 +1,27 @@
|
||||
<?php
|
||||
$app = app();
|
||||
$isLoggedIn = isset($_SESSION['user_id']);
|
||||
$isDebug = defined('APP_DEBUG') && APP_DEBUG === true;
|
||||
$displayName = 'Profil';
|
||||
$profileInitial = 'P';
|
||||
|
||||
if ($isLoggedIn) {
|
||||
try {
|
||||
$pdo = $app->pdo();
|
||||
if ($pdo) {
|
||||
$stmt = $pdo->prepare('SELECT display_name, first_name FROM user_profiles WHERE user_id = :id LIMIT 1');
|
||||
$stmt->execute(['id' => (int)$_SESSION['user_id']]);
|
||||
$profileRow = $stmt->fetch(PDO::FETCH_ASSOC) ?: [];
|
||||
$displayName = trim((string)($profileRow['display_name'] ?? '')) ?: trim((string)($profileRow['first_name'] ?? '')) ?: 'Profil';
|
||||
$firstChar = mb_substr($displayName, 0, 1);
|
||||
if ($firstChar !== '') {
|
||||
$profileInitial = mb_strtoupper($firstChar);
|
||||
}
|
||||
}
|
||||
} catch (\Throwable) {
|
||||
$displayName = 'Profil';
|
||||
$profileInitial = 'P';
|
||||
}
|
||||
}
|
||||
?>
|
||||
<header class="site-header">
|
||||
<div class="container nav-row">
|
||||
@@ -15,16 +35,21 @@ $isDebug = defined('APP_DEBUG') && APP_DEBUG === true;
|
||||
<nav class="nav-links" aria-label="Hauptmenü">
|
||||
<a href="/">Home</a>
|
||||
<a href="/search">Suche</a>
|
||||
<a href="/#events" data-nav-events>Termine</a>
|
||||
<a href="/community">Community</a>
|
||||
</nav>
|
||||
<div class="nav-actions">
|
||||
<?php if ($isLoggedIn): ?>
|
||||
<a class="btn ghost" href="/dashboard">Dashboard</a>
|
||||
<a class="btn ghost" href="/logout">Logout</a>
|
||||
<?php if ($isDebug): ?>
|
||||
<a class="btn ghost" href="/debug">Debug</a>
|
||||
<?php endif; ?>
|
||||
<div class="profile-menu" data-profile-menu>
|
||||
<button class="profile-menu__trigger" type="button" aria-haspopup="menu" aria-expanded="false" data-profile-menu-trigger>
|
||||
<span class="profile-menu__avatar" aria-hidden="true"><?= htmlspecialchars($profileInitial, ENT_QUOTES) ?></span>
|
||||
<span class="profile-menu__name"><?= htmlspecialchars($displayName, ENT_QUOTES) ?></span>
|
||||
</button>
|
||||
<div class="profile-menu__dropdown" role="menu">
|
||||
<a href="/dashboard" role="menuitem">Übersicht</a>
|
||||
<a href="/dashboard" role="menuitem">Mitgliederbereich</a>
|
||||
<a href="/logout" role="menuitem">Abmelden</a>
|
||||
</div>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<a class="btn ghost" href="/login">Anmelden</a>
|
||||
<a class="btn" href="/register">Kostenlos registrieren</a>
|
||||
@@ -35,14 +60,11 @@ $isDebug = defined('APP_DEBUG') && APP_DEBUG === true;
|
||||
<div class="mobile-menu" id="mobileMenu">
|
||||
<a href="/">Home</a>
|
||||
<a href="/search">Suche</a>
|
||||
<a href="/#events" data-nav-events>Termine</a>
|
||||
<a href="/community">Community</a>
|
||||
<?php if ($isLoggedIn): ?>
|
||||
<a class="btn ghost" href="/dashboard">Dashboard</a>
|
||||
<a class="btn block" href="/logout">Logout</a>
|
||||
<?php if ($isDebug): ?>
|
||||
<a class="btn ghost block" href="/debug">Debug</a>
|
||||
<?php endif; ?>
|
||||
<a class="btn ghost" href="/dashboard">Übersicht</a>
|
||||
<a class="btn ghost" href="/dashboard">Mitgliederbereich</a>
|
||||
<a class="btn block" href="/logout">Abmelden</a>
|
||||
<?php else: ?>
|
||||
<a class="btn ghost" href="/login">Anmelden</a>
|
||||
<a class="btn block" href="/register">Kostenlos registrieren</a>
|
||||
|
||||
Reference in New Issue
Block a user