mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-08 04:18:52 +00:00
check if folder is not empty (may happen for absolute paths). Thanks paul
git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@8639 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
f5c7243cf3
commit
cc6d084368
1 changed files with 29 additions and 5 deletions
|
@ -179,7 +179,7 @@ class compress_zip extends compress
|
||||||
* Extract archive
|
* Extract archive
|
||||||
*/
|
*/
|
||||||
function extract($dst)
|
function extract($dst)
|
||||||
{
|
{
|
||||||
// Loop the file, looking for files and folders
|
// Loop the file, looking for files and folders
|
||||||
$dd_try = false;
|
$dd_try = false;
|
||||||
rewind($this->fp);
|
rewind($this->fp);
|
||||||
|
@ -215,6 +215,12 @@ class compress_zip extends compress
|
||||||
// Create and folders and subfolders if they do not exist
|
// Create and folders and subfolders if they do not exist
|
||||||
foreach ($folders as $folder)
|
foreach ($folders as $folder)
|
||||||
{
|
{
|
||||||
|
$folder = trim($folder);
|
||||||
|
if (!$folder)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
$str = (!empty($str)) ? $str . '/' . $folder : $folder;
|
$str = (!empty($str)) ? $str . '/' . $folder : $folder;
|
||||||
if (!is_dir($str))
|
if (!is_dir($str))
|
||||||
{
|
{
|
||||||
|
@ -238,6 +244,12 @@ class compress_zip extends compress
|
||||||
// Create and folders and subfolders if they do not exist
|
// Create and folders and subfolders if they do not exist
|
||||||
foreach ($folders as $folder)
|
foreach ($folders as $folder)
|
||||||
{
|
{
|
||||||
|
$folder = trim($folder);
|
||||||
|
if (!$folder)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
$str = (!empty($str)) ? $str . '/' . $folder : $folder;
|
$str = (!empty($str)) ? $str . '/' . $folder : $folder;
|
||||||
if (!is_dir($str))
|
if (!is_dir($str))
|
||||||
{
|
{
|
||||||
|
@ -267,7 +279,7 @@ class compress_zip extends compress
|
||||||
// Not compressed
|
// Not compressed
|
||||||
fwrite($fp, $content);
|
fwrite($fp, $content);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 8:
|
case 8:
|
||||||
// Deflate
|
// Deflate
|
||||||
fwrite($fp, gzinflate($content, $data['uc_size']));
|
fwrite($fp, gzinflate($content, $data['uc_size']));
|
||||||
|
@ -278,7 +290,7 @@ class compress_zip extends compress
|
||||||
fwrite($fp, bzdecompress($content));
|
fwrite($fp, bzdecompress($content));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
fclose($fp);
|
fclose($fp);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -288,11 +300,11 @@ class compress_zip extends compress
|
||||||
// This case should simply never happen.. but it does exist..
|
// This case should simply never happen.. but it does exist..
|
||||||
case "\x50\x4b\x05\x06":
|
case "\x50\x4b\x05\x06":
|
||||||
break 2;
|
break 2;
|
||||||
|
|
||||||
// 'Packed to Removable Disk', ignore it and look for the next signature...
|
// 'Packed to Removable Disk', ignore it and look for the next signature...
|
||||||
case 'PK00':
|
case 'PK00':
|
||||||
continue 2;
|
continue 2;
|
||||||
|
|
||||||
// We have encountered a header that is weird. Lets look for better data...
|
// We have encountered a header that is weird. Lets look for better data...
|
||||||
default:
|
default:
|
||||||
if (!$dd_try)
|
if (!$dd_try)
|
||||||
|
@ -519,6 +531,12 @@ class compress_tar extends compress
|
||||||
// Create and folders and subfolders if they do not exist
|
// Create and folders and subfolders if they do not exist
|
||||||
foreach ($folders as $folder)
|
foreach ($folders as $folder)
|
||||||
{
|
{
|
||||||
|
$folder = trim($folder);
|
||||||
|
if (!$folder)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
$str = (!empty($str)) ? $str . '/' . $folder : $folder;
|
$str = (!empty($str)) ? $str . '/' . $folder : $folder;
|
||||||
if (!is_dir($str))
|
if (!is_dir($str))
|
||||||
{
|
{
|
||||||
|
@ -540,6 +558,12 @@ class compress_tar extends compress
|
||||||
// Create and folders and subfolders if they do not exist
|
// Create and folders and subfolders if they do not exist
|
||||||
foreach ($folders as $folder)
|
foreach ($folders as $folder)
|
||||||
{
|
{
|
||||||
|
$folder = trim($folder);
|
||||||
|
if (!$folder)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
$str = (!empty($str)) ? $str . '/' . $folder : $folder;
|
$str = (!empty($str)) ? $str . '/' . $folder : $folder;
|
||||||
if (!is_dir($str))
|
if (!is_dir($str))
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue