aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/functions_transfer.php
diff options
context:
space:
mode:
authorMeik Sievertsen <acydburn@phpbb.com>2009-04-18 15:09:19 +0000
committerMeik Sievertsen <acydburn@phpbb.com>2009-04-18 15:09:19 +0000
commit1042152a55ab2d0764c446949a77f085ab7a77f3 (patch)
tree008dc317ce03e80988c8c79f8c6d0cf263a02b32 /phpBB/includes/functions_transfer.php
parente3d98fe77b1f2c60ceefa0ddf9091d08815d1f89 (diff)
downloadforums-1042152a55ab2d0764c446949a77f085ab7a77f3.tar
forums-1042152a55ab2d0764c446949a77f085ab7a77f3.tar.gz
forums-1042152a55ab2d0764c446949a77f085ab7a77f3.tar.bz2
forums-1042152a55ab2d0764c446949a77f085ab7a77f3.tar.xz
forums-1042152a55ab2d0764c446949a77f085ab7a77f3.zip
Merge changes made in revisions #r9405 to #r9467
2009-04-18 git-svn-id: file:///svn/phpbb/trunk@9468 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/functions_transfer.php')
-rw-r--r--phpBB/includes/functions_transfer.php39
1 files changed, 37 insertions, 2 deletions
diff --git a/phpBB/includes/functions_transfer.php b/phpBB/includes/functions_transfer.php
index 808f28a147..d7cb11cbf4 100644
--- a/phpBB/includes/functions_transfer.php
+++ b/phpBB/includes/functions_transfer.php
@@ -190,7 +190,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))
{
@@ -442,7 +442,24 @@ class ftp extends transfer
*/
private 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;
}
/**
@@ -690,6 +707,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;
}