includes/functions.php
changeset 735 f191cb6bd0ca
parent 720 e2762777b170
child 741 a216e412c439
equal deleted inserted replaced
734:904fbf10f112 735:f191cb6bd0ca
  3146   
  3146   
  3147   //
  3147   //
  3148   // Compress buffered output if required and send to browser
  3148   // Compress buffered output if required and send to browser
  3149   // Sorry, doesn't work in IE. What else is new?
  3149   // Sorry, doesn't work in IE. What else is new?
  3150   //
  3150   //
  3151   if ( $do_gzip && function_exists('gzdeflate') && !strstr($_SERVER['HTTP_USER_AGENT'], 'MSIE') )
  3151   if ( $do_gzip && function_exists('gzdeflate') && !strstr($_SERVER['HTTP_USER_AGENT'], 'MSIE') && !headers_sent() )
  3152   {
  3152   {
  3153     $gzip_contents = ob_get_contents();
  3153     $gzip_contents = ob_get_contents();
  3154     ob_end_clean();
  3154     ob_end_clean();
  3155     
  3155     
  3156     $return = @enano_gzencode($gzip_contents);
  3156     $return = @enano_gzencode($gzip_contents);
  3750     return false;
  3750     return false;
  3751   
  3751   
  3752   if ( !file_exists($in_file) )
  3752   if ( !file_exists($in_file) )
  3753     return false;
  3753     return false;
  3754   
  3754   
  3755   if ( preg_match('/["\'\/\\\\]/', $in_file) || preg_match('/["\'\/\\\\]/', $out_file) )
  3755   $in_file = escapeshellarg($in_file);
  3756     die('SECURITY: scale_image(): infile or outfile path is screwy');
  3756   $out_file = escapeshellarg($out_file);
  3757   
  3757   
  3758   if ( file_exists($out_file) && !$unlink )
  3758   if ( file_exists($out_file) && !$unlink )
  3759     return false;
  3759     return false;
  3760   else if ( file_exists($out_file) && $unlink )
  3760   else if ( file_exists($out_file) && $unlink )
  3761     @unlink($out_file);
  3761     @unlink($out_file);