ab die maus
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
<?php
|
||||
// public/partials/header.php
|
||||
// partials/structure/header.php
|
||||
|
||||
// Aktuelle Domain + Protokoll
|
||||
$scheme = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? 'https' : 'http';
|
||||
$host = $_SERVER['HTTP_HOST'] ?? 'usbcheck.it';
|
||||
$scheme = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? 'https' : 'http';
|
||||
$host = $_SERVER['HTTP_HOST'] ?? 'usbcheck.it';
|
||||
$baseUrl = $scheme . '://' . $host;
|
||||
|
||||
// Wenn $navAnchors NICHT gesetzt ist → leeres Array
|
||||
@@ -18,8 +18,8 @@ if (session_status() !== PHP_SESSION_ACTIVE) {
|
||||
}
|
||||
|
||||
// aktuellen User aus der Session holen (wenn vorhanden)
|
||||
$currentUser = $_SESSION['user'] ?? null;
|
||||
$isLoggedIn = is_array($currentUser) && !empty($currentUser['id']);
|
||||
$currentUser = $_SESSION['user'] ?? null;
|
||||
$isLoggedIn = is_array($currentUser) && !empty($currentUser['id']);
|
||||
|
||||
// Initialen für Avatar bestimmen
|
||||
$userInitials = null;
|
||||
@@ -66,9 +66,10 @@ if ($isLoggedIn) {
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<!-- Navigation -->
|
||||
<!-- Navigation + Controls -->
|
||||
<div class="flex items-center gap-6">
|
||||
|
||||
<!-- Hauptnavigation -->
|
||||
<nav class="md:flex items-center gap-6 text-xs font-medium text-brand-muted uppercase tracking-[0.18em]">
|
||||
<?php foreach ($navAnchors as $item): ?>
|
||||
<a href="<?= htmlspecialchars($item['href']) ?>"
|
||||
@@ -127,12 +128,30 @@ if ($isLoggedIn) {
|
||||
Login
|
||||
</button>
|
||||
<?php else: ?>
|
||||
<!-- Eingeloggt: Avatar anzeigen -->
|
||||
<button id="userAvatar"
|
||||
class="h-9 w-9 rounded-full border border-brand-border bg-brand-surface flex items-center justify-center text-xs font-semibold text-brand-text shadow-soft hover:border-brand-primary transition"
|
||||
aria-label="Mein Konto">
|
||||
<span><?= htmlspecialchars($userInitials) ?></span>
|
||||
</button>
|
||||
<!-- Eingeloggt: Avatar + User-Menü -->
|
||||
<div class="relative">
|
||||
<button id="userAvatar"
|
||||
type="button"
|
||||
class="h-9 w-9 rounded-full border border-brand-border bg-brand-surface flex items-center justify-center text-xs font-semibold text-brand-text shadow-soft hover:border-brand-primary transition"
|
||||
aria-haspopup="true"
|
||||
aria-expanded="false"
|
||||
aria-label="Mein Konto">
|
||||
<span><?= htmlspecialchars($userInitials) ?></span>
|
||||
</button>
|
||||
|
||||
<div id="userMenu"
|
||||
class="hidden absolute right-0 mt-2 w-40 rounded-xl bg-brand-surface border border-brand-border shadow-lg py-1 text-xs text-brand-muted">
|
||||
<a href="/dashboard/?lang=<?= urlencode($lang) ?>"
|
||||
class="flex items-center gap-2 px-3 py-1.5 hover:bg-brand-bg/60 hover:text-brand-primary transition-colors">
|
||||
<span>Dashboard</span>
|
||||
</a>
|
||||
<a href="/auth/logout?lang=<?= urlencode($lang) ?>"
|
||||
id="userMenuLogout"
|
||||
class="flex items-center gap-2 px-3 py-1.5 hover:bg-brand-bg/60 hover:text-red-300 transition-colors">
|
||||
<span>Logout</span>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
</div>
|
||||
|
||||
@@ -20,6 +20,8 @@ if (!isset($pageDescription) || !is_string($pageDescription)) {
|
||||
$pageDescription = '';
|
||||
}
|
||||
|
||||
tpl_add_script('/assets/js/header-user-menu.js', 'footer', true, false, '', null);
|
||||
|
||||
// Kann später genutzt werden, falls du host-spezifische Sachen brauchst
|
||||
$host = $_SERVER['HTTP_HOST'] ?? '';
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user