mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-08-19 04:46:42 +02:00
Exclude symlinks from Vfs
This commit is contained in:
@@ -384,7 +384,7 @@ class Vfs
|
||||
*
|
||||
* @param string|array $base base of the search
|
||||
* @param array $options =null the following keys are allowed:
|
||||
* - type => {d|f|F} d=dirs, f=files (incl. symlinks), F=files (incl. symlinks to files), default all
|
||||
* - type => {d|f|F|!l} d=dirs, f=files (incl. symlinks), F=files (incl. symlinks to files), !l=no symlinks, default all
|
||||
* - depth => {true|false(default)} put the contents of a dir before the dir itself
|
||||
* - dirsontop => {true(default)|false} allways return dirs before the files (two distinct blocks)
|
||||
* - mindepth,maxdepth minimal or maximal depth to be returned
|
||||
@@ -646,7 +646,8 @@ class Vfs
|
||||
return; // not found, should not happen
|
||||
}
|
||||
if ($type && (($type == 'd') == !($stat['mode'] & Vfs\Sqlfs\StreamWrapper::MODE_DIR) || // != is_dir() which can be true for symlinks
|
||||
$type == 'F' && is_dir($path))) // symlink to a directory
|
||||
$type == 'F' && is_dir($path)) || // symlink to a directory
|
||||
$type == '!l' && ($stat['mode'] & Vfs::MODE_LINK)) // Symlink
|
||||
{
|
||||
return; // wrong type
|
||||
}
|
||||
|
@@ -443,7 +443,7 @@ class Sharing
|
||||
}
|
||||
|
||||
// We don't allow sharing links, share target instead
|
||||
if($target = Vfs::readlink($path))
|
||||
if(($target = Vfs::readlink($path)))
|
||||
{
|
||||
$path = $target;
|
||||
}
|
||||
@@ -761,5 +761,15 @@ if (file_exists(__DIR__.'/../../../filemanager/inc/class.filemanager_ui.inc.php'
|
||||
);
|
||||
return $actions;
|
||||
}
|
||||
|
||||
protected function get_vfs_options($query)
|
||||
{
|
||||
$options = parent::get_vfs_options($query);
|
||||
|
||||
// Hide symlinks
|
||||
$options['type'] = '!l';
|
||||
|
||||
return $options;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user