aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomasz Kramkowski <tk@the-tk.com>2017-08-04 23:51:41 +0100
committerAndreas Schneider <asn@cryptomilk.org>2017-08-14 08:37:53 +0200
commit40fdbaf9cb162f6bc8c356492fc00529372414fe (patch)
treefe2101a8090905a103d4e846873b6903f6887d62
parent1dbb111720a6c6fc092c0b5a670d4a48a7305fb0 (diff)
downloadmlmmj-webarchiver-40fdbaf9cb162f6bc8c356492fc00529372414fe.tar.gz
mlmmj-webarchiver-40fdbaf9cb162f6bc8c356492fc00529372414fe.tar.xz
mlmmj-webarchiver-40fdbaf9cb162f6bc8c356492fc00529372414fe.zip
index.php: reorder is_dir to end of expression to avoid unnecessary check
Putting is_dir first unnecessarily checks all the paths which will end up being discarded later. This might slow down operation only if you're hosting your archive off of a floppy disk. However, this early check does raise issues when open_basedir is pretty strict and prevents access to `$baselistdir . "/.."`. Moving the check to the end of the expression avoids filling logs with warnings about open_basedir restrictions being in effect. Signed-off-by: Tomasz Kramkowski <tk@the-tk.com>
-rw-r--r--mlmmj-webarchiver/skel/index.php3
1 files changed, 2 insertions, 1 deletions
diff --git a/mlmmj-webarchiver/skel/index.php b/mlmmj-webarchiver/skel/index.php
index 23c366f..7247927 100644
--- a/mlmmj-webarchiver/skel/index.php
+++ b/mlmmj-webarchiver/skel/index.php
@@ -3,7 +3,8 @@
$mlist = substr(strrchr ($baselistdir, "/"), 1);
$mlistdir = opendir($baselistdir);
while($file = readdir($mlistdir)) {
- if(is_dir($baselistdir . "/" . $file) && $file != "." && $file != ".." && $file != "images" && $file != "style") {
+ if($file != "." && $file != ".." && $file != "images" && $file != "style"
+ && is_dir($baselistdir . "/" . $file)) {
$navlists.= " | <a href=\"$file\">$file list</a>";
$bodylists.= "<h2><a href=\"$file\">$file mailing list</a></h2> ";
}