From e5061f231690f074725b9a5e4145ca66e8fe66e4 Mon Sep 17 00:00:00 2001 From: dooble M Date: Sun, 19 Aug 2012 15:06:33 +0200 Subject: [PATCH] Hide dot-hidden files --- functions.php | 2 +- index.php | 2 +- plugins/viewer/view.php | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/functions.php b/functions.php index b60543e..7c67db7 100644 --- a/functions.php +++ b/functions.php @@ -109,7 +109,7 @@ function getAlbumPreview($dir) if (! is_dir(dirname($previewFile))) mkdir(dirname($previewFile), 0777, true); // no preview: look for a preview in current dir, write it, return it - foreach (scandir($dir) as $file) if ($file != '.' and $file != '..') { + foreach (scandir($dir) as $file) if ($file[0] != '.') { $ext = strtolower(substr($file, -4)); if ($ext == ".jpg" or $ext == ".png") { $thumb = getPreview("$dir/$file"); diff --git a/index.php b/index.php index d598060..32aa537 100644 --- a/index.php +++ b/index.php @@ -55,7 +55,7 @@ $folders = array(); $imageFiles = array(); $otherFiles = array(); -foreach (scandir($realDir) as $file) if ($file != '.' and $file != '..') +foreach (scandir($realDir) as $file) if ($file[0] != '.') { if (is_dir("$realDir/$file")) { diff --git a/plugins/viewer/view.php b/plugins/viewer/view.php index 2af21b1..9ccf5cd 100644 --- a/plugins/viewer/view.php +++ b/plugins/viewer/view.php @@ -33,7 +33,8 @@ if (! is_file("$bizouRootFromHere/".IMAGES_DIR.$simpleImagePath)) { $images = array(); $files = scandir("$bizouRootFromHere/".IMAGES_DIR.dirname($simpleImagePath)); -foreach ($files as $file) { +foreach ($files as $file) if ($file[0] != '.') +{ $ext = strtolower(substr($file, -4)); if ($ext == ".jpg" or $ext == ".png") $images[] = $file; -- 1.7.10.4