includes/functions.php
changeset 1110 1a3f374310ca
parent 1099 73abd46f5148
child 1115 b3c249d06990
equal deleted inserted replaced
1109:c424a15a1656 1110:1a3f374310ca
  3155 
  3155 
  3156 function gzip_output()
  3156 function gzip_output()
  3157 {
  3157 {
  3158   global $do_gzip;
  3158   global $do_gzip;
  3159   
  3159   
       
  3160   $gzip_supported = false;
       
  3161   if ( isset($_SERVER['HTTP_ACCEPT_ENCODING']) )
       
  3162   {
       
  3163     $encodings = explode(',', $_SERVER['HTTP_ACCEPT_ENCODING']);
       
  3164     $gzip_supported = in_array('gzip', $encodings) || in_array('deflate', $encodings);
       
  3165   }
       
  3166   
  3160   //
  3167   //
  3161   // Compress buffered output if required and send to browser
  3168   // Compress buffered output if required and send to browser
  3162   // Sorry, doesn't work in IE. What else is new?
  3169   // Sorry, doesn't work in IE. What else is new?
  3163   //
  3170   //
  3164   if ( $do_gzip && function_exists('gzdeflate') && !strstr($_SERVER['HTTP_USER_AGENT'], 'MSIE') && !headers_sent() )
  3171   if ( $do_gzip && function_exists('gzdeflate') && !strstr($_SERVER['HTTP_USER_AGENT'], 'MSIE') && !headers_sent() && $gzip_supported )
  3165   {
  3172   {
  3166     $gzip_contents = ob_get_contents();
  3173     $gzip_contents = ob_get_contents();
  3167     ob_end_clean();
  3174     ob_end_clean();
  3168     
  3175     
  3169     global $php_errors;
  3176     global $php_errors;