cvs: pear /File_Archive Archive.php /File_Archive/Archive Reader.php Writer.php /File_Archive/Archive/Predicate And.php MIME.php Or.php
/File_Archive/Archive/Reader ChangeName.php Concat.php Directory.php Filter.php Gzip.php MimeList.php Multi.php Tar.php Uncompress.php Zip.php
/File_Archive/Archive/Writer Archive.php Mail.php MemoryArchive.php Tar.php /File_Archive/tests test.php
| From: | Vincent Lascaux | Date: | Tue, 22 Feb 2005 17:00:05 +0000 |
| Subject: | cvs: pear /File_Archive Archive.php /File_Archive/Archive Reader.php Writer.php /File_Archive/Archive/Predicate And.php MIME.php Or.php /File_Archive/Archive/Reader ChangeName.php Concat.php Directory.php Filter.php Gzip.php MimeList.php Multi.php Tar.php Uncompress.php Zip.php /File_Archive/Archive/Writer Archive.php Mail.php MemoryArchive.php Tar.php /File_Archive/tests test.php |
||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-29680@lists.php.net to get a copy of this message | ||
vincentlascaux Tue Feb 22 12:00:05 2005 EDT
Modified files:
/pear/File_Archive Archive.php
/pear/File_Archive/Archive/Predicate And.php MIME.php Or.php
/pear/File_Archive/Archive Reader.php Writer.php
/pear/File_Archive/Archive/Reader ChangeName.php Concat.php
Directory.php Filter.php Gzip.php
MimeList.php Multi.php Tar.php
Uncompress.php Zip.php
/pear/File_Archive/Archive/Writer Archive.php Mail.php
MemoryArchive.php Tar.php
/pear/File_Archive/tests test.php
Log:
Coding standards
http://cvs.php.net/diff.php/pear/File_Archive/Archive.php?r1=1.16&r2=1.17&ty=u Index: pear/File_Archive/Archive.php diff -u pear/File_Archive/Archive.php:1.16 pear/File_Archive/Archive.php:1.17 --- pear/File_Archive/Archive.php:1.16 Mon Feb 21 17:59:51 2005 +++ pear/File_Archive/Archive.php Tue Feb 22 12:00:04 2005 @@ -26,7 +26,7 @@ * @author Vincent Lascaux <vincentlascaux@php.net> * @copyright 1997-2005 The PHP Group * @license http://www.gnu.org/copyleft/lesser.html LGPL - * @version CVS: $Id: Archive.php,v 1.16 2005/02/21 22:59:51 vincentlascaux Exp $ + * @version CVS: $Id: Archive.php,v 1.17 2005/02/22 17:00:04 vincentlascaux Exp $ * @link http://pear.php.net/package/File_Archive */ @@ -203,8 +203,7 @@ $realPath = isset($parsedURL['path']) ? $parsedURL['path'] : ''; $pos = 0; - do - { + do { if($pos == strlen($realPath)) { return new File_Archive_Reader_File($std, $realSymbolic); } @@ -303,8 +302,7 @@ { require_once "File/Archive/Reader/Multi.php"; $result = new File_Archive_Reader_Multi(); - foreach($sources as $index => $foo) - { + foreach($sources as $index => $foo) { if(is_string($sources[index])) { $result->addSource(File_Archive::read($sources[index])); } else { @@ -366,8 +364,9 @@ require_once "File/Archive/Predicate/Or.php"; $pred = new File_Archive_Predicate_Or(); $args = func_get_args(); - foreach($args as $p) + foreach($args as $p) { $pred->addPredicate($p); + } return $pred; } /** @@ -506,8 +505,7 @@ if($type == "Gz") { $type = "Gzip"; } - switch($type) - { + switch($type) { case "Tgz": require_once "File/Archive/Writer/Tar.php"; require_once "File/Archive/Writer/Gzip.php"; http://cvs.php.net/diff.php/pear/File_Archive/Archive/Predicate/And.php?r1=1.4&r2=1.5&ty=u Index: pear/File_Archive/Archive/Predicate/And.php diff -u pear/File_Archive/Archive/Predicate/And.php:1.4 pear/File_Archive/Archive/Predicate/And.php:1.5 --- pear/File_Archive/Archive/Predicate/And.php:1.4 Fri Feb 18 16:00:49 2005 +++ pear/File_Archive/Archive/Predicate/And.php Tue Feb 22 12:00:04 2005 @@ -25,7 +25,7 @@ * @author Vincent Lascaux <vincentlascaux@php.net> * @copyright 1997-2005 The PHP Group * @license http://www.gnu.org/copyleft/lesser.html LGPL - * @version CVS: $Id: And.php,v 1.4 2005/02/18 21:00:49 vincentlascaux Exp $ + * @version CVS: $Id: And.php,v 1.5 2005/02/22 17:00:04 vincentlascaux Exp $ * @link http://pear.php.net/package/File_Archive */ @@ -72,8 +72,7 @@ */ function isTrue(&$source) { - foreach($this->preds as $p) - { + foreach($this->preds as $p) { if(!$p->isTrue($source)) { return false; } http://cvs.php.net/diff.php/pear/File_Archive/Archive/Predicate/MIME.php?r1=1.2&r2=1.3&ty=u Index: pear/File_Archive/Archive/Predicate/MIME.php diff -u pear/File_Archive/Archive/Predicate/MIME.php:1.2 pear/File_Archive/Archive/Predicate/MIME.php:1.3 --- pear/File_Archive/Archive/Predicate/MIME.php:1.2 Mon Feb 21 17:59:52 2005 +++ pear/File_Archive/Archive/Predicate/MIME.php Tue Feb 22 12:00:04 2005 @@ -25,7 +25,7 @@ * @author Vincent Lascaux <vincentlascaux@php.net> * @copyright 1997-2005 The PHP Group * @license http://www.gnu.org/copyleft/lesser.html LGPL - * @version CVS: $Id: MIME.php,v 1.2 2005/02/21 22:59:52 vincentlascaux Exp $ + * @version CVS: $Id: MIME.php,v 1.3 2005/02/22 17:00:04 vincentlascaux Exp $ * @link http://pear.php.net/package/File_Archive */ @@ -58,8 +58,7 @@ function isTrue(&$source) { $sourceMIME = $source->getMIME(); - foreach($this->mimes as $mime) - { + foreach($this->mimes as $mime) { if(MIME_Type::isWildcard($mime)) { $result = MIME_Type::wildcardMatch($mime, $sourceMIME); } else { http://cvs.php.net/diff.php/pear/File_Archive/Archive/Predicate/Or.php?r1=1.4&r2=1.5&ty=u Index: pear/File_Archive/Archive/Predicate/Or.php diff -u pear/File_Archive/Archive/Predicate/Or.php:1.4 pear/File_Archive/Archive/Predicate/Or.php:1.5 --- pear/File_Archive/Archive/Predicate/Or.php:1.4 Fri Feb 18 16:00:49 2005 +++ pear/File_Archive/Archive/Predicate/Or.php Tue Feb 22 12:00:04 2005 @@ -26,7 +26,7 @@ * @author Vincent Lascaux <vincentlascaux@php.net> * @copyright 1997-2005 The PHP Group * @license http://www.gnu.org/copyleft/lesser.html LGPL - * @version CVS: $Id: Or.php,v 1.4 2005/02/18 21:00:49 vincentlascaux Exp $ + * @version CVS: $Id: Or.php,v 1.5 2005/02/22 17:00:04 vincentlascaux Exp $ * @link http://pear.php.net/package/File_Archive */ @@ -72,8 +72,7 @@ */ function isTrue(&$source) { - foreach($this->preds as $p) - { + foreach($this->preds as $p) { if($p->isTrue($source)) { return true; } http://cvs.php.net/diff.php/pear/File_Archive/Archive/Reader.php?r1=1.5&r2=1.6&ty=u Index: pear/File_Archive/Archive/Reader.php diff -u pear/File_Archive/Archive/Reader.php:1.5 pear/File_Archive/Archive/Reader.php:1.6 --- pear/File_Archive/Archive/Reader.php:1.5 Sat Feb 19 19:02:27 2005 +++ pear/File_Archive/Archive/Reader.php Tue Feb 22 12:00:04 2005 @@ -27,7 +27,7 @@ * @author Vincent Lascaux <vincentlascaux@php.net> * @copyright 1997-2005 The PHP Group * @license http://www.gnu.org/copyleft/lesser.html LGPL - * @version CVS: $Id: Reader.php,v 1.5 2005/02/20 00:02:27 vincentlascaux Exp $ + * @version CVS: $Id: Reader.php,v 1.6 2005/02/22 17:00:04 vincentlascaux Exp $ * @link http://pear.php.net/package/File_Archive */ @@ -62,8 +62,7 @@ //TODO: not very efficient: close and re open the archive to start from the begining $this->close(); - while($this->next()) - { + while($this->next()) { if($this->getFilename() == $std) return true; } @@ -80,10 +79,11 @@ $std = str_replace("\\", "/", $path); while($std != ($std = preg_replace("/[^\/:?]+\/\.\.\//", "", $std))) ; $std = str_replace("/./", "", $std); - if(strncmp($std, "./", 2) == 0) + if(strncmp($std, "./", 2) == 0) { return substr($std, 2); - else + } else { return $std; + } } /** @@ -156,9 +156,9 @@ function sendData(&$writer, $bufferSize = 102400) { $filename = $this->getDataFilename(); - if($filename !== NULL) + if($filename !== NULL) { $writer->writeFile($filename); - else { + } else { while(($data = $this->getData($bufferSize)) !== null) $writer->writeData($data); } @@ -171,8 +171,7 @@ */ function extract(&$writer, $autoClose = true, $bufferSize = 102400) //Default 100ko buffer { - while(($error = $this->next()) === true) - { + while(($error = $this->next()) === true) { $filename = $this->getFilename(); $stat = $this->getStat(); http://cvs.php.net/diff.php/pear/File_Archive/Archive/Writer.php?r1=1.4&r2=1.5&ty=u Index: pear/File_Archive/Archive/Writer.php diff -u pear/File_Archive/Archive/Writer.php:1.4 pear/File_Archive/Archive/Writer.php:1.5 --- pear/File_Archive/Archive/Writer.php:1.4 Sat Feb 19 19:02:27 2005 +++ pear/File_Archive/Archive/Writer.php Tue Feb 22 12:00:04 2005 @@ -25,7 +25,7 @@ * @author Vincent Lascaux <vincentlascaux@php.net> * @copyright 1997-2005 The PHP Group * @license http://www.gnu.org/copyleft/lesser.html LGPL - * @version CVS: $Id: Writer.php,v 1.4 2005/02/20 00:02:27 vincentlascaux Exp $ + * @version CVS: $Id: Writer.php,v 1.5 2005/02/22 17:00:04 vincentlascaux Exp $ * @link http://pear.php.net/package/File_Archive */ @@ -66,8 +66,7 @@ function writeFile($filename) { $handle = fopen($filename, "r"); - while(!feof($handle)) - { + while(!feof($handle)) { $this->writeData(fread($handle, 102400)); } fclose($handle); http://cvs.php.net/diff.php/pear/File_Archive/Archive/Reader/ChangeName.php?r1=1.5&r2=1.6&ty=u Index: pear/File_Archive/Archive/Reader/ChangeName.php diff -u pear/File_Archive/Archive/Reader/ChangeName.php:1.5 pear/File_Archive/Archive/Reader/ChangeName.php:1.6 --- pear/File_Archive/Archive/Reader/ChangeName.php:1.5 Sat Feb 19 15:29:33 2005 +++ pear/File_Archive/Archive/Reader/ChangeName.php Tue Feb 22 12:00:05 2005 @@ -25,7 +25,7 @@ * @author Vincent Lascaux <vincentlascaux@php.net> * @copyright 1997-2005 The PHP Group * @license http://www.gnu.org/copyleft/lesser.html LGPL - * @version CVS: $Id: ChangeName.php,v 1.5 2005/02/19 20:29:33 vincentlascaux Exp $ + * @version CVS: $Id: ChangeName.php,v 1.6 2005/02/22 17:00:05 vincentlascaux Exp $ * @link http://pear.php.net/package/File_Archive */ @@ -83,12 +83,14 @@ { parent::File_Archive_Reader_Relay($source); $this->oldBaseName = $this->getStandardURL($oldBaseName); - if(substr($this->oldBaseName, -1)=='/') + if(substr($this->oldBaseName, -1)=='/') { $this->oldBaseName = substr($this->oldBaseName, 0, strlen($this->oldBaseName)-1); + } $this->newBaseName = $this->getStandardURL($newBaseName); - if(substr($this->newBaseName, -1)=='/') + if(substr($this->newBaseName, -1)=='/') { $this->newBaseName = substr($this->newBaseName, 0, strlen($this->newBaseName)-1); + } } /** @@ -99,10 +101,9 @@ $name = parent::getFilename(); if(empty($this->oldBaseName) || strncmp($name, $this->oldBaseName.'/', strlen($this->oldBaseName)+1)==0) { - $result = $this->newBaseName. + return $this->newBaseName. (empty($this->newBaseName) || strlen($name)<=strlen($this->oldBaseName)+1?'':'/'). substr($name, strlen($this->oldBaseName)+1); - return $result; } else { return $name; } http://cvs.php.net/diff.php/pear/File_Archive/Archive/Reader/Concat.php?r1=1.1&r2=1.2&ty=u Index: pear/File_Archive/Archive/Reader/Concat.php diff -u pear/File_Archive/Archive/Reader/Concat.php:1.1 pear/File_Archive/Archive/Reader/Concat.php:1.2 --- pear/File_Archive/Archive/Reader/Concat.php:1.1 Sat Feb 19 19:34:08 2005 +++ pear/File_Archive/Archive/Reader/Concat.php Tue Feb 22 12:00:05 2005 @@ -25,7 +25,7 @@ * @author Vincent Lascaux <vincentlascaux@php.net> * @copyright 1997-2005 The PHP Group * @license http://www.gnu.org/copyleft/lesser.html LGPL - * @version CVS: $Id: Concat.php,v 1.1 2005/02/20 00:34:08 vincentlascaux Exp $ + * @version CVS: $Id: Concat.php,v 1.2 2005/02/22 17:00:05 vincentlascaux Exp $ * @link http://pear.php.net/package/File_Archive */ @@ -52,8 +52,7 @@ //Compute the total length $this->stat[7] = 0; - while($source->next()) - { + while($source->next()) { $sourceStat = $source->getStat(); $this->stat[7] += $sourceStat[7]; } @@ -95,8 +94,7 @@ } $result = ''; - while($length == -1 || strlen($result)<$length) - { + while($length == -1 || strlen($result)<$length) { $sourceData = $this->source->getData($length==-1 ? -1 : $length - strlen($result)); if(PEAR::isError($sourceData)) { @@ -123,8 +121,7 @@ function skip($length) { $skipped = 0; - while($skipped < $length) - { + while($skipped < $length) { $sourceSkipped = $this->source->skip($length); if(PEAR::isError($sourceSkipped)) { return $skipped; http://cvs.php.net/diff.php/pear/File_Archive/Archive/Reader/Directory.php?r1=1.4&r2=1.5&ty=u Index: pear/File_Archive/Archive/Reader/Directory.php diff -u pear/File_Archive/Archive/Reader/Directory.php:1.4 pear/File_Archive/Archive/Reader/Directory.php:1.5 --- pear/File_Archive/Archive/Reader/Directory.php:1.4 Fri Feb 18 16:00:49 2005 +++ pear/File_Archive/Archive/Reader/Directory.php Tue Feb 22 12:00:05 2005 @@ -25,7 +25,7 @@ * @author Vincent Lascaux <vincentlascaux@php.net> * @copyright 1997-2005 The PHP Group * @license http://www.gnu.org/copyleft/lesser.html LGPL - * @version CVS: $Id: Directory.php,v 1.4 2005/02/18 21:00:49 vincentlascaux Exp $ + * @version CVS: $Id: Directory.php,v 1.5 2005/02/22 17:00:05 vincentlascaux Exp $ * @link http://pear.php.net/package/File_Archive */ @@ -87,8 +87,7 @@ $this->directoryHandle = opendir($this->directory); while($this->source == null || - !$this->source->next()) - { + !$this->source->next()) { $file = readdir($this->directoryHandle); if($file == '.' || $file == '..') { continue; http://cvs.php.net/diff.php/pear/File_Archive/Archive/Reader/Filter.php?r1=1.5&r2=1.6&ty=u Index: pear/File_Archive/Archive/Reader/Filter.php diff -u pear/File_Archive/Archive/Reader/Filter.php:1.5 pear/File_Archive/Archive/Reader/Filter.php:1.6 --- pear/File_Archive/Archive/Reader/Filter.php:1.5 Fri Feb 18 19:58:42 2005 +++ pear/File_Archive/Archive/Reader/Filter.php Tue Feb 22 12:00:05 2005 @@ -25,7 +25,7 @@ * @author Vincent Lascaux <vincentlascaux@php.net> * @copyright 1997-2005 The PHP Group * @license http://www.gnu.org/copyleft/lesser.html LGPL - * @version CVS: $Id: Filter.php,v 1.5 2005/02/19 00:58:42 vincentlascaux Exp $ + * @version CVS: $Id: Filter.php,v 1.6 2005/02/22 17:00:05 vincentlascaux Exp $ * @link http://pear.php.net/package/File_Archive */ @@ -56,8 +56,7 @@ */ function next() { - do - { + do { $error = $this->source->next(); if($error !== true) { return $error; http://cvs.php.net/diff.php/pear/File_Archive/Archive/Reader/Gzip.php?r1=1.3&r2=1.4&ty=u Index: pear/File_Archive/Archive/Reader/Gzip.php diff -u pear/File_Archive/Archive/Reader/Gzip.php:1.3 pear/File_Archive/Archive/Reader/Gzip.php:1.4 --- pear/File_Archive/Archive/Reader/Gzip.php:1.3 Fri Feb 18 16:00:49 2005 +++ pear/File_Archive/Archive/Reader/Gzip.php Tue Feb 22 12:00:05 2005 @@ -25,7 +25,7 @@ * @author Vincent Lascaux <vincentlascaux@php.net> * @copyright 1997-2005 The PHP Group * @license http://www.gnu.org/copyleft/lesser.html LGPL - * @version CVS: $Id: Gzip.php,v 1.3 2005/02/18 21:00:49 vincentlascaux Exp $ + * @version CVS: $Id: Gzip.php,v 1.4 2005/02/22 17:00:05 vincentlascaux Exp $ * @link http://pear.php.net/package/File_Archive */ @@ -65,38 +65,38 @@ return false; } - if($this->alreadyRead) - return FALSE; + if($this->alreadyRead) { + return false; + } $this->alreadyRead = true; $header = $this->source->getData(10); $id = unpack("H2id1/H2id2/C1tmp/C1flags",substr($header,0,4)); - if($id['id1'] != "1f" || $id['id2'] != "8b") - die("Not valid gz file (wrong header)"); + if($id['id1'] != "1f" || $id['id2'] != "8b") { + return PEAR::raiseError("Not valid gz file (wrong header)"); + } $temp = decbin($id['flags']); $this->hasName = ($temp & 0x8); $this->hasComment = ($temp & 0x4); $this->name = ""; - if($this->hasName) - { - while(($char = $this->source->getData(1)) !== "\0") - { - if($char === NULL) - die("Not valid gz file (unexpected end of archive reading filename)"); + if($this->hasName) { + while(($char = $this->source->getData(1)) !== "\0") { + if($char === null) { + return PEAR::raiseError("Not valid gz file (unexpected end of archive reading filename)"); + } $this->name .= $char; } $this->name = $this->getStandardURL($this->name); } $this->comment = ""; - if($this->hasComment) - { - while(($char = $this->source->getData(1)) !== "\0") - { - if($char === NULL) - die("Not valid gz file (unexpected end of archive reading comment)"); + if($this->hasComment) { + while(($char = $this->source->getData(1)) !== "\0") { + if($char === null) { + return PEAR::raiseError("Not valid gz file (unexpected end of archive reading comment)"); + } $this->comment .= $char; } } @@ -110,11 +110,12 @@ $this->data = gzinflate(substr($this->data,0,strlen($this->data)-8)); $this->offset = 0; - if($size != strlen($this->data)) - die("Not valid gz file (size error {$size} != ".strlen($this->data).")"); - if($crc32 != crc32 ($this->data)) - die("Not valid gz file (checksum error)"); - + if($size != strlen($this->data)) { + return PEAR::raiseError(("Not valid gz file (size error {$size} != ".strlen($this->data).")"); + } + if($crc32 != crc32 ($this->data)) { + return PEAR::raiseError(("Not valid gz file (checksum error)"); + } return TRUE; } /** @@ -138,14 +139,15 @@ */ function getData($length = -1) { - if($length == -1) + if($length == -1) { $actualLength = strlen($this->data) - $this->offset; - else + } else { $actualLength = min(strlen($this->data) - $this->offset, $length); + } - if($actualLength == 0) - return NULL; - else { + if($actualLength == 0) { + return null; + } else { $result = substr($this->data, $this->offset, $actualLength); $this->offset += $actualLength; return $result; http://cvs.php.net/diff.php/pear/File_Archive/Archive/Reader/MimeList.php?r1=1.5&r2=1.6&ty=u Index: pear/File_Archive/Archive/Reader/MimeList.php diff -u pear/File_Archive/Archive/Reader/MimeList.php:1.5 pear/File_Archive/Archive/Reader/MimeList.php:1.6 --- pear/File_Archive/Archive/Reader/MimeList.php:1.5 Mon Feb 21 19:32:05 2005 +++ pear/File_Archive/Archive/Reader/MimeList.php Tue Feb 22 12:00:05 2005 @@ -25,7 +25,7 @@ * @author Vincent Lascaux <vincentlascaux@php.net> * @copyright 1997-2005 The PHP Group * @license http://www.gnu.org/copyleft/lesser.html LGPL - * @version CVS: $Id: MimeList.php,v 1.5 2005/02/22 00:32:05 vincentlascaux Exp $ + * @version CVS: $Id: MimeList.php,v 1.6 2005/02/22 17:00:05 vincentlascaux Exp $ * @link http://pear.php.net/package/File_Archive */ @@ -37,458 +37,903 @@ { $pos = strrpos($filename, '.'); $extension = ""; - if($pos !== FALSE) { + if($pos !== false) { $extension = strtolower(substr($filename, $pos+1)); } - switch($extension) - { - case '3dmf': return 'x-world/x-3dmf'; - case 'a': return 'application/octet-stream'; - case 'aab': return 'application/x-authorware-bin'; - case 'aam': return 'application/x-authorware-map'; - case 'aas': return 'application/x-authorware-seg'; - case 'abc': return 'text/vnd.abc'; - case 'acgi': return 'text/html'; - case 'afl': return 'video/animaflex'; - case 'ai': return 'application/postscript'; - case 'aif': return 'audio/aiff'; - case 'aifc': return 'audio/aiff'; - case 'aiff': return 'audio/aiff'; - case 'aim': return 'application/x-aim'; - case 'aip': return 'text/x-audiosoft-intra'; - case 'ani': return 'application/x-navi-animation'; - case 'aos': return 'application/x-nokia-9000-communicator-add-on-software'; - case 'aps': return 'application/mime'; - case 'arc': return 'application/octet-stream'; - case 'arj': return 'application/arj'; - case 'art': return 'image/x-jg'; - case 'asf': return 'video/x-ms-asf'; - case 'asm': return 'text/x-asm'; - case 'asp': return 'text/asp'; - case 'asx': return 'application/x-mplayer2'; - case 'au': return 'audio/basic'; - case 'avi': return 'application/x-troff-msvideo'; - case 'avs': return 'video/avs-video'; - case 'bcpio': return 'application/x-bcpio'; - case 'bin': return 'application/x-binary'; - case 'bm': return 'image/bmp'; - case 'bmp': return 'image/bmp'; - case 'boo': return 'application/book'; - case 'book': return 'application/book'; - case 'boz': return 'application/x-bzip2'; - case 'bsh': return 'application/x-bsh'; - case 'bz': return 'application/x-bzip'; - case 'bz2': return 'application/x-bzip2'; - case 'c': return 'text/plain'; - case 'c++': return 'text/plain'; - case 'cat': return 'application/vnd.ms-pki.seccat'; - case 'cc': return 'text/plain'; - case 'ccad': return 'application/clariscad'; - case 'cco': return 'application/x-cocoa'; - case 'cdf': return 'application/cdf'; - case 'cer': return 'application/pkix-cert'; - case 'cha': return 'application/x-chat'; - case 'chat': return 'application/x-chat'; - case 'class': return 'application/java'; - case 'com': return 'application/octet-stream'; - case 'conf': return 'text/plain'; - case 'cpio': return 'application/x-cpio'; - case 'cpp': return 'text/x-c'; - case 'cpt': return 'application/mac-compactpro'; - case 'crl': return 'application/pkcs-crl'; - case 'csh': return 'application/x-csh'; - case 'css': return 'text/css'; - case 'cxx': return 'text/plain'; - case 'dcr': return 'application/x-director'; - case 'deepv': return 'application/x-deepv'; - case 'def': return 'text/plain'; - case 'der': return 'application/x-x509-ca-cert'; - case 'dif': return 'video/x-dv'; - case 'dir': return 'application/x-director'; - case 'dl': return 'video/dl'; - case 'doc': return 'application/msword'; - case 'dot': return 'application/msword'; - case 'dp': return 'application/commonground'; - case 'drw': return 'application/drafting'; - case 'dump': return 'application/octet-stream'; - case 'dv': return 'video/x-dv'; - case 'dvi': return 'application/x-dvi'; - case 'dwf': return 'drawing/x-dwf (old)'; - case 'dwg': return 'application/acad'; - case 'dxf': return 'application/dxf'; - case 'dxr': return 'application/x-director'; - case 'el': return 'text/x-script.elisp'; - case 'elc': return 'application/x-bytecode.elisp (compiled elisp)'; - case 'env': return 'application/x-envoy'; - case 'eps': return 'application/postscript'; - case 'es': return 'application/x-esrehber'; - case 'etx': return 'text/x-setext'; - case 'evy': return 'application/envoy'; - case 'exe': return 'application/octet-stream'; - case 'f': return 'text/plain'; - case 'f77': return 'text/x-fortran'; - case 'f90': return 'text/plain'; - case 'fdf': return 'application/vnd.fdf'; - case 'fif': return 'application/fractals'; - case 'fli': return 'video/fli'; - case 'flo': return 'image/florian'; - case 'flx': return 'text/vnd.fmi.flexstor'; - case 'fmf': return 'video/x-atomic3d-feature'; - case 'for': return 'text/plain'; - case 'fpx': return 'image/vnd.fpx'; - case 'frl': return 'application/freeloader'; - case 'funk': return 'audio/make'; - case 'g': return 'text/plain'; - case 'g3': return 'image/g3fax'; - case 'gif': return 'image/gif'; - case 'gl': return 'video/gl'; - case 'gsd': return 'audio/x-gsm'; - case 'gsm': return 'audio/x-gsm'; - case 'gsp': return 'application/x-gsp'; - case 'gss': return 'application/x-gss'; - case 'gtar': return 'application/x-gtar'; - case 'gz': return 'application/x-compressed'; - case 'gzip': return 'application/x-gzip'; - case 'h': return 'text/plain'; - case 'hdf': return 'application/x-hdf'; - case 'help': return 'application/x-helpfile'; - case 'hgl': return 'application/vnd.hp-hpgl'; - case 'hh': return 'text/plain'; - case 'hlb': return 'text/x-script'; - case 'hlp': return 'application/hlp'; - case 'hpg': return 'application/vnd.hp-hpgl'; - case 'hpgl': return 'application/vnd.hp-hpgl'; - case 'hqx': return 'application/binhex'; - case 'hta': return 'application/hta'; - case 'htc': return 'text/x-component'; - case 'htm': return 'text/html'; - case 'html': return 'text/html'; - case 'htmls': return 'text/html'; - case 'htt': return 'text/webviewhtml'; - case 'htx': return 'text/html'; - case 'ice': return 'x-conference/x-cooltalk'; - case 'ico': return 'image/x-icon'; - case 'idc': return 'text/plain'; - case 'ief': return 'image/ief'; - case 'iefs': return 'image/ief'; - case 'iges': return 'application/iges'; - case 'igs': return 'application/iges'; - case 'ima': return 'application/x-ima'; - case 'imap': return 'application/x-httpd-imap'; - case 'inf': return 'application/inf'; - case 'ins': return 'application/x-internett-signup'; - case 'ip': return 'application/x-ip2'; - case 'isu': return 'video/x-isvideo'; - case 'it': return 'audio/it'; - case 'iv': return 'application/x-inventor'; - case 'ivr': return 'i-world/i-vrml'; - case 'ivy': return 'application/x-livescreen'; - case 'jam': return 'audio/x-jam'; - case 'jav': return 'text/plain'; - case 'java': return 'text/plain'; - case 'jcm': return 'application/x-java-commerce'; - case 'jfif': return 'image/jpeg'; - case 'jfif-tbnl': return 'image/jpeg'; - case 'jpe': return 'image/jpeg'; - case 'jpeg': return 'image/jpeg'; - case 'jpg': return 'image/jpeg'; - case 'jps': return 'image/x-jps'; - case 'js': return 'application/x-javascript'; - case 'jut': return 'image/jutvision'; - case 'kar': return 'audio/midi'; - case 'ksh': return 'application/x-ksh'; - case 'la': return 'audio/nspaudio'; - case 'lam': return 'audio/x-liveaudio'; - case 'latex': return 'application/x-latex'; - case 'lha': return 'application/lha'; - case 'lhx': return 'application/octet-stream'; - case 'list': return 'text/plain'; - case 'lma': return 'audio/nspaudio'; - case 'log': return 'text/plain'; - case 'lsp': return 'application/x-lisp'; - case 'lst': return 'text/plain'; - case 'lsx': return 'text/x-la-asf'; - case 'ltx': return 'application/x-latex'; - case 'lzh': return 'application/octet-stream'; - case 'lzx': return 'application/lzx'; - case 'm': return 'text/plain'; - case 'm1v': return 'video/mpeg'; - case 'm2a': return 'audio/mpeg'; - case 'm2v': return 'video/mpeg'; - case 'm3u': return 'audio/x-mpequrl'; - case 'man': return 'application/x-troff-man'; - case 'map': return 'application/x-navimap'; - case 'mar': return 'text/plain'; - case 'mbd': return 'application/mbedlet'; - case 'mc$': return 'application/x-magic-cap-package-1.0'; - case 'mcd': return 'application/mcad'; - case 'mcf': return 'image/vasa'; - case 'mcp': return 'application/netmc'; - case 'me': return 'application/x-troff-me'; - case 'mht': return 'message/rfc822'; - case 'mhtml': return 'message/rfc822'; - case 'mid': return 'application/x-midi'; - case 'midi': return 'audio/midi'; - case 'mif': return 'application/x-frame'; - case 'mime': return 'message/rfc822'; - case 'mjf': return 'audio/x-vnd.audioexplosion.mjuicemediafile'; - case 'mjpg': return 'video/x-motion-jpeg'; - case 'mm': return 'application/base64'; - case 'mme': return 'application/base64'; - case 'mod': return 'audio/mod'; - case 'moov': return 'video/quicktime'; - case 'mov': return 'video/quicktime'; - case 'movie': return 'video/x-sgi-movie'; - case 'mp2': return 'video/mpeg'; - case 'mp3': return 'video/mpeg'; - case 'mpa': return 'audio/mpeg'; - case 'mpc': return 'application/x-project'; - case 'mpe': return 'video/mpeg'; - case 'mpeg': return 'video/mpeg'; - case 'mpg': return 'video/mpeg'; - case 'mpga': return 'audio/mpeg'; - case 'mpp': return 'application/vnd.ms-project'; - case 'mpt': return 'application/x-project'; - case 'mpv': return 'application/x-project'; - case 'mpx': return 'application/x-project'; - case 'mrc': return 'application/marc'; - case 'ms': return 'application/x-troff-ms'; - case 'mv': return 'video/x-sgi-movie'; - case 'my': return 'audio/make'; - case 'mzz': return 'application/x-vnd.audioexplosion.mzz'; - case 'nap': return 'image/naplps'; - case 'naplps': return 'image/naplps'; - case 'nc': return 'application/x-netcdf'; - case 'ncm': return 'application/vnd.nokia.configuration-message'; - case 'nif': return 'image/x-niff'; - case 'niff': return 'image/x-niff'; - case 'nix': return 'application/x-mix-transfer'; - case 'nsc': return 'application/x-conference'; - case 'nvd': return 'application/x-navidoc'; - case 'o': return 'application/octet-stream'; - case 'oda': return 'application/oda'; - case 'omc': return 'application/x-omc'; - case 'omcd': return 'application/x-omcdatamaker'; - case 'omcr': return 'application/x-omcregerator'; - case 'p': return 'text/x-pascal'; - case 'p10': return 'application/pkcs10'; - case 'p12': return 'application/pkcs-12'; - case 'p7a': return 'application/x-pkcs7-signature'; - case 'p7c': return 'application/pkcs7-mime'; - case 'p7m': return 'application/pkcs7-mime'; - case 'p7r': return 'application/x-pkcs7-certreqresp'; - case 'p7s': return 'application/pkcs7-signature'; - case 'part': return 'application/pro_eng'; - case 'pas': return 'text/pascal'; - case 'pbm': return 'image/x-portable-bitmap'; - case 'pcl': return 'application/vnd.hp-pcl'; - case 'pct': return 'image/x-pict'; - case 'pcx': return 'image/x-pcx'; - case 'pdb': return 'chemical/x-pdb'; - case 'pdf': return 'application/pdf'; - case 'pfunk': return 'audio/make'; - case 'pgm': return 'image/x-portable-graymap'; - case 'pic': return 'image/pict'; - case 'pict': return 'image/pict'; - case 'pkg': return 'application/x-newton-compatible-pkg'; - case 'pko': return 'application/vnd.ms-pki.pko'; - case 'pl': return 'text/plain'; - case 'plx': return 'application/x-pixclscript'; - case 'pm': return 'image/x-xpixmap'; - case 'pm4': return 'application/x-pagemaker'; - case 'pm5': return 'application/x-pagemaker'; - case 'png': return 'image/png'; - case 'pnm': return 'application/x-portable-anymap'; - case 'pot': return 'application/mspowerpoint'; - case 'pov': return 'model/x-pov'; - case 'ppa': return 'application/vnd.ms-powerpoint'; - case 'ppm': return 'image/x-portable-pixmap'; - case 'pps': return 'application/mspowerpoint'; - case 'ppt': return 'application/mspowerpoint'; - case 'ppz': return 'application/mspowerpoint'; - case 'pre': return 'application/x-freelance'; - case 'prt': return 'application/pro_eng'; - case 'ps': return 'application/postscript'; - case 'psd': return 'application/octet-stream'; - case 'pvu': return 'paleovu/x-pv'; - case 'pwz': return 'application/vnd.ms-powerpoint'; - case 'py': return 'text/x-script.phyton'; - case 'pyc': return 'applicaiton/x-bytecode.python'; - case 'qcp': return 'audio/vnd.qcelp'; - case 'qd3': return 'x-world/x-3dmf'; - case 'qd3d': return 'x-world/x-3dmf'; - case 'qif': return 'image/x-quicktime'; - case 'qt': return 'video/quicktime'; - case 'qtc': return 'video/x-qtc'; - case 'qti': return 'image/x-quicktime'; - case 'qtif': return 'image/x-quicktime'; - case 'ra': return 'audio/x-pn-realaudio'; - case 'ram': return 'audio/x-pn-realaudio'; - case 'ras': return 'application/x-cmu-raster'; - case 'rast': return 'image/cmu-raster'; - case 'rexx': return 'text/x-script.rexx'; - case 'rf': return 'image/vnd.rn-realflash'; - case 'rgb': return 'image/x-rgb'; - case 'rm': return 'application/vnd.rn-realmedia'; - case 'rmi': return 'audio/mid'; - case 'rmm': return 'audio/x-pn-realaudio'; - case 'rmp': return 'audio/x-pn-realaudio'; - case 'rng': return 'application/ringing-tones'; - case 'rnx': return 'application/vnd.rn-realplayer'; - case 'roff': return 'application/x-troff'; - case 'rp': return 'image/vnd.rn-realpix'; - case 'rpm': return 'audio/x-pn-realaudio-plugin'; - case 'rt': return 'text/richtext'; - case 'rtf': return 'application/rtf'; - case 'rtx': return 'text/richtext'; - case 'rv': return 'video/vnd.rn-realvideo'; - case 's': return 'text/x-asm'; - case 's3m': return 'audio/s3m'; - case 'saveme': return 'application/octet-stream'; - case 'sbk': return 'application/x-tbook'; - case 'scm': return 'application/x-lotusscreencam'; - case 'sdml': return 'text/plain'; - case 'sdp': return 'application/sdp'; - case 'sdr': return 'application/sounder'; - case 'sea': return 'application/sea'; - case 'set': return 'application/set'; - case 'sgm': return 'text/sgml'; - case 'sgml': return 'text/sgml'; - case 'sh': return 'application/x-bsh'; - case 'shar': return 'application/x-bsh'; - case 'shtml': return 'text/html'; - case 'sid': return 'audio/x-psid'; - case 'sit': return 'application/x-sit'; - case 'skd': return 'application/x-koan'; - case 'skm': return 'application/x-koan'; - case 'skp': return 'application/x-koan'; - case 'skt': return 'application/x-koan'; - case 'sl': return 'application/x-seelogo'; - case 'smi': return 'application/smil'; - case 'smil': return 'application/smil'; - case 'snd': return 'audio/basic'; - case 'sol': return 'application/solids'; - case 'spc': return 'application/x-pkcs7-certificates'; - case 'spl': return 'application/futuresplash'; - case 'spr': return 'application/x-sprite'; - case 'sprite': return 'application/x-sprite'; - case 'src': return 'application/x-wais-source'; - case 'ssi': return 'text/x-server-parsed-html'; - case 'ssm': return 'application/streamingmedia'; - case 'sst': return 'application/vnd.ms-pki.certstore'; - case 'step': return 'application/step'; - case 'stl': return 'application/sla'; - case 'stp': return 'application/step'; - case 'sv4cpio': return 'application/x-sv4cpio'; - case 'sv4crc': return 'application/x-sv4crc'; - case 'svf': return 'image/vnd.dwg'; - case 'svr': return 'application/x-world'; - case 'swf': return 'application/x-shockwave-flash'; - case 't': return 'application/x-troff'; - case 'talk': return 'text/x-speech'; - case 'tar': return 'application/x-tar'; - case 'tbk': return 'application/toolbook'; - case 'tcl': return 'application/x-tcl'; - case 'tcsh': return 'text/x-script.tcsh'; - case 'tex': return 'application/x-tex'; - case 'texi': return 'application/x-texinfo'; - case 'texinfo': return 'application/x-texinfo'; - case 'text': return 'text/plain'; - case 'tgz': return 'application/x-compressed'; - case 'tif': return 'image/tiff'; - case 'tiff': return 'image/tiff'; - case 'tr': return 'application/x-troff'; - case 'tsi': return 'audio/tsp-audio'; - case 'tsp': return 'application/dsptype'; - case 'tsv': return 'text/tab-separated-values'; - case 'turbot': return 'image/florian'; - case 'txt': return 'text/plain'; - case 'uil': return 'text/x-uil'; - case 'uni': return 'text/uri-list'; - case 'unis': return 'text/uri-list'; - case 'unv': return 'application/i-deas'; - case 'uri': return 'text/uri-list'; - case 'uris': return 'text/uri-list'; - case 'ustar': return 'multipart/x-ustar'; - case 'uu': return 'application/octet-stream'; - case 'uue': return 'text/x-uuencode'; - case 'vcd': return 'application/x-cdlink'; - case 'vcs': return 'text/x-vcalendar'; - case 'vda': return 'application/vda'; - case 'vdo': return 'video/vdo'; - case 'vew': return 'application/groupwise'; - case 'viv': return 'video/vivo'; - case 'vivo': return 'video/vivo'; - case 'vmd': return 'application/vocaltec-media-desc'; - case 'vmf': return 'application/vocaltec-media-file'; - case 'voc': return 'audio/voc'; - case 'vos': return 'video/vosaic'; - case 'vox': return 'audio/voxware'; - case 'vqe': return 'audio/x-twinvq-plugin'; - case 'vqf': return 'audio/x-twinvq'; - case 'vql': return 'audio/x-twinvq-plugin'; - case 'vrml': return 'application/x-vrml'; - case 'vrt': return 'x-world/x-vrt'; - case 'vsd': return 'application/x-visio'; - case 'vst': return 'application/x-visio'; - case 'vsw': return 'application/x-visio'; - case 'w60': return 'application/wordperfect6.0'; - case 'w61': return 'application/wordperfect6.1'; - case 'w6w': return 'application/msword'; - case 'wav': return 'audio/wav'; - case 'wb1': return 'application/x-qpro'; - case 'wbmp': return 'image/vnd.wap.wbmp'; - case 'web': return 'application/vnd.xara'; - case 'wiz': return 'application/msword'; - case 'wk1': return 'application/x-123'; - case 'wmf': return 'windows/metafile'; - case 'wml': return 'text/vnd.wap.wml'; - case 'wmlc': return 'application/vnd.wap.wmlc'; - case 'wmls': return 'text/vnd.wap.wmlscript'; - case 'wmlsc': return 'application/vnd.wap.wmlscriptc'; - case 'word': return 'application/msword'; - case 'wp': return 'application/wordperfect'; - case 'wp5': return 'application/wordperfect6.0'; - case 'wp6': return 'application/wordperfect'; - case 'wpd': return 'application/x-wpwin'; - case 'wq1': return 'application/x-lotus'; - case 'wri': return 'application/mswrite'; - case 'wrl': return 'model/vrml'; - case 'wrz': return 'model/vrml'; - case 'wsc': return 'text/scriplet'; - case 'wsrc': return 'application/x-wais-source'; - case 'wtk': return 'application/x-wintalk'; - case 'xbm': return 'image/x-xbitmap'; - case 'xdr': return 'video/x-amt-demorun'; - case 'xgz': return 'xgl/drawing'; - case 'xif': return 'image/vnd.xiff'; - case 'xl': return 'application/excel'; - case 'xla': return 'application/excel'; - case 'xlb': return 'application/excel'; - case 'xlc': return 'application/excel'; - case 'xld': return 'application/excel'; - case 'xlk': return 'application/excel'; - case 'xll': return 'application/excel'; - case 'xlm': return 'application/excel'; - case 'xls': return 'application/excel'; - case 'xlt': return 'application/excel'; - case 'xlv': return 'application/excel'; - case 'xlw': return 'application/excel'; - case 'xm': return 'audio/xm'; - case 'xml': return 'application/xml'; - case 'xmz': return 'xgl/movie'; - case 'xpix': return 'application/x-vnd.ls-xpix'; - case 'xpm': return 'image/xpm'; - case 'x-png': return 'image/png'; - case 'xsr': return 'video/x-amt-showrun'; - case 'xwd': return 'image/x-xwd'; - case 'xyz': return 'chemical/x-pdb'; - case 'z': return 'application/x-compress'; - case 'zip': return 'application/x-compressed'; - case 'zoo': return 'application/octet-stream'; - case 'zsh': return 'text/x-script.zsh'; - default: return 'application/octet-stream'; + switch($extension) { + case '3dmf': + return 'x-world/x-3dmf'; + case 'a': + return 'application/octet-stream'; + case 'aab': + return 'application/x-authorware-bin'; + case 'aam': + return 'application/x-authorware-map'; + case 'aas': + return 'application/x-authorware-seg'; + case 'abc': + return 'text/vnd.abc'; + case 'acgi': + return 'text/html'; + case 'afl': + return 'video/animaflex'; + case 'ai': + return 'application/postscript'; + case 'aif': + return 'audio/aiff'; + case 'aifc': + return 'audio/aiff'; + case 'aiff': + return 'audio/aiff'; + case 'aim': + return 'application/x-aim'; + case 'aip': + return 'text/x-audiosoft-intra'; + case 'ani': + return 'application/x-navi-animation'; + case 'aos': + return 'application/x-nokia-9000-communicator-add-on-software'; + case 'aps': + return 'application/mime'; + case 'arc': + return 'application/octet-stream'; + case 'arj': + return 'application/arj'; + case 'art': + return 'image/x-jg'; + case 'asf': + return 'video/x-ms-asf'; + case 'asm': + return 'text/x-asm'; + case 'asp': + return 'text/asp'; + case 'asx': + return 'application/x-mplayer2'; + case 'au': + return 'audio/basic'; + case 'avi': + return 'application/x-troff-msvideo'; + case 'avs': + return 'video/avs-video'; + case 'bcpio': + return 'application/x-bcpio'; + case 'bin': + return 'application/x-binary'; + case 'bm': + return 'image/bmp'; + case 'bmp': + return 'image/bmp'; + case 'boo': + return 'application/book'; + case 'book': + return 'application/book'; + case 'boz': + return 'application/x-bzip2'; + case 'bsh': + return 'application/x-bsh'; + case 'bz': + return 'application/x-bzip'; + case 'bz2': + return 'application/x-bzip2'; + case 'c': + return 'text/plain'; + case 'c++': + return 'text/plain'; + case 'cat': + return 'application/vnd.ms-pki.seccat'; + case 'cc': + return 'text/plain'; + case 'ccad': + return 'application/clariscad'; + case 'cco': + return 'application/x-cocoa'; + case 'cdf': + return 'application/cdf'; + case 'cer': + return 'application/pkix-cert'; + case 'cha': + return 'application/x-chat'; + case 'chat': + return 'application/x-chat'; + case 'class': + return 'application/java'; + case 'com': + return 'application/octet-stream'; + case 'conf': + return 'text/plain'; + case 'cpio': + return 'application/x-cpio'; + case 'cpp': + return 'text/x-c'; + case 'cpt': + return 'application/mac-compactpro'; + case 'crl': + return 'application/pkcs-crl'; + case 'csh': + return 'application/x-csh'; + case 'css': + return 'text/css'; + case 'cxx': + return 'text/plain'; + case 'dcr': + return 'application/x-director'; + case 'deepv': + return 'application/x-deepv'; + case 'def': + return 'text/plain'; + case 'der': + return 'application/x-x509-ca-cert'; + case 'dif': + return 'video/x-dv'; + case 'dir': + return 'application/x-director'; + case 'dl': + return 'video/dl'; + case 'doc': + return 'application/msword'; + case 'dot': + return 'application/msword'; + case 'dp': + return 'application/commonground'; + case 'drw': + return 'application/drafting'; + case 'dump': + return 'application/octet-stream'; + case 'dv': + return 'video/x-dv'; + case 'dvi': + return 'application/x-dvi'; + case 'dwf': + return 'drawing/x-dwf (old)'; + case 'dwg': + return 'application/acad'; + case 'dxf': + return 'application/dxf'; + case 'dxr': + return 'application/x-director'; + case 'el': + return 'text/x-script.elisp'; + case 'elc': + return 'application/x-bytecode.elisp (compiled elisp)'; + case 'env': + return 'application/x-envoy'; + case 'eps': + return 'application/postscript'; + case 'es': + return 'application/x-esrehber'; + case 'etx': + return 'text/x-setext'; + case 'evy': + return 'application/envoy'; + case 'exe': + return 'application/octet-stream'; + case 'f': + return 'text/plain'; + case 'f77': + return 'text/x-fortran'; + case 'f90': + return 'text/plain'; + case 'fdf': + return 'application/vnd.fdf'; + case 'fif': + return 'application/fractals'; + case 'fli': + return 'video/fli'; + case 'flo': + return 'image/florian'; + case 'flx': + return 'text/vnd.fmi.flexstor'; + case 'fmf': + return 'video/x-atomic3d-feature'; + case 'for': + return 'text/plain'; + case 'fpx': + return 'image/vnd.fpx'; + case 'frl': + return 'application/freeloader'; + case 'funk': + return 'audio/make'; + case 'g': + return 'text/plain'; + case 'g3': + return 'image/g3fax'; + case 'gif': + return 'image/gif'; + case 'gl': + return 'video/gl'; + case 'gsd': + return 'audio/x-gsm'; + case 'gsm': + return 'audio/x-gsm'; + case 'gsp': + return 'application/x-gsp'; + case 'gss': + return 'application/x-gss'; + case 'gtar': + return 'application/x-gtar'; + case 'gz': + return 'application/x-compressed'; + case 'gzip': + return 'application/x-gzip'; + case 'h': + return 'text/plain'; + case 'hdf': + return 'application/x-hdf'; + case 'help': + return 'application/x-helpfile'; + case 'hgl': + return 'application/vnd.hp-hpgl'; + case 'hh': + return 'text/plain'; + case 'hlb': + return 'text/x-script'; + case 'hlp': + return 'application/hlp'; + case 'hpg': + return 'application/vnd.hp-hpgl'; + case 'hpgl': + return 'application/vnd.hp-hpgl'; + case 'hqx': + return 'application/binhex'; + case 'hta': + return 'application/hta'; + case 'htc': + return 'text/x-component'; + case 'htm': + return 'text/html'; + case 'html': + return 'text/html'; + case 'htmls': + return 'text/html'; + case 'htt': + return 'text/webviewhtml'; + case 'htx': + return 'text/html'; + case 'ice': + return 'x-conference/x-cooltalk'; + case 'ico': + return 'image/x-icon'; + case 'idc': + return 'text/plain'; + case 'ief': + return 'image/ief'; + case 'iefs': + return 'image/ief'; + case 'iges': + return 'application/iges'; + case 'igs': + return 'application/iges'; + case 'ima': + return 'application/x-ima'; + case 'imap': + return 'application/x-httpd-imap'; + case 'inf': + return 'application/inf'; + case 'ins': + return 'application/x-internett-signup'; + case 'ip': + return 'application/x-ip2'; + case 'isu': + return 'video/x-isvideo'; + case 'it': + return 'audio/it'; + case 'iv': + return 'application/x-inventor'; + case 'ivr': + return 'i-world/i-vrml'; + case 'ivy': + return 'application/x-livescreen'; + case 'jam': + return 'audio/x-jam'; + case 'jav': + return 'text/plain'; + case 'java': + return 'text/plain'; + case 'jcm': + return 'application/x-java-commerce'; + case 'jfif': + return 'image/jpeg'; + case 'jfif-tbnl': + return 'image/jpeg'; + case 'jpe': + return 'image/jpeg'; + case 'jpeg': + return 'image/jpeg'; + case 'jpg': + return 'image/jpeg'; + case 'jps': + return 'image/x-jps'; + case 'js': + return 'application/x-javascript'; + case 'jut': + return 'image/jutvision'; + case 'kar': + return 'audio/midi'; + case 'ksh': + return 'application/x-ksh'; + case 'la': + return 'audio/nspaudio'; + case 'lam': + return 'audio/x-liveaudio'; + case 'latex': + return 'application/x-latex'; + case 'lha': + return 'application/lha'; + case 'lhx': + return 'application/octet-stream'; + case 'list': + return 'text/plain'; + case 'lma': + return 'audio/nspaudio'; + case 'log': + return 'text/plain'; + case 'lsp': + return 'application/x-lisp'; + case 'lst': + return 'text/plain'; + case 'lsx': + return 'text/x-la-asf'; + case 'ltx': + return 'application/x-latex'; + case 'lzh': + return 'application/octet-stream'; + case 'lzx': + return 'application/lzx'; + case 'm': + return 'text/plain'; + case 'm1v': + return 'video/mpeg'; + case 'm2a': + return 'audio/mpeg'; + case 'm2v': + return 'video/mpeg'; + case 'm3u': + return 'audio/x-mpequrl'; + case 'man': + return 'application/x-troff-man'; + case 'map': + return 'application/x-navimap'; + case 'mar': + return 'text/plain'; + case 'mbd': + return 'application/mbedlet'; + case 'mc$': + return 'application/x-magic-cap-package-1.0'; + case 'mcd': + return 'application/mcad'; + case 'mcf': + return 'image/vasa'; + case 'mcp': + return 'application/netmc'; + case 'me': + return 'application/x-troff-me'; + case 'mht': + return 'message/rfc822'; + case 'mhtml': + return 'message/rfc822'; + case 'mid': + return 'application/x-midi'; + case 'midi': + return 'audio/midi'; + case 'mif': + return 'application/x-frame'; + case 'mime': + return 'message/rfc822'; + case 'mjf': + return 'audio/x-vnd.audioexplosion.mjuicemediafile'; + case 'mjpg': + return 'video/x-motion-jpeg'; + case 'mm': + return 'application/base64'; + case 'mme': + return 'application/base64'; + case 'mod': + return 'audio/mod'; + case 'moov': + return 'video/quicktime'; + case 'mov': + return 'video/quicktime'; + case 'movie': + return 'video/x-sgi-movie'; + case 'mp2': + return 'video/mpeg'; + case 'mp3': + return 'video/mpeg'; + case 'mpa': + return 'audio/mpeg'; + case 'mpc': + return 'application/x-project'; + case 'mpe': + return 'video/mpeg'; + case 'mpeg': + return 'video/mpeg'; + case 'mpg': + return 'video/mpeg'; + case 'mpga': + return 'audio/mpeg'; + case 'mpp': + return 'application/vnd.ms-project'; + case 'mpt': + return 'application/x-project'; + case 'mpv': + return 'application/x-project'; + case 'mpx': + return 'application/x-project'; + case 'mrc': + return 'application/marc'; + case 'ms': + return 'application/x-troff-ms'; + case 'mv': + return 'video/x-sgi-movie'; + case 'my': + return 'audio/make'; + case 'mzz': + return 'application/x-vnd.audioexplosion.mzz'; + case 'nap': + return 'image/naplps'; + case 'naplps': + return 'image/naplps'; + case 'nc': + return 'application/x-netcdf'; + case 'ncm': + return 'application/vnd.nokia.configuration-message'; + case 'nif': + return 'image/x-niff'; + case 'niff': + return 'image/x-niff'; + case 'nix': + return 'application/x-mix-transfer'; + case 'nsc': + return 'application/x-conference'; + case 'nvd': + return 'application/x-navidoc'; + case 'o': + return 'application/octet-stream'; + case 'oda': + return 'application/oda'; + case 'omc': + return 'application/x-omc'; + case 'omcd': + return 'application/x-omcdatamaker'; + case 'omcr': + return 'application/x-omcregerator'; + case 'p': + return 'text/x-pascal'; + case 'p10': + return 'application/pkcs10'; + case 'p12': + return 'application/pkcs-12'; + case 'p7a': + return 'application/x-pkcs7-signature'; + case 'p7c': + return 'application/pkcs7-mime'; + case 'p7m': + return 'application/pkcs7-mime'; + case 'p7r': + return 'application/x-pkcs7-certreqresp'; + case 'p7s': + return 'application/pkcs7-signature'; + case 'part': + return 'application/pro_eng'; + case 'pas': + return 'text/pascal'; + case 'pbm': + return 'image/x-portable-bitmap'; + case 'pcl': + return 'application/vnd.hp-pcl'; + case 'pct': + return 'image/x-pict'; + case 'pcx': + return 'image/x-pcx'; + case 'pdb': + return 'chemical/x-pdb'; + case 'pdf': + return 'application/pdf'; + case 'pfunk': + return 'audio/make'; + case 'pgm': + return 'image/x-portable-graymap'; + case 'pic': + return 'image/pict'; + case 'pict': + return 'image/pict'; + case 'pkg': + return 'application/x-newton-compatible-pkg'; + case 'pko': + return 'application/vnd.ms-pki.pko'; + case 'pl': + return 'text/plain'; + case 'plx': + return 'application/x-pixclscript'; + case 'pm': + return 'image/x-xpixmap'; + case 'pm4': + return 'application/x-pagemaker'; + case 'pm5': + return 'application/x-pagemaker'; + case 'png': + return 'image/png'; + case 'pnm': + return 'application/x-portable-anymap'; + case 'pot': + return 'application/mspowerpoint'; + case 'pov': + return 'model/x-pov'; + case 'ppa': + return 'application/vnd.ms-powerpoint'; + case 'ppm': + return 'image/x-portable-pixmap'; + case 'pps': + return 'application/mspowerpoint'; + case 'ppt': + return 'application/mspowerpoint'; + case 'ppz': + return 'application/mspowerpoint'; + case 'pre': + return 'application/x-freelance'; + case 'prt': + return 'application/pro_eng'; + case 'ps': + return 'application/postscript'; + case 'psd': + return 'application/octet-stream'; + case 'pvu': + return 'paleovu/x-pv'; + case 'pwz': + return 'application/vnd.ms-powerpoint'; + case 'py': + return 'text/x-script.phyton'; + case 'pyc': + return 'applicaiton/x-bytecode.python'; + case 'qcp': + return 'audio/vnd.qcelp'; + case 'qd3': + return 'x-world/x-3dmf'; + case 'qd3d': + return 'x-world/x-3dmf'; + case 'qif': + return 'image/x-quicktime'; + case 'qt': + return 'video/quicktime'; + case 'qtc': + return 'video/x-qtc'; + case 'qti': + return 'image/x-quicktime'; + case 'qtif': + return 'image/x-quicktime'; + case 'ra': + return 'audio/x-pn-realaudio'; + case 'ram': + return 'audio/x-pn-realaudio'; + case 'ras': + return 'application/x-cmu-raster'; + case 'rast': + return 'image/cmu-raster'; + case 'rexx': + return 'text/x-script.rexx'; + case 'rf': + return 'image/vnd.rn-realflash'; + case 'rgb': + return 'image/x-rgb'; + case 'rm': + return 'application/vnd.rn-realmedia'; + case 'rmi': + return 'audio/mid'; + case 'rmm': + return 'audio/x-pn-realaudio'; + case 'rmp': + return 'audio/x-pn-realaudio'; + case 'rng': + return 'application/ringing-tones'; + case 'rnx': + return 'application/vnd.rn-realplayer'; + case 'roff': + return 'application/x-troff'; + case 'rp': + return 'image/vnd.rn-realpix'; + case 'rpm': + return 'audio/x-pn-realaudio-plugin'; + case 'rt': + return 'text/richtext'; + case 'rtf': + return 'application/rtf'; + case 'rtx': + return 'text/richtext'; + case 'rv': + return 'video/vnd.rn-realvideo'; + case 's': + return 'text/x-asm'; + case 's3m': + return 'audio/s3m'; + case 'saveme': + return 'application/octet-stream'; + case 'sbk': + return 'application/x-tbook'; + case 'scm': + return 'application/x-lotusscreencam'; + case 'sdml': + return 'text/plain'; + case 'sdp': + return 'application/sdp'; + case 'sdr': + return 'application/sounder'; + case 'sea': + return 'application/sea'; + case 'set': + return 'application/set'; + case 'sgm': + return 'text/sgml'; + case 'sgml': + return 'text/sgml'; + case 'sh': + return 'application/x-bsh'; + case 'shar': + return 'application/x-bsh'; + case 'shtml': + return 'text/html'; + case 'sid': + return 'audio/x-psid'; + case 'sit': + return 'application/x-sit'; + case 'skd': + return 'application/x-koan'; + case 'skm': + return 'application/x-koan'; + case 'skp': + return 'application/x-koan'; + case 'skt': + return 'application/x-koan'; + case 'sl': + return 'application/x-seelogo'; + case 'smi': + return 'application/smil'; + case 'smil': + return 'application/smil'; + case 'snd': + return 'audio/basic'; + case 'sol': + return 'application/solids'; + case 'spc': + return 'application/x-pkcs7-certificates'; + case 'spl': + return 'application/futuresplash'; + case 'spr': + return 'application/x-sprite'; + case 'sprite': + return 'application/x-sprite'; + case 'src': + return 'application/x-wais-source'; + case 'ssi': + return 'text/x-server-parsed-html'; + case 'ssm': + return 'application/streamingmedia'; + case 'sst': + return 'application/vnd.ms-pki.certstore'; + case 'step': + return 'application/step'; + case 'stl': + return 'application/sla'; + case 'stp': + return 'application/step'; + case 'sv4cpio': + return 'application/x-sv4cpio'; + case 'sv4crc': + return 'application/x-sv4crc'; + case 'svf': + return 'image/vnd.dwg'; + case 'svr': + return 'application/x-world'; + case 'swf': + return 'application/x-shockwave-flash'; + case 't': + return 'application/x-troff'; + case 'talk': + return 'text/x-speech'; + case 'tar': + return 'application/x-tar'; + case 'tbk': + return 'application/toolbook'; + case 'tcl': + return 'application/x-tcl'; + case 'tcsh': + return 'text/x-script.tcsh'; + case 'tex': + return 'application/x-tex'; + case 'texi': + return 'application/x-texinfo'; + case 'texinfo': + return 'application/x-texinfo'; + case 'text': + return 'text/plain'; + case 'tgz': + return 'application/x-compressed'; + case 'tif': + return 'image/tiff'; + case 'tiff': + return 'image/tiff'; + case 'tr': + return 'application/x-troff'; + case 'tsi': + return 'audio/tsp-audio'; + case 'tsp': + return 'application/dsptype'; + case 'tsv': + return 'text/tab-separated-values'; + case 'turbot': + return 'image/florian'; + case 'txt': + return 'text/plain'; + case 'uil': + return 'text/x-uil'; + case 'uni': + return 'text/uri-list'; + case 'unis': + return 'text/uri-list'; + case 'unv': + return 'application/i-deas'; + case 'uri': + return 'text/uri-list'; + case 'uris': + return 'text/uri-list'; + case 'ustar': + return 'multipart/x-ustar'; + case 'uu': + return 'application/octet-stream'; + case 'uue': + return 'text/x-uuencode'; + case 'vcd': + return 'application/x-cdlink'; + case 'vcs': + return 'text/x-vcalendar'; + case 'vda': + return 'application/vda'; + case 'vdo': + return 'video/vdo'; + case 'vew': + return 'application/groupwise'; + case 'viv': + return 'video/vivo'; + case 'vivo': + return 'video/vivo'; + case 'vmd': + return 'application/vocaltec-media-desc'; + case 'vmf': + return 'application/vocaltec-media-file'; + case 'voc': + return 'audio/voc'; + case 'vos': + return 'video/vosaic'; + case 'vox': + return 'audio/voxware'; + case 'vqe': + return 'audio/x-twinvq-plugin'; + case 'vqf': + return 'audio/x-twinvq'; + case 'vql': + return 'audio/x-twinvq-plugin'; + case 'vrml': + return 'application/x-vrml'; + case 'vrt': + return 'x-world/x-vrt'; + case 'vsd': + return 'application/x-visio'; + case 'vst': + return 'application/x-visio'; + case 'vsw': + return 'application/x-visio'; + case 'w60': + return 'application/wordperfect6.0'; + case 'w61': + return 'application/wordperfect6.1'; + case 'w6w': + return 'application/msword'; + case 'wav': + return 'audio/wav'; + case 'wb1': + return 'application/x-qpro'; + case 'wbmp': + return 'image/vnd.wap.wbmp'; + case 'web': + return 'application/vnd.xara'; + case 'wiz': + return 'application/msword'; + case 'wk1': + return 'application/x-123'; + case 'wmf': + return 'windows/metafile'; + case 'wml': + return 'text/vnd.wap.wml'; + case 'wmlc': + return 'application/vnd.wap.wmlc'; + case 'wmls': + return 'text/vnd.wap.wmlscript'; + case 'wmlsc': + return 'application/vnd.wap.wmlscriptc'; + case 'word': + return 'application/msword'; + case 'wp': + return 'application/wordperfect'; + case 'wp5': + return 'application/wordperfect6.0'; + case 'wp6': + return 'application/wordperfect'; + case 'wpd': + return 'application/x-wpwin'; + case 'wq1': + return 'application/x-lotus'; + case 'wri': + return 'application/mswrite'; + case 'wrl': + return 'model/vrml'; + case 'wrz': + return 'model/vrml'; + case 'wsc': + return 'text/scriplet'; + case 'wsrc': + return 'application/x-wais-source'; + case 'wtk': + return 'application/x-wintalk'; + case 'xbm': + return 'image/x-xbitmap'; + case 'xdr': + return 'video/x-amt-demorun'; + case 'xgz': + return 'xgl/drawing'; + case 'xif': + return 'image/vnd.xiff'; + case 'xl': + return 'application/excel'; + case 'xla': + return 'application/excel'; + case 'xlb': + return 'application/excel'; + case 'xlc': + return 'application/excel'; + case 'xld': + return 'application/excel'; + case 'xlk': + return 'application/excel'; + case 'xll': + return 'application/excel'; + case 'xlm': + return 'application/excel'; + case 'xls': + return 'application/excel'; + case 'xlt': + return 'application/excel'; + case 'xlv': + return 'application/excel'; + case 'xlw': + return 'application/excel'; + case 'xm': + return 'audio/xm'; + case 'xml': + return 'application/xml'; + case 'xmz': + return 'xgl/movie'; + case 'xpix': + return 'application/x-vnd.ls-xpix'; + case 'xpm': + return 'image/xpm'; + case 'x-png': + return 'image/png'; + case 'xsr': + return 'video/x-amt-showrun'; + case 'xwd': + return 'image/x-xwd'; + case 'xyz': + return 'chemical/x-pdb'; + case 'z': + return 'application/x-compress'; + case 'zip': + return 'application/x-compressed'; + case 'zoo': + return 'application/octet-stream'; + case 'zsh': + return 'text/x-script.zsh'; + default: + return 'application/octet-stream'; } } ?> \ No newline at end of file http://cvs.php.net/diff.php/pear/File_Archive/Archive/Reader/Multi.php?r1=1.5&r2=1.6&ty=u Index: pear/File_Archive/Archive/Reader/Multi.php diff -u pear/File_Archive/Archive/Reader/Multi.php:1.5 pear/File_Archive/Archive/Reader/Multi.php:1.6 --- pear/File_Archive/Archive/Reader/Multi.php:1.5 Sun Feb 20 08:24:25 2005 +++ pear/File_Archive/Archive/Reader/Multi.php Tue Feb 22 12:00:05 2005 @@ -25,7 +25,7 @@ * @author Vincent Lascaux <vincentlascaux@php.net> * @copyright 1997-2005 The PHP Group * @license http://www.gnu.org/copyleft/lesser.html LGPL - * @version CVS: $Id: Multi.php,v 1.5 2005/02/20 13:24:25 vincentlascaux Exp $ + * @version CVS: $Id: Multi.php,v 1.6 2005/02/22 17:00:05 vincentlascaux Exp $ * @link http://pear.php.net/package/File_Archive */ @@ -61,8 +61,7 @@ */ function next() { - while(array_key_exists($this->currentIndex, $this->sources)) - { + while(array_key_exists($this->currentIndex, $this->sources)) { $this->source =& $this->sources[$this->currentIndex]; if($this->source->next()) { http://cvs.php.net/diff.php/pear/File_Archive/Archive/Reader/Tar.php?r1=1.4&r2=1.5&ty=u Index: pear/File_Archive/Archive/Reader/Tar.php diff -u pear/File_Archive/Archive/Reader/Tar.php:1.4 pear/File_Archive/Archive/Reader/Tar.php:1.5 --- pear/File_Archive/Archive/Reader/Tar.php:1.4 Fri Feb 18 16:00:49 2005 +++ pear/File_Archive/Archive/Reader/Tar.php Tue Feb 22 12:00:05 2005 @@ -25,7 +25,7 @@ * @author Vincent Lascaux <vincentlascaux@php.net> * @copyright 1997-2005 The PHP Group * @license http://www.gnu.org/copyleft/lesser.html LGPL - * @version CVS: $Id: Tar.php,v 1.4 2005/02/18 21:00:49 vincentlascaux Exp $ + * @version CVS: $Id: Tar.php,v 1.5 2005/02/22 17:00:05 vincentlascaux Exp $ * @link http://pear.php.net/package/File_Archive */ @@ -127,10 +127,12 @@ } $checksum = 8*ord(" "); - for($i = 0; $i < 148; $i++) + for($i = 0; $i < 148; $i++) { $checksum += ord($rawHeader{$i}); - for($i = 156; $i < 512; $i++) + } + for($i = 156; $i < 512; $i++) { $checksum += ord($rawHeader{$i}); + } if(octdec($header['checksum']) != $checksum) { die('Checksum error on entry '.$this->currentFilename); http://cvs.php.net/diff.php/pear/File_Archive/Archive/Reader/Uncompress.php?r1=1.7&r2=1.8&ty=u Index: pear/File_Archive/Archive/Reader/Uncompress.php diff -u pear/File_Archive/Archive/Reader/Uncompress.php:1.7 pear/File_Archive/Archive/Reader/Uncompress.php:1.8 --- pear/File_Archive/Archive/Reader/Uncompress.php:1.7 Sat Feb 19 15:29:33 2005 +++ pear/File_Archive/Archive/Reader/Uncompress.php Tue Feb 22 12:00:05 2005 @@ -25,7 +25,7 @@ * @author Vincent Lascaux <vincentlascaux@php.net> * @copyright 1997-2005 The PHP Group * @license http://www.gnu.org/copyleft/lesser.html LGPL - * @version CVS: $Id: Uncompress.php,v 1.7 2005/02/19 20:29:33 vincentlascaux Exp $ + * @version CVS: $Id: Uncompress.php,v 1.8 2005/02/22 17:00:05 vincentlascaux Exp $ * @link http://pear.php.net/package/File_Archive */ @@ -122,8 +122,7 @@ $extension = strtolower(substr($filename, $pos+1)); } - switch($extension) - { + switch($extension) { case "tar": require_once "Tar.php"; $this->readers[count($this->readers)] =& $this->source; @@ -157,7 +156,8 @@ ) ); break; - default: return false; + default: + return false; } unset($this->source); $this->source = $next; @@ -172,13 +172,10 @@ $this->currentFileDisplayed = true; return true; } - while(true) - { + while(true) { //Remove the readers we have completly read from the stack - do - { - while(! $this->source->next()) - { + do { + while(! $this->source->next()) { if(empty($this->readers)) { return false; } @@ -208,8 +205,9 @@ $this->baseDirCompressionLevel = count($this->readers); } - if(! $this->push()) + if(! $this->push()) { return true; + } } } /** @@ -221,9 +219,6 @@ { $this->baseDirUncompressionLevel = null; $this->baseDir = $baseDir; -/* if(substr($this->baseDir,-1)=='/') { - $this->baseDir=substr($this->baseDir, 0, -1); - } */ if(! $this->next()) { return PEAR::raiseError("No directory $baseDir in inner reader"); @@ -240,8 +235,7 @@ $this->close(); - while($this->source->next()) - { + while($this->source->next()) { $currentFilename = $this->source->getFilename().'/'; $compLength = min(strlen($currentFilename), strlen($filename)); if( strncmp($currentFilename, $std, $compLength) == 0 ) { http://cvs.php.net/diff.php/pear/File_Archive/Archive/Reader/Zip.php?r1=1.6&r2=1.7&ty=u Index: pear/File_Archive/Archive/Reader/Zip.php diff -u pear/File_Archive/Archive/Reader/Zip.php:1.6 pear/File_Archive/Archive/Reader/Zip.php:1.7 --- pear/File_Archive/Archive/Reader/Zip.php:1.6 Sat Feb 19 16:12:55 2005 +++ pear/File_Archive/Archive/Reader/Zip.php Tue Feb 22 12:00:05 2005 @@ -25,7 +25,7 @@ * @author Vincent Lascaux <vincentlascaux@php.net> * @copyright 1997-2005 The PHP Group * @license http://www.gnu.org/copyleft/lesser.html LGPL - * @version CVS: $Id: Zip.php,v 1.6 2005/02/19 21:12:55 vincentlascaux Exp $ + * @version CVS: $Id: Zip.php,v 1.7 2005/02/22 17:00:05 vincentlascaux Exp $ * @link http://pear.php.net/package/File_Archive */ @@ -139,8 +139,7 @@ return false; } - do - { + do { $result = $this->nextWithFolders(); if($result !== true) { return $result; http://cvs.php.net/diff.php/pear/File_Archive/Archive/Writer/Archive.php?r1=1.4&r2=1.5&ty=u Index: pear/File_Archive/Archive/Writer/Archive.php diff -u pear/File_Archive/Archive/Writer/Archive.php:1.4 pear/File_Archive/Archive/Writer/Archive.php:1.5 --- pear/File_Archive/Archive/Writer/Archive.php:1.4 Fri Feb 18 16:00:49 2005 +++ pear/File_Archive/Archive/Writer/Archive.php Tue Feb 22 12:00:05 2005 @@ -25,7 +25,7 @@ * @author Vincent Lascaux <vincentlascaux@php.net> * @copyright 1997-2005 The PHP Group * @license http://www.gnu.org/copyleft/lesser.html LGPL - * @version CVS: $Id: Archive.php,v 1.4 2005/02/18 21:00:49 vincentlascaux Exp $ + * @version CVS: $Id: Archive.php,v 1.5 2005/02/22 17:00:05 vincentlascaux Exp $ * @link http://pear.php.net/package/File_Archive */ @@ -40,13 +40,13 @@ * @var File_Archive_Writer The compressed data will be written to this writer * @access private */ - var $innerWriter = NULL; + var $innerWriter; /** * @var bool If true, the innerWriter will be closed when closing this * @access private */ - var $autoClose = TRUE; + var $autoClose; /** * @param String $filename Name to give to the archive (the name will probably be used by the inner writer) http://cvs.php.net/diff.php/pear/File_Archive/Archive/Writer/Mail.php?r1=1.4&r2=1.5&ty=u Index: pear/File_Archive/Archive/Writer/Mail.php diff -u pear/File_Archive/Archive/Writer/Mail.php:1.4 pear/File_Archive/Archive/Writer/Mail.php:1.5 --- pear/File_Archive/Archive/Writer/Mail.php:1.4 Fri Feb 18 16:00:49 2005 +++ pear/File_Archive/Archive/Writer/Mail.php Tue Feb 22 12:00:05 2005 @@ -25,7 +25,7 @@ * @author Vincent Lascaux <vincentlascaux@php.net> * @copyright 1997-2005 The PHP Group * @license http://www.gnu.org/copyleft/lesser.html LGPL - * @version CVS: $Id: Mail.php,v 1.4 2005/02/18 21:00:49 vincentlascaux Exp $ + * @version CVS: $Id: Mail.php,v 1.5 2005/02/22 17:00:05 vincentlascaux Exp $ * @link http://pear.php.net/package/File_Archive */ @@ -168,7 +168,7 @@ $headers, $body) ) { - die("Error sending mail"); + return PEAR::raiseError("Error sending mail"); } } } http://cvs.php.net/diff.php/pear/File_Archive/Archive/Writer/MemoryArchive.php?r1=1.4&r2=1.5&ty=u Index: pear/File_Archive/Archive/Writer/MemoryArchive.php diff -u pear/File_Archive/Archive/Writer/MemoryArchive.php:1.4 pear/File_Archive/Archive/Writer/MemoryArchive.php:1.5 --- pear/File_Archive/Archive/Writer/MemoryArchive.php:1.4 Fri Feb 18 16:00:49 2005 +++ pear/File_Archive/Archive/Writer/MemoryArchive.php Tue Feb 22 12:00:05 2005 @@ -26,7 +26,7 @@ * @author Vincent Lascaux <vincentlascaux@php.net> * @copyright 1997-2005 The PHP Group * @license http://www.gnu.org/copyleft/lesser.html LGPL - * @version CVS: $Id: MemoryArchive.php,v 1.4 2005/02/18 21:00:49 vincentlascaux Exp $ + * @version CVS: $Id: MemoryArchive.php,v 1.5 2005/02/22 17:00:05 vincentlascaux Exp $ * @link http://pear.php.net/package/File_Archive */ @@ -76,7 +76,7 @@ /** * @see File_Archive_Writer::newFile */ - function newFile($filename, $stat, $mime = "application/octet-stream") + function newFile($filename, $stat=array(), $mime = "application/octet-stream") { if($this->nbFiles == 0) { $this->sendHeader(); http://cvs.php.net/diff.php/pear/File_Archive/Archive/Writer/Tar.php?r1=1.4&r2=1.5&ty=u Index: pear/File_Archive/Archive/Writer/Tar.php diff -u pear/File_Archive/Archive/Writer/Tar.php:1.4 pear/File_Archive/Archive/Writer/Tar.php:1.5 --- pear/File_Archive/Archive/Writer/Tar.php:1.4 Fri Feb 18 16:00:49 2005 +++ pear/File_Archive/Archive/Writer/Tar.php Tue Feb 22 12:00:05 2005 @@ -25,7 +25,7 @@ * @author Vincent Lascaux <vincentlascaux@php.net> * @copyright 1997-2005 The PHP Group * @license http://www.gnu.org/copyleft/lesser.html LGPL - * @version CVS: $Id: Tar.php,v 1.4 2005/02/18 21:00:49 vincentlascaux Exp $ + * @version CVS: $Id: Tar.php,v 1.5 2005/02/22 17:00:05 vincentlascaux Exp $ * @link http://pear.php.net/package/File_Archive */ @@ -97,10 +97,12 @@ ""); $checksum = 8*ord(" "); - for($i = 0; $i < 148; $i++) + for($i = 0; $i < 148; $i++) { $checksum += ord($blockbeg{$i}); - for($i = 0; $i < 356; $i++) + } + for($i = 0; $i < 356; $i++) { $checksum += ord($blockend{$i}); + } $checksum = pack("a8",sprintf("%6s ",decoct($checksum))); http://cvs.php.net/diff.php/pear/File_Archive/tests/test.php?r1=1.12&r2=1.13&ty=u Index: pear/File_Archive/tests/test.php diff -u pear/File_Archive/tests/test.php:1.12 pear/File_Archive/tests/test.php:1.13 --- pear/File_Archive/tests/test.php:1.12 Mon Feb 21 17:59:52 2005 +++ pear/File_Archive/tests/test.php Tue Feb 22 12:00:05 2005 @@ -256,15 +256,25 @@ function testTgz() { $this->_testArchive('tgz'); } function testWriteZip() { - $source = File_Archive::readMulti(); - $source->addSource(File_Archive::read('test.php')); - $source->addSource(File_Archive::readMemory("This is a dynamic file put in the ZIP archive", "dynamic.txt")); - $source->extract( - File_Archive::toArchive('test.zip', - File_Archive::toFiles() - ) - ); - $source->close(); + //Build the writer + $writer = File_Archive::toArchive('example1.zip', File_Archive::toFiles()); + + //Write the list of even number in [0..999] + $writer->newFile("even.txt"); + for($i=0; $i<1000; $i+=2) + { + $writer->writeData("$i\n"); + } + + //Write the list of odd number in [0..999] + $writer->newFile("odd.txt"); + for($i=1; $i<1000; $i+=2) + { + $writer->writeData("$i\n"); + } + + //Close the writer + $writer->close(); } function testMultiWriter()
http://cvs.php.net/diff.php/pear/File_Archive/Archive.php?r1=1.16&r2=1.17&ty=u Index: pear/File_Archive/Archive.php diff -u pear/File_Archive/Archive.php:1.16 pear/File_Archive/Archive.php:1.17 --- pear/File_Archive/Archive.php:1.16 Mon Feb 21 17:59:51 2005 +++ pear/File_Archive/Archive.php Tue Feb 22 12:00:04 2005 @@ -26,7 +26,7 @@ * @author Vincent Lascaux <vincentlascaux@php.net> * @copyright 1997-2005 The PHP Group * @license http://www.gnu.org/copyleft/lesser.html LGPL - * @version CVS: $Id: Archive.php,v 1.16 2005/02/21 22:59:51 vincentlascaux Exp $ + * @version CVS: $Id: Archive.php,v 1.17 2005/02/22 17:00:04 vincentlascaux Exp $ * @link http://pear.php.net/package/File_Archive */ @@ -203,8 +203,7 @@ $realPath = isset($parsedURL['path']) ? $parsedURL['path'] : ''; $pos = 0; - do - { + do { if($pos == strlen($realPath)) { return new File_Archive_Reader_File($std, $realSymbolic); } @@ -303,8 +302,7 @@ { require_once "File/Archive/Reader/Multi.php"; $result = new File_Archive_Reader_Multi(); - foreach($sources as $index => $foo) - { + foreach($sources as $index => $foo) { if(is_string($sources[index])) { $result->addSource(File_Archive::read($sources[index])); } else { @@ -366,8 +364,9 @@ require_once "File/Archive/Predicate/Or.php"; $pred = new File_Archive_Predicate_Or(); $args = func_get_args(); - foreach($args as $p) + foreach($args as $p) { $pred->addPredicate($p); + } return $pred; } /** @@ -506,8 +505,7 @@ if($type == "Gz") { $type = "Gzip"; } - switch($type) - { + switch($type) { case "Tgz": require_once "File/Archive/Writer/Tar.php"; require_once "File/Archive/Writer/Gzip.php"; http://cvs.php.net/diff.php/pear/File_Archive/Archive/Predicate/And.php?r1=1.4&r2=1.5&ty=u Index: pear/File_Archive/Archive/Predicate/And.php diff -u pear/File_Archive/Archive/Predicate/And.php:1.4 pear/File_Archive/Archive/Predicate/And.php:1.5 --- pear/File_Archive/Archive/Predicate/And.php:1.4 Fri Feb 18 16:00:49 2005 +++ pear/File_Archive/Archive/Predicate/And.php Tue Feb 22 12:00:04 2005 @@ -25,7 +25,7 @@ * @author Vincent Lascaux <vincentlascaux@php.net> * @copyright 1997-2005 The PHP Group * @license http://www.gnu.org/copyleft/lesser.html LGPL - * @version CVS: $Id: And.php,v 1.4 2005/02/18 21:00:49 vincentlascaux Exp $ + * @version CVS: $Id: And.php,v 1.5 2005/02/22 17:00:04 vincentlascaux Exp $ * @link http://pear.php.net/package/File_Archive */ @@ -72,8 +72,7 @@ */ function isTrue(&$source) { - foreach($this->preds as $p) - { + foreach($this->preds as $p) { if(!$p->isTrue($source)) { return false; } http://cvs.php.net/diff.php/pear/File_Archive/Archive/Predicate/MIME.php?r1=1.2&r2=1.3&ty=u Index: pear/File_Archive/Archive/Predicate/MIME.php diff -u pear/File_Archive/Archive/Predicate/MIME.php:1.2 pear/File_Archive/Archive/Predicate/MIME.php:1.3 --- pear/File_Archive/Archive/Predicate/MIME.php:1.2 Mon Feb 21 17:59:52 2005 +++ pear/File_Archive/Archive/Predicate/MIME.php Tue Feb 22 12:00:04 2005 @@ -25,7 +25,7 @@ * @author Vincent Lascaux <vincentlascaux@php.net> * @copyright 1997-2005 The PHP Group * @license http://www.gnu.org/copyleft/lesser.html LGPL - * @version CVS: $Id: MIME.php,v 1.2 2005/02/21 22:59:52 vincentlascaux Exp $ + * @version CVS: $Id: MIME.php,v 1.3 2005/02/22 17:00:04 vincentlascaux Exp $ * @link http://pear.php.net/package/File_Archive */ @@ -58,8 +58,7 @@ function isTrue(&$source) { $sourceMIME = $source->getMIME(); - foreach($this->mimes as $mime) - { + foreach($this->mimes as $mime) { if(MIME_Type::isWildcard($mime)) { $result = MIME_Type::wildcardMatch($mime, $sourceMIME); } else { http://cvs.php.net/diff.php/pear/File_Archive/Archive/Predicate/Or.php?r1=1.4&r2=1.5&ty=u Index: pear/File_Archive/Archive/Predicate/Or.php diff -u pear/File_Archive/Archive/Predicate/Or.php:1.4 pear/File_Archive/Archive/Predicate/Or.php:1.5 --- pear/File_Archive/Archive/Predicate/Or.php:1.4 Fri Feb 18 16:00:49 2005 +++ pear/File_Archive/Archive/Predicate/Or.php Tue Feb 22 12:00:04 2005 @@ -26,7 +26,7 @@ * @author Vincent Lascaux <vincentlascaux@php.net> * @copyright 1997-2005 The PHP Group * @license http://www.gnu.org/copyleft/lesser.html LGPL - * @version CVS: $Id: Or.php,v 1.4 2005/02/18 21:00:49 vincentlascaux Exp $ + * @version CVS: $Id: Or.php,v 1.5 2005/02/22 17:00:04 vincentlascaux Exp $ * @link http://pear.php.net/package/File_Archive */ @@ -72,8 +72,7 @@ */ function isTrue(&$source) { - foreach($this->preds as $p) - { + foreach($this->preds as $p) { if($p->isTrue($source)) { return true; } http://cvs.php.net/diff.php/pear/File_Archive/Archive/Reader.php?r1=1.5&r2=1.6&ty=u Index: pear/File_Archive/Archive/Reader.php diff -u pear/File_Archive/Archive/Reader.php:1.5 pear/File_Archive/Archive/Reader.php:1.6 --- pear/File_Archive/Archive/Reader.php:1.5 Sat Feb 19 19:02:27 2005 +++ pear/File_Archive/Archive/Reader.php Tue Feb 22 12:00:04 2005 @@ -27,7 +27,7 @@ * @author Vincent Lascaux <vincentlascaux@php.net> * @copyright 1997-2005 The PHP Group * @license http://www.gnu.org/copyleft/lesser.html LGPL - * @version CVS: $Id: Reader.php,v 1.5 2005/02/20 00:02:27 vincentlascaux Exp $ + * @version CVS: $Id: Reader.php,v 1.6 2005/02/22 17:00:04 vincentlascaux Exp $ * @link http://pear.php.net/package/File_Archive */ @@ -62,8 +62,7 @@ //TODO: not very efficient: close and re open the archive to start from the begining $this->close(); - while($this->next()) - { + while($this->next()) { if($this->getFilename() == $std) return true; } @@ -80,10 +79,11 @@ $std = str_replace("\\", "/", $path); while($std != ($std = preg_replace("/[^\/:?]+\/\.\.\//", "", $std))) ; $std = str_replace("/./", "", $std); - if(strncmp($std, "./", 2) == 0) + if(strncmp($std, "./", 2) == 0) { return substr($std, 2); - else + } else { return $std; + } } /** @@ -156,9 +156,9 @@ function sendData(&$writer, $bufferSize = 102400) { $filename = $this->getDataFilename(); - if($filename !== NULL) + if($filename !== NULL) { $writer->writeFile($filename); - else { + } else { while(($data = $this->getData($bufferSize)) !== null) $writer->writeData($data); } @@ -171,8 +171,7 @@ */ function extract(&$writer, $autoClose = true, $bufferSize = 102400) //Default 100ko buffer { - while(($error = $this->next()) === true) - { + while(($error = $this->next()) === true) { $filename = $this->getFilename(); $stat = $this->getStat(); http://cvs.php.net/diff.php/pear/File_Archive/Archive/Writer.php?r1=1.4&r2=1.5&ty=u Index: pear/File_Archive/Archive/Writer.php diff -u pear/File_Archive/Archive/Writer.php:1.4 pear/File_Archive/Archive/Writer.php:1.5 --- pear/File_Archive/Archive/Writer.php:1.4 Sat Feb 19 19:02:27 2005 +++ pear/File_Archive/Archive/Writer.php Tue Feb 22 12:00:04 2005 @@ -25,7 +25,7 @@ * @author Vincent Lascaux <vincentlascaux@php.net> * @copyright 1997-2005 The PHP Group * @license http://www.gnu.org/copyleft/lesser.html LGPL - * @version CVS: $Id: Writer.php,v 1.4 2005/02/20 00:02:27 vincentlascaux Exp $ + * @version CVS: $Id: Writer.php,v 1.5 2005/02/22 17:00:04 vincentlascaux Exp $ * @link http://pear.php.net/package/File_Archive */ @@ -66,8 +66,7 @@ function writeFile($filename) { $handle = fopen($filename, "r"); - while(!feof($handle)) - { + while(!feof($handle)) { $this->writeData(fread($handle, 102400)); } fclose($handle); http://cvs.php.net/diff.php/pear/File_Archive/Archive/Reader/ChangeName.php?r1=1.5&r2=1.6&ty=u Index: pear/File_Archive/Archive/Reader/ChangeName.php diff -u pear/File_Archive/Archive/Reader/ChangeName.php:1.5 pear/File_Archive/Archive/Reader/ChangeName.php:1.6 --- pear/File_Archive/Archive/Reader/ChangeName.php:1.5 Sat Feb 19 15:29:33 2005 +++ pear/File_Archive/Archive/Reader/ChangeName.php Tue Feb 22 12:00:05 2005 @@ -25,7 +25,7 @@ * @author Vincent Lascaux <vincentlascaux@php.net> * @copyright 1997-2005 The PHP Group * @license http://www.gnu.org/copyleft/lesser.html LGPL - * @version CVS: $Id: ChangeName.php,v 1.5 2005/02/19 20:29:33 vincentlascaux Exp $ + * @version CVS: $Id: ChangeName.php,v 1.6 2005/02/22 17:00:05 vincentlascaux Exp $ * @link http://pear.php.net/package/File_Archive */ @@ -83,12 +83,14 @@ { parent::File_Archive_Reader_Relay($source); $this->oldBaseName = $this->getStandardURL($oldBaseName); - if(substr($this->oldBaseName, -1)=='/') + if(substr($this->oldBaseName, -1)=='/') { $this->oldBaseName = substr($this->oldBaseName, 0, strlen($this->oldBaseName)-1); + } $this->newBaseName = $this->getStandardURL($newBaseName); - if(substr($this->newBaseName, -1)=='/') + if(substr($this->newBaseName, -1)=='/') { $this->newBaseName = substr($this->newBaseName, 0, strlen($this->newBaseName)-1); + } } /** @@ -99,10 +101,9 @@ $name = parent::getFilename(); if(empty($this->oldBaseName) || strncmp($name, $this->oldBaseName.'/', strlen($this->oldBaseName)+1)==0) { - $result = $this->newBaseName. + return $this->newBaseName. (empty($this->newBaseName) || strlen($name)<=strlen($this->oldBaseName)+1?'':'/'). substr($name, strlen($this->oldBaseName)+1); - return $result; } else { return $name; } http://cvs.php.net/diff.php/pear/File_Archive/Archive/Reader/Concat.php?r1=1.1&r2=1.2&ty=u Index: pear/File_Archive/Archive/Reader/Concat.php diff -u pear/File_Archive/Archive/Reader/Concat.php:1.1 pear/File_Archive/Archive/Reader/Concat.php:1.2 --- pear/File_Archive/Archive/Reader/Concat.php:1.1 Sat Feb 19 19:34:08 2005 +++ pear/File_Archive/Archive/Reader/Concat.php Tue Feb 22 12:00:05 2005 @@ -25,7 +25,7 @@ * @author Vincent Lascaux <vincentlascaux@php.net> * @copyright 1997-2005 The PHP Group * @license http://www.gnu.org/copyleft/lesser.html LGPL - * @version CVS: $Id: Concat.php,v 1.1 2005/02/20 00:34:08 vincentlascaux Exp $ + * @version CVS: $Id: Concat.php,v 1.2 2005/02/22 17:00:05 vincentlascaux Exp $ * @link http://pear.php.net/package/File_Archive */ @@ -52,8 +52,7 @@ //Compute the total length $this->stat[7] = 0; - while($source->next()) - { + while($source->next()) { $sourceStat = $source->getStat(); $this->stat[7] += $sourceStat[7]; } @@ -95,8 +94,7 @@ } $result = ''; - while($length == -1 || strlen($result)<$length) - { + while($length == -1 || strlen($result)<$length) { $sourceData = $this->source->getData($length==-1 ? -1 : $length - strlen($result)); if(PEAR::isError($sourceData)) { @@ -123,8 +121,7 @@ function skip($length) { $skipped = 0; - while($skipped < $length) - { + while($skipped < $length) { $sourceSkipped = $this->source->skip($length); if(PEAR::isError($sourceSkipped)) { return $skipped; http://cvs.php.net/diff.php/pear/File_Archive/Archive/Reader/Directory.php?r1=1.4&r2=1.5&ty=u Index: pear/File_Archive/Archive/Reader/Directory.php diff -u pear/File_Archive/Archive/Reader/Directory.php:1.4 pear/File_Archive/Archive/Reader/Directory.php:1.5 --- pear/File_Archive/Archive/Reader/Directory.php:1.4 Fri Feb 18 16:00:49 2005 +++ pear/File_Archive/Archive/Reader/Directory.php Tue Feb 22 12:00:05 2005 @@ -25,7 +25,7 @@ * @author Vincent Lascaux <vincentlascaux@php.net> * @copyright 1997-2005 The PHP Group * @license http://www.gnu.org/copyleft/lesser.html LGPL - * @version CVS: $Id: Directory.php,v 1.4 2005/02/18 21:00:49 vincentlascaux Exp $ + * @version CVS: $Id: Directory.php,v 1.5 2005/02/22 17:00:05 vincentlascaux Exp $ * @link http://pear.php.net/package/File_Archive */ @@ -87,8 +87,7 @@ $this->directoryHandle = opendir($this->directory); while($this->source == null || - !$this->source->next()) - { + !$this->source->next()) { $file = readdir($this->directoryHandle); if($file == '.' || $file == '..') { continue; http://cvs.php.net/diff.php/pear/File_Archive/Archive/Reader/Filter.php?r1=1.5&r2=1.6&ty=u Index: pear/File_Archive/Archive/Reader/Filter.php diff -u pear/File_Archive/Archive/Reader/Filter.php:1.5 pear/File_Archive/Archive/Reader/Filter.php:1.6 --- pear/File_Archive/Archive/Reader/Filter.php:1.5 Fri Feb 18 19:58:42 2005 +++ pear/File_Archive/Archive/Reader/Filter.php Tue Feb 22 12:00:05 2005 @@ -25,7 +25,7 @@ * @author Vincent Lascaux <vincentlascaux@php.net> * @copyright 1997-2005 The PHP Group * @license http://www.gnu.org/copyleft/lesser.html LGPL - * @version CVS: $Id: Filter.php,v 1.5 2005/02/19 00:58:42 vincentlascaux Exp $ + * @version CVS: $Id: Filter.php,v 1.6 2005/02/22 17:00:05 vincentlascaux Exp $ * @link http://pear.php.net/package/File_Archive */ @@ -56,8 +56,7 @@ */ function next() { - do - { + do { $error = $this->source->next(); if($error !== true) { return $error; http://cvs.php.net/diff.php/pear/File_Archive/Archive/Reader/Gzip.php?r1=1.3&r2=1.4&ty=u Index: pear/File_Archive/Archive/Reader/Gzip.php diff -u pear/File_Archive/Archive/Reader/Gzip.php:1.3 pear/File_Archive/Archive/Reader/Gzip.php:1.4 --- pear/File_Archive/Archive/Reader/Gzip.php:1.3 Fri Feb 18 16:00:49 2005 +++ pear/File_Archive/Archive/Reader/Gzip.php Tue Feb 22 12:00:05 2005 @@ -25,7 +25,7 @@ * @author Vincent Lascaux <vincentlascaux@php.net> * @copyright 1997-2005 The PHP Group * @license http://www.gnu.org/copyleft/lesser.html LGPL - * @version CVS: $Id: Gzip.php,v 1.3 2005/02/18 21:00:49 vincentlascaux Exp $ + * @version CVS: $Id: Gzip.php,v 1.4 2005/02/22 17:00:05 vincentlascaux Exp $ * @link http://pear.php.net/package/File_Archive */ @@ -65,38 +65,38 @@ return false; } - if($this->alreadyRead) - return FALSE; + if($this->alreadyRead) { + return false; + } $this->alreadyRead = true; $header = $this->source->getData(10); $id = unpack("H2id1/H2id2/C1tmp/C1flags",substr($header,0,4)); - if($id['id1'] != "1f" || $id['id2'] != "8b") - die("Not valid gz file (wrong header)"); + if($id['id1'] != "1f" || $id['id2'] != "8b") { + return PEAR::raiseError("Not valid gz file (wrong header)"); + } $temp = decbin($id['flags']); $this->hasName = ($temp & 0x8); $this->hasComment = ($temp & 0x4); $this->name = ""; - if($this->hasName) - { - while(($char = $this->source->getData(1)) !== "\0") - { - if($char === NULL) - die("Not valid gz file (unexpected end of archive reading filename)"); + if($this->hasName) { + while(($char = $this->source->getData(1)) !== "\0") { + if($char === null) { + return PEAR::raiseError("Not valid gz file (unexpected end of archive reading filename)"); + } $this->name .= $char; } $this->name = $this->getStandardURL($this->name); } $this->comment = ""; - if($this->hasComment) - { - while(($char = $this->source->getData(1)) !== "\0") - { - if($char === NULL) - die("Not valid gz file (unexpected end of archive reading comment)"); + if($this->hasComment) { + while(($char = $this->source->getData(1)) !== "\0") { + if($char === null) { + return PEAR::raiseError("Not valid gz file (unexpected end of archive reading comment)"); + } $this->comment .= $char; } } @@ -110,11 +110,12 @@ $this->data = gzinflate(substr($this->data,0,strlen($this->data)-8)); $this->offset = 0; - if($size != strlen($this->data)) - die("Not valid gz file (size error {$size} != ".strlen($this->data).")"); - if($crc32 != crc32 ($this->data)) - die("Not valid gz file (checksum error)"); - + if($size != strlen($this->data)) { + return PEAR::raiseError(("Not valid gz file (size error {$size} != ".strlen($this->data).")"); + } + if($crc32 != crc32 ($this->data)) { + return PEAR::raiseError(("Not valid gz file (checksum error)"); + } return TRUE; } /** @@ -138,14 +139,15 @@ */ function getData($length = -1) { - if($length == -1) + if($length == -1) { $actualLength = strlen($this->data) - $this->offset; - else + } else { $actualLength = min(strlen($this->data) - $this->offset, $length); + } - if($actualLength == 0) - return NULL; - else { + if($actualLength == 0) { + return null; + } else { $result = substr($this->data, $this->offset, $actualLength); $this->offset += $actualLength; return $result; http://cvs.php.net/diff.php/pear/File_Archive/Archive/Reader/MimeList.php?r1=1.5&r2=1.6&ty=u Index: pear/File_Archive/Archive/Reader/MimeList.php diff -u pear/File_Archive/Archive/Reader/MimeList.php:1.5 pear/File_Archive/Archive/Reader/MimeList.php:1.6 --- pear/File_Archive/Archive/Reader/MimeList.php:1.5 Mon Feb 21 19:32:05 2005 +++ pear/File_Archive/Archive/Reader/MimeList.php Tue Feb 22 12:00:05 2005 @@ -25,7 +25,7 @@ * @author Vincent Lascaux <vincentlascaux@php.net> * @copyright 1997-2005 The PHP Group * @license http://www.gnu.org/copyleft/lesser.html LGPL - * @version CVS: $Id: MimeList.php,v 1.5 2005/02/22 00:32:05 vincentlascaux Exp $ + * @version CVS: $Id: MimeList.php,v 1.6 2005/02/22 17:00:05 vincentlascaux Exp $ * @link http://pear.php.net/package/File_Archive */ @@ -37,458 +37,903 @@ { $pos = strrpos($filename, '.'); $extension = ""; - if($pos !== FALSE) { + if($pos !== false) { $extension = strtolower(substr($filename, $pos+1)); } - switch($extension) - { - case '3dmf': return 'x-world/x-3dmf'; - case 'a': return 'application/octet-stream'; - case 'aab': return 'application/x-authorware-bin'; - case 'aam': return 'application/x-authorware-map'; - case 'aas': return 'application/x-authorware-seg'; - case 'abc': return 'text/vnd.abc'; - case 'acgi': return 'text/html'; - case 'afl': return 'video/animaflex'; - case 'ai': return 'application/postscript'; - case 'aif': return 'audio/aiff'; - case 'aifc': return 'audio/aiff'; - case 'aiff': return 'audio/aiff'; - case 'aim': return 'application/x-aim'; - case 'aip': return 'text/x-audiosoft-intra'; - case 'ani': return 'application/x-navi-animation'; - case 'aos': return 'application/x-nokia-9000-communicator-add-on-software'; - case 'aps': return 'application/mime'; - case 'arc': return 'application/octet-stream'; - case 'arj': return 'application/arj'; - case 'art': return 'image/x-jg'; - case 'asf': return 'video/x-ms-asf'; - case 'asm': return 'text/x-asm'; - case 'asp': return 'text/asp'; - case 'asx': return 'application/x-mplayer2'; - case 'au': return 'audio/basic'; - case 'avi': return 'application/x-troff-msvideo'; - case 'avs': return 'video/avs-video'; - case 'bcpio': return 'application/x-bcpio'; - case 'bin': return 'application/x-binary'; - case 'bm': return 'image/bmp'; - case 'bmp': return 'image/bmp'; - case 'boo': return 'application/book'; - case 'book': return 'application/book'; - case 'boz': return 'application/x-bzip2'; - case 'bsh': return 'application/x-bsh'; - case 'bz': return 'application/x-bzip'; - case 'bz2': return 'application/x-bzip2'; - case 'c': return 'text/plain'; - case 'c++': return 'text/plain'; - case 'cat': return 'application/vnd.ms-pki.seccat'; - case 'cc': return 'text/plain'; - case 'ccad': return 'application/clariscad'; - case 'cco': return 'application/x-cocoa'; - case 'cdf': return 'application/cdf'; - case 'cer': return 'application/pkix-cert'; - case 'cha': return 'application/x-chat'; - case 'chat': return 'application/x-chat'; - case 'class': return 'application/java'; - case 'com': return 'application/octet-stream'; - case 'conf': return 'text/plain'; - case 'cpio': return 'application/x-cpio'; - case 'cpp': return 'text/x-c'; - case 'cpt': return 'application/mac-compactpro'; - case 'crl': return 'application/pkcs-crl'; - case 'csh': return 'application/x-csh'; - case 'css': return 'text/css'; - case 'cxx': return 'text/plain'; - case 'dcr': return 'application/x-director'; - case 'deepv': return 'application/x-deepv'; - case 'def': return 'text/plain'; - case 'der': return 'application/x-x509-ca-cert'; - case 'dif': return 'video/x-dv'; - case 'dir': return 'application/x-director'; - case 'dl': return 'video/dl'; - case 'doc': return 'application/msword'; - case 'dot': return 'application/msword'; - case 'dp': return 'application/commonground'; - case 'drw': return 'application/drafting'; - case 'dump': return 'application/octet-stream'; - case 'dv': return 'video/x-dv'; - case 'dvi': return 'application/x-dvi'; - case 'dwf': return 'drawing/x-dwf (old)'; - case 'dwg': return 'application/acad'; - case 'dxf': return 'application/dxf'; - case 'dxr': return 'application/x-director'; - case 'el': return 'text/x-script.elisp'; - case 'elc': return 'application/x-bytecode.elisp (compiled elisp)'; - case 'env': return 'application/x-envoy'; - case 'eps': return 'application/postscript'; - case 'es': return 'application/x-esrehber'; - case 'etx': return 'text/x-setext'; - case 'evy': return 'application/envoy'; - case 'exe': return 'application/octet-stream'; - case 'f': return 'text/plain'; - case 'f77': return 'text/x-fortran'; - case 'f90': return 'text/plain'; - case 'fdf': return 'application/vnd.fdf'; - case 'fif': return 'application/fractals'; - case 'fli': return 'video/fli'; - case 'flo': return 'image/florian'; - case 'flx': return 'text/vnd.fmi.flexstor'; - case 'fmf': return 'video/x-atomic3d-feature'; - case 'for': return 'text/plain'; - case 'fpx': return 'image/vnd.fpx'; - case 'frl': return 'application/freeloader'; - case 'funk': return 'audio/make'; - case 'g': return 'text/plain'; - case 'g3': return 'image/g3fax'; - case 'gif': return 'image/gif'; - case 'gl': return 'video/gl'; - case 'gsd': return 'audio/x-gsm'; - case 'gsm': return 'audio/x-gsm'; - case 'gsp': return 'application/x-gsp'; - case 'gss': return 'application/x-gss'; - case 'gtar': return 'application/x-gtar'; - case 'gz': return 'application/x-compressed'; - case 'gzip': return 'application/x-gzip'; - case 'h': return 'text/plain'; - case 'hdf': return 'application/x-hdf'; - case 'help': return 'application/x-helpfile'; - case 'hgl': return 'application/vnd.hp-hpgl'; - case 'hh': return 'text/plain'; - case 'hlb': return 'text/x-script'; - case 'hlp': return 'application/hlp'; - case 'hpg': return 'application/vnd.hp-hpgl'; - case 'hpgl': return 'application/vnd.hp-hpgl'; - case 'hqx': return 'application/binhex'; - case 'hta': return 'application/hta'; - case 'htc': return 'text/x-component'; - case 'htm': return 'text/html'; - case 'html': return 'text/html'; - case 'htmls': return 'text/html'; - case 'htt': return 'text/webviewhtml'; - case 'htx': return 'text/html'; - case 'ice': return 'x-conference/x-cooltalk'; - case 'ico': return 'image/x-icon'; - case 'idc': return 'text/plain'; - case 'ief': return 'image/ief'; - case 'iefs': return 'image/ief'; - case 'iges': return 'application/iges'; - case 'igs': return 'application/iges'; - case 'ima': return 'application/x-ima'; - case 'imap': return 'application/x-httpd-imap'; - case 'inf': return 'application/inf'; - case 'ins': return 'application/x-internett-signup'; - case 'ip': return 'application/x-ip2'; - case 'isu': return 'video/x-isvideo'; - case 'it': return 'audio/it'; - case 'iv': return 'application/x-inventor'; - case 'ivr': return 'i-world/i-vrml'; - case 'ivy': return 'application/x-livescreen'; - case 'jam': return 'audio/x-jam'; - case 'jav': return 'text/plain'; - case 'java': return 'text/plain'; - case 'jcm': return 'application/x-java-commerce'; - case 'jfif': return 'image/jpeg'; - case 'jfif-tbnl': return 'image/jpeg'; - case 'jpe': return 'image/jpeg'; - case 'jpeg': return 'image/jpeg'; - case 'jpg': return 'image/jpeg'; - case 'jps': return 'image/x-jps'; - case 'js': return 'application/x-javascript'; - case 'jut': return 'image/jutvision'; - case 'kar': return 'audio/midi'; - case 'ksh': return 'application/x-ksh'; - case 'la': return 'audio/nspaudio'; - case 'lam': return 'audio/x-liveaudio'; - case 'latex': return 'application/x-latex'; - case 'lha': return 'application/lha'; - case 'lhx': return 'application/octet-stream'; - case 'list': return 'text/plain'; - case 'lma': return 'audio/nspaudio'; - case 'log': return 'text/plain'; - case 'lsp': return 'application/x-lisp'; - case 'lst': return 'text/plain'; - case 'lsx': return 'text/x-la-asf'; - case 'ltx': return 'application/x-latex'; - case 'lzh': return 'application/octet-stream'; - case 'lzx': return 'application/lzx'; - case 'm': return 'text/plain'; - case 'm1v': return 'video/mpeg'; - case 'm2a': return 'audio/mpeg'; - case 'm2v': return 'video/mpeg'; - case 'm3u': return 'audio/x-mpequrl'; - case 'man': return 'application/x-troff-man'; - case 'map': return 'application/x-navimap'; - case 'mar': return 'text/plain'; - case 'mbd': return 'application/mbedlet'; - case 'mc$': return 'application/x-magic-cap-package-1.0'; - case 'mcd': return 'application/mcad'; - case 'mcf': return 'image/vasa'; - case 'mcp': return 'application/netmc'; - case 'me': return 'application/x-troff-me'; - case 'mht': return 'message/rfc822'; - case 'mhtml': return 'message/rfc822'; - case 'mid': return 'application/x-midi'; - case 'midi': return 'audio/midi'; - case 'mif': return 'application/x-frame'; - case 'mime': return 'message/rfc822'; - case 'mjf': return 'audio/x-vnd.audioexplosion.mjuicemediafile'; - case 'mjpg': return 'video/x-motion-jpeg'; - case 'mm': return 'application/base64'; - case 'mme': return 'application/base64'; - case 'mod': return 'audio/mod'; - case 'moov': return 'video/quicktime'; - case 'mov': return 'video/quicktime'; - case 'movie': return 'video/x-sgi-movie'; - case 'mp2': return 'video/mpeg'; - case 'mp3': return 'video/mpeg'; - case 'mpa': return 'audio/mpeg'; - case 'mpc': return 'application/x-project'; - case 'mpe': return 'video/mpeg'; - case 'mpeg': return 'video/mpeg'; - case 'mpg': return 'video/mpeg'; - case 'mpga': return 'audio/mpeg'; - case 'mpp': return 'application/vnd.ms-project'; - case 'mpt': return 'application/x-project'; - case 'mpv': return 'application/x-project'; - case 'mpx': return 'application/x-project'; - case 'mrc': return 'application/marc'; - case 'ms': return 'application/x-troff-ms'; - case 'mv': return 'video/x-sgi-movie'; - case 'my': return 'audio/make'; - case 'mzz': return 'application/x-vnd.audioexplosion.mzz'; - case 'nap': return 'image/naplps'; - case 'naplps': return 'image/naplps'; - case 'nc': return 'application/x-netcdf'; - case 'ncm': return 'application/vnd.nokia.configuration-message'; - case 'nif': return 'image/x-niff'; - case 'niff': return 'image/x-niff'; - case 'nix': return 'application/x-mix-transfer'; - case 'nsc': return 'application/x-conference'; - case 'nvd': return 'application/x-navidoc'; - case 'o': return 'application/octet-stream'; - case 'oda': return 'application/oda'; - case 'omc': return 'application/x-omc'; - case 'omcd': return 'application/x-omcdatamaker'; - case 'omcr': return 'application/x-omcregerator'; - case 'p': return 'text/x-pascal'; - case 'p10': return 'application/pkcs10'; - case 'p12': return 'application/pkcs-12'; - case 'p7a': return 'application/x-pkcs7-signature'; - case 'p7c': return 'application/pkcs7-mime'; - case 'p7m': return 'application/pkcs7-mime'; - case 'p7r': return 'application/x-pkcs7-certreqresp'; - case 'p7s': return 'application/pkcs7-signature'; - case 'part': return 'application/pro_eng'; - case 'pas': return 'text/pascal'; - case 'pbm': return 'image/x-portable-bitmap'; - case 'pcl': return 'application/vnd.hp-pcl'; - case 'pct': return 'image/x-pict'; - case 'pcx': return 'image/x-pcx'; - case 'pdb': return 'chemical/x-pdb'; - case 'pdf': return 'application/pdf'; - case 'pfunk': return 'audio/make'; - case 'pgm': return 'image/x-portable-graymap'; - case 'pic': return 'image/pict'; - case 'pict': return 'image/pict'; - case 'pkg': return 'application/x-newton-compatible-pkg'; - case 'pko': return 'application/vnd.ms-pki.pko'; - case 'pl': return 'text/plain'; - case 'plx': return 'application/x-pixclscript'; - case 'pm': return 'image/x-xpixmap'; - case 'pm4': return 'application/x-pagemaker'; - case 'pm5': return 'application/x-pagemaker'; - case 'png': return 'image/png'; - case 'pnm': return 'application/x-portable-anymap'; - case 'pot': return 'application/mspowerpoint'; - case 'pov': return 'model/x-pov'; - case 'ppa': return 'application/vnd.ms-powerpoint'; - case 'ppm': return 'image/x-portable-pixmap'; - case 'pps': return 'application/mspowerpoint'; - case 'ppt': return 'application/mspowerpoint'; - case 'ppz': return 'application/mspowerpoint'; - case 'pre': return 'application/x-freelance'; - case 'prt': return 'application/pro_eng'; - case 'ps': return 'application/postscript'; - case 'psd': return 'application/octet-stream'; - case 'pvu': return 'paleovu/x-pv'; - case 'pwz': return 'application/vnd.ms-powerpoint'; - case 'py': return 'text/x-script.phyton'; - case 'pyc': return 'applicaiton/x-bytecode.python'; - case 'qcp': return 'audio/vnd.qcelp'; - case 'qd3': return 'x-world/x-3dmf'; - case 'qd3d': return 'x-world/x-3dmf'; - case 'qif': return 'image/x-quicktime'; - case 'qt': return 'video/quicktime'; - case 'qtc': return 'video/x-qtc'; - case 'qti': return 'image/x-quicktime'; - case 'qtif': return 'image/x-quicktime'; - case 'ra': return 'audio/x-pn-realaudio'; - case 'ram': return 'audio/x-pn-realaudio'; - case 'ras': return 'application/x-cmu-raster'; - case 'rast': return 'image/cmu-raster'; - case 'rexx': return 'text/x-script.rexx'; - case 'rf': return 'image/vnd.rn-realflash'; - case 'rgb': return 'image/x-rgb'; - case 'rm': return 'application/vnd.rn-realmedia'; - case 'rmi': return 'audio/mid'; - case 'rmm': return 'audio/x-pn-realaudio'; - case 'rmp': return 'audio/x-pn-realaudio'; - case 'rng': return 'application/ringing-tones'; - case 'rnx': return 'application/vnd.rn-realplayer'; - case 'roff': return 'application/x-troff'; - case 'rp': return 'image/vnd.rn-realpix'; - case 'rpm': return 'audio/x-pn-realaudio-plugin'; - case 'rt': return 'text/richtext'; - case 'rtf': return 'application/rtf'; - case 'rtx': return 'text/richtext'; - case 'rv': return 'video/vnd.rn-realvideo'; - case 's': return 'text/x-asm'; - case 's3m': return 'audio/s3m'; - case 'saveme': return 'application/octet-stream'; - case 'sbk': return 'application/x-tbook'; - case 'scm': return 'application/x-lotusscreencam'; - case 'sdml': return 'text/plain'; - case 'sdp': return 'application/sdp'; - case 'sdr': return 'application/sounder'; - case 'sea': return 'application/sea'; - case 'set': return 'application/set'; - case 'sgm': return 'text/sgml'; - case 'sgml': return 'text/sgml'; - case 'sh': return 'application/x-bsh'; - case 'shar': return 'application/x-bsh'; - case 'shtml': return 'text/html'; - case 'sid': return 'audio/x-psid'; - case 'sit': return 'application/x-sit'; - case 'skd': return 'application/x-koan'; - case 'skm': return 'application/x-koan'; - case 'skp': return 'application/x-koan'; - case 'skt': return 'application/x-koan'; - case 'sl': return 'application/x-seelogo'; - case 'smi': return 'application/smil'; - case 'smil': return 'application/smil'; - case 'snd': return 'audio/basic'; - case 'sol': return 'application/solids'; - case 'spc': return 'application/x-pkcs7-certificates'; - case 'spl': return 'application/futuresplash'; - case 'spr': return 'application/x-sprite'; - case 'sprite': return 'application/x-sprite'; - case 'src': return 'application/x-wais-source'; - case 'ssi': return 'text/x-server-parsed-html'; - case 'ssm': return 'application/streamingmedia'; - case 'sst': return 'application/vnd.ms-pki.certstore'; - case 'step': return 'application/step'; - case 'stl': return 'application/sla'; - case 'stp': return 'application/step'; - case 'sv4cpio': return 'application/x-sv4cpio'; - case 'sv4crc': return 'application/x-sv4crc'; - case 'svf': return 'image/vnd.dwg'; - case 'svr': return 'application/x-world'; - case 'swf': return 'application/x-shockwave-flash'; - case 't': return 'application/x-troff'; - case 'talk': return 'text/x-speech'; - case 'tar': return 'application/x-tar'; - case 'tbk': return 'application/toolbook'; - case 'tcl': return 'application/x-tcl'; - case 'tcsh': return 'text/x-script.tcsh'; - case 'tex': return 'application/x-tex'; - case 'texi': return 'application/x-texinfo'; - case 'texinfo': return 'application/x-texinfo'; - case 'text': return 'text/plain'; - case 'tgz': return 'application/x-compressed'; - case 'tif': return 'image/tiff'; - case 'tiff': return 'image/tiff'; - case 'tr': return 'application/x-troff'; - case 'tsi': return 'audio/tsp-audio'; - case 'tsp': return 'application/dsptype'; - case 'tsv': return 'text/tab-separated-values'; - case 'turbot': return 'image/florian'; - case 'txt': return 'text/plain'; - case 'uil': return 'text/x-uil'; - case 'uni': return 'text/uri-list'; - case 'unis': return 'text/uri-list'; - case 'unv': return 'application/i-deas'; - case 'uri': return 'text/uri-list'; - case 'uris': return 'text/uri-list'; - case 'ustar': return 'multipart/x-ustar'; - case 'uu': return 'application/octet-stream'; - case 'uue': return 'text/x-uuencode'; - case 'vcd': return 'application/x-cdlink'; - case 'vcs': return 'text/x-vcalendar'; - case 'vda': return 'application/vda'; - case 'vdo': return 'video/vdo'; - case 'vew': return 'application/groupwise'; - case 'viv': return 'video/vivo'; - case 'vivo': return 'video/vivo'; - case 'vmd': return 'application/vocaltec-media-desc'; - case 'vmf': return 'application/vocaltec-media-file'; - case 'voc': return 'audio/voc'; - case 'vos': return 'video/vosaic'; - case 'vox': return 'audio/voxware'; - case 'vqe': return 'audio/x-twinvq-plugin'; - case 'vqf': return 'audio/x-twinvq'; - case 'vql': return 'audio/x-twinvq-plugin'; - case 'vrml': return 'application/x-vrml'; - case 'vrt': return 'x-world/x-vrt'; - case 'vsd': return 'application/x-visio'; - case 'vst': return 'application/x-visio'; - case 'vsw': return 'application/x-visio'; - case 'w60': return 'application/wordperfect6.0'; - case 'w61': return 'application/wordperfect6.1'; - case 'w6w': return 'application/msword'; - case 'wav': return 'audio/wav'; - case 'wb1': return 'application/x-qpro'; - case 'wbmp': return 'image/vnd.wap.wbmp'; - case 'web': return 'application/vnd.xara'; - case 'wiz': return 'application/msword'; - case 'wk1': return 'application/x-123'; - case 'wmf': return 'windows/metafile'; - case 'wml': return 'text/vnd.wap.wml'; - case 'wmlc': return 'application/vnd.wap.wmlc'; - case 'wmls': return 'text/vnd.wap.wmlscript'; - case 'wmlsc': return 'application/vnd.wap.wmlscriptc'; - case 'word': return 'application/msword'; - case 'wp': return 'application/wordperfect'; - case 'wp5': return 'application/wordperfect6.0'; - case 'wp6': return 'application/wordperfect'; - case 'wpd': return 'application/x-wpwin'; - case 'wq1': return 'application/x-lotus'; - case 'wri': return 'application/mswrite'; - case 'wrl': return 'model/vrml'; - case 'wrz': return 'model/vrml'; - case 'wsc': return 'text/scriplet'; - case 'wsrc': return 'application/x-wais-source'; - case 'wtk': return 'application/x-wintalk'; - case 'xbm': return 'image/x-xbitmap'; - case 'xdr': return 'video/x-amt-demorun'; - case 'xgz': return 'xgl/drawing'; - case 'xif': return 'image/vnd.xiff'; - case 'xl': return 'application/excel'; - case 'xla': return 'application/excel'; - case 'xlb': return 'application/excel'; - case 'xlc': return 'application/excel'; - case 'xld': return 'application/excel'; - case 'xlk': return 'application/excel'; - case 'xll': return 'application/excel'; - case 'xlm': return 'application/excel'; - case 'xls': return 'application/excel'; - case 'xlt': return 'application/excel'; - case 'xlv': return 'application/excel'; - case 'xlw': return 'application/excel'; - case 'xm': return 'audio/xm'; - case 'xml': return 'application/xml'; - case 'xmz': return 'xgl/movie'; - case 'xpix': return 'application/x-vnd.ls-xpix'; - case 'xpm': return 'image/xpm'; - case 'x-png': return 'image/png'; - case 'xsr': return 'video/x-amt-showrun'; - case 'xwd': return 'image/x-xwd'; - case 'xyz': return 'chemical/x-pdb'; - case 'z': return 'application/x-compress'; - case 'zip': return 'application/x-compressed'; - case 'zoo': return 'application/octet-stream'; - case 'zsh': return 'text/x-script.zsh'; - default: return 'application/octet-stream'; + switch($extension) { + case '3dmf': + return 'x-world/x-3dmf'; + case 'a': + return 'application/octet-stream'; + case 'aab': + return 'application/x-authorware-bin'; + case 'aam': + return 'application/x-authorware-map'; + case 'aas': + return 'application/x-authorware-seg'; + case 'abc': + return 'text/vnd.abc'; + case 'acgi': + return 'text/html'; + case 'afl': + return 'video/animaflex'; + case 'ai': + return 'application/postscript'; + case 'aif': + return 'audio/aiff'; + case 'aifc': + return 'audio/aiff'; + case 'aiff': + return 'audio/aiff'; + case 'aim': + return 'application/x-aim'; + case 'aip': + return 'text/x-audiosoft-intra'; + case 'ani': + return 'application/x-navi-animation'; + case 'aos': + return 'application/x-nokia-9000-communicator-add-on-software'; + case 'aps': + return 'application/mime'; + case 'arc': + return 'application/octet-stream'; + case 'arj': + return 'application/arj'; + case 'art': + return 'image/x-jg'; + case 'asf': + return 'video/x-ms-asf'; + case 'asm': + return 'text/x-asm'; + case 'asp': + return 'text/asp'; + case 'asx': + return 'application/x-mplayer2'; + case 'au': + return 'audio/basic'; + case 'avi': + return 'application/x-troff-msvideo'; + case 'avs': + return 'video/avs-video'; + case 'bcpio': + return 'application/x-bcpio'; + case 'bin': + return 'application/x-binary'; + case 'bm': + return 'image/bmp'; + case 'bmp': + return 'image/bmp'; + case 'boo': + return 'application/book'; + case 'book': + return 'application/book'; + case 'boz': + return 'application/x-bzip2'; + case 'bsh': + return 'application/x-bsh'; + case 'bz': + return 'application/x-bzip'; + case 'bz2': + return 'application/x-bzip2'; + case 'c': + return 'text/plain'; + case 'c++': + return 'text/plain'; + case 'cat': + return 'application/vnd.ms-pki.seccat'; + case 'cc': + return 'text/plain'; + case 'ccad': + return 'application/clariscad'; + case 'cco': + return 'application/x-cocoa'; + case 'cdf': + return 'application/cdf'; + case 'cer': + return 'application/pkix-cert'; + case 'cha': + return 'application/x-chat'; + case 'chat': + return 'application/x-chat'; + case 'class': + return 'application/java'; + case 'com': + return 'application/octet-stream'; + case 'conf': + return 'text/plain'; + case 'cpio': + return 'application/x-cpio'; + case 'cpp': + return 'text/x-c'; + case 'cpt': + return 'application/mac-compactpro'; + case 'crl': + return 'application/pkcs-crl'; + case 'csh': + return 'application/x-csh'; + case 'css': + return 'text/css'; + case 'cxx': + return 'text/plain'; + case 'dcr': + return 'application/x-director'; + case 'deepv': + return 'application/x-deepv'; + case 'def': + return 'text/plain'; + case 'der': + return 'application/x-x509-ca-cert'; + case 'dif': + return 'video/x-dv'; + case 'dir': + return 'application/x-director'; + case 'dl': + return 'video/dl'; + case 'doc': + return 'application/msword'; + case 'dot': + return 'application/msword'; + case 'dp': + return 'application/commonground'; + case 'drw': + return 'application/drafting'; + case 'dump': + return 'application/octet-stream'; + case 'dv': + return 'video/x-dv'; + case 'dvi': + return 'application/x-dvi'; + case 'dwf': + return 'drawing/x-dwf (old)'; + case 'dwg': + return 'application/acad'; + case 'dxf': + return 'application/dxf'; + case 'dxr': + return 'application/x-director'; + case 'el': + return 'text/x-script.elisp'; + case 'elc': + return 'application/x-bytecode.elisp (compiled elisp)'; + case 'env': + return 'application/x-envoy'; + case 'eps': + return 'application/postscript'; + case 'es': + return 'application/x-esrehber'; + case 'etx': + return 'text/x-setext'; + case 'evy': + return 'application/envoy'; + case 'exe': + return 'application/octet-stream'; + case 'f': + return 'text/plain'; + case 'f77': + return 'text/x-fortran'; + case 'f90': + return 'text/plain'; + case 'fdf': + return 'application/vnd.fdf'; + case 'fif': + return 'application/fractals'; + case 'fli': + return 'video/fli'; + case 'flo': + return 'image/florian'; + case 'flx': + return 'text/vnd.fmi.flexstor'; + case 'fmf': + return 'video/x-atomic3d-feature'; + case 'for': + return 'text/plain'; + case 'fpx': + return 'image/vnd.fpx'; + case 'frl': + return 'application/freeloader'; + case 'funk': + return 'audio/make'; + case 'g': + return 'text/plain'; + case 'g3': + return 'image/g3fax'; + case 'gif': + return 'image/gif'; + case 'gl': + return 'video/gl'; + case 'gsd': + return 'audio/x-gsm'; + case 'gsm': + return 'audio/x-gsm'; + case 'gsp': + return 'application/x-gsp'; + case 'gss': + return 'application/x-gss'; + case 'gtar': + return 'application/x-gtar'; + case 'gz': + return 'application/x-compressed'; + case 'gzip': + return 'application/x-gzip'; + case 'h': + return 'text/plain'; + case 'hdf': + return 'application/x-hdf'; + case 'help': + return 'application/x-helpfile'; + case 'hgl': + return 'application/vnd.hp-hpgl'; + case 'hh': + return 'text/plain'; + case 'hlb': + return 'text/x-script'; + case 'hlp': + return 'application/hlp'; + case 'hpg': + return 'application/vnd.hp-hpgl'; + case 'hpgl': + return 'application/vnd.hp-hpgl'; + case 'hqx': + return 'application/binhex'; + case 'hta': + return 'application/hta'; + case 'htc': + return 'text/x-component'; + case 'htm': + return 'text/html'; + case 'html': + return 'text/html'; + case 'htmls': + return 'text/html'; + case 'htt': + return 'text/webviewhtml'; + case 'htx': + return 'text/html'; + case 'ice': + return 'x-conference/x-cooltalk'; + case 'ico': + return 'image/x-icon'; + case 'idc': + return 'text/plain'; + case 'ief': + return 'image/ief'; + case 'iefs': + return 'image/ief'; + case 'iges': + return 'application/iges'; + case 'igs': + return 'application/iges'; + case 'ima': + return 'application/x-ima'; + case 'imap': + return 'application/x-httpd-imap'; + case 'inf': + return 'application/inf'; + case 'ins': + return 'application/x-internett-signup'; + case 'ip': + return 'application/x-ip2'; + case 'isu': + return 'video/x-isvideo'; + case 'it': + return 'audio/it'; + case 'iv': + return 'application/x-inventor'; + case 'ivr': + return 'i-world/i-vrml'; + case 'ivy': + return 'application/x-livescreen'; + case 'jam': + return 'audio/x-jam'; + case 'jav': + return 'text/plain'; + case 'java': + return 'text/plain'; + case 'jcm': + return 'application/x-java-commerce'; + case 'jfif': + return 'image/jpeg'; + case 'jfif-tbnl': + return 'image/jpeg'; + case 'jpe': + return 'image/jpeg'; + case 'jpeg': + return 'image/jpeg'; + case 'jpg': + return 'image/jpeg'; + case 'jps': + return 'image/x-jps'; + case 'js': + return 'application/x-javascript'; + case 'jut': + return 'image/jutvision'; + case 'kar': + return 'audio/midi'; + case 'ksh': + return 'application/x-ksh'; + case 'la': + return 'audio/nspaudio'; + case 'lam': + return 'audio/x-liveaudio'; + case 'latex': + return 'application/x-latex'; + case 'lha': + return 'application/lha'; + case 'lhx': + return 'application/octet-stream'; + case 'list': + return 'text/plain'; + case 'lma': + return 'audio/nspaudio'; + case 'log': + return 'text/plain'; + case 'lsp': + return 'application/x-lisp'; + case 'lst': + return 'text/plain'; + case 'lsx': + return 'text/x-la-asf'; + case 'ltx': + return 'application/x-latex'; + case 'lzh': + return 'application/octet-stream'; + case 'lzx': + return 'application/lzx'; + case 'm': + return 'text/plain'; + case 'm1v': + return 'video/mpeg'; + case 'm2a': + return 'audio/mpeg'; + case 'm2v': + return 'video/mpeg'; + case 'm3u': + return 'audio/x-mpequrl'; + case 'man': + return 'application/x-troff-man'; + case 'map': + return 'application/x-navimap'; + case 'mar': + return 'text/plain'; + case 'mbd': + return 'application/mbedlet'; + case 'mc$': + return 'application/x-magic-cap-package-1.0'; + case 'mcd': + return 'application/mcad'; + case 'mcf': + return 'image/vasa'; + case 'mcp': + return 'application/netmc'; + case 'me': + return 'application/x-troff-me'; + case 'mht': + return 'message/rfc822'; + case 'mhtml': + return 'message/rfc822'; + case 'mid': + return 'application/x-midi'; + case 'midi': + return 'audio/midi'; + case 'mif': + return 'application/x-frame'; + case 'mime': + return 'message/rfc822'; + case 'mjf': + return 'audio/x-vnd.audioexplosion.mjuicemediafile'; + case 'mjpg': + return 'video/x-motion-jpeg'; + case 'mm': + return 'application/base64'; + case 'mme': + return 'application/base64'; + case 'mod': + return 'audio/mod'; + case 'moov': + return 'video/quicktime'; + case 'mov': + return 'video/quicktime'; + case 'movie': + return 'video/x-sgi-movie'; + case 'mp2': + return 'video/mpeg'; + case 'mp3': + return 'video/mpeg'; + case 'mpa': + return 'audio/mpeg'; + case 'mpc': + return 'application/x-project'; + case 'mpe': + return 'video/mpeg'; + case 'mpeg': + return 'video/mpeg'; + case 'mpg': + return 'video/mpeg'; + case 'mpga': + return 'audio/mpeg'; + case 'mpp': + return 'application/vnd.ms-project'; + case 'mpt': + return 'application/x-project'; + case 'mpv': + return 'application/x-project'; + case 'mpx': + return 'application/x-project'; + case 'mrc': + return 'application/marc'; + case 'ms': + return 'application/x-troff-ms'; + case 'mv': + return 'video/x-sgi-movie'; + case 'my': + return 'audio/make'; + case 'mzz': + return 'application/x-vnd.audioexplosion.mzz'; + case 'nap': + return 'image/naplps'; + case 'naplps': + return 'image/naplps'; + case 'nc': + return 'application/x-netcdf'; + case 'ncm': + return 'application/vnd.nokia.configuration-message'; + case 'nif': + return 'image/x-niff'; + case 'niff': + return 'image/x-niff'; + case 'nix': + return 'application/x-mix-transfer'; + case 'nsc': + return 'application/x-conference'; + case 'nvd': + return 'application/x-navidoc'; + case 'o': + return 'application/octet-stream'; + case 'oda': + return 'application/oda'; + case 'omc': + return 'application/x-omc'; + case 'omcd': + return 'application/x-omcdatamaker'; + case 'omcr': + return 'application/x-omcregerator'; + case 'p': + return 'text/x-pascal'; + case 'p10': + return 'application/pkcs10'; + case 'p12': + return 'application/pkcs-12'; + case 'p7a': + return 'application/x-pkcs7-signature'; + case 'p7c': + return 'application/pkcs7-mime'; + case 'p7m': + return 'application/pkcs7-mime'; + case 'p7r': + return 'application/x-pkcs7-certreqresp'; + case 'p7s': + return 'application/pkcs7-signature'; + case 'part': + return 'application/pro_eng'; + case 'pas': + return 'text/pascal'; + case 'pbm': + return 'image/x-portable-bitmap'; + case 'pcl': + return 'application/vnd.hp-pcl'; + case 'pct': + return 'image/x-pict'; + case 'pcx': + return 'image/x-pcx'; + case 'pdb': + return 'chemical/x-pdb'; + case 'pdf': + return 'application/pdf'; + case 'pfunk': + return 'audio/make'; + case 'pgm': + return 'image/x-portable-graymap'; + case 'pic': + return 'image/pict'; + case 'pict': + return 'image/pict'; + case 'pkg': + return 'application/x-newton-compatible-pkg'; + case 'pko': + return 'application/vnd.ms-pki.pko'; + case 'pl': + return 'text/plain'; + case 'plx': + return 'application/x-pixclscript'; + case 'pm': + return 'image/x-xpixmap'; + case 'pm4': + return 'application/x-pagemaker'; + case 'pm5': + return 'application/x-pagemaker'; + case 'png': + return 'image/png'; + case 'pnm': + return 'application/x-portable-anymap'; + case 'pot': + return 'application/mspowerpoint'; + case 'pov': + return 'model/x-pov'; + case 'ppa': + return 'application/vnd.ms-powerpoint'; + case 'ppm': + return 'image/x-portable-pixmap'; + case 'pps': + return 'application/mspowerpoint'; + case 'ppt': + return 'application/mspowerpoint'; + case 'ppz': + return 'application/mspowerpoint'; + case 'pre': + return 'application/x-freelance'; + case 'prt': + return 'application/pro_eng'; + case 'ps': + return 'application/postscript'; + case 'psd': + return 'application/octet-stream'; + case 'pvu': + return 'paleovu/x-pv'; + case 'pwz': + return 'application/vnd.ms-powerpoint'; + case 'py': + return 'text/x-script.phyton'; + case 'pyc': + return 'applicaiton/x-bytecode.python'; + case 'qcp': + return 'audio/vnd.qcelp'; + case 'qd3': + return 'x-world/x-3dmf'; + case 'qd3d': + return 'x-world/x-3dmf'; + case 'qif': + return 'image/x-quicktime'; + case 'qt': + return 'video/quicktime'; + case 'qtc': + return 'video/x-qtc'; + case 'qti': + return 'image/x-quicktime'; + case 'qtif': + return 'image/x-quicktime'; + case 'ra': + return 'audio/x-pn-realaudio'; + case 'ram': + return 'audio/x-pn-realaudio'; + case 'ras': + return 'application/x-cmu-raster'; + case 'rast': + return 'image/cmu-raster'; + case 'rexx': + return 'text/x-script.rexx'; + case 'rf': + return 'image/vnd.rn-realflash'; + case 'rgb': + return 'image/x-rgb'; + case 'rm': + return 'application/vnd.rn-realmedia'; + case 'rmi': + return 'audio/mid'; + case 'rmm': + return 'audio/x-pn-realaudio'; + case 'rmp': + return 'audio/x-pn-realaudio'; + case 'rng': + return 'application/ringing-tones'; + case 'rnx': + return 'application/vnd.rn-realplayer'; + case 'roff': + return 'application/x-troff'; + case 'rp': + return 'image/vnd.rn-realpix'; + case 'rpm': + return 'audio/x-pn-realaudio-plugin'; + case 'rt': + return 'text/richtext'; + case 'rtf': + return 'application/rtf'; + case 'rtx': + return 'text/richtext'; + case 'rv': + return 'video/vnd.rn-realvideo'; + case 's': + return 'text/x-asm'; + case 's3m': + return 'audio/s3m'; + case 'saveme': + return 'application/octet-stream'; + case 'sbk': + return 'application/x-tbook'; + case 'scm': + return 'application/x-lotusscreencam'; + case 'sdml': + return 'text/plain'; + case 'sdp': + return 'application/sdp'; + case 'sdr': + return 'application/sounder'; + case 'sea': + return 'application/sea'; + case 'set': + return 'application/set'; + case 'sgm': + return 'text/sgml'; + case 'sgml': + return 'text/sgml'; + case 'sh': + return 'application/x-bsh'; + case 'shar': + return 'application/x-bsh'; + case 'shtml': + return 'text/html'; + case 'sid': + return 'audio/x-psid'; + case 'sit': + return 'application/x-sit'; + case 'skd': + return 'application/x-koan'; + case 'skm': + return 'application/x-koan'; + case 'skp': + return 'application/x-koan'; + case 'skt': + return 'application/x-koan'; + case 'sl': + return 'application/x-seelogo'; + case 'smi': + return 'application/smil'; + case 'smil': + return 'application/smil'; + case 'snd': + return 'audio/basic'; + case 'sol': + return 'application/solids'; + case 'spc': + return 'application/x-pkcs7-certificates'; + case 'spl': + return 'application/futuresplash'; + case 'spr': + return 'application/x-sprite'; + case 'sprite': + return 'application/x-sprite'; + case 'src': + return 'application/x-wais-source'; + case 'ssi': + return 'text/x-server-parsed-html'; + case 'ssm': + return 'application/streamingmedia'; + case 'sst': + return 'application/vnd.ms-pki.certstore'; + case 'step': + return 'application/step'; + case 'stl': + return 'application/sla'; + case 'stp': + return 'application/step'; + case 'sv4cpio': + return 'application/x-sv4cpio'; + case 'sv4crc': + return 'application/x-sv4crc'; + case 'svf': + return 'image/vnd.dwg'; + case 'svr': + return 'application/x-world'; + case 'swf': + return 'application/x-shockwave-flash'; + case 't': + return 'application/x-troff'; + case 'talk': + return 'text/x-speech'; + case 'tar': + return 'application/x-tar'; + case 'tbk': + return 'application/toolbook'; + case 'tcl': + return 'application/x-tcl'; + case 'tcsh': + return 'text/x-script.tcsh'; + case 'tex': + return 'application/x-tex'; + case 'texi': + return 'application/x-texinfo'; + case 'texinfo': + return 'application/x-texinfo'; + case 'text': + return 'text/plain'; + case 'tgz': + return 'application/x-compressed'; + case 'tif': + return 'image/tiff'; + case 'tiff': + return 'image/tiff'; + case 'tr': + return 'application/x-troff'; + case 'tsi': + return 'audio/tsp-audio'; + case 'tsp': + return 'application/dsptype'; + case 'tsv': + return 'text/tab-separated-values'; + case 'turbot': + return 'image/florian'; + case 'txt': + return 'text/plain'; + case 'uil': + return 'text/x-uil'; + case 'uni': + return 'text/uri-list'; + case 'unis': + return 'text/uri-list'; + case 'unv': + return 'application/i-deas'; + case 'uri': + return 'text/uri-list'; + case 'uris': + return 'text/uri-list'; + case 'ustar': + return 'multipart/x-ustar'; + case 'uu': + return 'application/octet-stream'; + case 'uue': + return 'text/x-uuencode'; + case 'vcd': + return 'application/x-cdlink'; + case 'vcs': + return 'text/x-vcalendar'; + case 'vda': + return 'application/vda'; + case 'vdo': + return 'video/vdo'; + case 'vew': + return 'application/groupwise'; + case 'viv': + return 'video/vivo'; + case 'vivo': + return 'video/vivo'; + case 'vmd': + return 'application/vocaltec-media-desc'; + case 'vmf': + return 'application/vocaltec-media-file'; + case 'voc': + return 'audio/voc'; + case 'vos': + return 'video/vosaic'; + case 'vox': + return 'audio/voxware'; + case 'vqe': + return 'audio/x-twinvq-plugin'; + case 'vqf': + return 'audio/x-twinvq'; + case 'vql': + return 'audio/x-twinvq-plugin'; + case 'vrml': + return 'application/x-vrml'; + case 'vrt': + return 'x-world/x-vrt'; + case 'vsd': + return 'application/x-visio'; + case 'vst': + return 'application/x-visio'; + case 'vsw': + return 'application/x-visio'; + case 'w60': + return 'application/wordperfect6.0'; + case 'w61': + return 'application/wordperfect6.1'; + case 'w6w': + return 'application/msword'; + case 'wav': + return 'audio/wav'; + case 'wb1': + return 'application/x-qpro'; + case 'wbmp': + return 'image/vnd.wap.wbmp'; + case 'web': + return 'application/vnd.xara'; + case 'wiz': + return 'application/msword'; + case 'wk1': + return 'application/x-123'; + case 'wmf': + return 'windows/metafile'; + case 'wml': + return 'text/vnd.wap.wml'; + case 'wmlc': + return 'application/vnd.wap.wmlc'; + case 'wmls': + return 'text/vnd.wap.wmlscript'; + case 'wmlsc': + return 'application/vnd.wap.wmlscriptc'; + case 'word': + return 'application/msword'; + case 'wp': + return 'application/wordperfect'; + case 'wp5': + return 'application/wordperfect6.0'; + case 'wp6': + return 'application/wordperfect'; + case 'wpd': + return 'application/x-wpwin'; + case 'wq1': + return 'application/x-lotus'; + case 'wri': + return 'application/mswrite'; + case 'wrl': + return 'model/vrml'; + case 'wrz': + return 'model/vrml'; + case 'wsc': + return 'text/scriplet'; + case 'wsrc': + return 'application/x-wais-source'; + case 'wtk': + return 'application/x-wintalk'; + case 'xbm': + return 'image/x-xbitmap'; + case 'xdr': + return 'video/x-amt-demorun'; + case 'xgz': + return 'xgl/drawing'; + case 'xif': + return 'image/vnd.xiff'; + case 'xl': + return 'application/excel'; + case 'xla': + return 'application/excel'; + case 'xlb': + return 'application/excel'; + case 'xlc': + return 'application/excel'; + case 'xld': + return 'application/excel'; + case 'xlk': + return 'application/excel'; + case 'xll': + return 'application/excel'; + case 'xlm': + return 'application/excel'; + case 'xls': + return 'application/excel'; + case 'xlt': + return 'application/excel'; + case 'xlv': + return 'application/excel'; + case 'xlw': + return 'application/excel'; + case 'xm': + return 'audio/xm'; + case 'xml': + return 'application/xml'; + case 'xmz': + return 'xgl/movie'; + case 'xpix': + return 'application/x-vnd.ls-xpix'; + case 'xpm': + return 'image/xpm'; + case 'x-png': + return 'image/png'; + case 'xsr': + return 'video/x-amt-showrun'; + case 'xwd': + return 'image/x-xwd'; + case 'xyz': + return 'chemical/x-pdb'; + case 'z': + return 'application/x-compress'; + case 'zip': + return 'application/x-compressed'; + case 'zoo': + return 'application/octet-stream'; + case 'zsh': + return 'text/x-script.zsh'; + default: + return 'application/octet-stream'; } } ?> \ No newline at end of file http://cvs.php.net/diff.php/pear/File_Archive/Archive/Reader/Multi.php?r1=1.5&r2=1.6&ty=u Index: pear/File_Archive/Archive/Reader/Multi.php diff -u pear/File_Archive/Archive/Reader/Multi.php:1.5 pear/File_Archive/Archive/Reader/Multi.php:1.6 --- pear/File_Archive/Archive/Reader/Multi.php:1.5 Sun Feb 20 08:24:25 2005 +++ pear/File_Archive/Archive/Reader/Multi.php Tue Feb 22 12:00:05 2005 @@ -25,7 +25,7 @@ * @author Vincent Lascaux <vincentlascaux@php.net> * @copyright 1997-2005 The PHP Group * @license http://www.gnu.org/copyleft/lesser.html LGPL - * @version CVS: $Id: Multi.php,v 1.5 2005/02/20 13:24:25 vincentlascaux Exp $ + * @version CVS: $Id: Multi.php,v 1.6 2005/02/22 17:00:05 vincentlascaux Exp $ * @link http://pear.php.net/package/File_Archive */ @@ -61,8 +61,7 @@ */ function next() { - while(array_key_exists($this->currentIndex, $this->sources)) - { + while(array_key_exists($this->currentIndex, $this->sources)) { $this->source =& $this->sources[$this->currentIndex]; if($this->source->next()) { http://cvs.php.net/diff.php/pear/File_Archive/Archive/Reader/Tar.php?r1=1.4&r2=1.5&ty=u Index: pear/File_Archive/Archive/Reader/Tar.php diff -u pear/File_Archive/Archive/Reader/Tar.php:1.4 pear/File_Archive/Archive/Reader/Tar.php:1.5 --- pear/File_Archive/Archive/Reader/Tar.php:1.4 Fri Feb 18 16:00:49 2005 +++ pear/File_Archive/Archive/Reader/Tar.php Tue Feb 22 12:00:05 2005 @@ -25,7 +25,7 @@ * @author Vincent Lascaux <vincentlascaux@php.net> * @copyright 1997-2005 The PHP Group * @license http://www.gnu.org/copyleft/lesser.html LGPL - * @version CVS: $Id: Tar.php,v 1.4 2005/02/18 21:00:49 vincentlascaux Exp $ + * @version CVS: $Id: Tar.php,v 1.5 2005/02/22 17:00:05 vincentlascaux Exp $ * @link http://pear.php.net/package/File_Archive */ @@ -127,10 +127,12 @@ } $checksum = 8*ord(" "); - for($i = 0; $i < 148; $i++) + for($i = 0; $i < 148; $i++) { $checksum += ord($rawHeader{$i}); - for($i = 156; $i < 512; $i++) + } + for($i = 156; $i < 512; $i++) { $checksum += ord($rawHeader{$i}); + } if(octdec($header['checksum']) != $checksum) { die('Checksum error on entry '.$this->currentFilename); http://cvs.php.net/diff.php/pear/File_Archive/Archive/Reader/Uncompress.php?r1=1.7&r2=1.8&ty=u Index: pear/File_Archive/Archive/Reader/Uncompress.php diff -u pear/File_Archive/Archive/Reader/Uncompress.php:1.7 pear/File_Archive/Archive/Reader/Uncompress.php:1.8 --- pear/File_Archive/Archive/Reader/Uncompress.php:1.7 Sat Feb 19 15:29:33 2005 +++ pear/File_Archive/Archive/Reader/Uncompress.php Tue Feb 22 12:00:05 2005 @@ -25,7 +25,7 @@ * @author Vincent Lascaux <vincentlascaux@php.net> * @copyright 1997-2005 The PHP Group * @license http://www.gnu.org/copyleft/lesser.html LGPL - * @version CVS: $Id: Uncompress.php,v 1.7 2005/02/19 20:29:33 vincentlascaux Exp $ + * @version CVS: $Id: Uncompress.php,v 1.8 2005/02/22 17:00:05 vincentlascaux Exp $ * @link http://pear.php.net/package/File_Archive */ @@ -122,8 +122,7 @@ $extension = strtolower(substr($filename, $pos+1)); } - switch($extension) - { + switch($extension) { case "tar": require_once "Tar.php"; $this->readers[count($this->readers)] =& $this->source; @@ -157,7 +156,8 @@ ) ); break; - default: return false; + default: + return false; } unset($this->source); $this->source = $next; @@ -172,13 +172,10 @@ $this->currentFileDisplayed = true; return true; } - while(true) - { + while(true) { //Remove the readers we have completly read from the stack - do - { - while(! $this->source->next()) - { + do { + while(! $this->source->next()) { if(empty($this->readers)) { return false; } @@ -208,8 +205,9 @@ $this->baseDirCompressionLevel = count($this->readers); } - if(! $this->push()) + if(! $this->push()) { return true; + } } } /** @@ -221,9 +219,6 @@ { $this->baseDirUncompressionLevel = null; $this->baseDir = $baseDir; -/* if(substr($this->baseDir,-1)=='/') { - $this->baseDir=substr($this->baseDir, 0, -1); - } */ if(! $this->next()) { return PEAR::raiseError("No directory $baseDir in inner reader"); @@ -240,8 +235,7 @@ $this->close(); - while($this->source->next()) - { + while($this->source->next()) { $currentFilename = $this->source->getFilename().'/'; $compLength = min(strlen($currentFilename), strlen($filename)); if( strncmp($currentFilename, $std, $compLength) == 0 ) { http://cvs.php.net/diff.php/pear/File_Archive/Archive/Reader/Zip.php?r1=1.6&r2=1.7&ty=u Index: pear/File_Archive/Archive/Reader/Zip.php diff -u pear/File_Archive/Archive/Reader/Zip.php:1.6 pear/File_Archive/Archive/Reader/Zip.php:1.7 --- pear/File_Archive/Archive/Reader/Zip.php:1.6 Sat Feb 19 16:12:55 2005 +++ pear/File_Archive/Archive/Reader/Zip.php Tue Feb 22 12:00:05 2005 @@ -25,7 +25,7 @@ * @author Vincent Lascaux <vincentlascaux@php.net> * @copyright 1997-2005 The PHP Group * @license http://www.gnu.org/copyleft/lesser.html LGPL - * @version CVS: $Id: Zip.php,v 1.6 2005/02/19 21:12:55 vincentlascaux Exp $ + * @version CVS: $Id: Zip.php,v 1.7 2005/02/22 17:00:05 vincentlascaux Exp $ * @link http://pear.php.net/package/File_Archive */ @@ -139,8 +139,7 @@ return false; } - do - { + do { $result = $this->nextWithFolders(); if($result !== true) { return $result; http://cvs.php.net/diff.php/pear/File_Archive/Archive/Writer/Archive.php?r1=1.4&r2=1.5&ty=u Index: pear/File_Archive/Archive/Writer/Archive.php diff -u pear/File_Archive/Archive/Writer/Archive.php:1.4 pear/File_Archive/Archive/Writer/Archive.php:1.5 --- pear/File_Archive/Archive/Writer/Archive.php:1.4 Fri Feb 18 16:00:49 2005 +++ pear/File_Archive/Archive/Writer/Archive.php Tue Feb 22 12:00:05 2005 @@ -25,7 +25,7 @@ * @author Vincent Lascaux <vincentlascaux@php.net> * @copyright 1997-2005 The PHP Group * @license http://www.gnu.org/copyleft/lesser.html LGPL - * @version CVS: $Id: Archive.php,v 1.4 2005/02/18 21:00:49 vincentlascaux Exp $ + * @version CVS: $Id: Archive.php,v 1.5 2005/02/22 17:00:05 vincentlascaux Exp $ * @link http://pear.php.net/package/File_Archive */ @@ -40,13 +40,13 @@ * @var File_Archive_Writer The compressed data will be written to this writer * @access private */ - var $innerWriter = NULL; + var $innerWriter; /** * @var bool If true, the innerWriter will be closed when closing this * @access private */ - var $autoClose = TRUE; + var $autoClose; /** * @param String $filename Name to give to the archive (the name will probably be used by the inner writer) http://cvs.php.net/diff.php/pear/File_Archive/Archive/Writer/Mail.php?r1=1.4&r2=1.5&ty=u Index: pear/File_Archive/Archive/Writer/Mail.php diff -u pear/File_Archive/Archive/Writer/Mail.php:1.4 pear/File_Archive/Archive/Writer/Mail.php:1.5 --- pear/File_Archive/Archive/Writer/Mail.php:1.4 Fri Feb 18 16:00:49 2005 +++ pear/File_Archive/Archive/Writer/Mail.php Tue Feb 22 12:00:05 2005 @@ -25,7 +25,7 @@ * @author Vincent Lascaux <vincentlascaux@php.net> * @copyright 1997-2005 The PHP Group * @license http://www.gnu.org/copyleft/lesser.html LGPL - * @version CVS: $Id: Mail.php,v 1.4 2005/02/18 21:00:49 vincentlascaux Exp $ + * @version CVS: $Id: Mail.php,v 1.5 2005/02/22 17:00:05 vincentlascaux Exp $ * @link http://pear.php.net/package/File_Archive */ @@ -168,7 +168,7 @@ $headers, $body) ) { - die("Error sending mail"); + return PEAR::raiseError("Error sending mail"); } } } http://cvs.php.net/diff.php/pear/File_Archive/Archive/Writer/MemoryArchive.php?r1=1.4&r2=1.5&ty=u Index: pear/File_Archive/Archive/Writer/MemoryArchive.php diff -u pear/File_Archive/Archive/Writer/MemoryArchive.php:1.4 pear/File_Archive/Archive/Writer/MemoryArchive.php:1.5 --- pear/File_Archive/Archive/Writer/MemoryArchive.php:1.4 Fri Feb 18 16:00:49 2005 +++ pear/File_Archive/Archive/Writer/MemoryArchive.php Tue Feb 22 12:00:05 2005 @@ -26,7 +26,7 @@ * @author Vincent Lascaux <vincentlascaux@php.net> * @copyright 1997-2005 The PHP Group * @license http://www.gnu.org/copyleft/lesser.html LGPL - * @version CVS: $Id: MemoryArchive.php,v 1.4 2005/02/18 21:00:49 vincentlascaux Exp $ + * @version CVS: $Id: MemoryArchive.php,v 1.5 2005/02/22 17:00:05 vincentlascaux Exp $ * @link http://pear.php.net/package/File_Archive */ @@ -76,7 +76,7 @@ /** * @see File_Archive_Writer::newFile */ - function newFile($filename, $stat, $mime = "application/octet-stream") + function newFile($filename, $stat=array(), $mime = "application/octet-stream") { if($this->nbFiles == 0) { $this->sendHeader(); http://cvs.php.net/diff.php/pear/File_Archive/Archive/Writer/Tar.php?r1=1.4&r2=1.5&ty=u Index: pear/File_Archive/Archive/Writer/Tar.php diff -u pear/File_Archive/Archive/Writer/Tar.php:1.4 pear/File_Archive/Archive/Writer/Tar.php:1.5 --- pear/File_Archive/Archive/Writer/Tar.php:1.4 Fri Feb 18 16:00:49 2005 +++ pear/File_Archive/Archive/Writer/Tar.php Tue Feb 22 12:00:05 2005 @@ -25,7 +25,7 @@ * @author Vincent Lascaux <vincentlascaux@php.net> * @copyright 1997-2005 The PHP Group * @license http://www.gnu.org/copyleft/lesser.html LGPL - * @version CVS: $Id: Tar.php,v 1.4 2005/02/18 21:00:49 vincentlascaux Exp $ + * @version CVS: $Id: Tar.php,v 1.5 2005/02/22 17:00:05 vincentlascaux Exp $ * @link http://pear.php.net/package/File_Archive */ @@ -97,10 +97,12 @@ ""); $checksum = 8*ord(" "); - for($i = 0; $i < 148; $i++) + for($i = 0; $i < 148; $i++) { $checksum += ord($blockbeg{$i}); - for($i = 0; $i < 356; $i++) + } + for($i = 0; $i < 356; $i++) { $checksum += ord($blockend{$i}); + } $checksum = pack("a8",sprintf("%6s ",decoct($checksum))); http://cvs.php.net/diff.php/pear/File_Archive/tests/test.php?r1=1.12&r2=1.13&ty=u Index: pear/File_Archive/tests/test.php diff -u pear/File_Archive/tests/test.php:1.12 pear/File_Archive/tests/test.php:1.13 --- pear/File_Archive/tests/test.php:1.12 Mon Feb 21 17:59:52 2005 +++ pear/File_Archive/tests/test.php Tue Feb 22 12:00:05 2005 @@ -256,15 +256,25 @@ function testTgz() { $this->_testArchive('tgz'); } function testWriteZip() { - $source = File_Archive::readMulti(); - $source->addSource(File_Archive::read('test.php')); - $source->addSource(File_Archive::readMemory("This is a dynamic file put in the ZIP archive", "dynamic.txt")); - $source->extract( - File_Archive::toArchive('test.zip', - File_Archive::toFiles() - ) - ); - $source->close(); + //Build the writer + $writer = File_Archive::toArchive('example1.zip', File_Archive::toFiles()); + + //Write the list of even number in [0..999] + $writer->newFile("even.txt"); + for($i=0; $i<1000; $i+=2) + { + $writer->writeData("$i\n"); + } + + //Write the list of odd number in [0..999] + $writer->newFile("odd.txt"); + for($i=1; $i<1000; $i+=2) + { + $writer->writeData("$i\n"); + } + + //Close the writer + $writer->close(); } function testMultiWriter()