| 1 |
<?php exit; |
| 2 |
// Determine supported compression method |
| 3 |
$gzip = strstr($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip'); |
| 4 |
$deflate = strstr($_SERVER['HTTP_ACCEPT_ENCODING'], 'deflate'); |
| 5 |
|
| 6 |
// Determine used compression method |
| 7 |
$encoding = $gzip ? 'gzip' : ($deflate ? 'deflate' : 'none'); |
| 8 |
|
| 9 |
// Check for buggy versions of Internet Explorer |
| 10 |
if (!strstr($_SERVER['HTTP_USER_AGENT'], 'Opera') && |
| 11 |
preg_match('/^Mozilla\/4\.0 \(compatible; MSIE ([0-9]\.[0-9])/i', $_SERVER['HTTP_USER_AGENT'], $matches)) |
| 12 |
{ |
| 13 |
$version = floatval($matches[1]); |
| 14 |
|
| 15 |
if ($version < 6) |
| 16 |
$encoding = 'none'; |
| 17 |
|
| 18 |
if ($version == 6 && !strstr($_SERVER['HTTP_USER_AGENT'], 'EV1')) |
| 19 |
$encoding = 'none'; |
| 20 |
} |
| 21 |
|
| 22 |
//Get data |
| 23 |
$contents = file_get_contents(__FILE__.'.'.$encoding); |
| 24 |
|
| 25 |
if (isset($encoding) && $encoding != 'none') |
| 26 |
{ |
| 27 |
// Send compressed contents |
| 28 |
header('Content-Encoding: '.$encoding); |
| 29 |
header('Content-Length: '.strlen($contents)); |
| 30 |
} |
| 31 |
header('Vary: Accept-Encoding'); |
| 32 |
|
| 33 |
header('Content-type: %%CONTENT%%; charset=utf-8'); |
| 34 |
header('Cache-Control: max-age=315360000, public, must-revalidate'); |
| 35 |
header('Expires: '.gmdate('D, d M Y H:i:s', time() + 315360000).' GMT'); //10 years |
| 36 |
|
| 37 |
echo $contents; |
| 38 |
|