@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | * |
36 | 36 | * @var string |
37 | 37 | **/ |
38 | - protected $bestFitType = 'logarithmic'; |
|
38 | + protected $bestFitType = 'logarithmic'; |
|
39 | 39 | |
40 | 40 | /** |
41 | 41 | * Return the Y-Value for a specified value of X |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | $slope = $this->getSlope($dp); |
71 | 71 | $intersect = $this->getIntersect($dp); |
72 | 72 | |
73 | - return 'Y = '.$intersect.' + '.$slope.' * log(X)'; |
|
73 | + return 'Y = ' . $intersect . ' + ' . $slope . ' * log(X)'; |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | /** |
@@ -35,7 +35,7 @@ |
||
35 | 35 | * |
36 | 36 | * @var string |
37 | 37 | **/ |
38 | - protected $bestFitType = 'linear'; |
|
38 | + protected $bestFitType = 'linear'; |
|
39 | 39 | |
40 | 40 | /** |
41 | 41 | * Return the Y-Value for a specified value of X |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | $A[$i][$j] = pow($xValues[$i], $j); |
170 | 170 | } |
171 | 171 | } |
172 | - for ($i=0; $i < $this->valueCount; ++$i) { |
|
172 | + for ($i = 0; $i < $this->valueCount; ++$i) { |
|
173 | 173 | $B[$i] = array($yValues[$i]); |
174 | 174 | } |
175 | 175 | $matrixA = new Matrix($A); |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | { |
208 | 208 | if (parent::__construct($yValues, $xValues) !== false) { |
209 | 209 | if ($order < $this->valueCount) { |
210 | - $this->bestFitType .= '_'.$order; |
|
210 | + $this->bestFitType .= '_' . $order; |
|
211 | 211 | $this->order = $order; |
212 | 212 | $this->polynomialRegression($order, $yValues, $xValues, $const); |
213 | 213 | if (($this->getGoodnessOfFit() < 0.0) || ($this->getGoodnessOfFit() > 1.0)) { |
@@ -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 |
@@ -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,14 +42,14 @@ |
||
42 | 42 | public static function hashPassword($pPassword = '') |
43 | 43 | { |
44 | 44 | $password = 0x0000; |
45 | - $charPos = 1; // char position |
|
45 | + $charPos = 1; // char position |
|
46 | 46 | |
47 | 47 | // split the plain text password in its component characters |
48 | 48 | $chars = preg_split('//', $pPassword, -1, PREG_SPLIT_NO_EMPTY); |
49 | 49 | foreach ($chars as $char) { |
50 | - $value = ord($char) << $charPos++; // shifted ASCII value |
|
51 | - $rotated_bits = $value >> 15; // rotated bits beyond bit 15 |
|
52 | - $value &= 0x7fff; // first 15 bits |
|
50 | + $value = ord($char) << $charPos++; // shifted ASCII value |
|
51 | + $rotated_bits = $value >> 15; // rotated bits beyond bit 15 |
|
52 | + $value &= 0x7fff; // first 15 bits |
|
53 | 53 | $password ^= ($value | $rotated_bits); |
54 | 54 | } |
55 | 55 |
@@ -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) == '\\')) { |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | /** Constants */ |
33 | 33 | /** Regular Expressions */ |
34 | 34 | // Fraction |
35 | - const STRING_REGEXP_FRACTION = '(-?)(\d+)\s+(\d+\/\d+)'; |
|
35 | + const STRING_REGEXP_FRACTION = '(-?)(\d+)\s+(\d+\/\d+)'; |
|
36 | 36 | |
37 | 37 | |
38 | 38 | /** |
@@ -535,12 +535,12 @@ discard block |
||
535 | 535 | } |
536 | 536 | $len = strlen($str); |
537 | 537 | $newstr = ''; |
538 | - for ($i=0; $i<$len; $i+=2) { |
|
538 | + for ($i = 0; $i < $len; $i += 2) { |
|
539 | 539 | if ($bom_be) { |
540 | - $val = ord($str{$i}) << 4; |
|
541 | - $val += ord($str{$i+1}); |
|
540 | + $val = ord($str{$i}) << 4; |
|
541 | + $val += ord($str{$i + 1}); |
|
542 | 542 | } else { |
543 | - $val = ord($str{$i+1}) << 4; |
|
543 | + $val = ord($str{$i + 1}) << 4; |
|
544 | 544 | $val += ord($str{$i}); |
545 | 545 | } |
546 | 546 | $newstr .= ($val == 0x228) ? "\n" : chr($val); |
@@ -678,9 +678,9 @@ discard block |
||
678 | 678 | */ |
679 | 679 | public static function convertToNumberIfFraction(&$operand) |
680 | 680 | { |
681 | - if (preg_match('/^'.self::STRING_REGEXP_FRACTION.'$/i', $operand, $match)) { |
|
681 | + if (preg_match('/^' . self::STRING_REGEXP_FRACTION . '$/i', $operand, $match)) { |
|
682 | 682 | $sign = ($match[1] == '-') ? '-' : '+'; |
683 | - $fractionFormula = '='.$sign.$match[2].$sign.$match[3]; |
|
683 | + $fractionFormula = '=' . $sign . $match[2] . $sign . $match[3]; |
|
684 | 684 | $operand = \PHPExcel\Calculation::getInstance()->_calculateFormulaValue($fractionFormula); |
685 | 685 | return true; |
686 | 686 | } |
@@ -458,22 +458,22 @@ |
||
458 | 458 | // Sort array |
459 | 459 | $images = array(); |
460 | 460 | if (isset($this->headerFooterImages[self::IMAGE_HEADER_LEFT])) { |
461 | - $images[self::IMAGE_HEADER_LEFT] = $this->headerFooterImages[self::IMAGE_HEADER_LEFT]; |
|
461 | + $images[self::IMAGE_HEADER_LEFT] = $this->headerFooterImages[self::IMAGE_HEADER_LEFT]; |
|
462 | 462 | } |
463 | 463 | if (isset($this->headerFooterImages[self::IMAGE_HEADER_CENTER])) { |
464 | - $images[self::IMAGE_HEADER_CENTER] = $this->headerFooterImages[self::IMAGE_HEADER_CENTER]; |
|
464 | + $images[self::IMAGE_HEADER_CENTER] = $this->headerFooterImages[self::IMAGE_HEADER_CENTER]; |
|
465 | 465 | } |
466 | 466 | if (isset($this->headerFooterImages[self::IMAGE_HEADER_RIGHT])) { |
467 | - $images[self::IMAGE_HEADER_RIGHT] = $this->headerFooterImages[self::IMAGE_HEADER_RIGHT]; |
|
467 | + $images[self::IMAGE_HEADER_RIGHT] = $this->headerFooterImages[self::IMAGE_HEADER_RIGHT]; |
|
468 | 468 | } |
469 | 469 | if (isset($this->headerFooterImages[self::IMAGE_FOOTER_LEFT])) { |
470 | - $images[self::IMAGE_FOOTER_LEFT] = $this->headerFooterImages[self::IMAGE_FOOTER_LEFT]; |
|
470 | + $images[self::IMAGE_FOOTER_LEFT] = $this->headerFooterImages[self::IMAGE_FOOTER_LEFT]; |
|
471 | 471 | } |
472 | 472 | if (isset($this->headerFooterImages[self::IMAGE_FOOTER_CENTER])) { |
473 | - $images[self::IMAGE_FOOTER_CENTER] = $this->headerFooterImages[self::IMAGE_FOOTER_CENTER]; |
|
473 | + $images[self::IMAGE_FOOTER_CENTER] = $this->headerFooterImages[self::IMAGE_FOOTER_CENTER]; |
|
474 | 474 | } |
475 | 475 | if (isset($this->headerFooterImages[self::IMAGE_FOOTER_RIGHT])) { |
476 | - $images[self::IMAGE_FOOTER_RIGHT] = $this->headerFooterImages[self::IMAGE_FOOTER_RIGHT]; |
|
476 | + $images[self::IMAGE_FOOTER_RIGHT] = $this->headerFooterImages[self::IMAGE_FOOTER_RIGHT]; |
|
477 | 477 | } |
478 | 478 | $this->headerFooterImages = $images; |
479 | 479 |