diff --git a/php/elFinderVolumeDriver.class.php b/php/elFinderVolumeDriver.class.php index 05be72286..4bfd4cf62 100644 --- a/php/elFinderVolumeDriver.class.php +++ b/php/elFinderVolumeDriver.class.php @@ -878,7 +878,7 @@ abstract class elFinderVolumeDriver { // root attributes $this->attributes[] = array( - 'pattern' => '~^'.preg_quote(DIRECTORY_SEPARATOR).'$~', + 'pattern' => '~^'.preg_quote($this->separator).'$~', 'locked' => true, 'hidden' => false ); @@ -2826,7 +2826,7 @@ abstract class elFinderVolumeDriver { $p = $this->relpathCE($path); // if reqesting root dir $path will be empty, then assign '/' as we cannot leave it blank for crypt if ($p === '') { - $p = DIRECTORY_SEPARATOR; + $p = $this->separator; } // TODO crypt path and return hash @@ -2859,7 +2859,7 @@ abstract class elFinderVolumeDriver { // TODO uncrypt hash and return path $path = $this->uncrypt($h); // append ROOT to path after it was cut in encode - return $this->abspathCE($path);//$this->root.($path == DIRECTORY_SEPARATOR ? '' : DIRECTORY_SEPARATOR.$path); + return $this->abspathCE($path);//$this->root.($path === $this->separator ? '' : $this->separator.$path); } //TODO: Add return statement here } diff --git a/php/elFinderVolumeFTP.class.php b/php/elFinderVolumeFTP.class.php index b6e46ca6c..90a938b13 100644 --- a/php/elFinderVolumeFTP.class.php +++ b/php/elFinderVolumeFTP.class.php @@ -95,6 +95,7 @@ class elFinderVolumeFTP extends elFinderVolumeDriver { 'owner' => true, 'tmbPath' => '', 'tmpPath' => '', + 'separator' => '/', 'dirMode' => 0755, 'fileMode' => 0644, 'rootCssClass' => 'elfinder-navbar-root-ftp' @@ -519,10 +520,12 @@ class elFinderVolumeFTP extends elFinderVolumeDriver { * * @param string $path file path * @return string - * @author Dmitry (dio) Levashov + * @author Naoki Sawada **/ protected function _dirname($path) { - return dirname($path); + $parts = explode($this->separator, trim($path, $this->separator)); + array_pop($parts); + return $this->separator . join($this->separator, $parts); } /** @@ -530,10 +533,11 @@ class elFinderVolumeFTP extends elFinderVolumeDriver { * * @param string $path file path * @return string - * @author Dmitry (dio) Levashov + * @author Naoki Sawada **/ protected function _basename($path) { - return basename($path); + $parts = explode($this->separator, trim($path, $this->separator)); + return array_pop($parts); } /**