$webRoot . '/public/theme/venix/css/app.min.css', '/theme/venix/css/admin-home.css' => $webRoot . '/public/theme/venix/css/admin-home.css', ]; $sidebarScript = static function () use ($webRoot): string { $footer = file_get_contents($webRoot . '/resources/views/venix/admin/static_footer.tpl'); if ($footer === false) { throw new RuntimeException('Unable to read the administrator footer template.'); } preg_match_all('/ HTML; return str_replace( ['__LABEL__', '__PATH__', '__MENU_ROWS__', '__CARDS__', '__REAL_SCRIPT__'], [$label, htmlspecialchars($path, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8'), $menuRows, $cards, $sidebarScript()], $document ); }; $path = parse_url((string) ($_SERVER['REQUEST_URI'] ?? '/'), PHP_URL_PATH); if (!is_string($path)) { http_response_code(400); exit; } if ($path === '/no-content') { http_response_code(204); exit; } if ($path === '/') { header('Location: /a', true, 302); exit; } if (isset($assets[$path])) { $content = file_get_contents($assets[$path]); if ($content === false) { http_response_code(500); exit; } header('Content-Type: text/css; charset=utf-8'); } elseif ($path === '/a' || $path === '/b') { if ($path === '/b') { usleep(800000); } $content = $renderPage($path); header('Content-Type: text/html; charset=utf-8'); } else { http_response_code(404); exit; } header('Content-Length: ' . strlen($content)); header('Cache-Control: no-cache'); echo $content;