Mercurial > dirlist-php
comparison index.php @ 28:ce92f4d41714
Add support for displaying hidden files.
| author | edogawaconan <me@myconan.net> |
|---|---|
| date | Thu, 30 Oct 2014 12:14:32 +0900 |
| parents | aa3f0003fb41 |
| children | c482f0db5c28 |
comparison
equal
deleted
inserted
replaced
| 27:aa3f0003fb41 | 28:ce92f4d41714 |
|---|---|
| 26 | 26 |
| 27 $dir_handle = @opendir($dir); | 27 $dir_handle = @opendir($dir); |
| 28 $files = array(); | 28 $files = array(); |
| 29 $dirs = array(); | 29 $dirs = array(); |
| 30 while (($file = readdir($dir_handle)) !== false) { | 30 while (($file = readdir($dir_handle)) !== false) { |
| 31 if (substr($file, 0, 1) === ".") { continue; } | 31 if ($file === "." || $file === "..") { continue; } |
| 32 elseif (!(isset($_SERVER["DL_SHOWALL"]) && $_SERVER["DL_SHOWALL"] === "1") && substr($file, 0, 1) === ".") { continue; } | |
| 32 elseif (is_dir($dir . $file)) { $dirs[] = $file; } | 33 elseif (is_dir($dir . $file)) { $dirs[] = $file; } |
| 33 else { $files[] = $file; } | 34 else { $files[] = $file; } |
| 34 } | 35 } |
| 35 sort($files); | 36 sort($files); |
| 36 sort($dirs); | 37 sort($dirs); |
