Gzip Support : bug fixe
This commit is contained in:
@@ -1,10 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
/* $Id$ */
|
/* $Id$ */
|
||||||
|
|
||||||
|
|
||||||
require("./grab_globals.inc.php3");
|
require("./grab_globals.inc.php3");
|
||||||
|
|
||||||
|
|
||||||
@set_time_limit(600);
|
@set_time_limit(600);
|
||||||
$crlf="\n";
|
$crlf="\n";
|
||||||
|
|
||||||
@@ -20,8 +18,8 @@ else
|
|||||||
include("./lib.inc.php3");
|
include("./lib.inc.php3");
|
||||||
$ext = "sql";
|
$ext = "sql";
|
||||||
if($what == "csv") $ext = "csv";
|
if($what == "csv") $ext = "csv";
|
||||||
if(isset($gzip))
|
if(isset($gzip))
|
||||||
if($gzip == "gzip") $ext = "gz";
|
if($gzip == "gzip") $ext = "gz";
|
||||||
|
|
||||||
header('Content-Type: application/octetstream');
|
header('Content-Type: application/octetstream');
|
||||||
header('Content-Disposition: filename="' . $filename . '.' . $ext . '"');
|
header('Content-Disposition: filename="' . $filename . '.' . $ext . '"');
|
||||||
@@ -51,7 +49,7 @@ else
|
|||||||
function my_handler($sql_insert)
|
function my_handler($sql_insert)
|
||||||
{
|
{
|
||||||
global $crlf, $asfile;
|
global $crlf, $asfile;
|
||||||
global $tmp_buffer;
|
global $tmp_buffer;
|
||||||
|
|
||||||
if(empty($asfile))
|
if(empty($asfile))
|
||||||
$tmp_buffer.= htmlspecialchars("$sql_insert;$crlf");
|
$tmp_buffer.= htmlspecialchars("$sql_insert;$crlf");
|
||||||
@@ -64,7 +62,7 @@ function my_csvhandler($sql_insert)
|
|||||||
// 2001-05-07, Lem9: added $add_character
|
// 2001-05-07, Lem9: added $add_character
|
||||||
|
|
||||||
global $crlf, $add_character, $asfile;
|
global $crlf, $add_character, $asfile;
|
||||||
global $tmp_buffer;
|
global $tmp_buffer;
|
||||||
|
|
||||||
if(empty($asfile))
|
if(empty($asfile))
|
||||||
$tmp_buffer.= htmlspecialchars($sql_insert . $add_character . $crlf);
|
$tmp_buffer.= htmlspecialchars($sql_insert . $add_character . $crlf);
|
||||||
@@ -122,9 +120,7 @@ else
|
|||||||
$dump_buffer.= "$crlf#$crlf";
|
$dump_buffer.= "$crlf#$crlf";
|
||||||
$dump_buffer.= "# $strTableStructure '$table'$crlf";
|
$dump_buffer.= "# $strTableStructure '$table'$crlf";
|
||||||
$dump_buffer.= "#$crlf$crlf";
|
$dump_buffer.= "#$crlf$crlf";
|
||||||
|
$dump_buffer.= get_table_def($db,$table, $crlf).";$crlf";
|
||||||
get_table_def($db, $table, $crlf).";$crlf";
|
|
||||||
$dump_buffer.=$tmp_buffer;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(($what == "data") || ($what == "dataonly"))
|
if(($what == "data") || ($what == "dataonly"))
|
||||||
@@ -133,28 +129,31 @@ else
|
|||||||
$dump_buffer.= "# $strDumpingData '$table'$crlf";
|
$dump_buffer.= "# $strDumpingData '$table'$crlf";
|
||||||
$dump_buffer.= "#$crlf$crlf";
|
$dump_buffer.= "#$crlf$crlf";
|
||||||
|
|
||||||
|
$tmp_buffer="";
|
||||||
get_table_content($db, $table, "my_handler");
|
get_table_content($db, $table, "my_handler");
|
||||||
$dump_buffer.=$tmp_buffer;
|
$dump_buffer.=$tmp_buffer;
|
||||||
|
|
||||||
}
|
}
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$dump_buffer.= "$crlf"; // Don't remove, it makes easier to select & copy from browser - staybyte
|
// Don't remove, it makes easier to select & copy frombrowser - staybyte
|
||||||
|
$dump_buffer.= "$crlf";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ // $what != "csv"
|
{ // $what != "csv"
|
||||||
|
$tmp_buffer="";
|
||||||
get_table_csv($db, $table, $separator, "my_csvhandler");
|
get_table_csv($db, $table, $separator, "my_csvhandler");
|
||||||
$dump_buffer.=$tmp_buffer;
|
$dump_buffer.=$tmp_buffer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isset($gzip)) {
|
if(isset($gzip)) {
|
||||||
if($gzip == "gzip" && function_exists("gzencode"))
|
if($gzip == "gzip" && function_exists("gzencode"))
|
||||||
echo gzencode($dump_buffer); // without the optional parameter level because it bug
|
// without the optional parameter level because it bug
|
||||||
|
echo gzencode($dump_buffer);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
echo $dump_buffer;
|
echo $dump_buffer;
|
||||||
|
|
||||||
if(empty($asfile))
|
if(empty($asfile))
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user