@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | * |
95 | 95 | * @acces public |
96 | 96 | * @param string $file |
97 | - * @return mixed true on success, PEAR_Error on failure |
|
97 | + * @return boolean true on success, PEAR_Error on failure |
|
98 | 98 | * @throws \PHPExcel\Reader\Exception |
99 | 99 | */ |
100 | 100 | public function read($file) |
@@ -225,6 +225,7 @@ discard block |
||
225 | 225 | /** |
226 | 226 | * Reads a signed char. |
227 | 227 | * @param resource file handle |
228 | + * @param resource $fh |
|
228 | 229 | * @return int |
229 | 230 | * @access public |
230 | 231 | */ |
@@ -237,6 +238,7 @@ discard block |
||
237 | 238 | /** |
238 | 239 | * Reads an unsigned short (2 octets). |
239 | 240 | * @param resource file handle |
241 | + * @param resource $fh |
|
240 | 242 | * @return int |
241 | 243 | * @access public |
242 | 244 | */ |
@@ -249,6 +251,7 @@ discard block |
||
249 | 251 | /** |
250 | 252 | * Reads an unsigned long (4 octets). |
251 | 253 | * @param resource file handle |
254 | + * @param resource $fh |
|
252 | 255 | * @return int |
253 | 256 | * @access public |
254 | 257 | */ |
@@ -264,7 +267,8 @@ discard block |
||
264 | 267 | * |
265 | 268 | * @access public |
266 | 269 | * @param integer the block id of the first block |
267 | - * @return mixed true on success, PEAR_Error on failure |
|
270 | + * @param integer $blockId |
|
271 | + * @return boolean true on success, PEAR_Error on failure |
|
268 | 272 | */ |
269 | 273 | public function _readPpsWks($blockId) |
270 | 274 | { |
@@ -50,43 +50,43 @@ discard block |
||
50 | 50 | /** |
51 | 51 | * The file handle for reading an OLE container |
52 | 52 | * @var resource |
53 | - */ |
|
53 | + */ |
|
54 | 54 | public $_file_handle; |
55 | 55 | |
56 | 56 | /** |
57 | - * Array of PPS's found on the OLE container |
|
58 | - * @var array |
|
59 | - */ |
|
57 | + * Array of PPS's found on the OLE container |
|
58 | + * @var array |
|
59 | + */ |
|
60 | 60 | public $_list = array(); |
61 | 61 | |
62 | 62 | /** |
63 | 63 | * Root directory of OLE container |
64 | 64 | * @var OLE_PPS_Root |
65 | - */ |
|
65 | + */ |
|
66 | 66 | public $root; |
67 | 67 | |
68 | 68 | /** |
69 | 69 | * Big Block Allocation Table |
70 | 70 | * @var array (blockId => nextBlockId) |
71 | - */ |
|
71 | + */ |
|
72 | 72 | public $bbat; |
73 | 73 | |
74 | 74 | /** |
75 | 75 | * Short Block Allocation Table |
76 | 76 | * @var array (blockId => nextBlockId) |
77 | - */ |
|
77 | + */ |
|
78 | 78 | public $sbat; |
79 | 79 | |
80 | 80 | /** |
81 | 81 | * Size of big blocks. This is usually 512. |
82 | 82 | * @var int number of octets per block. |
83 | - */ |
|
83 | + */ |
|
84 | 84 | public $bigBlockSize; |
85 | 85 | |
86 | 86 | /** |
87 | 87 | * Size of small blocks. This is usually 64. |
88 | 88 | * @var int number of octets per block |
89 | - */ |
|
89 | + */ |
|
90 | 90 | public $smallBlockSize; |
91 | 91 | |
92 | 92 | /** |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | * @param string $file |
97 | 97 | * @return mixed true on success, PEAR_Error on failure |
98 | 98 | * @throws \PHPExcel\Reader\Exception |
99 | - */ |
|
99 | + */ |
|
100 | 100 | public function read($file) |
101 | 101 | { |
102 | 102 | $fh = fopen($file, "r"); |
@@ -193,11 +193,11 @@ discard block |
||
193 | 193 | } |
194 | 194 | |
195 | 195 | /** |
196 | - * Returns a stream for use with fread() etc. External callers should |
|
197 | - * use \PHPExcel\Shared\OLE\PPS\File::getStream(). |
|
198 | - * @param int|PPS block id or PPS |
|
199 | - * @return resource read-only stream |
|
200 | - */ |
|
196 | + * Returns a stream for use with fread() etc. External callers should |
|
197 | + * use \PHPExcel\Shared\OLE\PPS\File::getStream(). |
|
198 | + * @param int|PPS block id or PPS |
|
199 | + * @return resource read-only stream |
|
200 | + */ |
|
201 | 201 | public function getStream($blockIdOrPps) |
202 | 202 | { |
203 | 203 | static $isRegistered = false; |
@@ -259,13 +259,13 @@ discard block |
||
259 | 259 | } |
260 | 260 | |
261 | 261 | /** |
262 | - * Gets information about all PPS's on the OLE container from the PPS WK's |
|
263 | - * creates an OLE_PPS object for each one. |
|
264 | - * |
|
265 | - * @access public |
|
266 | - * @param integer the block id of the first block |
|
267 | - * @return mixed true on success, PEAR_Error on failure |
|
268 | - */ |
|
262 | + * Gets information about all PPS's on the OLE container from the PPS WK's |
|
263 | + * creates an OLE_PPS object for each one. |
|
264 | + * |
|
265 | + * @access public |
|
266 | + * @param integer the block id of the first block |
|
267 | + * @return mixed true on success, PEAR_Error on failure |
|
268 | + */ |
|
269 | 269 | public function _readPpsWks($blockId) |
270 | 270 | { |
271 | 271 | $fh = $this->getStream($blockId); |
@@ -333,13 +333,13 @@ discard block |
||
333 | 333 | } |
334 | 334 | |
335 | 335 | /** |
336 | - * It checks whether the PPS tree is complete (all PPS's read) |
|
337 | - * starting with the given PPS (not necessarily root) |
|
338 | - * |
|
339 | - * @access public |
|
340 | - * @param integer $index The index of the PPS from which we are checking |
|
341 | - * @return boolean Whether the PPS tree for the given PPS is complete |
|
342 | - */ |
|
336 | + * It checks whether the PPS tree is complete (all PPS's read) |
|
337 | + * starting with the given PPS (not necessarily root) |
|
338 | + * |
|
339 | + * @access public |
|
340 | + * @param integer $index The index of the PPS from which we are checking |
|
341 | + * @return boolean Whether the PPS tree for the given PPS is complete |
|
342 | + */ |
|
343 | 343 | public function _ppsTreeComplete($index) |
344 | 344 | { |
345 | 345 | return isset($this->_list[$index]) && |
@@ -353,13 +353,13 @@ discard block |
||
353 | 353 | } |
354 | 354 | |
355 | 355 | /** |
356 | - * Checks whether a PPS is a File PPS or not. |
|
357 | - * If there is no PPS for the index given, it will return false. |
|
358 | - * |
|
359 | - * @access public |
|
360 | - * @param integer $index The index for the PPS |
|
361 | - * @return bool true if it's a File PPS, false otherwise |
|
362 | - */ |
|
356 | + * Checks whether a PPS is a File PPS or not. |
|
357 | + * If there is no PPS for the index given, it will return false. |
|
358 | + * |
|
359 | + * @access public |
|
360 | + * @param integer $index The index for the PPS |
|
361 | + * @return bool true if it's a File PPS, false otherwise |
|
362 | + */ |
|
363 | 363 | public function isFile($index) |
364 | 364 | { |
365 | 365 | if (isset($this->_list[$index])) { |
@@ -369,13 +369,13 @@ discard block |
||
369 | 369 | } |
370 | 370 | |
371 | 371 | /** |
372 | - * Checks whether a PPS is a Root PPS or not. |
|
373 | - * If there is no PPS for the index given, it will return false. |
|
374 | - * |
|
375 | - * @access public |
|
376 | - * @param integer $index The index for the PPS. |
|
377 | - * @return bool true if it's a Root PPS, false otherwise |
|
378 | - */ |
|
372 | + * Checks whether a PPS is a Root PPS or not. |
|
373 | + * If there is no PPS for the index given, it will return false. |
|
374 | + * |
|
375 | + * @access public |
|
376 | + * @param integer $index The index for the PPS. |
|
377 | + * @return bool true if it's a Root PPS, false otherwise |
|
378 | + */ |
|
379 | 379 | public function isRoot($index) |
380 | 380 | { |
381 | 381 | if (isset($this->_list[$index])) { |
@@ -385,28 +385,28 @@ discard block |
||
385 | 385 | } |
386 | 386 | |
387 | 387 | /** |
388 | - * Gives the total number of PPS's found in the OLE container. |
|
389 | - * |
|
390 | - * @access public |
|
391 | - * @return integer The total number of PPS's found in the OLE container |
|
392 | - */ |
|
388 | + * Gives the total number of PPS's found in the OLE container. |
|
389 | + * |
|
390 | + * @access public |
|
391 | + * @return integer The total number of PPS's found in the OLE container |
|
392 | + */ |
|
393 | 393 | public function ppsTotal() |
394 | 394 | { |
395 | 395 | return count($this->_list); |
396 | 396 | } |
397 | 397 | |
398 | 398 | /** |
399 | - * Gets data from a PPS |
|
400 | - * If there is no PPS for the index given, it will return an empty string. |
|
401 | - * |
|
402 | - * @access public |
|
403 | - * @param integer $index The index for the PPS |
|
404 | - * @param integer $position The position from which to start reading |
|
405 | - * (relative to the PPS) |
|
406 | - * @param integer $length The amount of bytes to read (at most) |
|
407 | - * @return string The binary string containing the data requested |
|
408 | - * @see OLE_PPS_File::getStream() |
|
409 | - */ |
|
399 | + * Gets data from a PPS |
|
400 | + * If there is no PPS for the index given, it will return an empty string. |
|
401 | + * |
|
402 | + * @access public |
|
403 | + * @param integer $index The index for the PPS |
|
404 | + * @param integer $position The position from which to start reading |
|
405 | + * (relative to the PPS) |
|
406 | + * @param integer $length The amount of bytes to read (at most) |
|
407 | + * @return string The binary string containing the data requested |
|
408 | + * @see OLE_PPS_File::getStream() |
|
409 | + */ |
|
410 | 410 | public function getData($index, $position, $length) |
411 | 411 | { |
412 | 412 | // if position is not valid return empty string |
@@ -420,13 +420,13 @@ discard block |
||
420 | 420 | } |
421 | 421 | |
422 | 422 | /** |
423 | - * Gets the data length from a PPS |
|
424 | - * If there is no PPS for the index given, it will return 0. |
|
425 | - * |
|
426 | - * @access public |
|
427 | - * @param integer $index The index for the PPS |
|
428 | - * @return integer The amount of bytes in data the PPS has |
|
429 | - */ |
|
423 | + * Gets the data length from a PPS |
|
424 | + * If there is no PPS for the index given, it will return 0. |
|
425 | + * |
|
426 | + * @access public |
|
427 | + * @param integer $index The index for the PPS |
|
428 | + * @return integer The amount of bytes in data the PPS has |
|
429 | + */ |
|
430 | 430 | public function getDataLength($index) |
431 | 431 | { |
432 | 432 | if (isset($this->_list[$index])) { |
@@ -436,13 +436,13 @@ discard block |
||
436 | 436 | } |
437 | 437 | |
438 | 438 | /** |
439 | - * Utility function to transform ASCII text to Unicode |
|
440 | - * |
|
441 | - * @access public |
|
442 | - * @static |
|
443 | - * @param string $ascii The ASCII string to transform |
|
444 | - * @return string The string in Unicode |
|
445 | - */ |
|
439 | + * Utility function to transform ASCII text to Unicode |
|
440 | + * |
|
441 | + * @access public |
|
442 | + * @static |
|
443 | + * @param string $ascii The ASCII string to transform |
|
444 | + * @return string The string in Unicode |
|
445 | + */ |
|
446 | 446 | public static function ascToUcs($ascii) |
447 | 447 | { |
448 | 448 | $rawname = ''; |
@@ -453,14 +453,14 @@ discard block |
||
453 | 453 | } |
454 | 454 | |
455 | 455 | /** |
456 | - * Utility function |
|
457 | - * Returns a string for the OLE container with the date given |
|
458 | - * |
|
459 | - * @access public |
|
460 | - * @static |
|
461 | - * @param integer $date A timestamp |
|
462 | - * @return string The string for the OLE container |
|
463 | - */ |
|
456 | + * Utility function |
|
457 | + * Returns a string for the OLE container with the date given |
|
458 | + * |
|
459 | + * @access public |
|
460 | + * @static |
|
461 | + * @param integer $date A timestamp |
|
462 | + * @return string The string for the OLE container |
|
463 | + */ |
|
464 | 464 | public static function localDateToOLE($date = null) |
465 | 465 | { |
466 | 466 | if (!isset($date)) { |
@@ -498,13 +498,13 @@ discard block |
||
498 | 498 | } |
499 | 499 | |
500 | 500 | /** |
501 | - * Returns a timestamp from an OLE container's date |
|
502 | - * |
|
503 | - * @access public |
|
504 | - * @static |
|
505 | - * @param integer $string A binary string with the encoded date |
|
506 | - * @return string The timestamp corresponding to the string |
|
507 | - */ |
|
501 | + * Returns a timestamp from an OLE container's date |
|
502 | + * |
|
503 | + * @access public |
|
504 | + * @static |
|
505 | + * @param integer $string A binary string with the encoded date |
|
506 | + * @return string The timestamp corresponding to the string |
|
507 | + */ |
|
508 | 508 | public static function OLE2LocalDate($string) |
509 | 509 | { |
510 | 510 | if (strlen($string) != 8) { |
@@ -40,12 +40,12 @@ discard block |
||
40 | 40 | */ |
41 | 41 | class OLE |
42 | 42 | { |
43 | - const OLE_PPS_TYPE_ROOT = 5; |
|
44 | - const OLE_PPS_TYPE_DIR = 1; |
|
45 | - const OLE_PPS_TYPE_FILE = 2; |
|
43 | + const OLE_PPS_TYPE_ROOT = 5; |
|
44 | + const OLE_PPS_TYPE_DIR = 1; |
|
45 | + const OLE_PPS_TYPE_FILE = 2; |
|
46 | 46 | const OLE_DATA_SIZE_SMALL = 0x1000; |
47 | - const OLE_LONG_INT_SIZE = 4; |
|
48 | - const OLE_PPS_SIZE = 0x80; |
|
47 | + const OLE_LONG_INT_SIZE = 4; |
|
48 | + const OLE_PPS_SIZE = 0x80; |
|
49 | 49 | |
50 | 50 | /** |
51 | 51 | * The file handle for reading an OLE container |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | } |
117 | 117 | // Size of blocks and short blocks in bytes |
118 | 118 | $this->bigBlockSize = pow(2, self::_readInt2($fh)); |
119 | - $this->smallBlockSize = pow(2, self::_readInt2($fh)); |
|
119 | + $this->smallBlockSize = pow(2, self::_readInt2($fh)); |
|
120 | 120 | |
121 | 121 | // Skip UID, revision number and version number |
122 | 122 | fseek($fh, 44); |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | public function _readPpsWks($blockId) |
270 | 270 | { |
271 | 271 | $fh = $this->getStream($blockId); |
272 | - for ($pos = 0;; $pos += 128) { |
|
272 | + for ($pos = 0; ; $pos += 128) { |
|
273 | 273 | fseek($fh, $pos, SEEK_SET); |
274 | 274 | $nameUtf16 = fread($fh, 64); |
275 | 275 | $nameLength = self::_readInt2($fh); |
@@ -473,7 +473,7 @@ discard block |
||
473 | 473 | // days from 1-1-1601 until the beggining of UNIX era |
474 | 474 | $days = 134774; |
475 | 475 | // calculate seconds |
476 | - $big_date = $days*24*3600 + gmmktime(date("H", $date), date("i", $date), date("s", $date), date("m", $date), date("d", $date), date("Y", $date)); |
|
476 | + $big_date = $days * 24 * 3600 + gmmktime(date("H", $date), date("i", $date), date("s", $date), date("m", $date), date("d", $date), date("Y", $date)); |
|
477 | 477 | // multiply just to make MS happy |
478 | 478 | $big_date *= 10000000; |
479 | 479 |
@@ -42,6 +42,7 @@ discard block |
||
42 | 42 | /** |
43 | 43 | * @param integer $time_1st A timestamp |
44 | 44 | * @param integer $time_2nd A timestamp |
45 | + * @param File[] $raChild |
|
45 | 46 | */ |
46 | 47 | public function __construct($time_1st, $time_2nd, $raChild) |
47 | 48 | { |
@@ -57,9 +58,9 @@ discard block |
||
57 | 58 | * If a resource pointer to a stream created by fopen() is passed |
58 | 59 | * it will be used, but you have to close such stream by yourself. |
59 | 60 | * |
60 | - * @param string|resource $filename The name of the file or stream where to save the OLE container. |
|
61 | + * @param string|null $filename The name of the file or stream where to save the OLE container. |
|
61 | 62 | * @access public |
62 | - * @return mixed true on success |
|
63 | + * @return boolean true on success |
|
63 | 64 | * @throws \PHPExcel\Writer\Exception |
64 | 65 | */ |
65 | 66 | public function save($filename) |
@@ -121,7 +122,7 @@ discard block |
||
121 | 122 | * |
122 | 123 | * @access public |
123 | 124 | * @param array $raList Reference to an array of PPS's |
124 | - * @return array The array of numbers |
|
125 | + * @return double[] The array of numbers |
|
125 | 126 | */ |
126 | 127 | public function _calcSize(&$raList) |
127 | 128 | { |
@@ -160,7 +161,7 @@ discard block |
||
160 | 161 | * @access public |
161 | 162 | * @param integer $i2 The argument |
162 | 163 | * @see save() |
163 | - * @return integer |
|
164 | + * @return double |
|
164 | 165 | */ |
165 | 166 | private static function adjust2($i2) |
166 | 167 | { |
@@ -51,17 +51,17 @@ discard block |
||
51 | 51 | } |
52 | 52 | |
53 | 53 | /** |
54 | - * Method for saving the whole OLE container (including files). |
|
55 | - * In fact, if called with an empty argument (or '-'), it saves to a |
|
56 | - * temporary file and then outputs it's contents to stdout. |
|
57 | - * If a resource pointer to a stream created by fopen() is passed |
|
58 | - * it will be used, but you have to close such stream by yourself. |
|
59 | - * |
|
60 | - * @param string|resource $filename The name of the file or stream where to save the OLE container. |
|
61 | - * @access public |
|
62 | - * @return mixed true on success |
|
63 | - * @throws \PHPExcel\Writer\Exception |
|
64 | - */ |
|
54 | + * Method for saving the whole OLE container (including files). |
|
55 | + * In fact, if called with an empty argument (or '-'), it saves to a |
|
56 | + * temporary file and then outputs it's contents to stdout. |
|
57 | + * If a resource pointer to a stream created by fopen() is passed |
|
58 | + * it will be used, but you have to close such stream by yourself. |
|
59 | + * |
|
60 | + * @param string|resource $filename The name of the file or stream where to save the OLE container. |
|
61 | + * @access public |
|
62 | + * @return mixed true on success |
|
63 | + * @throws \PHPExcel\Writer\Exception |
|
64 | + */ |
|
65 | 65 | public function save($filename) |
66 | 66 | { |
67 | 67 | // Initial Setting for saving |
@@ -117,12 +117,12 @@ discard block |
||
117 | 117 | } |
118 | 118 | |
119 | 119 | /** |
120 | - * Calculate some numbers |
|
121 | - * |
|
122 | - * @access public |
|
123 | - * @param array $raList Reference to an array of PPS's |
|
124 | - * @return array The array of numbers |
|
125 | - */ |
|
120 | + * Calculate some numbers |
|
121 | + * |
|
122 | + * @access public |
|
123 | + * @param array $raList Reference to an array of PPS's |
|
124 | + * @return array The array of numbers |
|
125 | + */ |
|
126 | 126 | public function _calcSize(&$raList) |
127 | 127 | { |
128 | 128 | // Calculate Basic Setting |
@@ -155,13 +155,13 @@ discard block |
||
155 | 155 | } |
156 | 156 | |
157 | 157 | /** |
158 | - * Helper function for caculating a magic value for block sizes |
|
159 | - * |
|
160 | - * @access public |
|
161 | - * @param integer $i2 The argument |
|
162 | - * @see save() |
|
163 | - * @return integer |
|
164 | - */ |
|
158 | + * Helper function for caculating a magic value for block sizes |
|
159 | + * |
|
160 | + * @access public |
|
161 | + * @param integer $i2 The argument |
|
162 | + * @see save() |
|
163 | + * @return integer |
|
164 | + */ |
|
165 | 165 | private static function adjust2($i2) |
166 | 166 | { |
167 | 167 | $iWk = log($i2)/log(2); |
@@ -169,13 +169,13 @@ discard block |
||
169 | 169 | } |
170 | 170 | |
171 | 171 | /** |
172 | - * Save OLE header |
|
173 | - * |
|
174 | - * @access public |
|
175 | - * @param integer $iSBDcnt |
|
176 | - * @param integer $iBBcnt |
|
177 | - * @param integer $iPPScnt |
|
178 | - */ |
|
172 | + * Save OLE header |
|
173 | + * |
|
174 | + * @access public |
|
175 | + * @param integer $iSBDcnt |
|
176 | + * @param integer $iBBcnt |
|
177 | + * @param integer $iPPScnt |
|
178 | + */ |
|
179 | 179 | public function _saveHeader($iSBDcnt, $iBBcnt, $iPPScnt) |
180 | 180 | { |
181 | 181 | $FILE = $this->_FILEH_; |
@@ -250,12 +250,12 @@ discard block |
||
250 | 250 | } |
251 | 251 | |
252 | 252 | /** |
253 | - * Saving big data (PPS's with data bigger than \PHPExcel\Shared\OLE::OLE_DATA_SIZE_SMALL) |
|
254 | - * |
|
255 | - * @access public |
|
256 | - * @param integer $iStBlk |
|
257 | - * @param array &$raList Reference to array of PPS's |
|
258 | - */ |
|
253 | + * Saving big data (PPS's with data bigger than \PHPExcel\Shared\OLE::OLE_DATA_SIZE_SMALL) |
|
254 | + * |
|
255 | + * @access public |
|
256 | + * @param integer $iStBlk |
|
257 | + * @param array &$raList Reference to array of PPS's |
|
258 | + */ |
|
259 | 259 | public function _saveBigData($iStBlk, &$raList) |
260 | 260 | { |
261 | 261 | $FILE = $this->_FILEH_; |
@@ -298,11 +298,11 @@ discard block |
||
298 | 298 | } |
299 | 299 | |
300 | 300 | /** |
301 | - * get small data (PPS's with data smaller than \PHPExcel\Shared\OLE::OLE_DATA_SIZE_SMALL) |
|
302 | - * |
|
303 | - * @access public |
|
304 | - * @param array &$raList Reference to array of PPS's |
|
305 | - */ |
|
301 | + * get small data (PPS's with data smaller than \PHPExcel\Shared\OLE::OLE_DATA_SIZE_SMALL) |
|
302 | + * |
|
303 | + * @access public |
|
304 | + * @param array &$raList Reference to array of PPS's |
|
305 | + */ |
|
306 | 306 | public function _makeSmallData(&$raList) |
307 | 307 | { |
308 | 308 | $sRes = ''; |
@@ -355,11 +355,11 @@ discard block |
||
355 | 355 | } |
356 | 356 | |
357 | 357 | /** |
358 | - * Saves all the PPS's WKs |
|
359 | - * |
|
360 | - * @access public |
|
361 | - * @param array $raList Reference to an array with all PPS's |
|
362 | - */ |
|
358 | + * Saves all the PPS's WKs |
|
359 | + * |
|
360 | + * @access public |
|
361 | + * @param array $raList Reference to an array with all PPS's |
|
362 | + */ |
|
363 | 363 | public function _savePps(&$raList) |
364 | 364 | { |
365 | 365 | // Save each PPS WK |
@@ -376,13 +376,13 @@ discard block |
||
376 | 376 | } |
377 | 377 | |
378 | 378 | /** |
379 | - * Saving Big Block Depot |
|
380 | - * |
|
381 | - * @access public |
|
382 | - * @param integer $iSbdSize |
|
383 | - * @param integer $iBsize |
|
384 | - * @param integer $iPpsCnt |
|
385 | - */ |
|
379 | + * Saving Big Block Depot |
|
380 | + * |
|
381 | + * @access public |
|
382 | + * @param integer $iSbdSize |
|
383 | + * @param integer $iBsize |
|
384 | + * @param integer $iPpsCnt |
|
385 | + */ |
|
386 | 386 | public function _saveBbd($iSbdSize, $iBsize, $iPpsCnt) |
387 | 387 | { |
388 | 388 | $FILE = $this->_FILEH_; |
@@ -65,13 +65,13 @@ discard block |
||
65 | 65 | public function save($filename) |
66 | 66 | { |
67 | 67 | // Initial Setting for saving |
68 | - $this->_BIG_BLOCK_SIZE = pow( |
|
68 | + $this->_BIG_BLOCK_SIZE = pow( |
|
69 | 69 | 2, |
70 | - (isset($this->_BIG_BLOCK_SIZE))? self::adjust2($this->_BIG_BLOCK_SIZE) : 9 |
|
70 | + (isset($this->_BIG_BLOCK_SIZE)) ? self::adjust2($this->_BIG_BLOCK_SIZE) : 9 |
|
71 | 71 | ); |
72 | - $this->_SMALL_BLOCK_SIZE= pow( |
|
72 | + $this->_SMALL_BLOCK_SIZE = pow( |
|
73 | 73 | 2, |
74 | - (isset($this->_SMALL_BLOCK_SIZE))? self::adjust2($this->_SMALL_BLOCK_SIZE) : 6 |
|
74 | + (isset($this->_SMALL_BLOCK_SIZE)) ? self::adjust2($this->_SMALL_BLOCK_SIZE) : 6 |
|
75 | 75 | ); |
76 | 76 | |
77 | 77 | if (is_resource($filename)) { |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | public function _calcSize(&$raList) |
127 | 127 | { |
128 | 128 | // Calculate Basic Setting |
129 | - list($iSBDcnt, $iBBcnt, $iPPScnt) = array(0,0,0); |
|
129 | + list($iSBDcnt, $iBBcnt, $iPPScnt) = array(0, 0, 0); |
|
130 | 130 | $iSmallLen = 0; |
131 | 131 | $iSBcnt = 0; |
132 | 132 | $iCount = count($raList); |
@@ -135,21 +135,21 @@ discard block |
||
135 | 135 | $raList[$i]->Size = $raList[$i]->getDataLen(); |
136 | 136 | if ($raList[$i]->Size < \PHPExcel\Shared\OLE::OLE_DATA_SIZE_SMALL) { |
137 | 137 | $iSBcnt += floor($raList[$i]->Size / $this->_SMALL_BLOCK_SIZE) |
138 | - + (($raList[$i]->Size % $this->_SMALL_BLOCK_SIZE)? 1: 0); |
|
138 | + + (($raList[$i]->Size % $this->_SMALL_BLOCK_SIZE) ? 1 : 0); |
|
139 | 139 | } else { |
140 | 140 | $iBBcnt += (floor($raList[$i]->Size / $this->_BIG_BLOCK_SIZE) + |
141 | - (($raList[$i]->Size % $this->_BIG_BLOCK_SIZE)? 1: 0)); |
|
141 | + (($raList[$i]->Size % $this->_BIG_BLOCK_SIZE) ? 1 : 0)); |
|
142 | 142 | } |
143 | 143 | } |
144 | 144 | } |
145 | 145 | $iSmallLen = $iSBcnt * $this->_SMALL_BLOCK_SIZE; |
146 | 146 | $iSlCnt = floor($this->_BIG_BLOCK_SIZE / \PHPExcel\Shared\OLE::OLE_LONG_INT_SIZE); |
147 | - $iSBDcnt = floor($iSBcnt / $iSlCnt) + (($iSBcnt % $iSlCnt)? 1:0); |
|
148 | - $iBBcnt += (floor($iSmallLen / $this->_BIG_BLOCK_SIZE) + |
|
149 | - (( $iSmallLen % $this->_BIG_BLOCK_SIZE)? 1: 0)); |
|
147 | + $iSBDcnt = floor($iSBcnt / $iSlCnt) + (($iSBcnt % $iSlCnt) ? 1 : 0); |
|
148 | + $iBBcnt += (floor($iSmallLen / $this->_BIG_BLOCK_SIZE) + |
|
149 | + (($iSmallLen % $this->_BIG_BLOCK_SIZE) ? 1 : 0)); |
|
150 | 150 | $iCnt = count($raList); |
151 | 151 | $iBdCnt = $this->_BIG_BLOCK_SIZE / \PHPExcel\Shared\OLE::OLE_PPS_SIZE; |
152 | - $iPPScnt = (floor($iCnt/$iBdCnt) + (($iCnt % $iBdCnt)? 1: 0)); |
|
152 | + $iPPScnt = (floor($iCnt / $iBdCnt) + (($iCnt % $iBdCnt) ? 1 : 0)); |
|
153 | 153 | |
154 | 154 | return array($iSBDcnt, $iBBcnt, $iPPScnt); |
155 | 155 | } |
@@ -164,8 +164,8 @@ discard block |
||
164 | 164 | */ |
165 | 165 | private static function adjust2($i2) |
166 | 166 | { |
167 | - $iWk = log($i2)/log(2); |
|
168 | - return ($iWk > floor($iWk))? floor($iWk)+1:$iWk; |
|
167 | + $iWk = log($i2) / log(2); |
|
168 | + return ($iWk > floor($iWk)) ? floor($iWk) + 1 : $iWk; |
|
169 | 169 | } |
170 | 170 | |
171 | 171 | /** |
@@ -187,17 +187,17 @@ discard block |
||
187 | 187 | $iBdExL = 0; |
188 | 188 | $iAll = $iBBcnt + $iPPScnt + $iSBDcnt; |
189 | 189 | $iAllW = $iAll; |
190 | - $iBdCntW = floor($iAllW / $iBlCnt) + (($iAllW % $iBlCnt)? 1: 0); |
|
191 | - $iBdCnt = floor(($iAll + $iBdCntW) / $iBlCnt) + ((($iAllW+$iBdCntW) % $iBlCnt)? 1: 0); |
|
190 | + $iBdCntW = floor($iAllW / $iBlCnt) + (($iAllW % $iBlCnt) ? 1 : 0); |
|
191 | + $iBdCnt = floor(($iAll + $iBdCntW) / $iBlCnt) + ((($iAllW + $iBdCntW) % $iBlCnt) ? 1 : 0); |
|
192 | 192 | |
193 | 193 | // Calculate BD count |
194 | 194 | if ($iBdCnt > $i1stBdL) { |
195 | 195 | while (1) { |
196 | 196 | ++$iBdExL; |
197 | 197 | ++$iAllW; |
198 | - $iBdCntW = floor($iAllW / $iBlCnt) + (($iAllW % $iBlCnt)? 1: 0); |
|
199 | - $iBdCnt = floor(($iAllW + $iBdCntW) / $iBlCnt) + ((($iAllW+$iBdCntW) % $iBlCnt)? 1: 0); |
|
200 | - if ($iBdCnt <= ($iBdExL*$iBlCnt+ $i1stBdL)) { |
|
198 | + $iBdCntW = floor($iAllW / $iBlCnt) + (($iAllW % $iBlCnt) ? 1 : 0); |
|
199 | + $iBdCnt = floor(($iAllW + $iBdCntW) / $iBlCnt) + ((($iAllW + $iBdCntW) % $iBlCnt) ? 1 : 0); |
|
200 | + if ($iBdCnt <= ($iBdExL * $iBlCnt + $i1stBdL)) { |
|
201 | 201 | break; |
202 | 202 | } |
203 | 203 | } |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | . "\x00\x00\x00\x00" |
221 | 221 | . "\x00\x00\x00\x00" |
222 | 222 | . pack("V", $iBdCnt) |
223 | - . pack("V", $iBBcnt+$iSBDcnt) //ROOT START |
|
223 | + . pack("V", $iBBcnt + $iSBDcnt) //ROOT START |
|
224 | 224 | . pack("V", 0) |
225 | 225 | . pack("V", 0x1000) |
226 | 226 | . pack("V", $iSBDcnt ? 0 : -2) //Small Block Depot |
@@ -234,12 +234,12 @@ discard block |
||
234 | 234 | . pack("V", 0)// Extra BDList Count |
235 | 235 | ); |
236 | 236 | } else { |
237 | - fwrite($FILE, pack("V", $iAll+$iBdCnt) . pack("V", $iBdExL)); |
|
237 | + fwrite($FILE, pack("V", $iAll + $iBdCnt) . pack("V", $iBdExL)); |
|
238 | 238 | } |
239 | 239 | |
240 | 240 | // BDList |
241 | 241 | for ($i = 0; $i < $i1stBdL && $i < $iBdCnt; ++$i) { |
242 | - fwrite($FILE, pack("V", $iAll+$i)); |
|
242 | + fwrite($FILE, pack("V", $iAll + $i)); |
|
243 | 243 | } |
244 | 244 | if ($i < $i1stBdL) { |
245 | 245 | $jB = $i1stBdL - $i; |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | $raList[$i]->startBlock = $iStBlk; |
286 | 286 | $iStBlk += |
287 | 287 | (floor($raList[$i]->Size / $this->_BIG_BLOCK_SIZE) + |
288 | - (($raList[$i]->Size % $this->_BIG_BLOCK_SIZE)? 1: 0)); |
|
288 | + (($raList[$i]->Size % $this->_BIG_BLOCK_SIZE) ? 1 : 0)); |
|
289 | 289 | } |
290 | 290 | // Close file for each PPS, and unlink it |
291 | 291 | //if (isset($raList[$i]->_PPS_FILE)) { |
@@ -318,11 +318,11 @@ discard block |
||
318 | 318 | } |
319 | 319 | if ($raList[$i]->Size < \PHPExcel\Shared\OLE::OLE_DATA_SIZE_SMALL) { |
320 | 320 | $iSmbCnt = floor($raList[$i]->Size / $this->_SMALL_BLOCK_SIZE) |
321 | - + (($raList[$i]->Size % $this->_SMALL_BLOCK_SIZE)? 1: 0); |
|
321 | + + (($raList[$i]->Size % $this->_SMALL_BLOCK_SIZE) ? 1 : 0); |
|
322 | 322 | // Add to SBD |
323 | 323 | $jB = $iSmbCnt - 1; |
324 | 324 | for ($j = 0; $j < $jB; ++$j) { |
325 | - fwrite($FILE, pack("V", $j+$iSmBlk+1)); |
|
325 | + fwrite($FILE, pack("V", $j + $iSmBlk + 1)); |
|
326 | 326 | } |
327 | 327 | fwrite($FILE, pack("V", -2)); |
328 | 328 | |
@@ -393,16 +393,16 @@ discard block |
||
393 | 393 | $iBdExL = 0; |
394 | 394 | $iAll = $iBsize + $iPpsCnt + $iSbdSize; |
395 | 395 | $iAllW = $iAll; |
396 | - $iBdCntW = floor($iAllW / $iBbCnt) + (($iAllW % $iBbCnt)? 1: 0); |
|
397 | - $iBdCnt = floor(($iAll + $iBdCntW) / $iBbCnt) + ((($iAllW+$iBdCntW) % $iBbCnt)? 1: 0); |
|
396 | + $iBdCntW = floor($iAllW / $iBbCnt) + (($iAllW % $iBbCnt) ? 1 : 0); |
|
397 | + $iBdCnt = floor(($iAll + $iBdCntW) / $iBbCnt) + ((($iAllW + $iBdCntW) % $iBbCnt) ? 1 : 0); |
|
398 | 398 | // Calculate BD count |
399 | - if ($iBdCnt >$i1stBdL) { |
|
399 | + if ($iBdCnt > $i1stBdL) { |
|
400 | 400 | while (1) { |
401 | 401 | ++$iBdExL; |
402 | 402 | ++$iAllW; |
403 | - $iBdCntW = floor($iAllW / $iBbCnt) + (($iAllW % $iBbCnt)? 1: 0); |
|
404 | - $iBdCnt = floor(($iAllW + $iBdCntW) / $iBbCnt) + ((($iAllW+$iBdCntW) % $iBbCnt)? 1: 0); |
|
405 | - if ($iBdCnt <= ($iBdExL*$iBbCnt+ $i1stBdL)) { |
|
403 | + $iBdCntW = floor($iAllW / $iBbCnt) + (($iAllW % $iBbCnt) ? 1 : 0); |
|
404 | + $iBdCnt = floor(($iAllW + $iBdCntW) / $iBbCnt) + ((($iAllW + $iBdCntW) % $iBbCnt) ? 1 : 0); |
|
405 | + if ($iBdCnt <= ($iBdExL * $iBbCnt + $i1stBdL)) { |
|
406 | 406 | break; |
407 | 407 | } |
408 | 408 | } |
@@ -412,19 +412,19 @@ discard block |
||
412 | 412 | // Set for SBD |
413 | 413 | if ($iSbdSize > 0) { |
414 | 414 | for ($i = 0; $i < ($iSbdSize - 1); ++$i) { |
415 | - fwrite($FILE, pack("V", $i+1)); |
|
415 | + fwrite($FILE, pack("V", $i + 1)); |
|
416 | 416 | } |
417 | 417 | fwrite($FILE, pack("V", -2)); |
418 | 418 | } |
419 | 419 | // Set for B |
420 | 420 | for ($i = 0; $i < ($iBsize - 1); ++$i) { |
421 | - fwrite($FILE, pack("V", $i+$iSbdSize+1)); |
|
421 | + fwrite($FILE, pack("V", $i + $iSbdSize + 1)); |
|
422 | 422 | } |
423 | 423 | fwrite($FILE, pack("V", -2)); |
424 | 424 | |
425 | 425 | // Set for PPS |
426 | 426 | for ($i = 0; $i < ($iPpsCnt - 1); ++$i) { |
427 | - fwrite($FILE, pack("V", $i+$iSbdSize+$iBsize+1)); |
|
427 | + fwrite($FILE, pack("V", $i + $iSbdSize + $iBsize + 1)); |
|
428 | 428 | } |
429 | 429 | fwrite($FILE, pack("V", -2)); |
430 | 430 | // Set for BBD itself ( 0xFFFFFFFD : BBD) |
@@ -444,17 +444,17 @@ discard block |
||
444 | 444 | } |
445 | 445 | // Extra BDList |
446 | 446 | if ($iBdCnt > $i1stBdL) { |
447 | - $iN=0; |
|
448 | - $iNb=0; |
|
447 | + $iN = 0; |
|
448 | + $iNb = 0; |
|
449 | 449 | for ($i = $i1stBdL; $i < $iBdCnt; $i++, ++$iN) { |
450 | 450 | if ($iN >= ($iBbCnt - 1)) { |
451 | 451 | $iN = 0; |
452 | 452 | ++$iNb; |
453 | - fwrite($FILE, pack("V", $iAll+$iBdCnt+$iNb)); |
|
453 | + fwrite($FILE, pack("V", $iAll + $iBdCnt + $iNb)); |
|
454 | 454 | } |
455 | - fwrite($FILE, pack("V", $iBsize+$iSbdSize+$iPpsCnt+$i)); |
|
455 | + fwrite($FILE, pack("V", $iBsize + $iSbdSize + $iPpsCnt + $i)); |
|
456 | 456 | } |
457 | - if (($iBdCnt-$i1stBdL) % ($iBbCnt-1)) { |
|
457 | + if (($iBdCnt - $i1stBdL) % ($iBbCnt - 1)) { |
|
458 | 458 | $iB = ($iBbCnt - 1) - (($iBdCnt - $i1stBdL) % ($iBbCnt - 1)); |
459 | 459 | for ($i = 0; $i < $iB; ++$i) { |
460 | 460 | fwrite($FILE, pack("V", -1)); |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | /** |
75 | 75 | * Read the file |
76 | 76 | * |
77 | - * @param $sFileName string Filename |
|
77 | + * @param string $sFileName string Filename |
|
78 | 78 | * @throws \PHPExcel\Reader\Exception |
79 | 79 | */ |
80 | 80 | public function read($sFileName) |
@@ -172,6 +172,7 @@ discard block |
||
172 | 172 | /** |
173 | 173 | * Extract binary stream data |
174 | 174 | * |
175 | + * @param integer $stream |
|
175 | 176 | * @return string |
176 | 177 | */ |
177 | 178 | public function getStream($stream) |
@@ -121,8 +121,8 @@ discard block |
||
121 | 121 | } |
122 | 122 | |
123 | 123 | for ($i = 0; $i < $bbdBlocks; ++$i) { |
124 | - $bigBlockDepotBlocks[$i] = self::getInt4d($this->data, $pos); |
|
125 | - $pos += 4; |
|
124 | + $bigBlockDepotBlocks[$i] = self::getInt4d($this->data, $pos); |
|
125 | + $pos += 4; |
|
126 | 126 | } |
127 | 127 | |
128 | 128 | for ($j = 0; $j < $this->numExtensionBlocks; ++$j) { |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | $block = $this->props[$stream]['startBlock']; |
189 | 189 | |
190 | 190 | while ($block != -2) { |
191 | - $pos = $block * self::SMALL_BLOCK_SIZE; |
|
191 | + $pos = $block * self::SMALL_BLOCK_SIZE; |
|
192 | 192 | $streamData .= substr($rootdata, $pos, self::SMALL_BLOCK_SIZE); |
193 | 193 | |
194 | 194 | $block = self::getInt4d($this->smallBlockChain, $block*4); |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | $bbdBlocks = $this->numBigBlockDepotBlocks; |
118 | 118 | |
119 | 119 | if ($this->numExtensionBlocks != 0) { |
120 | - $bbdBlocks = (self::BIG_BLOCK_SIZE - self::BIG_BLOCK_DEPOT_BLOCKS_POS)/4; |
|
120 | + $bbdBlocks = (self::BIG_BLOCK_SIZE - self::BIG_BLOCK_DEPOT_BLOCKS_POS) / 4; |
|
121 | 121 | } |
122 | 122 | |
123 | 123 | for ($i = 0; $i < $bbdBlocks; ++$i) { |
@@ -146,8 +146,8 @@ discard block |
||
146 | 146 | for ($i = 0; $i < $this->numBigBlockDepotBlocks; ++$i) { |
147 | 147 | $pos = ($bigBlockDepotBlocks[$i] + 1) * self::BIG_BLOCK_SIZE; |
148 | 148 | |
149 | - $this->bigBlockChain .= substr($this->data, $pos, 4*$bbs); |
|
150 | - $pos += 4*$bbs; |
|
149 | + $this->bigBlockChain .= substr($this->data, $pos, 4 * $bbs); |
|
150 | + $pos += 4 * $bbs; |
|
151 | 151 | } |
152 | 152 | |
153 | 153 | $pos = 0; |
@@ -156,10 +156,10 @@ discard block |
||
156 | 156 | while ($sbdBlock != -2) { |
157 | 157 | $pos = ($sbdBlock + 1) * self::BIG_BLOCK_SIZE; |
158 | 158 | |
159 | - $this->smallBlockChain .= substr($this->data, $pos, 4*$bbs); |
|
160 | - $pos += 4*$bbs; |
|
159 | + $this->smallBlockChain .= substr($this->data, $pos, 4 * $bbs); |
|
160 | + $pos += 4 * $bbs; |
|
161 | 161 | |
162 | - $sbdBlock = self::getInt4d($this->bigBlockChain, $sbdBlock*4); |
|
162 | + $sbdBlock = self::getInt4d($this->bigBlockChain, $sbdBlock * 4); |
|
163 | 163 | } |
164 | 164 | |
165 | 165 | // read the directory stream |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | $pos = $block * self::SMALL_BLOCK_SIZE; |
192 | 192 | $streamData .= substr($rootdata, $pos, self::SMALL_BLOCK_SIZE); |
193 | 193 | |
194 | - $block = self::getInt4d($this->smallBlockChain, $block*4); |
|
194 | + $block = self::getInt4d($this->smallBlockChain, $block * 4); |
|
195 | 195 | } |
196 | 196 | |
197 | 197 | return $streamData; |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | while ($block != -2) { |
211 | 211 | $pos = ($block + 1) * self::BIG_BLOCK_SIZE; |
212 | 212 | $streamData .= substr($this->data, $pos, self::BIG_BLOCK_SIZE); |
213 | - $block = self::getInt4d($this->bigBlockChain, $block*4); |
|
213 | + $block = self::getInt4d($this->bigBlockChain, $block * 4); |
|
214 | 214 | } |
215 | 215 | |
216 | 216 | return $streamData; |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | while ($block != -2) { |
232 | 232 | $pos = ($block + 1) * self::BIG_BLOCK_SIZE; |
233 | 233 | $data .= substr($this->data, $pos, self::BIG_BLOCK_SIZE); |
234 | - $block = self::getInt4d($this->bigBlockChain, $block*4); |
|
234 | + $block = self::getInt4d($this->bigBlockChain, $block * 4); |
|
235 | 235 | } |
236 | 236 | return $data; |
237 | 237 | } |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | $d = substr($this->entry, $offset, self::PROPERTY_STORAGE_BLOCK_SIZE); |
251 | 251 | |
252 | 252 | // size in bytes of name |
253 | - $nameSize = ord($d[self::SIZE_OF_NAME_POS]) | (ord($d[self::SIZE_OF_NAME_POS+1]) << 8); |
|
253 | + $nameSize = ord($d[self::SIZE_OF_NAME_POS]) | (ord($d[self::SIZE_OF_NAME_POS + 1]) << 8); |
|
254 | 254 | |
255 | 255 | // type of entry |
256 | 256 | $type = ord($d[self::TYPE_POS]); |
@@ -215,6 +215,10 @@ discard block |
||
215 | 215 | // Note that no real action is taken, if the archive does not exist it is not |
216 | 216 | // created. Use create() for that. |
217 | 217 | // -------------------------------------------------------------------------------- |
218 | + |
|
219 | + /** |
|
220 | + * @param string $p_zipname |
|
221 | + */ |
|
218 | 222 | public function __construct($p_zipname) |
219 | 223 | { |
220 | 224 | |
@@ -2193,6 +2197,10 @@ discard block |
||
2193 | 2197 | // Description : |
2194 | 2198 | // Parameters : |
2195 | 2199 | // -------------------------------------------------------------------------------- |
2200 | + |
|
2201 | + /** |
|
2202 | + * @param string $p_mode |
|
2203 | + */ |
|
2196 | 2204 | public function privOpenFd($p_mode) |
2197 | 2205 | { |
2198 | 2206 | $v_result=1; |
@@ -3772,6 +3780,10 @@ discard block |
||
3772 | 3780 | // Parameters : |
3773 | 3781 | // Return Values : |
3774 | 3782 | // -------------------------------------------------------------------------------- |
3783 | + |
|
3784 | + /** |
|
3785 | + * @param string $p_string |
|
3786 | + */ |
|
3775 | 3787 | public function privExtractFileAsString(&$p_entry, &$p_string, &$p_options) |
3776 | 3788 | { |
3777 | 3789 | $v_result=1; |
@@ -538,12 +538,12 @@ discard block |
||
538 | 538 | |
539 | 539 | // ----- For each file in the list check the attributes |
540 | 540 | $v_supported_attributes = array( |
541 | - PCLZIP_ATT_FILE_NAME => 'mandatory', |
|
542 | - PCLZIP_ATT_FILE_NEW_SHORT_NAME => 'optional', |
|
543 | - PCLZIP_ATT_FILE_NEW_FULL_NAME => 'optional', |
|
544 | - PCLZIP_ATT_FILE_MTIME => 'optional', |
|
545 | - PCLZIP_ATT_FILE_CONTENT => 'optional', |
|
546 | - PCLZIP_ATT_FILE_COMMENT => 'optional', |
|
541 | + PCLZIP_ATT_FILE_NAME => 'mandatory', |
|
542 | + PCLZIP_ATT_FILE_NEW_SHORT_NAME => 'optional', |
|
543 | + PCLZIP_ATT_FILE_NEW_FULL_NAME => 'optional', |
|
544 | + PCLZIP_ATT_FILE_MTIME => 'optional', |
|
545 | + PCLZIP_ATT_FILE_CONTENT => 'optional', |
|
546 | + PCLZIP_ATT_FILE_COMMENT => 'optional', |
|
547 | 547 | ); |
548 | 548 | foreach ($v_att_list as $v_entry) { |
549 | 549 | $v_result = $this->privFileDescrParseAtt($v_entry, $v_filedescr_list[], $v_options, $v_supported_attributes); |
@@ -700,25 +700,25 @@ discard block |
||
700 | 700 | if ((is_integer($v_arg_list[0])) && ($v_arg_list[0] > 77000)) { |
701 | 701 | // ----- Parse the options |
702 | 702 | $v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options, array ( |
703 | - PCLZIP_OPT_PATH => 'optional', |
|
704 | - PCLZIP_OPT_REMOVE_PATH => 'optional', |
|
705 | - PCLZIP_OPT_REMOVE_ALL_PATH => 'optional', |
|
706 | - PCLZIP_OPT_ADD_PATH => 'optional', |
|
707 | - PCLZIP_CB_PRE_EXTRACT => 'optional', |
|
708 | - PCLZIP_CB_POST_EXTRACT => 'optional', |
|
709 | - PCLZIP_OPT_SET_CHMOD => 'optional', |
|
710 | - PCLZIP_OPT_BY_NAME => 'optional', |
|
711 | - PCLZIP_OPT_BY_EREG => 'optional', |
|
712 | - PCLZIP_OPT_BY_PREG => 'optional', |
|
713 | - PCLZIP_OPT_BY_INDEX => 'optional', |
|
714 | - PCLZIP_OPT_EXTRACT_AS_STRING => 'optional', |
|
715 | - PCLZIP_OPT_EXTRACT_IN_OUTPUT => 'optional', |
|
716 | - PCLZIP_OPT_REPLACE_NEWER => 'optional', |
|
717 | - PCLZIP_OPT_STOP_ON_ERROR => 'optional', |
|
718 | - PCLZIP_OPT_EXTRACT_DIR_RESTRICTION => 'optional', |
|
719 | - PCLZIP_OPT_TEMP_FILE_THRESHOLD => 'optional', |
|
720 | - PCLZIP_OPT_TEMP_FILE_ON => 'optional', |
|
721 | - PCLZIP_OPT_TEMP_FILE_OFF => 'optional' |
|
703 | + PCLZIP_OPT_PATH => 'optional', |
|
704 | + PCLZIP_OPT_REMOVE_PATH => 'optional', |
|
705 | + PCLZIP_OPT_REMOVE_ALL_PATH => 'optional', |
|
706 | + PCLZIP_OPT_ADD_PATH => 'optional', |
|
707 | + PCLZIP_CB_PRE_EXTRACT => 'optional', |
|
708 | + PCLZIP_CB_POST_EXTRACT => 'optional', |
|
709 | + PCLZIP_OPT_SET_CHMOD => 'optional', |
|
710 | + PCLZIP_OPT_BY_NAME => 'optional', |
|
711 | + PCLZIP_OPT_BY_EREG => 'optional', |
|
712 | + PCLZIP_OPT_BY_PREG => 'optional', |
|
713 | + PCLZIP_OPT_BY_INDEX => 'optional', |
|
714 | + PCLZIP_OPT_EXTRACT_AS_STRING => 'optional', |
|
715 | + PCLZIP_OPT_EXTRACT_IN_OUTPUT => 'optional', |
|
716 | + PCLZIP_OPT_REPLACE_NEWER => 'optional', |
|
717 | + PCLZIP_OPT_STOP_ON_ERROR => 'optional', |
|
718 | + PCLZIP_OPT_EXTRACT_DIR_RESTRICTION => 'optional', |
|
719 | + PCLZIP_OPT_TEMP_FILE_THRESHOLD => 'optional', |
|
720 | + PCLZIP_OPT_TEMP_FILE_ON => 'optional', |
|
721 | + PCLZIP_OPT_TEMP_FILE_OFF => 'optional' |
|
722 | 722 | )); |
723 | 723 | if ($v_result != 1) { |
724 | 724 | return 0; |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | |
221 | 221 | // ----- Tests the zlib |
222 | 222 | if (!function_exists('gzopen')) { |
223 | - die('Abort '.basename(__FILE__).' : Missing zlib extensions'); |
|
223 | + die('Abort ' . basename(__FILE__) . ' : Missing zlib extensions'); |
|
224 | 224 | } |
225 | 225 | |
226 | 226 | // ----- Set the attributes |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | // -------------------------------------------------------------------------------- |
273 | 273 | public function create($p_filelist) |
274 | 274 | { |
275 | - $v_result=1; |
|
275 | + $v_result = 1; |
|
276 | 276 | |
277 | 277 | // ----- Reset the error handler |
278 | 278 | $this->privErrorReset(); |
@@ -296,7 +296,7 @@ discard block |
||
296 | 296 | // ----- Look for first arg |
297 | 297 | if ((is_integer($v_arg_list[0])) && ($v_arg_list[0] > 77000)) { |
298 | 298 | // ----- Parse the options |
299 | - $v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options, array ( |
|
299 | + $v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options, array( |
|
300 | 300 | PCLZIP_OPT_REMOVE_PATH => 'optional', |
301 | 301 | PCLZIP_OPT_REMOVE_ALL_PATH => 'optional', |
302 | 302 | PCLZIP_OPT_ADD_PATH => 'optional', |
@@ -438,7 +438,7 @@ discard block |
||
438 | 438 | // -------------------------------------------------------------------------------- |
439 | 439 | public function add($p_filelist) |
440 | 440 | { |
441 | - $v_result=1; |
|
441 | + $v_result = 1; |
|
442 | 442 | |
443 | 443 | // ----- Reset the error handler |
444 | 444 | $this->privErrorReset(); |
@@ -462,7 +462,7 @@ discard block |
||
462 | 462 | // ----- Look for first arg |
463 | 463 | if ((is_integer($v_arg_list[0])) && ($v_arg_list[0] > 77000)) { |
464 | 464 | // ----- Parse the options |
465 | - $v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options, array ( |
|
465 | + $v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options, array( |
|
466 | 466 | PCLZIP_OPT_REMOVE_PATH => 'optional', |
467 | 467 | PCLZIP_OPT_REMOVE_ALL_PATH => 'optional', |
468 | 468 | PCLZIP_OPT_ADD_PATH => 'optional', |
@@ -525,7 +525,7 @@ discard block |
||
525 | 525 | $v_string_list = explode(PCLZIP_SEPARATOR, $p_filelist); |
526 | 526 | } else { |
527 | 527 | // ----- Invalid variable type for $p_filelist |
528 | - PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid variable type '".gettype($p_filelist)."' for p_filelist"); |
|
528 | + PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid variable type '" . gettype($p_filelist) . "' for p_filelist"); |
|
529 | 529 | return 0; |
530 | 530 | } |
531 | 531 | |
@@ -612,7 +612,7 @@ discard block |
||
612 | 612 | // -------------------------------------------------------------------------------- |
613 | 613 | public function listContent() |
614 | 614 | { |
615 | - $v_result=1; |
|
615 | + $v_result = 1; |
|
616 | 616 | |
617 | 617 | // ----- Reset the error handler |
618 | 618 | $this->privErrorReset(); |
@@ -668,7 +668,7 @@ discard block |
||
668 | 668 | // -------------------------------------------------------------------------------- |
669 | 669 | public function extract() |
670 | 670 | { |
671 | - $v_result=1; |
|
671 | + $v_result = 1; |
|
672 | 672 | |
673 | 673 | // ----- Reset the error handler |
674 | 674 | $this->privErrorReset(); |
@@ -699,7 +699,7 @@ discard block |
||
699 | 699 | // ----- Look for first arg |
700 | 700 | if ((is_integer($v_arg_list[0])) && ($v_arg_list[0] > 77000)) { |
701 | 701 | // ----- Parse the options |
702 | - $v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options, array ( |
|
702 | + $v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options, array( |
|
703 | 703 | PCLZIP_OPT_PATH => 'optional', |
704 | 704 | PCLZIP_OPT_REMOVE_PATH => 'optional', |
705 | 705 | PCLZIP_OPT_REMOVE_ALL_PATH => 'optional', |
@@ -819,7 +819,7 @@ discard block |
||
819 | 819 | //function extractByIndex($p_index, options...) |
820 | 820 | public function extractByIndex($p_index) |
821 | 821 | { |
822 | - $v_result=1; |
|
822 | + $v_result = 1; |
|
823 | 823 | |
824 | 824 | // ----- Reset the error handler |
825 | 825 | $this->privErrorReset(); |
@@ -921,9 +921,9 @@ discard block |
||
921 | 921 | // ----- Trick |
922 | 922 | // Here I want to reuse extractByRule(), so I need to parse the $p_index |
923 | 923 | // with privParseOptions() |
924 | - $v_arg_trick = array (PCLZIP_OPT_BY_INDEX, $p_index); |
|
924 | + $v_arg_trick = array(PCLZIP_OPT_BY_INDEX, $p_index); |
|
925 | 925 | $v_options_trick = array(); |
926 | - $v_result = $this->privParseOptions($v_arg_trick, sizeof($v_arg_trick), $v_options_trick, array (PCLZIP_OPT_BY_INDEX => 'optional')); |
|
926 | + $v_result = $this->privParseOptions($v_arg_trick, sizeof($v_arg_trick), $v_options_trick, array(PCLZIP_OPT_BY_INDEX => 'optional')); |
|
927 | 927 | if ($v_result != 1) { |
928 | 928 | return 0; |
929 | 929 | } |
@@ -962,7 +962,7 @@ discard block |
||
962 | 962 | // -------------------------------------------------------------------------------- |
963 | 963 | public function delete() |
964 | 964 | { |
965 | - $v_result=1; |
|
965 | + $v_result = 1; |
|
966 | 966 | |
967 | 967 | // ----- Reset the error handler |
968 | 968 | $this->privErrorReset(); |
@@ -984,7 +984,7 @@ discard block |
||
984 | 984 | $v_arg_list = func_get_args(); |
985 | 985 | |
986 | 986 | // ----- Parse the options |
987 | - $v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options, array ( |
|
987 | + $v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options, array( |
|
988 | 988 | PCLZIP_OPT_BY_NAME => 'optional', |
989 | 989 | PCLZIP_OPT_BY_EREG => 'optional', |
990 | 990 | PCLZIP_OPT_BY_PREG => 'optional', |
@@ -1072,7 +1072,7 @@ discard block |
||
1072 | 1072 | $this->privSwapBackMagicQuotes(); |
1073 | 1073 | |
1074 | 1074 | // ----- Error log |
1075 | - PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open archive \''.$this->zipname.'\' in binary read mode'); |
|
1075 | + PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open archive \'' . $this->zipname . '\' in binary read mode'); |
|
1076 | 1076 | |
1077 | 1077 | // ----- Return |
1078 | 1078 | return 0; |
@@ -1131,7 +1131,7 @@ discard block |
||
1131 | 1131 | // TBC : Should also check the archive format |
1132 | 1132 | if (!is_file($p_archive)) { |
1133 | 1133 | // ----- Error log |
1134 | - PclZip::privErrorLog(PCLZIP_ERR_MISSING_FILE, "No file with filename '".$p_archive."'"); |
|
1134 | + PclZip::privErrorLog(PCLZIP_ERR_MISSING_FILE, "No file with filename '" . $p_archive . "'"); |
|
1135 | 1135 | $v_result = PCLZIP_ERR_MISSING_FILE; |
1136 | 1136 | } else { |
1137 | 1137 | // ----- Duplicate the archive |
@@ -1253,7 +1253,7 @@ discard block |
||
1253 | 1253 | } |
1254 | 1254 | |
1255 | 1255 | if ($p_with_code) { |
1256 | - return($v_value.' ('.$this->error_code.')'); |
|
1256 | + return($v_value . ' (' . $this->error_code . ')'); |
|
1257 | 1257 | } else { |
1258 | 1258 | return($v_value); |
1259 | 1259 | } |
@@ -1271,9 +1271,9 @@ discard block |
||
1271 | 1271 | return(PclErrorString()); |
1272 | 1272 | } else { |
1273 | 1273 | if ($p_full) { |
1274 | - return($this->errorName(true)." : ".$this->error_string); |
|
1274 | + return($this->errorName(true) . " : " . $this->error_string); |
|
1275 | 1275 | } else { |
1276 | - return($this->error_string." [code ".$this->error_code."]"); |
|
1276 | + return($this->error_string . " [code " . $this->error_code . "]"); |
|
1277 | 1277 | } |
1278 | 1278 | } |
1279 | 1279 | } |
@@ -1315,14 +1315,14 @@ discard block |
||
1315 | 1315 | // ----- Look if the file exits |
1316 | 1316 | if (!is_file($this->zipname)) { |
1317 | 1317 | // ----- Error log |
1318 | - PclZip::privErrorLog(PCLZIP_ERR_MISSING_FILE, "Missing archive file '".$this->zipname."'"); |
|
1318 | + PclZip::privErrorLog(PCLZIP_ERR_MISSING_FILE, "Missing archive file '" . $this->zipname . "'"); |
|
1319 | 1319 | return(false); |
1320 | 1320 | } |
1321 | 1321 | |
1322 | 1322 | // ----- Check that the file is readeable |
1323 | 1323 | if (!is_readable($this->zipname)) { |
1324 | 1324 | // ----- Error log |
1325 | - PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, "Unable to read archive '".$this->zipname."'"); |
|
1325 | + PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, "Unable to read archive '" . $this->zipname . "'"); |
|
1326 | 1326 | return(false); |
1327 | 1327 | } |
1328 | 1328 | |
@@ -1357,15 +1357,15 @@ discard block |
||
1357 | 1357 | // -------------------------------------------------------------------------------- |
1358 | 1358 | public function privParseOptions(&$p_options_list, $p_size, &$v_result_list, $v_requested_options = false) |
1359 | 1359 | { |
1360 | - $v_result=1; |
|
1360 | + $v_result = 1; |
|
1361 | 1361 | |
1362 | 1362 | // ----- Read the options |
1363 | - $i=0; |
|
1364 | - while ($i<$p_size) { |
|
1363 | + $i = 0; |
|
1364 | + while ($i < $p_size) { |
|
1365 | 1365 | // ----- Check if the option is supported |
1366 | 1366 | if (!isset($v_requested_options[$p_options_list[$i]])) { |
1367 | 1367 | // ----- Error log |
1368 | - PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid optional parameter '".$p_options_list[$i]."' for this method"); |
|
1368 | + PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid optional parameter '" . $p_options_list[$i] . "' for this method"); |
|
1369 | 1369 | |
1370 | 1370 | // ----- Return |
1371 | 1371 | return PclZip::errorCode(); |
@@ -1378,48 +1378,48 @@ discard block |
||
1378 | 1378 | case PCLZIP_OPT_REMOVE_PATH: |
1379 | 1379 | case PCLZIP_OPT_ADD_PATH: |
1380 | 1380 | // ----- Check the number of parameters |
1381 | - if (($i+1) >= $p_size) { |
|
1381 | + if (($i + 1) >= $p_size) { |
|
1382 | 1382 | // ----- Error log |
1383 | - PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'"); |
|
1383 | + PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '" . PclZipUtilOptionText($p_options_list[$i]) . "'"); |
|
1384 | 1384 | |
1385 | 1385 | // ----- Return |
1386 | 1386 | return PclZip::errorCode(); |
1387 | 1387 | } |
1388 | 1388 | |
1389 | 1389 | // ----- Get the value |
1390 | - $v_result_list[$p_options_list[$i]] = PclZipUtilTranslateWinPath($p_options_list[$i+1], false); |
|
1390 | + $v_result_list[$p_options_list[$i]] = PclZipUtilTranslateWinPath($p_options_list[$i + 1], false); |
|
1391 | 1391 | $i++; |
1392 | 1392 | break; |
1393 | 1393 | |
1394 | 1394 | case PCLZIP_OPT_TEMP_FILE_THRESHOLD: |
1395 | 1395 | // ----- Check the number of parameters |
1396 | - if (($i+1) >= $p_size) { |
|
1397 | - PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'"); |
|
1396 | + if (($i + 1) >= $p_size) { |
|
1397 | + PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '" . PclZipUtilOptionText($p_options_list[$i]) . "'"); |
|
1398 | 1398 | return PclZip::errorCode(); |
1399 | 1399 | } |
1400 | 1400 | |
1401 | 1401 | // ----- Check for incompatible options |
1402 | 1402 | if (isset($v_result_list[PCLZIP_OPT_TEMP_FILE_OFF])) { |
1403 | - PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Option '".PclZipUtilOptionText($p_options_list[$i])."' can not be used with option 'PCLZIP_OPT_TEMP_FILE_OFF'"); |
|
1403 | + PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Option '" . PclZipUtilOptionText($p_options_list[$i]) . "' can not be used with option 'PCLZIP_OPT_TEMP_FILE_OFF'"); |
|
1404 | 1404 | return PclZip::errorCode(); |
1405 | 1405 | } |
1406 | 1406 | |
1407 | 1407 | // ----- Check the value |
1408 | - $v_value = $p_options_list[$i+1]; |
|
1409 | - if ((!is_integer($v_value)) || ($v_value<0)) { |
|
1410 | - PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Integer expected for option '".PclZipUtilOptionText($p_options_list[$i])."'"); |
|
1408 | + $v_value = $p_options_list[$i + 1]; |
|
1409 | + if ((!is_integer($v_value)) || ($v_value < 0)) { |
|
1410 | + PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Integer expected for option '" . PclZipUtilOptionText($p_options_list[$i]) . "'"); |
|
1411 | 1411 | return PclZip::errorCode(); |
1412 | 1412 | } |
1413 | 1413 | |
1414 | 1414 | // ----- Get the value (and convert it in bytes) |
1415 | - $v_result_list[$p_options_list[$i]] = $v_value*1048576; |
|
1415 | + $v_result_list[$p_options_list[$i]] = $v_value * 1048576; |
|
1416 | 1416 | $i++; |
1417 | 1417 | break; |
1418 | 1418 | |
1419 | 1419 | case PCLZIP_OPT_TEMP_FILE_ON: |
1420 | 1420 | // ----- Check for incompatible options |
1421 | 1421 | if (isset($v_result_list[PCLZIP_OPT_TEMP_FILE_OFF])) { |
1422 | - PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Option '".PclZipUtilOptionText($p_options_list[$i])."' can not be used with option 'PCLZIP_OPT_TEMP_FILE_OFF'"); |
|
1422 | + PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Option '" . PclZipUtilOptionText($p_options_list[$i]) . "' can not be used with option 'PCLZIP_OPT_TEMP_FILE_OFF'"); |
|
1423 | 1423 | return PclZip::errorCode(); |
1424 | 1424 | } |
1425 | 1425 | |
@@ -1429,12 +1429,12 @@ discard block |
||
1429 | 1429 | case PCLZIP_OPT_TEMP_FILE_OFF: |
1430 | 1430 | // ----- Check for incompatible options |
1431 | 1431 | if (isset($v_result_list[PCLZIP_OPT_TEMP_FILE_ON])) { |
1432 | - PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Option '".PclZipUtilOptionText($p_options_list[$i])."' can not be used with option 'PCLZIP_OPT_TEMP_FILE_ON'"); |
|
1432 | + PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Option '" . PclZipUtilOptionText($p_options_list[$i]) . "' can not be used with option 'PCLZIP_OPT_TEMP_FILE_ON'"); |
|
1433 | 1433 | return PclZip::errorCode(); |
1434 | 1434 | } |
1435 | 1435 | // ----- Check for incompatible options |
1436 | 1436 | if (isset($v_result_list[PCLZIP_OPT_TEMP_FILE_THRESHOLD])) { |
1437 | - PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Option '".PclZipUtilOptionText($p_options_list[$i])."' can not be used with option 'PCLZIP_OPT_TEMP_FILE_THRESHOLD'"); |
|
1437 | + PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Option '" . PclZipUtilOptionText($p_options_list[$i]) . "' can not be used with option 'PCLZIP_OPT_TEMP_FILE_THRESHOLD'"); |
|
1438 | 1438 | return PclZip::errorCode(); |
1439 | 1439 | } |
1440 | 1440 | $v_result_list[$p_options_list[$i]] = true; |
@@ -1442,16 +1442,16 @@ discard block |
||
1442 | 1442 | |
1443 | 1443 | case PCLZIP_OPT_EXTRACT_DIR_RESTRICTION: |
1444 | 1444 | // ----- Check the number of parameters |
1445 | - if (($i+1) >= $p_size) { |
|
1445 | + if (($i + 1) >= $p_size) { |
|
1446 | 1446 | // ----- Error log |
1447 | - PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'"); |
|
1447 | + PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '" . PclZipUtilOptionText($p_options_list[$i]) . "'"); |
|
1448 | 1448 | // ----- Return |
1449 | 1449 | return PclZip::errorCode(); |
1450 | 1450 | } |
1451 | 1451 | |
1452 | 1452 | // ----- Get the value |
1453 | - if (is_string($p_options_list[$i+1]) && ($p_options_list[$i+1] != '')) { |
|
1454 | - $v_result_list[$p_options_list[$i]] = PclZipUtilTranslateWinPath($p_options_list[$i+1], false); |
|
1453 | + if (is_string($p_options_list[$i + 1]) && ($p_options_list[$i + 1] != '')) { |
|
1454 | + $v_result_list[$p_options_list[$i]] = PclZipUtilTranslateWinPath($p_options_list[$i + 1], false); |
|
1455 | 1455 | $i++; |
1456 | 1456 | } else { |
1457 | 1457 | } |
@@ -1459,21 +1459,21 @@ discard block |
||
1459 | 1459 | // ----- Look for options that request an array of string for value |
1460 | 1460 | case PCLZIP_OPT_BY_NAME: |
1461 | 1461 | // ----- Check the number of parameters |
1462 | - if (($i+1) >= $p_size) { |
|
1462 | + if (($i + 1) >= $p_size) { |
|
1463 | 1463 | // ----- Error log |
1464 | - PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'"); |
|
1464 | + PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '" . PclZipUtilOptionText($p_options_list[$i]) . "'"); |
|
1465 | 1465 | // ----- Return |
1466 | 1466 | return PclZip::errorCode(); |
1467 | 1467 | } |
1468 | 1468 | |
1469 | 1469 | // ----- Get the value |
1470 | - if (is_string($p_options_list[$i+1])) { |
|
1471 | - $v_result_list[$p_options_list[$i]][0] = $p_options_list[$i+1]; |
|
1472 | - } elseif (is_array($p_options_list[$i+1])) { |
|
1473 | - $v_result_list[$p_options_list[$i]] = $p_options_list[$i+1]; |
|
1470 | + if (is_string($p_options_list[$i + 1])) { |
|
1471 | + $v_result_list[$p_options_list[$i]][0] = $p_options_list[$i + 1]; |
|
1472 | + } elseif (is_array($p_options_list[$i + 1])) { |
|
1473 | + $v_result_list[$p_options_list[$i]] = $p_options_list[$i + 1]; |
|
1474 | 1474 | } else { |
1475 | 1475 | // ----- Error log |
1476 | - PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Wrong parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'"); |
|
1476 | + PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Wrong parameter value for option '" . PclZipUtilOptionText($p_options_list[$i]) . "'"); |
|
1477 | 1477 | // ----- Return |
1478 | 1478 | return PclZip::errorCode(); |
1479 | 1479 | } |
@@ -1488,19 +1488,19 @@ discard block |
||
1488 | 1488 | case PCLZIP_OPT_BY_PREG: |
1489 | 1489 | //case PCLZIP_OPT_CRYPT : |
1490 | 1490 | // ----- Check the number of parameters |
1491 | - if (($i+1) >= $p_size) { |
|
1491 | + if (($i + 1) >= $p_size) { |
|
1492 | 1492 | // ----- Error log |
1493 | - PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'"); |
|
1493 | + PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '" . PclZipUtilOptionText($p_options_list[$i]) . "'"); |
|
1494 | 1494 | // ----- Return |
1495 | 1495 | return PclZip::errorCode(); |
1496 | 1496 | } |
1497 | 1497 | |
1498 | 1498 | // ----- Get the value |
1499 | - if (is_string($p_options_list[$i+1])) { |
|
1500 | - $v_result_list[$p_options_list[$i]] = $p_options_list[$i+1]; |
|
1499 | + if (is_string($p_options_list[$i + 1])) { |
|
1500 | + $v_result_list[$p_options_list[$i]] = $p_options_list[$i + 1]; |
|
1501 | 1501 | } else { |
1502 | 1502 | // ----- Error log |
1503 | - PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Wrong parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'"); |
|
1503 | + PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Wrong parameter value for option '" . PclZipUtilOptionText($p_options_list[$i]) . "'"); |
|
1504 | 1504 | // ----- Return |
1505 | 1505 | return PclZip::errorCode(); |
1506 | 1506 | } |
@@ -1512,20 +1512,20 @@ discard block |
||
1512 | 1512 | case PCLZIP_OPT_ADD_COMMENT: |
1513 | 1513 | case PCLZIP_OPT_PREPEND_COMMENT: |
1514 | 1514 | // ----- Check the number of parameters |
1515 | - if (($i+1) >= $p_size) { |
|
1515 | + if (($i + 1) >= $p_size) { |
|
1516 | 1516 | // ----- Error log |
1517 | - PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'"); |
|
1517 | + PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '" . PclZipUtilOptionText($p_options_list[$i]) . "'"); |
|
1518 | 1518 | |
1519 | 1519 | // ----- Return |
1520 | 1520 | return PclZip::errorCode(); |
1521 | 1521 | } |
1522 | 1522 | |
1523 | 1523 | // ----- Get the value |
1524 | - if (is_string($p_options_list[$i+1])) { |
|
1525 | - $v_result_list[$p_options_list[$i]] = $p_options_list[$i+1]; |
|
1524 | + if (is_string($p_options_list[$i + 1])) { |
|
1525 | + $v_result_list[$p_options_list[$i]] = $p_options_list[$i + 1]; |
|
1526 | 1526 | } else { |
1527 | 1527 | // ----- Error log |
1528 | - PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Wrong parameter value for option '" .PclZipUtilOptionText($p_options_list[$i]) ."'"); |
|
1528 | + PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Wrong parameter value for option '" . PclZipUtilOptionText($p_options_list[$i]) . "'"); |
|
1529 | 1529 | |
1530 | 1530 | // ----- Return |
1531 | 1531 | return PclZip::errorCode(); |
@@ -1536,9 +1536,9 @@ discard block |
||
1536 | 1536 | // ----- Look for options that request an array of index |
1537 | 1537 | case PCLZIP_OPT_BY_INDEX: |
1538 | 1538 | // ----- Check the number of parameters |
1539 | - if (($i+1) >= $p_size) { |
|
1539 | + if (($i + 1) >= $p_size) { |
|
1540 | 1540 | // ----- Error log |
1541 | - PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'"); |
|
1541 | + PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '" . PclZipUtilOptionText($p_options_list[$i]) . "'"); |
|
1542 | 1542 | |
1543 | 1543 | // ----- Return |
1544 | 1544 | return PclZip::errorCode(); |
@@ -1546,19 +1546,19 @@ discard block |
||
1546 | 1546 | |
1547 | 1547 | // ----- Get the value |
1548 | 1548 | $v_work_list = array(); |
1549 | - if (is_string($p_options_list[$i+1])) { |
|
1549 | + if (is_string($p_options_list[$i + 1])) { |
|
1550 | 1550 | // ----- Remove spaces |
1551 | - $p_options_list[$i+1] = strtr($p_options_list[$i+1], ' ', ''); |
|
1551 | + $p_options_list[$i + 1] = strtr($p_options_list[$i + 1], ' ', ''); |
|
1552 | 1552 | |
1553 | 1553 | // ----- Parse items |
1554 | - $v_work_list = explode(",", $p_options_list[$i+1]); |
|
1555 | - } elseif (is_integer($p_options_list[$i+1])) { |
|
1556 | - $v_work_list[0] = $p_options_list[$i+1].'-'.$p_options_list[$i+1]; |
|
1557 | - } elseif (is_array($p_options_list[$i+1])) { |
|
1558 | - $v_work_list = $p_options_list[$i+1]; |
|
1554 | + $v_work_list = explode(",", $p_options_list[$i + 1]); |
|
1555 | + } elseif (is_integer($p_options_list[$i + 1])) { |
|
1556 | + $v_work_list[0] = $p_options_list[$i + 1] . '-' . $p_options_list[$i + 1]; |
|
1557 | + } elseif (is_array($p_options_list[$i + 1])) { |
|
1558 | + $v_work_list = $p_options_list[$i + 1]; |
|
1559 | 1559 | } else { |
1560 | 1560 | // ----- Error log |
1561 | - PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Value must be integer, string or array for option '".PclZipUtilOptionText($p_options_list[$i])."'"); |
|
1561 | + PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Value must be integer, string or array for option '" . PclZipUtilOptionText($p_options_list[$i]) . "'"); |
|
1562 | 1562 | |
1563 | 1563 | // ----- Return |
1564 | 1564 | return PclZip::errorCode(); |
@@ -1568,9 +1568,9 @@ discard block |
||
1568 | 1568 | // each index item in the list must be a couple with a start and |
1569 | 1569 | // an end value : [0,3], [5-5], [8-10], ... |
1570 | 1570 | // ----- Check the format of each item |
1571 | - $v_sort_flag=false; |
|
1572 | - $v_sort_value=0; |
|
1573 | - for ($j=0; $j<sizeof($v_work_list); $j++) { |
|
1571 | + $v_sort_flag = false; |
|
1572 | + $v_sort_value = 0; |
|
1573 | + for ($j = 0; $j < sizeof($v_work_list); $j++) { |
|
1574 | 1574 | // ----- Explode the item |
1575 | 1575 | $v_item_list = explode("-", $v_work_list[$j]); |
1576 | 1576 | $v_size_item_list = sizeof($v_item_list); |
@@ -1589,7 +1589,7 @@ discard block |
||
1589 | 1589 | $v_result_list[$p_options_list[$i]][$j]['end'] = $v_item_list[1]; |
1590 | 1590 | } else { |
1591 | 1591 | // ----- Error log |
1592 | - PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Too many values in index range for option '".PclZipUtilOptionText($p_options_list[$i])."'"); |
|
1592 | + PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Too many values in index range for option '" . PclZipUtilOptionText($p_options_list[$i]) . "'"); |
|
1593 | 1593 | |
1594 | 1594 | // ----- Return |
1595 | 1595 | return PclZip::errorCode(); |
@@ -1598,11 +1598,11 @@ discard block |
||
1598 | 1598 | |
1599 | 1599 | // ----- Look for list sort |
1600 | 1600 | if ($v_result_list[$p_options_list[$i]][$j]['start'] < $v_sort_value) { |
1601 | - $v_sort_flag=true; |
|
1601 | + $v_sort_flag = true; |
|
1602 | 1602 | |
1603 | 1603 | // ----- TBC : An automatic sort should be writen ... |
1604 | 1604 | // ----- Error log |
1605 | - PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Invalid order of index range for option '".PclZipUtilOptionText($p_options_list[$i])."'"); |
|
1605 | + PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Invalid order of index range for option '" . PclZipUtilOptionText($p_options_list[$i]) . "'"); |
|
1606 | 1606 | |
1607 | 1607 | // ----- Return |
1608 | 1608 | return PclZip::errorCode(); |
@@ -1629,14 +1629,14 @@ discard block |
||
1629 | 1629 | // ----- Look for options that request an octal value |
1630 | 1630 | case PCLZIP_OPT_SET_CHMOD: |
1631 | 1631 | // ----- Check the number of parameters |
1632 | - if (($i+1) >= $p_size) { |
|
1632 | + if (($i + 1) >= $p_size) { |
|
1633 | 1633 | // ----- Error log |
1634 | - PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'"); |
|
1634 | + PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '" . PclZipUtilOptionText($p_options_list[$i]) . "'"); |
|
1635 | 1635 | // ----- Return |
1636 | 1636 | return PclZip::errorCode(); |
1637 | 1637 | } |
1638 | 1638 | // ----- Get the value |
1639 | - $v_result_list[$p_options_list[$i]] = $p_options_list[$i+1]; |
|
1639 | + $v_result_list[$p_options_list[$i]] = $p_options_list[$i + 1]; |
|
1640 | 1640 | $i++; |
1641 | 1641 | break; |
1642 | 1642 | |
@@ -1652,20 +1652,20 @@ discard block |
||
1652 | 1652 | case PCLZIP_CB_POST_LIST : |
1653 | 1653 | */ |
1654 | 1654 | // ----- Check the number of parameters |
1655 | - if (($i+1) >= $p_size) { |
|
1655 | + if (($i + 1) >= $p_size) { |
|
1656 | 1656 | // ----- Error log |
1657 | - PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'"); |
|
1657 | + PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '" . PclZipUtilOptionText($p_options_list[$i]) . "'"); |
|
1658 | 1658 | // ----- Return |
1659 | 1659 | return PclZip::errorCode(); |
1660 | 1660 | } |
1661 | 1661 | |
1662 | 1662 | // ----- Get the value |
1663 | - $v_function_name = $p_options_list[$i+1]; |
|
1663 | + $v_function_name = $p_options_list[$i + 1]; |
|
1664 | 1664 | |
1665 | 1665 | // ----- Check that the value is a valid existing function |
1666 | 1666 | if (!function_exists($v_function_name)) { |
1667 | 1667 | // ----- Error log |
1668 | - PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Function '".$v_function_name."()' is not an existing function for option '".PclZipUtilOptionText($p_options_list[$i])."'"); |
|
1668 | + PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Function '" . $v_function_name . "()' is not an existing function for option '" . PclZipUtilOptionText($p_options_list[$i]) . "'"); |
|
1669 | 1669 | // ----- Return |
1670 | 1670 | return PclZip::errorCode(); |
1671 | 1671 | } |
@@ -1676,7 +1676,7 @@ discard block |
||
1676 | 1676 | break; |
1677 | 1677 | default: |
1678 | 1678 | // ----- Error log |
1679 | - PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Unknown parameter '" .$p_options_list[$i]."'"); |
|
1679 | + PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Unknown parameter '" . $p_options_list[$i] . "'"); |
|
1680 | 1680 | |
1681 | 1681 | // ----- Return |
1682 | 1682 | return PclZip::errorCode(); |
@@ -1688,13 +1688,13 @@ discard block |
||
1688 | 1688 | |
1689 | 1689 | // ----- Look for mandatory options |
1690 | 1690 | if ($v_requested_options !== false) { |
1691 | - for ($key=reset($v_requested_options); $key=key($v_requested_options); $key=next($v_requested_options)) { |
|
1691 | + for ($key = reset($v_requested_options); $key = key($v_requested_options); $key = next($v_requested_options)) { |
|
1692 | 1692 | // ----- Look for mandatory option |
1693 | 1693 | if ($v_requested_options[$key] == 'mandatory') { |
1694 | 1694 | // ----- Look if present |
1695 | 1695 | if (!isset($v_result_list[$key])) { |
1696 | 1696 | // ----- Error log |
1697 | - PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Missing mandatory parameter ".PclZipUtilOptionText($key)."(".$key.")"); |
|
1697 | + PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Missing mandatory parameter " . PclZipUtilOptionText($key) . "(" . $key . ")"); |
|
1698 | 1698 | |
1699 | 1699 | // ----- Return |
1700 | 1700 | return PclZip::errorCode(); |
@@ -1720,7 +1720,7 @@ discard block |
||
1720 | 1720 | // -------------------------------------------------------------------------------- |
1721 | 1721 | public function privOptionDefaultThreshold(&$p_options) |
1722 | 1722 | { |
1723 | - $v_result=1; |
|
1723 | + $v_result = 1; |
|
1724 | 1724 | |
1725 | 1725 | if (isset($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD]) || isset($p_options[PCLZIP_OPT_TEMP_FILE_OFF])) { |
1726 | 1726 | return $v_result; |
@@ -1733,17 +1733,17 @@ discard block |
||
1733 | 1733 | |
1734 | 1734 | if ($last == 'g') { |
1735 | 1735 | //$v_memory_limit = $v_memory_limit*1024*1024*1024; |
1736 | - $v_memory_limit = $v_memory_limit*1073741824; |
|
1736 | + $v_memory_limit = $v_memory_limit * 1073741824; |
|
1737 | 1737 | } |
1738 | 1738 | if ($last == 'm') { |
1739 | 1739 | //$v_memory_limit = $v_memory_limit*1024*1024; |
1740 | - $v_memory_limit = $v_memory_limit*1048576; |
|
1740 | + $v_memory_limit = $v_memory_limit * 1048576; |
|
1741 | 1741 | } |
1742 | 1742 | if ($last == 'k') { |
1743 | - $v_memory_limit = $v_memory_limit*1024; |
|
1743 | + $v_memory_limit = $v_memory_limit * 1024; |
|
1744 | 1744 | } |
1745 | 1745 | |
1746 | - $p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD] = floor($v_memory_limit*PCLZIP_TEMPORARY_FILE_RATIO); |
|
1746 | + $p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD] = floor($v_memory_limit * PCLZIP_TEMPORARY_FILE_RATIO); |
|
1747 | 1747 | |
1748 | 1748 | // ----- Sanity check : No threshold if value lower than 1M |
1749 | 1749 | if ($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD] < 1048576) { |
@@ -1765,14 +1765,14 @@ discard block |
||
1765 | 1765 | // -------------------------------------------------------------------------------- |
1766 | 1766 | public function privFileDescrParseAtt(&$p_file_list, &$p_filedescr, $v_options, $v_requested_options = false) |
1767 | 1767 | { |
1768 | - $v_result=1; |
|
1768 | + $v_result = 1; |
|
1769 | 1769 | |
1770 | 1770 | // ----- For each file in the list check the attributes |
1771 | 1771 | foreach ($p_file_list as $v_key => $v_value) { |
1772 | 1772 | // ----- Check if the option is supported |
1773 | 1773 | if (!isset($v_requested_options[$v_key])) { |
1774 | 1774 | // ----- Error log |
1775 | - PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid file attribute '".$v_key."' for this file"); |
|
1775 | + PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid file attribute '" . $v_key . "' for this file"); |
|
1776 | 1776 | |
1777 | 1777 | // ----- Return |
1778 | 1778 | return PclZip::errorCode(); |
@@ -1782,54 +1782,54 @@ discard block |
||
1782 | 1782 | switch ($v_key) { |
1783 | 1783 | case PCLZIP_ATT_FILE_NAME: |
1784 | 1784 | if (!is_string($v_value)) { |
1785 | - PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid type ".gettype($v_value).". String expected for attribute '".PclZipUtilOptionText($v_key)."'"); |
|
1785 | + PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid type " . gettype($v_value) . ". String expected for attribute '" . PclZipUtilOptionText($v_key) . "'"); |
|
1786 | 1786 | return PclZip::errorCode(); |
1787 | 1787 | } |
1788 | 1788 | |
1789 | 1789 | $p_filedescr['filename'] = PclZipUtilPathReduction($v_value); |
1790 | 1790 | |
1791 | 1791 | if ($p_filedescr['filename'] == '') { |
1792 | - PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid empty filename for attribute '".PclZipUtilOptionText($v_key)."'"); |
|
1792 | + PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid empty filename for attribute '" . PclZipUtilOptionText($v_key) . "'"); |
|
1793 | 1793 | return PclZip::errorCode(); |
1794 | 1794 | } |
1795 | 1795 | break; |
1796 | 1796 | case PCLZIP_ATT_FILE_NEW_SHORT_NAME: |
1797 | 1797 | if (!is_string($v_value)) { |
1798 | - PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid type ".gettype($v_value).". String expected for attribute '".PclZipUtilOptionText($v_key)."'"); |
|
1798 | + PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid type " . gettype($v_value) . ". String expected for attribute '" . PclZipUtilOptionText($v_key) . "'"); |
|
1799 | 1799 | return PclZip::errorCode(); |
1800 | 1800 | } |
1801 | 1801 | |
1802 | 1802 | $p_filedescr['new_short_name'] = PclZipUtilPathReduction($v_value); |
1803 | 1803 | |
1804 | 1804 | if ($p_filedescr['new_short_name'] == '') { |
1805 | - PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid empty short filename for attribute '".PclZipUtilOptionText($v_key)."'"); |
|
1805 | + PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid empty short filename for attribute '" . PclZipUtilOptionText($v_key) . "'"); |
|
1806 | 1806 | return PclZip::errorCode(); |
1807 | 1807 | } |
1808 | 1808 | break; |
1809 | 1809 | case PCLZIP_ATT_FILE_NEW_FULL_NAME: |
1810 | 1810 | if (!is_string($v_value)) { |
1811 | - PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid type ".gettype($v_value).". String expected for attribute '".PclZipUtilOptionText($v_key)."'"); |
|
1811 | + PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid type " . gettype($v_value) . ". String expected for attribute '" . PclZipUtilOptionText($v_key) . "'"); |
|
1812 | 1812 | return PclZip::errorCode(); |
1813 | 1813 | } |
1814 | 1814 | |
1815 | 1815 | $p_filedescr['new_full_name'] = PclZipUtilPathReduction($v_value); |
1816 | 1816 | |
1817 | 1817 | if ($p_filedescr['new_full_name'] == '') { |
1818 | - PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid empty full filename for attribute '".PclZipUtilOptionText($v_key)."'"); |
|
1818 | + PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid empty full filename for attribute '" . PclZipUtilOptionText($v_key) . "'"); |
|
1819 | 1819 | return PclZip::errorCode(); |
1820 | 1820 | } |
1821 | 1821 | break; |
1822 | 1822 | // ----- Look for options that takes a string |
1823 | 1823 | case PCLZIP_ATT_FILE_COMMENT: |
1824 | 1824 | if (!is_string($v_value)) { |
1825 | - PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid type ".gettype($v_value).". String expected for attribute '".PclZipUtilOptionText($v_key)."'"); |
|
1825 | + PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid type " . gettype($v_value) . ". String expected for attribute '" . PclZipUtilOptionText($v_key) . "'"); |
|
1826 | 1826 | return PclZip::errorCode(); |
1827 | 1827 | } |
1828 | 1828 | $p_filedescr['comment'] = $v_value; |
1829 | 1829 | break; |
1830 | 1830 | case PCLZIP_ATT_FILE_MTIME: |
1831 | 1831 | if (!is_integer($v_value)) { |
1832 | - PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid type ".gettype($v_value).". Integer expected for attribute '".PclZipUtilOptionText($v_key)."'"); |
|
1832 | + PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid type " . gettype($v_value) . ". Integer expected for attribute '" . PclZipUtilOptionText($v_key) . "'"); |
|
1833 | 1833 | return PclZip::errorCode(); |
1834 | 1834 | } |
1835 | 1835 | $p_filedescr['mtime'] = $v_value; |
@@ -1839,7 +1839,7 @@ discard block |
||
1839 | 1839 | break; |
1840 | 1840 | default: |
1841 | 1841 | // ----- Error log |
1842 | - PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Unknown parameter '".$v_key."'"); |
|
1842 | + PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Unknown parameter '" . $v_key . "'"); |
|
1843 | 1843 | |
1844 | 1844 | // ----- Return |
1845 | 1845 | return PclZip::errorCode(); |
@@ -1852,7 +1852,7 @@ discard block |
||
1852 | 1852 | if ($v_requested_options[$key] == 'mandatory') { |
1853 | 1853 | // ----- Look if present |
1854 | 1854 | if (!isset($p_file_list[$key])) { |
1855 | - PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Missing mandatory parameter ".PclZipUtilOptionText($key)."(".$key.")"); |
|
1855 | + PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Missing mandatory parameter " . PclZipUtilOptionText($key) . "(" . $key . ")"); |
|
1856 | 1856 | return PclZip::errorCode(); |
1857 | 1857 | } |
1858 | 1858 | } |
@@ -1881,13 +1881,13 @@ discard block |
||
1881 | 1881 | // -------------------------------------------------------------------------------- |
1882 | 1882 | public function privFileDescrExpand(&$p_filedescr_list, &$p_options) |
1883 | 1883 | { |
1884 | - $v_result=1; |
|
1884 | + $v_result = 1; |
|
1885 | 1885 | |
1886 | 1886 | // ----- Create a result list |
1887 | 1887 | $v_result_list = array(); |
1888 | 1888 | |
1889 | 1889 | // ----- Look each entry |
1890 | - for ($i=0; $i<sizeof($p_filedescr_list); $i++) { |
|
1890 | + for ($i = 0; $i < sizeof($p_filedescr_list); $i++) { |
|
1891 | 1891 | // ----- Get filedescr |
1892 | 1892 | $v_descr = $p_filedescr_list[$i]; |
1893 | 1893 | |
@@ -1914,7 +1914,7 @@ discard block |
||
1914 | 1914 | } else { |
1915 | 1915 | // ----- Missing file |
1916 | 1916 | // ----- Error log |
1917 | - PclZip::privErrorLog(PCLZIP_ERR_MISSING_FILE, "File '".$v_descr['filename']."' does not exist"); |
|
1917 | + PclZip::privErrorLog(PCLZIP_ERR_MISSING_FILE, "File '" . $v_descr['filename'] . "' does not exist"); |
|
1918 | 1918 | |
1919 | 1919 | // ----- Return |
1920 | 1920 | return PclZip::errorCode(); |
@@ -1939,7 +1939,7 @@ discard block |
||
1939 | 1939 | } |
1940 | 1940 | |
1941 | 1941 | // ----- Compose the full filename |
1942 | - $v_dirlist_descr[$v_dirlist_nb]['filename'] = $v_descr['filename'].'/'.$v_item_handler; |
|
1942 | + $v_dirlist_descr[$v_dirlist_nb]['filename'] = $v_descr['filename'] . '/' . $v_item_handler; |
|
1943 | 1943 | |
1944 | 1944 | // ----- Look for different stored filename |
1945 | 1945 | // Because the name of the folder was changed, the name of the |
@@ -1947,7 +1947,7 @@ discard block |
||
1947 | 1947 | if (($v_descr['stored_filename'] != $v_descr['filename']) |
1948 | 1948 | && (!isset($p_options[PCLZIP_OPT_REMOVE_ALL_PATH]))) { |
1949 | 1949 | if ($v_descr['stored_filename'] != '') { |
1950 | - $v_dirlist_descr[$v_dirlist_nb]['new_full_name'] = $v_descr['stored_filename'].'/'.$v_item_handler; |
|
1950 | + $v_dirlist_descr[$v_dirlist_nb]['new_full_name'] = $v_descr['stored_filename'] . '/' . $v_item_handler; |
|
1951 | 1951 | } else { |
1952 | 1952 | $v_dirlist_descr[$v_dirlist_nb]['new_full_name'] = $v_item_handler; |
1953 | 1953 | } |
@@ -1992,7 +1992,7 @@ discard block |
||
1992 | 1992 | // -------------------------------------------------------------------------------- |
1993 | 1993 | public function privCreate($p_filedescr_list, &$p_result_list, &$p_options) |
1994 | 1994 | { |
1995 | - $v_result=1; |
|
1995 | + $v_result = 1; |
|
1996 | 1996 | $v_list_detail = array(); |
1997 | 1997 | |
1998 | 1998 | // ----- Magic quotes trick |
@@ -2026,7 +2026,7 @@ discard block |
||
2026 | 2026 | // -------------------------------------------------------------------------------- |
2027 | 2027 | public function privAdd($p_filedescr_list, &$p_result_list, &$p_options) |
2028 | 2028 | { |
2029 | - $v_result=1; |
|
2029 | + $v_result = 1; |
|
2030 | 2030 | $v_list_detail = array(); |
2031 | 2031 | |
2032 | 2032 | // ----- Look if the archive exists or is empty |
@@ -2041,7 +2041,7 @@ discard block |
||
2041 | 2041 | $this->privDisableMagicQuotes(); |
2042 | 2042 | |
2043 | 2043 | // ----- Open the zip file |
2044 | - if (($v_result=$this->privOpenFd('rb')) != 1) { |
|
2044 | + if (($v_result = $this->privOpenFd('rb')) != 1) { |
|
2045 | 2045 | // ----- Magic quotes trick |
2046 | 2046 | $this->privSwapBackMagicQuotes(); |
2047 | 2047 | |
@@ -2061,14 +2061,14 @@ discard block |
||
2061 | 2061 | @rewind($this->zip_fd); |
2062 | 2062 | |
2063 | 2063 | // ----- Creates a temporay file |
2064 | - $v_zip_temp_name = PCLZIP_TEMPORARY_DIR.uniqid('pclzip-').'.tmp'; |
|
2064 | + $v_zip_temp_name = PCLZIP_TEMPORARY_DIR . uniqid('pclzip-') . '.tmp'; |
|
2065 | 2065 | |
2066 | 2066 | // ----- Open the temporary file in write mode |
2067 | 2067 | if (($v_zip_temp_fd = @fopen($v_zip_temp_name, 'wb')) == 0) { |
2068 | 2068 | $this->privCloseFd(); |
2069 | 2069 | $this->privSwapBackMagicQuotes(); |
2070 | 2070 | |
2071 | - PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open temporary file \''.$v_zip_temp_name.'\' in binary write mode'); |
|
2071 | + PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open temporary file \'' . $v_zip_temp_name . '\' in binary write mode'); |
|
2072 | 2072 | |
2073 | 2073 | // ----- Return |
2074 | 2074 | return PclZip::errorCode(); |
@@ -2116,7 +2116,7 @@ discard block |
||
2116 | 2116 | } |
2117 | 2117 | |
2118 | 2118 | // ----- Create the Central Dir files header |
2119 | - for ($i=0, $v_count=0; $i<sizeof($v_header_list); $i++) { |
|
2119 | + for ($i = 0, $v_count = 0; $i < sizeof($v_header_list); $i++) { |
|
2120 | 2120 | // ----- Create the file header |
2121 | 2121 | if ($v_header_list[$i]['status'] == 'ok') { |
2122 | 2122 | if (($v_result = $this->privWriteCentralFileHeader($v_header_list[$i])) != 1) { |
@@ -2141,17 +2141,17 @@ discard block |
||
2141 | 2141 | $v_comment = $p_options[PCLZIP_OPT_COMMENT]; |
2142 | 2142 | } |
2143 | 2143 | if (isset($p_options[PCLZIP_OPT_ADD_COMMENT])) { |
2144 | - $v_comment = $v_comment.$p_options[PCLZIP_OPT_ADD_COMMENT]; |
|
2144 | + $v_comment = $v_comment . $p_options[PCLZIP_OPT_ADD_COMMENT]; |
|
2145 | 2145 | } |
2146 | 2146 | if (isset($p_options[PCLZIP_OPT_PREPEND_COMMENT])) { |
2147 | - $v_comment = $p_options[PCLZIP_OPT_PREPEND_COMMENT].$v_comment; |
|
2147 | + $v_comment = $p_options[PCLZIP_OPT_PREPEND_COMMENT] . $v_comment; |
|
2148 | 2148 | } |
2149 | 2149 | |
2150 | 2150 | // ----- Calculate the size of the central header |
2151 | - $v_size = @ftell($this->zip_fd)-$v_offset; |
|
2151 | + $v_size = @ftell($this->zip_fd) - $v_offset; |
|
2152 | 2152 | |
2153 | 2153 | // ----- Create the central dir footer |
2154 | - if (($v_result = $this->privWriteCentralHeader($v_count+$v_central_dir['entries'], $v_size, $v_offset, $v_comment)) != 1) { |
|
2154 | + if (($v_result = $this->privWriteCentralHeader($v_count + $v_central_dir['entries'], $v_size, $v_offset, $v_comment)) != 1) { |
|
2155 | 2155 | // ----- Reset the file list |
2156 | 2156 | unset($v_header_list); |
2157 | 2157 | $this->privSwapBackMagicQuotes(); |
@@ -2195,12 +2195,12 @@ discard block |
||
2195 | 2195 | // -------------------------------------------------------------------------------- |
2196 | 2196 | public function privOpenFd($p_mode) |
2197 | 2197 | { |
2198 | - $v_result=1; |
|
2198 | + $v_result = 1; |
|
2199 | 2199 | |
2200 | 2200 | // ----- Look if already open |
2201 | 2201 | if ($this->zip_fd != 0) { |
2202 | 2202 | // ----- Error log |
2203 | - PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Zip file \''.$this->zipname.'\' already open'); |
|
2203 | + PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Zip file \'' . $this->zipname . '\' already open'); |
|
2204 | 2204 | |
2205 | 2205 | // ----- Return |
2206 | 2206 | return PclZip::errorCode(); |
@@ -2209,7 +2209,7 @@ discard block |
||
2209 | 2209 | // ----- Open the zip file |
2210 | 2210 | if (($this->zip_fd = @fopen($this->zipname, $p_mode)) == 0) { |
2211 | 2211 | // ----- Error log |
2212 | - PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open archive \''.$this->zipname.'\' in '.$p_mode.' mode'); |
|
2212 | + PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open archive \'' . $this->zipname . '\' in ' . $p_mode . ' mode'); |
|
2213 | 2213 | |
2214 | 2214 | // ----- Return |
2215 | 2215 | return PclZip::errorCode(); |
@@ -2227,7 +2227,7 @@ discard block |
||
2227 | 2227 | // -------------------------------------------------------------------------------- |
2228 | 2228 | public function privCloseFd() |
2229 | 2229 | { |
2230 | - $v_result=1; |
|
2230 | + $v_result = 1; |
|
2231 | 2231 | |
2232 | 2232 | if ($this->zip_fd != 0) { |
2233 | 2233 | @fclose($this->zip_fd); |
@@ -2255,7 +2255,7 @@ discard block |
||
2255 | 2255 | // public function privAddList($p_list, &$p_result_list, $p_add_dir, $p_remove_dir, $p_remove_all_dir, &$p_options) |
2256 | 2256 | public function privAddList($p_filedescr_list, &$p_result_list, &$p_options) |
2257 | 2257 | { |
2258 | - $v_result=1; |
|
2258 | + $v_result = 1; |
|
2259 | 2259 | |
2260 | 2260 | // ----- Add the files |
2261 | 2261 | $v_header_list = array(); |
@@ -2268,7 +2268,7 @@ discard block |
||
2268 | 2268 | $v_offset = @ftell($this->zip_fd); |
2269 | 2269 | |
2270 | 2270 | // ----- Create the Central Dir files header |
2271 | - for ($i=0, $v_count=0; $i<sizeof($v_header_list); $i++) { |
|
2271 | + for ($i = 0, $v_count = 0; $i < sizeof($v_header_list); $i++) { |
|
2272 | 2272 | // ----- Create the file header |
2273 | 2273 | if ($v_header_list[$i]['status'] == 'ok') { |
2274 | 2274 | if (($v_result = $this->privWriteCentralFileHeader($v_header_list[$i])) != 1) { |
@@ -2289,7 +2289,7 @@ discard block |
||
2289 | 2289 | } |
2290 | 2290 | |
2291 | 2291 | // ----- Calculate the size of the central header |
2292 | - $v_size = @ftell($this->zip_fd)-$v_offset; |
|
2292 | + $v_size = @ftell($this->zip_fd) - $v_offset; |
|
2293 | 2293 | |
2294 | 2294 | // ----- Create the central dir footer |
2295 | 2295 | if (($v_result = $this->privWriteCentralHeader($v_count, $v_size, $v_offset, $v_comment)) != 1) { |
@@ -2316,14 +2316,14 @@ discard block |
||
2316 | 2316 | // -------------------------------------------------------------------------------- |
2317 | 2317 | public function privAddFileList($p_filedescr_list, &$p_result_list, &$p_options) |
2318 | 2318 | { |
2319 | - $v_result=1; |
|
2319 | + $v_result = 1; |
|
2320 | 2320 | $v_header = array(); |
2321 | 2321 | |
2322 | 2322 | // ----- Recuperate the current number of elt in list |
2323 | 2323 | $v_nb = sizeof($p_result_list); |
2324 | 2324 | |
2325 | 2325 | // ----- Loop on the files |
2326 | - for ($j=0; ($j<sizeof($p_filedescr_list)) && ($v_result==1); $j++) { |
|
2326 | + for ($j = 0; ($j < sizeof($p_filedescr_list)) && ($v_result == 1); $j++) { |
|
2327 | 2327 | // ----- Format the filename |
2328 | 2328 | $p_filedescr_list[$j]['filename'] = PclZipUtilTranslateWinPath($p_filedescr_list[$j]['filename'], false); |
2329 | 2329 | |
@@ -2335,7 +2335,7 @@ discard block |
||
2335 | 2335 | |
2336 | 2336 | // ----- Check the filename |
2337 | 2337 | if (($p_filedescr_list[$j]['type'] != 'virtual_file') && (!file_exists($p_filedescr_list[$j]['filename']))) { |
2338 | - PclZip::privErrorLog(PCLZIP_ERR_MISSING_FILE, "File '".$p_filedescr_list[$j]['filename']."' does not exist"); |
|
2338 | + PclZip::privErrorLog(PCLZIP_ERR_MISSING_FILE, "File '" . $p_filedescr_list[$j]['filename'] . "' does not exist"); |
|
2339 | 2339 | return PclZip::errorCode(); |
2340 | 2340 | } |
2341 | 2341 | |
@@ -2368,7 +2368,7 @@ discard block |
||
2368 | 2368 | // -------------------------------------------------------------------------------- |
2369 | 2369 | public function privAddFile($p_filedescr, &$p_header, &$p_options) |
2370 | 2370 | { |
2371 | - $v_result=1; |
|
2371 | + $v_result = 1; |
|
2372 | 2372 | |
2373 | 2373 | // ----- Working variable |
2374 | 2374 | $p_filename = $p_filedescr['filename']; |
@@ -2413,10 +2413,10 @@ discard block |
||
2413 | 2413 | $p_header['index'] = -1; |
2414 | 2414 | |
2415 | 2415 | // ----- Look for regular file |
2416 | - if ($p_filedescr['type']=='file') { |
|
2416 | + if ($p_filedescr['type'] == 'file') { |
|
2417 | 2417 | $p_header['external'] = 0x00000000; |
2418 | 2418 | $p_header['size'] = filesize($p_filename); |
2419 | - } elseif ($p_filedescr['type']=='folder') { |
|
2419 | + } elseif ($p_filedescr['type'] == 'folder') { |
|
2420 | 2420 | // ----- Look for regular folder |
2421 | 2421 | $p_header['external'] = 0x00000010; |
2422 | 2422 | $p_header['mtime'] = filemtime($p_filename); |
@@ -2570,7 +2570,7 @@ discard block |
||
2570 | 2570 | // ----- Set the file properties |
2571 | 2571 | $p_header['size'] = 0; |
2572 | 2572 | //$p_header['external'] = 0x41FF0010; // Value for a folder : to be checked |
2573 | - $p_header['external'] = 0x00000010; // Value for a folder : to be checked |
|
2573 | + $p_header['external'] = 0x00000010; // Value for a folder : to be checked |
|
2574 | 2574 | |
2575 | 2575 | // ----- Call the header generation |
2576 | 2576 | if (($v_result = $this->privWriteFileHeader($p_header)) != 1) { |
@@ -2612,7 +2612,7 @@ discard block |
||
2612 | 2612 | // -------------------------------------------------------------------------------- |
2613 | 2613 | public function privAddFileUsingTempFile($p_filedescr, &$p_header, &$p_options) |
2614 | 2614 | { |
2615 | - $v_result=PCLZIP_ERR_NO_ERROR; |
|
2615 | + $v_result = PCLZIP_ERR_NO_ERROR; |
|
2616 | 2616 | |
2617 | 2617 | // ----- Working variable |
2618 | 2618 | $p_filename = $p_filedescr['filename']; |
@@ -2625,10 +2625,10 @@ discard block |
||
2625 | 2625 | } |
2626 | 2626 | |
2627 | 2627 | // ----- Creates a compressed temporary file |
2628 | - $v_gzip_temp_name = PCLZIP_TEMPORARY_DIR.uniqid('pclzip-').'.gz'; |
|
2628 | + $v_gzip_temp_name = PCLZIP_TEMPORARY_DIR . uniqid('pclzip-') . '.gz'; |
|
2629 | 2629 | if (($v_file_compressed = @gzopen($v_gzip_temp_name, "wb")) == 0) { |
2630 | 2630 | fclose($v_file); |
2631 | - PclZip::privErrorLog(PCLZIP_ERR_WRITE_OPEN_FAIL, 'Unable to open temporary file \''.$v_gzip_temp_name.'\' in binary write mode'); |
|
2631 | + PclZip::privErrorLog(PCLZIP_ERR_WRITE_OPEN_FAIL, 'Unable to open temporary file \'' . $v_gzip_temp_name . '\' in binary write mode'); |
|
2632 | 2632 | return PclZip::errorCode(); |
2633 | 2633 | } |
2634 | 2634 | |
@@ -2648,13 +2648,13 @@ discard block |
||
2648 | 2648 | |
2649 | 2649 | // ----- Check the minimum file size |
2650 | 2650 | if (filesize($v_gzip_temp_name) < 18) { |
2651 | - PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'gzip temporary file \''.$v_gzip_temp_name.'\' has invalid filesize - should be minimum 18 bytes'); |
|
2651 | + PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'gzip temporary file \'' . $v_gzip_temp_name . '\' has invalid filesize - should be minimum 18 bytes'); |
|
2652 | 2652 | return PclZip::errorCode(); |
2653 | 2653 | } |
2654 | 2654 | |
2655 | 2655 | // ----- Extract the compressed attributes |
2656 | 2656 | if (($v_file_compressed = @fopen($v_gzip_temp_name, "rb")) == 0) { |
2657 | - PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open temporary file \''.$v_gzip_temp_name.'\' in binary read mode'); |
|
2657 | + PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open temporary file \'' . $v_gzip_temp_name . '\' in binary read mode'); |
|
2658 | 2658 | return PclZip::errorCode(); |
2659 | 2659 | } |
2660 | 2660 | |
@@ -2666,7 +2666,7 @@ discard block |
||
2666 | 2666 | $v_data_header['os'] = bin2hex($v_data_header['os']); |
2667 | 2667 | |
2668 | 2668 | // ----- Read the gzip file footer |
2669 | - @fseek($v_file_compressed, filesize($v_gzip_temp_name)-8); |
|
2669 | + @fseek($v_file_compressed, filesize($v_gzip_temp_name) - 8); |
|
2670 | 2670 | $v_binary_data = @fread($v_file_compressed, 8); |
2671 | 2671 | $v_data_footer = unpack('Vcrc/Vcompressed_size', $v_binary_data); |
2672 | 2672 | |
@@ -2674,7 +2674,7 @@ discard block |
||
2674 | 2674 | $p_header['compression'] = ord($v_data_header['cm']); |
2675 | 2675 | //$p_header['mtime'] = $v_data_header['mtime']; |
2676 | 2676 | $p_header['crc'] = $v_data_footer['crc']; |
2677 | - $p_header['compressed_size'] = filesize($v_gzip_temp_name)-18; |
|
2677 | + $p_header['compressed_size'] = filesize($v_gzip_temp_name) - 18; |
|
2678 | 2678 | |
2679 | 2679 | // ----- Close the file |
2680 | 2680 | @fclose($v_file_compressed); |
@@ -2686,7 +2686,7 @@ discard block |
||
2686 | 2686 | |
2687 | 2687 | // ----- Add the compressed data |
2688 | 2688 | if (($v_file_compressed = @fopen($v_gzip_temp_name, "rb")) == 0) { |
2689 | - PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open temporary file \''.$v_gzip_temp_name.'\' in binary read mode'); |
|
2689 | + PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open temporary file \'' . $v_gzip_temp_name . '\' in binary read mode'); |
|
2690 | 2690 | return PclZip::errorCode(); |
2691 | 2691 | } |
2692 | 2692 | |
@@ -2722,7 +2722,7 @@ discard block |
||
2722 | 2722 | // -------------------------------------------------------------------------------- |
2723 | 2723 | public function privCalculateStoredFilename(&$p_filedescr, &$p_options) |
2724 | 2724 | { |
2725 | - $v_result=1; |
|
2725 | + $v_result = 1; |
|
2726 | 2726 | |
2727 | 2727 | // ----- Working variables |
2728 | 2728 | $p_filename = $p_filedescr['filename']; |
@@ -2754,9 +2754,9 @@ discard block |
||
2754 | 2754 | $v_path_info = pathinfo($p_filename); |
2755 | 2755 | $v_dir = ''; |
2756 | 2756 | if ($v_path_info['dirname'] != '') { |
2757 | - $v_dir = $v_path_info['dirname'].'/'; |
|
2757 | + $v_dir = $v_path_info['dirname'] . '/'; |
|
2758 | 2758 | } |
2759 | - $v_stored_filename = $v_dir.$p_filedescr['new_short_name']; |
|
2759 | + $v_stored_filename = $v_dir . $p_filedescr['new_short_name']; |
|
2760 | 2760 | } else { |
2761 | 2761 | // ----- Calculate the stored filename |
2762 | 2762 | $v_stored_filename = $p_filename; |
@@ -2773,7 +2773,7 @@ discard block |
||
2773 | 2773 | |
2774 | 2774 | if ((substr($p_filename, 0, 2) == "./") || (substr($p_remove_dir, 0, 2) == "./")) { |
2775 | 2775 | if ((substr($p_filename, 0, 2) == "./") && (substr($p_remove_dir, 0, 2) != "./")) { |
2776 | - $p_remove_dir = "./".$p_remove_dir; |
|
2776 | + $p_remove_dir = "./" . $p_remove_dir; |
|
2777 | 2777 | } |
2778 | 2778 | if ((substr($p_filename, 0, 2) != "./") && (substr($p_remove_dir, 0, 2) == "./")) { |
2779 | 2779 | $p_remove_dir = substr($p_remove_dir, 2); |
@@ -2796,9 +2796,9 @@ discard block |
||
2796 | 2796 | // ----- Look for path to add |
2797 | 2797 | if ($p_add_dir != "") { |
2798 | 2798 | if (substr($p_add_dir, -1) == "/") { |
2799 | - $v_stored_filename = $p_add_dir.$v_stored_filename; |
|
2799 | + $v_stored_filename = $p_add_dir . $v_stored_filename; |
|
2800 | 2800 | } else { |
2801 | - $v_stored_filename = $p_add_dir."/".$v_stored_filename; |
|
2801 | + $v_stored_filename = $p_add_dir . "/" . $v_stored_filename; |
|
2802 | 2802 | } |
2803 | 2803 | } |
2804 | 2804 | } |
@@ -2820,15 +2820,15 @@ discard block |
||
2820 | 2820 | // -------------------------------------------------------------------------------- |
2821 | 2821 | public function privWriteFileHeader(&$p_header) |
2822 | 2822 | { |
2823 | - $v_result=1; |
|
2823 | + $v_result = 1; |
|
2824 | 2824 | |
2825 | 2825 | // ----- Store the offset position of the file |
2826 | 2826 | $p_header['offset'] = ftell($this->zip_fd); |
2827 | 2827 | |
2828 | 2828 | // ----- Transform UNIX mtime to DOS format mdate/mtime |
2829 | 2829 | $v_date = getdate($p_header['mtime']); |
2830 | - $v_mtime = ($v_date['hours']<<11) + ($v_date['minutes']<<5) + $v_date['seconds']/2; |
|
2831 | - $v_mdate = (($v_date['year']-1980)<<9) + ($v_date['mon']<<5) + $v_date['mday']; |
|
2830 | + $v_mtime = ($v_date['hours'] << 11) + ($v_date['minutes'] << 5) + $v_date['seconds'] / 2; |
|
2831 | + $v_mdate = (($v_date['year'] - 1980) << 9) + ($v_date['mon'] << 5) + $v_date['mday']; |
|
2832 | 2832 | |
2833 | 2833 | // ----- Packed data |
2834 | 2834 | $v_binary_data = pack("VvvvvvVVVvv", 0x04034b50, $p_header['version_extracted'], $p_header['flag'], $p_header['compression'], $v_mtime, $v_mdate, $p_header['crc'], $p_header['compressed_size'], $p_header['size'], strlen($p_header['stored_filename']), $p_header['extra_len']); |
@@ -2857,7 +2857,7 @@ discard block |
||
2857 | 2857 | // -------------------------------------------------------------------------------- |
2858 | 2858 | public function privWriteCentralFileHeader(&$p_header) |
2859 | 2859 | { |
2860 | - $v_result=1; |
|
2860 | + $v_result = 1; |
|
2861 | 2861 | |
2862 | 2862 | // TBC |
2863 | 2863 | //for(reset($p_header); $key = key($p_header); next($p_header)) { |
@@ -2865,8 +2865,8 @@ discard block |
||
2865 | 2865 | |
2866 | 2866 | // ----- Transform UNIX mtime to DOS format mdate/mtime |
2867 | 2867 | $v_date = getdate($p_header['mtime']); |
2868 | - $v_mtime = ($v_date['hours']<<11) + ($v_date['minutes']<<5) + $v_date['seconds']/2; |
|
2869 | - $v_mdate = (($v_date['year']-1980)<<9) + ($v_date['mon']<<5) + $v_date['mday']; |
|
2868 | + $v_mtime = ($v_date['hours'] << 11) + ($v_date['minutes'] << 5) + $v_date['seconds'] / 2; |
|
2869 | + $v_mdate = (($v_date['year'] - 1980) << 9) + ($v_date['mon'] << 5) + $v_date['mday']; |
|
2870 | 2870 | |
2871 | 2871 | |
2872 | 2872 | // ----- Packed data |
@@ -2936,7 +2936,7 @@ discard block |
||
2936 | 2936 | $this->privSwapBackMagicQuotes(); |
2937 | 2937 | |
2938 | 2938 | // ----- Error log |
2939 | - PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open archive \''.$this->zipname.'\' in binary read mode'); |
|
2939 | + PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open archive \'' . $this->zipname . '\' in binary read mode'); |
|
2940 | 2940 | |
2941 | 2941 | // ----- Return |
2942 | 2942 | return PclZip::errorCode(); |
@@ -2962,7 +2962,7 @@ discard block |
||
2962 | 2962 | } |
2963 | 2963 | |
2964 | 2964 | // ----- Read each entry |
2965 | - for ($i=0; $i<$v_central_dir['entries']; $i++) { |
|
2965 | + for ($i = 0; $i < $v_central_dir['entries']; $i++) { |
|
2966 | 2966 | // ----- Read the file header |
2967 | 2967 | if (($v_result = $this->privReadCentralFileHeader($v_header)) != 1) { |
2968 | 2968 | $this->privSwapBackMagicQuotes(); |
@@ -3007,7 +3007,7 @@ discard block |
||
3007 | 3007 | // -------------------------------------------------------------------------------- |
3008 | 3008 | public function privConvertHeader2FileInfo($p_header, &$p_info) |
3009 | 3009 | { |
3010 | - $v_result=1; |
|
3010 | + $v_result = 1; |
|
3011 | 3011 | |
3012 | 3012 | // ----- Get the interesting attributes |
3013 | 3013 | $v_temp_path = PclZipUtilPathReduction($p_header['filename']); |
@@ -3018,7 +3018,7 @@ discard block |
||
3018 | 3018 | $p_info['compressed_size'] = $p_header['compressed_size']; |
3019 | 3019 | $p_info['mtime'] = $p_header['mtime']; |
3020 | 3020 | $p_info['comment'] = $p_header['comment']; |
3021 | - $p_info['folder'] = (($p_header['external']&0x00000010)==0x00000010); |
|
3021 | + $p_info['folder'] = (($p_header['external'] & 0x00000010) == 0x00000010); |
|
3022 | 3022 | $p_info['index'] = $p_header['index']; |
3023 | 3023 | $p_info['status'] = $p_header['status']; |
3024 | 3024 | $p_info['crc'] = $p_header['crc']; |
@@ -3046,21 +3046,21 @@ discard block |
||
3046 | 3046 | // -------------------------------------------------------------------------------- |
3047 | 3047 | public function privExtractByRule(&$p_file_list, $p_path, $p_remove_path, $p_remove_all_path, &$p_options) |
3048 | 3048 | { |
3049 | - $v_result=1; |
|
3049 | + $v_result = 1; |
|
3050 | 3050 | |
3051 | 3051 | // ----- Magic quotes trick |
3052 | 3052 | $this->privDisableMagicQuotes(); |
3053 | 3053 | |
3054 | 3054 | // ----- Check the path |
3055 | - if (($p_path == "") || ((substr($p_path, 0, 1) != "/") && (substr($p_path, 0, 3) != "../") && (substr($p_path, 1, 2)!=":/"))) { |
|
3056 | - $p_path = "./".$p_path; |
|
3055 | + if (($p_path == "") || ((substr($p_path, 0, 1) != "/") && (substr($p_path, 0, 3) != "../") && (substr($p_path, 1, 2) != ":/"))) { |
|
3056 | + $p_path = "./" . $p_path; |
|
3057 | 3057 | } |
3058 | 3058 | |
3059 | 3059 | // ----- Reduce the path last (and duplicated) '/' |
3060 | 3060 | if (($p_path != "./") && ($p_path != "/")) { |
3061 | 3061 | // ----- Look for the path end '/' |
3062 | 3062 | while (substr($p_path, -1) == "/") { |
3063 | - $p_path = substr($p_path, 0, strlen($p_path)-1); |
|
3063 | + $p_path = substr($p_path, 0, strlen($p_path) - 1); |
|
3064 | 3064 | } |
3065 | 3065 | } |
3066 | 3066 | |
@@ -3091,7 +3091,7 @@ discard block |
||
3091 | 3091 | |
3092 | 3092 | // ----- Read each entry |
3093 | 3093 | $j_start = 0; |
3094 | - for ($i=0, $v_nb_extracted=0; $i<$v_central_dir['entries']; $i++) { |
|
3094 | + for ($i = 0, $v_nb_extracted = 0; $i < $v_central_dir['entries']; $i++) { |
|
3095 | 3095 | // ----- Read next Central dir entry |
3096 | 3096 | @rewind($this->zip_fd); |
3097 | 3097 | if (@fseek($this->zip_fd, $v_pos_entry)) { |
@@ -3128,7 +3128,7 @@ discard block |
||
3128 | 3128 | // ----- Look for extract by name rule |
3129 | 3129 | if ((isset($p_options[PCLZIP_OPT_BY_NAME])) && ($p_options[PCLZIP_OPT_BY_NAME] != 0)) { |
3130 | 3130 | // ----- Look if the filename is in the list |
3131 | - for ($j=0; ($j<sizeof($p_options[PCLZIP_OPT_BY_NAME])) && (!$v_extract); $j++) { |
|
3131 | + for ($j = 0; ($j < sizeof($p_options[PCLZIP_OPT_BY_NAME])) && (!$v_extract); $j++) { |
|
3132 | 3132 | // ----- Look for a directory |
3133 | 3133 | if (substr($p_options[PCLZIP_OPT_BY_NAME][$j], -1) == "/") { |
3134 | 3134 | // ----- Look if the directory is in the filename path |
@@ -3148,15 +3148,15 @@ discard block |
||
3148 | 3148 | } elseif ((isset($p_options[PCLZIP_OPT_BY_INDEX])) && ($p_options[PCLZIP_OPT_BY_INDEX] != 0)) { |
3149 | 3149 | // ----- Look for extract by index rule |
3150 | 3150 | // ----- Look if the index is in the list |
3151 | - for ($j=$j_start; ($j<sizeof($p_options[PCLZIP_OPT_BY_INDEX])) && (!$v_extract); $j++) { |
|
3152 | - if (($i>=$p_options[PCLZIP_OPT_BY_INDEX][$j]['start']) && ($i<=$p_options[PCLZIP_OPT_BY_INDEX][$j]['end'])) { |
|
3151 | + for ($j = $j_start; ($j < sizeof($p_options[PCLZIP_OPT_BY_INDEX])) && (!$v_extract); $j++) { |
|
3152 | + if (($i >= $p_options[PCLZIP_OPT_BY_INDEX][$j]['start']) && ($i <= $p_options[PCLZIP_OPT_BY_INDEX][$j]['end'])) { |
|
3153 | 3153 | $v_extract = true; |
3154 | 3154 | } |
3155 | - if ($i>=$p_options[PCLZIP_OPT_BY_INDEX][$j]['end']) { |
|
3156 | - $j_start = $j+1; |
|
3155 | + if ($i >= $p_options[PCLZIP_OPT_BY_INDEX][$j]['end']) { |
|
3156 | + $j_start = $j + 1; |
|
3157 | 3157 | } |
3158 | 3158 | |
3159 | - if ($p_options[PCLZIP_OPT_BY_INDEX][$j]['start']>$i) { |
|
3159 | + if ($p_options[PCLZIP_OPT_BY_INDEX][$j]['start'] > $i) { |
|
3160 | 3160 | break; |
3161 | 3161 | } |
3162 | 3162 | } |
@@ -3173,7 +3173,7 @@ discard block |
||
3173 | 3173 | if ((isset($p_options[PCLZIP_OPT_STOP_ON_ERROR])) && ($p_options[PCLZIP_OPT_STOP_ON_ERROR] === true)) { |
3174 | 3174 | $this->privSwapBackMagicQuotes(); |
3175 | 3175 | |
3176 | - PclZip::privErrorLog(PCLZIP_ERR_UNSUPPORTED_COMPRESSION, "Filename '".$v_header['stored_filename']."' is compressed by an unsupported compression method (".$v_header['compression'].") "); |
|
3176 | + PclZip::privErrorLog(PCLZIP_ERR_UNSUPPORTED_COMPRESSION, "Filename '" . $v_header['stored_filename'] . "' is compressed by an unsupported compression method (" . $v_header['compression'] . ") "); |
|
3177 | 3177 | |
3178 | 3178 | return PclZip::errorCode(); |
3179 | 3179 | } |
@@ -3186,7 +3186,7 @@ discard block |
||
3186 | 3186 | if ((isset($p_options[PCLZIP_OPT_STOP_ON_ERROR])) && ($p_options[PCLZIP_OPT_STOP_ON_ERROR] === true)) { |
3187 | 3187 | $this->privSwapBackMagicQuotes(); |
3188 | 3188 | |
3189 | - PclZip::privErrorLog(PCLZIP_ERR_UNSUPPORTED_ENCRYPTION, "Unsupported encryption for filename '".$v_header['stored_filename']."'"); |
|
3189 | + PclZip::privErrorLog(PCLZIP_ERR_UNSUPPORTED_ENCRYPTION, "Unsupported encryption for filename '" . $v_header['stored_filename'] . "'"); |
|
3190 | 3190 | |
3191 | 3191 | return PclZip::errorCode(); |
3192 | 3192 | } |
@@ -3320,7 +3320,7 @@ discard block |
||
3320 | 3320 | // -------------------------------------------------------------------------------- |
3321 | 3321 | public function privExtractFile(&$p_entry, $p_path, $p_remove_path, $p_remove_all_path, &$p_options) |
3322 | 3322 | { |
3323 | - $v_result=1; |
|
3323 | + $v_result = 1; |
|
3324 | 3324 | |
3325 | 3325 | // ----- Read the file header |
3326 | 3326 | if (($v_result = $this->privReadFileHeader($v_header)) != 1) { |
@@ -3337,7 +3337,7 @@ discard block |
||
3337 | 3337 | // ----- Look for all path to remove |
3338 | 3338 | if ($p_remove_all_path == true) { |
3339 | 3339 | // ----- Look for folder entry that not need to be extracted |
3340 | - if (($p_entry['external']&0x00000010)==0x00000010) { |
|
3340 | + if (($p_entry['external'] & 0x00000010) == 0x00000010) { |
|
3341 | 3341 | $p_entry['status'] = "filtered"; |
3342 | 3342 | |
3343 | 3343 | return $v_result; |
@@ -3364,14 +3364,14 @@ discard block |
||
3364 | 3364 | |
3365 | 3365 | // ----- Add the path |
3366 | 3366 | if ($p_path != '') { |
3367 | - $p_entry['filename'] = $p_path."/".$p_entry['filename']; |
|
3367 | + $p_entry['filename'] = $p_path . "/" . $p_entry['filename']; |
|
3368 | 3368 | } |
3369 | 3369 | |
3370 | 3370 | // ----- Check a base_dir_restriction |
3371 | 3371 | if (isset($p_options[PCLZIP_OPT_EXTRACT_DIR_RESTRICTION])) { |
3372 | 3372 | $v_inclusion = PclZipUtilPathInclusion($p_options[PCLZIP_OPT_EXTRACT_DIR_RESTRICTION], $p_entry['filename']); |
3373 | 3373 | if ($v_inclusion == 0) { |
3374 | - PclZip::privErrorLog(PCLZIP_ERR_DIRECTORY_RESTRICTION, "Filename '".$p_entry['filename']."' is outside PCLZIP_OPT_EXTRACT_DIR_RESTRICTION"); |
|
3374 | + PclZip::privErrorLog(PCLZIP_ERR_DIRECTORY_RESTRICTION, "Filename '" . $p_entry['filename'] . "' is outside PCLZIP_OPT_EXTRACT_DIR_RESTRICTION"); |
|
3375 | 3375 | |
3376 | 3376 | return PclZip::errorCode(); |
3377 | 3377 | } |
@@ -3418,8 +3418,8 @@ discard block |
||
3418 | 3418 | // ----- Look for PCLZIP_OPT_STOP_ON_ERROR |
3419 | 3419 | // For historical reason first PclZip implementation does not stop |
3420 | 3420 | // when this kind of error occurs. |
3421 | - if ((isset($p_options[PCLZIP_OPT_STOP_ON_ERROR])) && ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) { |
|
3422 | - PclZip::privErrorLog(PCLZIP_ERR_ALREADY_A_DIRECTORY, "Filename '".$p_entry['filename']."' is already used by an existing directory"); |
|
3421 | + if ((isset($p_options[PCLZIP_OPT_STOP_ON_ERROR])) && ($p_options[PCLZIP_OPT_STOP_ON_ERROR] === true)) { |
|
3422 | + PclZip::privErrorLog(PCLZIP_ERR_ALREADY_A_DIRECTORY, "Filename '" . $p_entry['filename'] . "' is already used by an existing directory"); |
|
3423 | 3423 | return PclZip::errorCode(); |
3424 | 3424 | } |
3425 | 3425 | } elseif (!is_writeable($p_entry['filename'])) { |
@@ -3431,7 +3431,7 @@ discard block |
||
3431 | 3431 | // For historical reason first PclZip implementation does not stop |
3432 | 3432 | // when this kind of error occurs. |
3433 | 3433 | if ((isset($p_options[PCLZIP_OPT_STOP_ON_ERROR])) && ($p_options[PCLZIP_OPT_STOP_ON_ERROR] === true)) { |
3434 | - PclZip::privErrorLog(PCLZIP_ERR_WRITE_OPEN_FAIL, "Filename '".$p_entry['filename']."' exists and is write protected"); |
|
3434 | + PclZip::privErrorLog(PCLZIP_ERR_WRITE_OPEN_FAIL, "Filename '" . $p_entry['filename'] . "' exists and is write protected"); |
|
3435 | 3435 | return PclZip::errorCode(); |
3436 | 3436 | } |
3437 | 3437 | } elseif (filemtime($p_entry['filename']) > $p_entry['mtime']) { |
@@ -3445,7 +3445,7 @@ discard block |
||
3445 | 3445 | // For historical reason first PclZip implementation does not stop |
3446 | 3446 | // when this kind of error occurs. |
3447 | 3447 | if ((isset($p_options[PCLZIP_OPT_STOP_ON_ERROR])) && ($p_options[PCLZIP_OPT_STOP_ON_ERROR] === true)) { |
3448 | - PclZip::privErrorLog(PCLZIP_ERR_WRITE_OPEN_FAIL, "Newer version of '".$p_entry['filename']."' exists and option PCLZIP_OPT_REPLACE_NEWER is not selected"); |
|
3448 | + PclZip::privErrorLog(PCLZIP_ERR_WRITE_OPEN_FAIL, "Newer version of '" . $p_entry['filename'] . "' exists and option PCLZIP_OPT_REPLACE_NEWER is not selected"); |
|
3449 | 3449 | return PclZip::errorCode(); |
3450 | 3450 | } |
3451 | 3451 | } |
@@ -3453,7 +3453,7 @@ discard block |
||
3453 | 3453 | } |
3454 | 3454 | } else { |
3455 | 3455 | // ----- Check the directory availability and create it if necessary |
3456 | - if ((($p_entry['external']&0x00000010)==0x00000010) || (substr($p_entry['filename'], -1) == '/')) { |
|
3456 | + if ((($p_entry['external'] & 0x00000010) == 0x00000010) || (substr($p_entry['filename'], -1) == '/')) { |
|
3457 | 3457 | $v_dir_to_check = $p_entry['filename']; |
3458 | 3458 | } elseif (!strstr($p_entry['filename'], "/")) { |
3459 | 3459 | $v_dir_to_check = ""; |
@@ -3461,7 +3461,7 @@ discard block |
||
3461 | 3461 | $v_dir_to_check = dirname($p_entry['filename']); |
3462 | 3462 | } |
3463 | 3463 | |
3464 | - if (($v_result = $this->privDirCheck($v_dir_to_check, (($p_entry['external']&0x00000010)==0x00000010))) != 1) { |
|
3464 | + if (($v_result = $this->privDirCheck($v_dir_to_check, (($p_entry['external'] & 0x00000010) == 0x00000010))) != 1) { |
|
3465 | 3465 | // ----- Change the file status |
3466 | 3466 | $p_entry['status'] = "path_creation_fail"; |
3467 | 3467 | |
@@ -3475,7 +3475,7 @@ discard block |
||
3475 | 3475 | // ----- Look if extraction should be done |
3476 | 3476 | if ($p_entry['status'] == 'ok') { |
3477 | 3477 | // ----- Do the extraction (if not a folder) |
3478 | - if (!(($p_entry['external']&0x00000010) == 0x00000010)) { |
|
3478 | + if (!(($p_entry['external'] & 0x00000010) == 0x00000010)) { |
|
3479 | 3479 | // ----- Look for not compressed file |
3480 | 3480 | if ($p_entry['compression'] == 0) { |
3481 | 3481 | // ----- Opening destination file |
@@ -3509,7 +3509,7 @@ discard block |
||
3509 | 3509 | // ----- TBC |
3510 | 3510 | // Need to be finished |
3511 | 3511 | if (($p_entry['flag'] & 1) == 1) { |
3512 | - PclZip::privErrorLog(PCLZIP_ERR_UNSUPPORTED_ENCRYPTION, 'File \''.$p_entry['filename'].'\' is encrypted. Encrypted files are not supported.'); |
|
3512 | + PclZip::privErrorLog(PCLZIP_ERR_UNSUPPORTED_ENCRYPTION, 'File \'' . $p_entry['filename'] . '\' is encrypted. Encrypted files are not supported.'); |
|
3513 | 3513 | return PclZip::errorCode(); |
3514 | 3514 | } |
3515 | 3515 | |
@@ -3597,13 +3597,13 @@ discard block |
||
3597 | 3597 | // -------------------------------------------------------------------------------- |
3598 | 3598 | public function privExtractFileUsingTempFile(&$p_entry, &$p_options) |
3599 | 3599 | { |
3600 | - $v_result=1; |
|
3600 | + $v_result = 1; |
|
3601 | 3601 | |
3602 | 3602 | // ----- Creates a temporary file |
3603 | - $v_gzip_temp_name = PCLZIP_TEMPORARY_DIR.uniqid('pclzip-').'.gz'; |
|
3603 | + $v_gzip_temp_name = PCLZIP_TEMPORARY_DIR . uniqid('pclzip-') . '.gz'; |
|
3604 | 3604 | if (($v_dest_file = @fopen($v_gzip_temp_name, "wb")) == 0) { |
3605 | 3605 | fclose($v_file); |
3606 | - PclZip::privErrorLog(PCLZIP_ERR_WRITE_OPEN_FAIL, 'Unable to open temporary file \''.$v_gzip_temp_name.'\' in binary write mode'); |
|
3606 | + PclZip::privErrorLog(PCLZIP_ERR_WRITE_OPEN_FAIL, 'Unable to open temporary file \'' . $v_gzip_temp_name . '\' in binary write mode'); |
|
3607 | 3607 | return PclZip::errorCode(); |
3608 | 3608 | } |
3609 | 3609 | |
@@ -3638,7 +3638,7 @@ discard block |
||
3638 | 3638 | if (($v_src_file = @gzopen($v_gzip_temp_name, 'rb')) == 0) { |
3639 | 3639 | @fclose($v_dest_file); |
3640 | 3640 | $p_entry['status'] = "read_error"; |
3641 | - PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open temporary file \''.$v_gzip_temp_name.'\' in binary read mode'); |
|
3641 | + PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open temporary file \'' . $v_gzip_temp_name . '\' in binary read mode'); |
|
3642 | 3642 | return PclZip::errorCode(); |
3643 | 3643 | } |
3644 | 3644 | |
@@ -3670,7 +3670,7 @@ discard block |
||
3670 | 3670 | // -------------------------------------------------------------------------------- |
3671 | 3671 | public function privExtractFileInOutput(&$p_entry, &$p_options) |
3672 | 3672 | { |
3673 | - $v_result=1; |
|
3673 | + $v_result = 1; |
|
3674 | 3674 | |
3675 | 3675 | // ----- Read the file header |
3676 | 3676 | if (($v_result = $this->privReadFileHeader($v_header)) != 1) { |
@@ -3716,7 +3716,7 @@ discard block |
||
3716 | 3716 | // ----- Look if extraction should be done |
3717 | 3717 | if ($p_entry['status'] == 'ok') { |
3718 | 3718 | // ----- Do the extraction (if not a folder) |
3719 | - if (!(($p_entry['external']&0x00000010)==0x00000010)) { |
|
3719 | + if (!(($p_entry['external'] & 0x00000010) == 0x00000010)) { |
|
3720 | 3720 | // ----- Look for not compressed file |
3721 | 3721 | if ($p_entry['compressed_size'] == $p_entry['size']) { |
3722 | 3722 | // ----- Read the file in a buffer (one shot) |
@@ -3774,7 +3774,7 @@ discard block |
||
3774 | 3774 | // -------------------------------------------------------------------------------- |
3775 | 3775 | public function privExtractFileAsString(&$p_entry, &$p_string, &$p_options) |
3776 | 3776 | { |
3777 | - $v_result=1; |
|
3777 | + $v_result = 1; |
|
3778 | 3778 | |
3779 | 3779 | // ----- Read the file header |
3780 | 3780 | $v_header = array(); |
@@ -3820,7 +3820,7 @@ discard block |
||
3820 | 3820 | // ----- Look if extraction should be done |
3821 | 3821 | if ($p_entry['status'] == 'ok') { |
3822 | 3822 | // ----- Do the extraction (if not a folder) |
3823 | - if (!(($p_entry['external']&0x00000010)==0x00000010)) { |
|
3823 | + if (!(($p_entry['external'] & 0x00000010) == 0x00000010)) { |
|
3824 | 3824 | // ----- Look for not compressed file |
3825 | 3825 | // if ($p_entry['compressed_size'] == $p_entry['size']) |
3826 | 3826 | if ($p_entry['compression'] == 0) { |
@@ -3883,7 +3883,7 @@ discard block |
||
3883 | 3883 | // -------------------------------------------------------------------------------- |
3884 | 3884 | public function privReadFileHeader(&$p_header) |
3885 | 3885 | { |
3886 | - $v_result=1; |
|
3886 | + $v_result = 1; |
|
3887 | 3887 | |
3888 | 3888 | // ----- Read the 4 bytes signature |
3889 | 3889 | $v_binary_data = @fread($this->zip_fd, 4); |
@@ -3907,7 +3907,7 @@ discard block |
||
3907 | 3907 | $p_header['status'] = "invalid_header"; |
3908 | 3908 | |
3909 | 3909 | // ----- Error log |
3910 | - PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, "Invalid block size : ".strlen($v_binary_data)); |
|
3910 | + PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, "Invalid block size : " . strlen($v_binary_data)); |
|
3911 | 3911 | |
3912 | 3912 | // ----- Return |
3913 | 3913 | return PclZip::errorCode(); |
@@ -3942,7 +3942,7 @@ discard block |
||
3942 | 3942 | // ----- Extract time |
3943 | 3943 | $v_hour = ($p_header['mtime'] & 0xF800) >> 11; |
3944 | 3944 | $v_minute = ($p_header['mtime'] & 0x07E0) >> 5; |
3945 | - $v_seconde = ($p_header['mtime'] & 0x001F)*2; |
|
3945 | + $v_seconde = ($p_header['mtime'] & 0x001F) * 2; |
|
3946 | 3946 | |
3947 | 3947 | // ----- Extract date |
3948 | 3948 | $v_year = (($p_header['mdate'] & 0xFE00) >> 9) + 1980; |
@@ -4002,7 +4002,7 @@ discard block |
||
4002 | 4002 | $p_header['status'] = "invalid_header"; |
4003 | 4003 | |
4004 | 4004 | // ----- Error log |
4005 | - PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, "Invalid block size : ".strlen($v_binary_data)); |
|
4005 | + PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, "Invalid block size : " . strlen($v_binary_data)); |
|
4006 | 4006 | |
4007 | 4007 | // ----- Return |
4008 | 4008 | return PclZip::errorCode(); |
@@ -4041,7 +4041,7 @@ discard block |
||
4041 | 4041 | // ----- Extract time |
4042 | 4042 | $v_hour = ($p_header['mtime'] & 0xF800) >> 11; |
4043 | 4043 | $v_minute = ($p_header['mtime'] & 0x07E0) >> 5; |
4044 | - $v_seconde = ($p_header['mtime'] & 0x001F)*2; |
|
4044 | + $v_seconde = ($p_header['mtime'] & 0x001F) * 2; |
|
4045 | 4045 | |
4046 | 4046 | // ----- Extract date |
4047 | 4047 | $v_year = (($p_header['mdate'] & 0xFE00) >> 9) + 1980; |
@@ -4082,7 +4082,7 @@ discard block |
||
4082 | 4082 | // -------------------------------------------------------------------------------- |
4083 | 4083 | public function privCheckFileHeaders(&$p_local_header, &$p_central_header) |
4084 | 4084 | { |
4085 | - $v_result=1; |
|
4085 | + $v_result = 1; |
|
4086 | 4086 | |
4087 | 4087 | // ----- Check the static values |
4088 | 4088 | // TBC |
@@ -4119,14 +4119,14 @@ discard block |
||
4119 | 4119 | // -------------------------------------------------------------------------------- |
4120 | 4120 | public function privReadEndCentralDir(&$p_central_dir) |
4121 | 4121 | { |
4122 | - $v_result=1; |
|
4122 | + $v_result = 1; |
|
4123 | 4123 | |
4124 | 4124 | // ----- Go to the end of the zip file |
4125 | 4125 | $v_size = filesize($this->zipname); |
4126 | 4126 | @fseek($this->zip_fd, $v_size); |
4127 | 4127 | if (@ftell($this->zip_fd) != $v_size) { |
4128 | 4128 | // ----- Error log |
4129 | - PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'Unable to go to the end of the archive \''.$this->zipname.'\''); |
|
4129 | + PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'Unable to go to the end of the archive \'' . $this->zipname . '\''); |
|
4130 | 4130 | |
4131 | 4131 | // ----- Return |
4132 | 4132 | return PclZip::errorCode(); |
@@ -4136,10 +4136,10 @@ discard block |
||
4136 | 4136 | // in this case the end of central dir is at 22 bytes of the file end |
4137 | 4137 | $v_found = 0; |
4138 | 4138 | if ($v_size > 26) { |
4139 | - @fseek($this->zip_fd, $v_size-22); |
|
4140 | - if (($v_pos = @ftell($this->zip_fd)) != ($v_size-22)) { |
|
4139 | + @fseek($this->zip_fd, $v_size - 22); |
|
4140 | + if (($v_pos = @ftell($this->zip_fd)) != ($v_size - 22)) { |
|
4141 | 4141 | // ----- Error log |
4142 | - PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'Unable to seek back to the middle of the archive \''.$this->zipname.'\''); |
|
4142 | + PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'Unable to seek back to the middle of the archive \'' . $this->zipname . '\''); |
|
4143 | 4143 | |
4144 | 4144 | // ----- Return |
4145 | 4145 | return PclZip::errorCode(); |
@@ -4163,10 +4163,10 @@ discard block |
||
4163 | 4163 | if ($v_maximum_size > $v_size) { |
4164 | 4164 | $v_maximum_size = $v_size; |
4165 | 4165 | } |
4166 | - @fseek($this->zip_fd, $v_size-$v_maximum_size); |
|
4167 | - if (@ftell($this->zip_fd) != ($v_size-$v_maximum_size)) { |
|
4166 | + @fseek($this->zip_fd, $v_size - $v_maximum_size); |
|
4167 | + if (@ftell($this->zip_fd) != ($v_size - $v_maximum_size)) { |
|
4168 | 4168 | // ----- Error log |
4169 | - PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'Unable to seek back to the middle of the archive \''.$this->zipname.'\''); |
|
4169 | + PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'Unable to seek back to the middle of the archive \'' . $this->zipname . '\''); |
|
4170 | 4170 | |
4171 | 4171 | // ----- Return |
4172 | 4172 | return PclZip::errorCode(); |
@@ -4210,7 +4210,7 @@ discard block |
||
4210 | 4210 | // ----- Look for invalid block size |
4211 | 4211 | if (strlen($v_binary_data) != 18) { |
4212 | 4212 | // ----- Error log |
4213 | - PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, "Invalid End of Central Dir Record size : ".strlen($v_binary_data)); |
|
4213 | + PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, "Invalid End of Central Dir Record size : " . strlen($v_binary_data)); |
|
4214 | 4214 | |
4215 | 4215 | // ----- Return |
4216 | 4216 | return PclZip::errorCode(); |
@@ -4265,11 +4265,11 @@ discard block |
||
4265 | 4265 | // -------------------------------------------------------------------------------- |
4266 | 4266 | public function privDeleteByRule(&$p_result_list, &$p_options) |
4267 | 4267 | { |
4268 | - $v_result=1; |
|
4268 | + $v_result = 1; |
|
4269 | 4269 | $v_list_detail = array(); |
4270 | 4270 | |
4271 | 4271 | // ----- Open the zip file |
4272 | - if (($v_result=$this->privOpenFd('rb')) != 1) { |
|
4272 | + if (($v_result = $this->privOpenFd('rb')) != 1) { |
|
4273 | 4273 | // ----- Return |
4274 | 4274 | return $v_result; |
4275 | 4275 | } |
@@ -4302,7 +4302,7 @@ discard block |
||
4302 | 4302 | // ----- Read each entry |
4303 | 4303 | $v_header_list = array(); |
4304 | 4304 | $j_start = 0; |
4305 | - for ($i=0, $v_nb_extracted=0; $i<$v_central_dir['entries']; $i++) { |
|
4305 | + for ($i = 0, $v_nb_extracted = 0; $i < $v_central_dir['entries']; $i++) { |
|
4306 | 4306 | // ----- Read the file header |
4307 | 4307 | $v_header_list[$v_nb_extracted] = array(); |
4308 | 4308 | if (($v_result = $this->privReadCentralFileHeader($v_header_list[$v_nb_extracted])) != 1) { |
@@ -4322,13 +4322,13 @@ discard block |
||
4322 | 4322 | // ----- Look for extract by name rule |
4323 | 4323 | if ((isset($p_options[PCLZIP_OPT_BY_NAME])) && ($p_options[PCLZIP_OPT_BY_NAME] != 0)) { |
4324 | 4324 | // ----- Look if the filename is in the list |
4325 | - for ($j=0; ($j<sizeof($p_options[PCLZIP_OPT_BY_NAME])) && (!$v_found); $j++) { |
|
4325 | + for ($j = 0; ($j < sizeof($p_options[PCLZIP_OPT_BY_NAME])) && (!$v_found); $j++) { |
|
4326 | 4326 | // ----- Look for a directory |
4327 | 4327 | if (substr($p_options[PCLZIP_OPT_BY_NAME][$j], -1) == "/") { |
4328 | 4328 | // ----- Look if the directory is in the filename path |
4329 | 4329 | 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])) { |
4330 | 4330 | $v_found = true; |
4331 | - } 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])) { |
|
4331 | + } 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])) { |
|
4332 | 4332 | $v_found = true; |
4333 | 4333 | } |
4334 | 4334 | } elseif ($v_header_list[$v_nb_extracted]['stored_filename'] == $p_options[PCLZIP_OPT_BY_NAME][$j]) { |
@@ -4344,14 +4344,14 @@ discard block |
||
4344 | 4344 | } elseif ((isset($p_options[PCLZIP_OPT_BY_INDEX])) && ($p_options[PCLZIP_OPT_BY_INDEX] != 0)) { |
4345 | 4345 | // ----- Look for extract by index rule |
4346 | 4346 | // ----- Look if the index is in the list |
4347 | - for ($j=$j_start; ($j<sizeof($p_options[PCLZIP_OPT_BY_INDEX])) && (!$v_found); $j++) { |
|
4348 | - if (($i>=$p_options[PCLZIP_OPT_BY_INDEX][$j]['start']) && ($i<=$p_options[PCLZIP_OPT_BY_INDEX][$j]['end'])) { |
|
4347 | + for ($j = $j_start; ($j < sizeof($p_options[PCLZIP_OPT_BY_INDEX])) && (!$v_found); $j++) { |
|
4348 | + if (($i >= $p_options[PCLZIP_OPT_BY_INDEX][$j]['start']) && ($i <= $p_options[PCLZIP_OPT_BY_INDEX][$j]['end'])) { |
|
4349 | 4349 | $v_found = true; |
4350 | 4350 | } |
4351 | - if ($i>=$p_options[PCLZIP_OPT_BY_INDEX][$j]['end']) { |
|
4352 | - $j_start = $j+1; |
|
4351 | + if ($i >= $p_options[PCLZIP_OPT_BY_INDEX][$j]['end']) { |
|
4352 | + $j_start = $j + 1; |
|
4353 | 4353 | } |
4354 | - if ($p_options[PCLZIP_OPT_BY_INDEX][$j]['start']>$i) { |
|
4354 | + if ($p_options[PCLZIP_OPT_BY_INDEX][$j]['start'] > $i) { |
|
4355 | 4355 | break; |
4356 | 4356 | } |
4357 | 4357 | } |
@@ -4370,7 +4370,7 @@ discard block |
||
4370 | 4370 | // ----- Look if something need to be deleted |
4371 | 4371 | if ($v_nb_extracted > 0) { |
4372 | 4372 | // ----- Creates a temporay file |
4373 | - $v_zip_temp_name = PCLZIP_TEMPORARY_DIR.uniqid('pclzip-').'.tmp'; |
|
4373 | + $v_zip_temp_name = PCLZIP_TEMPORARY_DIR . uniqid('pclzip-') . '.tmp'; |
|
4374 | 4374 | |
4375 | 4375 | // ----- Creates a temporary zip archive |
4376 | 4376 | $v_temp_zip = new PclZip($v_zip_temp_name); |
@@ -4384,7 +4384,7 @@ discard block |
||
4384 | 4384 | } |
4385 | 4385 | |
4386 | 4386 | // ----- Look which file need to be kept |
4387 | - for ($i=0; $i<sizeof($v_header_list); $i++) { |
|
4387 | + for ($i = 0; $i < sizeof($v_header_list); $i++) { |
|
4388 | 4388 | // ----- Calculate the position of the header |
4389 | 4389 | @rewind($this->zip_fd); |
4390 | 4390 | if (@fseek($this->zip_fd, $v_header_list[$i]['offset'])) { |
@@ -4445,7 +4445,7 @@ discard block |
||
4445 | 4445 | $v_offset = @ftell($v_temp_zip->zip_fd); |
4446 | 4446 | |
4447 | 4447 | // ----- Re-Create the Central Dir files header |
4448 | - for ($i=0; $i<sizeof($v_header_list); $i++) { |
|
4448 | + for ($i = 0; $i < sizeof($v_header_list); $i++) { |
|
4449 | 4449 | // ----- Create the file header |
4450 | 4450 | if (($v_result = $v_temp_zip->privWriteCentralFileHeader($v_header_list[$i])) != 1) { |
4451 | 4451 | $v_temp_zip->privCloseFd(); |
@@ -4468,7 +4468,7 @@ discard block |
||
4468 | 4468 | } |
4469 | 4469 | |
4470 | 4470 | // ----- Calculate the size of the central header |
4471 | - $v_size = @ftell($v_temp_zip->zip_fd)-$v_offset; |
|
4471 | + $v_size = @ftell($v_temp_zip->zip_fd) - $v_offset; |
|
4472 | 4472 | |
4473 | 4473 | // ----- Create the central dir footer |
4474 | 4474 | if (($v_result = $v_temp_zip->privWriteCentralHeader(sizeof($v_header_list), $v_size, $v_offset, $v_comment)) != 1) { |
@@ -4533,8 +4533,8 @@ discard block |
||
4533 | 4533 | $v_result = 1; |
4534 | 4534 | |
4535 | 4535 | // ----- Remove the final '/' |
4536 | - if (($p_is_dir) && (substr($p_dir, -1)=='/')) { |
|
4537 | - $p_dir = substr($p_dir, 0, strlen($p_dir)-1); |
|
4536 | + if (($p_is_dir) && (substr($p_dir, -1) == '/')) { |
|
4537 | + $p_dir = substr($p_dir, 0, strlen($p_dir) - 1); |
|
4538 | 4538 | } |
4539 | 4539 | |
4540 | 4540 | // ----- Check the directory availability |
@@ -4578,7 +4578,7 @@ discard block |
||
4578 | 4578 | // -------------------------------------------------------------------------------- |
4579 | 4579 | public function privMerge(&$p_archive_to_add) |
4580 | 4580 | { |
4581 | - $v_result=1; |
|
4581 | + $v_result = 1; |
|
4582 | 4582 | |
4583 | 4583 | // ----- Look if the archive_to_add exists |
4584 | 4584 | if (!is_file($p_archive_to_add->zipname)) { |
@@ -4599,7 +4599,7 @@ discard block |
||
4599 | 4599 | } |
4600 | 4600 | |
4601 | 4601 | // ----- Open the zip file |
4602 | - if (($v_result=$this->privOpenFd('rb')) != 1) { |
|
4602 | + if (($v_result = $this->privOpenFd('rb')) != 1) { |
|
4603 | 4603 | // ----- Return |
4604 | 4604 | return $v_result; |
4605 | 4605 | } |
@@ -4615,7 +4615,7 @@ discard block |
||
4615 | 4615 | @rewind($this->zip_fd); |
4616 | 4616 | |
4617 | 4617 | // ----- Open the archive_to_add file |
4618 | - if (($v_result=$p_archive_to_add->privOpenFd('rb')) != 1) { |
|
4618 | + if (($v_result = $p_archive_to_add->privOpenFd('rb')) != 1) { |
|
4619 | 4619 | $this->privCloseFd(); |
4620 | 4620 | |
4621 | 4621 | // ----- Return |
@@ -4635,14 +4635,14 @@ discard block |
||
4635 | 4635 | @rewind($p_archive_to_add->zip_fd); |
4636 | 4636 | |
4637 | 4637 | // ----- Creates a temporay file |
4638 | - $v_zip_temp_name = PCLZIP_TEMPORARY_DIR.uniqid('pclzip-').'.tmp'; |
|
4638 | + $v_zip_temp_name = PCLZIP_TEMPORARY_DIR . uniqid('pclzip-') . '.tmp'; |
|
4639 | 4639 | |
4640 | 4640 | // ----- Open the temporary file in write mode |
4641 | 4641 | if (($v_zip_temp_fd = @fopen($v_zip_temp_name, 'wb')) == 0) { |
4642 | 4642 | $this->privCloseFd(); |
4643 | 4643 | $p_archive_to_add->privCloseFd(); |
4644 | 4644 | |
4645 | - PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open temporary file \''.$v_zip_temp_name.'\' in binary write mode'); |
|
4645 | + PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open temporary file \'' . $v_zip_temp_name . '\' in binary write mode'); |
|
4646 | 4646 | |
4647 | 4647 | // ----- Return |
4648 | 4648 | return PclZip::errorCode(); |
@@ -4689,10 +4689,10 @@ discard block |
||
4689 | 4689 | } |
4690 | 4690 | |
4691 | 4691 | // ----- Merge the file comments |
4692 | - $v_comment = $v_central_dir['comment'].' '.$v_central_dir_to_add['comment']; |
|
4692 | + $v_comment = $v_central_dir['comment'] . ' ' . $v_central_dir_to_add['comment']; |
|
4693 | 4693 | |
4694 | 4694 | // ----- Calculate the size of the (new) central header |
4695 | - $v_size = @ftell($v_zip_temp_fd)-$v_offset; |
|
4695 | + $v_size = @ftell($v_zip_temp_fd) - $v_offset; |
|
4696 | 4696 | |
4697 | 4697 | // ----- Swap the file descriptor |
4698 | 4698 | // Here is a trick : I swap the temporary fd with the zip fd, in order to use |
@@ -4702,7 +4702,7 @@ discard block |
||
4702 | 4702 | $v_zip_temp_fd = $v_swap; |
4703 | 4703 | |
4704 | 4704 | // ----- Create the central dir footer |
4705 | - if (($v_result = $this->privWriteCentralHeader($v_central_dir['entries']+$v_central_dir_to_add['entries'], $v_size, $v_offset, $v_comment)) != 1) { |
|
4705 | + if (($v_result = $this->privWriteCentralHeader($v_central_dir['entries'] + $v_central_dir_to_add['entries'], $v_size, $v_offset, $v_comment)) != 1) { |
|
4706 | 4706 | $this->privCloseFd(); |
4707 | 4707 | $p_archive_to_add->privCloseFd(); |
4708 | 4708 | @fclose($v_zip_temp_fd); |
@@ -4749,7 +4749,7 @@ discard block |
||
4749 | 4749 | // -------------------------------------------------------------------------------- |
4750 | 4750 | public function privDuplicate($p_archive_filename) |
4751 | 4751 | { |
4752 | - $v_result=1; |
|
4752 | + $v_result = 1; |
|
4753 | 4753 | |
4754 | 4754 | // ----- Look if the $p_archive_filename exists |
4755 | 4755 | if (!is_file($p_archive_filename)) { |
@@ -4761,7 +4761,7 @@ discard block |
||
4761 | 4761 | } |
4762 | 4762 | |
4763 | 4763 | // ----- Open the zip file |
4764 | - if (($v_result=$this->privOpenFd('wb')) != 1) { |
|
4764 | + if (($v_result = $this->privOpenFd('wb')) != 1) { |
|
4765 | 4765 | // ----- Return |
4766 | 4766 | return $v_result; |
4767 | 4767 | } |
@@ -4770,7 +4770,7 @@ discard block |
||
4770 | 4770 | if (($v_zip_temp_fd = @fopen($p_archive_filename, 'rb')) == 0) { |
4771 | 4771 | $this->privCloseFd(); |
4772 | 4772 | |
4773 | - PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open archive file \''.$p_archive_filename.'\' in binary write mode'); |
|
4773 | + PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open archive file \'' . $p_archive_filename . '\' in binary write mode'); |
|
4774 | 4774 | |
4775 | 4775 | // ----- Return |
4776 | 4776 | return PclZip::errorCode(); |
@@ -4837,7 +4837,7 @@ discard block |
||
4837 | 4837 | // -------------------------------------------------------------------------------- |
4838 | 4838 | public function privDisableMagicQuotes() |
4839 | 4839 | { |
4840 | - $v_result=1; |
|
4840 | + $v_result = 1; |
|
4841 | 4841 | |
4842 | 4842 | // ----- Look if function exists |
4843 | 4843 | if ((!function_exists("get_magic_quotes_runtime")) || (!function_exists("set_magic_quotes_runtime"))) { |
@@ -4870,7 +4870,7 @@ discard block |
||
4870 | 4870 | // -------------------------------------------------------------------------------- |
4871 | 4871 | public function privSwapBackMagicQuotes() |
4872 | 4872 | { |
4873 | - $v_result=1; |
|
4873 | + $v_result = 1; |
|
4874 | 4874 | |
4875 | 4875 | // ----- Look if function exists |
4876 | 4876 | if ((!function_exists("get_magic_quotes_runtime")) || (!function_exists("set_magic_quotes_runtime"))) { |
@@ -4912,7 +4912,7 @@ discard block |
||
4912 | 4912 | |
4913 | 4913 | // ----- Study directories from last to first |
4914 | 4914 | $v_skip = 0; |
4915 | - for ($i=sizeof($v_list)-1; $i>=0; $i--) { |
|
4915 | + for ($i = sizeof($v_list) - 1; $i >= 0; $i--) { |
|
4916 | 4916 | // ----- Look for current path |
4917 | 4917 | if ($v_list[$i] == ".") { |
4918 | 4918 | // ----- Ignore this directory |
@@ -4922,14 +4922,14 @@ discard block |
||
4922 | 4922 | } elseif ($v_list[$i] == "") { |
4923 | 4923 | // ----- First '/' i.e. root slash |
4924 | 4924 | if ($i == 0) { |
4925 | - $v_result = "/".$v_result; |
|
4925 | + $v_result = "/" . $v_result; |
|
4926 | 4926 | if ($v_skip > 0) { |
4927 | 4927 | // ----- It is an invalid path, so the path is not modified |
4928 | 4928 | // TBC |
4929 | 4929 | $v_result = $p_dir; |
4930 | 4930 | $v_skip = 0; |
4931 | 4931 | } |
4932 | - } elseif ($i == (sizeof($v_list)-1)) { |
|
4932 | + } elseif ($i == (sizeof($v_list) - 1)) { |
|
4933 | 4933 | // ----- Last '/' i.e. indicates a directory |
4934 | 4934 | $v_result = $v_list[$i]; |
4935 | 4935 | } else { |
@@ -4942,7 +4942,7 @@ discard block |
||
4942 | 4942 | if ($v_skip > 0) { |
4943 | 4943 | $v_skip--; |
4944 | 4944 | } else { |
4945 | - $v_result = $v_list[$i].($i!=(sizeof($v_list)-1)?"/".$v_result:""); |
|
4945 | + $v_result = $v_list[$i] . ($i != (sizeof($v_list) - 1) ? "/" . $v_result : ""); |
|
4946 | 4946 | } |
4947 | 4947 | } |
4948 | 4948 | } |
@@ -4950,7 +4950,7 @@ discard block |
||
4950 | 4950 | // ----- Look for skip |
4951 | 4951 | if ($v_skip > 0) { |
4952 | 4952 | while ($v_skip > 0) { |
4953 | - $v_result = '../'.$v_result; |
|
4953 | + $v_result = '../' . $v_result; |
|
4954 | 4954 | $v_skip--; |
4955 | 4955 | } |
4956 | 4956 | } |
@@ -4981,11 +4981,11 @@ discard block |
||
4981 | 4981 | $v_result = 1; |
4982 | 4982 | |
4983 | 4983 | // ----- Look for path beginning by ./ |
4984 | - if (($p_dir == '.') || ((strlen($p_dir) >=2) && (substr($p_dir, 0, 2) == './'))) { |
|
4985 | - $p_dir = PclZipUtilTranslateWinPath(getcwd(), false).'/'.substr($p_dir, 1); |
|
4984 | + if (($p_dir == '.') || ((strlen($p_dir) >= 2) && (substr($p_dir, 0, 2) == './'))) { |
|
4985 | + $p_dir = PclZipUtilTranslateWinPath(getcwd(), false) . '/' . substr($p_dir, 1); |
|
4986 | 4986 | } |
4987 | - if (($p_path == '.') || ((strlen($p_path) >=2) && (substr($p_path, 0, 2) == './'))) { |
|
4988 | - $p_path = PclZipUtilTranslateWinPath(getcwd(), false).'/'.substr($p_path, 1); |
|
4987 | + if (($p_path == '.') || ((strlen($p_path) >= 2) && (substr($p_path, 0, 2) == './'))) { |
|
4988 | + $p_path = PclZipUtilTranslateWinPath(getcwd(), false) . '/' . substr($p_path, 1); |
|
4989 | 4989 | } |
4990 | 4990 | |
4991 | 4991 | // ----- Explode dir and path by directory separator |
@@ -5057,28 +5057,28 @@ discard block |
||
5057 | 5057 | { |
5058 | 5058 | $v_result = 1; |
5059 | 5059 | |
5060 | - if ($p_mode==0) { |
|
5060 | + if ($p_mode == 0) { |
|
5061 | 5061 | while ($p_size != 0) { |
5062 | 5062 | $v_read_size = ($p_size < PCLZIP_READ_BLOCK_SIZE ? $p_size : PCLZIP_READ_BLOCK_SIZE); |
5063 | 5063 | $v_buffer = @fread($p_src, $v_read_size); |
5064 | 5064 | @fwrite($p_dest, $v_buffer, $v_read_size); |
5065 | 5065 | $p_size -= $v_read_size; |
5066 | 5066 | } |
5067 | - } elseif ($p_mode==1) { |
|
5067 | + } elseif ($p_mode == 1) { |
|
5068 | 5068 | while ($p_size != 0) { |
5069 | 5069 | $v_read_size = ($p_size < PCLZIP_READ_BLOCK_SIZE ? $p_size : PCLZIP_READ_BLOCK_SIZE); |
5070 | 5070 | $v_buffer = @gzread($p_src, $v_read_size); |
5071 | 5071 | @fwrite($p_dest, $v_buffer, $v_read_size); |
5072 | 5072 | $p_size -= $v_read_size; |
5073 | 5073 | } |
5074 | - } elseif ($p_mode==2) { |
|
5074 | + } elseif ($p_mode == 2) { |
|
5075 | 5075 | while ($p_size != 0) { |
5076 | 5076 | $v_read_size = ($p_size < PCLZIP_READ_BLOCK_SIZE ? $p_size : PCLZIP_READ_BLOCK_SIZE); |
5077 | 5077 | $v_buffer = @fread($p_src, $v_read_size); |
5078 | 5078 | @gzwrite($p_dest, $v_buffer, $v_read_size); |
5079 | 5079 | $p_size -= $v_read_size; |
5080 | 5080 | } |
5081 | - } elseif ($p_mode==3) { |
|
5081 | + } elseif ($p_mode == 3) { |
|
5082 | 5082 | while ($p_size != 0) { |
5083 | 5083 | $v_read_size = ($p_size < PCLZIP_READ_BLOCK_SIZE ? $p_size : PCLZIP_READ_BLOCK_SIZE); |
5084 | 5084 | $v_buffer = @gzread($p_src, $v_read_size); |
@@ -5164,7 +5164,7 @@ discard block |
||
5164 | 5164 | if (stristr(php_uname(), 'windows')) { |
5165 | 5165 | // ----- Look for potential disk letter |
5166 | 5166 | if (($p_remove_disk_letter) && (($v_position = strpos($p_path, ':')) != false)) { |
5167 | - $p_path = substr($p_path, $v_position+1); |
|
5167 | + $p_path = substr($p_path, $v_position + 1); |
|
5168 | 5168 | } |
5169 | 5169 | // ----- Change potential windows directory separator |
5170 | 5170 | if ((strpos($p_path, '\\') > 0) || (substr($p_path, 0, 1) == '\\')) { |
@@ -81,7 +81,7 @@ |
||
81 | 81 | /** |
82 | 82 | * Return the Timezone transition for the specified timezone and timestamp |
83 | 83 | * |
84 | - * @param DateTimeZone $objTimezone The timezone for finding the transitions |
|
84 | + * @param \DateTimeZone $objTimezone The timezone for finding the transitions |
|
85 | 85 | * @param integer $timestamp PHP date/time value for finding the current transition |
86 | 86 | * @return array The current transition details |
87 | 87 | */ |
@@ -35,7 +35,7 @@ |
||
35 | 35 | * @private |
36 | 36 | * @var string |
37 | 37 | */ |
38 | - protected static $timezone = 'UTC'; |
|
38 | + protected static $timezone = 'UTC'; |
|
39 | 39 | |
40 | 40 | /** |
41 | 41 | * Validate a Timezone name |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | * Return the Y-Value for a specified value of X |
123 | 123 | * |
124 | 124 | * @param float $xValue X-Value |
125 | - * @return float Y-Value |
|
125 | + * @return boolean Y-Value |
|
126 | 126 | */ |
127 | 127 | public function getValueOfYForX($xValue) |
128 | 128 | { |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | * Return the X-Value for a specified value of Y |
134 | 134 | * |
135 | 135 | * @param float $yValue Y-Value |
136 | - * @return float X-Value |
|
136 | + * @return boolean X-Value |
|
137 | 137 | */ |
138 | 138 | public function getValueOfXForY($yValue) |
139 | 139 | { |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | * Return the Equation of the best-fit line |
155 | 155 | * |
156 | 156 | * @param int $dp Number of places of decimal precision to display |
157 | - * @return string |
|
157 | + * @return boolean |
|
158 | 158 | */ |
159 | 159 | public function getEquation($dp = 0) |
160 | 160 | { |
@@ -306,6 +306,9 @@ discard block |
||
306 | 306 | return $this->yBestFitValues; |
307 | 307 | } |
308 | 308 | |
309 | + /** |
|
310 | + * @param double $sumY2 |
|
311 | + */ |
|
309 | 312 | protected function calculateGoodnessOfFit($sumX, $sumY, $sumX2, $sumY2, $sumXY, $meanX, $meanY, $const) |
310 | 313 | { |
311 | 314 | $SSres = $SScov = $SScor = $SStot = $SSsex = 0.0; |
@@ -360,6 +363,11 @@ discard block |
||
360 | 363 | } |
361 | 364 | } |
362 | 365 | |
366 | + /** |
|
367 | + * @param double[] $yValues |
|
368 | + * @param double[] $xValues |
|
369 | + * @param boolean $const |
|
370 | + */ |
|
363 | 371 | protected function leastSquareFit($yValues, $xValues, $const) |
364 | 372 | { |
365 | 373 | // calculate sums |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | * Return the Slope of the line |
78 | 78 | * |
79 | 79 | * @param int $dp Number of places of decimal precision to display |
80 | - * @return string |
|
80 | + * @return double |
|
81 | 81 | **/ |
82 | 82 | public function getSlope($dp = 0) |
83 | 83 | { |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | * Return the Value of X where it intersects Y = 0 |
92 | 92 | * |
93 | 93 | * @param int $dp Number of places of decimal precision to display |
94 | - * @return string |
|
94 | + * @return double |
|
95 | 95 | **/ |
96 | 96 | public function getIntersect($dp = 0) |
97 | 97 | { |
@@ -35,7 +35,7 @@ |
||
35 | 35 | * |
36 | 36 | * @var string |
37 | 37 | **/ |
38 | - protected $bestFitType = 'exponential'; |
|
38 | + protected $bestFitType = 'exponential'; |
|
39 | 39 | |
40 | 40 | /** |
41 | 41 | * Return the Y-Value for a specified value of X |
@@ -81,7 +81,7 @@ |
||
81 | 81 | * Return the Value of X where it intersects Y = 0 |
82 | 82 | * |
83 | 83 | * @param int $dp Number of places of decimal precision to display |
84 | - * @return string |
|
84 | + * @return double |
|
85 | 85 | **/ |
86 | 86 | public function getIntersect($dp = 0) |
87 | 87 | { |
@@ -35,7 +35,7 @@ |
||
35 | 35 | * |
36 | 36 | * @var string |
37 | 37 | **/ |
38 | - protected $bestFitType = 'power'; |
|
38 | + protected $bestFitType = 'power'; |
|
39 | 39 | |
40 | 40 | |
41 | 41 | /** |
@@ -109,7 +109,7 @@ |
||
109 | 109 | * Fallback method for writeRaw, introduced in PHP 5.2 |
110 | 110 | * |
111 | 111 | * @param string $text |
112 | - * @return string |
|
112 | + * @return boolean |
|
113 | 113 | */ |
114 | 114 | public function writeRawData($text) |
115 | 115 | { |
@@ -46,7 +46,7 @@ |
||
46 | 46 | * |
47 | 47 | * @var string |
48 | 48 | */ |
49 | - private $tempFileName = ''; |
|
49 | + private $tempFileName = ''; |
|
50 | 50 | |
51 | 51 | /** |
52 | 52 | * Create a new XMLWriter instance |