diff options
Diffstat (limited to 'phpBB/includes/functions_transfer.php')
-rw-r--r-- | phpBB/includes/functions_transfer.php | 39 |
1 files changed, 37 insertions, 2 deletions
diff --git a/phpBB/includes/functions_transfer.php b/phpBB/includes/functions_transfer.php index 2925a2df77..c345f81e1d 100644 --- a/phpBB/includes/functions_transfer.php +++ b/phpBB/includes/functions_transfer.php @@ -206,7 +206,7 @@ class transfer $directory = $this->root_path . str_replace($phpbb_root_path, '', $directory); $this->_chdir($directory); - $result = $this->_ls(''); + $result = $this->_ls(); if ($result !== false && is_array($result)) { @@ -460,7 +460,24 @@ class ftp extends transfer */ function _ls($dir = './') { - return @ftp_nlist($this->connection, $dir); + $list = @ftp_nlist($this->connection, $dir); + + // Remove path if prepended + foreach ($list as $key => $item) + { + // Use same separator for item and dir + $item = str_replace('\\', '/', $item); + $dir = str_replace('\\', '/', $dir); + + if (strpos($item, $dir) === 0) + { + $item = substr($item, strlen($dir)); + } + + $list[$key] = $item; + } + + return $list; } /** @@ -710,6 +727,24 @@ class ftp_fsock extends transfer } $this->_close_data_connection(); + // Clear buffer + $this->_check_command(); + + // Remove path if prepended + foreach ($list as $key => $item) + { + // Use same separator for item and dir + $item = str_replace('\\', '/', $item); + $dir = str_replace('\\', '/', $dir); + + if (strpos($item, $dir) === 0) + { + $item = substr($item, strlen($dir)); + } + + $list[$key] = $item; + } + return $list; } |