Files
usbcheck.it/public/landingpage/dashboard/index.php
2025-11-25 20:59:54 +01:00

48 lines
1.4 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
// public/dashboard/index.php
$pageKey = 'dashboard';
require __DIR__ . '/../../../structure/fileload.php';
// Sprachlogik
$lang = $_GET['lang'] ?? 'de';
$lang = in_array($lang, ['de','en','it','fr'], true) ? $lang : 'de';
// User aus Session holen
$currentUser = $_SESSION['user'] ?? null;
$isLoggedIn = is_array($currentUser) && !empty($currentUser['id']);
// Wenn nicht eingeloggt → zurück zur Login-Seite mit Redirect zurück zum Dashboard
if (!$isLoggedIn) {
if (function_exists('flash_set')) {
flash_set('error', 'Bitte melde dich zuerst an.', 'login');
}
$loginUrl = '/login/?lang=' . urlencode($lang) .
'&view=login' .
'&redirect=' . urlencode('/dashboard/');
header('Location: ' . $loginUrl);
exit;
}
// Seitentitel & Description
$pageTitle = 'Dashboard ' . app_primary_domain();
$pageDescription = 'Verwalte deine USB-Tests, Geräte und Pro-Einstellungen in deinem USBCheck-Dashboard.';
// Navigation kannst du für das Dashboard leer lassen oder anpassen
$navAnchors = [];
// Optional: spezielles Dashboard-JS laden (Platzhalter)
if (function_exists('tpl_add_script')) {
tpl_add_script('/assets/js/dashboard.js', 'footer', true, false, '', null);
}
// Layout-Start
tpl('layout_start', 'structure');
// Dashboard-Content
tpl('dashboard', 'landing', 'dashboard');
// Layout-Ende
tpl('layout_end', 'structure');