示例#1
0
function zip_inflate($data, $crc32, $uncomp_size)
{
    if (function_exists('gzinflate')) {
        $data = gzinflate($data);
        if (strlen($data) != $uncomp_size) {
            trigger_error("not enough output from gzinflate", E_USER_ERROR);
        }
        if (zip_crc32($data) != $crc32) {
            trigger_error("CRC32 mismatch", E_USER_ERROR);
        }
        return $data;
    }
    if (!function_exists('gzopen')) {
        global $request;
        $request->finish(_("Can't inflate data: zlib support not enabled in this PHP"));
    }
    // Reconstruct gzip header and ungzip the data.
    $mtime = time();
    //(Bogus mtime)
    return gzip_uncompress(pack("a2CxV@10", GZIP_MAGIC, GZIP_DEFLATE, $mtime) . $data . pack("VV", $crc32, $uncomp_size));
}
示例#2
0
function zip_inflate($data, $crc32, $uncomp_size)
{
	if (!function_exists('gzopen')) {
		global $request;

		$request->finish(_("Can't inflate data: zlib support not enabled in this PHP"));
	}

	// Reconstruct gzip header and ungzip the data.
	$mtime = time(); //(Bogus mtime)

	return gzip_uncompress(pack("a2CxV@10", GZIP_MAGIC, GZIP_DEFLATE, $mtime). $data . pack('VV', $crc32, $uncomp_size));
}