X-Git-Url: http://git.shiar.nl/minimedit.git/blobdiff_plain/e0c43cd6e50d762ea564faf17a9aa4a21ca72ffb..HEAD:/foto/index.php diff --git a/foto/index.php b/foto/index.php index 8ba7db1..45c49c9 100644 --- a/foto/index.php +++ b/foto/index.php @@ -2,12 +2,22 @@ $rootdir = $Page->link; $nav = explode('/', $rootdir); +if (count($nav) > 1 and $nav[1] == 'tag') { + $rootdir = preg_replace('{/}', '/.', $rootdir, 1); +} $nav[0] = "Foto's"; # override of root 'foto' $title = array_pop($nav); $Page->title = ($nav ? implode(' ', $nav) . ': ' : '') . $title; if ($_SERVER['HTTP_ACCEPT'] === 'application/json') { header('Access-Control-Allow-Origin: *'); + header('Cache-Control: max-age=10'); + if (file_exists($rootdir)) { + header('Last-Modified: '.gmdate(DATE_RFC7231, filemtime($rootdir))); + } + else { + http_response_code(404); + } $imgs = []; foreach (glob("$rootdir/*.jpg") as $path) { $target = preg_replace('{^(\.\./)*}', '', readlink($path));