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