mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 06:08:52 +00:00
git-svn-id: file:///svn/phpbb/trunk@6991 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
caf5bfffd7
commit
e10e47044e
1 changed files with 16 additions and 17 deletions
|
@ -498,12 +498,15 @@ class base_extractor
|
||||||
var $store;
|
var $store;
|
||||||
var $download;
|
var $download;
|
||||||
var $time;
|
var $time;
|
||||||
|
var $format;
|
||||||
|
|
||||||
function base_extractor($download = false, $store = false, $format, $filename, $time)
|
function base_extractor($download = false, $store = false, $format, $filename, $time)
|
||||||
{
|
{
|
||||||
$this->download = $download;
|
$this->download = $download;
|
||||||
$this->store = $store;
|
$this->store = $store;
|
||||||
$this->time = $time;
|
$this->time = $time;
|
||||||
|
$this->format = $format;
|
||||||
|
|
||||||
switch ($format)
|
switch ($format)
|
||||||
{
|
{
|
||||||
case 'text':
|
case 'text':
|
||||||
|
@ -531,8 +534,6 @@ class base_extractor
|
||||||
|
|
||||||
if ($download == true)
|
if ($download == true)
|
||||||
{
|
{
|
||||||
$this->fh = fopen('php://output', 'wb');
|
|
||||||
|
|
||||||
$name = $filename . $ext;
|
$name = $filename . $ext;
|
||||||
header('Pragma: no-cache');
|
header('Pragma: no-cache');
|
||||||
header("Content-Type: $mimetype; name=\"$name\"");
|
header("Content-Type: $mimetype; name=\"$name\"");
|
||||||
|
@ -541,8 +542,9 @@ class base_extractor
|
||||||
switch ($format)
|
switch ($format)
|
||||||
{
|
{
|
||||||
case 'bzip2':
|
case 'bzip2':
|
||||||
ob_start('ob_bz2handler');
|
ob_start();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'gzip':
|
case 'gzip':
|
||||||
ob_start('ob_gzhandler');
|
ob_start('ob_gzhandler');
|
||||||
break;
|
break;
|
||||||
|
@ -575,9 +577,11 @@ class base_extractor
|
||||||
$close($this->fp);
|
$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)
|
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);
|
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
|
// modified from PHP.net
|
||||||
function fgetd(&$fp, $delim, $read, $seek, $eof, $buffer = 8192)
|
function fgetd(&$fp, $delim, $read, $seek, $eof, $buffer = 8192)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue