Page not found or not yet implemented.
getAll('users'); if (empty($users) && !isset($_GET['setup'])) { header('Location: setup.php'); exit; } // Handle logout if (isset($_GET['action']) && $_GET['action'] === 'logout') { $auth->logout(); header('Location: login.php'); exit; } // Check authentication if (!$auth->isLoggedIn()) { header('Location: login.php'); exit; } // Get current user $currentUser = $auth->getCurrentUser(); // Route handling $page = $_GET['page'] ?? 'dashboard'; $action = $_GET['action'] ?? 'index'; // Define available pages $pages = [ 'dashboard' => ['file' => 'pages/dashboard.php', 'title' => 'Dashboard', 'icon' => 'home', 'roles' => ['admin', 'operator', 'readonly']], 'asns' => ['file' => 'pages/asns.php', 'title' => 'ASNs', 'icon' => 'organization', 'roles' => ['admin', 'operator', 'readonly']], 'nodes' => ['file' => 'pages/nodes.php', 'title' => 'Nodes', 'icon' => 'server', 'roles' => ['admin', 'operator', 'readonly']], 'peers' => ['file' => 'pages/peers.php', 'title' => 'Peers', 'icon' => 'git-branch', 'roles' => ['admin', 'operator', 'readonly']], 'templates' => ['file' => 'pages/templates.php', 'title' => 'Templates', 'icon' => 'file-code', 'roles' => ['admin', 'operator', 'readonly']], 'hosts' => ['file' => 'pages/hosts.php', 'title' => 'Hosts', 'icon' => 'terminal', 'roles' => ['admin', 'operator']], 'config' => ['file' => 'pages/config.php', 'title' => 'Configuration', 'icon' => 'file', 'roles' => ['admin', 'operator', 'readonly']], 'execute' => ['file' => 'pages/execute.php', 'title' => 'Execute', 'icon' => 'play', 'roles' => ['admin', 'operator']], 'logs' => ['file' => 'pages/logs.php', 'title' => 'Logs', 'icon' => 'history', 'roles' => ['admin', 'operator', 'readonly']], 'backups' => ['file' => 'pages/backups.php', 'title' => 'Backups', 'icon' => 'archive', 'roles' => ['admin']], 'users' => ['file' => 'pages/users.php', 'title' => 'Users', 'icon' => 'people', 'roles' => ['admin']], 'settings' => ['file' => 'pages/settings.php', 'title' => 'Settings', 'icon' => 'gear', 'roles' => ['admin']], ]; // Check if page exists if (!isset($pages[$page])) { $page = 'dashboard'; } // Check page access if (!in_array($currentUser['role'], $pages[$page]['roles'])) { $page = 'dashboard'; } $currentPage = $pages[$page]; // Helper function to check permission function hasPermission(string $permission): bool { global $auth; return $auth->hasPermission($permission); } // Helper function to generate CSRF token field function csrfField(): string { global $auth; return ''; } // Helper function to escape output function e($value): string { return htmlspecialchars((string) $value, ENT_QUOTES, 'UTF-8'); } // Helper function to format date function formatDate($date): string { if (empty($date)) return '-'; return date('Y-m-d H:i:s', strtotime($date)); } // Helper function to format bytes function formatBytes(int $bytes, int $precision = 2): string { $units = ['B', 'KB', 'MB', 'GB', 'TB']; $bytes = max($bytes, 0); $pow = floor(($bytes ? log($bytes) : 0) / log(1024)); $pow = min($pow, count($units) - 1); $bytes /= pow(1024, $pow); return round($bytes, $precision) . ' ' . $units[$pow]; } ?>
Page not found or not yet implemented.