diff options
author | David M <davidmj@users.sourceforge.net> | 2007-02-16 04:20:45 +0000 |
---|---|---|
committer | David M <davidmj@users.sourceforge.net> | 2007-02-16 04:20:45 +0000 |
commit | e10e47044e0034b8224f65598739b2c3d6e0ddbd (patch) | |
tree | a2dab3219ca03d7140cfd0e01fa517fd78db6e44 /phpBB/includes | |
parent | caf5bfffd7e15b31f040746db1a18530b2a5642f (diff) | |
download | forums-e10e47044e0034b8224f65598739b2c3d6e0ddbd.tar forums-e10e47044e0034b8224f65598739b2c3d6e0ddbd.tar.gz forums-e10e47044e0034b8224f65598739b2c3d6e0ddbd.tar.bz2 forums-e10e47044e0034b8224f65598739b2c3d6e0ddbd.tar.xz forums-e10e47044e0034b8224f65598739b2c3d6e0ddbd.zip |
#8154
git-svn-id: file:///svn/phpbb/trunk@6991 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes')
-rw-r--r-- | phpBB/includes/acp/acp_database.php | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/phpBB/includes/acp/acp_database.php b/phpBB/includes/acp/acp_database.php index e1ec9fa8bc..1424bdb84d 100644 --- a/phpBB/includes/acp/acp_database.php +++ b/phpBB/includes/acp/acp_database.php @@ -498,12 +498,15 @@ class base_extractor var $store; var $download; var $time; + var $format; function base_extractor($download = false, $store = false, $format, $filename, $time) { $this->download = $download; $this->store = $store; $this->time = $time; + $this->format = $format; + switch ($format) { case 'text': @@ -531,8 +534,6 @@ class base_extractor if ($download == true) { - $this->fh = fopen('php://output', 'wb'); - $name = $filename . $ext; header('Pragma: no-cache'); header("Content-Type: $mimetype; name=\"$name\""); @@ -541,8 +542,9 @@ class base_extractor switch ($format) { case 'bzip2': - ob_start('ob_bz2handler'); + ob_start(); break; + case 'gzip': ob_start('ob_gzhandler'); break; @@ -575,9 +577,11 @@ class base_extractor $close($this->fp); } - if ($this->download) + // bzip2 must be written all the way at the end + if ($this->format === 'bzip2') { - fclose($this->fh); + $c = ob_get_clean(); + echo bzcompress($c); } } @@ -595,7 +599,13 @@ class base_extractor if ($this->download === true) { - fwrite($this->fh, $data); + echo $data; + + // we can write the gzip data as soon as we get it + if ($this->format === 'gzip') + { + ob_flush(); + } } } } @@ -2156,17 +2166,6 @@ function sanitize_data_generic($text) return implode('||', $val); } -// Internal handler for BZip2 -function ob_bz2handler($data, $mode) -{ - static $internal = ''; - $internal .= $data; - if ($mode & PHP_OUTPUT_HANDLER_END) - { - return bzcompress($internal); - } -} - // modified from PHP.net function fgetd(&$fp, $delim, $read, $seek, $eof, $buffer = 8192) { |