src build elFinder-2.1-f03b320

This commit is contained in:
nao-pon
2023-06-14 01:38:47 +09:00
parent c4dc30bda0
commit 95f402ce72
11 changed files with 741 additions and 676 deletions
+12 -6
View File
@@ -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