Yet more of the psr-2 work
This commit is contained in:
parent
4c8dd00dff
commit
61e81377cb
|
@ -271,11 +271,13 @@ class PHPExcel_Calculation
|
|||
|
||||
// PHPExcel functions
|
||||
private static $PHPExcelFunctions = array( // PHPExcel functions
|
||||
'ABS' => array('category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
|
||||
'ABS' => array(
|
||||
'category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
|
||||
'functionCall' => 'abs',
|
||||
'argumentCount' => '1'
|
||||
argumentCount' => '1'
|
||||
),
|
||||
'ACCRINT' => array('category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
|
||||
'ACCRINT' => array(
|
||||
'category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
|
||||
'functionCall' => 'PHPExcel_Calculation_Financial::ACCRINT',
|
||||
'argumentCount' => '4-7'
|
||||
),
|
||||
|
@ -1697,7 +1699,8 @@ class PHPExcel_Calculation
|
|||
'functionCall' => 'PHPExcel_Calculation_Financial::YIELDMAT',
|
||||
'argumentCount' => '5,6'
|
||||
),
|
||||
'ZTEST' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
|
||||
'ZTEST' => array(
|
||||
'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
|
||||
'functionCall' => 'PHPExcel_Calculation_Statistical::ZTEST',
|
||||
'argumentCount' => '2-3'
|
||||
)
|
||||
|
@ -1739,7 +1742,7 @@ class PHPExcel_Calculation
|
|||
}
|
||||
}
|
||||
|
||||
private static function _loadLocales()
|
||||
private static function loadLocales()
|
||||
{
|
||||
$localeFileDirectory = PHPEXCEL_ROOT.'PHPExcel/locale/';
|
||||
foreach (glob($localeFileDirectory.'/*', GLOB_ONLYDIR) as $filename) {
|
||||
|
@ -1981,7 +1984,7 @@ class PHPExcel_Calculation
|
|||
}
|
||||
|
||||
if (count(self::$validLocaleLanguages) == 1) {
|
||||
self::_loadLocales();
|
||||
self::loadLocales();
|
||||
}
|
||||
// Test whether we have any language data for this language (any locale)
|
||||
if (in_array($language, self::$validLocaleLanguages)) {
|
||||
|
|
|
@ -41,7 +41,7 @@ class PHPExcel_Chart_Legend
|
|||
const POSITION_TOP = 't';
|
||||
const POSITION_TOPRIGHT = 'tr';
|
||||
|
||||
private static $_positionXLref = array(
|
||||
private static $positionXLref = array(
|
||||
self::xlLegendPositionBottom => self::POSITION_BOTTOM,
|
||||
self::xlLegendPositionCorner => self::POSITION_TOPRIGHT,
|
||||
self::xlLegendPositionCustom => '??',
|
||||
|
@ -99,7 +99,7 @@ class PHPExcel_Chart_Legend
|
|||
*/
|
||||
public function setPosition($position = self::POSITION_RIGHT)
|
||||
{
|
||||
if (!in_array($position, self::$_positionXLref)) {
|
||||
if (!in_array($position, self::$positionXLref)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -114,7 +114,7 @@ class PHPExcel_Chart_Legend
|
|||
*/
|
||||
public function getPositionXL()
|
||||
{
|
||||
return array_search($this->position, self::$_positionXLref);
|
||||
return array_search($this->position, self::$positionXLref);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -124,11 +124,11 @@ class PHPExcel_Chart_Legend
|
|||
*/
|
||||
public function setPositionXL($positionXL = self::xlLegendPositionRight)
|
||||
{
|
||||
if (!array_key_exists($positionXL, self::$_positionXLref)) {
|
||||
if (!array_key_exists($positionXL, self::$positionXLref)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->position = self::$_positionXLref[$positionXL];
|
||||
$this->position = self::$positionXLref[$positionXL];
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -535,7 +535,7 @@ class PHPExcel_DocumentProperties
|
|||
return strtotime($propertyValue);
|
||||
break;
|
||||
case 'bool': // Boolean
|
||||
return ($propertyValue == 'true') ? True : False;
|
||||
return ($propertyValue == 'true') ? true : false;
|
||||
break;
|
||||
case 'cy': // Currency
|
||||
case 'error': // Error Status Code
|
||||
|
@ -556,7 +556,8 @@ class PHPExcel_DocumentProperties
|
|||
return $propertyValue;
|
||||
}
|
||||
|
||||
public static function convertPropertyType($propertyType) {
|
||||
public static function convertPropertyType($propertyType)
|
||||
{
|
||||
switch ($propertyType) {
|
||||
case 'i1': // 1-Byte Signed Integer
|
||||
case 'i2': // 2-Byte Signed Integer
|
||||
|
@ -607,5 +608,4 @@ class PHPExcel_DocumentProperties
|
|||
}
|
||||
return self::PROPERTY_TYPE_UNKNOWN;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -32,35 +32,35 @@ class PHPExcel_DocumentSecurity
|
|||
*
|
||||
* @var boolean
|
||||
*/
|
||||
private $_lockRevision;
|
||||
private $lockRevision;
|
||||
|
||||
/**
|
||||
* LockStructure
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
private $_lockStructure;
|
||||
private $lockStructure;
|
||||
|
||||
/**
|
||||
* LockWindows
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
private $_lockWindows;
|
||||
private $lockWindows;
|
||||
|
||||
/**
|
||||
* RevisionsPassword
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_revisionsPassword;
|
||||
private $revisionsPassword;
|
||||
|
||||
/**
|
||||
* WorkbookPassword
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_workbookPassword;
|
||||
private $workbookPassword;
|
||||
|
||||
/**
|
||||
* Create a new PHPExcel_DocumentSecurity
|
||||
|
@ -68,11 +68,11 @@ class PHPExcel_DocumentSecurity
|
|||
public function __construct()
|
||||
{
|
||||
// Initialise values
|
||||
$this->_lockRevision = false;
|
||||
$this->_lockStructure = false;
|
||||
$this->_lockWindows = false;
|
||||
$this->_revisionsPassword = '';
|
||||
$this->_workbookPassword = '';
|
||||
$this->lockRevision = false;
|
||||
$this->lockStructure = false;
|
||||
$this->lockWindows = false;
|
||||
$this->revisionsPassword = '';
|
||||
$this->workbookPassword = '';
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -82,9 +82,9 @@ class PHPExcel_DocumentSecurity
|
|||
*/
|
||||
public function isSecurityEnabled()
|
||||
{
|
||||
return $this->_lockRevision ||
|
||||
$this->_lockStructure ||
|
||||
$this->_lockWindows;
|
||||
return $this->lockRevision ||
|
||||
$this->lockStructure ||
|
||||
$this->lockWindows;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -94,7 +94,7 @@ class PHPExcel_DocumentSecurity
|
|||
*/
|
||||
public function getLockRevision()
|
||||
{
|
||||
return $this->_lockRevision;
|
||||
return $this->lockRevision;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -105,7 +105,7 @@ class PHPExcel_DocumentSecurity
|
|||
*/
|
||||
public function setLockRevision($pValue = false)
|
||||
{
|
||||
$this->_lockRevision = $pValue;
|
||||
$this->lockRevision = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
@ -116,7 +116,7 @@ class PHPExcel_DocumentSecurity
|
|||
*/
|
||||
public function getLockStructure()
|
||||
{
|
||||
return $this->_lockStructure;
|
||||
return $this->lockStructure;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -127,7 +127,7 @@ class PHPExcel_DocumentSecurity
|
|||
*/
|
||||
public function setLockStructure($pValue = false)
|
||||
{
|
||||
$this->_lockStructure = $pValue;
|
||||
$this->lockStructure = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
@ -138,7 +138,7 @@ class PHPExcel_DocumentSecurity
|
|||
*/
|
||||
public function getLockWindows()
|
||||
{
|
||||
return $this->_lockWindows;
|
||||
return $this->lockWindows;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -149,7 +149,7 @@ class PHPExcel_DocumentSecurity
|
|||
*/
|
||||
public function setLockWindows($pValue = false)
|
||||
{
|
||||
$this->_lockWindows = $pValue;
|
||||
$this->lockWindows = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
@ -160,7 +160,7 @@ class PHPExcel_DocumentSecurity
|
|||
*/
|
||||
public function getRevisionsPassword()
|
||||
{
|
||||
return $this->_revisionsPassword;
|
||||
return $this->revisionsPassword;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -175,7 +175,7 @@ class PHPExcel_DocumentSecurity
|
|||
if (!$pAlreadyHashed) {
|
||||
$pValue = PHPExcel_Shared_PasswordHasher::hashPassword($pValue);
|
||||
}
|
||||
$this->_revisionsPassword = $pValue;
|
||||
$this->revisionsPassword = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
@ -186,7 +186,7 @@ class PHPExcel_DocumentSecurity
|
|||
*/
|
||||
public function getWorkbookPassword()
|
||||
{
|
||||
return $this->_workbookPassword;
|
||||
return $this->workbookPassword;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -201,7 +201,7 @@ class PHPExcel_DocumentSecurity
|
|||
if (!$pAlreadyHashed) {
|
||||
$pValue = PHPExcel_Shared_PasswordHasher::hashPassword($pValue);
|
||||
}
|
||||
$this->_workbookPassword = $pValue;
|
||||
$this->workbookPassword = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
|
|
@ -66,7 +66,7 @@ class PHPExcel_HashTable
|
|||
// Check if an array was passed
|
||||
if ($pSource == null) {
|
||||
return;
|
||||
} else if (!is_array($pSource)) {
|
||||
} elseif (!is_array($pSource)) {
|
||||
throw new PHPExcel_Exception('Invalid array parameter passed.');
|
||||
}
|
||||
|
||||
|
|
|
@ -573,7 +573,8 @@ class PHPExcel_Helper_HTML
|
|||
|
||||
protected $richTextObject;
|
||||
|
||||
protected function initialise() {
|
||||
protected function initialise()
|
||||
{
|
||||
$this->face = $this->size = $this->color = null;
|
||||
$this->bold = $this->italic = $this->underline = $this->superscript = $this->subscript = $this->strikethrough = false;
|
||||
|
||||
|
@ -582,7 +583,8 @@ class PHPExcel_Helper_HTML
|
|||
$this->stringData = '';
|
||||
}
|
||||
|
||||
public function toRichTextObject($html) {
|
||||
public function toRichTextObject($html)
|
||||
{
|
||||
$this->initialise();
|
||||
|
||||
// Create a new DOM object
|
||||
|
@ -594,15 +596,17 @@ class PHPExcel_Helper_HTML
|
|||
// Discard excess white space
|
||||
$dom->preserveWhiteSpace = false;
|
||||
|
||||
$this->richTextObject = new PHPExcel_RichText();;
|
||||
$this->richTextObject = new PHPExcel_RichText();
|
||||
$this->parseElements($dom);
|
||||
return $this->richTextObject;
|
||||
}
|
||||
|
||||
protected function buildTextRun() {
|
||||
protected function buildTextRun()
|
||||
{
|
||||
$text = $this->stringData;
|
||||
if (trim($text) === '')
|
||||
if (trim($text) === '') {
|
||||
return;
|
||||
}
|
||||
|
||||
$richtextRun = $this->richTextObject->createTextRun($this->stringData);
|
||||
if ($this->face) {
|
||||
|
@ -612,7 +616,7 @@ class PHPExcel_Helper_HTML
|
|||
$richtextRun->getFont()->setSize($this->size);
|
||||
}
|
||||
if ($this->color) {
|
||||
$richtextRun->getFont()->setColor( new PHPExcel_Style_Color( 'ff' . $this->color ) );
|
||||
$richtextRun->getFont()->setColor(new PHPExcel_Style_Color('ff' . $this->color));
|
||||
}
|
||||
if ($this->bold) {
|
||||
$richtextRun->getFont()->setBold(true);
|
||||
|
@ -635,7 +639,8 @@ class PHPExcel_Helper_HTML
|
|||
$this->stringData = '';
|
||||
}
|
||||
|
||||
protected function rgbToColour($rgb) {
|
||||
protected function rgbToColour($rgb)
|
||||
{
|
||||
preg_match_all('/\d+/', $rgb, $values);
|
||||
foreach ($values[0] as &$value) {
|
||||
$value = str_pad(dechex($value), 2, '0', STR_PAD_LEFT);
|
||||
|
@ -643,11 +648,13 @@ class PHPExcel_Helper_HTML
|
|||
return implode($values[0]);
|
||||
}
|
||||
|
||||
protected function colourNameLookup($rgb) {
|
||||
protected function colourNameLookup($rgb)
|
||||
{
|
||||
return self::$colourMap[$rgb];
|
||||
}
|
||||
|
||||
protected function startFontTag($tag) {
|
||||
protected function startFontTag($tag)
|
||||
{
|
||||
foreach ($tag->attributes as $attribute) {
|
||||
$attributeName = strtolower($attribute->name);
|
||||
$attributeValue = $attribute->value;
|
||||
|
@ -666,69 +673,85 @@ class PHPExcel_Helper_HTML
|
|||
}
|
||||
}
|
||||
|
||||
protected function endFontTag() {
|
||||
protected function endFontTag()
|
||||
{
|
||||
$this->face = $this->size = $this->color = null;
|
||||
}
|
||||
|
||||
protected function startBoldTag() {
|
||||
protected function startBoldTag()
|
||||
{
|
||||
$this->bold = true;
|
||||
}
|
||||
|
||||
protected function endBoldTag() {
|
||||
protected function endBoldTag()
|
||||
{
|
||||
$this->bold = false;
|
||||
}
|
||||
|
||||
protected function startItalicTag() {
|
||||
protected function startItalicTag()
|
||||
{
|
||||
$this->italic = true;
|
||||
}
|
||||
|
||||
protected function endItalicTag() {
|
||||
protected function endItalicTag()
|
||||
{
|
||||
$this->italic = false;
|
||||
}
|
||||
|
||||
protected function startUnderlineTag() {
|
||||
protected function startUnderlineTag()
|
||||
{
|
||||
$this->underline = true;
|
||||
}
|
||||
|
||||
protected function endUnderlineTag() {
|
||||
protected function endUnderlineTag()
|
||||
{
|
||||
$this->underline = false;
|
||||
}
|
||||
|
||||
protected function startSubscriptTag() {
|
||||
protected function startSubscriptTag()
|
||||
{
|
||||
$this->subscript = true;
|
||||
}
|
||||
|
||||
protected function endSubscriptTag() {
|
||||
protected function endSubscriptTag()
|
||||
{
|
||||
$this->subscript = false;
|
||||
}
|
||||
|
||||
protected function startSuperscriptTag() {
|
||||
protected function startSuperscriptTag()
|
||||
{
|
||||
$this->superscript = true;
|
||||
}
|
||||
|
||||
protected function endSuperscriptTag() {
|
||||
protected function endSuperscriptTag()
|
||||
{
|
||||
$this->superscript = false;
|
||||
}
|
||||
|
||||
protected function startStrikethruTag() {
|
||||
protected function startStrikethruTag()
|
||||
{
|
||||
$this->strikethrough = true;
|
||||
}
|
||||
|
||||
protected function endStrikethruTag() {
|
||||
protected function endStrikethruTag()
|
||||
{
|
||||
$this->strikethrough = false;
|
||||
}
|
||||
|
||||
protected function breakTag() {
|
||||
protected function breakTag()
|
||||
{
|
||||
$this->stringData .= PHP_EOL;
|
||||
}
|
||||
|
||||
protected function parseTextNode(DOMText $textNode) {
|
||||
protected function parseTextNode(DOMText $textNode)
|
||||
{
|
||||
$domText = preg_replace('/\s+/u', ' ', ltrim($textNode->nodeValue));
|
||||
$this->stringData .= $domText;
|
||||
$this->buildTextRun();
|
||||
}
|
||||
|
||||
protected function handleCallback($element, $callbackTag, $callbacks) {
|
||||
protected function handleCallback($element, $callbackTag, $callbacks)
|
||||
{
|
||||
if (isset($callbacks[$callbackTag])) {
|
||||
$elementHandler = $callbacks[$callbackTag];
|
||||
if (method_exists($this, $elementHandler)) {
|
||||
|
@ -737,7 +760,8 @@ class PHPExcel_Helper_HTML
|
|||
}
|
||||
}
|
||||
|
||||
protected function parseElementNode(DOMElement $element) {
|
||||
protected function parseElementNode(DOMElement $element)
|
||||
{
|
||||
$callbackTag = strtolower($element->nodeName);
|
||||
$this->stack[] = $callbackTag;
|
||||
|
||||
|
@ -750,7 +774,8 @@ class PHPExcel_Helper_HTML
|
|||
$this->handleCallback($element, $callbackTag, $this->endTagCallbacks);
|
||||
}
|
||||
|
||||
protected function parseElements(DOMNode $element) {
|
||||
protected function parseElements(DOMNode $element)
|
||||
{
|
||||
foreach ($element->childNodes as $child) {
|
||||
if ($child instanceof DOMText) {
|
||||
$this->parseTextNode($child);
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* PHPExcel
|
||||
* PHPExcel_Shared_OLE_ChainedBlockStream
|
||||
*
|
||||
* Copyright (c) 2006 - 2015 PHPExcel
|
||||
*
|
||||
|
@ -24,17 +25,6 @@
|
|||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version ##VERSION##, ##DATE##
|
||||
*/
|
||||
|
||||
/**
|
||||
* PHPExcel_Shared_OLE_ChainedBlockStream
|
||||
*
|
||||
* Stream wrapper for reading data stored in an OLE file. Implements methods
|
||||
* for PHP's stream_wrapper_register(). For creating streams using this
|
||||
* wrapper, use PHPExcel_Shared_OLE_PPS_File::getStream().
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Shared_OLE
|
||||
*/
|
||||
class PHPExcel_Shared_OLE_ChainedBlockStream
|
||||
{
|
||||
/**
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
* @package PHPExcel_Shared_OLE
|
||||
*/
|
||||
class PHPExcel_Shared_OLE_PPS_File extends PHPExcel_Shared_OLE_PPS
|
||||
{
|
||||
{
|
||||
/**
|
||||
* The constructor
|
||||
*
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
* @package PHPExcel_Shared_OLE
|
||||
*/
|
||||
class PHPExcel_Shared_OLE_PPS_Root extends PHPExcel_Shared_OLE_PPS
|
||||
{
|
||||
{
|
||||
|
||||
/**
|
||||
* Directory for temporary files
|
||||
|
@ -71,10 +71,14 @@ class PHPExcel_Shared_OLE_PPS_Root extends PHPExcel_Shared_OLE_PPS
|
|||
public function save($filename)
|
||||
{
|
||||
// Initial Setting for saving
|
||||
$this->_BIG_BLOCK_SIZE = pow(2,
|
||||
((isset($this->_BIG_BLOCK_SIZE))? self::_adjust2($this->_BIG_BLOCK_SIZE) : 9));
|
||||
$this->_SMALL_BLOCK_SIZE= pow(2,
|
||||
((isset($this->_SMALL_BLOCK_SIZE))? self::_adjust2($this->_SMALL_BLOCK_SIZE): 6));
|
||||
$this->_BIG_BLOCK_SIZE = pow(
|
||||
2,
|
||||
(isset($this->_BIG_BLOCK_SIZE))? self::_adjust2($this->_BIG_BLOCK_SIZE) : 9
|
||||
);
|
||||
$this->_SMALL_BLOCK_SIZE= pow(
|
||||
2,
|
||||
(isset($this->_SMALL_BLOCK_SIZE))? self::_adjust2($this->_SMALL_BLOCK_SIZE) : 6
|
||||
);
|
||||
|
||||
if (is_resource($filename)) {
|
||||
$this->_FILEH_ = $filename;
|
||||
|
|
|
@ -25,170 +25,170 @@
|
|||
// $Id: pclzip.lib.php,v 1.60 2009/09/30 21:01:04 vblavet Exp $
|
||||
// --------------------------------------------------------------------------------
|
||||
|
||||
// ----- Constants
|
||||
if (!defined('PCLZIP_READ_BLOCK_SIZE')) {
|
||||
define( 'PCLZIP_READ_BLOCK_SIZE', 2048 );
|
||||
}
|
||||
// ----- Constants
|
||||
if (!defined('PCLZIP_READ_BLOCK_SIZE')) {
|
||||
define('PCLZIP_READ_BLOCK_SIZE', 2048);
|
||||
}
|
||||
|
||||
// ----- File list separator
|
||||
// In version 1.x of PclZip, the separator for file list is a space
|
||||
// (which is not a very smart choice, specifically for windows paths !).
|
||||
// A better separator should be a comma (,). This constant gives you the
|
||||
// abilty to change that.
|
||||
// However notice that changing this value, may have impact on existing
|
||||
// scripts, using space separated filenames.
|
||||
// Recommanded values for compatibility with older versions :
|
||||
//define( 'PCLZIP_SEPARATOR', ' ' );
|
||||
// Recommanded values for smart separation of filenames.
|
||||
if (!defined('PCLZIP_SEPARATOR')) {
|
||||
define( 'PCLZIP_SEPARATOR', ',' );
|
||||
}
|
||||
// ----- File list separator
|
||||
// In version 1.x of PclZip, the separator for file list is a space
|
||||
// (which is not a very smart choice, specifically for windows paths !).
|
||||
// A better separator should be a comma (,). This constant gives you the
|
||||
// abilty to change that.
|
||||
// However notice that changing this value, may have impact on existing
|
||||
// scripts, using space separated filenames.
|
||||
// Recommanded values for compatibility with older versions :
|
||||
//define('PCLZIP_SEPARATOR', ' ');
|
||||
// Recommanded values for smart separation of filenames.
|
||||
if (!defined('PCLZIP_SEPARATOR')) {
|
||||
define('PCLZIP_SEPARATOR', ',');
|
||||
}
|
||||
|
||||
// ----- Error configuration
|
||||
// 0 : PclZip Class integrated error handling
|
||||
// 1 : PclError external library error handling. By enabling this
|
||||
// you must ensure that you have included PclError library.
|
||||
// [2,...] : reserved for futur use
|
||||
if (!defined('PCLZIP_ERROR_EXTERNAL')) {
|
||||
define( 'PCLZIP_ERROR_EXTERNAL', 0 );
|
||||
}
|
||||
// ----- Error configuration
|
||||
// 0 : PclZip Class integrated error handling
|
||||
// 1 : PclError external library error handling. By enabling this
|
||||
// you must ensure that you have included PclError library.
|
||||
// [2,...] : reserved for futur use
|
||||
if (!defined('PCLZIP_ERROR_EXTERNAL')) {
|
||||
define('PCLZIP_ERROR_EXTERNAL', 0);
|
||||
}
|
||||
|
||||
// ----- Optional static temporary directory
|
||||
// By default temporary files are generated in the script current
|
||||
// path.
|
||||
// If defined :
|
||||
// - MUST BE terminated by a '/'.
|
||||
// - MUST be a valid, already created directory
|
||||
// Samples :
|
||||
// define( 'PCLZIP_TEMPORARY_DIR', '/temp/' );
|
||||
// define( 'PCLZIP_TEMPORARY_DIR', 'C:/Temp/' );
|
||||
if (!defined('PCLZIP_TEMPORARY_DIR')) {
|
||||
define( 'PCLZIP_TEMPORARY_DIR', '' );
|
||||
}
|
||||
// ----- Optional static temporary directory
|
||||
// By default temporary files are generated in the script current
|
||||
// path.
|
||||
// If defined :
|
||||
// - MUST BE terminated by a '/'.
|
||||
// - MUST be a valid, already created directory
|
||||
// Samples :
|
||||
// define('PCLZIP_TEMPORARY_DIR', '/temp/');
|
||||
// define('PCLZIP_TEMPORARY_DIR', 'C:/Temp/');
|
||||
if (!defined('PCLZIP_TEMPORARY_DIR')) {
|
||||
define('PCLZIP_TEMPORARY_DIR', '');
|
||||
}
|
||||
|
||||
// ----- Optional threshold ratio for use of temporary files
|
||||
// Pclzip sense the size of the file to add/extract and decide to
|
||||
// use or not temporary file. The algorythm is looking for
|
||||
// memory_limit of PHP and apply a ratio.
|
||||
// threshold = memory_limit * ratio.
|
||||
// Recommended values are under 0.5. Default 0.47.
|
||||
// Samples :
|
||||
// define( 'PCLZIP_TEMPORARY_FILE_RATIO', 0.5 );
|
||||
if (!defined('PCLZIP_TEMPORARY_FILE_RATIO')) {
|
||||
define( 'PCLZIP_TEMPORARY_FILE_RATIO', 0.47 );
|
||||
}
|
||||
// ----- Optional threshold ratio for use of temporary files
|
||||
// Pclzip sense the size of the file to add/extract and decide to
|
||||
// use or not temporary file. The algorythm is looking for
|
||||
// memory_limit of PHP and apply a ratio.
|
||||
// threshold = memory_limit * ratio.
|
||||
// Recommended values are under 0.5. Default 0.47.
|
||||
// Samples :
|
||||
// define('PCLZIP_TEMPORARY_FILE_RATIO', 0.5);
|
||||
if (!defined('PCLZIP_TEMPORARY_FILE_RATIO')) {
|
||||
define('PCLZIP_TEMPORARY_FILE_RATIO', 0.47);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
// ***** UNDER THIS LINE NOTHING NEEDS TO BE MODIFIED *****
|
||||
// --------------------------------------------------------------------------------
|
||||
|
||||
// ----- Global variables
|
||||
$g_pclzip_version = "2.8.2";
|
||||
// ----- Global variables
|
||||
$g_pclzip_version = "2.8.2";
|
||||
|
||||
// ----- Error codes
|
||||
// -1 : Unable to open file in binary write mode
|
||||
// -2 : Unable to open file in binary read mode
|
||||
// -3 : Invalid parameters
|
||||
// -4 : File does not exist
|
||||
// -5 : Filename is too long (max. 255)
|
||||
// -6 : Not a valid zip file
|
||||
// -7 : Invalid extracted file size
|
||||
// -8 : Unable to create directory
|
||||
// -9 : Invalid archive extension
|
||||
// -10 : Invalid archive format
|
||||
// -11 : Unable to delete file (unlink)
|
||||
// -12 : Unable to rename file (rename)
|
||||
// -13 : Invalid header checksum
|
||||
// -14 : Invalid archive size
|
||||
define( 'PCLZIP_ERR_USER_ABORTED', 2 );
|
||||
define( 'PCLZIP_ERR_NO_ERROR', 0 );
|
||||
define( 'PCLZIP_ERR_WRITE_OPEN_FAIL', -1 );
|
||||
define( 'PCLZIP_ERR_READ_OPEN_FAIL', -2 );
|
||||
define( 'PCLZIP_ERR_INVALID_PARAMETER', -3 );
|
||||
define( 'PCLZIP_ERR_MISSING_FILE', -4 );
|
||||
define( 'PCLZIP_ERR_FILENAME_TOO_LONG', -5 );
|
||||
define( 'PCLZIP_ERR_INVALID_ZIP', -6 );
|
||||
define( 'PCLZIP_ERR_BAD_EXTRACTED_FILE', -7 );
|
||||
define( 'PCLZIP_ERR_DIR_CREATE_FAIL', -8 );
|
||||
define( 'PCLZIP_ERR_BAD_EXTENSION', -9 );
|
||||
define( 'PCLZIP_ERR_BAD_FORMAT', -10 );
|
||||
define( 'PCLZIP_ERR_DELETE_FILE_FAIL', -11 );
|
||||
define( 'PCLZIP_ERR_RENAME_FILE_FAIL', -12 );
|
||||
define( 'PCLZIP_ERR_BAD_CHECKSUM', -13 );
|
||||
define( 'PCLZIP_ERR_INVALID_ARCHIVE_ZIP', -14 );
|
||||
define( 'PCLZIP_ERR_MISSING_OPTION_VALUE', -15 );
|
||||
define( 'PCLZIP_ERR_INVALID_OPTION_VALUE', -16 );
|
||||
define( 'PCLZIP_ERR_ALREADY_A_DIRECTORY', -17 );
|
||||
define( 'PCLZIP_ERR_UNSUPPORTED_COMPRESSION', -18 );
|
||||
define( 'PCLZIP_ERR_UNSUPPORTED_ENCRYPTION', -19 );
|
||||
define( 'PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE', -20 );
|
||||
define( 'PCLZIP_ERR_DIRECTORY_RESTRICTION', -21 );
|
||||
// ----- Error codes
|
||||
// -1 : Unable to open file in binary write mode
|
||||
// -2 : Unable to open file in binary read mode
|
||||
// -3 : Invalid parameters
|
||||
// -4 : File does not exist
|
||||
// -5 : Filename is too long (max. 255)
|
||||
// -6 : Not a valid zip file
|
||||
// -7 : Invalid extracted file size
|
||||
// -8 : Unable to create directory
|
||||
// -9 : Invalid archive extension
|
||||
// -10 : Invalid archive format
|
||||
// -11 : Unable to delete file (unlink)
|
||||
// -12 : Unable to rename file (rename)
|
||||
// -13 : Invalid header checksum
|
||||
// -14 : Invalid archive size
|
||||
define('PCLZIP_ERR_USER_ABORTED', 2);
|
||||
define('PCLZIP_ERR_NO_ERROR', 0);
|
||||
define('PCLZIP_ERR_WRITE_OPEN_FAIL', -1);
|
||||
define('PCLZIP_ERR_READ_OPEN_FAIL', -2);
|
||||
define('PCLZIP_ERR_INVALID_PARAMETER', -3);
|
||||
define('PCLZIP_ERR_MISSING_FILE', -4);
|
||||
define('PCLZIP_ERR_FILENAME_TOO_LONG', -5);
|
||||
define('PCLZIP_ERR_INVALID_ZIP', -6);
|
||||
define('PCLZIP_ERR_BAD_EXTRACTED_FILE', -7);
|
||||
define('PCLZIP_ERR_DIR_CREATE_FAIL', -8);
|
||||
define('PCLZIP_ERR_BAD_EXTENSION', -9);
|
||||
define('PCLZIP_ERR_BAD_FORMAT', -10);
|
||||
define('PCLZIP_ERR_DELETE_FILE_FAIL', -11);
|
||||
define('PCLZIP_ERR_RENAME_FILE_FAIL', -12);
|
||||
define('PCLZIP_ERR_BAD_CHECKSUM', -13);
|
||||
define('PCLZIP_ERR_INVALID_ARCHIVE_ZIP', -14);
|
||||
define('PCLZIP_ERR_MISSING_OPTION_VALUE', -15);
|
||||
define('PCLZIP_ERR_INVALID_OPTION_VALUE', -16);
|
||||
define('PCLZIP_ERR_ALREADY_A_DIRECTORY', -17);
|
||||
define('PCLZIP_ERR_UNSUPPORTED_COMPRESSION', -18);
|
||||
define('PCLZIP_ERR_UNSUPPORTED_ENCRYPTION', -19);
|
||||
define('PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE', -20);
|
||||
define('PCLZIP_ERR_DIRECTORY_RESTRICTION', -21);
|
||||
|
||||
// ----- Options values
|
||||
define( 'PCLZIP_OPT_PATH', 77001 );
|
||||
define( 'PCLZIP_OPT_ADD_PATH', 77002 );
|
||||
define( 'PCLZIP_OPT_REMOVE_PATH', 77003 );
|
||||
define( 'PCLZIP_OPT_REMOVE_ALL_PATH', 77004 );
|
||||
define( 'PCLZIP_OPT_SET_CHMOD', 77005 );
|
||||
define( 'PCLZIP_OPT_EXTRACT_AS_STRING', 77006 );
|
||||
define( 'PCLZIP_OPT_NO_COMPRESSION', 77007 );
|
||||
define( 'PCLZIP_OPT_BY_NAME', 77008 );
|
||||
define( 'PCLZIP_OPT_BY_INDEX', 77009 );
|
||||
define( 'PCLZIP_OPT_BY_EREG', 77010 );
|
||||
define( 'PCLZIP_OPT_BY_PREG', 77011 );
|
||||
define( 'PCLZIP_OPT_COMMENT', 77012 );
|
||||
define( 'PCLZIP_OPT_ADD_COMMENT', 77013 );
|
||||
define( 'PCLZIP_OPT_PREPEND_COMMENT', 77014 );
|
||||
define( 'PCLZIP_OPT_EXTRACT_IN_OUTPUT', 77015 );
|
||||
define( 'PCLZIP_OPT_REPLACE_NEWER', 77016 );
|
||||
define( 'PCLZIP_OPT_STOP_ON_ERROR', 77017 );
|
||||
// Having big trouble with crypt. Need to multiply 2 long int
|
||||
// which is not correctly supported by PHP ...
|
||||
//define( 'PCLZIP_OPT_CRYPT', 77018 );
|
||||
define( 'PCLZIP_OPT_EXTRACT_DIR_RESTRICTION', 77019 );
|
||||
define( 'PCLZIP_OPT_TEMP_FILE_THRESHOLD', 77020 );
|
||||
define( 'PCLZIP_OPT_ADD_TEMP_FILE_THRESHOLD', 77020 ); // alias
|
||||
define( 'PCLZIP_OPT_TEMP_FILE_ON', 77021 );
|
||||
define( 'PCLZIP_OPT_ADD_TEMP_FILE_ON', 77021 ); // alias
|
||||
define( 'PCLZIP_OPT_TEMP_FILE_OFF', 77022 );
|
||||
define( 'PCLZIP_OPT_ADD_TEMP_FILE_OFF', 77022 ); // alias
|
||||
// ----- Options values
|
||||
define('PCLZIP_OPT_PATH', 77001);
|
||||
define('PCLZIP_OPT_ADD_PATH', 77002);
|
||||
define('PCLZIP_OPT_REMOVE_PATH', 77003);
|
||||
define('PCLZIP_OPT_REMOVE_ALL_PATH', 77004);
|
||||
define('PCLZIP_OPT_SET_CHMOD', 77005);
|
||||
define('PCLZIP_OPT_EXTRACT_AS_STRING', 77006);
|
||||
define('PCLZIP_OPT_NO_COMPRESSION', 77007);
|
||||
define('PCLZIP_OPT_BY_NAME', 77008);
|
||||
define('PCLZIP_OPT_BY_INDEX', 77009);
|
||||
define('PCLZIP_OPT_BY_EREG', 77010);
|
||||
define('PCLZIP_OPT_BY_PREG', 77011);
|
||||
define('PCLZIP_OPT_COMMENT', 77012);
|
||||
define('PCLZIP_OPT_ADD_COMMENT', 77013);
|
||||
define('PCLZIP_OPT_PREPEND_COMMENT', 77014);
|
||||
define('PCLZIP_OPT_EXTRACT_IN_OUTPUT', 77015);
|
||||
define('PCLZIP_OPT_REPLACE_NEWER', 77016);
|
||||
define('PCLZIP_OPT_STOP_ON_ERROR', 77017);
|
||||
// Having big trouble with crypt. Need to multiply 2 long int
|
||||
// which is not correctly supported by PHP ...
|
||||
//define('PCLZIP_OPT_CRYPT', 77018);
|
||||
define('PCLZIP_OPT_EXTRACT_DIR_RESTRICTION', 77019);
|
||||
define('PCLZIP_OPT_TEMP_FILE_THRESHOLD', 77020);
|
||||
define('PCLZIP_OPT_ADD_TEMP_FILE_THRESHOLD', 77020); // alias
|
||||
define('PCLZIP_OPT_TEMP_FILE_ON', 77021);
|
||||
define('PCLZIP_OPT_ADD_TEMP_FILE_ON', 77021); // alias
|
||||
define('PCLZIP_OPT_TEMP_FILE_OFF', 77022);
|
||||
define('PCLZIP_OPT_ADD_TEMP_FILE_OFF', 77022); // alias
|
||||
|
||||
// ----- File description attributes
|
||||
define( 'PCLZIP_ATT_FILE_NAME', 79001 );
|
||||
define( 'PCLZIP_ATT_FILE_NEW_SHORT_NAME', 79002 );
|
||||
define( 'PCLZIP_ATT_FILE_NEW_FULL_NAME', 79003 );
|
||||
define( 'PCLZIP_ATT_FILE_MTIME', 79004 );
|
||||
define( 'PCLZIP_ATT_FILE_CONTENT', 79005 );
|
||||
define( 'PCLZIP_ATT_FILE_COMMENT', 79006 );
|
||||
// ----- File description attributes
|
||||
define('PCLZIP_ATT_FILE_NAME', 79001);
|
||||
define('PCLZIP_ATT_FILE_NEW_SHORT_NAME', 79002);
|
||||
define('PCLZIP_ATT_FILE_NEW_FULL_NAME', 79003);
|
||||
define('PCLZIP_ATT_FILE_MTIME', 79004);
|
||||
define('PCLZIP_ATT_FILE_CONTENT', 79005);
|
||||
define('PCLZIP_ATT_FILE_COMMENT', 79006);
|
||||
|
||||
// ----- Call backs values
|
||||
define( 'PCLZIP_CB_PRE_EXTRACT', 78001 );
|
||||
define( 'PCLZIP_CB_POST_EXTRACT', 78002 );
|
||||
define( 'PCLZIP_CB_PRE_ADD', 78003 );
|
||||
define( 'PCLZIP_CB_POST_ADD', 78004 );
|
||||
/* For futur use
|
||||
define( 'PCLZIP_CB_PRE_LIST', 78005 );
|
||||
define( 'PCLZIP_CB_POST_LIST', 78006 );
|
||||
define( 'PCLZIP_CB_PRE_DELETE', 78007 );
|
||||
define( 'PCLZIP_CB_POST_DELETE', 78008 );
|
||||
*/
|
||||
// ----- Call backs values
|
||||
define('PCLZIP_CB_PRE_EXTRACT', 78001);
|
||||
define('PCLZIP_CB_POST_EXTRACT', 78002);
|
||||
define('PCLZIP_CB_PRE_ADD', 78003);
|
||||
define('PCLZIP_CB_POST_ADD', 78004);
|
||||
/* For futur use
|
||||
define('PCLZIP_CB_PRE_LIST', 78005);
|
||||
define('PCLZIP_CB_POST_LIST', 78006);
|
||||
define('PCLZIP_CB_PRE_DELETE', 78007);
|
||||
define('PCLZIP_CB_POST_DELETE', 78008);
|
||||
*/
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
// Class : PclZip
|
||||
// Description :
|
||||
// PclZip is the class that represent a Zip archive.
|
||||
// The public methods allow the manipulation of the archive.
|
||||
// Attributes :
|
||||
// Attributes must not be accessed directly.
|
||||
// Methods :
|
||||
// PclZip() : Object creator
|
||||
// create() : Creates the Zip archive
|
||||
// listContent() : List the content of the Zip archive
|
||||
// extract() : Extract the content of the archive
|
||||
// properties() : List the properties of the archive
|
||||
// --------------------------------------------------------------------------------
|
||||
class PclZip
|
||||
{
|
||||
// --------------------------------------------------------------------------------
|
||||
// Class : PclZip
|
||||
// Description :
|
||||
// PclZip is the class that represent a Zip archive.
|
||||
// The public methods allow the manipulation of the archive.
|
||||
// Attributes :
|
||||
// Attributes must not be accessed directly.
|
||||
// Methods :
|
||||
// PclZip() : Object creator
|
||||
// create() : Creates the Zip archive
|
||||
// listContent() : List the content of the Zip archive
|
||||
// extract() : Extract the content of the archive
|
||||
// properties() : List the properties of the archive
|
||||
// --------------------------------------------------------------------------------
|
||||
class PclZip
|
||||
{
|
||||
// ----- Filename of the zip file
|
||||
var $zipname = '';
|
||||
|
||||
|
@ -216,8 +216,7 @@
|
|||
{
|
||||
|
||||
// ----- Tests the zlib
|
||||
if (!function_exists('gzopen'))
|
||||
{
|
||||
if (!function_exists('gzopen')) {
|
||||
die('Abort '.basename(__FILE__).' : Missing zlib extensions');
|
||||
}
|
||||
|
||||
|
@ -229,6 +228,7 @@
|
|||
// ----- Return
|
||||
return;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
|
@ -307,7 +307,7 @@
|
|||
PCLZIP_OPT_TEMP_FILE_ON => 'optional',
|
||||
PCLZIP_OPT_TEMP_FILE_OFF => 'optional'
|
||||
//, PCLZIP_OPT_CRYPT => 'optional'
|
||||
));
|
||||
));
|
||||
if ($v_result != 1) {
|
||||
return 0;
|
||||
}
|
||||
|
@ -382,13 +382,13 @@
|
|||
|
||||
// ----- For each file in the list check the attributes
|
||||
$v_supported_attributes
|
||||
= array ( PCLZIP_ATT_FILE_NAME => 'mandatory'
|
||||
= array (PCLZIP_ATT_FILE_NAME => 'mandatory'
|
||||
,PCLZIP_ATT_FILE_NEW_SHORT_NAME => 'optional'
|
||||
,PCLZIP_ATT_FILE_NEW_FULL_NAME => 'optional'
|
||||
,PCLZIP_ATT_FILE_MTIME => 'optional'
|
||||
,PCLZIP_ATT_FILE_CONTENT => 'optional'
|
||||
,PCLZIP_ATT_FILE_COMMENT => 'optional'
|
||||
);
|
||||
);
|
||||
foreach ($v_att_list as $v_entry) {
|
||||
$v_result = $this->privFileDescrParseAtt($v_entry,
|
||||
$v_filedescr_list[],
|
||||
|
@ -492,7 +492,7 @@
|
|||
PCLZIP_OPT_TEMP_FILE_ON => 'optional',
|
||||
PCLZIP_OPT_TEMP_FILE_OFF => 'optional'
|
||||
//, PCLZIP_OPT_CRYPT => 'optional'
|
||||
));
|
||||
));
|
||||
if ($v_result != 1) {
|
||||
return 0;
|
||||
}
|
||||
|
@ -565,13 +565,13 @@
|
|||
|
||||
// ----- For each file in the list check the attributes
|
||||
$v_supported_attributes
|
||||
= array ( PCLZIP_ATT_FILE_NAME => 'mandatory'
|
||||
= array (PCLZIP_ATT_FILE_NAME => 'mandatory'
|
||||
,PCLZIP_ATT_FILE_NEW_SHORT_NAME => 'optional'
|
||||
,PCLZIP_ATT_FILE_NEW_FULL_NAME => 'optional'
|
||||
,PCLZIP_ATT_FILE_MTIME => 'optional'
|
||||
,PCLZIP_ATT_FILE_CONTENT => 'optional'
|
||||
,PCLZIP_ATT_FILE_COMMENT => 'optional'
|
||||
);
|
||||
);
|
||||
foreach ($v_att_list as $v_entry) {
|
||||
$v_result = $this->privFileDescrParseAtt($v_entry,
|
||||
$v_filedescr_list[],
|
||||
|
@ -751,7 +751,7 @@
|
|||
PCLZIP_OPT_TEMP_FILE_THRESHOLD => 'optional',
|
||||
PCLZIP_OPT_TEMP_FILE_ON => 'optional',
|
||||
PCLZIP_OPT_TEMP_FILE_OFF => 'optional'
|
||||
));
|
||||
));
|
||||
if ($v_result != 1) {
|
||||
return 0;
|
||||
}
|
||||
|
@ -907,7 +907,7 @@
|
|||
PCLZIP_OPT_TEMP_FILE_THRESHOLD => 'optional',
|
||||
PCLZIP_OPT_TEMP_FILE_ON => 'optional',
|
||||
PCLZIP_OPT_TEMP_FILE_OFF => 'optional'
|
||||
));
|
||||
));
|
||||
if ($v_result != 1) {
|
||||
return 0;
|
||||
}
|
||||
|
@ -966,7 +966,7 @@
|
|||
$v_arg_trick = array (PCLZIP_OPT_BY_INDEX, $p_index);
|
||||
$v_options_trick = array();
|
||||
$v_result = $this->privParseOptions($v_arg_trick, sizeof($v_arg_trick), $v_options_trick,
|
||||
array (PCLZIP_OPT_BY_INDEX => 'optional' ));
|
||||
array (PCLZIP_OPT_BY_INDEX => 'optional'));
|
||||
if ($v_result != 1) {
|
||||
return 0;
|
||||
}
|
||||
|
@ -1031,7 +1031,7 @@
|
|||
array (PCLZIP_OPT_BY_NAME => 'optional',
|
||||
PCLZIP_OPT_BY_EREG => 'optional',
|
||||
PCLZIP_OPT_BY_PREG => 'optional',
|
||||
PCLZIP_OPT_BY_INDEX => 'optional' ));
|
||||
PCLZIP_OPT_BY_INDEX => 'optional'));
|
||||
if ($v_result != 1) {
|
||||
return 0;
|
||||
}
|
||||
|
@ -1287,7 +1287,7 @@
|
|||
// --------------------------------------------------------------------------------
|
||||
function errorName($p_with_code=false)
|
||||
{
|
||||
$v_name = array ( PCLZIP_ERR_NO_ERROR => 'PCLZIP_ERR_NO_ERROR',
|
||||
$v_name = array (PCLZIP_ERR_NO_ERROR => 'PCLZIP_ERR_NO_ERROR',
|
||||
PCLZIP_ERR_WRITE_OPEN_FAIL => 'PCLZIP_ERR_WRITE_OPEN_FAIL',
|
||||
PCLZIP_ERR_READ_OPEN_FAIL => 'PCLZIP_ERR_READ_OPEN_FAIL',
|
||||
PCLZIP_ERR_INVALID_PARAMETER => 'PCLZIP_ERR_INVALID_PARAMETER',
|
||||
|
@ -1308,7 +1308,7 @@
|
|||
PCLZIP_ERR_UNSUPPORTED_ENCRYPTION => 'PCLZIP_ERR_UNSUPPORTED_ENCRYPTION'
|
||||
,PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE => 'PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE'
|
||||
,PCLZIP_ERR_DIRECTORY_RESTRICTION => 'PCLZIP_ERR_DIRECTORY_RESTRICTION'
|
||||
);
|
||||
);
|
||||
|
||||
if (isset($v_name[$this->error_code])) {
|
||||
$v_value = $v_name[$this->error_code];
|
||||
|
@ -1521,7 +1521,7 @@
|
|||
}
|
||||
|
||||
// ----- Get the value
|
||||
if ( is_string($p_options_list[$i+1])
|
||||
if (is_string($p_options_list[$i+1])
|
||||
&& ($p_options_list[$i+1] != '')) {
|
||||
$v_result_list[$p_options_list[$i]] = PclZipUtilTranslateWinPath($p_options_list[$i+1], FALSE);
|
||||
$i++;
|
||||
|
@ -2482,7 +2482,7 @@
|
|||
}
|
||||
|
||||
// ----- Check the filename
|
||||
if ( ($p_filedescr_list[$j]['type'] != 'virtual_file')
|
||||
if (($p_filedescr_list[$j]['type'] != 'virtual_file')
|
||||
&& (!file_exists($p_filedescr_list[$j]['filename']))) {
|
||||
PclZip::privErrorLog(PCLZIP_ERR_MISSING_FILE, "File '".$p_filedescr_list[$j]['filename']."' does not exist");
|
||||
return PclZip::errorCode();
|
||||
|
@ -2490,14 +2490,14 @@
|
|||
|
||||
// ----- Look if it is a file or a dir with no all path remove option
|
||||
// or a dir with all its path removed
|
||||
// if ( (is_file($p_filedescr_list[$j]['filename']))
|
||||
// || ( is_dir($p_filedescr_list[$j]['filename'])
|
||||
if ( ($p_filedescr_list[$j]['type'] == 'file')
|
||||
// if ((is_file($p_filedescr_list[$j]['filename']))
|
||||
// || (is_dir($p_filedescr_list[$j]['filename'])
|
||||
if (($p_filedescr_list[$j]['type'] == 'file')
|
||||
|| ($p_filedescr_list[$j]['type'] == 'virtual_file')
|
||||
|| ( ($p_filedescr_list[$j]['type'] == 'folder')
|
||||
&& ( !isset($p_options[PCLZIP_OPT_REMOVE_ALL_PATH])
|
||||
|| (($p_filedescr_list[$j]['type'] == 'folder')
|
||||
&& (!isset($p_options[PCLZIP_OPT_REMOVE_ALL_PATH])
|
||||
|| !$p_options[PCLZIP_OPT_REMOVE_ALL_PATH]))
|
||||
) {
|
||||
) {
|
||||
|
||||
// ----- Add the file
|
||||
$v_result = $this->privAddFile($p_filedescr_list[$j], $v_header,
|
||||
|
@ -2650,10 +2650,10 @@
|
|||
// ----- Look for a file
|
||||
if ($p_filedescr['type'] == 'file') {
|
||||
// ----- Look for using temporary file to zip
|
||||
if ( (!isset($p_options[PCLZIP_OPT_TEMP_FILE_OFF]))
|
||||
if ((!isset($p_options[PCLZIP_OPT_TEMP_FILE_OFF]))
|
||||
&& (isset($p_options[PCLZIP_OPT_TEMP_FILE_ON])
|
||||
|| (isset($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD])
|
||||
&& ($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD] <= $p_header['size'])) ) ) {
|
||||
&& ($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD] <= $p_header['size'])))) {
|
||||
$v_result = $this->privAddFileUsingTempFile($p_filedescr, $p_header, $p_options);
|
||||
if ($v_result < PCLZIP_ERR_NO_ERROR) {
|
||||
return $v_result;
|
||||
|
@ -2966,14 +2966,14 @@
|
|||
if (substr($p_remove_dir, -1) != '/')
|
||||
$p_remove_dir .= "/";
|
||||
|
||||
if ( (substr($p_filename, 0, 2) == "./")
|
||||
if ((substr($p_filename, 0, 2) == "./")
|
||||
|| (substr($p_remove_dir, 0, 2) == "./")) {
|
||||
|
||||
if ( (substr($p_filename, 0, 2) == "./")
|
||||
if ((substr($p_filename, 0, 2) == "./")
|
||||
&& (substr($p_remove_dir, 0, 2) != "./")) {
|
||||
$p_remove_dir = "./".$p_remove_dir;
|
||||
}
|
||||
if ( (substr($p_filename, 0, 2) != "./")
|
||||
if ((substr($p_filename, 0, 2) != "./")
|
||||
&& (substr($p_remove_dir, 0, 2) == "./")) {
|
||||
$p_remove_dir = substr($p_remove_dir, 2);
|
||||
}
|
||||
|
@ -3280,8 +3280,8 @@
|
|||
$this->privDisableMagicQuotes();
|
||||
|
||||
// ----- Check the path
|
||||
if ( ($p_path == "")
|
||||
|| ( (substr($p_path, 0, 1) != "/")
|
||||
if (($p_path == "")
|
||||
|| ((substr($p_path, 0, 1) != "/")
|
||||
&& (substr($p_path, 0, 3) != "../")
|
||||
&& (substr($p_path,1,2)!=":/")))
|
||||
$p_path = "./".$p_path;
|
||||
|
@ -3365,7 +3365,7 @@
|
|||
$v_extract = false;
|
||||
|
||||
// ----- Look for extract by name rule
|
||||
if ( (isset($p_options[PCLZIP_OPT_BY_NAME]))
|
||||
if ((isset($p_options[PCLZIP_OPT_BY_NAME]))
|
||||
&& ($p_options[PCLZIP_OPT_BY_NAME] != 0)) {
|
||||
|
||||
// ----- Look if the filename is in the list
|
||||
|
@ -3375,7 +3375,7 @@
|
|||
if (substr($p_options[PCLZIP_OPT_BY_NAME][$j], -1) == "/") {
|
||||
|
||||
// ----- Look if the directory is in the filename path
|
||||
if ( (strlen($v_header['stored_filename']) > strlen($p_options[PCLZIP_OPT_BY_NAME][$j]))
|
||||
if ((strlen($v_header['stored_filename']) > strlen($p_options[PCLZIP_OPT_BY_NAME][$j]))
|
||||
&& (substr($v_header['stored_filename'], 0, strlen($p_options[PCLZIP_OPT_BY_NAME][$j])) == $p_options[PCLZIP_OPT_BY_NAME][$j])) {
|
||||
$v_extract = true;
|
||||
}
|
||||
|
@ -3390,7 +3390,7 @@
|
|||
// ----- Look for extract by ereg rule
|
||||
// ereg() is deprecated with PHP 5.3
|
||||
/*
|
||||
else if ( (isset($p_options[PCLZIP_OPT_BY_EREG]))
|
||||
else if ((isset($p_options[PCLZIP_OPT_BY_EREG]))
|
||||
&& ($p_options[PCLZIP_OPT_BY_EREG] != "")) {
|
||||
|
||||
if (ereg($p_options[PCLZIP_OPT_BY_EREG], $v_header['stored_filename'])) {
|
||||
|
@ -3400,7 +3400,7 @@
|
|||
*/
|
||||
|
||||
// ----- Look for extract by preg rule
|
||||
else if ( (isset($p_options[PCLZIP_OPT_BY_PREG]))
|
||||
else if ((isset($p_options[PCLZIP_OPT_BY_PREG]))
|
||||
&& ($p_options[PCLZIP_OPT_BY_PREG] != "")) {
|
||||
|
||||
if (preg_match($p_options[PCLZIP_OPT_BY_PREG], $v_header['stored_filename'])) {
|
||||
|
@ -3409,7 +3409,7 @@
|
|||
}
|
||||
|
||||
// ----- Look for extract by index rule
|
||||
else if ( (isset($p_options[PCLZIP_OPT_BY_INDEX]))
|
||||
else if ((isset($p_options[PCLZIP_OPT_BY_INDEX]))
|
||||
&& ($p_options[PCLZIP_OPT_BY_INDEX] != 0)) {
|
||||
|
||||
// ----- Look if the index is in the list
|
||||
|
@ -3434,13 +3434,13 @@
|
|||
}
|
||||
|
||||
// ----- Check compression method
|
||||
if ( ($v_extract)
|
||||
&& ( ($v_header['compression'] != 8)
|
||||
if (($v_extract)
|
||||
&& (($v_header['compression'] != 8)
|
||||
&& ($v_header['compression'] != 0))) {
|
||||
$v_header['status'] = 'unsupported_compression';
|
||||
|
||||
// ----- Look for PCLZIP_OPT_STOP_ON_ERROR
|
||||
if ( (isset($p_options[PCLZIP_OPT_STOP_ON_ERROR]))
|
||||
if ((isset($p_options[PCLZIP_OPT_STOP_ON_ERROR]))
|
||||
&& ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) {
|
||||
|
||||
$this->privSwapBackMagicQuotes();
|
||||
|
@ -3459,7 +3459,7 @@
|
|||
$v_header['status'] = 'unsupported_encryption';
|
||||
|
||||
// ----- Look for PCLZIP_OPT_STOP_ON_ERROR
|
||||
if ( (isset($p_options[PCLZIP_OPT_STOP_ON_ERROR]))
|
||||
if ((isset($p_options[PCLZIP_OPT_STOP_ON_ERROR]))
|
||||
&& ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) {
|
||||
|
||||
$this->privSwapBackMagicQuotes();
|
||||
|
@ -3541,7 +3541,7 @@
|
|||
}
|
||||
}
|
||||
// ----- Look for extraction in standard output
|
||||
elseif ( (isset($p_options[PCLZIP_OPT_EXTRACT_IN_OUTPUT]))
|
||||
elseif ((isset($p_options[PCLZIP_OPT_EXTRACT_IN_OUTPUT]))
|
||||
&& ($p_options[PCLZIP_OPT_EXTRACT_IN_OUTPUT])) {
|
||||
// ----- Extracting the file in standard output
|
||||
$v_result1 = $this->privExtractFileInOutput($v_header, $p_options);
|
||||
|
@ -3734,7 +3734,7 @@
|
|||
// ----- Look for PCLZIP_OPT_STOP_ON_ERROR
|
||||
// For historical reason first PclZip implementation does not stop
|
||||
// when this kind of error occurs.
|
||||
if ( (isset($p_options[PCLZIP_OPT_STOP_ON_ERROR]))
|
||||
if ((isset($p_options[PCLZIP_OPT_STOP_ON_ERROR]))
|
||||
&& ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) {
|
||||
|
||||
PclZip::privErrorLog(PCLZIP_ERR_ALREADY_A_DIRECTORY,
|
||||
|
@ -3754,7 +3754,7 @@
|
|||
// ----- Look for PCLZIP_OPT_STOP_ON_ERROR
|
||||
// For historical reason first PclZip implementation does not stop
|
||||
// when this kind of error occurs.
|
||||
if ( (isset($p_options[PCLZIP_OPT_STOP_ON_ERROR]))
|
||||
if ((isset($p_options[PCLZIP_OPT_STOP_ON_ERROR]))
|
||||
&& ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) {
|
||||
|
||||
PclZip::privErrorLog(PCLZIP_ERR_WRITE_OPEN_FAIL,
|
||||
|
@ -3769,7 +3769,7 @@
|
|||
else if (filemtime($p_entry['filename']) > $p_entry['mtime'])
|
||||
{
|
||||
// ----- Change the file status
|
||||
if ( (isset($p_options[PCLZIP_OPT_REPLACE_NEWER]))
|
||||
if ((isset($p_options[PCLZIP_OPT_REPLACE_NEWER]))
|
||||
&& ($p_options[PCLZIP_OPT_REPLACE_NEWER]===true)) {
|
||||
}
|
||||
else {
|
||||
|
@ -3778,7 +3778,7 @@
|
|||
// ----- Look for PCLZIP_OPT_STOP_ON_ERROR
|
||||
// For historical reason first PclZip implementation does not stop
|
||||
// when this kind of error occurs.
|
||||
if ( (isset($p_options[PCLZIP_OPT_STOP_ON_ERROR]))
|
||||
if ((isset($p_options[PCLZIP_OPT_STOP_ON_ERROR]))
|
||||
&& ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) {
|
||||
|
||||
PclZip::privErrorLog(PCLZIP_ERR_WRITE_OPEN_FAIL,
|
||||
|
@ -3867,10 +3867,10 @@
|
|||
|
||||
|
||||
// ----- Look for using temporary file to unzip
|
||||
if ( (!isset($p_options[PCLZIP_OPT_TEMP_FILE_OFF]))
|
||||
if ((!isset($p_options[PCLZIP_OPT_TEMP_FILE_OFF]))
|
||||
&& (isset($p_options[PCLZIP_OPT_TEMP_FILE_ON])
|
||||
|| (isset($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD])
|
||||
&& ($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD] <= $p_entry['size'])) ) ) {
|
||||
&& ($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD] <= $p_entry['size'])))) {
|
||||
$v_result = $this->privExtractFileUsingTempFile($p_entry, $p_options);
|
||||
if ($v_result < PCLZIP_ERR_NO_ERROR) {
|
||||
return $v_result;
|
||||
|
@ -4591,7 +4591,7 @@
|
|||
//$v_bytes = ($v_bytes << 8) | Ord($v_byte);
|
||||
// Note we mask the old value down such that once shifted we can never end up with more than a 32bit number
|
||||
// Otherwise on systems where we have 64bit integers the check below for the magic number will fail.
|
||||
$v_bytes = ( ($v_bytes & 0xFFFFFF) << 8) | Ord($v_byte);
|
||||
$v_bytes = (($v_bytes & 0xFFFFFF) << 8) | Ord($v_byte);
|
||||
|
||||
// ----- Compare the bytes
|
||||
if ($v_bytes == 0x504b0506)
|
||||
|
@ -4742,7 +4742,7 @@
|
|||
$v_found = false;
|
||||
|
||||
// ----- Look for extract by name rule
|
||||
if ( (isset($p_options[PCLZIP_OPT_BY_NAME]))
|
||||
if ((isset($p_options[PCLZIP_OPT_BY_NAME]))
|
||||
&& ($p_options[PCLZIP_OPT_BY_NAME] != 0)) {
|
||||
|
||||
// ----- Look if the filename is in the list
|
||||
|
@ -4752,11 +4752,11 @@
|
|||
if (substr($p_options[PCLZIP_OPT_BY_NAME][$j], -1) == "/") {
|
||||
|
||||
// ----- Look if the directory is in the filename path
|
||||
if ( (strlen($v_header_list[$v_nb_extracted]['stored_filename']) > strlen($p_options[PCLZIP_OPT_BY_NAME][$j]))
|
||||
if ((strlen($v_header_list[$v_nb_extracted]['stored_filename']) > strlen($p_options[PCLZIP_OPT_BY_NAME][$j]))
|
||||
&& (substr($v_header_list[$v_nb_extracted]['stored_filename'], 0, strlen($p_options[PCLZIP_OPT_BY_NAME][$j])) == $p_options[PCLZIP_OPT_BY_NAME][$j])) {
|
||||
$v_found = true;
|
||||
}
|
||||
elseif ( (($v_header_list[$v_nb_extracted]['external']&0x00000010)==0x00000010) /* Indicates a folder */
|
||||
elseif ((($v_header_list[$v_nb_extracted]['external']&0x00000010)==0x00000010) /* Indicates a folder */
|
||||
&& ($v_header_list[$v_nb_extracted]['stored_filename'].'/' == $p_options[PCLZIP_OPT_BY_NAME][$j])) {
|
||||
$v_found = true;
|
||||
}
|
||||
|
@ -4771,7 +4771,7 @@
|
|||
// ----- Look for extract by ereg rule
|
||||
// ereg() is deprecated with PHP 5.3
|
||||
/*
|
||||
else if ( (isset($p_options[PCLZIP_OPT_BY_EREG]))
|
||||
else if ((isset($p_options[PCLZIP_OPT_BY_EREG]))
|
||||
&& ($p_options[PCLZIP_OPT_BY_EREG] != "")) {
|
||||
|
||||
if (ereg($p_options[PCLZIP_OPT_BY_EREG], $v_header_list[$v_nb_extracted]['stored_filename'])) {
|
||||
|
@ -4781,7 +4781,7 @@
|
|||
*/
|
||||
|
||||
// ----- Look for extract by preg rule
|
||||
else if ( (isset($p_options[PCLZIP_OPT_BY_PREG]))
|
||||
else if ((isset($p_options[PCLZIP_OPT_BY_PREG]))
|
||||
&& ($p_options[PCLZIP_OPT_BY_PREG] != "")) {
|
||||
|
||||
if (preg_match($p_options[PCLZIP_OPT_BY_PREG], $v_header_list[$v_nb_extracted]['stored_filename'])) {
|
||||
|
@ -4790,7 +4790,7 @@
|
|||
}
|
||||
|
||||
// ----- Look for extract by index rule
|
||||
else if ( (isset($p_options[PCLZIP_OPT_BY_INDEX]))
|
||||
else if ((isset($p_options[PCLZIP_OPT_BY_INDEX]))
|
||||
&& ($p_options[PCLZIP_OPT_BY_INDEX] != 0)) {
|
||||
|
||||
// ----- Look if the index is in the list
|
||||
|
@ -5329,7 +5329,7 @@
|
|||
$v_result=1;
|
||||
|
||||
// ----- Look if function exists
|
||||
if ( (!function_exists("get_magic_quotes_runtime"))
|
||||
if ((!function_exists("get_magic_quotes_runtime"))
|
||||
|| (!function_exists("set_magic_quotes_runtime"))) {
|
||||
return $v_result;
|
||||
}
|
||||
|
@ -5363,7 +5363,7 @@
|
|||
$v_result=1;
|
||||
|
||||
// ----- Look if function exists
|
||||
if ( (!function_exists("get_magic_quotes_runtime"))
|
||||
if ((!function_exists("get_magic_quotes_runtime"))
|
||||
|| (!function_exists("set_magic_quotes_runtime"))) {
|
||||
return $v_result;
|
||||
}
|
||||
|
@ -5479,11 +5479,11 @@
|
|||
$v_result = 1;
|
||||
|
||||
// ----- Look for path beginning by ./
|
||||
if ( ($p_dir == '.')
|
||||
if (($p_dir == '.')
|
||||
|| ((strlen($p_dir) >=2) && (substr($p_dir, 0, 2) == './'))) {
|
||||
$p_dir = PclZipUtilTranslateWinPath(getcwd(), FALSE).'/'.substr($p_dir, 1);
|
||||
}
|
||||
if ( ($p_path == '.')
|
||||
if (($p_path == '.')
|
||||
|| ((strlen($p_path) >=2) && (substr($p_path, 0, 2) == './'))) {
|
||||
$p_path = PclZipUtilTranslateWinPath(getcwd(), FALSE).'/'.substr($p_path, 1);
|
||||
}
|
||||
|
@ -5510,7 +5510,7 @@
|
|||
}
|
||||
|
||||
// ----- Compare the items
|
||||
if (($v_list_dir[$i] != $v_list_path[$j]) && ($v_list_dir[$i] != '') && ( $v_list_path[$j] != '')) {
|
||||
if (($v_list_dir[$i] != $v_list_path[$j]) && ($v_list_dir[$i] != '') && ($v_list_path[$j] != '')) {
|
||||
$v_result = 0;
|
||||
}
|
||||
|
||||
|
@ -5649,7 +5649,7 @@
|
|||
$v_list = get_defined_constants();
|
||||
for (reset($v_list); $v_key = key($v_list); next($v_list)) {
|
||||
$v_prefix = substr($v_key, 0, 10);
|
||||
if (( ($v_prefix == 'PCLZIP_OPT')
|
||||
if ((($v_prefix == 'PCLZIP_OPT')
|
||||
|| ($v_prefix == 'PCLZIP_CB_')
|
||||
|| ($v_prefix == 'PCLZIP_ATT'))
|
||||
&& ($v_list[$v_key] == $p_option)) {
|
||||
|
|
Loading…
Reference in New Issue