don't use /index/eoiruer urls but /index.php/eorieur
authorMarc MAURICE <dooblempub@positon.org>
Tue, 19 Oct 2010 22:39:49 +0000 (00:39 +0200)
committerMarc MAURICE <dooblempub@positon.org>
Tue, 19 Oct 2010 22:39:49 +0000 (00:39 +0200)
more standard. the first only work with mod_negociation

index.php
view.php

index b9b7309..2265857 100644 (file)
--- a/index.php
+++ b/index.php
@@ -61,7 +61,7 @@ function getAlbumPreview($dir)
        return '';
 }
 
-$scriptUrlPath = substr($_SERVER["SCRIPT_NAME"], 0, -4); // trim .php
+$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
@@ -93,7 +93,7 @@ foreach (scandir($realDir) as $file) if ($file != '.' and $file != '..')
        {
                $ext = strtolower(substr($file, -4));
                if ($ext == ".jpg" or $ext == ".png")
-                       $imageFiles[] = array( "name" => $file, "url" => getPreview("$realDir/$file"), "link" => dirname($scriptUrlPath)."/view$shortPath/$file" );
+                       $imageFiles[] = array( "name" => $file, "url" => getPreview("$realDir/$file"), "link" => dirname($scriptUrlPath)."/view.php$shortPath/$file" );
                else
                        $otherFiles[] = array( "name" => $file, "link" => dirname($scriptUrlPath)."/$realDir/$file" );
        }
index 2d6aaa5..803a164 100644 (file)
--- a/view.php
+++ b/view.php
@@ -42,7 +42,7 @@ if ($nextImage === '') {
 if ($prevImage === '') $prevPageUrl = '';
 else $prevPageUrl = dirname($_SERVER["REQUEST_URI"])."/$prevImage";
 
-$directoryUrl = dirname($_SERVER["SCRIPT_NAME"])."/index".dirname($shortPath);
+$directoryUrl = dirname($_SERVER["SCRIPT_NAME"])."/index.php".dirname($shortPath);
 
 header('Content-Type: text/html; charset=utf-8');
 header('Expires: '.gmdate('D, d M Y H:i:s \G\M\T', time() + 3600));