3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the Revised BSD License.
6 This program is distributed in the hope that it will be useful,
7 but WITHOUT ANY WARRANTY; without even the implied warranty of
8 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 Revised BSD License for more details.
11 Copyright 2004-2023 iDB Support - https://idb.osdn.jp/support/category.php?act=view&id=1
12 Copyright 2004-2023 Game Maker 2k - https://idb.osdn.jp/support/category.php?act=view&id=2
13 GZip and Zlib by Jean-loup Gailly (compression) and Mark Adler (decompression) http://www.zlib.net/
14 BZip2 and libbzip2 by Julian Seward http://www.bzip.org/
16 $FileInfo: compression.php - Last Update: 6/22/2023 SVN 984 - Author: cooldude2k $
18 $File3Name = basename($_SERVER['SCRIPT_NAME']);
19 if ($File3Name=="compression.php"||
$File3Name=="/compression.php") {
22 //Check if zlib is loaded
23 if(extension_loaded("zlib")) {
24 function gunzip($infile, $outfile) {
26 $zp = gzopen($infile, "r");
28 $string .= gzread($zp, 4096);
30 $fp = fopen($outfile, "w");
31 fwrite($fp, $string, strlen($string));
35 function gunzip2($infile, $outfile) {
36 $string = implode("", gzfile($infile));
37 $fp = fopen($outfile, "w");
38 fwrite($fp, $string, strlen($string));
41 function gzip($infile, $outfile, $param = 5) {
42 $fp = fopen($infile, "r");
43 $data = fread ($fp, filesize($infile));
45 $zp = gzopen($outfile, "w".$param);
49 //Check if bz2 is loaded
50 if(extension_loaded("bz2")) {
51 function bzip($infile, $outfile) {
52 $fp = fopen($infile, "r");
53 $data = fread($fp, filesize($infile));
55 $zp = bzopen($outfile, "w");
60 function bunzip($infile, $outfile) {
62 $zp = bzopen($infile, "r");
64 $string .= bzread($zp, 4096);
66 $fp = fopen($outfile, "w");
67 fwrite($fp, $string, strlen($string));
70 //Check if zip is loaded
71 if(extension_loaded("zip")) {
72 /* Nothing for now... :P */ }
73 //Check if rar is loaded
74 if(extension_loaded("rar")) {
75 /* Nothing for now... :P */ }