Fix local file handling

This commit is contained in:
Benjamin Renard 2018-06-01 13:59:01 +02:00
parent 37e573a247
commit 1a700b1737

View file

@ -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;
if (file_exists($path)) {
break;
}
$path = false;
}
if (!$default_dir) {
if (!$path) {
if (!$default_dir)
return;
}
$path = $root_dir.'/'.$default_dir.'/'.$file;
}
if ($with_nocache)
$path .= "?nocache=".self::getNoCacheFileValue($path);
return $path;