ob_start();
ob_implicit_flush(0);
function GzDocOut(){
global $HTTP_ACCEPT_ENCODING, $DEBUG;
$DEBUG = ($DEBUG) ? $DEBUG : 1;
if(preg_match('/(x-gzip|gzip)/', $HTTP_ACCEPT_ENCODING, $EncodeArr)){
$ENCODING = $EncodeArr[1];
$Contents = ob_get_contents();
ob_end_clean();
header("Content-Encoding: $ENCODING");
$Contents .= ($DEBUG) ? "\n" : '';
if($DEBUG == 2){
$Contents .= "\n';
$Contents .= "\n';
}
$Size = strlen($Contents);
$Crc = crc32($Contents);
$Contents = gzcompress($Contents);
print pack('c*',0x1f,0x8b,0x08,0x00,0x00,0x00,0x00,0x00);
print substr($Contents, 0, strlen($Contents) - 4);
print pack('V*',$Crc,$Size);
exit;
}else{
print ($DEBUG) ? '' : '';
ob_end_flush();
exit;
}
}
?>