X-Git-Url: http://positon.org/gitweb/?a=blobdiff_plain;f=index.php;h=61f5579412b06c7272b98a944e2fdb0608980914;hb=dee4e81d5b8beb87f660bfe5c3638c676ac0c014;hp=c20a4dced9c8762dfd5e07c05f50e073e6d67e7b;hpb=cbbc2407ba4c951c77c6fbb3fa39efeee1266c70;p=bizou.git diff --git a/index.php b/index.php index c20a4dc..61f5579 100644 --- a/index.php +++ b/index.php @@ -80,15 +80,17 @@ function getAlbumPreview($dir) $scriptUrlPath = $_SERVER["SCRIPT_NAME"]; -// if url == http://localhost/photos/index/toto/titi, path_info == /toto/titi -// if url == http://localhost/photos/index, path_info is not set +// if url == http://localhost/photos/index.php/toto/titi, path_info == /toto/titi +// if url == http://localhost/photos/index.php, path_info is not set // if url == http://localhost/photos/, path_info is not set -// if path_info is not set, we are at top level, so we redirect to /photos/index/ +// if path_info is not set, we are at top level, so we redirect to /photos/index.php/ if (! isset($_SERVER["PATH_INFO"])) { header("Location: $scriptUrlPath/"); exit(); } +# shortPath is the simple path to the image +# /index.php/toto/titi => shortPath == /toto/titi $shortPath = $_SERVER["PATH_INFO"]; if ($shortPath == '/') $shortPath = ''; // extra security check to avoid /photos/index/../.. like urls, maybe useless but.. @@ -98,6 +100,8 @@ $folders = array(); $imageFiles = array(); $otherFiles = array(); +# realDir is the directory in filesystem +# seen from current script directory $realDir = IMAGES_DIR.$shortPath; if (! is_dir($realDir)) { @@ -115,9 +119,6 @@ foreach (scandir($realDir) as $file) if ($file != '.' and $file != '..') { $ext = strtolower(substr($file, -4)); if ($ext == ".jpg" or $ext == ".png") { - if (USE_VIEWER) - $link = dirname($scriptUrlPath)."/view.php$shortPath/$file"; - else $link = dirname($scriptUrlPath)."/$realDir/$file"; $imageFiles[] = array( "name" => $file, "url" => getPreview("$realDir/$file"), "link" => $link );