mirror of
https://github.com/phpbb/phpbb.git
synced 2025-05-05 15:16:16 +02:00
fix $transfer->file_exists() and $transfer->_ls() if using fsock or IIS7. Bug #43115, #43105, #30395
Thanks to j5_dev for reporting this git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9433 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
beb73bc127
commit
c801cc9a1f
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user