# HG changeset patch # User edogawaconan # Date 1414638872 -32400 # Node ID ce92f4d4171457134e246475ff4d000b162ab601 # Parent aa3f0003fb4119f7763aa770c7b9918bbdc1ff77 Add support for displaying hidden files. diff -r aa3f0003fb41 -r ce92f4d41714 README.md --- a/README.md Thu Oct 30 12:05:35 2014 +0900 +++ b/README.md Thu Oct 30 12:14:32 2014 +0900 @@ -37,6 +37,14 @@ And done. Probably also works with apache but I have no idea how to set it up. +Configurations +-------------- + +Here are some variables which changes how it behaves: + +- `DL_DIR`: sets directory to be listed. +- `DL_SHOWALL`: show or hide files which name start with `.`. Set to `1` to show. + Upgrading --------- diff -r aa3f0003fb41 -r ce92f4d41714 index.php --- a/index.php Thu Oct 30 12:05:35 2014 +0900 +++ b/index.php Thu Oct 30 12:14:32 2014 +0900 @@ -28,7 +28,8 @@ $files = array(); $dirs = array(); while (($file = readdir($dir_handle)) !== false) { - if (substr($file, 0, 1) === ".") { continue; } + if ($file === "." || $file === "..") { continue; } + elseif (!(isset($_SERVER["DL_SHOWALL"]) && $_SERVER["DL_SHOWALL"] === "1") && substr($file, 0, 1) === ".") { continue; } elseif (is_dir($dir . $file)) { $dirs[] = $file; } else { $files[] = $file; } }