From 1a700b1737cb5cca268c66bf52cabd85d66389a8 Mon Sep 17 00:00:00 2001 From: Benjamin Renard Date: Fri, 1 Jun 2018 13:59:01 +0200 Subject: [PATCH] Fix local file handling --- public_html/includes/class/class.LStemplate.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/public_html/includes/class/class.LStemplate.php b/public_html/includes/class/class.LStemplate.php index 9015aff8..874fb87d 100644 --- a/public_html/includes/class/class.LStemplate.php +++ b/public_html/includes/class/class.LStemplate.php @@ -159,15 +159,19 @@ class LStemplate { public static function getFilePath($file, $root_dir, $default_dir=null, $with_nocache=false) { if ($default_dir === null) $default_dir = self :: getDefaultDir(); + $path = false; foreach(self :: $directories as $dir) { - if (file_exists($root_dir.'/'.$dir.'/'.$file)) { - $path = $root_dir.'/'.$dir.'/'.$file; + $path = $root_dir.'/'.$dir.'/'.$file; + if (file_exists($path)) { + break; } + $path = false; } - if (!$default_dir) { - return; + if (!$path) { + if (!$default_dir) + return; + $path = $root_dir.'/'.$default_dir.'/'.$file; } - $path = $root_dir.'/'.$default_dir.'/'.$file; if ($with_nocache) $path .= "?nocache=".self::getNoCacheFileValue($path); return $path;