projet par cursor
This commit is contained in:
1 parent
236f75ecdd
commit
b785db1b84
47 files changed
+3902
No files matched your search
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
require_once dirname(__DIR__) . "/src/Config.php";
|
||||
|
||||
Config::charger();
|
||||
|
||||
$fichier = basename($_GET["fichier"] ?? "");
|
||||
|
||||
if ($fichier === "" || str_contains($fichier, ".."))
|
||||
{
|
||||
http_response_code(404);
|
||||
exit;
|
||||
}
|
||||
|
||||
$chemin = Config::get("jaquettesPath") . "/" . $fichier;
|
||||
|
||||
if (!is_file($chemin))
|
||||
{
|
||||
http_response_code(404);
|
||||
exit;
|
||||
}
|
||||
|
||||
$extension = strtolower(pathinfo($chemin, PATHINFO_EXTENSION));
|
||||
$types = [
|
||||
"jpg" => "image/jpeg",
|
||||
"jpeg" => "image/jpeg",
|
||||
"png" => "image/png",
|
||||
"webp" => "image/webp",
|
||||
"gif" => "image/gif"
|
||||
];
|
||||
|
||||
header("Content-Type: " . ($types[$extension] ?? "application/octet-stream"));
|
||||
header("Cache-Control: public, max-age=604800");
|
||||
readfile($chemin);
|
||||