PDO::ERRMODE_EXCEPTION, PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC] ); } // Standard-Standort des eingeloggten Benutzers laden $currentLocation = null; if (!empty($defaultLocation)) { // Seite hat den Standort bereits geladen – direkt übernehmen $currentLocation = $defaultLocation; } elseif ($loggedIn && isset($_SESSION['user_id'])) { // Eigene DB-Verbindung aufbauen falls die Seite keine bereitstellt $stmtLoc = $pdoHeader->prepare( 'SELECT id, name, latitude, longitude, elevation, timezone FROM app_user_locations WHERE user_id = ? AND is_default = 1 LIMIT 1' ); $stmtLoc->execute([(int)$_SESSION['user_id']]); $currentLocation = $stmtLoc->fetch() ?: null; } if ($isAdmin && $pdoHeader !== null) { $stmtPendingUsers = $pdoHeader->query('SELECT COUNT(*) FROM app_users WHERE is_active = 0'); $pendingApprovals = (int)$stmtPendingUsers->fetchColumn(); } $menuGroups = [ [ 'title' => 'Himmel & Planeten', 'links' => [ ['href' => 'moonphase.php', 'label' => 'Mondphase'], ['href' => 'index_py.php', 'label' => 'Sonne & Mond'], ['href' => 'planetensichtbarkeit.php', 'label' => 'Planetensichtbarkeit'], ['href' => 'solarsystem.php', 'label' => 'Sonnensystem'], ['href' => 'jupitersystem.php', 'label' => 'Jupitersystem'], ['href' => 'tagbogen.php', 'label' => 'Tagbogen'], ['href' => 'sternenhimmel.php', 'label' => 'Sternenhimmel'], ['href' => 'geocron/index.php', 'label' => 'Geocron'], ['href' => 'geocron3d.php', 'label' => 'Geocron 3D'], ], ], [ 'title' => 'Finsternisse & Bedeckungen', 'links' => [ ['href' => 'mondfinsternis.php', 'label' => 'Mondfinsternis'], ['href' => 'sonnenfinsternis.php', 'label' => 'Sonnenfinsternis'], ['href' => 'bedeckung.php', 'label' => 'Bedeckungsphänomene'], ['href' => 'sternbedeckungen.php', 'label' => 'Mond-Stern-Bedeckungen'], ], ], ]; $adminLinks = [ ['href' => 'admin_users.php', 'label' => 'Benutzerverwaltung'], ]; ?>