All pastes #35140 Raw Edit

Someone

public php v1 · immutable
#35140 ·published 2005-12-29 12:06 UTC
rendered paste body
function compress_out ($input) {	//Based on old YaBBSE code (c)	//Open-Source Project by Zef Hemel (zef@zefnet.com <mailto:zef@zefnet.com>)	//Copyright (c) 2001-2002 The YaBB Development Team	if((function_exists("gzcompress")) && (function_exists("crc32"))){	   if(strpos(" " . $_SERVER['HTTP_ACCEPT_ENCODING'], "x-gzip")){	      $encode = "x-gzip";	   }	   elseif(strpos(" " . $_SERVER['HTTP_ACCEPT_ENCODING'], "gzip")){	      $encode = "gzip";	   }	if (isset($encode)){		header("Content-Encoding: $encode");		$encode_size = strlen($input);		$encode_crc = crc32($input);		$out = "\x1f\x8b\x08\x00\x00\x00\x00\x00";		$out .= substr(gzcompress($input, 1), 0, -4);		$out .= pack("V", $encode_crc);		$out .= pack("V", $encode_size);	}	else{		$out = $input;	}}else{	$out = $input;}return ($out);}