diff --git a/src/classes/File.php b/src/classes/File.php index 8ee42bd..5828aa9 100644 --- a/src/classes/File.php +++ b/src/classes/File.php @@ -179,6 +179,10 @@ public static function a2r($file,$dir=NULL){ if($rf==$rd) return ""; + if(Settings::$allow_symlinks_outside_photos_dir && substr($rf,0,strlen($rd)) != $rd && is_file($rf) ){ + return substr($file,strlen($dir) + 1 ); + } + if( substr($rf,0,strlen($rd)) != $rd ){ throw new Exception("This file is not inside the photos folder !
"); } diff --git a/src/classes/Menu.php b/src/classes/Menu.php index 2c67e81..379963b 100644 --- a/src/classes/Menu.php +++ b/src/classes/Menu.php @@ -221,7 +221,8 @@ public static function list_files($dir,$rec = false, $hidden = false, $stopatfir /// Content isn't hidden and is a file if($content[0] != '.' || $hidden){ - if(is_file($path=$dir."/".$content)){ + $path = $dir."/".$content; + if(is_file($path) || is_link($path)){ if((File::Type($path) && (File::Type($path) == "Image" || File::Type($path)=="Video")) || $all_file_type){ /// Add content to list $list[]=$path; diff --git a/src/classes/Settings.php b/src/classes/Settings.php index 972e85c..bd0bb6e 100644 --- a/src/classes/Settings.php +++ b/src/classes/Settings.php @@ -66,6 +66,9 @@ class Settings extends Page /// Quality of mini thumbnails in overview, scala: 0-100 static public $quality_mini = 90; + /// The user can enable this to allow symlinks in his photos_dir to point to files outside his photos_dir + static public $allow_symlinks_outside_photos_dir = false; + /**** Admin Settings ****/ @@ -201,6 +204,10 @@ static public function init($forced = false, $config_file = NULL){ Settings::$conf_dir = $config->ps_generated."/Conf/"; Settings::$admin_settings_file = $config->ps_generated."/Conf/admin_settings.ini"; + if (isset($config->allow_symlinks_outside_photos_dir)) { + Settings::$allow_symlinks_outside_photos_dir = (bool) $config->allow_symlinks_outside_photos_dir; + } + if (isset($config->cache_max_age)) { Settings::$cache_max_age = (int) $config->cache_max_age; }