plugins/SpecialUpdownload.php
changeset 80 cb7dde69c301
parent 23 320acf077276
child 81 d7fc25acd3f3
equal deleted inserted replaced
79:5faff33a6580 80:cb7dde69c301
   267   if(isset($_GET['download'])) header('Content-disposition: attachment, filename="'.$filename.'";');
   267   if(isset($_GET['download'])) header('Content-disposition: attachment, filename="'.$filename.'";');
   268   header('Content-length: '.$len);
   268   header('Content-length: '.$len);
   269   header('Last-Modified: '.date('r', $row['time_id']));
   269   header('Last-Modified: '.date('r', $row['time_id']));
   270   echo($data);
   270   echo($data);
   271   
   271   
   272   //
   272   gzip_output();
   273   // Compress buffered output if required and send to browser
       
   274   //
       
   275   if ( $do_gzip )
       
   276   {
       
   277     //
       
   278     // Copied from phpBB, which was in turn borrowed from php.net
       
   279     //
       
   280     $gzip_contents = ob_get_contents();
       
   281     ob_end_clean();
       
   282   
       
   283     $gzip_size = strlen($gzip_contents);
       
   284     $gzip_crc = crc32($gzip_contents);
       
   285   
       
   286     $gzip_contents = gzcompress($gzip_contents, 9);
       
   287     $gzip_contents = substr($gzip_contents, 0, strlen($gzip_contents) - 4);
       
   288   
       
   289     header('Content-encoding: gzip');
       
   290     echo "\x1f\x8b\x08\x00\x00\x00\x00\x00";
       
   291     echo $gzip_contents;
       
   292     echo pack('V', $gzip_crc);
       
   293     echo pack('V', $gzip_size);
       
   294   }
       
   295   
   273   
   296   exit;
   274   exit;
   297   
   275   
   298 }
   276 }
   299 
   277