File 40fdbaf9cb162f6bc8c356492fc00529372414fe.patch of Package mlmmj-webarchiver
From 40fdbaf9cb162f6bc8c356492fc00529372414fe Mon Sep 17 00:00:00 2001
From: Tomasz Kramkowski <tk@the-tk.com>
Date: Fri, 4 Aug 2017 23:51:41 +0100
Subject: [PATCH] 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>
---
mlmmj-webarchiver/skel/index.php | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
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> ";
}
--
GitLab