Просмотр файла public_html/template/gzip.php

Размер файла: 962B
<?php
if (!defined("BASEDIR")) { header("Location:../index.php"); exit; }

if ($_SERVER['HTTP_HOST']) {$config_servername = $_SERVER['HTTP_HOST'];} else {$config_servername = $_SERVER['SERVER_NAME'];}

if ($config_gzip=="1" && @extension_loaded('zlib') && @ini_get('zlib.output_compression') != '1' && @ini_get('output_handler') != 'ob_gzhandler'){

if(isset($_SERVER['HTTP_ACCEPT_ENCODING'])){
$AE = $_SERVER['HTTP_ACCEPT_ENCODING'];
} else {
$AE = $_SERVER['HTTP_TE'];
}

$support_gzip = (strpos($AE, 'gzip') !== FALSE);
$support_deflate = (strpos($AE, 'deflate') !== FALSE);

if($support_gzip && $support_deflate) {
	$support_deflate = FALSE;
}

if($support_gzip){
header("Content-Encoding: gzip");
ob_start("compress_output_gzip");
} 

if ($support_deflate) {
header("Content-Encoding: deflate");
ob_start("compress_output_deflate");
} 

if (!$support_gzip && !$support_deflate) {
ob_start();
$config_gzip="0"; 
}

}else{
ob_start();
$config_gzip="0"; 
}

?>