aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/functions_compress.php
diff options
context:
space:
mode:
authorDavid M <davidmj@users.sourceforge.net>2007-07-13 03:16:59 +0000
committerDavid M <davidmj@users.sourceforge.net>2007-07-13 03:16:59 +0000
commitb011f383f96f858782f40fde03bc4b7008c4b280 (patch)
tree84eefd7dc0feaf0be53a3820906b9f35c37c39c3 /phpBB/includes/functions_compress.php
parentc1531d9925585dbbbaa395ba10f16e7575aa1272 (diff)
downloadforums-b011f383f96f858782f40fde03bc4b7008c4b280.tar
forums-b011f383f96f858782f40fde03bc4b7008c4b280.tar.gz
forums-b011f383f96f858782f40fde03bc4b7008c4b280.tar.bz2
forums-b011f383f96f858782f40fde03bc4b7008c4b280.tar.xz
forums-b011f383f96f858782f40fde03bc4b7008c4b280.zip
#13327
git-svn-id: file:///svn/phpbb/trunk@7877 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/functions_compress.php')
-rw-r--r--phpBB/includes/functions_compress.php28
1 files changed, 17 insertions, 11 deletions
diff --git a/phpBB/includes/functions_compress.php b/phpBB/includes/functions_compress.php
index d8267cf7f6..ade844b262 100644
--- a/phpBB/includes/functions_compress.php
+++ b/phpBB/includes/functions_compress.php
@@ -12,7 +12,7 @@
* Class for handling archives (compression/decompression)
* @package phpBB3
*/
-class compress
+class compress
{
var $fp = 0;
@@ -434,12 +434,15 @@ class compress_zip extends compress
header("Content-Type: $mimetype; name=\"$download_name.zip\"");
header("Content-disposition: attachment; filename=$download_name.zip");
- $fp = fopen("{$phpbb_root_path}store/$filename.zip", 'rb');
- while ($buffer = fread($fp, 1024))
+ $fp = @fopen("{$phpbb_root_path}store/$filename.zip", 'rb');
+ if ($fp)
{
- echo $buffer;
+ while ($buffer = fread($fp, 1024))
+ {
+ echo $buffer;
+ }
+ fclose($fp);
}
- fclose($fp);
}
}
@@ -546,8 +549,8 @@ class compress_tar extends compress
{
$fzwrite = ($this->isbz && function_exists('bzwrite')) ? 'bzwrite' : (($this->isgz && @extension_loaded('zlib')) ? 'gzwrite' : 'fwrite');
- // Symbolizes that there are no more files
- $fzwrite($this->fp, str_repeat("\0", 512));
+ // The end of a tar archive ends in two records of all NULLs (1024 bytes of \0)
+ $fzwrite($this->fp, str_repeat("\0", 1024));
}
$fzclose($this->fp);
@@ -648,12 +651,15 @@ class compress_tar extends compress
header("Content-Type: $mimetype; name=\"$download_name$this->type\"");
header("Content-disposition: attachment; filename=$download_name$this->type");
- $fp = fopen("{$phpbb_root_path}store/$filename$this->type", 'rb');
- while ($buffer = fread($fp, 1024))
+ $fp = @fopen("{$phpbb_root_path}store/$filename$this->type", 'rb');
+ if ($fp)
{
- echo $buffer;
+ while ($buffer = fread($fp, 1024))
+ {
+ echo $buffer;
+ }
+ fclose($fp);
}
- fclose($fp);
}
}