Added proper 404 errors on file or directory not found
[bizou.git] / index.php
index 97f7e59..03989d6 100644 (file)
--- a/index.php
+++ b/index.php
@@ -20,7 +20,7 @@
 define('THUMB_SIZE', 100);
 define('DATA_DIR', 'data');
 define('IMAGES_DIR', 'images');
-define('USE_VIEWER', true);
+define('USE_VIEWER', true); # if set to false, you can delete view.php
 
 function getPreview($imgFile, $maxSize = THUMB_SIZE)
 {
@@ -103,6 +103,11 @@ $otherFiles = array();
 
 $realDir = IMAGES_DIR.$shortPath;
 
+if (! is_dir($realDir)) {
+       header("HTTP/1.1 404 Not Found");
+       die("Directory Not Found");
+}
+
 foreach (scandir($realDir) as $file) if ($file != '.' and $file != '..')
 {
        if (is_dir("$realDir/$file"))