mirror of
https://github.com/Studio-42/elFinder
synced 2026-06-08 12:37:09 +00:00
src build elFinder-2.1-f03b320
This commit is contained in:
@@ -373,9 +373,13 @@ class elFinderVolumeLocalFileSystem extends elFinderVolumeDriver
|
||||
// realpath() returns FALSE if the file does not exist
|
||||
if ($path === false || strpos($path, $this->root) !== 0) {
|
||||
if (DIRECTORY_SEPARATOR !== '/') {
|
||||
$dir = str_replace('/', DIRECTORY_SEPARATOR, $dir);
|
||||
$name = str_replace('/', DIRECTORY_SEPARATOR, $name);
|
||||
}
|
||||
// Directory traversal measures
|
||||
if (strpos($dir, '..' . DIRECTORY_SEPARATOR) !== false || substr($dir, -2) == '..') {
|
||||
$dir = $this->root;
|
||||
}
|
||||
if (strpos($name, '..' . DIRECTORY_SEPARATOR) !== false) {
|
||||
$name = basename($name);
|
||||
}
|
||||
@@ -968,7 +972,7 @@ class elFinderVolumeLocalFileSystem extends elFinderVolumeDriver
|
||||
**/
|
||||
protected function _symlink($source, $targetDir, $name)
|
||||
{
|
||||
return symlink($source, $this->_joinPath($targetDir, $name));
|
||||
return $this->localFileSystemSymlink($source, $this->_joinPath($targetDir, $name));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1466,12 +1470,14 @@ class elFinderVolumeLocalFileSystem extends elFinderVolumeDriver
|
||||
protected function localFileSystemSymlink($target, $link)
|
||||
{
|
||||
$res = false;
|
||||
$errlev = error_reporting();
|
||||
error_reporting($errlev ^ E_WARNING);
|
||||
if ($res = symlink(realpath($target), $link)) {
|
||||
$res = is_readable($link);
|
||||
if (function_exists('symlink') and is_callable('symlink')) {
|
||||
$errlev = error_reporting();
|
||||
error_reporting($errlev ^ E_WARNING);
|
||||
if ($res = symlink(realpath($target), $link)) {
|
||||
$res = is_readable($link);
|
||||
}
|
||||
error_reporting($errlev);
|
||||
}
|
||||
error_reporting($errlev);
|
||||
return $res;
|
||||
}
|
||||
} // END class
|
||||
|
||||
Reference in New Issue
Block a user