HTML; } function html_navbar(string $active = ''): void { $user = current_user(); $isAdmin = is_admin(); $pages = [ 'mail' => ['/', 'bi-envelope-fill', 'Courriers'], ]; if ($isAdmin) { $pages['accounts'] = ['/admin/accounts.php', 'bi-people-fill', 'Comptes']; $pages['domain'] = ['/admin/domain.php', 'bi-gear-fill', 'Configuration']; $pages['status'] = ['/admin/index.php', 'bi-activity', 'Tableau de bord']; $pages['users'] = ['/admin/users.php', 'bi-person-lock', 'Utilisateurs']; } $roleBadge = $isAdmin ? 'admin' : 'user'; echo ''; } function html_foot(): void { echo << HTML; } function flash(string $type, string $msg): void { $_SESSION['flash'] = ['type' => $type, 'msg' => $msg]; } function flash_render(): void { if (!empty($_SESSION['flash'])) { $f = $_SESSION['flash']; unset($_SESSION['flash']); $icon = $f['type'] === 'success' ? 'check-circle-fill' : 'exclamation-triangle-fill'; echo "
"; echo "{$f['msg']}"; echo '
'; } }