00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044 include_once( 'lib/ezfile/classes/ezcompressionhandler.php' );
00045
00046 class eZGZIPShellCompressionHandler extends eZCompressionHandler
00047 {
00048
00049
00050 function eZGZIPShellCompressionHandler()
00051 {
00052 $this->File = false;
00053 $thus->Level = false;
00054 $this->eZCompressionHandler( 'GZIP (shell)', 'gzipshell' );
00055 }
00056
00057
00058
00059
00060 function setCompressionLevel( $level )
00061 {
00062 if ( $level < 0 or $level > 9 )
00063 $level = false;
00064 $this->Level = $level;
00065 }
00066
00067
00068
00069
00070
00071 function compressionLevel()
00072 {
00073 return $this->Level;
00074 }
00075
00076
00077
00078
00079 function isAvailable()
00080 {
00081 return false;
00082 }
00083
00084 function gunzipFile( $filename )
00085 {
00086 $command = 'gzip -dc $filename > $';
00087 }
00088
00089
00090
00091
00092 function doOpen( $filename, $mode )
00093 {
00094 $this->File = @gzopen( $filename, $mode );
00095 }
00096
00097
00098
00099
00100 function doClose()
00101 {
00102 return @gzclose( $this->File );
00103 }
00104
00105
00106
00107
00108 function doRead( $uncompressedLength = false )
00109 {
00110 return @gzread( $this->File, $uncompressedLength );
00111 }
00112
00113
00114
00115
00116 function doWrite( $data, $uncompressedLength = false )
00117 {
00118 return @gzwrite( $this->File, $uncompressedLength );
00119 }
00120
00121
00122
00123
00124 function doFlush()
00125 {
00126 return @fflush( $this->File );
00127 }
00128
00129
00130
00131
00132 function doSeek( $offset, $whence )
00133 {
00134 if ( $whence == SEEK_SET )
00135 $offset = $offset - gztell( $this->File );
00136 else if ( $whence == SEEK_END )
00137 {
00138 eZDebugSetting::writeError( 'lib-ezfile-gziplibz',
00139 "Seeking from end is not supported for gzipped files" );
00140 return false;
00141 }
00142 return @gzseek( $this->File, $offset );
00143 }
00144
00145
00146
00147
00148 function doRewind()
00149 {
00150 return @gzrewind( $this->File );
00151 }
00152
00153
00154
00155
00156 function doTell()
00157 {
00158 return @gztell( $this->File );
00159 }
00160
00161
00162
00163
00164 function doEOF()
00165 {
00166 return @gzeof( $this->File );
00167 }
00168
00169
00170
00171
00172 function doPasstrough()
00173 {
00174 return @gzpasstru( $this->File );
00175 }
00176
00177
00178
00179
00180 function compress( $source )
00181 {
00182 return @gzcompress( $source, $this->Level );
00183 }
00184
00185
00186
00187
00188 function decompress( $source )
00189 {
00190 return @gzuncompress( $source );
00191 }
00192
00193
00194
00195
00196 function errorString()
00197 {
00198 return false;
00199 }
00200
00201
00202
00203
00204 function errorNumber()
00205 {
00206 return false;
00207 }
00208
00209
00210
00211 var $File;
00212
00213 var $Level;
00214 }
00215
00216 ?>