'text/css; charset=UTF-8', 'js' => 'application/javascript; charset=UTF-8', 'json' => 'application/json; charset=UTF-8', 'map' => 'application/json; charset=UTF-8', 'svg' => 'image/svg+xml', 'png' => 'image/png', 'jpg' => 'image/jpeg', 'jpeg' => 'image/jpeg', 'gif' => 'image/gif', 'webp' => 'image/webp', 'ico' => 'image/x-icon', ]; if (isset($contentTypes[$extension])) { header('Content-Type: ' . $contentTypes[$extension]); } header('Content-Length: ' . (string) filesize($filePath)); readfile($filePath); }; if ($adminReactFile && is_file($adminReactFile)) { $sendStaticFile($adminReactFile); return true; } $publicFile = realpath($publicRoot . $path); if ($path !== '/' && $publicFile !== false && str_starts_with($publicFile, $publicRoot) && is_file($publicFile)) { $sendStaticFile($publicFile); return true; } $publicIndexFile = realpath(rtrim($publicRoot . $path, '/') . '/index.html'); if ($path !== '/' && rtrim($path, '/') !== '/back' && $publicIndexFile !== false && str_starts_with($publicIndexFile, $publicRoot) && is_file($publicIndexFile)) { $sendStaticFile($publicIndexFile); return true; } $legacyPublicFile = realpath(__DIR__ . $path); if ( str_starts_with($path, '/img/') && $path !== '/' && $legacyPublicFile !== false && str_starts_with($legacyPublicFile, __DIR__ . '/img') && is_file($legacyPublicFile) ) { $sendStaticFile($legacyPublicFile); return true; } if (strpos($path, '/back') === 0) { require __DIR__ . '/back/ex.php'; return true; } if (strpos($path, '/api') === 0) { require __DIR__ . '/api/ex.php'; return true; } require __DIR__ . '/ex.php'; return true;