25 lines
774 B
PHP
25 lines
774 B
PHP
<?php
|
|
if (!defined('SVRJS_MOD_DIRECTORY')) die;
|
|
if (!defined('SVRJS_MOD_DIRECTORY_MODERATION')) die;
|
|
|
|
if (session_id()) session_write_close();
|
|
|
|
if (ob_get_status()) {
|
|
$content = ob_get_clean();
|
|
|
|
if ($content && COMPRESSION_ENABLED && isset($_SERVER['HTTP_ACCEPT_ENCODING'])) {
|
|
$acceptEncoding = array_map(function ($encoding) {
|
|
return trim($encoding);
|
|
}, explode(',', $_SERVER['HTTP_ACCEPT_ENCODING']));
|
|
|
|
if (in_array('gzip', $acceptEncoding)) {
|
|
$content = gzencode($content, 9);
|
|
header('Content-Encoding: gzip');
|
|
} elseif (in_array('deflate', $acceptEncoding)) {
|
|
$content = gzdeflate($content, 9);
|
|
header('Content-Encoding: deflate');
|
|
}
|
|
}
|
|
|
|
echo $content;
|
|
}
|