[ Index ] |
|
Code source de DokuWiki 2006-11-06 |
1 <?php 2 3 /* 4 +---------------------------------------------+ 5 | TAR format class - Creates TAR archives | 6 +---------------------------------------------+ 7 | This class is part or the MaxgComp suite | 8 +---------------------------------------------+ 9 | Created by the Maxg Network (maxg.info) | 10 | http://docs.maxg.info for help & license. | 11 +---------------------------------------------+ 12 | Author: Bouchon <tarlib@bouchon.org> (Maxg) | 13 +---------------------------------------------+ 14 * Modified for Dokuwiki 15 * @author Christopher Smith <chris@jalakai.co.uk> 16 */ 17 18 define('COMPRESS_GZIP',1); 19 define('COMPRESS_BZIP',2); 20 define('COMPRESS_AUTO',3); 21 define('COMPRESS_NONE',0); 22 23 define('TARLIB_VERSION','1.2'); 24 define('FULL_ARCHIVE',-1); 25 26 define('ARCHIVE_DYNAMIC',0); 27 define('ARCHIVE_RENAMECOMP',5); 28 define('COMPRESS_DETECT',-1); 29 30 class CompTar 31 { 32 var $_comptype; 33 var $_compzlevel; 34 var $_fp; 35 var $_memdat; 36 var $_nomf; 37 var $_result; 38 39 function CompTar($p_filen = ARCHIVE_DYNAMIC , $p_comptype = COMPRESS_AUTO, $p_complevel = 9) 40 { 41 $this->_nomf = $p_filen; $flag=0; 42 if($p_comptype && $p_comptype % 5 == 0){$p_comptype /= ARCHIVE_RENAMECOMP; $flag=1;} 43 44 if($p_complevel > 0 && $p_complevel <= 9) $this->_compzlevel = $p_complevel; 45 else $p_complevel = 9; 46 47 if($p_comptype == COMPRESS_DETECT) 48 { 49 if(strtolower(substr($p_filen,-3)) == '.gz') $p_comptype = COMPRESS_GZIP; 50 elseif(strtolower(substr($p_filen,-4)) == '.bz2') $p_comptype = COMPRESS_BZIP; 51 else $p_comptype = COMPRESS_NONE; 52 } 53 54 switch($p_comptype) 55 { 56 case COMPRESS_GZIP: 57 if(!extension_loaded('zlib')) $this->_result = -1; 58 $this->_comptype = COMPRESS_GZIP; 59 break; 60 61 case COMPRESS_BZIP: 62 if(!extension_loaded('bz2')) $this->_result = -2; 63 $this->_comptype = COMPRESS_BZIP; 64 break; 65 66 case COMPRESS_AUTO: 67 if(extension_loaded('zlib')) 68 $this->_comptype = COMPRESS_GZIP; 69 elseif(extension_loaded('bz2')) 70 $this->_comptype = COMPRESS_BZIP; 71 else 72 $this->_comptype = COMPRESS_NONE; 73 break; 74 75 default: 76 $this->_comptype = COMPRESS_NONE; 77 } 78 79 if($this->_result < 0) $this->_comptype = COMPRESS_NONE; 80 81 if($flag) $this->_nomf.= '.'.$this->getCompression(1); 82 $this->_result = true; 83 } 84 85 function setArchive($p_name='', $p_comp = COMPRESS_AUTO, $p_level=9) 86 { 87 $this->_CompTar(); 88 $this->CompTar($p_name, $p_comp, $p_level); 89 return $this->_result; 90 } 91 92 function getCompression($ext = false) 93 { 94 $exts = Array('tar','tar.gz','tar.bz2'); 95 if($ext) return $exts[$this->_comptype]; 96 return $this->_comptype; 97 } 98 99 function setCompression($p_comp = COMPRESS_AUTO) 100 { 101 $this->setArchive($this->_nomf, $p_comp, $this->_compzlevel); 102 return $this->_compzlevel; 103 } 104 105 function getDynamicArchive() 106 { 107 return $this->_encode($this->_memdat); 108 } 109 110 function writeArchive($p_archive) 111 { 112 if(!$this->_memdat) return -7; 113 $fp = @fopen($p_archive, 'wb'); 114 if(!$fp) return -6; 115 116 fwrite($fp, $this->_memdat); 117 fclose($fp); 118 119 return true; 120 } 121 122 function sendClient($name = '', $archive = '', $headers = TRUE) 123 { 124 if(!$name && !$this->_nomf) return -9; 125 if(!$archive && !$this->_memdat) return -10; 126 if(!$name) $name = basename($this->_nomf); 127 128 if($archive){ if(!file_exists($archive)) return -11; } 129 else $decoded = $this->getDynamicArchive(); 130 131 if($headers) 132 { 133 header('Content-Type: application/x-gtar'); 134 header('Content-Disposition: attachment; filename='.basename($name)); 135 header('Accept-Ranges: bytes'); 136 header('Content-Length: '.($archive ? filesize($archive) : strlen($decoded))); 137 } 138 139 if($archive) 140 { 141 $fp = @fopen($archive,'rb'); 142 if(!$fp) return -4; 143 144 while(!foef($fp)) echo fread($fp,2048); 145 } 146 else 147 { 148 echo $decoded; 149 } 150 151 return true; 152 } 153 154 function Extract($p_what = FULL_ARCHIVE, $p_to = '.', $p_remdir='', $p_mode = 0755) 155 { 156 if(!$this->_OpenRead()) return -4; 157 // if(!@is_dir($p_to)) if(!@mkdir($p_to, 0777)) return -8; --CS 158 if(!@is_dir($p_to)) if(!$this->_dirApp($p_to)) return -8; //--CS (route through correct dir fn) 159 160 $ok = $this->_extractList($p_to, $p_what, $p_remdir, $p_mode); 161 $this->_CompTar(); 162 163 return $ok; 164 } 165 166 function Create($p_filelist,$p_add='',$p_rem='') 167 { 168 if(!$fl = $this->_fetchFilelist($p_filelist)) return -5; 169 if(!$this->_OpenWrite()) return -6; 170 171 $ok = $this->_addFileList($fl,$p_add,$p_rem); 172 173 if($ok) $this->_writeFooter(); 174 else{ $this->_CompTar(); @unlink($this->_nomf); } 175 176 return $ok; 177 } 178 179 function Add($p_filelist, $p_add = '', $p_rem = '') 180 { 181 if (($this->_nomf != ARCHIVE_DYNAMIC && @is_file($this->_nomf)) || ($this->_nomf == ARCHIVE_DYNAMIC && !$this->_memdat)) 182 return $this->Create($p_filelist, $p_add, $p_rem); 183 184 if(!$fl = $this->_fetchFilelist($p_filelist)) return -5; 185 return $this->_append($fl, $p_add, $p_rem); 186 } 187 188 function ListContents() 189 { 190 if(!$this->_nomf) return -3; 191 if(!$this->_OpenRead()) return -4; 192 193 $result = Array(); 194 195 while ($dat = $this->_read(512)) 196 { 197 $dat = $this->_readHeader($dat); 198 if(!is_array($dat)) continue; 199 200 $this->_seek(ceil($dat['size']/512)*512,1); 201 $result[] = $dat; 202 } 203 204 return $result; 205 } 206 207 function TarErrorStr($i) 208 { 209 $ecodes = Array( 210 1 => TRUE, 211 0 => "Undocumented error", 212 -1 => "Can't use COMPRESS_GZIP compression : ZLIB extensions are not loaded !", 213 -2 => "Can't use COMPRESS_BZIP compression : BZ2 extensions are not loaded !", 214 -3 => "You must set a archive file to read the contents !", 215 -4 => "Can't open the archive file for read !", 216 -5 => "Invalide file list !", 217 -6 => "Can't open the archive in write mode !", 218 -7 => "There is no ARCHIVE_DYNAMIC to write !", 219 -8 => "Can't create the directory to extract files !", 220 -9 => "Please pass a archive name to send if you made created an ARCHIVE_DYNAMIC !", 221 -10 => "You didn't pass an archive filename and there is no stored ARCHIVE_DYNAMIC !", 222 -11 => "Given archive doesn't exist !" 223 ); 224 225 return isset($ecodes[$i]) ? $ecodes[$i] : $ecodes[0]; 226 } 227 228 function TarInfo($headers = true) 229 { 230 if($headers) 231 { 232 ?> 233 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 234 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 235 <html> 236 237 <head> 238 <title>MaxgComp TAR</title> 239 <style type="text/css"> 240 body{margin: 20px;} 241 body,td{font-size:10pt;font-family: arial;} 242 </style> 243 <meta name="Author" content="The Maxg Network, http://maxg.info" /> 244 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> 245 </head> 246 247 <body bgcolor="#EFEFEF"> 248 <?php 249 } 250 ?> 251 <table border="0" align="center" width="500" cellspacing="4" cellpadding="5" style="border:1px dotted black;"> 252 <tr> 253 <td align="center" bgcolor="#DFDFEF" colspan="3" style="font-size:15pt;font-color:#330000;border:1px solid black;">MaxgComp TAR</td> 254 </tr> 255 <tr> 256 <td colspan="2" bgcolor="#EFEFFE" style="border:1px solid black;">This software was created by the Maxg Network, <a href="http://maxg.info" target="_blank" style="text-decoration:none;color:#333366;">http://maxg.info</a> 257 <br />It is distributed under the GNU <a href="http://www.gnu.org/copyleft/lesser.html" target="_blank" style="text-decoration:none;color:#333366;">Lesser General Public License</a> 258 <br />You can find the documentation of this class <a href="http://docs.maxg.info" target="_blank" style="text-decoration:none;color:#333366;">here</a></td> 259 <td width="60" bgcolor="#EFEFFE" style="border:1px solid black;" align="center"><img src="http://img.maxg.info/menu/tar.gif" border="0" alt="MaxgComp TAR" /></td> 260 </tr> 261 <tr> 262 <td width="50%" align="center" style="border:1px solid black;" bgcolor="#DFDFEF">MaxgComp TAR version</td> 263 <td colspan="2" align="center" bgcolor="#EFEFFE" style="border:1px solid black;"><?=TARLIB_VERSION?></td> 264 </tr> 265 <tr> 266 <td width="50%" align="center" style="border:1px solid black;" bgcolor="#DFDFEF">ZLIB extensions</td> 267 <td colspan="2" align="center" bgcolor="#EFEFFE" style="border:1px solid black;"><?=(extension_loaded('zlib') ? '<b>Yes</b>' : '<i>No</i>')?></td> 268 </tr> 269 <tr> 270 <td width="50%" align="center" style="border:1px solid black;" bgcolor="#DFDFEF">BZ2 extensions</td> 271 <td colspan="2" align="center" bgcolor="#EFEFFE" style="border:1px solid black;"><?=(extension_loaded('bz2') ? '<b>Yes</b>' : '<i>No</i>')?></td> 272 </tr> 273 <tr> 274 <td width="50%" align="center" style="border:1px solid black;" bgcolor="#DFDFEF">Allow URL fopen</td> 275 <td colspan="2" align="center" bgcolor="#EFEFFE" style="border:1px solid black;"><?=(ini_get('allow_url_fopen') ? '<b>Yes</b>' : '<i>No</i>')?></td> 276 </tr> 277 <tr> 278 <td width="50%" align="center" style="border:1px solid black;" bgcolor="#DFDFEF">Time limit</td> 279 <td colspan="2" align="center" bgcolor="#EFEFFE" style="border:1px solid black;"><?=ini_get('max_execution_time')?></td> 280 </tr> 281 <tr> 282 <td width="50%" align="center" style="border:1px solid black;" bgcolor="#DFDFEF">PHP Version</td> 283 <td colspan="2" align="center" bgcolor="#EFEFFE" style="border:1px solid black;"><?=phpversion()?></td> 284 </tr> 285 <tr> 286 <td colspan="3" align="center" bgcolor="#EFEFFE" style="border:1px solid black;"> 287 <i>Special thanks to « Vincent Blavet » for his PEAR::Archive_Tar class</i> 288 </td> 289 </tr> 290 </table> 291 <?php 292 if($headers) echo '</body></html>'; 293 } 294 295 function _seek($p_flen, $tell=0) 296 { 297 if($this->_nomf === ARCHIVE_DYNAMIC) 298 $this->_memdat=substr($this->_memdat,0,($tell ? strlen($this->_memdat) : 0) + $p_flen); 299 elseif($this->_comptype == COMPRESS_GZIP) 300 @gzseek($this->_fp, ($tell ? @gztell($this->_fp) : 0)+$p_flen); 301 elseif($this->_comptype == COMPRESS_BZIP) 302 @fseek($this->_fp, ($tell ? @ftell($this->_fp) : 0)+$p_flen); 303 else 304 @fseek($this->_fp, ($tell ? @ftell($this->_fp) : 0)+$p_flen); 305 } 306 307 function _OpenRead() 308 { 309 if($this->_comptype == COMPRESS_GZIP) 310 $this->_fp = @gzopen($this->_nomf, 'rb'); 311 elseif($this->_comptype == COMPRESS_BZIP) 312 $this->_fp = @bzopen($this->_nomf, 'rb'); 313 else 314 $this->_fp = @fopen($this->_nomf, 'rb'); 315 316 return ($this->_fp ? true : false); 317 } 318 319 function _OpenWrite($add = 'w') 320 { 321 if($this->_nomf === ARCHIVE_DYNAMIC) return true; 322 323 if($this->_comptype == COMPRESS_GZIP) 324 $this->_fp = @gzopen($this->_nomf, $add.'b'.$this->_compzlevel); 325 elseif($this->_comptype == COMPRESS_BZIP) 326 $this->_fp = @bzopen($this->_nomf, $add.'b'); 327 else 328 $this->_fp = @fopen($this->_nomf, $add.'b'); 329 330 return ($this->_fp ? true : false); 331 } 332 333 function _CompTar() 334 { 335 if($this->_nomf === ARCHIVE_DYNAMIC || !$this->_fp) return; 336 337 if($this->_comptype == COMPRESS_GZIP) @gzclose($this->_fp); 338 elseif($this->_comptype == COMPRESS_BZIP) @bzclose($this->_fp); 339 else @fclose($this->_fp); 340 } 341 342 function _read($p_len) 343 { 344 if($this->_comptype == COMPRESS_GZIP) 345 return @gzread($this->_fp,$p_len); 346 elseif($this->_comptype == COMPRESS_BZIP) 347 return @bzread($this->_fp,$p_len); 348 else 349 return @fread($this->_fp,$p_len); 350 } 351 352 function _write($p_data) 353 { 354 if($this->_nomf === ARCHIVE_DYNAMIC) $this->_memdat .= $p_data; 355 elseif($this->_comptype == COMPRESS_GZIP) 356 return @gzwrite($this->_fp,$p_data); 357 358 elseif($this->_comptype == COMPRESS_BZIP) 359 return @bzwrite($this->_fp,$p_data); 360 361 else 362 return @fwrite($this->_fp,$p_data); 363 } 364 365 function _encode($p_dat) 366 { 367 if($this->_comptype == COMPRESS_GZIP) 368 return gzencode($p_dat, $this->_compzlevel); 369 elseif($this->_comptype == COMPRESS_BZIP) 370 return bzcompress($p_dat, $this->_compzlevel); 371 else return $p_dat; 372 } 373 374 function _readHeader($p_dat) 375 { 376 if (!$p_dat || strlen($p_dat) != 512) return false; 377 378 for ($i=0, $chks=0; $i<148; $i++) 379 $chks += ord($p_dat[$i]); 380 381 for ($i=156,$chks+=256; $i<512; $i++) 382 $chks += ord($p_dat[$i]); 383 384 $headers = @unpack("a100filename/a8mode/a8uid/a8gid/a12size/a12mtime/a8checksum/a1typeflag/a100link/a6magic/a2version/a32uname/a32gname/a8devmajor/a8devminor", $p_dat); 385 if(!$headers) return false; 386 387 $return['checksum'] = OctDec(trim($headers['checksum'])); 388 if ($return['checksum'] != $chks) return false; 389 390 $return['filename'] = trim($headers['filename']); 391 $return['mode'] = OctDec(trim($headers['mode'])); 392 $return['uid'] = OctDec(trim($headers['uid'])); 393 $return['gid'] = OctDec(trim($headers['gid'])); 394 $return['size'] = OctDec(trim($headers['size'])); 395 $return['mtime'] = OctDec(trim($headers['mtime'])); 396 $return['typeflag'] = $headers['typeflag']; 397 $return['link'] = trim($headers['link']); 398 $return['uname'] = trim($headers['uname']); 399 $return['gname'] = trim($headers['gname']); 400 401 return $return; 402 } 403 404 function _fetchFilelist($p_filelist) 405 { 406 if(!$p_filelist || (is_array($p_filelist) && !@count($p_filelist))) return false; 407 408 if(is_string($p_filelist)) 409 { 410 $p_filelist = explode('|',$p_filelist); 411 if(!is_array($p_filelist)) $p_filelist = Array($p_filelist); 412 } 413 414 return $p_filelist; 415 } 416 417 function _addFileList($p_fl, $p_addir, $p_remdir) 418 { 419 foreach($p_fl as $file) 420 { 421 if(($file == $this->_nomf && $this->_nomf != ARCHIVE_DYNAMIC) || !$file || (!file_exists($file) && !is_array($file))) 422 continue; 423 424 if (!$this->_addFile($file, $p_addir, $p_remdir)) 425 continue; 426 427 if (@is_dir($file)) 428 { 429 $d = @opendir($file); 430 431 if(!$d) continue; 432 readdir($d); readdir($d); 433 434 while($f = readdir($d)) 435 { 436 if($file != ".") $tmplist[0] = "$file/$f"; 437 else $tmplist[0] = $d; 438 439 $this->_addFileList($tmplist, $p_addir, $p_remdir); 440 } 441 442 closedir($d); unset($tmplist,$f); 443 } 444 } 445 return true; 446 } 447 448 function _addFile($p_fn, $p_addir = '', $p_remdir = '') 449 { 450 if(is_array($p_fn)) list($p_fn, $data) = $p_fn; 451 $sname = $p_fn; 452 453 if($p_remdir) 454 { 455 if(substr($p_remdir,-1) != '/') $p_remdir .= "/"; 456 457 if(substr($sname, 0, strlen($p_remdir)) == $p_remdir) 458 $sname = substr($sname, strlen($p_remdir)); 459 } 460 461 if($p_addir) $sname = $p_addir.(substr($p_addir,-1) == '/' ? '' : "/").$sname; 462 463 if(strlen($sname) > 99) return; 464 465 if(@is_dir($p_fn)) 466 { 467 if(!$this->_writeFileHeader($p_fn, $sname)) return false; 468 } 469 else 470 { 471 if(!$data) 472 { 473 $fp = fopen($p_fn, 'rb'); 474 if(!$fp) return false; 475 } 476 477 if(!$this->_writeFileHeader($p_fn, $sname, ($data ? strlen($data) : FALSE))) return false; 478 479 if(!$data) 480 { 481 while(!feof($fp)) 482 { 483 $packed = pack("a512", fread($fp,512)); 484 $this->_write($packed); 485 } 486 fclose($fp); 487 } 488 else 489 { 490 for($s = 0; $s < strlen($data); $s += 512) 491 $this->_write(pack("a512",substr($data,$s,512))); 492 } 493 } 494 495 return true; 496 } 497 498 function _writeFileHeader($p_file, $p_sname, $p_data=false) 499 { 500 if(!$p_data) 501 { 502 if (!$p_sname) $p_sname = $p_file; 503 $p_sname = $this->_pathTrans($p_sname); 504 505 $h_info = stat($p_file); 506 $h[0] = sprintf("%6s ", DecOct($h_info[4])); 507 $h[] = sprintf("%6s ", DecOct($h_info[5])); 508 $h[] = sprintf("%6s ", DecOct(fileperms($p_file))); 509 clearstatcache(); 510 $h[] = sprintf("%11s ", DecOct(filesize($p_file))); 511 $h[] = sprintf("%11s", DecOct(filemtime($p_file))); 512 513 $dir = @is_dir($p_file) ? '5' : ''; 514 } 515 else 516 { 517 $dir = ''; 518 $p_data = sprintf("%11s ", DecOct($p_data)); 519 $time = sprintf("%11s ", DecOct(time())); 520 $h = Array(" 0 "," 0 "," 40777 ",$p_data,$time); 521 } 522 523 $data_first = pack("a100a8a8a8a12A12", $p_sname, $h[2], $h[0], $h[1], $h[3], $h[4]); 524 $data_last = pack("a1a100a6a2a32a32a8a8a155a12", $dir, '', '', '', '', '', '', '', '', ""); 525 526 for ($i=0,$chks=0; $i<148; $i++) 527 $chks += ord($data_first[$i]); 528 529 for ($i=156, $chks+=256, $j=0; $i<512; $i++, $j++) 530 $chks += ord($data_last[$j]); 531 532 $this->_write($data_first); 533 534 $chks = pack("a8",sprintf("%6s ", DecOct($chks))); 535 $this->_write($chks.$data_last); 536 537 return true; 538 } 539 540 function _append($p_filelist, $p_addir="", $p_remdir="") 541 { 542 if(!$this->_fp) if(!$this->_OpenWrite('a')) return -6; 543 544 if($this->_nomf == ARCHIVE_DYNAMIC) 545 { 546 $s = strlen($this->_memdat); 547 $this->_memdat = substr($this->_memdat,0,-512); 548 } 549 else 550 { 551 $s = filesize($this->_nomf); 552 $this->_seek($s-512); 553 } 554 555 $ok = $this->_addFileList($p_filelist, $p_addir, $p_remdir); 556 $this->_writeFooter(); 557 558 return $ok; 559 } 560 561 function _pathTrans($p_dir) 562 { 563 if ($p_dir) 564 { 565 $subf = explode("/", $p_dir); $r=''; 566 567 for ($i=count($subf)-1; $i>=0; $i--) 568 { 569 if ($subf[$i] == ".") {} 570 else if ($subf[$i] == "..") $i--; 571 else if (!$subf[$i] && $i!=count($subf)-1 && $i) {} 572 else $r = $subf[$i].($i!=(count($subf)-1) ? "/".$r : ""); 573 } 574 } 575 return $r; 576 } 577 578 function _writeFooter() 579 { 580 $this->_write(pack("a512", "")); 581 } 582 583 function _extractList($p_to, $p_files, $p_remdir, $p_mode = 0755) 584 { 585 if (!$p_to || ($p_to[0]!="/"&&substr($p_to,0,3)!="../"&&substr($p_to,1,3)!=":\\")) /*" // <- PHP Coder bug */ 586 $p_to = "./$p_to"; 587 588 if ($p_remdir && substr($p_remdir,-1)!='/') $p_remdir .= '/'; 589 $p_remdirs = strlen($p_remdir); 590 while($dat = $this->_read(512)) 591 { 592 $headers = $this->_readHeader($dat); 593 if(!$headers['filename']) continue; 594 595 if($p_files == -1 || $p_files[0] == -1) $extract = true; 596 else 597 { 598 $extract = false; 599 600 foreach($p_files as $f) 601 { 602 if(substr($f,-1) == "/") { 603 if((strlen($headers['filename']) > strlen($f)) && (substr($headers['filename'],0,strlen($f))==$f)) { 604 $extract = true; break; 605 } 606 } 607 elseif($f == $headers['filename']) { 608 $extract = true; break; 609 } 610 } 611 } 612 613 if ($extract) 614 { 615 $det[] = $headers; 616 if ($p_remdir && substr($headers['filename'],0,$p_remdirs)==$p_remdir) 617 $headers['filename'] = substr($headers['filename'],$p_remdirs); 618 619 if($headers['filename'].'/' == $p_remdir && $headers['typeflag']=='5') continue; 620 621 if ($p_to != "./" && $p_to != "/") 622 { 623 while($p_to{-1}=="/") $p_to = substr($p_to,0,-1); 624 625 if($headers['filename']{0} == "/") 626 $headers['filename'] = $p_to.$headers['filename']; 627 else 628 $headers['filename'] = $p_to."/".$headers['filename']; 629 } 630 631 $ok = $this->_dirApp($headers['typeflag']=="5" ? $headers['filename'] : dirname($headers['filename'])); 632 if($ok < 0) return $ok; 633 634 if (!$headers['typeflag']) 635 { 636 if (!$fp = @fopen($headers['filename'], "wb")) return -6; 637 $n = floor($headers['size']/512); 638 639 for ($i=0; $i<$n; $i++) fwrite($fp, $this->_read(512),512); 640 if (($headers['size'] % 512) != 0) fwrite($fp, $this->_read(512), $headers['size'] % 512); 641 642 fclose($fp); 643 touch($headers['filename'], $headers['mtime']); 644 chmod($headers['filename'], $p_mode); 645 } 646 else 647 { 648 $this->_seek(ceil($headers['size']/512)*512,1); 649 } 650 }else $this->_seek(ceil($headers['size']/512)*512,1); 651 } 652 return $det; 653 } 654 655 function _dirApp($d) 656 { 657 // map to dokuwiki function (its more robust) 658 return ap_mkdir($d); 659 /* 660 $d = explode('/', $d); 661 $base = ''; 662 663 foreach($d as $f) 664 { 665 if(!is_dir($base.$f)) 666 { 667 $ok = @mkdir($base.$f, 0777); 668 if(!$ok) return false; 669 } 670 $base .= "$f/"; 671 } 672 */ 673 } 674 675 } 676
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Tue Apr 3 20:47:31 2007 | par Balluche grâce à PHPXref 0.7 |