diff --git a/Install/bin/router.php b/Install/bin/router.php index 6375667..38ac063 100644 --- a/Install/bin/router.php +++ b/Install/bin/router.php @@ -1,31 +1,46 @@ 'text/css', + 'jpg' => 'image/jpeg', + 'jpeg' => 'image/jpeg', + 'png' => 'image/png', + 'svg' => 'image/svg+xml', + 'webp' => 'image/webp', + 'gif' => 'image/gif', + 'json' => 'application/json', + 'js' => 'text/javascript', + ]; + + $extension = strtolower(pathinfo($path, PATHINFO_EXTENSION)); + + if (!isset($allowedExtensions[$extension])) { + http_response_code(403); + exit; } - header('Content-type:' . $contentType); - echo file_get_contents($path); -} else { - include($basePath . 'index.php'); + header('Content-Type: ' . $allowedExtensions[$extension]); + readfile($path); + exit; } + +include $basePath . DIRECTORY_SEPARATOR . 'index.php';