63 lines
1.6 KiB
PHP
63 lines
1.6 KiB
PHP
|
<?php
|
|||
|
if(!defined('DATALIFEENGINE'))
|
|||
|
{
|
|||
|
die("Hacking attempt!");
|
|||
|
}
|
|||
|
|
|||
|
function CheckCanGzip(){
|
|||
|
|
|||
|
if (headers_sent() || connection_aborted() || !function_exists('ob_gzhandler') || ini_get('zlib.output_compression')) return 0;
|
|||
|
|
|||
|
if (strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'x-gzip') !== false) return "x-gzip";
|
|||
|
if (strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') !== false) return "gzip";
|
|||
|
|
|||
|
return 0;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
function GzipOut($debug=0){
|
|||
|
global $config, $Timer, $db, $tpl, $_DOCUMENT_DATE;
|
|||
|
|
|||
|
$s = "
|
|||
|
<!-- <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ".$Timer->stop()." <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> -->
|
|||
|
<!-- <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ".round($tpl->template_parse_time, 5)." <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> -->
|
|||
|
<!-- <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> MySQL <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: ".round($db->MySQL_time_taken, 5)." <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> -->
|
|||
|
<!-- <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> MySQL <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ".$db->query_num." -->";
|
|||
|
|
|||
|
if($_DOCUMENT_DATE)
|
|||
|
{
|
|||
|
@header ("Last-Modified: " . date('r', $_DOCUMENT_DATE) ." GMT");
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
if ($config['allow_gzip'] != "yes") {if ($debug) echo $s; ob_end_flush(); return;}
|
|||
|
|
|||
|
$ENCODING = CheckCanGzip();
|
|||
|
|
|||
|
if ($ENCODING){
|
|||
|
$s .= "\n<!-- <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> $ENCODING -->\n";
|
|||
|
$Contents = ob_get_contents();
|
|||
|
ob_end_clean();
|
|||
|
|
|||
|
if ($debug){
|
|||
|
$s .= "<!-- <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>: ".strlen($Contents)." <20><><EFBFBD><EFBFBD> ";
|
|||
|
$s .= "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: ".
|
|||
|
strlen(gzencode($Contents, 1, FORCE_GZIP)).
|
|||
|
" <20><><EFBFBD><EFBFBD> -->";
|
|||
|
$Contents .= $s;
|
|||
|
}
|
|||
|
|
|||
|
header("Content-Encoding: $ENCODING");
|
|||
|
|
|||
|
$Contents = gzencode($Contents, 1, FORCE_GZIP);
|
|||
|
echo $Contents;
|
|||
|
exit;
|
|||
|
|
|||
|
}else{
|
|||
|
|
|||
|
ob_end_flush();
|
|||
|
exit;
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
?>
|