aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/functions_compress.php
diff options
context:
space:
mode:
authorMeik Sievertsen <acydburn@phpbb.com>2008-06-09 17:46:41 +0000
committerMeik Sievertsen <acydburn@phpbb.com>2008-06-09 17:46:41 +0000
commit50f5502cc9d83d109f881de88d4702d7fc6c2176 (patch)
tree99d7ded1f1bf88247a798acd459996db8f99c164 /phpBB/includes/functions_compress.php
parente199f55ba2d3fcac361b2a546ed86061423cb990 (diff)
downloadforums-50f5502cc9d83d109f881de88d4702d7fc6c2176.tar
forums-50f5502cc9d83d109f881de88d4702d7fc6c2176.tar.gz
forums-50f5502cc9d83d109f881de88d4702d7fc6c2176.tar.bz2
forums-50f5502cc9d83d109f881de88d4702d7fc6c2176.tar.xz
forums-50f5502cc9d83d109f881de88d4702d7fc6c2176.zip
check if folder is not empty (may happen for absolute paths). Thanks paul
git-svn-id: file:///svn/phpbb/trunk@8640 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/functions_compress.php')
-rw-r--r--phpBB/includes/functions_compress.php34
1 files changed, 29 insertions, 5 deletions
diff --git a/phpBB/includes/functions_compress.php b/phpBB/includes/functions_compress.php
index f4efc6b5c9..0e024f3a8d 100644
--- a/phpBB/includes/functions_compress.php
+++ b/phpBB/includes/functions_compress.php
@@ -177,7 +177,7 @@ class compress_zip extends compress
* Extract archive
*/
public function extract($dst)
- {
+ {
// Loop the file, looking for files and folders
$dd_try = false;
rewind($this->fp);
@@ -213,6 +213,12 @@ class compress_zip extends compress
// Create and folders and subfolders if they do not exist
foreach ($folders as $folder)
{
+ $folder = trim($folder);
+ if (!$folder)
+ {
+ continue;
+ }
+
$str = (!empty($str)) ? $str . '/' . $folder : $folder;
if (!is_dir($str))
{
@@ -236,6 +242,12 @@ class compress_zip extends compress
// Create and folders and subfolders if they do not exist
foreach ($folders as $folder)
{
+ $folder = trim($folder);
+ if (!$folder)
+ {
+ continue;
+ }
+
$str = (!empty($str)) ? $str . '/' . $folder : $folder;
if (!is_dir($str))
{
@@ -265,7 +277,7 @@ class compress_zip extends compress
// Not compressed
fwrite($fp, $content);
break;
-
+
case 8:
// Deflate
fwrite($fp, gzinflate($content, $data['uc_size']));
@@ -276,7 +288,7 @@ class compress_zip extends compress
fwrite($fp, bzdecompress($content));
break;
}
-
+
fclose($fp);
break;
@@ -286,11 +298,11 @@ class compress_zip extends compress
// This case should simply never happen.. but it does exist..
case "\x50\x4b\x05\x06":
break 2;
-
+
// 'Packed to Removable Disk', ignore it and look for the next signature...
case 'PK00':
continue 2;
-
+
// We have encountered a header that is weird. Lets look for better data...
default:
if (!$dd_try)
@@ -515,6 +527,12 @@ class compress_tar extends compress
// Create and folders and subfolders if they do not exist
foreach ($folders as $folder)
{
+ $folder = trim($folder);
+ if (!$folder)
+ {
+ continue;
+ }
+
$str = (!empty($str)) ? $str . '/' . $folder : $folder;
if (!is_dir($str))
{
@@ -536,6 +554,12 @@ class compress_tar extends compress
// Create and folders and subfolders if they do not exist
foreach ($folders as $folder)
{
+ $folder = trim($folder);
+ if (!$folder)
+ {
+ continue;
+ }
+
$str = (!empty($str)) ? $str . '/' . $folder : $folder;
if (!is_dir($str))
{