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
00045
00046
00047
00048 include_once( 'lib/ezfile/classes/ezfilehandler.php' );
00049
00050 class eZArchiveHandler
00051 {
00052
00053
00054
00055 function eZArchiveHandler( &$fileHandler, $archiveFilename = false )
00056 {
00057 $this->FileHandler =& $fileHandler;
00058 $this->ArchiveFilename = $archiveFilename;
00059 }
00060
00061 function setArchiveFileName( $filename )
00062 {
00063 $this->ArchiveFilename = $filename;
00064 }
00065
00066 function fileIsOpen()
00067 {
00068 return $this->FileHandler->isOpen();
00069 }
00070
00071 function fileIsBinaryMode()
00072 {
00073 return $this->FileHandler->isBinaryMode();
00074 }
00075
00076 function fileName()
00077 {
00078 return $this->FileHandler->filename();
00079 }
00080
00081 function fileMode()
00082 {
00083 return $this->FileHandler->mode();
00084 }
00085
00086 function fileOpen( $archiveFilename = false, $mode = false )
00087 {
00088 if ( !$archiveFilename )
00089 $archiveFilename = $this->ArchiveFilename;
00090 $result = $this->FileHandler->open( $archiveFilename, $mode );
00091 if ( $result )
00092 $this->ArchiveFilename = $archiveFilename;
00093 return $result;
00094 }
00095
00096 function fileClose()
00097 {
00098 return $this->FileHandler->close();
00099 }
00100
00101 function fileRead( $length = false )
00102 {
00103 return $this->FileHandler->read( $length );
00104 }
00105
00106 function fileWrite( $data, $length = false )
00107 {
00108 return $this->FileHandler->write( $data, $length );
00109 }
00110
00111 function fileFlush()
00112 {
00113 return $this->FileHandler->flush();
00114 }
00115
00116 function fileSeek( $offset, $whence = SEEK_SET )
00117 {
00118 return $this->FileHandler->seek( $offset, $whence );
00119 }
00120
00121 function fileRewind()
00122 {
00123 return $this->FileHandler->rewind();
00124 }
00125
00126 function fileTell()
00127 {
00128 return $this->FileHandler->tell();
00129 }
00130
00131 function fileEOF()
00132 {
00133 return $this->FileHandler->eof();
00134 }
00135
00136 function filePasstrough( $closeFile = true )
00137 {
00138 return $this->FileHandler->passtrough( $closeFile );
00139 }
00140
00141 function fileError()
00142 {
00143 return $this->FileHandler->error();
00144 }
00145
00146 function fileErrorString()
00147 {
00148 return $this->FileHandler->errorString();
00149 }
00150
00151 function fileErrorNumber()
00152 {
00153 return $this->FileHandler->errorNumber();
00154 }
00155
00156
00157
00158
00159 function fileRename( $destinationFilename, $sourceFilename = true )
00160 {
00161 return $this->FileHandler->rename( $destinationFilename, $sourceFilename );
00162 }
00163
00164 function fileUnlink( $filename = false )
00165 {
00166 return $this->FileHandler->unlink( $filename );
00167 }
00168
00169 function fileCopy( $sourceFilename, $destinationFilename )
00170 {
00171 return $this->FileHandler->copy( $sourceFilename, $destinationFilename );
00172 }
00173
00174 function fileExists( $filename = false )
00175 {
00176 return $this->FileHandler->exists( $filename );
00177 }
00178
00179 function fileIsDirectory( $filename = false )
00180 {
00181 return $this->FileHandler->isDirectory( $filename );
00182 }
00183
00184 function fileIsExecutable( $filename = false )
00185 {
00186 return $this->FileHandler->isExecutable( $filename );
00187 }
00188
00189 function fileIsFile( $filename = false )
00190 {
00191 return $this->FileHandler->isFile( $filename );
00192 }
00193
00194 function fileIsLink( $filename = false )
00195 {
00196 return $this->FileHandler->isLink( $filename );
00197 }
00198
00199 function fileIsReadable( $filename = false )
00200 {
00201 return $this->FileHandler->isReadable( $filename );
00202 }
00203
00204 function fileIsWriteable( $filename = false )
00205 {
00206 return $this->FileHandler->isWriteable( $filename );
00207 }
00208
00209 function fileStatistics( $filename = false )
00210 {
00211 return $this->FileHandler->statistics( $filename );
00212 }
00213
00214
00215
00216
00217 function fileHandler()
00218 {
00219 return $this->FileHandler;
00220 }
00221
00222
00223
00224
00225 function isAvailable()
00226 {
00227 return true;
00228 }
00229
00230
00231
00232
00233
00234 function &detachHandler()
00235 {
00236 $oldHandler =& $this->FileHandler;
00237 $this->FileHandler =& $oldHandler->duplicate();
00238 return $oldHandler;
00239 }
00240
00241
00242
00243
00244
00245
00246 function &instance( $identifier, $fileHandlerType = false, $arhiveFilename = false )
00247 {
00248 include_once( 'lib/ezutils/classes/ezini.php' );
00249 $ini =& eZINI::instance( 'file.ini' );
00250 $handlers = $ini->variable( 'ArchiveSettings', 'Handlers' );
00251 $instance = false;
00252 if ( isset( $handlers[$identifier] ) )
00253 {
00254 $className = $handlers[$identifier];
00255 $includeFile = 'lib/ezfile/classes/' . $className . '.php';
00256 include_once( $includeFile );
00257 $fileHandler =& eZFileHandler::instance( $fileHandlerType );
00258 $instance = new $className( $fileHandler, $arhiveFilename );
00259 if ( !$instance->isAvailable() )
00260 {
00261 unset( $instance );
00262 $instance = false;
00263 }
00264 }
00265 return $instance;
00266 }
00267
00268
00269 var $FileHandler;
00270 }
00271
00272 ?>