30 lines
730 B
PHP
Executable File
30 lines
730 B
PHP
Executable File
<?php
|
|
header("Access-Control-Allow-Origin: *");
|
|
|
|
if(!isset($_GET["ev"])) die("GET ev fehlt");
|
|
$ev=$_GET["ev"];
|
|
|
|
if(!isset($_GET["jahr"])) die("GET jahr fehlt");
|
|
$jahr=$_GET["jahr"];
|
|
|
|
if(str_contains($ev, "/")) die("GET ev ungültig");
|
|
if(str_contains($jahr, "/")) die("GET jahr ungültig");
|
|
|
|
$path="../../bilder/".$ev."/".$jahr;
|
|
|
|
$bilder=scandir($path);
|
|
|
|
$file_extension_whitelist=["jpg","jpeg","png","gif"];
|
|
|
|
$result=[];
|
|
|
|
|
|
foreach ($bilder as $key => $value) {
|
|
if (is_dir($path."/".$value)) {
|
|
continue;
|
|
}
|
|
if(in_array(pathinfo($path."/".$value,PATHINFO_EXTENSION),$file_extension_whitelist)) $result[] = "/".$ev."/".$jahr."/".$value;
|
|
}
|
|
|
|
echo json_encode($result,JSON_UNESCAPED_SLASHES|JSON_UNESCAPED_UNICODE);
|