note 117339 added to ziparchive.open
| From: | abolfazl dot ziaratban at gmail dot com | Date: | Sun, 24 May 2015 16:35:49 +0000 |
| Subject: | note 117339 added to ziparchive.open | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-202653@lists.php.net to get a copy of this message | ||
<?php
#made by abolfazl ziaratban (c)
#license GPL
class zip extends ZipArchive
{
public function message($code)
{
switch ($code)
{
case 0:
return 'No error';
case 1:
return 'Multi-disk zip archives not supported';
case 2:
return 'Renaming temporary file failed';
case 3:
return 'Closing zip archive failed';
case 4:
return 'Seek error';
case 5:
return 'Read error';
case 6:
return 'Write error';
case 7:
return 'CRC error';
case 8:
return 'Containing zip archive was closed';
case 9:
return 'No such file';
case 10:
return 'File already exists';
case 11:
return 'Can\'t open file';
case 12:
return 'Failure to create temporary file';
case 13:
return 'Zlib error';
case 14:
return 'Malloc failure';
case 15:
return 'Entry has been changed';
case 16:
return 'Compression method not supported';
case 17:
return 'Premature EOF';
case 18:
return 'Invalid argument';
case 19:
return 'Not a zip archive';
case 20:
return 'Internal error';
case 21:
return 'Zip archive inconsistent';
case 22:
return 'Can\'t remove file';
case 23:
return 'Entry has been deleted';
default:
return 'An unknown error has occurred('.intval($code).')';
}
}
public function isDir($path)
{
return substr($path,-1) == '/';
}
public function getTree()
{
$Tree = array();
$pathArray = array();
for($i=0; $i<$this->numFiles; $i++)
{
$path = $this->getNameIndex($i);
$pathBySlash = array_values(explode('/',$path));
$c = count($pathBySlash);
$temp = &$Tree;
for($j=0; $j<$c-1; $j++)
if(isset($temp[$pathBySlash[$j]]))
$temp = &$temp[$pathBySlash[$j]];
else
{
$temp[$pathBySlash[$j]] = array();
$temp = &$temp[$pathBySlash[$j]];
}
if($this->isDir($path))
$temp[$pathBySlash[$c-1]] = array();
else
$temp[] = $pathBySlash[$c-1];
}
return $Tree;
}
}
?>
----
Server IP: 72.52.91.14
Probable Submitter: 2.181.109.213
----
Manual Page -- http://php.net/manual/en/ziparchive.open.php
Edit -- https://master.php.net/note/edit/117339
Del: integrated -- https://master.php.net/note/delete/117339/integrated
Del: useless -- https://master.php.net/note/delete/117339/useless
Del: bad code -- https://master.php.net/note/delete/117339/bad+code
Del: spam -- https://master.php.net/note/delete/117339/spam
Del: non-english -- https://master.php.net/note/delete/117339/non-english
Del: in docs -- https://master.php.net/note/delete/117339/in+docs
Del: other reasons-- https://master.php.net/note/delete/117339
Reject -- https://master.php.net/note/reject/117339
Search -- https://master.php.net/manage/user-notes.php