Completed
Pull Request — master (#54)
by Reginaldo
41:52
created
app/Vendor/PHPExcel/PHPExcel/Shared/PCLZip/pclzip.lib.php 4 patches
Doc Comments   +26 added lines patch added patch discarded remove patch
@@ -212,6 +212,10 @@  discard block
 block discarded – undo
212 212
   //   Note that no real action is taken, if the archive does not exist it is not
213 213
   //   created. Use create() for that.
214 214
   // --------------------------------------------------------------------------------
215
+
216
+  /**
217
+   * @param string $p_zipname
218
+   */
215 219
   function PclZip($p_zipname)
216 220
   {
217 221
 
@@ -2335,6 +2339,10 @@  discard block
 block discarded – undo
2335 2339
   // Description :
2336 2340
   // Parameters :
2337 2341
   // --------------------------------------------------------------------------------
2342
+
2343
+  /**
2344
+   * @param string $p_mode
2345
+   */
2338 2346
   function privOpenFd($p_mode)
2339 2347
   {
2340 2348
     $v_result=1;
@@ -4151,6 +4159,10 @@  discard block
 block discarded – undo
4151 4159
   // Parameters :
4152 4160
   // Return Values :
4153 4161
   // --------------------------------------------------------------------------------
4162
+
4163
+  /**
4164
+   * @param string $p_string
4165
+   */
4154 4166
   function privExtractFileAsString(&$p_entry, &$p_string, &$p_options)
4155 4167
   {
4156 4168
     $v_result=1;
@@ -5044,6 +5056,10 @@  discard block
 block discarded – undo
5044 5056
   // Parameters :
5045 5057
   // Return Values :
5046 5058
   // --------------------------------------------------------------------------------
5059
+
5060
+  /**
5061
+   * @param PclZip $p_archive_to_add
5062
+   */
5047 5063
   function privMerge(&$p_archive_to_add)
5048 5064
   {
5049 5065
     $v_result=1;
@@ -5551,6 +5567,11 @@  discard block
 block discarded – undo
5551 5567
   //             3 : src & dest gzip
5552 5568
   // Return Values :
5553 5569
   // --------------------------------------------------------------------------------
5570
+
5571
+  /**
5572
+   * @param integer $p_src
5573
+   * @param integer $p_dest
5574
+   */
5554 5575
   function PclZipUtilCopyBlock($p_src, $p_dest, $p_size, $p_mode=0)
5555 5576
   {
5556 5577
     $v_result = 1;
@@ -5613,6 +5634,11 @@  discard block
 block discarded – undo
5613 5634
   // Return Values :
5614 5635
   //   1 on success, 0 on failure.
5615 5636
   // --------------------------------------------------------------------------------
5637
+
5638
+  /**
5639
+   * @param string $p_src
5640
+   * @param string $p_dest
5641
+   */
5616 5642
   function PclZipUtilRename($p_src, $p_dest)
5617 5643
   {
5618 5644
     $v_result = 1;
Please login to merge, or discard this patch.
Indentation   +3756 added lines, -3756 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 
28 28
   // ----- Constants
29 29
   if (!defined('PCLZIP_READ_BLOCK_SIZE')) {
30
-    define( 'PCLZIP_READ_BLOCK_SIZE', 2048 );
30
+	define( 'PCLZIP_READ_BLOCK_SIZE', 2048 );
31 31
   }
32 32
   
33 33
   // ----- File list separator
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
   //define( 'PCLZIP_SEPARATOR', ' ' );
42 42
   // Recommanded values for smart separation of filenames.
43 43
   if (!defined('PCLZIP_SEPARATOR')) {
44
-    define( 'PCLZIP_SEPARATOR', ',' );
44
+	define( 'PCLZIP_SEPARATOR', ',' );
45 45
   }
46 46
 
47 47
   // ----- Error configuration
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
   //     you must ensure that you have included PclError library.
51 51
   // [2,...] : reserved for futur use
52 52
   if (!defined('PCLZIP_ERROR_EXTERNAL')) {
53
-    define( 'PCLZIP_ERROR_EXTERNAL', 0 );
53
+	define( 'PCLZIP_ERROR_EXTERNAL', 0 );
54 54
   }
55 55
 
56 56
   // ----- Optional static temporary directory
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
   // define( 'PCLZIP_TEMPORARY_DIR', '/temp/' );
64 64
   // define( 'PCLZIP_TEMPORARY_DIR', 'C:/Temp/' );
65 65
   if (!defined('PCLZIP_TEMPORARY_DIR')) {
66
-    define( 'PCLZIP_TEMPORARY_DIR', '' );
66
+	define( 'PCLZIP_TEMPORARY_DIR', '' );
67 67
   }
68 68
 
69 69
   // ----- Optional threshold ratio for use of temporary files
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
   //       Samples :
76 76
   // define( 'PCLZIP_TEMPORARY_FILE_RATIO', 0.5 );
77 77
   if (!defined('PCLZIP_TEMPORARY_FILE_RATIO')) {
78
-    define( 'PCLZIP_TEMPORARY_FILE_RATIO', 0.47 );
78
+	define( 'PCLZIP_TEMPORARY_FILE_RATIO', 0.47 );
79 79
   }
80 80
 
81 81
 // --------------------------------------------------------------------------------
@@ -189,20 +189,20 @@  discard block
 block discarded – undo
189 189
   // --------------------------------------------------------------------------------
190 190
   class PclZip
191 191
   {
192
-    // ----- Filename of the zip file
193
-    var $zipname = '';
192
+	// ----- Filename of the zip file
193
+	var $zipname = '';
194 194
 
195
-    // ----- File descriptor of the zip file
196
-    var $zip_fd = 0;
195
+	// ----- File descriptor of the zip file
196
+	var $zip_fd = 0;
197 197
 
198
-    // ----- Internal error handling
199
-    var $error_code = 1;
200
-    var $error_string = '';
198
+	// ----- Internal error handling
199
+	var $error_code = 1;
200
+	var $error_string = '';
201 201
     
202
-    // ----- Current status of the magic_quotes_runtime
203
-    // This value store the php configuration for magic_quotes
204
-    // The class can then disable the magic_quotes and reset it after
205
-    var $magic_quotes_status;
202
+	// ----- Current status of the magic_quotes_runtime
203
+	// This value store the php configuration for magic_quotes
204
+	// The class can then disable the magic_quotes and reset it after
205
+	var $magic_quotes_status;
206 206
 
207 207
   // --------------------------------------------------------------------------------
208 208
   // Function : PclZip()
@@ -215,19 +215,19 @@  discard block
 block discarded – undo
215 215
   function PclZip($p_zipname)
216 216
   {
217 217
 
218
-    // ----- Tests the zlib
219
-    if (!function_exists('gzopen'))
220
-    {
221
-      die('Abort '.basename(__FILE__).' : Missing zlib extensions');
222
-    }
218
+	// ----- Tests the zlib
219
+	if (!function_exists('gzopen'))
220
+	{
221
+	  die('Abort '.basename(__FILE__).' : Missing zlib extensions');
222
+	}
223 223
 
224
-    // ----- Set the attributes
225
-    $this->zipname = $p_zipname;
226
-    $this->zip_fd = 0;
227
-    $this->magic_quotes_status = -1;
224
+	// ----- Set the attributes
225
+	$this->zipname = $p_zipname;
226
+	$this->zip_fd = 0;
227
+	$this->magic_quotes_status = -1;
228 228
 
229
-    // ----- Return
230
-    return;
229
+	// ----- Return
230
+	return;
231 231
   }
232 232
   // --------------------------------------------------------------------------------
233 233
 
@@ -270,149 +270,149 @@  discard block
 block discarded – undo
270 270
   // --------------------------------------------------------------------------------
271 271
   function create($p_filelist)
272 272
   {
273
-    $v_result=1;
274
-
275
-    // ----- Reset the error handler
276
-    $this->privErrorReset();
277
-
278
-    // ----- Set default values
279
-    $v_options = array();
280
-    $v_options[PCLZIP_OPT_NO_COMPRESSION] = FALSE;
281
-
282
-    // ----- Look for variable options arguments
283
-    $v_size = func_num_args();
284
-
285
-    // ----- Look for arguments
286
-    if ($v_size > 1) {
287
-      // ----- Get the arguments
288
-      $v_arg_list = func_get_args();
289
-
290
-      // ----- Remove from the options list the first argument
291
-      array_shift($v_arg_list);
292
-      $v_size--;
293
-
294
-      // ----- Look for first arg
295
-      if ((is_integer($v_arg_list[0])) && ($v_arg_list[0] > 77000)) {
296
-
297
-        // ----- Parse the options
298
-        $v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options,
299
-                                            array (PCLZIP_OPT_REMOVE_PATH => 'optional',
300
-                                                   PCLZIP_OPT_REMOVE_ALL_PATH => 'optional',
301
-                                                   PCLZIP_OPT_ADD_PATH => 'optional',
302
-                                                   PCLZIP_CB_PRE_ADD => 'optional',
303
-                                                   PCLZIP_CB_POST_ADD => 'optional',
304
-                                                   PCLZIP_OPT_NO_COMPRESSION => 'optional',
305
-                                                   PCLZIP_OPT_COMMENT => 'optional',
306
-                                                   PCLZIP_OPT_TEMP_FILE_THRESHOLD => 'optional',
307
-                                                   PCLZIP_OPT_TEMP_FILE_ON => 'optional',
308
-                                                   PCLZIP_OPT_TEMP_FILE_OFF => 'optional'
309
-                                                   //, PCLZIP_OPT_CRYPT => 'optional'
310
-                                             ));
311
-        if ($v_result != 1) {
312
-          return 0;
313
-        }
314
-      }
273
+	$v_result=1;
274
+
275
+	// ----- Reset the error handler
276
+	$this->privErrorReset();
277
+
278
+	// ----- Set default values
279
+	$v_options = array();
280
+	$v_options[PCLZIP_OPT_NO_COMPRESSION] = FALSE;
281
+
282
+	// ----- Look for variable options arguments
283
+	$v_size = func_num_args();
284
+
285
+	// ----- Look for arguments
286
+	if ($v_size > 1) {
287
+	  // ----- Get the arguments
288
+	  $v_arg_list = func_get_args();
289
+
290
+	  // ----- Remove from the options list the first argument
291
+	  array_shift($v_arg_list);
292
+	  $v_size--;
293
+
294
+	  // ----- Look for first arg
295
+	  if ((is_integer($v_arg_list[0])) && ($v_arg_list[0] > 77000)) {
296
+
297
+		// ----- Parse the options
298
+		$v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options,
299
+											array (PCLZIP_OPT_REMOVE_PATH => 'optional',
300
+												   PCLZIP_OPT_REMOVE_ALL_PATH => 'optional',
301
+												   PCLZIP_OPT_ADD_PATH => 'optional',
302
+												   PCLZIP_CB_PRE_ADD => 'optional',
303
+												   PCLZIP_CB_POST_ADD => 'optional',
304
+												   PCLZIP_OPT_NO_COMPRESSION => 'optional',
305
+												   PCLZIP_OPT_COMMENT => 'optional',
306
+												   PCLZIP_OPT_TEMP_FILE_THRESHOLD => 'optional',
307
+												   PCLZIP_OPT_TEMP_FILE_ON => 'optional',
308
+												   PCLZIP_OPT_TEMP_FILE_OFF => 'optional'
309
+												   //, PCLZIP_OPT_CRYPT => 'optional'
310
+											 ));
311
+		if ($v_result != 1) {
312
+		  return 0;
313
+		}
314
+	  }
315 315
 
316
-      // ----- Look for 2 args
317
-      // Here we need to support the first historic synopsis of the
318
-      // method.
319
-      else {
320
-
321
-        // ----- Get the first argument
322
-        $v_options[PCLZIP_OPT_ADD_PATH] = $v_arg_list[0];
323
-
324
-        // ----- Look for the optional second argument
325
-        if ($v_size == 2) {
326
-          $v_options[PCLZIP_OPT_REMOVE_PATH] = $v_arg_list[1];
327
-        }
328
-        else if ($v_size > 2) {
329
-          PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER,
330
-		                       "Invalid number / type of arguments");
331
-          return 0;
332
-        }
333
-      }
334
-    }
316
+	  // ----- Look for 2 args
317
+	  // Here we need to support the first historic synopsis of the
318
+	  // method.
319
+	  else {
320
+
321
+		// ----- Get the first argument
322
+		$v_options[PCLZIP_OPT_ADD_PATH] = $v_arg_list[0];
323
+
324
+		// ----- Look for the optional second argument
325
+		if ($v_size == 2) {
326
+		  $v_options[PCLZIP_OPT_REMOVE_PATH] = $v_arg_list[1];
327
+		}
328
+		else if ($v_size > 2) {
329
+		  PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER,
330
+							   "Invalid number / type of arguments");
331
+		  return 0;
332
+		}
333
+	  }
334
+	}
335 335
     
336
-    // ----- Look for default option values
337
-    $this->privOptionDefaultThreshold($v_options);
338
-
339
-    // ----- Init
340
-    $v_string_list = array();
341
-    $v_att_list = array();
342
-    $v_filedescr_list = array();
343
-    $p_result_list = array();
336
+	// ----- Look for default option values
337
+	$this->privOptionDefaultThreshold($v_options);
338
+
339
+	// ----- Init
340
+	$v_string_list = array();
341
+	$v_att_list = array();
342
+	$v_filedescr_list = array();
343
+	$p_result_list = array();
344 344
     
345
-    // ----- Look if the $p_filelist is really an array
346
-    if (is_array($p_filelist)) {
345
+	// ----- Look if the $p_filelist is really an array
346
+	if (is_array($p_filelist)) {
347 347
     
348
-      // ----- Look if the first element is also an array
349
-      //       This will mean that this is a file description entry
350
-      if (isset($p_filelist[0]) && is_array($p_filelist[0])) {
351
-        $v_att_list = $p_filelist;
352
-      }
348
+	  // ----- Look if the first element is also an array
349
+	  //       This will mean that this is a file description entry
350
+	  if (isset($p_filelist[0]) && is_array($p_filelist[0])) {
351
+		$v_att_list = $p_filelist;
352
+	  }
353 353
       
354
-      // ----- The list is a list of string names
355
-      else {
356
-        $v_string_list = $p_filelist;
357
-      }
358
-    }
354
+	  // ----- The list is a list of string names
355
+	  else {
356
+		$v_string_list = $p_filelist;
357
+	  }
358
+	}
359 359
 
360
-    // ----- Look if the $p_filelist is a string
361
-    else if (is_string($p_filelist)) {
362
-      // ----- Create a list from the string
363
-      $v_string_list = explode(PCLZIP_SEPARATOR, $p_filelist);
364
-    }
360
+	// ----- Look if the $p_filelist is a string
361
+	else if (is_string($p_filelist)) {
362
+	  // ----- Create a list from the string
363
+	  $v_string_list = explode(PCLZIP_SEPARATOR, $p_filelist);
364
+	}
365 365
 
366
-    // ----- Invalid variable type for $p_filelist
367
-    else {
368
-      PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid variable type p_filelist");
369
-      return 0;
370
-    }
366
+	// ----- Invalid variable type for $p_filelist
367
+	else {
368
+	  PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid variable type p_filelist");
369
+	  return 0;
370
+	}
371 371
     
372
-    // ----- Reformat the string list
373
-    if (sizeof($v_string_list) != 0) {
374
-      foreach ($v_string_list as $v_string) {
375
-        if ($v_string != '') {
376
-          $v_att_list[][PCLZIP_ATT_FILE_NAME] = $v_string;
377
-        }
378
-        else {
379
-        }
380
-      }
381
-    }
372
+	// ----- Reformat the string list
373
+	if (sizeof($v_string_list) != 0) {
374
+	  foreach ($v_string_list as $v_string) {
375
+		if ($v_string != '') {
376
+		  $v_att_list[][PCLZIP_ATT_FILE_NAME] = $v_string;
377
+		}
378
+		else {
379
+		}
380
+	  }
381
+	}
382 382
     
383
-    // ----- For each file in the list check the attributes
384
-    $v_supported_attributes
385
-    = array ( PCLZIP_ATT_FILE_NAME => 'mandatory'
386
-             ,PCLZIP_ATT_FILE_NEW_SHORT_NAME => 'optional'
387
-             ,PCLZIP_ATT_FILE_NEW_FULL_NAME => 'optional'
388
-             ,PCLZIP_ATT_FILE_MTIME => 'optional'
389
-             ,PCLZIP_ATT_FILE_CONTENT => 'optional'
390
-             ,PCLZIP_ATT_FILE_COMMENT => 'optional'
383
+	// ----- For each file in the list check the attributes
384
+	$v_supported_attributes
385
+	= array ( PCLZIP_ATT_FILE_NAME => 'mandatory'
386
+			 ,PCLZIP_ATT_FILE_NEW_SHORT_NAME => 'optional'
387
+			 ,PCLZIP_ATT_FILE_NEW_FULL_NAME => 'optional'
388
+			 ,PCLZIP_ATT_FILE_MTIME => 'optional'
389
+			 ,PCLZIP_ATT_FILE_CONTENT => 'optional'
390
+			 ,PCLZIP_ATT_FILE_COMMENT => 'optional'
391 391
 						);
392
-    foreach ($v_att_list as $v_entry) {
393
-      $v_result = $this->privFileDescrParseAtt($v_entry,
394
-                                               $v_filedescr_list[],
395
-                                               $v_options,
396
-                                               $v_supported_attributes);
397
-      if ($v_result != 1) {
398
-        return 0;
399
-      }
400
-    }
392
+	foreach ($v_att_list as $v_entry) {
393
+	  $v_result = $this->privFileDescrParseAtt($v_entry,
394
+											   $v_filedescr_list[],
395
+											   $v_options,
396
+											   $v_supported_attributes);
397
+	  if ($v_result != 1) {
398
+		return 0;
399
+	  }
400
+	}
401 401
 
402
-    // ----- Expand the filelist (expand directories)
403
-    $v_result = $this->privFileDescrExpand($v_filedescr_list, $v_options);
404
-    if ($v_result != 1) {
405
-      return 0;
406
-    }
402
+	// ----- Expand the filelist (expand directories)
403
+	$v_result = $this->privFileDescrExpand($v_filedescr_list, $v_options);
404
+	if ($v_result != 1) {
405
+	  return 0;
406
+	}
407 407
 
408
-    // ----- Call the create fct
409
-    $v_result = $this->privCreate($v_filedescr_list, $p_result_list, $v_options);
410
-    if ($v_result != 1) {
411
-      return 0;
412
-    }
408
+	// ----- Call the create fct
409
+	$v_result = $this->privCreate($v_filedescr_list, $p_result_list, $v_options);
410
+	if ($v_result != 1) {
411
+	  return 0;
412
+	}
413 413
 
414
-    // ----- Return
415
-    return $p_result_list;
414
+	// ----- Return
415
+	return $p_result_list;
416 416
   }
417 417
   // --------------------------------------------------------------------------------
418 418
 
@@ -453,149 +453,149 @@  discard block
 block discarded – undo
453 453
   // --------------------------------------------------------------------------------
454 454
   function add($p_filelist)
455 455
   {
456
-    $v_result=1;
457
-
458
-    // ----- Reset the error handler
459
-    $this->privErrorReset();
460
-
461
-    // ----- Set default values
462
-    $v_options = array();
463
-    $v_options[PCLZIP_OPT_NO_COMPRESSION] = FALSE;
464
-
465
-    // ----- Look for variable options arguments
466
-    $v_size = func_num_args();
467
-
468
-    // ----- Look for arguments
469
-    if ($v_size > 1) {
470
-      // ----- Get the arguments
471
-      $v_arg_list = func_get_args();
472
-
473
-      // ----- Remove form the options list the first argument
474
-      array_shift($v_arg_list);
475
-      $v_size--;
476
-
477
-      // ----- Look for first arg
478
-      if ((is_integer($v_arg_list[0])) && ($v_arg_list[0] > 77000)) {
479
-
480
-        // ----- Parse the options
481
-        $v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options,
482
-                                            array (PCLZIP_OPT_REMOVE_PATH => 'optional',
483
-                                                   PCLZIP_OPT_REMOVE_ALL_PATH => 'optional',
484
-                                                   PCLZIP_OPT_ADD_PATH => 'optional',
485
-                                                   PCLZIP_CB_PRE_ADD => 'optional',
486
-                                                   PCLZIP_CB_POST_ADD => 'optional',
487
-                                                   PCLZIP_OPT_NO_COMPRESSION => 'optional',
488
-                                                   PCLZIP_OPT_COMMENT => 'optional',
489
-                                                   PCLZIP_OPT_ADD_COMMENT => 'optional',
490
-                                                   PCLZIP_OPT_PREPEND_COMMENT => 'optional',
491
-                                                   PCLZIP_OPT_TEMP_FILE_THRESHOLD => 'optional',
492
-                                                   PCLZIP_OPT_TEMP_FILE_ON => 'optional',
493
-                                                   PCLZIP_OPT_TEMP_FILE_OFF => 'optional'
494
-                                                   //, PCLZIP_OPT_CRYPT => 'optional'
456
+	$v_result=1;
457
+
458
+	// ----- Reset the error handler
459
+	$this->privErrorReset();
460
+
461
+	// ----- Set default values
462
+	$v_options = array();
463
+	$v_options[PCLZIP_OPT_NO_COMPRESSION] = FALSE;
464
+
465
+	// ----- Look for variable options arguments
466
+	$v_size = func_num_args();
467
+
468
+	// ----- Look for arguments
469
+	if ($v_size > 1) {
470
+	  // ----- Get the arguments
471
+	  $v_arg_list = func_get_args();
472
+
473
+	  // ----- Remove form the options list the first argument
474
+	  array_shift($v_arg_list);
475
+	  $v_size--;
476
+
477
+	  // ----- Look for first arg
478
+	  if ((is_integer($v_arg_list[0])) && ($v_arg_list[0] > 77000)) {
479
+
480
+		// ----- Parse the options
481
+		$v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options,
482
+											array (PCLZIP_OPT_REMOVE_PATH => 'optional',
483
+												   PCLZIP_OPT_REMOVE_ALL_PATH => 'optional',
484
+												   PCLZIP_OPT_ADD_PATH => 'optional',
485
+												   PCLZIP_CB_PRE_ADD => 'optional',
486
+												   PCLZIP_CB_POST_ADD => 'optional',
487
+												   PCLZIP_OPT_NO_COMPRESSION => 'optional',
488
+												   PCLZIP_OPT_COMMENT => 'optional',
489
+												   PCLZIP_OPT_ADD_COMMENT => 'optional',
490
+												   PCLZIP_OPT_PREPEND_COMMENT => 'optional',
491
+												   PCLZIP_OPT_TEMP_FILE_THRESHOLD => 'optional',
492
+												   PCLZIP_OPT_TEMP_FILE_ON => 'optional',
493
+												   PCLZIP_OPT_TEMP_FILE_OFF => 'optional'
494
+												   //, PCLZIP_OPT_CRYPT => 'optional'
495 495
 												   ));
496
-        if ($v_result != 1) {
497
-          return 0;
498
-        }
499
-      }
496
+		if ($v_result != 1) {
497
+		  return 0;
498
+		}
499
+	  }
500 500
 
501
-      // ----- Look for 2 args
502
-      // Here we need to support the first historic synopsis of the
503
-      // method.
504
-      else {
505
-
506
-        // ----- Get the first argument
507
-        $v_options[PCLZIP_OPT_ADD_PATH] = $v_add_path = $v_arg_list[0];
508
-
509
-        // ----- Look for the optional second argument
510
-        if ($v_size == 2) {
511
-          $v_options[PCLZIP_OPT_REMOVE_PATH] = $v_arg_list[1];
512
-        }
513
-        else if ($v_size > 2) {
514
-          // ----- Error log
515
-          PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid number / type of arguments");
516
-
517
-          // ----- Return
518
-          return 0;
519
-        }
520
-      }
521
-    }
501
+	  // ----- Look for 2 args
502
+	  // Here we need to support the first historic synopsis of the
503
+	  // method.
504
+	  else {
505
+
506
+		// ----- Get the first argument
507
+		$v_options[PCLZIP_OPT_ADD_PATH] = $v_add_path = $v_arg_list[0];
508
+
509
+		// ----- Look for the optional second argument
510
+		if ($v_size == 2) {
511
+		  $v_options[PCLZIP_OPT_REMOVE_PATH] = $v_arg_list[1];
512
+		}
513
+		else if ($v_size > 2) {
514
+		  // ----- Error log
515
+		  PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid number / type of arguments");
516
+
517
+		  // ----- Return
518
+		  return 0;
519
+		}
520
+	  }
521
+	}
522 522
 
523
-    // ----- Look for default option values
524
-    $this->privOptionDefaultThreshold($v_options);
523
+	// ----- Look for default option values
524
+	$this->privOptionDefaultThreshold($v_options);
525 525
 
526
-    // ----- Init
527
-    $v_string_list = array();
528
-    $v_att_list = array();
529
-    $v_filedescr_list = array();
530
-    $p_result_list = array();
526
+	// ----- Init
527
+	$v_string_list = array();
528
+	$v_att_list = array();
529
+	$v_filedescr_list = array();
530
+	$p_result_list = array();
531 531
     
532
-    // ----- Look if the $p_filelist is really an array
533
-    if (is_array($p_filelist)) {
532
+	// ----- Look if the $p_filelist is really an array
533
+	if (is_array($p_filelist)) {
534 534
     
535
-      // ----- Look if the first element is also an array
536
-      //       This will mean that this is a file description entry
537
-      if (isset($p_filelist[0]) && is_array($p_filelist[0])) {
538
-        $v_att_list = $p_filelist;
539
-      }
535
+	  // ----- Look if the first element is also an array
536
+	  //       This will mean that this is a file description entry
537
+	  if (isset($p_filelist[0]) && is_array($p_filelist[0])) {
538
+		$v_att_list = $p_filelist;
539
+	  }
540 540
       
541
-      // ----- The list is a list of string names
542
-      else {
543
-        $v_string_list = $p_filelist;
544
-      }
545
-    }
541
+	  // ----- The list is a list of string names
542
+	  else {
543
+		$v_string_list = $p_filelist;
544
+	  }
545
+	}
546 546
 
547
-    // ----- Look if the $p_filelist is a string
548
-    else if (is_string($p_filelist)) {
549
-      // ----- Create a list from the string
550
-      $v_string_list = explode(PCLZIP_SEPARATOR, $p_filelist);
551
-    }
547
+	// ----- Look if the $p_filelist is a string
548
+	else if (is_string($p_filelist)) {
549
+	  // ----- Create a list from the string
550
+	  $v_string_list = explode(PCLZIP_SEPARATOR, $p_filelist);
551
+	}
552 552
 
553
-    // ----- Invalid variable type for $p_filelist
554
-    else {
555
-      PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid variable type '".gettype($p_filelist)."' for p_filelist");
556
-      return 0;
557
-    }
553
+	// ----- Invalid variable type for $p_filelist
554
+	else {
555
+	  PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid variable type '".gettype($p_filelist)."' for p_filelist");
556
+	  return 0;
557
+	}
558 558
     
559
-    // ----- Reformat the string list
560
-    if (sizeof($v_string_list) != 0) {
561
-      foreach ($v_string_list as $v_string) {
562
-        $v_att_list[][PCLZIP_ATT_FILE_NAME] = $v_string;
563
-      }
564
-    }
559
+	// ----- Reformat the string list
560
+	if (sizeof($v_string_list) != 0) {
561
+	  foreach ($v_string_list as $v_string) {
562
+		$v_att_list[][PCLZIP_ATT_FILE_NAME] = $v_string;
563
+	  }
564
+	}
565 565
     
566
-    // ----- For each file in the list check the attributes
567
-    $v_supported_attributes
568
-    = array ( PCLZIP_ATT_FILE_NAME => 'mandatory'
569
-             ,PCLZIP_ATT_FILE_NEW_SHORT_NAME => 'optional'
570
-             ,PCLZIP_ATT_FILE_NEW_FULL_NAME => 'optional'
571
-             ,PCLZIP_ATT_FILE_MTIME => 'optional'
572
-             ,PCLZIP_ATT_FILE_CONTENT => 'optional'
573
-             ,PCLZIP_ATT_FILE_COMMENT => 'optional'
566
+	// ----- For each file in the list check the attributes
567
+	$v_supported_attributes
568
+	= array ( PCLZIP_ATT_FILE_NAME => 'mandatory'
569
+			 ,PCLZIP_ATT_FILE_NEW_SHORT_NAME => 'optional'
570
+			 ,PCLZIP_ATT_FILE_NEW_FULL_NAME => 'optional'
571
+			 ,PCLZIP_ATT_FILE_MTIME => 'optional'
572
+			 ,PCLZIP_ATT_FILE_CONTENT => 'optional'
573
+			 ,PCLZIP_ATT_FILE_COMMENT => 'optional'
574 574
 						);
575
-    foreach ($v_att_list as $v_entry) {
576
-      $v_result = $this->privFileDescrParseAtt($v_entry,
577
-                                               $v_filedescr_list[],
578
-                                               $v_options,
579
-                                               $v_supported_attributes);
580
-      if ($v_result != 1) {
581
-        return 0;
582
-      }
583
-    }
575
+	foreach ($v_att_list as $v_entry) {
576
+	  $v_result = $this->privFileDescrParseAtt($v_entry,
577
+											   $v_filedescr_list[],
578
+											   $v_options,
579
+											   $v_supported_attributes);
580
+	  if ($v_result != 1) {
581
+		return 0;
582
+	  }
583
+	}
584 584
 
585
-    // ----- Expand the filelist (expand directories)
586
-    $v_result = $this->privFileDescrExpand($v_filedescr_list, $v_options);
587
-    if ($v_result != 1) {
588
-      return 0;
589
-    }
585
+	// ----- Expand the filelist (expand directories)
586
+	$v_result = $this->privFileDescrExpand($v_filedescr_list, $v_options);
587
+	if ($v_result != 1) {
588
+	  return 0;
589
+	}
590 590
 
591
-    // ----- Call the create fct
592
-    $v_result = $this->privAdd($v_filedescr_list, $p_result_list, $v_options);
593
-    if ($v_result != 1) {
594
-      return 0;
595
-    }
591
+	// ----- Call the create fct
592
+	$v_result = $this->privAdd($v_filedescr_list, $p_result_list, $v_options);
593
+	if ($v_result != 1) {
594
+	  return 0;
595
+	}
596 596
 
597
-    // ----- Return
598
-    return $p_result_list;
597
+	// ----- Return
598
+	return $p_result_list;
599 599
   }
600 600
   // --------------------------------------------------------------------------------
601 601
 
@@ -642,26 +642,26 @@  discard block
 block discarded – undo
642 642
   // --------------------------------------------------------------------------------
643 643
   function listContent()
644 644
   {
645
-    $v_result=1;
645
+	$v_result=1;
646 646
 
647
-    // ----- Reset the error handler
648
-    $this->privErrorReset();
647
+	// ----- Reset the error handler
648
+	$this->privErrorReset();
649 649
 
650
-    // ----- Check archive
651
-    if (!$this->privCheckFormat()) {
652
-      return(0);
653
-    }
650
+	// ----- Check archive
651
+	if (!$this->privCheckFormat()) {
652
+	  return(0);
653
+	}
654 654
 
655
-    // ----- Call the extracting fct
656
-    $p_list = array();
657
-    if (($v_result = $this->privList($p_list)) != 1)
658
-    {
659
-      unset($p_list);
660
-      return(0);
661
-    }
655
+	// ----- Call the extracting fct
656
+	$p_list = array();
657
+	if (($v_result = $this->privList($p_list)) != 1)
658
+	{
659
+	  unset($p_list);
660
+	  return(0);
661
+	}
662 662
 
663
-    // ----- Return
664
-    return $p_list;
663
+	// ----- Return
664
+	return $p_list;
665 665
   }
666 666
   // --------------------------------------------------------------------------------
667 667
 
@@ -699,120 +699,120 @@  discard block
 block discarded – undo
699 699
   // --------------------------------------------------------------------------------
700 700
   function extract()
701 701
   {
702
-    $v_result=1;
702
+	$v_result=1;
703 703
 
704
-    // ----- Reset the error handler
705
-    $this->privErrorReset();
704
+	// ----- Reset the error handler
705
+	$this->privErrorReset();
706 706
 
707
-    // ----- Check archive
708
-    if (!$this->privCheckFormat()) {
709
-      return(0);
710
-    }
707
+	// ----- Check archive
708
+	if (!$this->privCheckFormat()) {
709
+	  return(0);
710
+	}
711 711
 
712
-    // ----- Set default values
713
-    $v_options = array();
712
+	// ----- Set default values
713
+	$v_options = array();
714 714
 //    $v_path = "./";
715
-    $v_path = '';
716
-    $v_remove_path = "";
717
-    $v_remove_all_path = false;
718
-
719
-    // ----- Look for variable options arguments
720
-    $v_size = func_num_args();
721
-
722
-    // ----- Default values for option
723
-    $v_options[PCLZIP_OPT_EXTRACT_AS_STRING] = FALSE;
724
-
725
-    // ----- Look for arguments
726
-    if ($v_size > 0) {
727
-      // ----- Get the arguments
728
-      $v_arg_list = func_get_args();
729
-
730
-      // ----- Look for first arg
731
-      if ((is_integer($v_arg_list[0])) && ($v_arg_list[0] > 77000)) {
732
-
733
-        // ----- Parse the options
734
-        $v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options,
735
-                                            array (PCLZIP_OPT_PATH => 'optional',
736
-                                                   PCLZIP_OPT_REMOVE_PATH => 'optional',
737
-                                                   PCLZIP_OPT_REMOVE_ALL_PATH => 'optional',
738
-                                                   PCLZIP_OPT_ADD_PATH => 'optional',
739
-                                                   PCLZIP_CB_PRE_EXTRACT => 'optional',
740
-                                                   PCLZIP_CB_POST_EXTRACT => 'optional',
741
-                                                   PCLZIP_OPT_SET_CHMOD => 'optional',
742
-                                                   PCLZIP_OPT_BY_NAME => 'optional',
743
-                                                   PCLZIP_OPT_BY_EREG => 'optional',
744
-                                                   PCLZIP_OPT_BY_PREG => 'optional',
745
-                                                   PCLZIP_OPT_BY_INDEX => 'optional',
746
-                                                   PCLZIP_OPT_EXTRACT_AS_STRING => 'optional',
747
-                                                   PCLZIP_OPT_EXTRACT_IN_OUTPUT => 'optional',
748
-                                                   PCLZIP_OPT_REPLACE_NEWER => 'optional'
749
-                                                   ,PCLZIP_OPT_STOP_ON_ERROR => 'optional'
750
-                                                   ,PCLZIP_OPT_EXTRACT_DIR_RESTRICTION => 'optional',
751
-                                                   PCLZIP_OPT_TEMP_FILE_THRESHOLD => 'optional',
752
-                                                   PCLZIP_OPT_TEMP_FILE_ON => 'optional',
753
-                                                   PCLZIP_OPT_TEMP_FILE_OFF => 'optional'
754
-												    ));
755
-        if ($v_result != 1) {
756
-          return 0;
757
-        }
758
-
759
-        // ----- Set the arguments
760
-        if (isset($v_options[PCLZIP_OPT_PATH])) {
761
-          $v_path = $v_options[PCLZIP_OPT_PATH];
762
-        }
763
-        if (isset($v_options[PCLZIP_OPT_REMOVE_PATH])) {
764
-          $v_remove_path = $v_options[PCLZIP_OPT_REMOVE_PATH];
765
-        }
766
-        if (isset($v_options[PCLZIP_OPT_REMOVE_ALL_PATH])) {
767
-          $v_remove_all_path = $v_options[PCLZIP_OPT_REMOVE_ALL_PATH];
768
-        }
769
-        if (isset($v_options[PCLZIP_OPT_ADD_PATH])) {
770
-          // ----- Check for '/' in last path char
771
-          if ((strlen($v_path) > 0) && (substr($v_path, -1) != '/')) {
772
-            $v_path .= '/';
773
-          }
774
-          $v_path .= $v_options[PCLZIP_OPT_ADD_PATH];
775
-        }
776
-      }
715
+	$v_path = '';
716
+	$v_remove_path = "";
717
+	$v_remove_all_path = false;
718
+
719
+	// ----- Look for variable options arguments
720
+	$v_size = func_num_args();
721
+
722
+	// ----- Default values for option
723
+	$v_options[PCLZIP_OPT_EXTRACT_AS_STRING] = FALSE;
724
+
725
+	// ----- Look for arguments
726
+	if ($v_size > 0) {
727
+	  // ----- Get the arguments
728
+	  $v_arg_list = func_get_args();
729
+
730
+	  // ----- Look for first arg
731
+	  if ((is_integer($v_arg_list[0])) && ($v_arg_list[0] > 77000)) {
732
+
733
+		// ----- Parse the options
734
+		$v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options,
735
+											array (PCLZIP_OPT_PATH => 'optional',
736
+												   PCLZIP_OPT_REMOVE_PATH => 'optional',
737
+												   PCLZIP_OPT_REMOVE_ALL_PATH => 'optional',
738
+												   PCLZIP_OPT_ADD_PATH => 'optional',
739
+												   PCLZIP_CB_PRE_EXTRACT => 'optional',
740
+												   PCLZIP_CB_POST_EXTRACT => 'optional',
741
+												   PCLZIP_OPT_SET_CHMOD => 'optional',
742
+												   PCLZIP_OPT_BY_NAME => 'optional',
743
+												   PCLZIP_OPT_BY_EREG => 'optional',
744
+												   PCLZIP_OPT_BY_PREG => 'optional',
745
+												   PCLZIP_OPT_BY_INDEX => 'optional',
746
+												   PCLZIP_OPT_EXTRACT_AS_STRING => 'optional',
747
+												   PCLZIP_OPT_EXTRACT_IN_OUTPUT => 'optional',
748
+												   PCLZIP_OPT_REPLACE_NEWER => 'optional'
749
+												   ,PCLZIP_OPT_STOP_ON_ERROR => 'optional'
750
+												   ,PCLZIP_OPT_EXTRACT_DIR_RESTRICTION => 'optional',
751
+												   PCLZIP_OPT_TEMP_FILE_THRESHOLD => 'optional',
752
+												   PCLZIP_OPT_TEMP_FILE_ON => 'optional',
753
+												   PCLZIP_OPT_TEMP_FILE_OFF => 'optional'
754
+													));
755
+		if ($v_result != 1) {
756
+		  return 0;
757
+		}
758
+
759
+		// ----- Set the arguments
760
+		if (isset($v_options[PCLZIP_OPT_PATH])) {
761
+		  $v_path = $v_options[PCLZIP_OPT_PATH];
762
+		}
763
+		if (isset($v_options[PCLZIP_OPT_REMOVE_PATH])) {
764
+		  $v_remove_path = $v_options[PCLZIP_OPT_REMOVE_PATH];
765
+		}
766
+		if (isset($v_options[PCLZIP_OPT_REMOVE_ALL_PATH])) {
767
+		  $v_remove_all_path = $v_options[PCLZIP_OPT_REMOVE_ALL_PATH];
768
+		}
769
+		if (isset($v_options[PCLZIP_OPT_ADD_PATH])) {
770
+		  // ----- Check for '/' in last path char
771
+		  if ((strlen($v_path) > 0) && (substr($v_path, -1) != '/')) {
772
+			$v_path .= '/';
773
+		  }
774
+		  $v_path .= $v_options[PCLZIP_OPT_ADD_PATH];
775
+		}
776
+	  }
777 777
 
778
-      // ----- Look for 2 args
779
-      // Here we need to support the first historic synopsis of the
780
-      // method.
781
-      else {
782
-
783
-        // ----- Get the first argument
784
-        $v_path = $v_arg_list[0];
785
-
786
-        // ----- Look for the optional second argument
787
-        if ($v_size == 2) {
788
-          $v_remove_path = $v_arg_list[1];
789
-        }
790
-        else if ($v_size > 2) {
791
-          // ----- Error log
792
-          PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid number / type of arguments");
793
-
794
-          // ----- Return
795
-          return 0;
796
-        }
797
-      }
798
-    }
778
+	  // ----- Look for 2 args
779
+	  // Here we need to support the first historic synopsis of the
780
+	  // method.
781
+	  else {
782
+
783
+		// ----- Get the first argument
784
+		$v_path = $v_arg_list[0];
785
+
786
+		// ----- Look for the optional second argument
787
+		if ($v_size == 2) {
788
+		  $v_remove_path = $v_arg_list[1];
789
+		}
790
+		else if ($v_size > 2) {
791
+		  // ----- Error log
792
+		  PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid number / type of arguments");
793
+
794
+		  // ----- Return
795
+		  return 0;
796
+		}
797
+	  }
798
+	}
799 799
 
800
-    // ----- Look for default option values
801
-    $this->privOptionDefaultThreshold($v_options);
800
+	// ----- Look for default option values
801
+	$this->privOptionDefaultThreshold($v_options);
802 802
 
803
-    // ----- Trace
803
+	// ----- Trace
804 804
 
805
-    // ----- Call the extracting fct
806
-    $p_list = array();
807
-    $v_result = $this->privExtractByRule($p_list, $v_path, $v_remove_path,
808
-	                                     $v_remove_all_path, $v_options);
809
-    if ($v_result < 1) {
810
-      unset($p_list);
811
-      return(0);
812
-    }
805
+	// ----- Call the extracting fct
806
+	$p_list = array();
807
+	$v_result = $this->privExtractByRule($p_list, $v_path, $v_remove_path,
808
+										 $v_remove_all_path, $v_options);
809
+	if ($v_result < 1) {
810
+	  unset($p_list);
811
+	  return(0);
812
+	}
813 813
 
814
-    // ----- Return
815
-    return $p_list;
814
+	// ----- Return
815
+	return $p_list;
816 816
   }
817 817
   // --------------------------------------------------------------------------------
818 818
 
@@ -856,132 +856,132 @@  discard block
 block discarded – undo
856 856
   //function extractByIndex($p_index, options...)
857 857
   function extractByIndex($p_index)
858 858
   {
859
-    $v_result=1;
859
+	$v_result=1;
860 860
 
861
-    // ----- Reset the error handler
862
-    $this->privErrorReset();
861
+	// ----- Reset the error handler
862
+	$this->privErrorReset();
863 863
 
864
-    // ----- Check archive
865
-    if (!$this->privCheckFormat()) {
866
-      return(0);
867
-    }
864
+	// ----- Check archive
865
+	if (!$this->privCheckFormat()) {
866
+	  return(0);
867
+	}
868 868
 
869
-    // ----- Set default values
870
-    $v_options = array();
869
+	// ----- Set default values
870
+	$v_options = array();
871 871
 //    $v_path = "./";
872
-    $v_path = '';
873
-    $v_remove_path = "";
874
-    $v_remove_all_path = false;
875
-
876
-    // ----- Look for variable options arguments
877
-    $v_size = func_num_args();
878
-
879
-    // ----- Default values for option
880
-    $v_options[PCLZIP_OPT_EXTRACT_AS_STRING] = FALSE;
881
-
882
-    // ----- Look for arguments
883
-    if ($v_size > 1) {
884
-      // ----- Get the arguments
885
-      $v_arg_list = func_get_args();
886
-
887
-      // ----- Remove form the options list the first argument
888
-      array_shift($v_arg_list);
889
-      $v_size--;
890
-
891
-      // ----- Look for first arg
892
-      if ((is_integer($v_arg_list[0])) && ($v_arg_list[0] > 77000)) {
893
-
894
-        // ----- Parse the options
895
-        $v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options,
896
-                                            array (PCLZIP_OPT_PATH => 'optional',
897
-                                                   PCLZIP_OPT_REMOVE_PATH => 'optional',
898
-                                                   PCLZIP_OPT_REMOVE_ALL_PATH => 'optional',
899
-                                                   PCLZIP_OPT_EXTRACT_AS_STRING => 'optional',
900
-                                                   PCLZIP_OPT_ADD_PATH => 'optional',
901
-                                                   PCLZIP_CB_PRE_EXTRACT => 'optional',
902
-                                                   PCLZIP_CB_POST_EXTRACT => 'optional',
903
-                                                   PCLZIP_OPT_SET_CHMOD => 'optional',
904
-                                                   PCLZIP_OPT_REPLACE_NEWER => 'optional'
905
-                                                   ,PCLZIP_OPT_STOP_ON_ERROR => 'optional'
906
-                                                   ,PCLZIP_OPT_EXTRACT_DIR_RESTRICTION => 'optional',
907
-                                                   PCLZIP_OPT_TEMP_FILE_THRESHOLD => 'optional',
908
-                                                   PCLZIP_OPT_TEMP_FILE_ON => 'optional',
909
-                                                   PCLZIP_OPT_TEMP_FILE_OFF => 'optional'
872
+	$v_path = '';
873
+	$v_remove_path = "";
874
+	$v_remove_all_path = false;
875
+
876
+	// ----- Look for variable options arguments
877
+	$v_size = func_num_args();
878
+
879
+	// ----- Default values for option
880
+	$v_options[PCLZIP_OPT_EXTRACT_AS_STRING] = FALSE;
881
+
882
+	// ----- Look for arguments
883
+	if ($v_size > 1) {
884
+	  // ----- Get the arguments
885
+	  $v_arg_list = func_get_args();
886
+
887
+	  // ----- Remove form the options list the first argument
888
+	  array_shift($v_arg_list);
889
+	  $v_size--;
890
+
891
+	  // ----- Look for first arg
892
+	  if ((is_integer($v_arg_list[0])) && ($v_arg_list[0] > 77000)) {
893
+
894
+		// ----- Parse the options
895
+		$v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options,
896
+											array (PCLZIP_OPT_PATH => 'optional',
897
+												   PCLZIP_OPT_REMOVE_PATH => 'optional',
898
+												   PCLZIP_OPT_REMOVE_ALL_PATH => 'optional',
899
+												   PCLZIP_OPT_EXTRACT_AS_STRING => 'optional',
900
+												   PCLZIP_OPT_ADD_PATH => 'optional',
901
+												   PCLZIP_CB_PRE_EXTRACT => 'optional',
902
+												   PCLZIP_CB_POST_EXTRACT => 'optional',
903
+												   PCLZIP_OPT_SET_CHMOD => 'optional',
904
+												   PCLZIP_OPT_REPLACE_NEWER => 'optional'
905
+												   ,PCLZIP_OPT_STOP_ON_ERROR => 'optional'
906
+												   ,PCLZIP_OPT_EXTRACT_DIR_RESTRICTION => 'optional',
907
+												   PCLZIP_OPT_TEMP_FILE_THRESHOLD => 'optional',
908
+												   PCLZIP_OPT_TEMP_FILE_ON => 'optional',
909
+												   PCLZIP_OPT_TEMP_FILE_OFF => 'optional'
910 910
 												   ));
911
-        if ($v_result != 1) {
912
-          return 0;
913
-        }
914
-
915
-        // ----- Set the arguments
916
-        if (isset($v_options[PCLZIP_OPT_PATH])) {
917
-          $v_path = $v_options[PCLZIP_OPT_PATH];
918
-        }
919
-        if (isset($v_options[PCLZIP_OPT_REMOVE_PATH])) {
920
-          $v_remove_path = $v_options[PCLZIP_OPT_REMOVE_PATH];
921
-        }
922
-        if (isset($v_options[PCLZIP_OPT_REMOVE_ALL_PATH])) {
923
-          $v_remove_all_path = $v_options[PCLZIP_OPT_REMOVE_ALL_PATH];
924
-        }
925
-        if (isset($v_options[PCLZIP_OPT_ADD_PATH])) {
926
-          // ----- Check for '/' in last path char
927
-          if ((strlen($v_path) > 0) && (substr($v_path, -1) != '/')) {
928
-            $v_path .= '/';
929
-          }
930
-          $v_path .= $v_options[PCLZIP_OPT_ADD_PATH];
931
-        }
932
-        if (!isset($v_options[PCLZIP_OPT_EXTRACT_AS_STRING])) {
933
-          $v_options[PCLZIP_OPT_EXTRACT_AS_STRING] = FALSE;
934
-        }
935
-        else {
936
-        }
937
-      }
911
+		if ($v_result != 1) {
912
+		  return 0;
913
+		}
914
+
915
+		// ----- Set the arguments
916
+		if (isset($v_options[PCLZIP_OPT_PATH])) {
917
+		  $v_path = $v_options[PCLZIP_OPT_PATH];
918
+		}
919
+		if (isset($v_options[PCLZIP_OPT_REMOVE_PATH])) {
920
+		  $v_remove_path = $v_options[PCLZIP_OPT_REMOVE_PATH];
921
+		}
922
+		if (isset($v_options[PCLZIP_OPT_REMOVE_ALL_PATH])) {
923
+		  $v_remove_all_path = $v_options[PCLZIP_OPT_REMOVE_ALL_PATH];
924
+		}
925
+		if (isset($v_options[PCLZIP_OPT_ADD_PATH])) {
926
+		  // ----- Check for '/' in last path char
927
+		  if ((strlen($v_path) > 0) && (substr($v_path, -1) != '/')) {
928
+			$v_path .= '/';
929
+		  }
930
+		  $v_path .= $v_options[PCLZIP_OPT_ADD_PATH];
931
+		}
932
+		if (!isset($v_options[PCLZIP_OPT_EXTRACT_AS_STRING])) {
933
+		  $v_options[PCLZIP_OPT_EXTRACT_AS_STRING] = FALSE;
934
+		}
935
+		else {
936
+		}
937
+	  }
938 938
 
939
-      // ----- Look for 2 args
940
-      // Here we need to support the first historic synopsis of the
941
-      // method.
942
-      else {
943
-
944
-        // ----- Get the first argument
945
-        $v_path = $v_arg_list[0];
946
-
947
-        // ----- Look for the optional second argument
948
-        if ($v_size == 2) {
949
-          $v_remove_path = $v_arg_list[1];
950
-        }
951
-        else if ($v_size > 2) {
952
-          // ----- Error log
953
-          PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid number / type of arguments");
954
-
955
-          // ----- Return
956
-          return 0;
957
-        }
958
-      }
959
-    }
939
+	  // ----- Look for 2 args
940
+	  // Here we need to support the first historic synopsis of the
941
+	  // method.
942
+	  else {
943
+
944
+		// ----- Get the first argument
945
+		$v_path = $v_arg_list[0];
946
+
947
+		// ----- Look for the optional second argument
948
+		if ($v_size == 2) {
949
+		  $v_remove_path = $v_arg_list[1];
950
+		}
951
+		else if ($v_size > 2) {
952
+		  // ----- Error log
953
+		  PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid number / type of arguments");
954
+
955
+		  // ----- Return
956
+		  return 0;
957
+		}
958
+	  }
959
+	}
960 960
 
961
-    // ----- Trace
962
-
963
-    // ----- Trick
964
-    // Here I want to reuse extractByRule(), so I need to parse the $p_index
965
-    // with privParseOptions()
966
-    $v_arg_trick = array (PCLZIP_OPT_BY_INDEX, $p_index);
967
-    $v_options_trick = array();
968
-    $v_result = $this->privParseOptions($v_arg_trick, sizeof($v_arg_trick), $v_options_trick,
969
-                                        array (PCLZIP_OPT_BY_INDEX => 'optional' ));
970
-    if ($v_result != 1) {
971
-        return 0;
972
-    }
973
-    $v_options[PCLZIP_OPT_BY_INDEX] = $v_options_trick[PCLZIP_OPT_BY_INDEX];
961
+	// ----- Trace
962
+
963
+	// ----- Trick
964
+	// Here I want to reuse extractByRule(), so I need to parse the $p_index
965
+	// with privParseOptions()
966
+	$v_arg_trick = array (PCLZIP_OPT_BY_INDEX, $p_index);
967
+	$v_options_trick = array();
968
+	$v_result = $this->privParseOptions($v_arg_trick, sizeof($v_arg_trick), $v_options_trick,
969
+										array (PCLZIP_OPT_BY_INDEX => 'optional' ));
970
+	if ($v_result != 1) {
971
+		return 0;
972
+	}
973
+	$v_options[PCLZIP_OPT_BY_INDEX] = $v_options_trick[PCLZIP_OPT_BY_INDEX];
974 974
 
975
-    // ----- Look for default option values
976
-    $this->privOptionDefaultThreshold($v_options);
975
+	// ----- Look for default option values
976
+	$this->privOptionDefaultThreshold($v_options);
977 977
 
978
-    // ----- Call the extracting fct
979
-    if (($v_result = $this->privExtractByRule($p_list, $v_path, $v_remove_path, $v_remove_all_path, $v_options)) < 1) {
980
-        return(0);
981
-    }
978
+	// ----- Call the extracting fct
979
+	if (($v_result = $this->privExtractByRule($p_list, $v_path, $v_remove_path, $v_remove_all_path, $v_options)) < 1) {
980
+		return(0);
981
+	}
982 982
 
983
-    // ----- Return
984
-    return $p_list;
983
+	// ----- Return
984
+	return $p_list;
985 985
   }
986 986
   // --------------------------------------------------------------------------------
987 987
 
@@ -1005,54 +1005,54 @@  discard block
 block discarded – undo
1005 1005
   // --------------------------------------------------------------------------------
1006 1006
   function delete()
1007 1007
   {
1008
-    $v_result=1;
1008
+	$v_result=1;
1009 1009
 
1010
-    // ----- Reset the error handler
1011
-    $this->privErrorReset();
1010
+	// ----- Reset the error handler
1011
+	$this->privErrorReset();
1012 1012
 
1013
-    // ----- Check archive
1014
-    if (!$this->privCheckFormat()) {
1015
-      return(0);
1016
-    }
1013
+	// ----- Check archive
1014
+	if (!$this->privCheckFormat()) {
1015
+	  return(0);
1016
+	}
1017 1017
 
1018
-    // ----- Set default values
1019
-    $v_options = array();
1020
-
1021
-    // ----- Look for variable options arguments
1022
-    $v_size = func_num_args();
1023
-
1024
-    // ----- Look for arguments
1025
-    if ($v_size > 0) {
1026
-      // ----- Get the arguments
1027
-      $v_arg_list = func_get_args();
1028
-
1029
-      // ----- Parse the options
1030
-      $v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options,
1031
-                                        array (PCLZIP_OPT_BY_NAME => 'optional',
1032
-                                               PCLZIP_OPT_BY_EREG => 'optional',
1033
-                                               PCLZIP_OPT_BY_PREG => 'optional',
1034
-                                               PCLZIP_OPT_BY_INDEX => 'optional' ));
1035
-      if ($v_result != 1) {
1036
-          return 0;
1037
-      }
1038
-    }
1018
+	// ----- Set default values
1019
+	$v_options = array();
1020
+
1021
+	// ----- Look for variable options arguments
1022
+	$v_size = func_num_args();
1023
+
1024
+	// ----- Look for arguments
1025
+	if ($v_size > 0) {
1026
+	  // ----- Get the arguments
1027
+	  $v_arg_list = func_get_args();
1028
+
1029
+	  // ----- Parse the options
1030
+	  $v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options,
1031
+										array (PCLZIP_OPT_BY_NAME => 'optional',
1032
+											   PCLZIP_OPT_BY_EREG => 'optional',
1033
+											   PCLZIP_OPT_BY_PREG => 'optional',
1034
+											   PCLZIP_OPT_BY_INDEX => 'optional' ));
1035
+	  if ($v_result != 1) {
1036
+		  return 0;
1037
+	  }
1038
+	}
1039 1039
 
1040
-    // ----- Magic quotes trick
1041
-    $this->privDisableMagicQuotes();
1040
+	// ----- Magic quotes trick
1041
+	$this->privDisableMagicQuotes();
1042 1042
 
1043
-    // ----- Call the delete fct
1044
-    $v_list = array();
1045
-    if (($v_result = $this->privDeleteByRule($v_list, $v_options)) != 1) {
1046
-      $this->privSwapBackMagicQuotes();
1047
-      unset($v_list);
1048
-      return(0);
1049
-    }
1043
+	// ----- Call the delete fct
1044
+	$v_list = array();
1045
+	if (($v_result = $this->privDeleteByRule($v_list, $v_options)) != 1) {
1046
+	  $this->privSwapBackMagicQuotes();
1047
+	  unset($v_list);
1048
+	  return(0);
1049
+	}
1050 1050
 
1051
-    // ----- Magic quotes trick
1052
-    $this->privSwapBackMagicQuotes();
1051
+	// ----- Magic quotes trick
1052
+	$this->privSwapBackMagicQuotes();
1053 1053
 
1054
-    // ----- Return
1055
-    return $v_list;
1054
+	// ----- Return
1055
+	return $v_list;
1056 1056
   }
1057 1057
   // --------------------------------------------------------------------------------
1058 1058
 
@@ -1065,10 +1065,10 @@  discard block
 block discarded – undo
1065 1065
   function deleteByIndex($p_index)
1066 1066
   {
1067 1067
     
1068
-    $p_list = $this->delete(PCLZIP_OPT_BY_INDEX, $p_index);
1068
+	$p_list = $this->delete(PCLZIP_OPT_BY_INDEX, $p_index);
1069 1069
 
1070
-    // ----- Return
1071
-    return $p_list;
1070
+	// ----- Return
1071
+	return $p_list;
1072 1072
   }
1073 1073
   // --------------------------------------------------------------------------------
1074 1074
 
@@ -1089,61 +1089,61 @@  discard block
 block discarded – undo
1089 1089
   function properties()
1090 1090
   {
1091 1091
 
1092
-    // ----- Reset the error handler
1093
-    $this->privErrorReset();
1092
+	// ----- Reset the error handler
1093
+	$this->privErrorReset();
1094 1094
 
1095
-    // ----- Magic quotes trick
1096
-    $this->privDisableMagicQuotes();
1095
+	// ----- Magic quotes trick
1096
+	$this->privDisableMagicQuotes();
1097 1097
 
1098
-    // ----- Check archive
1099
-    if (!$this->privCheckFormat()) {
1100
-      $this->privSwapBackMagicQuotes();
1101
-      return(0);
1102
-    }
1098
+	// ----- Check archive
1099
+	if (!$this->privCheckFormat()) {
1100
+	  $this->privSwapBackMagicQuotes();
1101
+	  return(0);
1102
+	}
1103 1103
 
1104
-    // ----- Default properties
1105
-    $v_prop = array();
1106
-    $v_prop['comment'] = '';
1107
-    $v_prop['nb'] = 0;
1108
-    $v_prop['status'] = 'not_exist';
1109
-
1110
-    // ----- Look if file exists
1111
-    if (@is_file($this->zipname))
1112
-    {
1113
-      // ----- Open the zip file
1114
-      if (($this->zip_fd = @fopen($this->zipname, 'rb')) == 0)
1115
-      {
1116
-        $this->privSwapBackMagicQuotes();
1104
+	// ----- Default properties
1105
+	$v_prop = array();
1106
+	$v_prop['comment'] = '';
1107
+	$v_prop['nb'] = 0;
1108
+	$v_prop['status'] = 'not_exist';
1109
+
1110
+	// ----- Look if file exists
1111
+	if (@is_file($this->zipname))
1112
+	{
1113
+	  // ----- Open the zip file
1114
+	  if (($this->zip_fd = @fopen($this->zipname, 'rb')) == 0)
1115
+	  {
1116
+		$this->privSwapBackMagicQuotes();
1117 1117
         
1118
-        // ----- Error log
1119
-        PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open archive \''.$this->zipname.'\' in binary read mode');
1118
+		// ----- Error log
1119
+		PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open archive \''.$this->zipname.'\' in binary read mode');
1120 1120
 
1121
-        // ----- Return
1122
-        return 0;
1123
-      }
1121
+		// ----- Return
1122
+		return 0;
1123
+	  }
1124 1124
 
1125
-      // ----- Read the central directory informations
1126
-      $v_central_dir = array();
1127
-      if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1)
1128
-      {
1129
-        $this->privSwapBackMagicQuotes();
1130
-        return 0;
1131
-      }
1125
+	  // ----- Read the central directory informations
1126
+	  $v_central_dir = array();
1127
+	  if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1)
1128
+	  {
1129
+		$this->privSwapBackMagicQuotes();
1130
+		return 0;
1131
+	  }
1132 1132
 
1133
-      // ----- Close the zip file
1134
-      $this->privCloseFd();
1133
+	  // ----- Close the zip file
1134
+	  $this->privCloseFd();
1135 1135
 
1136
-      // ----- Set the user attributes
1137
-      $v_prop['comment'] = $v_central_dir['comment'];
1138
-      $v_prop['nb'] = $v_central_dir['entries'];
1139
-      $v_prop['status'] = 'ok';
1140
-    }
1136
+	  // ----- Set the user attributes
1137
+	  $v_prop['comment'] = $v_central_dir['comment'];
1138
+	  $v_prop['nb'] = $v_central_dir['entries'];
1139
+	  $v_prop['status'] = 'ok';
1140
+	}
1141 1141
 
1142
-    // ----- Magic quotes trick
1143
-    $this->privSwapBackMagicQuotes();
1142
+	// ----- Magic quotes trick
1143
+	$this->privSwapBackMagicQuotes();
1144 1144
 
1145
-    // ----- Return
1146
-    return $v_prop;
1145
+	// ----- Return
1146
+	return $v_prop;
1147 1147
   }
1148 1148
   // --------------------------------------------------------------------------------
1149 1149
 
@@ -1161,46 +1161,46 @@  discard block
 block discarded – undo
1161 1161
   // --------------------------------------------------------------------------------
1162 1162
   function duplicate($p_archive)
1163 1163
   {
1164
-    $v_result = 1;
1164
+	$v_result = 1;
1165 1165
 
1166
-    // ----- Reset the error handler
1167
-    $this->privErrorReset();
1166
+	// ----- Reset the error handler
1167
+	$this->privErrorReset();
1168 1168
 
1169
-    // ----- Look if the $p_archive is a PclZip object
1170
-    if ((is_object($p_archive)) && (get_class($p_archive) == 'pclzip'))
1171
-    {
1169
+	// ----- Look if the $p_archive is a PclZip object
1170
+	if ((is_object($p_archive)) && (get_class($p_archive) == 'pclzip'))
1171
+	{
1172 1172
 
1173
-      // ----- Duplicate the archive
1174
-      $v_result = $this->privDuplicate($p_archive->zipname);
1175
-    }
1173
+	  // ----- Duplicate the archive
1174
+	  $v_result = $this->privDuplicate($p_archive->zipname);
1175
+	}
1176 1176
 
1177
-    // ----- Look if the $p_archive is a string (so a filename)
1178
-    else if (is_string($p_archive))
1179
-    {
1177
+	// ----- Look if the $p_archive is a string (so a filename)
1178
+	else if (is_string($p_archive))
1179
+	{
1180 1180
 
1181
-      // ----- Check that $p_archive is a valid zip file
1182
-      // TBC : Should also check the archive format
1183
-      if (!is_file($p_archive)) {
1184
-        // ----- Error log
1185
-        PclZip::privErrorLog(PCLZIP_ERR_MISSING_FILE, "No file with filename '".$p_archive."'");
1186
-        $v_result = PCLZIP_ERR_MISSING_FILE;
1187
-      }
1188
-      else {
1189
-        // ----- Duplicate the archive
1190
-        $v_result = $this->privDuplicate($p_archive);
1191
-      }
1192
-    }
1181
+	  // ----- Check that $p_archive is a valid zip file
1182
+	  // TBC : Should also check the archive format
1183
+	  if (!is_file($p_archive)) {
1184
+		// ----- Error log
1185
+		PclZip::privErrorLog(PCLZIP_ERR_MISSING_FILE, "No file with filename '".$p_archive."'");
1186
+		$v_result = PCLZIP_ERR_MISSING_FILE;
1187
+	  }
1188
+	  else {
1189
+		// ----- Duplicate the archive
1190
+		$v_result = $this->privDuplicate($p_archive);
1191
+	  }
1192
+	}
1193 1193
 
1194
-    // ----- Invalid variable
1195
-    else
1196
-    {
1197
-      // ----- Error log
1198
-      PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid variable type p_archive_to_add");
1199
-      $v_result = PCLZIP_ERR_INVALID_PARAMETER;
1200
-    }
1194
+	// ----- Invalid variable
1195
+	else
1196
+	{
1197
+	  // ----- Error log
1198
+	  PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid variable type p_archive_to_add");
1199
+	  $v_result = PCLZIP_ERR_INVALID_PARAMETER;
1200
+	}
1201 1201
 
1202
-    // ----- Return
1203
-    return $v_result;
1202
+	// ----- Return
1203
+	return $v_result;
1204 1204
   }
1205 1205
   // --------------------------------------------------------------------------------
1206 1206
 
@@ -1220,45 +1220,45 @@  discard block
 block discarded – undo
1220 1220
   // --------------------------------------------------------------------------------
1221 1221
   function merge($p_archive_to_add)
1222 1222
   {
1223
-    $v_result = 1;
1223
+	$v_result = 1;
1224 1224
 
1225
-    // ----- Reset the error handler
1226
-    $this->privErrorReset();
1225
+	// ----- Reset the error handler
1226
+	$this->privErrorReset();
1227 1227
 
1228
-    // ----- Check archive
1229
-    if (!$this->privCheckFormat()) {
1230
-      return(0);
1231
-    }
1228
+	// ----- Check archive
1229
+	if (!$this->privCheckFormat()) {
1230
+	  return(0);
1231
+	}
1232 1232
 
1233
-    // ----- Look if the $p_archive_to_add is a PclZip object
1234
-    if ((is_object($p_archive_to_add)) && (get_class($p_archive_to_add) == 'pclzip'))
1235
-    {
1233
+	// ----- Look if the $p_archive_to_add is a PclZip object
1234
+	if ((is_object($p_archive_to_add)) && (get_class($p_archive_to_add) == 'pclzip'))
1235
+	{
1236 1236
 
1237
-      // ----- Merge the archive
1238
-      $v_result = $this->privMerge($p_archive_to_add);
1239
-    }
1237
+	  // ----- Merge the archive
1238
+	  $v_result = $this->privMerge($p_archive_to_add);
1239
+	}
1240 1240
 
1241
-    // ----- Look if the $p_archive_to_add is a string (so a filename)
1242
-    else if (is_string($p_archive_to_add))
1243
-    {
1241
+	// ----- Look if the $p_archive_to_add is a string (so a filename)
1242
+	else if (is_string($p_archive_to_add))
1243
+	{
1244 1244
 
1245
-      // ----- Create a temporary archive
1246
-      $v_object_archive = new PclZip($p_archive_to_add);
1245
+	  // ----- Create a temporary archive
1246
+	  $v_object_archive = new PclZip($p_archive_to_add);
1247 1247
 
1248
-      // ----- Merge the archive
1249
-      $v_result = $this->privMerge($v_object_archive);
1250
-    }
1248
+	  // ----- Merge the archive
1249
+	  $v_result = $this->privMerge($v_object_archive);
1250
+	}
1251 1251
 
1252
-    // ----- Invalid variable
1253
-    else
1254
-    {
1255
-      // ----- Error log
1256
-      PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid variable type p_archive_to_add");
1257
-      $v_result = PCLZIP_ERR_INVALID_PARAMETER;
1258
-    }
1252
+	// ----- Invalid variable
1253
+	else
1254
+	{
1255
+	  // ----- Error log
1256
+	  PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid variable type p_archive_to_add");
1257
+	  $v_result = PCLZIP_ERR_INVALID_PARAMETER;
1258
+	}
1259 1259
 
1260
-    // ----- Return
1261
-    return $v_result;
1260
+	// ----- Return
1261
+	return $v_result;
1262 1262
   }
1263 1263
   // --------------------------------------------------------------------------------
1264 1264
 
@@ -1271,12 +1271,12 @@  discard block
 block discarded – undo
1271 1271
   // --------------------------------------------------------------------------------
1272 1272
   function errorCode()
1273 1273
   {
1274
-    if (PCLZIP_ERROR_EXTERNAL == 1) {
1275
-      return(PclErrorCode());
1276
-    }
1277
-    else {
1278
-      return($this->error_code);
1279
-    }
1274
+	if (PCLZIP_ERROR_EXTERNAL == 1) {
1275
+	  return(PclErrorCode());
1276
+	}
1277
+	else {
1278
+	  return($this->error_code);
1279
+	}
1280 1280
   }
1281 1281
   // --------------------------------------------------------------------------------
1282 1282
 
@@ -1287,42 +1287,42 @@  discard block
 block discarded – undo
1287 1287
   // --------------------------------------------------------------------------------
1288 1288
   function errorName($p_with_code=false)
1289 1289
   {
1290
-    $v_name = array ( PCLZIP_ERR_NO_ERROR => 'PCLZIP_ERR_NO_ERROR',
1291
-                      PCLZIP_ERR_WRITE_OPEN_FAIL => 'PCLZIP_ERR_WRITE_OPEN_FAIL',
1292
-                      PCLZIP_ERR_READ_OPEN_FAIL => 'PCLZIP_ERR_READ_OPEN_FAIL',
1293
-                      PCLZIP_ERR_INVALID_PARAMETER => 'PCLZIP_ERR_INVALID_PARAMETER',
1294
-                      PCLZIP_ERR_MISSING_FILE => 'PCLZIP_ERR_MISSING_FILE',
1295
-                      PCLZIP_ERR_FILENAME_TOO_LONG => 'PCLZIP_ERR_FILENAME_TOO_LONG',
1296
-                      PCLZIP_ERR_INVALID_ZIP => 'PCLZIP_ERR_INVALID_ZIP',
1297
-                      PCLZIP_ERR_BAD_EXTRACTED_FILE => 'PCLZIP_ERR_BAD_EXTRACTED_FILE',
1298
-                      PCLZIP_ERR_DIR_CREATE_FAIL => 'PCLZIP_ERR_DIR_CREATE_FAIL',
1299
-                      PCLZIP_ERR_BAD_EXTENSION => 'PCLZIP_ERR_BAD_EXTENSION',
1300
-                      PCLZIP_ERR_BAD_FORMAT => 'PCLZIP_ERR_BAD_FORMAT',
1301
-                      PCLZIP_ERR_DELETE_FILE_FAIL => 'PCLZIP_ERR_DELETE_FILE_FAIL',
1302
-                      PCLZIP_ERR_RENAME_FILE_FAIL => 'PCLZIP_ERR_RENAME_FILE_FAIL',
1303
-                      PCLZIP_ERR_BAD_CHECKSUM => 'PCLZIP_ERR_BAD_CHECKSUM',
1304
-                      PCLZIP_ERR_INVALID_ARCHIVE_ZIP => 'PCLZIP_ERR_INVALID_ARCHIVE_ZIP',
1305
-                      PCLZIP_ERR_MISSING_OPTION_VALUE => 'PCLZIP_ERR_MISSING_OPTION_VALUE',
1306
-                      PCLZIP_ERR_INVALID_OPTION_VALUE => 'PCLZIP_ERR_INVALID_OPTION_VALUE',
1307
-                      PCLZIP_ERR_UNSUPPORTED_COMPRESSION => 'PCLZIP_ERR_UNSUPPORTED_COMPRESSION',
1308
-                      PCLZIP_ERR_UNSUPPORTED_ENCRYPTION => 'PCLZIP_ERR_UNSUPPORTED_ENCRYPTION'
1309
-                      ,PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE => 'PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE'
1310
-                      ,PCLZIP_ERR_DIRECTORY_RESTRICTION => 'PCLZIP_ERR_DIRECTORY_RESTRICTION'
1311
-                    );
1312
-
1313
-    if (isset($v_name[$this->error_code])) {
1314
-      $v_value = $v_name[$this->error_code];
1315
-    }
1316
-    else {
1317
-      $v_value = 'NoName';
1318
-    }
1290
+	$v_name = array ( PCLZIP_ERR_NO_ERROR => 'PCLZIP_ERR_NO_ERROR',
1291
+					  PCLZIP_ERR_WRITE_OPEN_FAIL => 'PCLZIP_ERR_WRITE_OPEN_FAIL',
1292
+					  PCLZIP_ERR_READ_OPEN_FAIL => 'PCLZIP_ERR_READ_OPEN_FAIL',
1293
+					  PCLZIP_ERR_INVALID_PARAMETER => 'PCLZIP_ERR_INVALID_PARAMETER',
1294
+					  PCLZIP_ERR_MISSING_FILE => 'PCLZIP_ERR_MISSING_FILE',
1295
+					  PCLZIP_ERR_FILENAME_TOO_LONG => 'PCLZIP_ERR_FILENAME_TOO_LONG',
1296
+					  PCLZIP_ERR_INVALID_ZIP => 'PCLZIP_ERR_INVALID_ZIP',
1297
+					  PCLZIP_ERR_BAD_EXTRACTED_FILE => 'PCLZIP_ERR_BAD_EXTRACTED_FILE',
1298
+					  PCLZIP_ERR_DIR_CREATE_FAIL => 'PCLZIP_ERR_DIR_CREATE_FAIL',
1299
+					  PCLZIP_ERR_BAD_EXTENSION => 'PCLZIP_ERR_BAD_EXTENSION',
1300
+					  PCLZIP_ERR_BAD_FORMAT => 'PCLZIP_ERR_BAD_FORMAT',
1301
+					  PCLZIP_ERR_DELETE_FILE_FAIL => 'PCLZIP_ERR_DELETE_FILE_FAIL',
1302
+					  PCLZIP_ERR_RENAME_FILE_FAIL => 'PCLZIP_ERR_RENAME_FILE_FAIL',
1303
+					  PCLZIP_ERR_BAD_CHECKSUM => 'PCLZIP_ERR_BAD_CHECKSUM',
1304
+					  PCLZIP_ERR_INVALID_ARCHIVE_ZIP => 'PCLZIP_ERR_INVALID_ARCHIVE_ZIP',
1305
+					  PCLZIP_ERR_MISSING_OPTION_VALUE => 'PCLZIP_ERR_MISSING_OPTION_VALUE',
1306
+					  PCLZIP_ERR_INVALID_OPTION_VALUE => 'PCLZIP_ERR_INVALID_OPTION_VALUE',
1307
+					  PCLZIP_ERR_UNSUPPORTED_COMPRESSION => 'PCLZIP_ERR_UNSUPPORTED_COMPRESSION',
1308
+					  PCLZIP_ERR_UNSUPPORTED_ENCRYPTION => 'PCLZIP_ERR_UNSUPPORTED_ENCRYPTION'
1309
+					  ,PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE => 'PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE'
1310
+					  ,PCLZIP_ERR_DIRECTORY_RESTRICTION => 'PCLZIP_ERR_DIRECTORY_RESTRICTION'
1311
+					);
1312
+
1313
+	if (isset($v_name[$this->error_code])) {
1314
+	  $v_value = $v_name[$this->error_code];
1315
+	}
1316
+	else {
1317
+	  $v_value = 'NoName';
1318
+	}
1319 1319
 
1320
-    if ($p_with_code) {
1321
-      return($v_value.' ('.$this->error_code.')');
1322
-    }
1323
-    else {
1324
-      return($v_value);
1325
-    }
1320
+	if ($p_with_code) {
1321
+	  return($v_value.' ('.$this->error_code.')');
1322
+	}
1323
+	else {
1324
+	  return($v_value);
1325
+	}
1326 1326
   }
1327 1327
   // --------------------------------------------------------------------------------
1328 1328
 
@@ -1333,17 +1333,17 @@  discard block
 block discarded – undo
1333 1333
   // --------------------------------------------------------------------------------
1334 1334
   function errorInfo($p_full=false)
1335 1335
   {
1336
-    if (PCLZIP_ERROR_EXTERNAL == 1) {
1337
-      return(PclErrorString());
1338
-    }
1339
-    else {
1340
-      if ($p_full) {
1341
-        return($this->errorName(true)." : ".$this->error_string);
1342
-      }
1343
-      else {
1344
-        return($this->error_string." [code ".$this->error_code."]");
1345
-      }
1346
-    }
1336
+	if (PCLZIP_ERROR_EXTERNAL == 1) {
1337
+	  return(PclErrorString());
1338
+	}
1339
+	else {
1340
+	  if ($p_full) {
1341
+		return($this->errorName(true)." : ".$this->error_string);
1342
+	  }
1343
+	  else {
1344
+		return($this->error_string." [code ".$this->error_code."]");
1345
+	  }
1346
+	}
1347 1347
   }
1348 1348
   // --------------------------------------------------------------------------------
1349 1349
 
@@ -1372,39 +1372,39 @@  discard block
 block discarded – undo
1372 1372
   // --------------------------------------------------------------------------------
1373 1373
   function privCheckFormat($p_level=0)
1374 1374
   {
1375
-    $v_result = true;
1375
+	$v_result = true;
1376 1376
 
1377 1377
 	// ----- Reset the file system cache
1378
-    clearstatcache();
1378
+	clearstatcache();
1379 1379
 
1380
-    // ----- Reset the error handler
1381
-    $this->privErrorReset();
1380
+	// ----- Reset the error handler
1381
+	$this->privErrorReset();
1382 1382
 
1383
-    // ----- Look if the file exits
1384
-    if (!is_file($this->zipname)) {
1385
-      // ----- Error log
1386
-      PclZip::privErrorLog(PCLZIP_ERR_MISSING_FILE, "Missing archive file '".$this->zipname."'");
1387
-      return(false);
1388
-    }
1383
+	// ----- Look if the file exits
1384
+	if (!is_file($this->zipname)) {
1385
+	  // ----- Error log
1386
+	  PclZip::privErrorLog(PCLZIP_ERR_MISSING_FILE, "Missing archive file '".$this->zipname."'");
1387
+	  return(false);
1388
+	}
1389 1389
 
1390
-    // ----- Check that the file is readeable
1391
-    if (!is_readable($this->zipname)) {
1392
-      // ----- Error log
1393
-      PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, "Unable to read archive '".$this->zipname."'");
1394
-      return(false);
1395
-    }
1390
+	// ----- Check that the file is readeable
1391
+	if (!is_readable($this->zipname)) {
1392
+	  // ----- Error log
1393
+	  PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, "Unable to read archive '".$this->zipname."'");
1394
+	  return(false);
1395
+	}
1396 1396
 
1397
-    // ----- Check the magic code
1398
-    // TBC
1397
+	// ----- Check the magic code
1398
+	// TBC
1399 1399
 
1400
-    // ----- Check the central header
1401
-    // TBC
1400
+	// ----- Check the central header
1401
+	// TBC
1402 1402
 
1403
-    // ----- Check each file header
1404
-    // TBC
1403
+	// ----- Check each file header
1404
+	// TBC
1405 1405
 
1406
-    // ----- Return
1407
-    return $v_result;
1406
+	// ----- Return
1407
+	return $v_result;
1408 1408
   }
1409 1409
   // --------------------------------------------------------------------------------
1410 1410
 
@@ -1425,395 +1425,395 @@  discard block
 block discarded – undo
1425 1425
   // --------------------------------------------------------------------------------
1426 1426
   function privParseOptions(&$p_options_list, $p_size, &$v_result_list, $v_requested_options=false)
1427 1427
   {
1428
-    $v_result=1;
1428
+	$v_result=1;
1429 1429
     
1430
-    // ----- Read the options
1431
-    $i=0;
1432
-    while ($i<$p_size) {
1430
+	// ----- Read the options
1431
+	$i=0;
1432
+	while ($i<$p_size) {
1433 1433
 
1434
-      // ----- Check if the option is supported
1435
-      if (!isset($v_requested_options[$p_options_list[$i]])) {
1436
-        // ----- Error log
1437
-        PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid optional parameter '".$p_options_list[$i]."' for this method");
1434
+	  // ----- Check if the option is supported
1435
+	  if (!isset($v_requested_options[$p_options_list[$i]])) {
1436
+		// ----- Error log
1437
+		PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid optional parameter '".$p_options_list[$i]."' for this method");
1438 1438
 
1439
-        // ----- Return
1440
-        return PclZip::errorCode();
1441
-      }
1439
+		// ----- Return
1440
+		return PclZip::errorCode();
1441
+	  }
1442 1442
 
1443
-      // ----- Look for next option
1444
-      switch ($p_options_list[$i]) {
1445
-        // ----- Look for options that request a path value
1446
-        case PCLZIP_OPT_PATH :
1447
-        case PCLZIP_OPT_REMOVE_PATH :
1448
-        case PCLZIP_OPT_ADD_PATH :
1449
-          // ----- Check the number of parameters
1450
-          if (($i+1) >= $p_size) {
1451
-            // ----- Error log
1452
-            PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
1453
-
1454
-            // ----- Return
1455
-            return PclZip::errorCode();
1456
-          }
1443
+	  // ----- Look for next option
1444
+	  switch ($p_options_list[$i]) {
1445
+		// ----- Look for options that request a path value
1446
+		case PCLZIP_OPT_PATH :
1447
+		case PCLZIP_OPT_REMOVE_PATH :
1448
+		case PCLZIP_OPT_ADD_PATH :
1449
+		  // ----- Check the number of parameters
1450
+		  if (($i+1) >= $p_size) {
1451
+			// ----- Error log
1452
+			PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
1453
+
1454
+			// ----- Return
1455
+			return PclZip::errorCode();
1456
+		  }
1457 1457
 
1458
-          // ----- Get the value
1459
-          $v_result_list[$p_options_list[$i]] = PclZipUtilTranslateWinPath($p_options_list[$i+1], FALSE);
1460
-          $i++;
1461
-        break;
1458
+		  // ----- Get the value
1459
+		  $v_result_list[$p_options_list[$i]] = PclZipUtilTranslateWinPath($p_options_list[$i+1], FALSE);
1460
+		  $i++;
1461
+		break;
1462 1462
 
1463
-        case PCLZIP_OPT_TEMP_FILE_THRESHOLD :
1464
-          // ----- Check the number of parameters
1465
-          if (($i+1) >= $p_size) {
1466
-            PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
1467
-            return PclZip::errorCode();
1468
-          }
1463
+		case PCLZIP_OPT_TEMP_FILE_THRESHOLD :
1464
+		  // ----- Check the number of parameters
1465
+		  if (($i+1) >= $p_size) {
1466
+			PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
1467
+			return PclZip::errorCode();
1468
+		  }
1469 1469
           
1470
-          // ----- Check for incompatible options
1471
-          if (isset($v_result_list[PCLZIP_OPT_TEMP_FILE_OFF])) {
1472
-            PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Option '".PclZipUtilOptionText($p_options_list[$i])."' can not be used with option 'PCLZIP_OPT_TEMP_FILE_OFF'");
1473
-            return PclZip::errorCode();
1474
-          }
1470
+		  // ----- Check for incompatible options
1471
+		  if (isset($v_result_list[PCLZIP_OPT_TEMP_FILE_OFF])) {
1472
+			PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Option '".PclZipUtilOptionText($p_options_list[$i])."' can not be used with option 'PCLZIP_OPT_TEMP_FILE_OFF'");
1473
+			return PclZip::errorCode();
1474
+		  }
1475 1475
           
1476
-          // ----- Check the value
1477
-          $v_value = $p_options_list[$i+1];
1478
-          if ((!is_integer($v_value)) || ($v_value<0)) {
1479
-            PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Integer expected for option '".PclZipUtilOptionText($p_options_list[$i])."'");
1480
-            return PclZip::errorCode();
1481
-          }
1476
+		  // ----- Check the value
1477
+		  $v_value = $p_options_list[$i+1];
1478
+		  if ((!is_integer($v_value)) || ($v_value<0)) {
1479
+			PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Integer expected for option '".PclZipUtilOptionText($p_options_list[$i])."'");
1480
+			return PclZip::errorCode();
1481
+		  }
1482 1482
 
1483
-          // ----- Get the value (and convert it in bytes)
1484
-          $v_result_list[$p_options_list[$i]] = $v_value*1048576;
1485
-          $i++;
1486
-        break;
1483
+		  // ----- Get the value (and convert it in bytes)
1484
+		  $v_result_list[$p_options_list[$i]] = $v_value*1048576;
1485
+		  $i++;
1486
+		break;
1487 1487
 
1488
-        case PCLZIP_OPT_TEMP_FILE_ON :
1489
-          // ----- Check for incompatible options
1490
-          if (isset($v_result_list[PCLZIP_OPT_TEMP_FILE_OFF])) {
1491
-            PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Option '".PclZipUtilOptionText($p_options_list[$i])."' can not be used with option 'PCLZIP_OPT_TEMP_FILE_OFF'");
1492
-            return PclZip::errorCode();
1493
-          }
1488
+		case PCLZIP_OPT_TEMP_FILE_ON :
1489
+		  // ----- Check for incompatible options
1490
+		  if (isset($v_result_list[PCLZIP_OPT_TEMP_FILE_OFF])) {
1491
+			PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Option '".PclZipUtilOptionText($p_options_list[$i])."' can not be used with option 'PCLZIP_OPT_TEMP_FILE_OFF'");
1492
+			return PclZip::errorCode();
1493
+		  }
1494 1494
           
1495
-          $v_result_list[$p_options_list[$i]] = true;
1496
-        break;
1497
-
1498
-        case PCLZIP_OPT_TEMP_FILE_OFF :
1499
-          // ----- Check for incompatible options
1500
-          if (isset($v_result_list[PCLZIP_OPT_TEMP_FILE_ON])) {
1501
-            PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Option '".PclZipUtilOptionText($p_options_list[$i])."' can not be used with option 'PCLZIP_OPT_TEMP_FILE_ON'");
1502
-            return PclZip::errorCode();
1503
-          }
1504
-          // ----- Check for incompatible options
1505
-          if (isset($v_result_list[PCLZIP_OPT_TEMP_FILE_THRESHOLD])) {
1506
-            PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Option '".PclZipUtilOptionText($p_options_list[$i])."' can not be used with option 'PCLZIP_OPT_TEMP_FILE_THRESHOLD'");
1507
-            return PclZip::errorCode();
1508
-          }
1495
+		  $v_result_list[$p_options_list[$i]] = true;
1496
+		break;
1497
+
1498
+		case PCLZIP_OPT_TEMP_FILE_OFF :
1499
+		  // ----- Check for incompatible options
1500
+		  if (isset($v_result_list[PCLZIP_OPT_TEMP_FILE_ON])) {
1501
+			PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Option '".PclZipUtilOptionText($p_options_list[$i])."' can not be used with option 'PCLZIP_OPT_TEMP_FILE_ON'");
1502
+			return PclZip::errorCode();
1503
+		  }
1504
+		  // ----- Check for incompatible options
1505
+		  if (isset($v_result_list[PCLZIP_OPT_TEMP_FILE_THRESHOLD])) {
1506
+			PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Option '".PclZipUtilOptionText($p_options_list[$i])."' can not be used with option 'PCLZIP_OPT_TEMP_FILE_THRESHOLD'");
1507
+			return PclZip::errorCode();
1508
+		  }
1509 1509
           
1510
-          $v_result_list[$p_options_list[$i]] = true;
1511
-        break;
1510
+		  $v_result_list[$p_options_list[$i]] = true;
1511
+		break;
1512 1512
 
1513
-        case PCLZIP_OPT_EXTRACT_DIR_RESTRICTION :
1514
-          // ----- Check the number of parameters
1515
-          if (($i+1) >= $p_size) {
1516
-            // ----- Error log
1517
-            PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
1513
+		case PCLZIP_OPT_EXTRACT_DIR_RESTRICTION :
1514
+		  // ----- Check the number of parameters
1515
+		  if (($i+1) >= $p_size) {
1516
+			// ----- Error log
1517
+			PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
1518 1518
 
1519
-            // ----- Return
1520
-            return PclZip::errorCode();
1521
-          }
1519
+			// ----- Return
1520
+			return PclZip::errorCode();
1521
+		  }
1522 1522
 
1523
-          // ----- Get the value
1524
-          if (   is_string($p_options_list[$i+1])
1525
-              && ($p_options_list[$i+1] != '')) {
1526
-            $v_result_list[$p_options_list[$i]] = PclZipUtilTranslateWinPath($p_options_list[$i+1], FALSE);
1527
-            $i++;
1528
-          }
1529
-          else {
1530
-          }
1531
-        break;
1523
+		  // ----- Get the value
1524
+		  if (   is_string($p_options_list[$i+1])
1525
+			  && ($p_options_list[$i+1] != '')) {
1526
+			$v_result_list[$p_options_list[$i]] = PclZipUtilTranslateWinPath($p_options_list[$i+1], FALSE);
1527
+			$i++;
1528
+		  }
1529
+		  else {
1530
+		  }
1531
+		break;
1532 1532
 
1533
-        // ----- Look for options that request an array of string for value
1534
-        case PCLZIP_OPT_BY_NAME :
1535
-          // ----- Check the number of parameters
1536
-          if (($i+1) >= $p_size) {
1537
-            // ----- Error log
1538
-            PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
1533
+		// ----- Look for options that request an array of string for value
1534
+		case PCLZIP_OPT_BY_NAME :
1535
+		  // ----- Check the number of parameters
1536
+		  if (($i+1) >= $p_size) {
1537
+			// ----- Error log
1538
+			PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
1539 1539
 
1540
-            // ----- Return
1541
-            return PclZip::errorCode();
1542
-          }
1540
+			// ----- Return
1541
+			return PclZip::errorCode();
1542
+		  }
1543 1543
 
1544
-          // ----- Get the value
1545
-          if (is_string($p_options_list[$i+1])) {
1546
-              $v_result_list[$p_options_list[$i]][0] = $p_options_list[$i+1];
1547
-          }
1548
-          else if (is_array($p_options_list[$i+1])) {
1549
-              $v_result_list[$p_options_list[$i]] = $p_options_list[$i+1];
1550
-          }
1551
-          else {
1552
-            // ----- Error log
1553
-            PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Wrong parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
1544
+		  // ----- Get the value
1545
+		  if (is_string($p_options_list[$i+1])) {
1546
+			  $v_result_list[$p_options_list[$i]][0] = $p_options_list[$i+1];
1547
+		  }
1548
+		  else if (is_array($p_options_list[$i+1])) {
1549
+			  $v_result_list[$p_options_list[$i]] = $p_options_list[$i+1];
1550
+		  }
1551
+		  else {
1552
+			// ----- Error log
1553
+			PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Wrong parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
1554 1554
 
1555
-            // ----- Return
1556
-            return PclZip::errorCode();
1557
-          }
1558
-          $i++;
1559
-        break;
1560
-
1561
-        // ----- Look for options that request an EREG or PREG expression
1562
-        case PCLZIP_OPT_BY_EREG :
1563
-          // ereg() is deprecated starting with PHP 5.3. Move PCLZIP_OPT_BY_EREG
1564
-          // to PCLZIP_OPT_BY_PREG
1565
-          $p_options_list[$i] = PCLZIP_OPT_BY_PREG;
1566
-        case PCLZIP_OPT_BY_PREG :
1567
-        //case PCLZIP_OPT_CRYPT :
1568
-          // ----- Check the number of parameters
1569
-          if (($i+1) >= $p_size) {
1570
-            // ----- Error log
1571
-            PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
1572
-
1573
-            // ----- Return
1574
-            return PclZip::errorCode();
1575
-          }
1555
+			// ----- Return
1556
+			return PclZip::errorCode();
1557
+		  }
1558
+		  $i++;
1559
+		break;
1560
+
1561
+		// ----- Look for options that request an EREG or PREG expression
1562
+		case PCLZIP_OPT_BY_EREG :
1563
+		  // ereg() is deprecated starting with PHP 5.3. Move PCLZIP_OPT_BY_EREG
1564
+		  // to PCLZIP_OPT_BY_PREG
1565
+		  $p_options_list[$i] = PCLZIP_OPT_BY_PREG;
1566
+		case PCLZIP_OPT_BY_PREG :
1567
+		//case PCLZIP_OPT_CRYPT :
1568
+		  // ----- Check the number of parameters
1569
+		  if (($i+1) >= $p_size) {
1570
+			// ----- Error log
1571
+			PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
1572
+
1573
+			// ----- Return
1574
+			return PclZip::errorCode();
1575
+		  }
1576 1576
 
1577
-          // ----- Get the value
1578
-          if (is_string($p_options_list[$i+1])) {
1579
-              $v_result_list[$p_options_list[$i]] = $p_options_list[$i+1];
1580
-          }
1581
-          else {
1582
-            // ----- Error log
1583
-            PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Wrong parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
1577
+		  // ----- Get the value
1578
+		  if (is_string($p_options_list[$i+1])) {
1579
+			  $v_result_list[$p_options_list[$i]] = $p_options_list[$i+1];
1580
+		  }
1581
+		  else {
1582
+			// ----- Error log
1583
+			PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Wrong parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
1584 1584
 
1585
-            // ----- Return
1586
-            return PclZip::errorCode();
1587
-          }
1588
-          $i++;
1589
-        break;
1590
-
1591
-        // ----- Look for options that takes a string
1592
-        case PCLZIP_OPT_COMMENT :
1593
-        case PCLZIP_OPT_ADD_COMMENT :
1594
-        case PCLZIP_OPT_PREPEND_COMMENT :
1595
-          // ----- Check the number of parameters
1596
-          if (($i+1) >= $p_size) {
1597
-            // ----- Error log
1598
-            PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE,
1599
-			                     "Missing parameter value for option '"
1585
+			// ----- Return
1586
+			return PclZip::errorCode();
1587
+		  }
1588
+		  $i++;
1589
+		break;
1590
+
1591
+		// ----- Look for options that takes a string
1592
+		case PCLZIP_OPT_COMMENT :
1593
+		case PCLZIP_OPT_ADD_COMMENT :
1594
+		case PCLZIP_OPT_PREPEND_COMMENT :
1595
+		  // ----- Check the number of parameters
1596
+		  if (($i+1) >= $p_size) {
1597
+			// ----- Error log
1598
+			PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE,
1599
+								 "Missing parameter value for option '"
1600 1600
 								 .PclZipUtilOptionText($p_options_list[$i])
1601 1601
 								 ."'");
1602 1602
 
1603
-            // ----- Return
1604
-            return PclZip::errorCode();
1605
-          }
1603
+			// ----- Return
1604
+			return PclZip::errorCode();
1605
+		  }
1606 1606
 
1607
-          // ----- Get the value
1608
-          if (is_string($p_options_list[$i+1])) {
1609
-              $v_result_list[$p_options_list[$i]] = $p_options_list[$i+1];
1610
-          }
1611
-          else {
1612
-            // ----- Error log
1613
-            PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE,
1614
-			                     "Wrong parameter value for option '"
1607
+		  // ----- Get the value
1608
+		  if (is_string($p_options_list[$i+1])) {
1609
+			  $v_result_list[$p_options_list[$i]] = $p_options_list[$i+1];
1610
+		  }
1611
+		  else {
1612
+			// ----- Error log
1613
+			PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE,
1614
+								 "Wrong parameter value for option '"
1615 1615
 								 .PclZipUtilOptionText($p_options_list[$i])
1616 1616
 								 ."'");
1617 1617
 
1618
-            // ----- Return
1619
-            return PclZip::errorCode();
1620
-          }
1621
-          $i++;
1622
-        break;
1623
-
1624
-        // ----- Look for options that request an array of index
1625
-        case PCLZIP_OPT_BY_INDEX :
1626
-          // ----- Check the number of parameters
1627
-          if (($i+1) >= $p_size) {
1628
-            // ----- Error log
1629
-            PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
1630
-
1631
-            // ----- Return
1632
-            return PclZip::errorCode();
1633
-          }
1618
+			// ----- Return
1619
+			return PclZip::errorCode();
1620
+		  }
1621
+		  $i++;
1622
+		break;
1623
+
1624
+		// ----- Look for options that request an array of index
1625
+		case PCLZIP_OPT_BY_INDEX :
1626
+		  // ----- Check the number of parameters
1627
+		  if (($i+1) >= $p_size) {
1628
+			// ----- Error log
1629
+			PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
1630
+
1631
+			// ----- Return
1632
+			return PclZip::errorCode();
1633
+		  }
1634 1634
 
1635
-          // ----- Get the value
1636
-          $v_work_list = array();
1637
-          if (is_string($p_options_list[$i+1])) {
1635
+		  // ----- Get the value
1636
+		  $v_work_list = array();
1637
+		  if (is_string($p_options_list[$i+1])) {
1638 1638
 
1639
-              // ----- Remove spaces
1640
-              $p_options_list[$i+1] = strtr($p_options_list[$i+1], ' ', '');
1639
+			  // ----- Remove spaces
1640
+			  $p_options_list[$i+1] = strtr($p_options_list[$i+1], ' ', '');
1641 1641
 
1642
-              // ----- Parse items
1643
-              $v_work_list = explode(",", $p_options_list[$i+1]);
1644
-          }
1645
-          else if (is_integer($p_options_list[$i+1])) {
1646
-              $v_work_list[0] = $p_options_list[$i+1].'-'.$p_options_list[$i+1];
1647
-          }
1648
-          else if (is_array($p_options_list[$i+1])) {
1649
-              $v_work_list = $p_options_list[$i+1];
1650
-          }
1651
-          else {
1652
-            // ----- Error log
1653
-            PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Value must be integer, string or array for option '".PclZipUtilOptionText($p_options_list[$i])."'");
1642
+			  // ----- Parse items
1643
+			  $v_work_list = explode(",", $p_options_list[$i+1]);
1644
+		  }
1645
+		  else if (is_integer($p_options_list[$i+1])) {
1646
+			  $v_work_list[0] = $p_options_list[$i+1].'-'.$p_options_list[$i+1];
1647
+		  }
1648
+		  else if (is_array($p_options_list[$i+1])) {
1649
+			  $v_work_list = $p_options_list[$i+1];
1650
+		  }
1651
+		  else {
1652
+			// ----- Error log
1653
+			PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Value must be integer, string or array for option '".PclZipUtilOptionText($p_options_list[$i])."'");
1654 1654
 
1655
-            // ----- Return
1656
-            return PclZip::errorCode();
1657
-          }
1655
+			// ----- Return
1656
+			return PclZip::errorCode();
1657
+		  }
1658 1658
           
1659
-          // ----- Reduce the index list
1660
-          // each index item in the list must be a couple with a start and
1661
-          // an end value : [0,3], [5-5], [8-10], ...
1662
-          // ----- Check the format of each item
1663
-          $v_sort_flag=false;
1664
-          $v_sort_value=0;
1665
-          for ($j=0; $j<sizeof($v_work_list); $j++) {
1666
-              // ----- Explode the item
1667
-              $v_item_list = explode("-", $v_work_list[$j]);
1668
-              $v_size_item_list = sizeof($v_item_list);
1659
+		  // ----- Reduce the index list
1660
+		  // each index item in the list must be a couple with a start and
1661
+		  // an end value : [0,3], [5-5], [8-10], ...
1662
+		  // ----- Check the format of each item
1663
+		  $v_sort_flag=false;
1664
+		  $v_sort_value=0;
1665
+		  for ($j=0; $j<sizeof($v_work_list); $j++) {
1666
+			  // ----- Explode the item
1667
+			  $v_item_list = explode("-", $v_work_list[$j]);
1668
+			  $v_size_item_list = sizeof($v_item_list);
1669 1669
               
1670
-              // ----- TBC : Here we might check that each item is a
1671
-              // real integer ...
1670
+			  // ----- TBC : Here we might check that each item is a
1671
+			  // real integer ...
1672 1672
               
1673
-              // ----- Look for single value
1674
-              if ($v_size_item_list == 1) {
1675
-                  // ----- Set the option value
1676
-                  $v_result_list[$p_options_list[$i]][$j]['start'] = $v_item_list[0];
1677
-                  $v_result_list[$p_options_list[$i]][$j]['end'] = $v_item_list[0];
1678
-              }
1679
-              elseif ($v_size_item_list == 2) {
1680
-                  // ----- Set the option value
1681
-                  $v_result_list[$p_options_list[$i]][$j]['start'] = $v_item_list[0];
1682
-                  $v_result_list[$p_options_list[$i]][$j]['end'] = $v_item_list[1];
1683
-              }
1684
-              else {
1685
-                  // ----- Error log
1686
-                  PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Too many values in index range for option '".PclZipUtilOptionText($p_options_list[$i])."'");
1687
-
1688
-                  // ----- Return
1689
-                  return PclZip::errorCode();
1690
-              }
1691
-
1692
-
1693
-              // ----- Look for list sort
1694
-              if ($v_result_list[$p_options_list[$i]][$j]['start'] < $v_sort_value) {
1695
-                  $v_sort_flag=true;
1696
-
1697
-                  // ----- TBC : An automatic sort should be writen ...
1698
-                  // ----- Error log
1699
-                  PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Invalid order of index range for option '".PclZipUtilOptionText($p_options_list[$i])."'");
1700
-
1701
-                  // ----- Return
1702
-                  return PclZip::errorCode();
1703
-              }
1704
-              $v_sort_value = $v_result_list[$p_options_list[$i]][$j]['start'];
1705
-          }
1673
+			  // ----- Look for single value
1674
+			  if ($v_size_item_list == 1) {
1675
+				  // ----- Set the option value
1676
+				  $v_result_list[$p_options_list[$i]][$j]['start'] = $v_item_list[0];
1677
+				  $v_result_list[$p_options_list[$i]][$j]['end'] = $v_item_list[0];
1678
+			  }
1679
+			  elseif ($v_size_item_list == 2) {
1680
+				  // ----- Set the option value
1681
+				  $v_result_list[$p_options_list[$i]][$j]['start'] = $v_item_list[0];
1682
+				  $v_result_list[$p_options_list[$i]][$j]['end'] = $v_item_list[1];
1683
+			  }
1684
+			  else {
1685
+				  // ----- Error log
1686
+				  PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Too many values in index range for option '".PclZipUtilOptionText($p_options_list[$i])."'");
1687
+
1688
+				  // ----- Return
1689
+				  return PclZip::errorCode();
1690
+			  }
1691
+
1692
+
1693
+			  // ----- Look for list sort
1694
+			  if ($v_result_list[$p_options_list[$i]][$j]['start'] < $v_sort_value) {
1695
+				  $v_sort_flag=true;
1696
+
1697
+				  // ----- TBC : An automatic sort should be writen ...
1698
+				  // ----- Error log
1699
+				  PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Invalid order of index range for option '".PclZipUtilOptionText($p_options_list[$i])."'");
1700
+
1701
+				  // ----- Return
1702
+				  return PclZip::errorCode();
1703
+			  }
1704
+			  $v_sort_value = $v_result_list[$p_options_list[$i]][$j]['start'];
1705
+		  }
1706 1706
           
1707
-          // ----- Sort the items
1708
-          if ($v_sort_flag) {
1709
-              // TBC : To Be Completed
1710
-          }
1707
+		  // ----- Sort the items
1708
+		  if ($v_sort_flag) {
1709
+			  // TBC : To Be Completed
1710
+		  }
1711 1711
 
1712
-          // ----- Next option
1713
-          $i++;
1714
-        break;
1715
-
1716
-        // ----- Look for options that request no value
1717
-        case PCLZIP_OPT_REMOVE_ALL_PATH :
1718
-        case PCLZIP_OPT_EXTRACT_AS_STRING :
1719
-        case PCLZIP_OPT_NO_COMPRESSION :
1720
-        case PCLZIP_OPT_EXTRACT_IN_OUTPUT :
1721
-        case PCLZIP_OPT_REPLACE_NEWER :
1722
-        case PCLZIP_OPT_STOP_ON_ERROR :
1723
-          $v_result_list[$p_options_list[$i]] = true;
1724
-        break;
1725
-
1726
-        // ----- Look for options that request an octal value
1727
-        case PCLZIP_OPT_SET_CHMOD :
1728
-          // ----- Check the number of parameters
1729
-          if (($i+1) >= $p_size) {
1730
-            // ----- Error log
1731
-            PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
1732
-
1733
-            // ----- Return
1734
-            return PclZip::errorCode();
1735
-          }
1712
+		  // ----- Next option
1713
+		  $i++;
1714
+		break;
1715
+
1716
+		// ----- Look for options that request no value
1717
+		case PCLZIP_OPT_REMOVE_ALL_PATH :
1718
+		case PCLZIP_OPT_EXTRACT_AS_STRING :
1719
+		case PCLZIP_OPT_NO_COMPRESSION :
1720
+		case PCLZIP_OPT_EXTRACT_IN_OUTPUT :
1721
+		case PCLZIP_OPT_REPLACE_NEWER :
1722
+		case PCLZIP_OPT_STOP_ON_ERROR :
1723
+		  $v_result_list[$p_options_list[$i]] = true;
1724
+		break;
1725
+
1726
+		// ----- Look for options that request an octal value
1727
+		case PCLZIP_OPT_SET_CHMOD :
1728
+		  // ----- Check the number of parameters
1729
+		  if (($i+1) >= $p_size) {
1730
+			// ----- Error log
1731
+			PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
1732
+
1733
+			// ----- Return
1734
+			return PclZip::errorCode();
1735
+		  }
1736 1736
 
1737
-          // ----- Get the value
1738
-          $v_result_list[$p_options_list[$i]] = $p_options_list[$i+1];
1739
-          $i++;
1740
-        break;
1741
-
1742
-        // ----- Look for options that request a call-back
1743
-        case PCLZIP_CB_PRE_EXTRACT :
1744
-        case PCLZIP_CB_POST_EXTRACT :
1745
-        case PCLZIP_CB_PRE_ADD :
1746
-        case PCLZIP_CB_POST_ADD :
1747
-        /* for futur use
1737
+		  // ----- Get the value
1738
+		  $v_result_list[$p_options_list[$i]] = $p_options_list[$i+1];
1739
+		  $i++;
1740
+		break;
1741
+
1742
+		// ----- Look for options that request a call-back
1743
+		case PCLZIP_CB_PRE_EXTRACT :
1744
+		case PCLZIP_CB_POST_EXTRACT :
1745
+		case PCLZIP_CB_PRE_ADD :
1746
+		case PCLZIP_CB_POST_ADD :
1747
+		/* for futur use
1748 1748
         case PCLZIP_CB_PRE_DELETE :
1749 1749
         case PCLZIP_CB_POST_DELETE :
1750 1750
         case PCLZIP_CB_PRE_LIST :
1751 1751
         case PCLZIP_CB_POST_LIST :
1752 1752
         */
1753
-          // ----- Check the number of parameters
1754
-          if (($i+1) >= $p_size) {
1755
-            // ----- Error log
1756
-            PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
1753
+		  // ----- Check the number of parameters
1754
+		  if (($i+1) >= $p_size) {
1755
+			// ----- Error log
1756
+			PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
1757 1757
 
1758
-            // ----- Return
1759
-            return PclZip::errorCode();
1760
-          }
1758
+			// ----- Return
1759
+			return PclZip::errorCode();
1760
+		  }
1761 1761
 
1762
-          // ----- Get the value
1763
-          $v_function_name = $p_options_list[$i+1];
1762
+		  // ----- Get the value
1763
+		  $v_function_name = $p_options_list[$i+1];
1764 1764
 
1765
-          // ----- Check that the value is a valid existing function
1766
-          if (!function_exists($v_function_name)) {
1767
-            // ----- Error log
1768
-            PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Function '".$v_function_name."()' is not an existing function for option '".PclZipUtilOptionText($p_options_list[$i])."'");
1765
+		  // ----- Check that the value is a valid existing function
1766
+		  if (!function_exists($v_function_name)) {
1767
+			// ----- Error log
1768
+			PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Function '".$v_function_name."()' is not an existing function for option '".PclZipUtilOptionText($p_options_list[$i])."'");
1769 1769
 
1770
-            // ----- Return
1771
-            return PclZip::errorCode();
1772
-          }
1770
+			// ----- Return
1771
+			return PclZip::errorCode();
1772
+		  }
1773 1773
 
1774
-          // ----- Set the attribute
1775
-          $v_result_list[$p_options_list[$i]] = $v_function_name;
1776
-          $i++;
1777
-        break;
1774
+		  // ----- Set the attribute
1775
+		  $v_result_list[$p_options_list[$i]] = $v_function_name;
1776
+		  $i++;
1777
+		break;
1778 1778
 
1779
-        default :
1780
-          // ----- Error log
1781
-          PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER,
1782
-		                       "Unknown parameter '"
1779
+		default :
1780
+		  // ----- Error log
1781
+		  PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER,
1782
+							   "Unknown parameter '"
1783 1783
 							   .$p_options_list[$i]."'");
1784 1784
 
1785
-          // ----- Return
1786
-          return PclZip::errorCode();
1787
-      }
1785
+		  // ----- Return
1786
+		  return PclZip::errorCode();
1787
+	  }
1788 1788
 
1789
-      // ----- Next options
1790
-      $i++;
1791
-    }
1789
+	  // ----- Next options
1790
+	  $i++;
1791
+	}
1792 1792
 
1793
-    // ----- Look for mandatory options
1794
-    if ($v_requested_options !== false) {
1795
-      for ($key=reset($v_requested_options); $key=key($v_requested_options); $key=next($v_requested_options)) {
1796
-        // ----- Look for mandatory option
1797
-        if ($v_requested_options[$key] == 'mandatory') {
1798
-          // ----- Look if present
1799
-          if (!isset($v_result_list[$key])) {
1800
-            // ----- Error log
1801
-            PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Missing mandatory parameter ".PclZipUtilOptionText($key)."(".$key.")");
1802
-
1803
-            // ----- Return
1804
-            return PclZip::errorCode();
1805
-          }
1806
-        }
1807
-      }
1808
-    }
1793
+	// ----- Look for mandatory options
1794
+	if ($v_requested_options !== false) {
1795
+	  for ($key=reset($v_requested_options); $key=key($v_requested_options); $key=next($v_requested_options)) {
1796
+		// ----- Look for mandatory option
1797
+		if ($v_requested_options[$key] == 'mandatory') {
1798
+		  // ----- Look if present
1799
+		  if (!isset($v_result_list[$key])) {
1800
+			// ----- Error log
1801
+			PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Missing mandatory parameter ".PclZipUtilOptionText($key)."(".$key.")");
1802
+
1803
+			// ----- Return
1804
+			return PclZip::errorCode();
1805
+		  }
1806
+		}
1807
+	  }
1808
+	}
1809 1809
     
1810
-    // ----- Look for default values
1811
-    if (!isset($v_result_list[PCLZIP_OPT_TEMP_FILE_THRESHOLD])) {
1810
+	// ----- Look for default values
1811
+	if (!isset($v_result_list[PCLZIP_OPT_TEMP_FILE_THRESHOLD])) {
1812 1812
       
1813
-    }
1813
+	}
1814 1814
 
1815
-    // ----- Return
1816
-    return $v_result;
1815
+	// ----- Return
1816
+	return $v_result;
1817 1817
   }
1818 1818
   // --------------------------------------------------------------------------------
1819 1819
 
@@ -1825,37 +1825,37 @@  discard block
 block discarded – undo
1825 1825
   // --------------------------------------------------------------------------------
1826 1826
   function privOptionDefaultThreshold(&$p_options)
1827 1827
   {
1828
-    $v_result=1;
1828
+	$v_result=1;
1829 1829
     
1830
-    if (isset($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD])
1831
-        || isset($p_options[PCLZIP_OPT_TEMP_FILE_OFF])) {
1832
-      return $v_result;
1833
-    }
1830
+	if (isset($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD])
1831
+		|| isset($p_options[PCLZIP_OPT_TEMP_FILE_OFF])) {
1832
+	  return $v_result;
1833
+	}
1834 1834
     
1835
-    // ----- Get 'memory_limit' configuration value
1836
-    $v_memory_limit = ini_get('memory_limit');
1837
-    $v_memory_limit = trim($v_memory_limit);
1838
-    $last = strtolower(substr($v_memory_limit, -1));
1835
+	// ----- Get 'memory_limit' configuration value
1836
+	$v_memory_limit = ini_get('memory_limit');
1837
+	$v_memory_limit = trim($v_memory_limit);
1838
+	$last = strtolower(substr($v_memory_limit, -1));
1839 1839
  
1840
-    if($last == 'g')
1841
-        //$v_memory_limit = $v_memory_limit*1024*1024*1024;
1842
-        $v_memory_limit = $v_memory_limit*1073741824;
1843
-    if($last == 'm')
1844
-        //$v_memory_limit = $v_memory_limit*1024*1024;
1845
-        $v_memory_limit = $v_memory_limit*1048576;
1846
-    if($last == 'k')
1847
-        $v_memory_limit = $v_memory_limit*1024;
1840
+	if($last == 'g')
1841
+		//$v_memory_limit = $v_memory_limit*1024*1024*1024;
1842
+		$v_memory_limit = $v_memory_limit*1073741824;
1843
+	if($last == 'm')
1844
+		//$v_memory_limit = $v_memory_limit*1024*1024;
1845
+		$v_memory_limit = $v_memory_limit*1048576;
1846
+	if($last == 'k')
1847
+		$v_memory_limit = $v_memory_limit*1024;
1848 1848
             
1849
-    $p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD] = floor($v_memory_limit*PCLZIP_TEMPORARY_FILE_RATIO);
1849
+	$p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD] = floor($v_memory_limit*PCLZIP_TEMPORARY_FILE_RATIO);
1850 1850
     
1851 1851
 
1852
-    // ----- Sanity check : No threshold if value lower than 1M
1853
-    if ($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD] < 1048576) {
1854
-      unset($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD]);
1855
-    }
1852
+	// ----- Sanity check : No threshold if value lower than 1M
1853
+	if ($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD] < 1048576) {
1854
+	  unset($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD]);
1855
+	}
1856 1856
           
1857
-    // ----- Return
1858
-    return $v_result;
1857
+	// ----- Return
1858
+	return $v_result;
1859 1859
   }
1860 1860
   // --------------------------------------------------------------------------------
1861 1861
 
@@ -1869,116 +1869,116 @@  discard block
 block discarded – undo
1869 1869
   // --------------------------------------------------------------------------------
1870 1870
   function privFileDescrParseAtt(&$p_file_list, &$p_filedescr, $v_options, $v_requested_options=false)
1871 1871
   {
1872
-    $v_result=1;
1872
+	$v_result=1;
1873 1873
     
1874
-    // ----- For each file in the list check the attributes
1875
-    foreach ($p_file_list as $v_key => $v_value) {
1874
+	// ----- For each file in the list check the attributes
1875
+	foreach ($p_file_list as $v_key => $v_value) {
1876 1876
     
1877
-      // ----- Check if the option is supported
1878
-      if (!isset($v_requested_options[$v_key])) {
1879
-        // ----- Error log
1880
-        PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid file attribute '".$v_key."' for this file");
1877
+	  // ----- Check if the option is supported
1878
+	  if (!isset($v_requested_options[$v_key])) {
1879
+		// ----- Error log
1880
+		PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid file attribute '".$v_key."' for this file");
1881 1881
 
1882
-        // ----- Return
1883
-        return PclZip::errorCode();
1884
-      }
1882
+		// ----- Return
1883
+		return PclZip::errorCode();
1884
+	  }
1885 1885
 
1886
-      // ----- Look for attribute
1887
-      switch ($v_key) {
1888
-        case PCLZIP_ATT_FILE_NAME :
1889
-          if (!is_string($v_value)) {
1890
-            PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid type ".gettype($v_value).". String expected for attribute '".PclZipUtilOptionText($v_key)."'");
1891
-            return PclZip::errorCode();
1892
-          }
1886
+	  // ----- Look for attribute
1887
+	  switch ($v_key) {
1888
+		case PCLZIP_ATT_FILE_NAME :
1889
+		  if (!is_string($v_value)) {
1890
+			PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid type ".gettype($v_value).". String expected for attribute '".PclZipUtilOptionText($v_key)."'");
1891
+			return PclZip::errorCode();
1892
+		  }
1893 1893
 
1894
-          $p_filedescr['filename'] = PclZipUtilPathReduction($v_value);
1894
+		  $p_filedescr['filename'] = PclZipUtilPathReduction($v_value);
1895 1895
           
1896
-          if ($p_filedescr['filename'] == '') {
1897
-            PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid empty filename for attribute '".PclZipUtilOptionText($v_key)."'");
1898
-            return PclZip::errorCode();
1899
-          }
1896
+		  if ($p_filedescr['filename'] == '') {
1897
+			PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid empty filename for attribute '".PclZipUtilOptionText($v_key)."'");
1898
+			return PclZip::errorCode();
1899
+		  }
1900 1900
 
1901
-        break;
1901
+		break;
1902 1902
 
1903
-        case PCLZIP_ATT_FILE_NEW_SHORT_NAME :
1904
-          if (!is_string($v_value)) {
1905
-            PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid type ".gettype($v_value).". String expected for attribute '".PclZipUtilOptionText($v_key)."'");
1906
-            return PclZip::errorCode();
1907
-          }
1903
+		case PCLZIP_ATT_FILE_NEW_SHORT_NAME :
1904
+		  if (!is_string($v_value)) {
1905
+			PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid type ".gettype($v_value).". String expected for attribute '".PclZipUtilOptionText($v_key)."'");
1906
+			return PclZip::errorCode();
1907
+		  }
1908 1908
 
1909
-          $p_filedescr['new_short_name'] = PclZipUtilPathReduction($v_value);
1909
+		  $p_filedescr['new_short_name'] = PclZipUtilPathReduction($v_value);
1910 1910
 
1911
-          if ($p_filedescr['new_short_name'] == '') {
1912
-            PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid empty short filename for attribute '".PclZipUtilOptionText($v_key)."'");
1913
-            return PclZip::errorCode();
1914
-          }
1915
-        break;
1911
+		  if ($p_filedescr['new_short_name'] == '') {
1912
+			PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid empty short filename for attribute '".PclZipUtilOptionText($v_key)."'");
1913
+			return PclZip::errorCode();
1914
+		  }
1915
+		break;
1916 1916
 
1917
-        case PCLZIP_ATT_FILE_NEW_FULL_NAME :
1918
-          if (!is_string($v_value)) {
1919
-            PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid type ".gettype($v_value).". String expected for attribute '".PclZipUtilOptionText($v_key)."'");
1920
-            return PclZip::errorCode();
1921
-          }
1917
+		case PCLZIP_ATT_FILE_NEW_FULL_NAME :
1918
+		  if (!is_string($v_value)) {
1919
+			PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid type ".gettype($v_value).". String expected for attribute '".PclZipUtilOptionText($v_key)."'");
1920
+			return PclZip::errorCode();
1921
+		  }
1922 1922
 
1923
-          $p_filedescr['new_full_name'] = PclZipUtilPathReduction($v_value);
1923
+		  $p_filedescr['new_full_name'] = PclZipUtilPathReduction($v_value);
1924 1924
 
1925
-          if ($p_filedescr['new_full_name'] == '') {
1926
-            PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid empty full filename for attribute '".PclZipUtilOptionText($v_key)."'");
1927
-            return PclZip::errorCode();
1928
-          }
1929
-        break;
1925
+		  if ($p_filedescr['new_full_name'] == '') {
1926
+			PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid empty full filename for attribute '".PclZipUtilOptionText($v_key)."'");
1927
+			return PclZip::errorCode();
1928
+		  }
1929
+		break;
1930 1930
 
1931
-        // ----- Look for options that takes a string
1932
-        case PCLZIP_ATT_FILE_COMMENT :
1933
-          if (!is_string($v_value)) {
1934
-            PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid type ".gettype($v_value).". String expected for attribute '".PclZipUtilOptionText($v_key)."'");
1935
-            return PclZip::errorCode();
1936
-          }
1931
+		// ----- Look for options that takes a string
1932
+		case PCLZIP_ATT_FILE_COMMENT :
1933
+		  if (!is_string($v_value)) {
1934
+			PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid type ".gettype($v_value).". String expected for attribute '".PclZipUtilOptionText($v_key)."'");
1935
+			return PclZip::errorCode();
1936
+		  }
1937 1937
 
1938
-          $p_filedescr['comment'] = $v_value;
1939
-        break;
1938
+		  $p_filedescr['comment'] = $v_value;
1939
+		break;
1940 1940
 
1941
-        case PCLZIP_ATT_FILE_MTIME :
1942
-          if (!is_integer($v_value)) {
1943
-            PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid type ".gettype($v_value).". Integer expected for attribute '".PclZipUtilOptionText($v_key)."'");
1944
-            return PclZip::errorCode();
1945
-          }
1941
+		case PCLZIP_ATT_FILE_MTIME :
1942
+		  if (!is_integer($v_value)) {
1943
+			PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid type ".gettype($v_value).". Integer expected for attribute '".PclZipUtilOptionText($v_key)."'");
1944
+			return PclZip::errorCode();
1945
+		  }
1946 1946
 
1947
-          $p_filedescr['mtime'] = $v_value;
1948
-        break;
1947
+		  $p_filedescr['mtime'] = $v_value;
1948
+		break;
1949 1949
 
1950
-        case PCLZIP_ATT_FILE_CONTENT :
1951
-          $p_filedescr['content'] = $v_value;
1952
-        break;
1950
+		case PCLZIP_ATT_FILE_CONTENT :
1951
+		  $p_filedescr['content'] = $v_value;
1952
+		break;
1953 1953
 
1954
-        default :
1955
-          // ----- Error log
1956
-          PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER,
1957
-		                           "Unknown parameter '".$v_key."'");
1954
+		default :
1955
+		  // ----- Error log
1956
+		  PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER,
1957
+								   "Unknown parameter '".$v_key."'");
1958 1958
 
1959
-          // ----- Return
1960
-          return PclZip::errorCode();
1961
-      }
1959
+		  // ----- Return
1960
+		  return PclZip::errorCode();
1961
+	  }
1962 1962
 
1963
-      // ----- Look for mandatory options
1964
-      if ($v_requested_options !== false) {
1965
-        for ($key=reset($v_requested_options); $key=key($v_requested_options); $key=next($v_requested_options)) {
1966
-          // ----- Look for mandatory option
1967
-          if ($v_requested_options[$key] == 'mandatory') {
1968
-            // ----- Look if present
1969
-            if (!isset($p_file_list[$key])) {
1970
-              PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Missing mandatory parameter ".PclZipUtilOptionText($key)."(".$key.")");
1971
-              return PclZip::errorCode();
1972
-            }
1973
-          }
1974
-        }
1975
-      }
1963
+	  // ----- Look for mandatory options
1964
+	  if ($v_requested_options !== false) {
1965
+		for ($key=reset($v_requested_options); $key=key($v_requested_options); $key=next($v_requested_options)) {
1966
+		  // ----- Look for mandatory option
1967
+		  if ($v_requested_options[$key] == 'mandatory') {
1968
+			// ----- Look if present
1969
+			if (!isset($p_file_list[$key])) {
1970
+			  PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Missing mandatory parameter ".PclZipUtilOptionText($key)."(".$key.")");
1971
+			  return PclZip::errorCode();
1972
+			}
1973
+		  }
1974
+		}
1975
+	  }
1976 1976
     
1977
-    // end foreach
1978
-    }
1977
+	// end foreach
1978
+	}
1979 1979
     
1980
-    // ----- Return
1981
-    return $v_result;
1980
+	// ----- Return
1981
+	return $v_result;
1982 1982
   }
1983 1983
   // --------------------------------------------------------------------------------
1984 1984
 
@@ -1998,120 +1998,120 @@  discard block
 block discarded – undo
1998 1998
   // --------------------------------------------------------------------------------
1999 1999
   function privFileDescrExpand(&$p_filedescr_list, &$p_options)
2000 2000
   {
2001
-    $v_result=1;
2001
+	$v_result=1;
2002 2002
     
2003
-    // ----- Create a result list
2004
-    $v_result_list = array();
2003
+	// ----- Create a result list
2004
+	$v_result_list = array();
2005 2005
     
2006
-    // ----- Look each entry
2007
-    for ($i=0; $i<sizeof($p_filedescr_list); $i++) {
2006
+	// ----- Look each entry
2007
+	for ($i=0; $i<sizeof($p_filedescr_list); $i++) {
2008 2008
       
2009
-      // ----- Get filedescr
2010
-      $v_descr = $p_filedescr_list[$i];
2009
+	  // ----- Get filedescr
2010
+	  $v_descr = $p_filedescr_list[$i];
2011 2011
       
2012
-      // ----- Reduce the filename
2013
-      $v_descr['filename'] = PclZipUtilTranslateWinPath($v_descr['filename'], false);
2014
-      $v_descr['filename'] = PclZipUtilPathReduction($v_descr['filename']);
2012
+	  // ----- Reduce the filename
2013
+	  $v_descr['filename'] = PclZipUtilTranslateWinPath($v_descr['filename'], false);
2014
+	  $v_descr['filename'] = PclZipUtilPathReduction($v_descr['filename']);
2015 2015
       
2016
-      // ----- Look for real file or folder
2017
-      if (file_exists($v_descr['filename'])) {
2018
-        if (@is_file($v_descr['filename'])) {
2019
-          $v_descr['type'] = 'file';
2020
-        }
2021
-        else if (@is_dir($v_descr['filename'])) {
2022
-          $v_descr['type'] = 'folder';
2023
-        }
2024
-        else if (@is_link($v_descr['filename'])) {
2025
-          // skip
2026
-          continue;
2027
-        }
2028
-        else {
2029
-          // skip
2030
-          continue;
2031
-        }
2032
-      }
2016
+	  // ----- Look for real file or folder
2017
+	  if (file_exists($v_descr['filename'])) {
2018
+		if (@is_file($v_descr['filename'])) {
2019
+		  $v_descr['type'] = 'file';
2020
+		}
2021
+		else if (@is_dir($v_descr['filename'])) {
2022
+		  $v_descr['type'] = 'folder';
2023
+		}
2024
+		else if (@is_link($v_descr['filename'])) {
2025
+		  // skip
2026
+		  continue;
2027
+		}
2028
+		else {
2029
+		  // skip
2030
+		  continue;
2031
+		}
2032
+	  }
2033 2033
       
2034
-      // ----- Look for string added as file
2035
-      else if (isset($v_descr['content'])) {
2036
-        $v_descr['type'] = 'virtual_file';
2037
-      }
2034
+	  // ----- Look for string added as file
2035
+	  else if (isset($v_descr['content'])) {
2036
+		$v_descr['type'] = 'virtual_file';
2037
+	  }
2038 2038
       
2039
-      // ----- Missing file
2040
-      else {
2041
-        // ----- Error log
2042
-        PclZip::privErrorLog(PCLZIP_ERR_MISSING_FILE, "File '".$v_descr['filename']."' does not exist");
2039
+	  // ----- Missing file
2040
+	  else {
2041
+		// ----- Error log
2042
+		PclZip::privErrorLog(PCLZIP_ERR_MISSING_FILE, "File '".$v_descr['filename']."' does not exist");
2043 2043
 
2044
-        // ----- Return
2045
-        return PclZip::errorCode();
2046
-      }
2044
+		// ----- Return
2045
+		return PclZip::errorCode();
2046
+	  }
2047 2047
       
2048
-      // ----- Calculate the stored filename
2049
-      $this->privCalculateStoredFilename($v_descr, $p_options);
2048
+	  // ----- Calculate the stored filename
2049
+	  $this->privCalculateStoredFilename($v_descr, $p_options);
2050 2050
       
2051
-      // ----- Add the descriptor in result list
2052
-      $v_result_list[sizeof($v_result_list)] = $v_descr;
2051
+	  // ----- Add the descriptor in result list
2052
+	  $v_result_list[sizeof($v_result_list)] = $v_descr;
2053 2053
       
2054
-      // ----- Look for folder
2055
-      if ($v_descr['type'] == 'folder') {
2056
-        // ----- List of items in folder
2057
-        $v_dirlist_descr = array();
2058
-        $v_dirlist_nb = 0;
2059
-        if ($v_folder_handler = @opendir($v_descr['filename'])) {
2060
-          while (($v_item_handler = @readdir($v_folder_handler)) !== false) {
2061
-
2062
-            // ----- Skip '.' and '..'
2063
-            if (($v_item_handler == '.') || ($v_item_handler == '..')) {
2064
-                continue;
2065
-            }
2054
+	  // ----- Look for folder
2055
+	  if ($v_descr['type'] == 'folder') {
2056
+		// ----- List of items in folder
2057
+		$v_dirlist_descr = array();
2058
+		$v_dirlist_nb = 0;
2059
+		if ($v_folder_handler = @opendir($v_descr['filename'])) {
2060
+		  while (($v_item_handler = @readdir($v_folder_handler)) !== false) {
2061
+
2062
+			// ----- Skip '.' and '..'
2063
+			if (($v_item_handler == '.') || ($v_item_handler == '..')) {
2064
+				continue;
2065
+			}
2066 2066
             
2067
-            // ----- Compose the full filename
2068
-            $v_dirlist_descr[$v_dirlist_nb]['filename'] = $v_descr['filename'].'/'.$v_item_handler;
2067
+			// ----- Compose the full filename
2068
+			$v_dirlist_descr[$v_dirlist_nb]['filename'] = $v_descr['filename'].'/'.$v_item_handler;
2069 2069
             
2070
-            // ----- Look for different stored filename
2071
-            // Because the name of the folder was changed, the name of the
2072
-            // files/sub-folders also change
2073
-            if (($v_descr['stored_filename'] != $v_descr['filename'])
2074
-                 && (!isset($p_options[PCLZIP_OPT_REMOVE_ALL_PATH]))) {
2075
-              if ($v_descr['stored_filename'] != '') {
2076
-                $v_dirlist_descr[$v_dirlist_nb]['new_full_name'] = $v_descr['stored_filename'].'/'.$v_item_handler;
2077
-              }
2078
-              else {
2079
-                $v_dirlist_descr[$v_dirlist_nb]['new_full_name'] = $v_item_handler;
2080
-              }
2081
-            }
2070
+			// ----- Look for different stored filename
2071
+			// Because the name of the folder was changed, the name of the
2072
+			// files/sub-folders also change
2073
+			if (($v_descr['stored_filename'] != $v_descr['filename'])
2074
+				 && (!isset($p_options[PCLZIP_OPT_REMOVE_ALL_PATH]))) {
2075
+			  if ($v_descr['stored_filename'] != '') {
2076
+				$v_dirlist_descr[$v_dirlist_nb]['new_full_name'] = $v_descr['stored_filename'].'/'.$v_item_handler;
2077
+			  }
2078
+			  else {
2079
+				$v_dirlist_descr[$v_dirlist_nb]['new_full_name'] = $v_item_handler;
2080
+			  }
2081
+			}
2082 2082
       
2083
-            $v_dirlist_nb++;
2084
-          }
2083
+			$v_dirlist_nb++;
2084
+		  }
2085 2085
           
2086
-          @closedir($v_folder_handler);
2087
-        }
2088
-        else {
2089
-          // TBC : unable to open folder in read mode
2090
-        }
2086
+		  @closedir($v_folder_handler);
2087
+		}
2088
+		else {
2089
+		  // TBC : unable to open folder in read mode
2090
+		}
2091 2091
         
2092
-        // ----- Expand each element of the list
2093
-        if ($v_dirlist_nb != 0) {
2094
-          // ----- Expand
2095
-          if (($v_result = $this->privFileDescrExpand($v_dirlist_descr, $p_options)) != 1) {
2096
-            return $v_result;
2097
-          }
2092
+		// ----- Expand each element of the list
2093
+		if ($v_dirlist_nb != 0) {
2094
+		  // ----- Expand
2095
+		  if (($v_result = $this->privFileDescrExpand($v_dirlist_descr, $p_options)) != 1) {
2096
+			return $v_result;
2097
+		  }
2098 2098
           
2099
-          // ----- Concat the resulting list
2100
-          $v_result_list = array_merge($v_result_list, $v_dirlist_descr);
2101
-        }
2102
-        else {
2103
-        }
2099
+		  // ----- Concat the resulting list
2100
+		  $v_result_list = array_merge($v_result_list, $v_dirlist_descr);
2101
+		}
2102
+		else {
2103
+		}
2104 2104
           
2105
-        // ----- Free local array
2106
-        unset($v_dirlist_descr);
2107
-      }
2108
-    }
2105
+		// ----- Free local array
2106
+		unset($v_dirlist_descr);
2107
+	  }
2108
+	}
2109 2109
     
2110
-    // ----- Get the result list
2111
-    $p_filedescr_list = $v_result_list;
2110
+	// ----- Get the result list
2111
+	$p_filedescr_list = $v_result_list;
2112 2112
 
2113
-    // ----- Return
2114
-    return $v_result;
2113
+	// ----- Return
2114
+	return $v_result;
2115 2115
   }
2116 2116
   // --------------------------------------------------------------------------------
2117 2117
 
@@ -2123,30 +2123,30 @@  discard block
 block discarded – undo
2123 2123
   // --------------------------------------------------------------------------------
2124 2124
   function privCreate($p_filedescr_list, &$p_result_list, &$p_options)
2125 2125
   {
2126
-    $v_result=1;
2127
-    $v_list_detail = array();
2126
+	$v_result=1;
2127
+	$v_list_detail = array();
2128 2128
     
2129
-    // ----- Magic quotes trick
2130
-    $this->privDisableMagicQuotes();
2131
-
2132
-    // ----- Open the file in write mode
2133
-    if (($v_result = $this->privOpenFd('wb')) != 1)
2134
-    {
2135
-      // ----- Return
2136
-      return $v_result;
2137
-    }
2129
+	// ----- Magic quotes trick
2130
+	$this->privDisableMagicQuotes();
2131
+
2132
+	// ----- Open the file in write mode
2133
+	if (($v_result = $this->privOpenFd('wb')) != 1)
2134
+	{
2135
+	  // ----- Return
2136
+	  return $v_result;
2137
+	}
2138 2138
 
2139
-    // ----- Add the list of files
2140
-    $v_result = $this->privAddList($p_filedescr_list, $p_result_list, $p_options);
2139
+	// ----- Add the list of files
2140
+	$v_result = $this->privAddList($p_filedescr_list, $p_result_list, $p_options);
2141 2141
 
2142
-    // ----- Close
2143
-    $this->privCloseFd();
2142
+	// ----- Close
2143
+	$this->privCloseFd();
2144 2144
 
2145
-    // ----- Magic quotes trick
2146
-    $this->privSwapBackMagicQuotes();
2145
+	// ----- Magic quotes trick
2146
+	$this->privSwapBackMagicQuotes();
2147 2147
 
2148
-    // ----- Return
2149
-    return $v_result;
2148
+	// ----- Return
2149
+	return $v_result;
2150 2150
   }
2151 2151
   // --------------------------------------------------------------------------------
2152 2152
 
@@ -2158,175 +2158,175 @@  discard block
 block discarded – undo
2158 2158
   // --------------------------------------------------------------------------------
2159 2159
   function privAdd($p_filedescr_list, &$p_result_list, &$p_options)
2160 2160
   {
2161
-    $v_result=1;
2162
-    $v_list_detail = array();
2161
+	$v_result=1;
2162
+	$v_list_detail = array();
2163 2163
 
2164
-    // ----- Look if the archive exists or is empty
2165
-    if ((!is_file($this->zipname)) || (filesize($this->zipname) == 0))
2166
-    {
2164
+	// ----- Look if the archive exists or is empty
2165
+	if ((!is_file($this->zipname)) || (filesize($this->zipname) == 0))
2166
+	{
2167 2167
 
2168
-      // ----- Do a create
2169
-      $v_result = $this->privCreate($p_filedescr_list, $p_result_list, $p_options);
2168
+	  // ----- Do a create
2169
+	  $v_result = $this->privCreate($p_filedescr_list, $p_result_list, $p_options);
2170 2170
 
2171
-      // ----- Return
2172
-      return $v_result;
2173
-    }
2174
-    // ----- Magic quotes trick
2175
-    $this->privDisableMagicQuotes();
2171
+	  // ----- Return
2172
+	  return $v_result;
2173
+	}
2174
+	// ----- Magic quotes trick
2175
+	$this->privDisableMagicQuotes();
2176 2176
 
2177
-    // ----- Open the zip file
2178
-    if (($v_result=$this->privOpenFd('rb')) != 1)
2179
-    {
2180
-      // ----- Magic quotes trick
2181
-      $this->privSwapBackMagicQuotes();
2177
+	// ----- Open the zip file
2178
+	if (($v_result=$this->privOpenFd('rb')) != 1)
2179
+	{
2180
+	  // ----- Magic quotes trick
2181
+	  $this->privSwapBackMagicQuotes();
2182 2182
 
2183
-      // ----- Return
2184
-      return $v_result;
2185
-    }
2183
+	  // ----- Return
2184
+	  return $v_result;
2185
+	}
2186 2186
 
2187
-    // ----- Read the central directory informations
2188
-    $v_central_dir = array();
2189
-    if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1)
2190
-    {
2191
-      $this->privCloseFd();
2192
-      $this->privSwapBackMagicQuotes();
2193
-      return $v_result;
2194
-    }
2187
+	// ----- Read the central directory informations
2188
+	$v_central_dir = array();
2189
+	if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1)
2190
+	{
2191
+	  $this->privCloseFd();
2192
+	  $this->privSwapBackMagicQuotes();
2193
+	  return $v_result;
2194
+	}
2195 2195
 
2196
-    // ----- Go to beginning of File
2197
-    @rewind($this->zip_fd);
2196
+	// ----- Go to beginning of File
2197
+	@rewind($this->zip_fd);
2198 2198
 
2199
-    // ----- Creates a temporay file
2200
-    $v_zip_temp_name = PCLZIP_TEMPORARY_DIR.uniqid('pclzip-').'.tmp';
2199
+	// ----- Creates a temporay file
2200
+	$v_zip_temp_name = PCLZIP_TEMPORARY_DIR.uniqid('pclzip-').'.tmp';
2201 2201
 
2202
-    // ----- Open the temporary file in write mode
2203
-    if (($v_zip_temp_fd = @fopen($v_zip_temp_name, 'wb')) == 0)
2204
-    {
2205
-      $this->privCloseFd();
2206
-      $this->privSwapBackMagicQuotes();
2202
+	// ----- Open the temporary file in write mode
2203
+	if (($v_zip_temp_fd = @fopen($v_zip_temp_name, 'wb')) == 0)
2204
+	{
2205
+	  $this->privCloseFd();
2206
+	  $this->privSwapBackMagicQuotes();
2207 2207
 
2208
-      PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open temporary file \''.$v_zip_temp_name.'\' in binary write mode');
2208
+	  PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open temporary file \''.$v_zip_temp_name.'\' in binary write mode');
2209 2209
 
2210
-      // ----- Return
2211
-      return PclZip::errorCode();
2212
-    }
2210
+	  // ----- Return
2211
+	  return PclZip::errorCode();
2212
+	}
2213 2213
 
2214
-    // ----- Copy the files from the archive to the temporary file
2215
-    // TBC : Here I should better append the file and go back to erase the central dir
2216
-    $v_size = $v_central_dir['offset'];
2217
-    while ($v_size != 0)
2218
-    {
2219
-      $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
2220
-      $v_buffer = fread($this->zip_fd, $v_read_size);
2221
-      @fwrite($v_zip_temp_fd, $v_buffer, $v_read_size);
2222
-      $v_size -= $v_read_size;
2223
-    }
2214
+	// ----- Copy the files from the archive to the temporary file
2215
+	// TBC : Here I should better append the file and go back to erase the central dir
2216
+	$v_size = $v_central_dir['offset'];
2217
+	while ($v_size != 0)
2218
+	{
2219
+	  $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
2220
+	  $v_buffer = fread($this->zip_fd, $v_read_size);
2221
+	  @fwrite($v_zip_temp_fd, $v_buffer, $v_read_size);
2222
+	  $v_size -= $v_read_size;
2223
+	}
2224 2224
 
2225
-    // ----- Swap the file descriptor
2226
-    // Here is a trick : I swap the temporary fd with the zip fd, in order to use
2227
-    // the following methods on the temporary fil and not the real archive
2228
-    $v_swap = $this->zip_fd;
2229
-    $this->zip_fd = $v_zip_temp_fd;
2230
-    $v_zip_temp_fd = $v_swap;
2231
-
2232
-    // ----- Add the files
2233
-    $v_header_list = array();
2234
-    if (($v_result = $this->privAddFileList($p_filedescr_list, $v_header_list, $p_options)) != 1)
2235
-    {
2236
-      fclose($v_zip_temp_fd);
2237
-      $this->privCloseFd();
2238
-      @unlink($v_zip_temp_name);
2239
-      $this->privSwapBackMagicQuotes();
2240
-
2241
-      // ----- Return
2242
-      return $v_result;
2243
-    }
2225
+	// ----- Swap the file descriptor
2226
+	// Here is a trick : I swap the temporary fd with the zip fd, in order to use
2227
+	// the following methods on the temporary fil and not the real archive
2228
+	$v_swap = $this->zip_fd;
2229
+	$this->zip_fd = $v_zip_temp_fd;
2230
+	$v_zip_temp_fd = $v_swap;
2231
+
2232
+	// ----- Add the files
2233
+	$v_header_list = array();
2234
+	if (($v_result = $this->privAddFileList($p_filedescr_list, $v_header_list, $p_options)) != 1)
2235
+	{
2236
+	  fclose($v_zip_temp_fd);
2237
+	  $this->privCloseFd();
2238
+	  @unlink($v_zip_temp_name);
2239
+	  $this->privSwapBackMagicQuotes();
2240
+
2241
+	  // ----- Return
2242
+	  return $v_result;
2243
+	}
2244 2244
 
2245
-    // ----- Store the offset of the central dir
2246
-    $v_offset = @ftell($this->zip_fd);
2247
-
2248
-    // ----- Copy the block of file headers from the old archive
2249
-    $v_size = $v_central_dir['size'];
2250
-    while ($v_size != 0)
2251
-    {
2252
-      $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
2253
-      $v_buffer = @fread($v_zip_temp_fd, $v_read_size);
2254
-      @fwrite($this->zip_fd, $v_buffer, $v_read_size);
2255
-      $v_size -= $v_read_size;
2256
-    }
2245
+	// ----- Store the offset of the central dir
2246
+	$v_offset = @ftell($this->zip_fd);
2247
+
2248
+	// ----- Copy the block of file headers from the old archive
2249
+	$v_size = $v_central_dir['size'];
2250
+	while ($v_size != 0)
2251
+	{
2252
+	  $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
2253
+	  $v_buffer = @fread($v_zip_temp_fd, $v_read_size);
2254
+	  @fwrite($this->zip_fd, $v_buffer, $v_read_size);
2255
+	  $v_size -= $v_read_size;
2256
+	}
2257 2257
 
2258
-    // ----- Create the Central Dir files header
2259
-    for ($i=0, $v_count=0; $i<sizeof($v_header_list); $i++)
2260
-    {
2261
-      // ----- Create the file header
2262
-      if ($v_header_list[$i]['status'] == 'ok') {
2263
-        if (($v_result = $this->privWriteCentralFileHeader($v_header_list[$i])) != 1) {
2264
-          fclose($v_zip_temp_fd);
2265
-          $this->privCloseFd();
2266
-          @unlink($v_zip_temp_name);
2267
-          $this->privSwapBackMagicQuotes();
2268
-
2269
-          // ----- Return
2270
-          return $v_result;
2271
-        }
2272
-        $v_count++;
2273
-      }
2258
+	// ----- Create the Central Dir files header
2259
+	for ($i=0, $v_count=0; $i<sizeof($v_header_list); $i++)
2260
+	{
2261
+	  // ----- Create the file header
2262
+	  if ($v_header_list[$i]['status'] == 'ok') {
2263
+		if (($v_result = $this->privWriteCentralFileHeader($v_header_list[$i])) != 1) {
2264
+		  fclose($v_zip_temp_fd);
2265
+		  $this->privCloseFd();
2266
+		  @unlink($v_zip_temp_name);
2267
+		  $this->privSwapBackMagicQuotes();
2268
+
2269
+		  // ----- Return
2270
+		  return $v_result;
2271
+		}
2272
+		$v_count++;
2273
+	  }
2274 2274
 
2275
-      // ----- Transform the header to a 'usable' info
2276
-      $this->privConvertHeader2FileInfo($v_header_list[$i], $p_result_list[$i]);
2277
-    }
2275
+	  // ----- Transform the header to a 'usable' info
2276
+	  $this->privConvertHeader2FileInfo($v_header_list[$i], $p_result_list[$i]);
2277
+	}
2278 2278
 
2279
-    // ----- Zip file comment
2280
-    $v_comment = $v_central_dir['comment'];
2281
-    if (isset($p_options[PCLZIP_OPT_COMMENT])) {
2282
-      $v_comment = $p_options[PCLZIP_OPT_COMMENT];
2283
-    }
2284
-    if (isset($p_options[PCLZIP_OPT_ADD_COMMENT])) {
2285
-      $v_comment = $v_comment.$p_options[PCLZIP_OPT_ADD_COMMENT];
2286
-    }
2287
-    if (isset($p_options[PCLZIP_OPT_PREPEND_COMMENT])) {
2288
-      $v_comment = $p_options[PCLZIP_OPT_PREPEND_COMMENT].$v_comment;
2289
-    }
2279
+	// ----- Zip file comment
2280
+	$v_comment = $v_central_dir['comment'];
2281
+	if (isset($p_options[PCLZIP_OPT_COMMENT])) {
2282
+	  $v_comment = $p_options[PCLZIP_OPT_COMMENT];
2283
+	}
2284
+	if (isset($p_options[PCLZIP_OPT_ADD_COMMENT])) {
2285
+	  $v_comment = $v_comment.$p_options[PCLZIP_OPT_ADD_COMMENT];
2286
+	}
2287
+	if (isset($p_options[PCLZIP_OPT_PREPEND_COMMENT])) {
2288
+	  $v_comment = $p_options[PCLZIP_OPT_PREPEND_COMMENT].$v_comment;
2289
+	}
2290 2290
 
2291
-    // ----- Calculate the size of the central header
2292
-    $v_size = @ftell($this->zip_fd)-$v_offset;
2291
+	// ----- Calculate the size of the central header
2292
+	$v_size = @ftell($this->zip_fd)-$v_offset;
2293 2293
 
2294
-    // ----- Create the central dir footer
2295
-    if (($v_result = $this->privWriteCentralHeader($v_count+$v_central_dir['entries'], $v_size, $v_offset, $v_comment)) != 1)
2296
-    {
2297
-      // ----- Reset the file list
2298
-      unset($v_header_list);
2299
-      $this->privSwapBackMagicQuotes();
2294
+	// ----- Create the central dir footer
2295
+	if (($v_result = $this->privWriteCentralHeader($v_count+$v_central_dir['entries'], $v_size, $v_offset, $v_comment)) != 1)
2296
+	{
2297
+	  // ----- Reset the file list
2298
+	  unset($v_header_list);
2299
+	  $this->privSwapBackMagicQuotes();
2300 2300
 
2301
-      // ----- Return
2302
-      return $v_result;
2303
-    }
2301
+	  // ----- Return
2302
+	  return $v_result;
2303
+	}
2304 2304
 
2305
-    // ----- Swap back the file descriptor
2306
-    $v_swap = $this->zip_fd;
2307
-    $this->zip_fd = $v_zip_temp_fd;
2308
-    $v_zip_temp_fd = $v_swap;
2305
+	// ----- Swap back the file descriptor
2306
+	$v_swap = $this->zip_fd;
2307
+	$this->zip_fd = $v_zip_temp_fd;
2308
+	$v_zip_temp_fd = $v_swap;
2309 2309
 
2310
-    // ----- Close
2311
-    $this->privCloseFd();
2310
+	// ----- Close
2311
+	$this->privCloseFd();
2312 2312
 
2313
-    // ----- Close the temporary file
2314
-    @fclose($v_zip_temp_fd);
2313
+	// ----- Close the temporary file
2314
+	@fclose($v_zip_temp_fd);
2315 2315
 
2316
-    // ----- Magic quotes trick
2317
-    $this->privSwapBackMagicQuotes();
2316
+	// ----- Magic quotes trick
2317
+	$this->privSwapBackMagicQuotes();
2318 2318
 
2319
-    // ----- Delete the zip file
2320
-    // TBC : I should test the result ...
2321
-    @unlink($this->zipname);
2319
+	// ----- Delete the zip file
2320
+	// TBC : I should test the result ...
2321
+	@unlink($this->zipname);
2322 2322
 
2323
-    // ----- Rename the temporary file
2324
-    // TBC : I should test the result ...
2325
-    //@rename($v_zip_temp_name, $this->zipname);
2326
-    PclZipUtilRename($v_zip_temp_name, $this->zipname);
2323
+	// ----- Rename the temporary file
2324
+	// TBC : I should test the result ...
2325
+	//@rename($v_zip_temp_name, $this->zipname);
2326
+	PclZipUtilRename($v_zip_temp_name, $this->zipname);
2327 2327
 
2328
-    // ----- Return
2329
-    return $v_result;
2328
+	// ----- Return
2329
+	return $v_result;
2330 2330
   }
2331 2331
   // --------------------------------------------------------------------------------
2332 2332
 
@@ -2337,30 +2337,30 @@  discard block
 block discarded – undo
2337 2337
   // --------------------------------------------------------------------------------
2338 2338
   function privOpenFd($p_mode)
2339 2339
   {
2340
-    $v_result=1;
2340
+	$v_result=1;
2341 2341
 
2342
-    // ----- Look if already open
2343
-    if ($this->zip_fd != 0)
2344
-    {
2345
-      // ----- Error log
2346
-      PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Zip file \''.$this->zipname.'\' already open');
2342
+	// ----- Look if already open
2343
+	if ($this->zip_fd != 0)
2344
+	{
2345
+	  // ----- Error log
2346
+	  PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Zip file \''.$this->zipname.'\' already open');
2347 2347
 
2348
-      // ----- Return
2349
-      return PclZip::errorCode();
2350
-    }
2348
+	  // ----- Return
2349
+	  return PclZip::errorCode();
2350
+	}
2351 2351
 
2352
-    // ----- Open the zip file
2353
-    if (($this->zip_fd = @fopen($this->zipname, $p_mode)) == 0)
2354
-    {
2355
-      // ----- Error log
2356
-      PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open archive \''.$this->zipname.'\' in '.$p_mode.' mode');
2352
+	// ----- Open the zip file
2353
+	if (($this->zip_fd = @fopen($this->zipname, $p_mode)) == 0)
2354
+	{
2355
+	  // ----- Error log
2356
+	  PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open archive \''.$this->zipname.'\' in '.$p_mode.' mode');
2357 2357
 
2358
-      // ----- Return
2359
-      return PclZip::errorCode();
2360
-    }
2358
+	  // ----- Return
2359
+	  return PclZip::errorCode();
2360
+	}
2361 2361
 
2362
-    // ----- Return
2363
-    return $v_result;
2362
+	// ----- Return
2363
+	return $v_result;
2364 2364
   }
2365 2365
   // --------------------------------------------------------------------------------
2366 2366
 
@@ -2371,14 +2371,14 @@  discard block
 block discarded – undo
2371 2371
   // --------------------------------------------------------------------------------
2372 2372
   function privCloseFd()
2373 2373
   {
2374
-    $v_result=1;
2374
+	$v_result=1;
2375 2375
 
2376
-    if ($this->zip_fd != 0)
2377
-      @fclose($this->zip_fd);
2378
-    $this->zip_fd = 0;
2376
+	if ($this->zip_fd != 0)
2377
+	  @fclose($this->zip_fd);
2378
+	$this->zip_fd = 0;
2379 2379
 
2380
-    // ----- Return
2381
-    return $v_result;
2380
+	// ----- Return
2381
+	return $v_result;
2382 2382
   }
2383 2383
   // --------------------------------------------------------------------------------
2384 2384
 
@@ -2398,56 +2398,56 @@  discard block
 block discarded – undo
2398 2398
 //  function privAddList($p_list, &$p_result_list, $p_add_dir, $p_remove_dir, $p_remove_all_dir, &$p_options)
2399 2399
   function privAddList($p_filedescr_list, &$p_result_list, &$p_options)
2400 2400
   {
2401
-    $v_result=1;
2402
-
2403
-    // ----- Add the files
2404
-    $v_header_list = array();
2405
-    if (($v_result = $this->privAddFileList($p_filedescr_list, $v_header_list, $p_options)) != 1)
2406
-    {
2407
-      // ----- Return
2408
-      return $v_result;
2409
-    }
2401
+	$v_result=1;
2402
+
2403
+	// ----- Add the files
2404
+	$v_header_list = array();
2405
+	if (($v_result = $this->privAddFileList($p_filedescr_list, $v_header_list, $p_options)) != 1)
2406
+	{
2407
+	  // ----- Return
2408
+	  return $v_result;
2409
+	}
2410 2410
 
2411
-    // ----- Store the offset of the central dir
2412
-    $v_offset = @ftell($this->zip_fd);
2413
-
2414
-    // ----- Create the Central Dir files header
2415
-    for ($i=0,$v_count=0; $i<sizeof($v_header_list); $i++)
2416
-    {
2417
-      // ----- Create the file header
2418
-      if ($v_header_list[$i]['status'] == 'ok') {
2419
-        if (($v_result = $this->privWriteCentralFileHeader($v_header_list[$i])) != 1) {
2420
-          // ----- Return
2421
-          return $v_result;
2422
-        }
2423
-        $v_count++;
2424
-      }
2411
+	// ----- Store the offset of the central dir
2412
+	$v_offset = @ftell($this->zip_fd);
2413
+
2414
+	// ----- Create the Central Dir files header
2415
+	for ($i=0,$v_count=0; $i<sizeof($v_header_list); $i++)
2416
+	{
2417
+	  // ----- Create the file header
2418
+	  if ($v_header_list[$i]['status'] == 'ok') {
2419
+		if (($v_result = $this->privWriteCentralFileHeader($v_header_list[$i])) != 1) {
2420
+		  // ----- Return
2421
+		  return $v_result;
2422
+		}
2423
+		$v_count++;
2424
+	  }
2425 2425
 
2426
-      // ----- Transform the header to a 'usable' info
2427
-      $this->privConvertHeader2FileInfo($v_header_list[$i], $p_result_list[$i]);
2428
-    }
2426
+	  // ----- Transform the header to a 'usable' info
2427
+	  $this->privConvertHeader2FileInfo($v_header_list[$i], $p_result_list[$i]);
2428
+	}
2429 2429
 
2430
-    // ----- Zip file comment
2431
-    $v_comment = '';
2432
-    if (isset($p_options[PCLZIP_OPT_COMMENT])) {
2433
-      $v_comment = $p_options[PCLZIP_OPT_COMMENT];
2434
-    }
2430
+	// ----- Zip file comment
2431
+	$v_comment = '';
2432
+	if (isset($p_options[PCLZIP_OPT_COMMENT])) {
2433
+	  $v_comment = $p_options[PCLZIP_OPT_COMMENT];
2434
+	}
2435 2435
 
2436
-    // ----- Calculate the size of the central header
2437
-    $v_size = @ftell($this->zip_fd)-$v_offset;
2436
+	// ----- Calculate the size of the central header
2437
+	$v_size = @ftell($this->zip_fd)-$v_offset;
2438 2438
 
2439
-    // ----- Create the central dir footer
2440
-    if (($v_result = $this->privWriteCentralHeader($v_count, $v_size, $v_offset, $v_comment)) != 1)
2441
-    {
2442
-      // ----- Reset the file list
2443
-      unset($v_header_list);
2439
+	// ----- Create the central dir footer
2440
+	if (($v_result = $this->privWriteCentralHeader($v_count, $v_size, $v_offset, $v_comment)) != 1)
2441
+	{
2442
+	  // ----- Reset the file list
2443
+	  unset($v_header_list);
2444 2444
 
2445
-      // ----- Return
2446
-      return $v_result;
2447
-    }
2445
+	  // ----- Return
2446
+	  return $v_result;
2447
+	}
2448 2448
 
2449
-    // ----- Return
2450
-    return $v_result;
2449
+	// ----- Return
2450
+	return $v_result;
2451 2451
   }
2452 2452
   // --------------------------------------------------------------------------------
2453 2453
 
@@ -2462,57 +2462,57 @@  discard block
 block discarded – undo
2462 2462
   // --------------------------------------------------------------------------------
2463 2463
   function privAddFileList($p_filedescr_list, &$p_result_list, &$p_options)
2464 2464
   {
2465
-    $v_result=1;
2466
-    $v_header = array();
2465
+	$v_result=1;
2466
+	$v_header = array();
2467 2467
 
2468
-    // ----- Recuperate the current number of elt in list
2469
-    $v_nb = sizeof($p_result_list);
2468
+	// ----- Recuperate the current number of elt in list
2469
+	$v_nb = sizeof($p_result_list);
2470 2470
 
2471
-    // ----- Loop on the files
2472
-    for ($j=0; ($j<sizeof($p_filedescr_list)) && ($v_result==1); $j++) {
2473
-      // ----- Format the filename
2474
-      $p_filedescr_list[$j]['filename']
2475
-      = PclZipUtilTranslateWinPath($p_filedescr_list[$j]['filename'], false);
2471
+	// ----- Loop on the files
2472
+	for ($j=0; ($j<sizeof($p_filedescr_list)) && ($v_result==1); $j++) {
2473
+	  // ----- Format the filename
2474
+	  $p_filedescr_list[$j]['filename']
2475
+	  = PclZipUtilTranslateWinPath($p_filedescr_list[$j]['filename'], false);
2476 2476
       
2477 2477
 
2478
-      // ----- Skip empty file names
2479
-      // TBC : Can this be possible ? not checked in DescrParseAtt ?
2480
-      if ($p_filedescr_list[$j]['filename'] == "") {
2481
-        continue;
2482
-      }
2478
+	  // ----- Skip empty file names
2479
+	  // TBC : Can this be possible ? not checked in DescrParseAtt ?
2480
+	  if ($p_filedescr_list[$j]['filename'] == "") {
2481
+		continue;
2482
+	  }
2483 2483
 
2484
-      // ----- Check the filename
2485
-      if (   ($p_filedescr_list[$j]['type'] != 'virtual_file')
2486
-          && (!file_exists($p_filedescr_list[$j]['filename']))) {
2487
-        PclZip::privErrorLog(PCLZIP_ERR_MISSING_FILE, "File '".$p_filedescr_list[$j]['filename']."' does not exist");
2488
-        return PclZip::errorCode();
2489
-      }
2484
+	  // ----- Check the filename
2485
+	  if (   ($p_filedescr_list[$j]['type'] != 'virtual_file')
2486
+		  && (!file_exists($p_filedescr_list[$j]['filename']))) {
2487
+		PclZip::privErrorLog(PCLZIP_ERR_MISSING_FILE, "File '".$p_filedescr_list[$j]['filename']."' does not exist");
2488
+		return PclZip::errorCode();
2489
+	  }
2490 2490
 
2491
-      // ----- Look if it is a file or a dir with no all path remove option
2492
-      // or a dir with all its path removed
2491
+	  // ----- Look if it is a file or a dir with no all path remove option
2492
+	  // or a dir with all its path removed
2493 2493
 //      if (   (is_file($p_filedescr_list[$j]['filename']))
2494 2494
 //          || (   is_dir($p_filedescr_list[$j]['filename'])
2495
-      if (   ($p_filedescr_list[$j]['type'] == 'file')
2496
-          || ($p_filedescr_list[$j]['type'] == 'virtual_file')
2497
-          || (   ($p_filedescr_list[$j]['type'] == 'folder')
2498
-              && (   !isset($p_options[PCLZIP_OPT_REMOVE_ALL_PATH])
2499
-                  || !$p_options[PCLZIP_OPT_REMOVE_ALL_PATH]))
2500
-          ) {
2501
-
2502
-        // ----- Add the file
2503
-        $v_result = $this->privAddFile($p_filedescr_list[$j], $v_header,
2504
-                                       $p_options);
2505
-        if ($v_result != 1) {
2506
-          return $v_result;
2507
-        }
2508
-
2509
-        // ----- Store the file infos
2510
-        $p_result_list[$v_nb++] = $v_header;
2511
-      }
2512
-    }
2495
+	  if (   ($p_filedescr_list[$j]['type'] == 'file')
2496
+		  || ($p_filedescr_list[$j]['type'] == 'virtual_file')
2497
+		  || (   ($p_filedescr_list[$j]['type'] == 'folder')
2498
+			  && (   !isset($p_options[PCLZIP_OPT_REMOVE_ALL_PATH])
2499
+				  || !$p_options[PCLZIP_OPT_REMOVE_ALL_PATH]))
2500
+		  ) {
2501
+
2502
+		// ----- Add the file
2503
+		$v_result = $this->privAddFile($p_filedescr_list[$j], $v_header,
2504
+									   $p_options);
2505
+		if ($v_result != 1) {
2506
+		  return $v_result;
2507
+		}
2508
+
2509
+		// ----- Store the file infos
2510
+		$p_result_list[$v_nb++] = $v_header;
2511
+	  }
2512
+	}
2513 2513
 
2514
-    // ----- Return
2515
-    return $v_result;
2514
+	// ----- Return
2515
+	return $v_result;
2516 2516
   }
2517 2517
   // --------------------------------------------------------------------------------
2518 2518
 
@@ -2524,22 +2524,22 @@  discard block
 block discarded – undo
2524 2524
   // --------------------------------------------------------------------------------
2525 2525
   function privAddFile($p_filedescr, &$p_header, &$p_options)
2526 2526
   {
2527
-    $v_result=1;
2527
+	$v_result=1;
2528 2528
     
2529
-    // ----- Working variable
2530
-    $p_filename = $p_filedescr['filename'];
2529
+	// ----- Working variable
2530
+	$p_filename = $p_filedescr['filename'];
2531 2531
 
2532
-    // TBC : Already done in the fileAtt check ... ?
2533
-    if ($p_filename == "") {
2534
-      // ----- Error log
2535
-      PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid file list parameter (invalid or empty list)");
2532
+	// TBC : Already done in the fileAtt check ... ?
2533
+	if ($p_filename == "") {
2534
+	  // ----- Error log
2535
+	  PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid file list parameter (invalid or empty list)");
2536 2536
 
2537
-      // ----- Return
2538
-      return PclZip::errorCode();
2539
-    }
2537
+	  // ----- Return
2538
+	  return PclZip::errorCode();
2539
+	}
2540 2540
   
2541
-    // ----- Look for a stored different filename 
2542
-    /* TBC : Removed
2541
+	// ----- Look for a stored different filename 
2542
+	/* TBC : Removed
2543 2543
     if (isset($p_filedescr['stored_filename'])) {
2544 2544
       $v_stored_filename = $p_filedescr['stored_filename'];
2545 2545
     }
@@ -2548,244 +2548,244 @@  discard block
 block discarded – undo
2548 2548
     }
2549 2549
     */
2550 2550
 
2551
-    // ----- Set the file properties
2552
-    clearstatcache();
2553
-    $p_header['version'] = 20;
2554
-    $p_header['version_extracted'] = 10;
2555
-    $p_header['flag'] = 0;
2556
-    $p_header['compression'] = 0;
2557
-    $p_header['crc'] = 0;
2558
-    $p_header['compressed_size'] = 0;
2559
-    $p_header['filename_len'] = strlen($p_filename);
2560
-    $p_header['extra_len'] = 0;
2561
-    $p_header['disk'] = 0;
2562
-    $p_header['internal'] = 0;
2563
-    $p_header['offset'] = 0;
2564
-    $p_header['filename'] = $p_filename;
2551
+	// ----- Set the file properties
2552
+	clearstatcache();
2553
+	$p_header['version'] = 20;
2554
+	$p_header['version_extracted'] = 10;
2555
+	$p_header['flag'] = 0;
2556
+	$p_header['compression'] = 0;
2557
+	$p_header['crc'] = 0;
2558
+	$p_header['compressed_size'] = 0;
2559
+	$p_header['filename_len'] = strlen($p_filename);
2560
+	$p_header['extra_len'] = 0;
2561
+	$p_header['disk'] = 0;
2562
+	$p_header['internal'] = 0;
2563
+	$p_header['offset'] = 0;
2564
+	$p_header['filename'] = $p_filename;
2565 2565
 // TBC : Removed    $p_header['stored_filename'] = $v_stored_filename;
2566
-    $p_header['stored_filename'] = $p_filedescr['stored_filename'];
2567
-    $p_header['extra'] = '';
2568
-    $p_header['status'] = 'ok';
2569
-    $p_header['index'] = -1;
2570
-
2571
-    // ----- Look for regular file
2572
-    if ($p_filedescr['type']=='file') {
2573
-      $p_header['external'] = 0x00000000;
2574
-      $p_header['size'] = filesize($p_filename);
2575
-    }
2566
+	$p_header['stored_filename'] = $p_filedescr['stored_filename'];
2567
+	$p_header['extra'] = '';
2568
+	$p_header['status'] = 'ok';
2569
+	$p_header['index'] = -1;
2570
+
2571
+	// ----- Look for regular file
2572
+	if ($p_filedescr['type']=='file') {
2573
+	  $p_header['external'] = 0x00000000;
2574
+	  $p_header['size'] = filesize($p_filename);
2575
+	}
2576 2576
     
2577
-    // ----- Look for regular folder
2578
-    else if ($p_filedescr['type']=='folder') {
2579
-      $p_header['external'] = 0x00000010;
2580
-      $p_header['mtime'] = filemtime($p_filename);
2581
-      $p_header['size'] = filesize($p_filename);
2582
-    }
2577
+	// ----- Look for regular folder
2578
+	else if ($p_filedescr['type']=='folder') {
2579
+	  $p_header['external'] = 0x00000010;
2580
+	  $p_header['mtime'] = filemtime($p_filename);
2581
+	  $p_header['size'] = filesize($p_filename);
2582
+	}
2583 2583
     
2584
-    // ----- Look for virtual file
2585
-    else if ($p_filedescr['type'] == 'virtual_file') {
2586
-      $p_header['external'] = 0x00000000;
2587
-      $p_header['size'] = strlen($p_filedescr['content']);
2588
-    }
2584
+	// ----- Look for virtual file
2585
+	else if ($p_filedescr['type'] == 'virtual_file') {
2586
+	  $p_header['external'] = 0x00000000;
2587
+	  $p_header['size'] = strlen($p_filedescr['content']);
2588
+	}
2589 2589
     
2590 2590
 
2591
-    // ----- Look for filetime
2592
-    if (isset($p_filedescr['mtime'])) {
2593
-      $p_header['mtime'] = $p_filedescr['mtime'];
2594
-    }
2595
-    else if ($p_filedescr['type'] == 'virtual_file') {
2596
-      $p_header['mtime'] = time();
2597
-    }
2598
-    else {
2599
-      $p_header['mtime'] = filemtime($p_filename);
2600
-    }
2591
+	// ----- Look for filetime
2592
+	if (isset($p_filedescr['mtime'])) {
2593
+	  $p_header['mtime'] = $p_filedescr['mtime'];
2594
+	}
2595
+	else if ($p_filedescr['type'] == 'virtual_file') {
2596
+	  $p_header['mtime'] = time();
2597
+	}
2598
+	else {
2599
+	  $p_header['mtime'] = filemtime($p_filename);
2600
+	}
2601 2601
 
2602
-    // ------ Look for file comment
2603
-    if (isset($p_filedescr['comment'])) {
2604
-      $p_header['comment_len'] = strlen($p_filedescr['comment']);
2605
-      $p_header['comment'] = $p_filedescr['comment'];
2606
-    }
2607
-    else {
2608
-      $p_header['comment_len'] = 0;
2609
-      $p_header['comment'] = '';
2610
-    }
2602
+	// ------ Look for file comment
2603
+	if (isset($p_filedescr['comment'])) {
2604
+	  $p_header['comment_len'] = strlen($p_filedescr['comment']);
2605
+	  $p_header['comment'] = $p_filedescr['comment'];
2606
+	}
2607
+	else {
2608
+	  $p_header['comment_len'] = 0;
2609
+	  $p_header['comment'] = '';
2610
+	}
2611 2611
 
2612
-    // ----- Look for pre-add callback
2613
-    if (isset($p_options[PCLZIP_CB_PRE_ADD])) {
2612
+	// ----- Look for pre-add callback
2613
+	if (isset($p_options[PCLZIP_CB_PRE_ADD])) {
2614 2614
 
2615
-      // ----- Generate a local information
2616
-      $v_local_header = array();
2617
-      $this->privConvertHeader2FileInfo($p_header, $v_local_header);
2615
+	  // ----- Generate a local information
2616
+	  $v_local_header = array();
2617
+	  $this->privConvertHeader2FileInfo($p_header, $v_local_header);
2618 2618
 
2619
-      // ----- Call the callback
2620
-      // Here I do not use call_user_func() because I need to send a reference to the
2621
-      // header.
2619
+	  // ----- Call the callback
2620
+	  // Here I do not use call_user_func() because I need to send a reference to the
2621
+	  // header.
2622 2622
 //      eval('$v_result = '.$p_options[PCLZIP_CB_PRE_ADD].'(PCLZIP_CB_PRE_ADD, $v_local_header);');
2623
-      $v_result = $p_options[PCLZIP_CB_PRE_ADD](PCLZIP_CB_PRE_ADD, $v_local_header);
2624
-      if ($v_result == 0) {
2625
-        // ----- Change the file status
2626
-        $p_header['status'] = "skipped";
2627
-        $v_result = 1;
2628
-      }
2623
+	  $v_result = $p_options[PCLZIP_CB_PRE_ADD](PCLZIP_CB_PRE_ADD, $v_local_header);
2624
+	  if ($v_result == 0) {
2625
+		// ----- Change the file status
2626
+		$p_header['status'] = "skipped";
2627
+		$v_result = 1;
2628
+	  }
2629 2629
 
2630
-      // ----- Update the informations
2631
-      // Only some fields can be modified
2632
-      if ($p_header['stored_filename'] != $v_local_header['stored_filename']) {
2633
-        $p_header['stored_filename'] = PclZipUtilPathReduction($v_local_header['stored_filename']);
2634
-      }
2635
-    }
2630
+	  // ----- Update the informations
2631
+	  // Only some fields can be modified
2632
+	  if ($p_header['stored_filename'] != $v_local_header['stored_filename']) {
2633
+		$p_header['stored_filename'] = PclZipUtilPathReduction($v_local_header['stored_filename']);
2634
+	  }
2635
+	}
2636 2636
 
2637
-    // ----- Look for empty stored filename
2638
-    if ($p_header['stored_filename'] == "") {
2639
-      $p_header['status'] = "filtered";
2640
-    }
2637
+	// ----- Look for empty stored filename
2638
+	if ($p_header['stored_filename'] == "") {
2639
+	  $p_header['status'] = "filtered";
2640
+	}
2641 2641
     
2642
-    // ----- Check the path length
2643
-    if (strlen($p_header['stored_filename']) > 0xFF) {
2644
-      $p_header['status'] = 'filename_too_long';
2645
-    }
2642
+	// ----- Check the path length
2643
+	if (strlen($p_header['stored_filename']) > 0xFF) {
2644
+	  $p_header['status'] = 'filename_too_long';
2645
+	}
2646 2646
 
2647
-    // ----- Look if no error, or file not skipped
2648
-    if ($p_header['status'] == 'ok') {
2649
-
2650
-      // ----- Look for a file
2651
-      if ($p_filedescr['type'] == 'file') {
2652
-        // ----- Look for using temporary file to zip
2653
-        if ( (!isset($p_options[PCLZIP_OPT_TEMP_FILE_OFF])) 
2654
-            && (isset($p_options[PCLZIP_OPT_TEMP_FILE_ON])
2655
-                || (isset($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD])
2656
-                    && ($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD] <= $p_header['size'])) ) ) {
2657
-          $v_result = $this->privAddFileUsingTempFile($p_filedescr, $p_header, $p_options);
2658
-          if ($v_result < PCLZIP_ERR_NO_ERROR) {
2659
-            return $v_result;
2660
-          }
2661
-        }
2647
+	// ----- Look if no error, or file not skipped
2648
+	if ($p_header['status'] == 'ok') {
2649
+
2650
+	  // ----- Look for a file
2651
+	  if ($p_filedescr['type'] == 'file') {
2652
+		// ----- Look for using temporary file to zip
2653
+		if ( (!isset($p_options[PCLZIP_OPT_TEMP_FILE_OFF])) 
2654
+			&& (isset($p_options[PCLZIP_OPT_TEMP_FILE_ON])
2655
+				|| (isset($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD])
2656
+					&& ($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD] <= $p_header['size'])) ) ) {
2657
+		  $v_result = $this->privAddFileUsingTempFile($p_filedescr, $p_header, $p_options);
2658
+		  if ($v_result < PCLZIP_ERR_NO_ERROR) {
2659
+			return $v_result;
2660
+		  }
2661
+		}
2662 2662
         
2663
-        // ----- Use "in memory" zip algo
2664
-        else {
2663
+		// ----- Use "in memory" zip algo
2664
+		else {
2665 2665
 
2666
-        // ----- Open the source file
2667
-        if (($v_file = @fopen($p_filename, "rb")) == 0) {
2668
-          PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, "Unable to open file '$p_filename' in binary read mode");
2669
-          return PclZip::errorCode();
2670
-        }
2666
+		// ----- Open the source file
2667
+		if (($v_file = @fopen($p_filename, "rb")) == 0) {
2668
+		  PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, "Unable to open file '$p_filename' in binary read mode");
2669
+		  return PclZip::errorCode();
2670
+		}
2671 2671
 
2672
-        // ----- Read the file content
2673
-        $v_content = @fread($v_file, $p_header['size']);
2672
+		// ----- Read the file content
2673
+		$v_content = @fread($v_file, $p_header['size']);
2674 2674
 
2675
-        // ----- Close the file
2676
-        @fclose($v_file);
2675
+		// ----- Close the file
2676
+		@fclose($v_file);
2677 2677
 
2678
-        // ----- Calculate the CRC
2679
-        $p_header['crc'] = @crc32($v_content);
2678
+		// ----- Calculate the CRC
2679
+		$p_header['crc'] = @crc32($v_content);
2680 2680
         
2681
-        // ----- Look for no compression
2682
-        if ($p_options[PCLZIP_OPT_NO_COMPRESSION]) {
2683
-          // ----- Set header parameters
2684
-          $p_header['compressed_size'] = $p_header['size'];
2685
-          $p_header['compression'] = 0;
2686
-        }
2681
+		// ----- Look for no compression
2682
+		if ($p_options[PCLZIP_OPT_NO_COMPRESSION]) {
2683
+		  // ----- Set header parameters
2684
+		  $p_header['compressed_size'] = $p_header['size'];
2685
+		  $p_header['compression'] = 0;
2686
+		}
2687 2687
         
2688
-        // ----- Look for normal compression
2689
-        else {
2690
-          // ----- Compress the content
2691
-          $v_content = @gzdeflate($v_content);
2692
-
2693
-          // ----- Set header parameters
2694
-          $p_header['compressed_size'] = strlen($v_content);
2695
-          $p_header['compression'] = 8;
2696
-        }
2688
+		// ----- Look for normal compression
2689
+		else {
2690
+		  // ----- Compress the content
2691
+		  $v_content = @gzdeflate($v_content);
2692
+
2693
+		  // ----- Set header parameters
2694
+		  $p_header['compressed_size'] = strlen($v_content);
2695
+		  $p_header['compression'] = 8;
2696
+		}
2697 2697
         
2698
-        // ----- Call the header generation
2699
-        if (($v_result = $this->privWriteFileHeader($p_header)) != 1) {
2700
-          @fclose($v_file);
2701
-          return $v_result;
2702
-        }
2698
+		// ----- Call the header generation
2699
+		if (($v_result = $this->privWriteFileHeader($p_header)) != 1) {
2700
+		  @fclose($v_file);
2701
+		  return $v_result;
2702
+		}
2703 2703
 
2704
-        // ----- Write the compressed (or not) content
2705
-        @fwrite($this->zip_fd, $v_content, $p_header['compressed_size']);
2704
+		// ----- Write the compressed (or not) content
2705
+		@fwrite($this->zip_fd, $v_content, $p_header['compressed_size']);
2706 2706
 
2707
-        }
2707
+		}
2708 2708
 
2709
-      }
2709
+	  }
2710 2710
 
2711
-      // ----- Look for a virtual file (a file from string)
2712
-      else if ($p_filedescr['type'] == 'virtual_file') {
2711
+	  // ----- Look for a virtual file (a file from string)
2712
+	  else if ($p_filedescr['type'] == 'virtual_file') {
2713 2713
           
2714
-        $v_content = $p_filedescr['content'];
2714
+		$v_content = $p_filedescr['content'];
2715 2715
 
2716
-        // ----- Calculate the CRC
2717
-        $p_header['crc'] = @crc32($v_content);
2716
+		// ----- Calculate the CRC
2717
+		$p_header['crc'] = @crc32($v_content);
2718 2718
         
2719
-        // ----- Look for no compression
2720
-        if ($p_options[PCLZIP_OPT_NO_COMPRESSION]) {
2721
-          // ----- Set header parameters
2722
-          $p_header['compressed_size'] = $p_header['size'];
2723
-          $p_header['compression'] = 0;
2724
-        }
2719
+		// ----- Look for no compression
2720
+		if ($p_options[PCLZIP_OPT_NO_COMPRESSION]) {
2721
+		  // ----- Set header parameters
2722
+		  $p_header['compressed_size'] = $p_header['size'];
2723
+		  $p_header['compression'] = 0;
2724
+		}
2725 2725
         
2726
-        // ----- Look for normal compression
2727
-        else {
2728
-          // ----- Compress the content
2729
-          $v_content = @gzdeflate($v_content);
2730
-
2731
-          // ----- Set header parameters
2732
-          $p_header['compressed_size'] = strlen($v_content);
2733
-          $p_header['compression'] = 8;
2734
-        }
2726
+		// ----- Look for normal compression
2727
+		else {
2728
+		  // ----- Compress the content
2729
+		  $v_content = @gzdeflate($v_content);
2730
+
2731
+		  // ----- Set header parameters
2732
+		  $p_header['compressed_size'] = strlen($v_content);
2733
+		  $p_header['compression'] = 8;
2734
+		}
2735 2735
         
2736
-        // ----- Call the header generation
2737
-        if (($v_result = $this->privWriteFileHeader($p_header)) != 1) {
2738
-          @fclose($v_file);
2739
-          return $v_result;
2740
-        }
2741
-
2742
-        // ----- Write the compressed (or not) content
2743
-        @fwrite($this->zip_fd, $v_content, $p_header['compressed_size']);
2744
-      }
2736
+		// ----- Call the header generation
2737
+		if (($v_result = $this->privWriteFileHeader($p_header)) != 1) {
2738
+		  @fclose($v_file);
2739
+		  return $v_result;
2740
+		}
2741
+
2742
+		// ----- Write the compressed (or not) content
2743
+		@fwrite($this->zip_fd, $v_content, $p_header['compressed_size']);
2744
+	  }
2745 2745
 
2746
-      // ----- Look for a directory
2747
-      else if ($p_filedescr['type'] == 'folder') {
2748
-        // ----- Look for directory last '/'
2749
-        if (@substr($p_header['stored_filename'], -1) != '/') {
2750
-          $p_header['stored_filename'] .= '/';
2751
-        }
2752
-
2753
-        // ----- Set the file properties
2754
-        $p_header['size'] = 0;
2755
-        //$p_header['external'] = 0x41FF0010;   // Value for a folder : to be checked
2756
-        $p_header['external'] = 0x00000010;   // Value for a folder : to be checked
2757
-
2758
-        // ----- Call the header generation
2759
-        if (($v_result = $this->privWriteFileHeader($p_header)) != 1)
2760
-        {
2761
-          return $v_result;
2762
-        }
2763
-      }
2764
-    }
2746
+	  // ----- Look for a directory
2747
+	  else if ($p_filedescr['type'] == 'folder') {
2748
+		// ----- Look for directory last '/'
2749
+		if (@substr($p_header['stored_filename'], -1) != '/') {
2750
+		  $p_header['stored_filename'] .= '/';
2751
+		}
2752
+
2753
+		// ----- Set the file properties
2754
+		$p_header['size'] = 0;
2755
+		//$p_header['external'] = 0x41FF0010;   // Value for a folder : to be checked
2756
+		$p_header['external'] = 0x00000010;   // Value for a folder : to be checked
2757
+
2758
+		// ----- Call the header generation
2759
+		if (($v_result = $this->privWriteFileHeader($p_header)) != 1)
2760
+		{
2761
+		  return $v_result;
2762
+		}
2763
+	  }
2764
+	}
2765 2765
 
2766
-    // ----- Look for post-add callback
2767
-    if (isset($p_options[PCLZIP_CB_POST_ADD])) {
2766
+	// ----- Look for post-add callback
2767
+	if (isset($p_options[PCLZIP_CB_POST_ADD])) {
2768 2768
 
2769
-      // ----- Generate a local information
2770
-      $v_local_header = array();
2771
-      $this->privConvertHeader2FileInfo($p_header, $v_local_header);
2769
+	  // ----- Generate a local information
2770
+	  $v_local_header = array();
2771
+	  $this->privConvertHeader2FileInfo($p_header, $v_local_header);
2772 2772
 
2773
-      // ----- Call the callback
2774
-      // Here I do not use call_user_func() because I need to send a reference to the
2775
-      // header.
2773
+	  // ----- Call the callback
2774
+	  // Here I do not use call_user_func() because I need to send a reference to the
2775
+	  // header.
2776 2776
 //      eval('$v_result = '.$p_options[PCLZIP_CB_POST_ADD].'(PCLZIP_CB_POST_ADD, $v_local_header);');
2777
-      $v_result = $p_options[PCLZIP_CB_POST_ADD](PCLZIP_CB_POST_ADD, $v_local_header);
2778
-      if ($v_result == 0) {
2779
-        // ----- Ignored
2780
-        $v_result = 1;
2781
-      }
2777
+	  $v_result = $p_options[PCLZIP_CB_POST_ADD](PCLZIP_CB_POST_ADD, $v_local_header);
2778
+	  if ($v_result == 0) {
2779
+		// ----- Ignored
2780
+		$v_result = 1;
2781
+	  }
2782 2782
 
2783
-      // ----- Update the informations
2784
-      // Nothing can be modified
2785
-    }
2783
+	  // ----- Update the informations
2784
+	  // Nothing can be modified
2785
+	}
2786 2786
 
2787
-    // ----- Return
2788
-    return $v_result;
2787
+	// ----- Return
2788
+	return $v_result;
2789 2789
   }
2790 2790
   // --------------------------------------------------------------------------------
2791 2791
 
@@ -2797,105 +2797,105 @@  discard block
 block discarded – undo
2797 2797
   // --------------------------------------------------------------------------------
2798 2798
   function privAddFileUsingTempFile($p_filedescr, &$p_header, &$p_options)
2799 2799
   {
2800
-    $v_result=PCLZIP_ERR_NO_ERROR;
2800
+	$v_result=PCLZIP_ERR_NO_ERROR;
2801 2801
     
2802
-    // ----- Working variable
2803
-    $p_filename = $p_filedescr['filename'];
2802
+	// ----- Working variable
2803
+	$p_filename = $p_filedescr['filename'];
2804 2804
 
2805 2805
 
2806
-    // ----- Open the source file
2807
-    if (($v_file = @fopen($p_filename, "rb")) == 0) {
2808
-      PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, "Unable to open file '$p_filename' in binary read mode");
2809
-      return PclZip::errorCode();
2810
-    }
2806
+	// ----- Open the source file
2807
+	if (($v_file = @fopen($p_filename, "rb")) == 0) {
2808
+	  PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, "Unable to open file '$p_filename' in binary read mode");
2809
+	  return PclZip::errorCode();
2810
+	}
2811 2811
 
2812
-    // ----- Creates a compressed temporary file
2813
-    $v_gzip_temp_name = PCLZIP_TEMPORARY_DIR.uniqid('pclzip-').'.gz';
2814
-    if (($v_file_compressed = @gzopen($v_gzip_temp_name, "wb")) == 0) {
2815
-      fclose($v_file);
2816
-      PclZip::privErrorLog(PCLZIP_ERR_WRITE_OPEN_FAIL, 'Unable to open temporary file \''.$v_gzip_temp_name.'\' in binary write mode');
2817
-      return PclZip::errorCode();
2818
-    }
2812
+	// ----- Creates a compressed temporary file
2813
+	$v_gzip_temp_name = PCLZIP_TEMPORARY_DIR.uniqid('pclzip-').'.gz';
2814
+	if (($v_file_compressed = @gzopen($v_gzip_temp_name, "wb")) == 0) {
2815
+	  fclose($v_file);
2816
+	  PclZip::privErrorLog(PCLZIP_ERR_WRITE_OPEN_FAIL, 'Unable to open temporary file \''.$v_gzip_temp_name.'\' in binary write mode');
2817
+	  return PclZip::errorCode();
2818
+	}
2819 2819
 
2820
-    // ----- Read the file by PCLZIP_READ_BLOCK_SIZE octets blocks
2821
-    $v_size = filesize($p_filename);
2822
-    while ($v_size != 0) {
2823
-      $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
2824
-      $v_buffer = @fread($v_file, $v_read_size);
2825
-      //$v_binary_data = pack('a'.$v_read_size, $v_buffer);
2826
-      @gzputs($v_file_compressed, $v_buffer, $v_read_size);
2827
-      $v_size -= $v_read_size;
2828
-    }
2820
+	// ----- Read the file by PCLZIP_READ_BLOCK_SIZE octets blocks
2821
+	$v_size = filesize($p_filename);
2822
+	while ($v_size != 0) {
2823
+	  $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
2824
+	  $v_buffer = @fread($v_file, $v_read_size);
2825
+	  //$v_binary_data = pack('a'.$v_read_size, $v_buffer);
2826
+	  @gzputs($v_file_compressed, $v_buffer, $v_read_size);
2827
+	  $v_size -= $v_read_size;
2828
+	}
2829 2829
 
2830
-    // ----- Close the file
2831
-    @fclose($v_file);
2832
-    @gzclose($v_file_compressed);
2830
+	// ----- Close the file
2831
+	@fclose($v_file);
2832
+	@gzclose($v_file_compressed);
2833 2833
 
2834
-    // ----- Check the minimum file size
2835
-    if (filesize($v_gzip_temp_name) < 18) {
2836
-      PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'gzip temporary file \''.$v_gzip_temp_name.'\' has invalid filesize - should be minimum 18 bytes');
2837
-      return PclZip::errorCode();
2838
-    }
2834
+	// ----- Check the minimum file size
2835
+	if (filesize($v_gzip_temp_name) < 18) {
2836
+	  PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'gzip temporary file \''.$v_gzip_temp_name.'\' has invalid filesize - should be minimum 18 bytes');
2837
+	  return PclZip::errorCode();
2838
+	}
2839 2839
 
2840
-    // ----- Extract the compressed attributes
2841
-    if (($v_file_compressed = @fopen($v_gzip_temp_name, "rb")) == 0) {
2842
-      PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open temporary file \''.$v_gzip_temp_name.'\' in binary read mode');
2843
-      return PclZip::errorCode();
2844
-    }
2840
+	// ----- Extract the compressed attributes
2841
+	if (($v_file_compressed = @fopen($v_gzip_temp_name, "rb")) == 0) {
2842
+	  PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open temporary file \''.$v_gzip_temp_name.'\' in binary read mode');
2843
+	  return PclZip::errorCode();
2844
+	}
2845 2845
 
2846
-    // ----- Read the gzip file header
2847
-    $v_binary_data = @fread($v_file_compressed, 10);
2848
-    $v_data_header = unpack('a1id1/a1id2/a1cm/a1flag/Vmtime/a1xfl/a1os', $v_binary_data);
2846
+	// ----- Read the gzip file header
2847
+	$v_binary_data = @fread($v_file_compressed, 10);
2848
+	$v_data_header = unpack('a1id1/a1id2/a1cm/a1flag/Vmtime/a1xfl/a1os', $v_binary_data);
2849 2849
 
2850
-    // ----- Check some parameters
2851
-    $v_data_header['os'] = bin2hex($v_data_header['os']);
2850
+	// ----- Check some parameters
2851
+	$v_data_header['os'] = bin2hex($v_data_header['os']);
2852 2852
 
2853
-    // ----- Read the gzip file footer
2854
-    @fseek($v_file_compressed, filesize($v_gzip_temp_name)-8);
2855
-    $v_binary_data = @fread($v_file_compressed, 8);
2856
-    $v_data_footer = unpack('Vcrc/Vcompressed_size', $v_binary_data);
2853
+	// ----- Read the gzip file footer
2854
+	@fseek($v_file_compressed, filesize($v_gzip_temp_name)-8);
2855
+	$v_binary_data = @fread($v_file_compressed, 8);
2856
+	$v_data_footer = unpack('Vcrc/Vcompressed_size', $v_binary_data);
2857 2857
 
2858
-    // ----- Set the attributes
2859
-    $p_header['compression'] = ord($v_data_header['cm']);
2860
-    //$p_header['mtime'] = $v_data_header['mtime'];
2861
-    $p_header['crc'] = $v_data_footer['crc'];
2862
-    $p_header['compressed_size'] = filesize($v_gzip_temp_name)-18;
2858
+	// ----- Set the attributes
2859
+	$p_header['compression'] = ord($v_data_header['cm']);
2860
+	//$p_header['mtime'] = $v_data_header['mtime'];
2861
+	$p_header['crc'] = $v_data_footer['crc'];
2862
+	$p_header['compressed_size'] = filesize($v_gzip_temp_name)-18;
2863 2863
 
2864
-    // ----- Close the file
2865
-    @fclose($v_file_compressed);
2864
+	// ----- Close the file
2865
+	@fclose($v_file_compressed);
2866 2866
 
2867
-    // ----- Call the header generation
2868
-    if (($v_result = $this->privWriteFileHeader($p_header)) != 1) {
2869
-      return $v_result;
2870
-    }
2867
+	// ----- Call the header generation
2868
+	if (($v_result = $this->privWriteFileHeader($p_header)) != 1) {
2869
+	  return $v_result;
2870
+	}
2871 2871
 
2872
-    // ----- Add the compressed data
2873
-    if (($v_file_compressed = @fopen($v_gzip_temp_name, "rb")) == 0)
2874
-    {
2875
-      PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open temporary file \''.$v_gzip_temp_name.'\' in binary read mode');
2876
-      return PclZip::errorCode();
2877
-    }
2872
+	// ----- Add the compressed data
2873
+	if (($v_file_compressed = @fopen($v_gzip_temp_name, "rb")) == 0)
2874
+	{
2875
+	  PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open temporary file \''.$v_gzip_temp_name.'\' in binary read mode');
2876
+	  return PclZip::errorCode();
2877
+	}
2878 2878
 
2879
-    // ----- Read the file by PCLZIP_READ_BLOCK_SIZE octets blocks
2880
-    fseek($v_file_compressed, 10);
2881
-    $v_size = $p_header['compressed_size'];
2882
-    while ($v_size != 0)
2883
-    {
2884
-      $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
2885
-      $v_buffer = @fread($v_file_compressed, $v_read_size);
2886
-      //$v_binary_data = pack('a'.$v_read_size, $v_buffer);
2887
-      @fwrite($this->zip_fd, $v_buffer, $v_read_size);
2888
-      $v_size -= $v_read_size;
2889
-    }
2879
+	// ----- Read the file by PCLZIP_READ_BLOCK_SIZE octets blocks
2880
+	fseek($v_file_compressed, 10);
2881
+	$v_size = $p_header['compressed_size'];
2882
+	while ($v_size != 0)
2883
+	{
2884
+	  $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
2885
+	  $v_buffer = @fread($v_file_compressed, $v_read_size);
2886
+	  //$v_binary_data = pack('a'.$v_read_size, $v_buffer);
2887
+	  @fwrite($this->zip_fd, $v_buffer, $v_read_size);
2888
+	  $v_size -= $v_read_size;
2889
+	}
2890 2890
 
2891
-    // ----- Close the file
2892
-    @fclose($v_file_compressed);
2891
+	// ----- Close the file
2892
+	@fclose($v_file_compressed);
2893 2893
 
2894
-    // ----- Unlink the temporary file
2895
-    @unlink($v_gzip_temp_name);
2894
+	// ----- Unlink the temporary file
2895
+	@unlink($v_gzip_temp_name);
2896 2896
     
2897
-    // ----- Return
2898
-    return $v_result;
2897
+	// ----- Return
2898
+	return $v_result;
2899 2899
   }
2900 2900
   // --------------------------------------------------------------------------------
2901 2901
 
@@ -2909,107 +2909,107 @@  discard block
 block discarded – undo
2909 2909
   // --------------------------------------------------------------------------------
2910 2910
   function privCalculateStoredFilename(&$p_filedescr, &$p_options)
2911 2911
   {
2912
-    $v_result=1;
2912
+	$v_result=1;
2913 2913
     
2914
-    // ----- Working variables
2915
-    $p_filename = $p_filedescr['filename'];
2916
-    if (isset($p_options[PCLZIP_OPT_ADD_PATH])) {
2917
-      $p_add_dir = $p_options[PCLZIP_OPT_ADD_PATH];
2918
-    }
2919
-    else {
2920
-      $p_add_dir = '';
2921
-    }
2922
-    if (isset($p_options[PCLZIP_OPT_REMOVE_PATH])) {
2923
-      $p_remove_dir = $p_options[PCLZIP_OPT_REMOVE_PATH];
2924
-    }
2925
-    else {
2926
-      $p_remove_dir = '';
2927
-    }
2928
-    if (isset($p_options[PCLZIP_OPT_REMOVE_ALL_PATH])) {
2929
-      $p_remove_all_dir = $p_options[PCLZIP_OPT_REMOVE_ALL_PATH];
2930
-    }
2931
-    else {
2932
-      $p_remove_all_dir = 0;
2933
-    }
2914
+	// ----- Working variables
2915
+	$p_filename = $p_filedescr['filename'];
2916
+	if (isset($p_options[PCLZIP_OPT_ADD_PATH])) {
2917
+	  $p_add_dir = $p_options[PCLZIP_OPT_ADD_PATH];
2918
+	}
2919
+	else {
2920
+	  $p_add_dir = '';
2921
+	}
2922
+	if (isset($p_options[PCLZIP_OPT_REMOVE_PATH])) {
2923
+	  $p_remove_dir = $p_options[PCLZIP_OPT_REMOVE_PATH];
2924
+	}
2925
+	else {
2926
+	  $p_remove_dir = '';
2927
+	}
2928
+	if (isset($p_options[PCLZIP_OPT_REMOVE_ALL_PATH])) {
2929
+	  $p_remove_all_dir = $p_options[PCLZIP_OPT_REMOVE_ALL_PATH];
2930
+	}
2931
+	else {
2932
+	  $p_remove_all_dir = 0;
2933
+	}
2934 2934
 
2935 2935
 
2936
-    // ----- Look for full name change
2937
-    if (isset($p_filedescr['new_full_name'])) {
2938
-      // ----- Remove drive letter if any
2939
-      $v_stored_filename = PclZipUtilTranslateWinPath($p_filedescr['new_full_name']);
2940
-    }
2936
+	// ----- Look for full name change
2937
+	if (isset($p_filedescr['new_full_name'])) {
2938
+	  // ----- Remove drive letter if any
2939
+	  $v_stored_filename = PclZipUtilTranslateWinPath($p_filedescr['new_full_name']);
2940
+	}
2941 2941
     
2942
-    // ----- Look for path and/or short name change
2943
-    else {
2944
-
2945
-      // ----- Look for short name change
2946
-      // Its when we cahnge just the filename but not the path
2947
-      if (isset($p_filedescr['new_short_name'])) {
2948
-        $v_path_info = pathinfo($p_filename);
2949
-        $v_dir = '';
2950
-        if ($v_path_info['dirname'] != '') {
2951
-          $v_dir = $v_path_info['dirname'].'/';
2952
-        }
2953
-        $v_stored_filename = $v_dir.$p_filedescr['new_short_name'];
2954
-      }
2955
-      else {
2956
-        // ----- Calculate the stored filename
2957
-        $v_stored_filename = $p_filename;
2958
-      }
2942
+	// ----- Look for path and/or short name change
2943
+	else {
2944
+
2945
+	  // ----- Look for short name change
2946
+	  // Its when we cahnge just the filename but not the path
2947
+	  if (isset($p_filedescr['new_short_name'])) {
2948
+		$v_path_info = pathinfo($p_filename);
2949
+		$v_dir = '';
2950
+		if ($v_path_info['dirname'] != '') {
2951
+		  $v_dir = $v_path_info['dirname'].'/';
2952
+		}
2953
+		$v_stored_filename = $v_dir.$p_filedescr['new_short_name'];
2954
+	  }
2955
+	  else {
2956
+		// ----- Calculate the stored filename
2957
+		$v_stored_filename = $p_filename;
2958
+	  }
2959 2959
 
2960
-      // ----- Look for all path to remove
2961
-      if ($p_remove_all_dir) {
2962
-        $v_stored_filename = basename($p_filename);
2963
-      }
2964
-      // ----- Look for partial path remove
2965
-      else if ($p_remove_dir != "") {
2966
-        if (substr($p_remove_dir, -1) != '/')
2967
-          $p_remove_dir .= "/";
2960
+	  // ----- Look for all path to remove
2961
+	  if ($p_remove_all_dir) {
2962
+		$v_stored_filename = basename($p_filename);
2963
+	  }
2964
+	  // ----- Look for partial path remove
2965
+	  else if ($p_remove_dir != "") {
2966
+		if (substr($p_remove_dir, -1) != '/')
2967
+		  $p_remove_dir .= "/";
2968 2968
 
2969
-        if (   (substr($p_filename, 0, 2) == "./")
2970
-            || (substr($p_remove_dir, 0, 2) == "./")) {
2969
+		if (   (substr($p_filename, 0, 2) == "./")
2970
+			|| (substr($p_remove_dir, 0, 2) == "./")) {
2971 2971
             
2972
-          if (   (substr($p_filename, 0, 2) == "./")
2973
-              && (substr($p_remove_dir, 0, 2) != "./")) {
2974
-            $p_remove_dir = "./".$p_remove_dir;
2975
-          }
2976
-          if (   (substr($p_filename, 0, 2) != "./")
2977
-              && (substr($p_remove_dir, 0, 2) == "./")) {
2978
-            $p_remove_dir = substr($p_remove_dir, 2);
2979
-          }
2980
-        }
2972
+		  if (   (substr($p_filename, 0, 2) == "./")
2973
+			  && (substr($p_remove_dir, 0, 2) != "./")) {
2974
+			$p_remove_dir = "./".$p_remove_dir;
2975
+		  }
2976
+		  if (   (substr($p_filename, 0, 2) != "./")
2977
+			  && (substr($p_remove_dir, 0, 2) == "./")) {
2978
+			$p_remove_dir = substr($p_remove_dir, 2);
2979
+		  }
2980
+		}
2981 2981
 
2982
-        $v_compare = PclZipUtilPathInclusion($p_remove_dir,
2983
-                                             $v_stored_filename);
2984
-        if ($v_compare > 0) {
2985
-          if ($v_compare == 2) {
2986
-            $v_stored_filename = "";
2987
-          }
2988
-          else {
2989
-            $v_stored_filename = substr($v_stored_filename,
2990
-                                        strlen($p_remove_dir));
2991
-          }
2992
-        }
2993
-      }
2982
+		$v_compare = PclZipUtilPathInclusion($p_remove_dir,
2983
+											 $v_stored_filename);
2984
+		if ($v_compare > 0) {
2985
+		  if ($v_compare == 2) {
2986
+			$v_stored_filename = "";
2987
+		  }
2988
+		  else {
2989
+			$v_stored_filename = substr($v_stored_filename,
2990
+										strlen($p_remove_dir));
2991
+		  }
2992
+		}
2993
+	  }
2994 2994
       
2995
-      // ----- Remove drive letter if any
2996
-      $v_stored_filename = PclZipUtilTranslateWinPath($v_stored_filename);
2995
+	  // ----- Remove drive letter if any
2996
+	  $v_stored_filename = PclZipUtilTranslateWinPath($v_stored_filename);
2997 2997
       
2998
-      // ----- Look for path to add
2999
-      if ($p_add_dir != "") {
3000
-        if (substr($p_add_dir, -1) == "/")
3001
-          $v_stored_filename = $p_add_dir.$v_stored_filename;
3002
-        else
3003
-          $v_stored_filename = $p_add_dir."/".$v_stored_filename;
3004
-      }
3005
-    }
2998
+	  // ----- Look for path to add
2999
+	  if ($p_add_dir != "") {
3000
+		if (substr($p_add_dir, -1) == "/")
3001
+		  $v_stored_filename = $p_add_dir.$v_stored_filename;
3002
+		else
3003
+		  $v_stored_filename = $p_add_dir."/".$v_stored_filename;
3004
+	  }
3005
+	}
3006 3006
 
3007
-    // ----- Filename (reduce the path of stored name)
3008
-    $v_stored_filename = PclZipUtilPathReduction($v_stored_filename);
3009
-    $p_filedescr['stored_filename'] = $v_stored_filename;
3007
+	// ----- Filename (reduce the path of stored name)
3008
+	$v_stored_filename = PclZipUtilPathReduction($v_stored_filename);
3009
+	$p_filedescr['stored_filename'] = $v_stored_filename;
3010 3010
     
3011
-    // ----- Return
3012
-    return $v_result;
3011
+	// ----- Return
3012
+	return $v_result;
3013 3013
   }
3014 3014
   // --------------------------------------------------------------------------------
3015 3015
 
@@ -3021,40 +3021,40 @@  discard block
 block discarded – undo
3021 3021
   // --------------------------------------------------------------------------------
3022 3022
   function privWriteFileHeader(&$p_header)
3023 3023
   {
3024
-    $v_result=1;
3024
+	$v_result=1;
3025 3025
 
3026
-    // ----- Store the offset position of the file
3027
-    $p_header['offset'] = ftell($this->zip_fd);
3026
+	// ----- Store the offset position of the file
3027
+	$p_header['offset'] = ftell($this->zip_fd);
3028 3028
 
3029
-    // ----- Transform UNIX mtime to DOS format mdate/mtime
3030
-    $v_date = getdate($p_header['mtime']);
3031
-    $v_mtime = ($v_date['hours']<<11) + ($v_date['minutes']<<5) + $v_date['seconds']/2;
3032
-    $v_mdate = (($v_date['year']-1980)<<9) + ($v_date['mon']<<5) + $v_date['mday'];
3029
+	// ----- Transform UNIX mtime to DOS format mdate/mtime
3030
+	$v_date = getdate($p_header['mtime']);
3031
+	$v_mtime = ($v_date['hours']<<11) + ($v_date['minutes']<<5) + $v_date['seconds']/2;
3032
+	$v_mdate = (($v_date['year']-1980)<<9) + ($v_date['mon']<<5) + $v_date['mday'];
3033 3033
 
3034
-    // ----- Packed data
3035
-    $v_binary_data = pack("VvvvvvVVVvv", 0x04034b50,
3036
-	                      $p_header['version_extracted'], $p_header['flag'],
3037
-                          $p_header['compression'], $v_mtime, $v_mdate,
3038
-                          $p_header['crc'], $p_header['compressed_size'],
3034
+	// ----- Packed data
3035
+	$v_binary_data = pack("VvvvvvVVVvv", 0x04034b50,
3036
+						  $p_header['version_extracted'], $p_header['flag'],
3037
+						  $p_header['compression'], $v_mtime, $v_mdate,
3038
+						  $p_header['crc'], $p_header['compressed_size'],
3039 3039
 						  $p_header['size'],
3040
-                          strlen($p_header['stored_filename']),
3040
+						  strlen($p_header['stored_filename']),
3041 3041
 						  $p_header['extra_len']);
3042 3042
 
3043
-    // ----- Write the first 148 bytes of the header in the archive
3044
-    fputs($this->zip_fd, $v_binary_data, 30);
3043
+	// ----- Write the first 148 bytes of the header in the archive
3044
+	fputs($this->zip_fd, $v_binary_data, 30);
3045 3045
 
3046
-    // ----- Write the variable fields
3047
-    if (strlen($p_header['stored_filename']) != 0)
3048
-    {
3049
-      fputs($this->zip_fd, $p_header['stored_filename'], strlen($p_header['stored_filename']));
3050
-    }
3051
-    if ($p_header['extra_len'] != 0)
3052
-    {
3053
-      fputs($this->zip_fd, $p_header['extra'], $p_header['extra_len']);
3054
-    }
3046
+	// ----- Write the variable fields
3047
+	if (strlen($p_header['stored_filename']) != 0)
3048
+	{
3049
+	  fputs($this->zip_fd, $p_header['stored_filename'], strlen($p_header['stored_filename']));
3050
+	}
3051
+	if ($p_header['extra_len'] != 0)
3052
+	{
3053
+	  fputs($this->zip_fd, $p_header['extra'], $p_header['extra_len']);
3054
+	}
3055 3055
 
3056
-    // ----- Return
3057
-    return $v_result;
3056
+	// ----- Return
3057
+	return $v_result;
3058 3058
   }
3059 3059
   // --------------------------------------------------------------------------------
3060 3060
 
@@ -3066,48 +3066,48 @@  discard block
 block discarded – undo
3066 3066
   // --------------------------------------------------------------------------------
3067 3067
   function privWriteCentralFileHeader(&$p_header)
3068 3068
   {
3069
-    $v_result=1;
3069
+	$v_result=1;
3070 3070
 
3071
-    // TBC
3072
-    //for(reset($p_header); $key = key($p_header); next($p_header)) {
3073
-    //}
3071
+	// TBC
3072
+	//for(reset($p_header); $key = key($p_header); next($p_header)) {
3073
+	//}
3074 3074
 
3075
-    // ----- Transform UNIX mtime to DOS format mdate/mtime
3076
-    $v_date = getdate($p_header['mtime']);
3077
-    $v_mtime = ($v_date['hours']<<11) + ($v_date['minutes']<<5) + $v_date['seconds']/2;
3078
-    $v_mdate = (($v_date['year']-1980)<<9) + ($v_date['mon']<<5) + $v_date['mday'];
3075
+	// ----- Transform UNIX mtime to DOS format mdate/mtime
3076
+	$v_date = getdate($p_header['mtime']);
3077
+	$v_mtime = ($v_date['hours']<<11) + ($v_date['minutes']<<5) + $v_date['seconds']/2;
3078
+	$v_mdate = (($v_date['year']-1980)<<9) + ($v_date['mon']<<5) + $v_date['mday'];
3079 3079
 
3080 3080
 
3081
-    // ----- Packed data
3082
-    $v_binary_data = pack("VvvvvvvVVVvvvvvVV", 0x02014b50,
3083
-	                      $p_header['version'], $p_header['version_extracted'],
3084
-                          $p_header['flag'], $p_header['compression'],
3081
+	// ----- Packed data
3082
+	$v_binary_data = pack("VvvvvvvVVVvvvvvVV", 0x02014b50,
3083
+						  $p_header['version'], $p_header['version_extracted'],
3084
+						  $p_header['flag'], $p_header['compression'],
3085 3085
 						  $v_mtime, $v_mdate, $p_header['crc'],
3086
-                          $p_header['compressed_size'], $p_header['size'],
3087
-                          strlen($p_header['stored_filename']),
3086
+						  $p_header['compressed_size'], $p_header['size'],
3087
+						  strlen($p_header['stored_filename']),
3088 3088
 						  $p_header['extra_len'], $p_header['comment_len'],
3089
-                          $p_header['disk'], $p_header['internal'],
3089
+						  $p_header['disk'], $p_header['internal'],
3090 3090
 						  $p_header['external'], $p_header['offset']);
3091 3091
 
3092
-    // ----- Write the 42 bytes of the header in the zip file
3093
-    fputs($this->zip_fd, $v_binary_data, 46);
3092
+	// ----- Write the 42 bytes of the header in the zip file
3093
+	fputs($this->zip_fd, $v_binary_data, 46);
3094 3094
 
3095
-    // ----- Write the variable fields
3096
-    if (strlen($p_header['stored_filename']) != 0)
3097
-    {
3098
-      fputs($this->zip_fd, $p_header['stored_filename'], strlen($p_header['stored_filename']));
3099
-    }
3100
-    if ($p_header['extra_len'] != 0)
3101
-    {
3102
-      fputs($this->zip_fd, $p_header['extra'], $p_header['extra_len']);
3103
-    }
3104
-    if ($p_header['comment_len'] != 0)
3105
-    {
3106
-      fputs($this->zip_fd, $p_header['comment'], $p_header['comment_len']);
3107
-    }
3095
+	// ----- Write the variable fields
3096
+	if (strlen($p_header['stored_filename']) != 0)
3097
+	{
3098
+	  fputs($this->zip_fd, $p_header['stored_filename'], strlen($p_header['stored_filename']));
3099
+	}
3100
+	if ($p_header['extra_len'] != 0)
3101
+	{
3102
+	  fputs($this->zip_fd, $p_header['extra'], $p_header['extra_len']);
3103
+	}
3104
+	if ($p_header['comment_len'] != 0)
3105
+	{
3106
+	  fputs($this->zip_fd, $p_header['comment'], $p_header['comment_len']);
3107
+	}
3108 3108
 
3109
-    // ----- Return
3110
-    return $v_result;
3109
+	// ----- Return
3110
+	return $v_result;
3111 3111
   }
3112 3112
   // --------------------------------------------------------------------------------
3113 3113
 
@@ -3119,24 +3119,24 @@  discard block
 block discarded – undo
3119 3119
   // --------------------------------------------------------------------------------
3120 3120
   function privWriteCentralHeader($p_nb_entries, $p_size, $p_offset, $p_comment)
3121 3121
   {
3122
-    $v_result=1;
3122
+	$v_result=1;
3123 3123
 
3124
-    // ----- Packed data
3125
-    $v_binary_data = pack("VvvvvVVv", 0x06054b50, 0, 0, $p_nb_entries,
3126
-	                      $p_nb_entries, $p_size,
3124
+	// ----- Packed data
3125
+	$v_binary_data = pack("VvvvvVVv", 0x06054b50, 0, 0, $p_nb_entries,
3126
+						  $p_nb_entries, $p_size,
3127 3127
 						  $p_offset, strlen($p_comment));
3128 3128
 
3129
-    // ----- Write the 22 bytes of the header in the zip file
3130
-    fputs($this->zip_fd, $v_binary_data, 22);
3129
+	// ----- Write the 22 bytes of the header in the zip file
3130
+	fputs($this->zip_fd, $v_binary_data, 22);
3131 3131
 
3132
-    // ----- Write the variable fields
3133
-    if (strlen($p_comment) != 0)
3134
-    {
3135
-      fputs($this->zip_fd, $p_comment, strlen($p_comment));
3136
-    }
3132
+	// ----- Write the variable fields
3133
+	if (strlen($p_comment) != 0)
3134
+	{
3135
+	  fputs($this->zip_fd, $p_comment, strlen($p_comment));
3136
+	}
3137 3137
 
3138
-    // ----- Return
3139
-    return $v_result;
3138
+	// ----- Return
3139
+	return $v_result;
3140 3140
   }
3141 3141
   // --------------------------------------------------------------------------------
3142 3142
 
@@ -3148,69 +3148,69 @@  discard block
 block discarded – undo
3148 3148
   // --------------------------------------------------------------------------------
3149 3149
   function privList(&$p_list)
3150 3150
   {
3151
-    $v_result=1;
3151
+	$v_result=1;
3152 3152
 
3153
-    // ----- Magic quotes trick
3154
-    $this->privDisableMagicQuotes();
3153
+	// ----- Magic quotes trick
3154
+	$this->privDisableMagicQuotes();
3155 3155
 
3156
-    // ----- Open the zip file
3157
-    if (($this->zip_fd = @fopen($this->zipname, 'rb')) == 0)
3158
-    {
3159
-      // ----- Magic quotes trick
3160
-      $this->privSwapBackMagicQuotes();
3156
+	// ----- Open the zip file
3157
+	if (($this->zip_fd = @fopen($this->zipname, 'rb')) == 0)
3158
+	{
3159
+	  // ----- Magic quotes trick
3160
+	  $this->privSwapBackMagicQuotes();
3161 3161
       
3162
-      // ----- Error log
3163
-      PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open archive \''.$this->zipname.'\' in binary read mode');
3162
+	  // ----- Error log
3163
+	  PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open archive \''.$this->zipname.'\' in binary read mode');
3164 3164
 
3165
-      // ----- Return
3166
-      return PclZip::errorCode();
3167
-    }
3165
+	  // ----- Return
3166
+	  return PclZip::errorCode();
3167
+	}
3168 3168
 
3169
-    // ----- Read the central directory informations
3170
-    $v_central_dir = array();
3171
-    if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1)
3172
-    {
3173
-      $this->privSwapBackMagicQuotes();
3174
-      return $v_result;
3175
-    }
3169
+	// ----- Read the central directory informations
3170
+	$v_central_dir = array();
3171
+	if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1)
3172
+	{
3173
+	  $this->privSwapBackMagicQuotes();
3174
+	  return $v_result;
3175
+	}
3176 3176
 
3177
-    // ----- Go to beginning of Central Dir
3178
-    @rewind($this->zip_fd);
3179
-    if (@fseek($this->zip_fd, $v_central_dir['offset']))
3180
-    {
3181
-      $this->privSwapBackMagicQuotes();
3177
+	// ----- Go to beginning of Central Dir
3178
+	@rewind($this->zip_fd);
3179
+	if (@fseek($this->zip_fd, $v_central_dir['offset']))
3180
+	{
3181
+	  $this->privSwapBackMagicQuotes();
3182 3182
 
3183
-      // ----- Error log
3184
-      PclZip::privErrorLog(PCLZIP_ERR_INVALID_ARCHIVE_ZIP, 'Invalid archive size');
3183
+	  // ----- Error log
3184
+	  PclZip::privErrorLog(PCLZIP_ERR_INVALID_ARCHIVE_ZIP, 'Invalid archive size');
3185 3185
 
3186
-      // ----- Return
3187
-      return PclZip::errorCode();
3188
-    }
3186
+	  // ----- Return
3187
+	  return PclZip::errorCode();
3188
+	}
3189 3189
 
3190
-    // ----- Read each entry
3191
-    for ($i=0; $i<$v_central_dir['entries']; $i++)
3192
-    {
3193
-      // ----- Read the file header
3194
-      if (($v_result = $this->privReadCentralFileHeader($v_header)) != 1)
3195
-      {
3196
-        $this->privSwapBackMagicQuotes();
3197
-        return $v_result;
3198
-      }
3199
-      $v_header['index'] = $i;
3190
+	// ----- Read each entry
3191
+	for ($i=0; $i<$v_central_dir['entries']; $i++)
3192
+	{
3193
+	  // ----- Read the file header
3194
+	  if (($v_result = $this->privReadCentralFileHeader($v_header)) != 1)
3195
+	  {
3196
+		$this->privSwapBackMagicQuotes();
3197
+		return $v_result;
3198
+	  }
3199
+	  $v_header['index'] = $i;
3200 3200
 
3201
-      // ----- Get the only interesting attributes
3202
-      $this->privConvertHeader2FileInfo($v_header, $p_list[$i]);
3203
-      unset($v_header);
3204
-    }
3201
+	  // ----- Get the only interesting attributes
3202
+	  $this->privConvertHeader2FileInfo($v_header, $p_list[$i]);
3203
+	  unset($v_header);
3204
+	}
3205 3205
 
3206
-    // ----- Close the zip file
3207
-    $this->privCloseFd();
3206
+	// ----- Close the zip file
3207
+	$this->privCloseFd();
3208 3208
 
3209
-    // ----- Magic quotes trick
3210
-    $this->privSwapBackMagicQuotes();
3209
+	// ----- Magic quotes trick
3210
+	$this->privSwapBackMagicQuotes();
3211 3211
 
3212
-    // ----- Return
3213
-    return $v_result;
3212
+	// ----- Return
3213
+	return $v_result;
3214 3214
   }
3215 3215
   // --------------------------------------------------------------------------------
3216 3216
 
@@ -3235,24 +3235,24 @@  discard block
 block discarded – undo
3235 3235
   // --------------------------------------------------------------------------------
3236 3236
   function privConvertHeader2FileInfo($p_header, &$p_info)
3237 3237
   {
3238
-    $v_result=1;
3239
-
3240
-    // ----- Get the interesting attributes
3241
-    $v_temp_path = PclZipUtilPathReduction($p_header['filename']);
3242
-    $p_info['filename'] = $v_temp_path;
3243
-    $v_temp_path = PclZipUtilPathReduction($p_header['stored_filename']);
3244
-    $p_info['stored_filename'] = $v_temp_path;
3245
-    $p_info['size'] = $p_header['size'];
3246
-    $p_info['compressed_size'] = $p_header['compressed_size'];
3247
-    $p_info['mtime'] = $p_header['mtime'];
3248
-    $p_info['comment'] = $p_header['comment'];
3249
-    $p_info['folder'] = (($p_header['external']&0x00000010)==0x00000010);
3250
-    $p_info['index'] = $p_header['index'];
3251
-    $p_info['status'] = $p_header['status'];
3252
-    $p_info['crc'] = $p_header['crc'];
3253
-
3254
-    // ----- Return
3255
-    return $v_result;
3238
+	$v_result=1;
3239
+
3240
+	// ----- Get the interesting attributes
3241
+	$v_temp_path = PclZipUtilPathReduction($p_header['filename']);
3242
+	$p_info['filename'] = $v_temp_path;
3243
+	$v_temp_path = PclZipUtilPathReduction($p_header['stored_filename']);
3244
+	$p_info['stored_filename'] = $v_temp_path;
3245
+	$p_info['size'] = $p_header['size'];
3246
+	$p_info['compressed_size'] = $p_header['compressed_size'];
3247
+	$p_info['mtime'] = $p_header['mtime'];
3248
+	$p_info['comment'] = $p_header['comment'];
3249
+	$p_info['folder'] = (($p_header['external']&0x00000010)==0x00000010);
3250
+	$p_info['index'] = $p_header['index'];
3251
+	$p_info['status'] = $p_header['status'];
3252
+	$p_info['crc'] = $p_header['crc'];
3253
+
3254
+	// ----- Return
3255
+	return $v_result;
3256 3256
   }
3257 3257
   // --------------------------------------------------------------------------------
3258 3258
 
@@ -3274,122 +3274,122 @@  discard block
 block discarded – undo
3274 3274
   // --------------------------------------------------------------------------------
3275 3275
   function privExtractByRule(&$p_file_list, $p_path, $p_remove_path, $p_remove_all_path, &$p_options)
3276 3276
   {
3277
-    $v_result=1;
3277
+	$v_result=1;
3278 3278
 
3279
-    // ----- Magic quotes trick
3280
-    $this->privDisableMagicQuotes();
3279
+	// ----- Magic quotes trick
3280
+	$this->privDisableMagicQuotes();
3281 3281
 
3282
-    // ----- Check the path
3283
-    if (   ($p_path == "")
3284
-	    || (   (substr($p_path, 0, 1) != "/")
3285
-		    && (substr($p_path, 0, 3) != "../")
3282
+	// ----- Check the path
3283
+	if (   ($p_path == "")
3284
+		|| (   (substr($p_path, 0, 1) != "/")
3285
+			&& (substr($p_path, 0, 3) != "../")
3286 3286
 			&& (substr($p_path,1,2)!=":/")))
3287
-      $p_path = "./".$p_path;
3288
-
3289
-    // ----- Reduce the path last (and duplicated) '/'
3290
-    if (($p_path != "./") && ($p_path != "/"))
3291
-    {
3292
-      // ----- Look for the path end '/'
3293
-      while (substr($p_path, -1) == "/")
3294
-      {
3295
-        $p_path = substr($p_path, 0, strlen($p_path)-1);
3296
-      }
3297
-    }
3287
+	  $p_path = "./".$p_path;
3288
+
3289
+	// ----- Reduce the path last (and duplicated) '/'
3290
+	if (($p_path != "./") && ($p_path != "/"))
3291
+	{
3292
+	  // ----- Look for the path end '/'
3293
+	  while (substr($p_path, -1) == "/")
3294
+	  {
3295
+		$p_path = substr($p_path, 0, strlen($p_path)-1);
3296
+	  }
3297
+	}
3298 3298
 
3299
-    // ----- Look for path to remove format (should end by /)
3300
-    if (($p_remove_path != "") && (substr($p_remove_path, -1) != '/'))
3301
-    {
3302
-      $p_remove_path .= '/';
3303
-    }
3304
-    $p_remove_path_size = strlen($p_remove_path);
3299
+	// ----- Look for path to remove format (should end by /)
3300
+	if (($p_remove_path != "") && (substr($p_remove_path, -1) != '/'))
3301
+	{
3302
+	  $p_remove_path .= '/';
3303
+	}
3304
+	$p_remove_path_size = strlen($p_remove_path);
3305 3305
 
3306
-    // ----- Open the zip file
3307
-    if (($v_result = $this->privOpenFd('rb')) != 1)
3308
-    {
3309
-      $this->privSwapBackMagicQuotes();
3310
-      return $v_result;
3311
-    }
3306
+	// ----- Open the zip file
3307
+	if (($v_result = $this->privOpenFd('rb')) != 1)
3308
+	{
3309
+	  $this->privSwapBackMagicQuotes();
3310
+	  return $v_result;
3311
+	}
3312 3312
 
3313
-    // ----- Read the central directory informations
3314
-    $v_central_dir = array();
3315
-    if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1)
3316
-    {
3317
-      // ----- Close the zip file
3318
-      $this->privCloseFd();
3319
-      $this->privSwapBackMagicQuotes();
3313
+	// ----- Read the central directory informations
3314
+	$v_central_dir = array();
3315
+	if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1)
3316
+	{
3317
+	  // ----- Close the zip file
3318
+	  $this->privCloseFd();
3319
+	  $this->privSwapBackMagicQuotes();
3320 3320
 
3321
-      return $v_result;
3322
-    }
3321
+	  return $v_result;
3322
+	}
3323 3323
 
3324
-    // ----- Start at beginning of Central Dir
3325
-    $v_pos_entry = $v_central_dir['offset'];
3324
+	// ----- Start at beginning of Central Dir
3325
+	$v_pos_entry = $v_central_dir['offset'];
3326 3326
 
3327
-    // ----- Read each entry
3328
-    $j_start = 0;
3329
-    for ($i=0, $v_nb_extracted=0; $i<$v_central_dir['entries']; $i++)
3330
-    {
3327
+	// ----- Read each entry
3328
+	$j_start = 0;
3329
+	for ($i=0, $v_nb_extracted=0; $i<$v_central_dir['entries']; $i++)
3330
+	{
3331 3331
 
3332
-      // ----- Read next Central dir entry
3333
-      @rewind($this->zip_fd);
3334
-      if (@fseek($this->zip_fd, $v_pos_entry))
3335
-      {
3336
-        // ----- Close the zip file
3337
-        $this->privCloseFd();
3338
-        $this->privSwapBackMagicQuotes();
3332
+	  // ----- Read next Central dir entry
3333
+	  @rewind($this->zip_fd);
3334
+	  if (@fseek($this->zip_fd, $v_pos_entry))
3335
+	  {
3336
+		// ----- Close the zip file
3337
+		$this->privCloseFd();
3338
+		$this->privSwapBackMagicQuotes();
3339 3339
 
3340
-        // ----- Error log
3341
-        PclZip::privErrorLog(PCLZIP_ERR_INVALID_ARCHIVE_ZIP, 'Invalid archive size');
3340
+		// ----- Error log
3341
+		PclZip::privErrorLog(PCLZIP_ERR_INVALID_ARCHIVE_ZIP, 'Invalid archive size');
3342 3342
 
3343
-        // ----- Return
3344
-        return PclZip::errorCode();
3345
-      }
3343
+		// ----- Return
3344
+		return PclZip::errorCode();
3345
+	  }
3346 3346
 
3347
-      // ----- Read the file header
3348
-      $v_header = array();
3349
-      if (($v_result = $this->privReadCentralFileHeader($v_header)) != 1)
3350
-      {
3351
-        // ----- Close the zip file
3352
-        $this->privCloseFd();
3353
-        $this->privSwapBackMagicQuotes();
3347
+	  // ----- Read the file header
3348
+	  $v_header = array();
3349
+	  if (($v_result = $this->privReadCentralFileHeader($v_header)) != 1)
3350
+	  {
3351
+		// ----- Close the zip file
3352
+		$this->privCloseFd();
3353
+		$this->privSwapBackMagicQuotes();
3354 3354
 
3355
-        return $v_result;
3356
-      }
3355
+		return $v_result;
3356
+	  }
3357 3357
 
3358
-      // ----- Store the index
3359
-      $v_header['index'] = $i;
3358
+	  // ----- Store the index
3359
+	  $v_header['index'] = $i;
3360 3360
 
3361
-      // ----- Store the file position
3362
-      $v_pos_entry = ftell($this->zip_fd);
3361
+	  // ----- Store the file position
3362
+	  $v_pos_entry = ftell($this->zip_fd);
3363 3363
 
3364
-      // ----- Look for the specific extract rules
3365
-      $v_extract = false;
3364
+	  // ----- Look for the specific extract rules
3365
+	  $v_extract = false;
3366 3366
 
3367
-      // ----- Look for extract by name rule
3368
-      if (   (isset($p_options[PCLZIP_OPT_BY_NAME]))
3369
-          && ($p_options[PCLZIP_OPT_BY_NAME] != 0)) {
3367
+	  // ----- Look for extract by name rule
3368
+	  if (   (isset($p_options[PCLZIP_OPT_BY_NAME]))
3369
+		  && ($p_options[PCLZIP_OPT_BY_NAME] != 0)) {
3370 3370
 
3371
-          // ----- Look if the filename is in the list
3372
-          for ($j=0; ($j<sizeof($p_options[PCLZIP_OPT_BY_NAME])) && (!$v_extract); $j++) {
3371
+		  // ----- Look if the filename is in the list
3372
+		  for ($j=0; ($j<sizeof($p_options[PCLZIP_OPT_BY_NAME])) && (!$v_extract); $j++) {
3373 3373
 
3374
-              // ----- Look for a directory
3375
-              if (substr($p_options[PCLZIP_OPT_BY_NAME][$j], -1) == "/") {
3374
+			  // ----- Look for a directory
3375
+			  if (substr($p_options[PCLZIP_OPT_BY_NAME][$j], -1) == "/") {
3376 3376
 
3377
-                  // ----- Look if the directory is in the filename path
3378
-                  if (   (strlen($v_header['stored_filename']) > strlen($p_options[PCLZIP_OPT_BY_NAME][$j]))
3379
-                      && (substr($v_header['stored_filename'], 0, strlen($p_options[PCLZIP_OPT_BY_NAME][$j])) == $p_options[PCLZIP_OPT_BY_NAME][$j])) {
3380
-                      $v_extract = true;
3381
-                  }
3382
-              }
3383
-              // ----- Look for a filename
3384
-              elseif ($v_header['stored_filename'] == $p_options[PCLZIP_OPT_BY_NAME][$j]) {
3385
-                  $v_extract = true;
3386
-              }
3387
-          }
3388
-      }
3377
+				  // ----- Look if the directory is in the filename path
3378
+				  if (   (strlen($v_header['stored_filename']) > strlen($p_options[PCLZIP_OPT_BY_NAME][$j]))
3379
+					  && (substr($v_header['stored_filename'], 0, strlen($p_options[PCLZIP_OPT_BY_NAME][$j])) == $p_options[PCLZIP_OPT_BY_NAME][$j])) {
3380
+					  $v_extract = true;
3381
+				  }
3382
+			  }
3383
+			  // ----- Look for a filename
3384
+			  elseif ($v_header['stored_filename'] == $p_options[PCLZIP_OPT_BY_NAME][$j]) {
3385
+				  $v_extract = true;
3386
+			  }
3387
+		  }
3388
+	  }
3389 3389
 
3390
-      // ----- Look for extract by ereg rule
3391
-      // ereg() is deprecated with PHP 5.3
3392
-      /* 
3390
+	  // ----- Look for extract by ereg rule
3391
+	  // ereg() is deprecated with PHP 5.3
3392
+	  /* 
3393 3393
       else if (   (isset($p_options[PCLZIP_OPT_BY_EREG]))
3394 3394
                && ($p_options[PCLZIP_OPT_BY_EREG] != "")) {
3395 3395
 
@@ -3399,207 +3399,207 @@  discard block
 block discarded – undo
3399 3399
       }
3400 3400
       */
3401 3401
 
3402
-      // ----- Look for extract by preg rule
3403
-      else if (   (isset($p_options[PCLZIP_OPT_BY_PREG]))
3404
-               && ($p_options[PCLZIP_OPT_BY_PREG] != "")) {
3402
+	  // ----- Look for extract by preg rule
3403
+	  else if (   (isset($p_options[PCLZIP_OPT_BY_PREG]))
3404
+			   && ($p_options[PCLZIP_OPT_BY_PREG] != "")) {
3405 3405
 
3406
-          if (preg_match($p_options[PCLZIP_OPT_BY_PREG], $v_header['stored_filename'])) {
3407
-              $v_extract = true;
3408
-          }
3409
-      }
3406
+		  if (preg_match($p_options[PCLZIP_OPT_BY_PREG], $v_header['stored_filename'])) {
3407
+			  $v_extract = true;
3408
+		  }
3409
+	  }
3410 3410
 
3411
-      // ----- Look for extract by index rule
3412
-      else if (   (isset($p_options[PCLZIP_OPT_BY_INDEX]))
3413
-               && ($p_options[PCLZIP_OPT_BY_INDEX] != 0)) {
3411
+	  // ----- Look for extract by index rule
3412
+	  else if (   (isset($p_options[PCLZIP_OPT_BY_INDEX]))
3413
+			   && ($p_options[PCLZIP_OPT_BY_INDEX] != 0)) {
3414 3414
           
3415
-          // ----- Look if the index is in the list
3416
-          for ($j=$j_start; ($j<sizeof($p_options[PCLZIP_OPT_BY_INDEX])) && (!$v_extract); $j++) {
3417
-
3418
-              if (($i>=$p_options[PCLZIP_OPT_BY_INDEX][$j]['start']) && ($i<=$p_options[PCLZIP_OPT_BY_INDEX][$j]['end'])) {
3419
-                  $v_extract = true;
3420
-              }
3421
-              if ($i>=$p_options[PCLZIP_OPT_BY_INDEX][$j]['end']) {
3422
-                  $j_start = $j+1;
3423
-              }
3424
-
3425
-              if ($p_options[PCLZIP_OPT_BY_INDEX][$j]['start']>$i) {
3426
-                  break;
3427
-              }
3428
-          }
3429
-      }
3415
+		  // ----- Look if the index is in the list
3416
+		  for ($j=$j_start; ($j<sizeof($p_options[PCLZIP_OPT_BY_INDEX])) && (!$v_extract); $j++) {
3417
+
3418
+			  if (($i>=$p_options[PCLZIP_OPT_BY_INDEX][$j]['start']) && ($i<=$p_options[PCLZIP_OPT_BY_INDEX][$j]['end'])) {
3419
+				  $v_extract = true;
3420
+			  }
3421
+			  if ($i>=$p_options[PCLZIP_OPT_BY_INDEX][$j]['end']) {
3422
+				  $j_start = $j+1;
3423
+			  }
3424
+
3425
+			  if ($p_options[PCLZIP_OPT_BY_INDEX][$j]['start']>$i) {
3426
+				  break;
3427
+			  }
3428
+		  }
3429
+	  }
3430 3430
 
3431
-      // ----- Look for no rule, which means extract all the archive
3432
-      else {
3433
-          $v_extract = true;
3434
-      }
3431
+	  // ----- Look for no rule, which means extract all the archive
3432
+	  else {
3433
+		  $v_extract = true;
3434
+	  }
3435 3435
 
3436 3436
 	  // ----- Check compression method
3437 3437
 	  if (   ($v_extract)
3438
-	      && (   ($v_header['compression'] != 8)
3439
-		      && ($v_header['compression'] != 0))) {
3440
-          $v_header['status'] = 'unsupported_compression';
3438
+		  && (   ($v_header['compression'] != 8)
3439
+			  && ($v_header['compression'] != 0))) {
3440
+		  $v_header['status'] = 'unsupported_compression';
3441 3441
 
3442
-          // ----- Look for PCLZIP_OPT_STOP_ON_ERROR
3443
-          if (   (isset($p_options[PCLZIP_OPT_STOP_ON_ERROR]))
3444
-		      && ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) {
3442
+		  // ----- Look for PCLZIP_OPT_STOP_ON_ERROR
3443
+		  if (   (isset($p_options[PCLZIP_OPT_STOP_ON_ERROR]))
3444
+			  && ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) {
3445 3445
 
3446
-              $this->privSwapBackMagicQuotes();
3446
+			  $this->privSwapBackMagicQuotes();
3447 3447
               
3448
-              PclZip::privErrorLog(PCLZIP_ERR_UNSUPPORTED_COMPRESSION,
3449
-			                       "Filename '".$v_header['stored_filename']."' is "
3450
-				  	    	  	   ."compressed by an unsupported compression "
3451
-				  	    	  	   ."method (".$v_header['compression'].") ");
3448
+			  PclZip::privErrorLog(PCLZIP_ERR_UNSUPPORTED_COMPRESSION,
3449
+								   "Filename '".$v_header['stored_filename']."' is "
3450
+				  			  	   ."compressed by an unsupported compression "
3451
+				  			  	   ."method (".$v_header['compression'].") ");
3452 3452
 
3453
-              return PclZip::errorCode();
3453
+			  return PclZip::errorCode();
3454 3454
 		  }
3455 3455
 	  }
3456 3456
 	  
3457 3457
 	  // ----- Check encrypted files
3458 3458
 	  if (($v_extract) && (($v_header['flag'] & 1) == 1)) {
3459
-          $v_header['status'] = 'unsupported_encryption';
3459
+		  $v_header['status'] = 'unsupported_encryption';
3460 3460
 
3461
-          // ----- Look for PCLZIP_OPT_STOP_ON_ERROR
3462
-          if (   (isset($p_options[PCLZIP_OPT_STOP_ON_ERROR]))
3463
-		      && ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) {
3461
+		  // ----- Look for PCLZIP_OPT_STOP_ON_ERROR
3462
+		  if (   (isset($p_options[PCLZIP_OPT_STOP_ON_ERROR]))
3463
+			  && ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) {
3464 3464
 
3465
-              $this->privSwapBackMagicQuotes();
3465
+			  $this->privSwapBackMagicQuotes();
3466 3466
 
3467
-              PclZip::privErrorLog(PCLZIP_ERR_UNSUPPORTED_ENCRYPTION,
3468
-			                       "Unsupported encryption for "
3469
-				  	    	  	   ." filename '".$v_header['stored_filename']
3467
+			  PclZip::privErrorLog(PCLZIP_ERR_UNSUPPORTED_ENCRYPTION,
3468
+								   "Unsupported encryption for "
3469
+				  			  	   ." filename '".$v_header['stored_filename']
3470 3470
 								   ."'");
3471 3471
 
3472
-              return PclZip::errorCode();
3472
+			  return PclZip::errorCode();
3473 3473
 		  }
3474
-    }
3474
+	}
3475 3475
 
3476
-      // ----- Look for real extraction
3477
-      if (($v_extract) && ($v_header['status'] != 'ok')) {
3478
-          $v_result = $this->privConvertHeader2FileInfo($v_header,
3479
-		                                        $p_file_list[$v_nb_extracted++]);
3480
-          if ($v_result != 1) {
3481
-              $this->privCloseFd();
3482
-              $this->privSwapBackMagicQuotes();
3483
-              return $v_result;
3484
-          }
3476
+	  // ----- Look for real extraction
3477
+	  if (($v_extract) && ($v_header['status'] != 'ok')) {
3478
+		  $v_result = $this->privConvertHeader2FileInfo($v_header,
3479
+												$p_file_list[$v_nb_extracted++]);
3480
+		  if ($v_result != 1) {
3481
+			  $this->privCloseFd();
3482
+			  $this->privSwapBackMagicQuotes();
3483
+			  return $v_result;
3484
+		  }
3485 3485
 
3486
-          $v_extract = false;
3487
-      }
3486
+		  $v_extract = false;
3487
+	  }
3488 3488
       
3489
-      // ----- Look for real extraction
3490
-      if ($v_extract)
3491
-      {
3489
+	  // ----- Look for real extraction
3490
+	  if ($v_extract)
3491
+	  {
3492 3492
 
3493
-        // ----- Go to the file position
3494
-        @rewind($this->zip_fd);
3495
-        if (@fseek($this->zip_fd, $v_header['offset']))
3496
-        {
3497
-          // ----- Close the zip file
3498
-          $this->privCloseFd();
3493
+		// ----- Go to the file position
3494
+		@rewind($this->zip_fd);
3495
+		if (@fseek($this->zip_fd, $v_header['offset']))
3496
+		{
3497
+		  // ----- Close the zip file
3498
+		  $this->privCloseFd();
3499 3499
 
3500
-          $this->privSwapBackMagicQuotes();
3500
+		  $this->privSwapBackMagicQuotes();
3501 3501
 
3502
-          // ----- Error log
3503
-          PclZip::privErrorLog(PCLZIP_ERR_INVALID_ARCHIVE_ZIP, 'Invalid archive size');
3502
+		  // ----- Error log
3503
+		  PclZip::privErrorLog(PCLZIP_ERR_INVALID_ARCHIVE_ZIP, 'Invalid archive size');
3504 3504
 
3505
-          // ----- Return
3506
-          return PclZip::errorCode();
3507
-        }
3505
+		  // ----- Return
3506
+		  return PclZip::errorCode();
3507
+		}
3508 3508
 
3509
-        // ----- Look for extraction as string
3510
-        if ($p_options[PCLZIP_OPT_EXTRACT_AS_STRING]) {
3509
+		// ----- Look for extraction as string
3510
+		if ($p_options[PCLZIP_OPT_EXTRACT_AS_STRING]) {
3511 3511
 
3512
-          $v_string = '';
3512
+		  $v_string = '';
3513 3513
 
3514
-          // ----- Extracting the file
3515
-          $v_result1 = $this->privExtractFileAsString($v_header, $v_string, $p_options);
3516
-          if ($v_result1 < 1) {
3517
-            $this->privCloseFd();
3518
-            $this->privSwapBackMagicQuotes();
3519
-            return $v_result1;
3520
-          }
3514
+		  // ----- Extracting the file
3515
+		  $v_result1 = $this->privExtractFileAsString($v_header, $v_string, $p_options);
3516
+		  if ($v_result1 < 1) {
3517
+			$this->privCloseFd();
3518
+			$this->privSwapBackMagicQuotes();
3519
+			return $v_result1;
3520
+		  }
3521 3521
 
3522
-          // ----- Get the only interesting attributes
3523
-          if (($v_result = $this->privConvertHeader2FileInfo($v_header, $p_file_list[$v_nb_extracted])) != 1)
3524
-          {
3525
-            // ----- Close the zip file
3526
-            $this->privCloseFd();
3527
-            $this->privSwapBackMagicQuotes();
3522
+		  // ----- Get the only interesting attributes
3523
+		  if (($v_result = $this->privConvertHeader2FileInfo($v_header, $p_file_list[$v_nb_extracted])) != 1)
3524
+		  {
3525
+			// ----- Close the zip file
3526
+			$this->privCloseFd();
3527
+			$this->privSwapBackMagicQuotes();
3528 3528
 
3529
-            return $v_result;
3530
-          }
3529
+			return $v_result;
3530
+		  }
3531 3531
 
3532
-          // ----- Set the file content
3533
-          $p_file_list[$v_nb_extracted]['content'] = $v_string;
3532
+		  // ----- Set the file content
3533
+		  $p_file_list[$v_nb_extracted]['content'] = $v_string;
3534 3534
 
3535
-          // ----- Next extracted file
3536
-          $v_nb_extracted++;
3535
+		  // ----- Next extracted file
3536
+		  $v_nb_extracted++;
3537 3537
           
3538
-          // ----- Look for user callback abort
3539
-          if ($v_result1 == 2) {
3540
-          	break;
3541
-          }
3542
-        }
3543
-        // ----- Look for extraction in standard output
3544
-        elseif (   (isset($p_options[PCLZIP_OPT_EXTRACT_IN_OUTPUT]))
3545
-		        && ($p_options[PCLZIP_OPT_EXTRACT_IN_OUTPUT])) {
3546
-          // ----- Extracting the file in standard output
3547
-          $v_result1 = $this->privExtractFileInOutput($v_header, $p_options);
3548
-          if ($v_result1 < 1) {
3549
-            $this->privCloseFd();
3550
-            $this->privSwapBackMagicQuotes();
3551
-            return $v_result1;
3552
-          }
3538
+		  // ----- Look for user callback abort
3539
+		  if ($v_result1 == 2) {
3540
+		  	break;
3541
+		  }
3542
+		}
3543
+		// ----- Look for extraction in standard output
3544
+		elseif (   (isset($p_options[PCLZIP_OPT_EXTRACT_IN_OUTPUT]))
3545
+				&& ($p_options[PCLZIP_OPT_EXTRACT_IN_OUTPUT])) {
3546
+		  // ----- Extracting the file in standard output
3547
+		  $v_result1 = $this->privExtractFileInOutput($v_header, $p_options);
3548
+		  if ($v_result1 < 1) {
3549
+			$this->privCloseFd();
3550
+			$this->privSwapBackMagicQuotes();
3551
+			return $v_result1;
3552
+		  }
3553 3553
 
3554
-          // ----- Get the only interesting attributes
3555
-          if (($v_result = $this->privConvertHeader2FileInfo($v_header, $p_file_list[$v_nb_extracted++])) != 1) {
3556
-            $this->privCloseFd();
3557
-            $this->privSwapBackMagicQuotes();
3558
-            return $v_result;
3559
-          }
3554
+		  // ----- Get the only interesting attributes
3555
+		  if (($v_result = $this->privConvertHeader2FileInfo($v_header, $p_file_list[$v_nb_extracted++])) != 1) {
3556
+			$this->privCloseFd();
3557
+			$this->privSwapBackMagicQuotes();
3558
+			return $v_result;
3559
+		  }
3560 3560
 
3561
-          // ----- Look for user callback abort
3562
-          if ($v_result1 == 2) {
3563
-          	break;
3564
-          }
3565
-        }
3566
-        // ----- Look for normal extraction
3567
-        else {
3568
-          // ----- Extracting the file
3569
-          $v_result1 = $this->privExtractFile($v_header,
3570
-		                                      $p_path, $p_remove_path,
3561
+		  // ----- Look for user callback abort
3562
+		  if ($v_result1 == 2) {
3563
+		  	break;
3564
+		  }
3565
+		}
3566
+		// ----- Look for normal extraction
3567
+		else {
3568
+		  // ----- Extracting the file
3569
+		  $v_result1 = $this->privExtractFile($v_header,
3570
+											  $p_path, $p_remove_path,
3571 3571
 											  $p_remove_all_path,
3572 3572
 											  $p_options);
3573
-          if ($v_result1 < 1) {
3574
-            $this->privCloseFd();
3575
-            $this->privSwapBackMagicQuotes();
3576
-            return $v_result1;
3577
-          }
3573
+		  if ($v_result1 < 1) {
3574
+			$this->privCloseFd();
3575
+			$this->privSwapBackMagicQuotes();
3576
+			return $v_result1;
3577
+		  }
3578 3578
 
3579
-          // ----- Get the only interesting attributes
3580
-          if (($v_result = $this->privConvertHeader2FileInfo($v_header, $p_file_list[$v_nb_extracted++])) != 1)
3581
-          {
3582
-            // ----- Close the zip file
3583
-            $this->privCloseFd();
3584
-            $this->privSwapBackMagicQuotes();
3579
+		  // ----- Get the only interesting attributes
3580
+		  if (($v_result = $this->privConvertHeader2FileInfo($v_header, $p_file_list[$v_nb_extracted++])) != 1)
3581
+		  {
3582
+			// ----- Close the zip file
3583
+			$this->privCloseFd();
3584
+			$this->privSwapBackMagicQuotes();
3585 3585
 
3586
-            return $v_result;
3587
-          }
3586
+			return $v_result;
3587
+		  }
3588 3588
 
3589
-          // ----- Look for user callback abort
3590
-          if ($v_result1 == 2) {
3591
-          	break;
3592
-          }
3593
-        }
3594
-      }
3595
-    }
3589
+		  // ----- Look for user callback abort
3590
+		  if ($v_result1 == 2) {
3591
+		  	break;
3592
+		  }
3593
+		}
3594
+	  }
3595
+	}
3596 3596
 
3597
-    // ----- Close the zip file
3598
-    $this->privCloseFd();
3599
-    $this->privSwapBackMagicQuotes();
3597
+	// ----- Close the zip file
3598
+	$this->privCloseFd();
3599
+	$this->privSwapBackMagicQuotes();
3600 3600
 
3601
-    // ----- Return
3602
-    return $v_result;
3601
+	// ----- Return
3602
+	return $v_result;
3603 3603
   }
3604 3604
   // --------------------------------------------------------------------------------
3605 3605
 
@@ -3614,346 +3614,346 @@  discard block
 block discarded – undo
3614 3614
   // --------------------------------------------------------------------------------
3615 3615
   function privExtractFile(&$p_entry, $p_path, $p_remove_path, $p_remove_all_path, &$p_options)
3616 3616
   {
3617
-    $v_result=1;
3617
+	$v_result=1;
3618 3618
 
3619
-    // ----- Read the file header
3620
-    if (($v_result = $this->privReadFileHeader($v_header)) != 1)
3621
-    {
3622
-      // ----- Return
3623
-      return $v_result;
3624
-    }
3619
+	// ----- Read the file header
3620
+	if (($v_result = $this->privReadFileHeader($v_header)) != 1)
3621
+	{
3622
+	  // ----- Return
3623
+	  return $v_result;
3624
+	}
3625 3625
 
3626 3626
 
3627
-    // ----- Check that the file header is coherent with $p_entry info
3628
-    if ($this->privCheckFileHeaders($v_header, $p_entry) != 1) {
3629
-        // TBC
3630
-    }
3627
+	// ----- Check that the file header is coherent with $p_entry info
3628
+	if ($this->privCheckFileHeaders($v_header, $p_entry) != 1) {
3629
+		// TBC
3630
+	}
3631 3631
 
3632
-    // ----- Look for all path to remove
3633
-    if ($p_remove_all_path == true) {
3634
-        // ----- Look for folder entry that not need to be extracted
3635
-        if (($p_entry['external']&0x00000010)==0x00000010) {
3632
+	// ----- Look for all path to remove
3633
+	if ($p_remove_all_path == true) {
3634
+		// ----- Look for folder entry that not need to be extracted
3635
+		if (($p_entry['external']&0x00000010)==0x00000010) {
3636 3636
 
3637
-            $p_entry['status'] = "filtered";
3637
+			$p_entry['status'] = "filtered";
3638 3638
 
3639
-            return $v_result;
3640
-        }
3639
+			return $v_result;
3640
+		}
3641 3641
 
3642
-        // ----- Get the basename of the path
3643
-        $p_entry['filename'] = basename($p_entry['filename']);
3644
-    }
3642
+		// ----- Get the basename of the path
3643
+		$p_entry['filename'] = basename($p_entry['filename']);
3644
+	}
3645 3645
 
3646
-    // ----- Look for path to remove
3647
-    else if ($p_remove_path != "")
3648
-    {
3649
-      if (PclZipUtilPathInclusion($p_remove_path, $p_entry['filename']) == 2)
3650
-      {
3646
+	// ----- Look for path to remove
3647
+	else if ($p_remove_path != "")
3648
+	{
3649
+	  if (PclZipUtilPathInclusion($p_remove_path, $p_entry['filename']) == 2)
3650
+	  {
3651 3651
 
3652
-        // ----- Change the file status
3653
-        $p_entry['status'] = "filtered";
3652
+		// ----- Change the file status
3653
+		$p_entry['status'] = "filtered";
3654 3654
 
3655
-        // ----- Return
3656
-        return $v_result;
3657
-      }
3655
+		// ----- Return
3656
+		return $v_result;
3657
+	  }
3658 3658
 
3659
-      $p_remove_path_size = strlen($p_remove_path);
3660
-      if (substr($p_entry['filename'], 0, $p_remove_path_size) == $p_remove_path)
3661
-      {
3659
+	  $p_remove_path_size = strlen($p_remove_path);
3660
+	  if (substr($p_entry['filename'], 0, $p_remove_path_size) == $p_remove_path)
3661
+	  {
3662 3662
 
3663
-        // ----- Remove the path
3664
-        $p_entry['filename'] = substr($p_entry['filename'], $p_remove_path_size);
3663
+		// ----- Remove the path
3664
+		$p_entry['filename'] = substr($p_entry['filename'], $p_remove_path_size);
3665 3665
 
3666
-      }
3667
-    }
3666
+	  }
3667
+	}
3668 3668
 
3669
-    // ----- Add the path
3670
-    if ($p_path != '') {
3671
-      $p_entry['filename'] = $p_path."/".$p_entry['filename'];
3672
-    }
3669
+	// ----- Add the path
3670
+	if ($p_path != '') {
3671
+	  $p_entry['filename'] = $p_path."/".$p_entry['filename'];
3672
+	}
3673 3673
     
3674
-    // ----- Check a base_dir_restriction
3675
-    if (isset($p_options[PCLZIP_OPT_EXTRACT_DIR_RESTRICTION])) {
3676
-      $v_inclusion
3677
-      = PclZipUtilPathInclusion($p_options[PCLZIP_OPT_EXTRACT_DIR_RESTRICTION],
3678
-                                $p_entry['filename']); 
3679
-      if ($v_inclusion == 0) {
3680
-
3681
-        PclZip::privErrorLog(PCLZIP_ERR_DIRECTORY_RESTRICTION,
3682
-			                     "Filename '".$p_entry['filename']."' is "
3674
+	// ----- Check a base_dir_restriction
3675
+	if (isset($p_options[PCLZIP_OPT_EXTRACT_DIR_RESTRICTION])) {
3676
+	  $v_inclusion
3677
+	  = PclZipUtilPathInclusion($p_options[PCLZIP_OPT_EXTRACT_DIR_RESTRICTION],
3678
+								$p_entry['filename']); 
3679
+	  if ($v_inclusion == 0) {
3680
+
3681
+		PclZip::privErrorLog(PCLZIP_ERR_DIRECTORY_RESTRICTION,
3682
+								 "Filename '".$p_entry['filename']."' is "
3683 3683
 								 ."outside PCLZIP_OPT_EXTRACT_DIR_RESTRICTION");
3684 3684
 
3685
-        return PclZip::errorCode();
3686
-      }
3687
-    }
3685
+		return PclZip::errorCode();
3686
+	  }
3687
+	}
3688 3688
 
3689
-    // ----- Look for pre-extract callback
3690
-    if (isset($p_options[PCLZIP_CB_PRE_EXTRACT])) {
3689
+	// ----- Look for pre-extract callback
3690
+	if (isset($p_options[PCLZIP_CB_PRE_EXTRACT])) {
3691 3691
 
3692
-      // ----- Generate a local information
3693
-      $v_local_header = array();
3694
-      $this->privConvertHeader2FileInfo($p_entry, $v_local_header);
3692
+	  // ----- Generate a local information
3693
+	  $v_local_header = array();
3694
+	  $this->privConvertHeader2FileInfo($p_entry, $v_local_header);
3695 3695
 
3696
-      // ----- Call the callback
3697
-      // Here I do not use call_user_func() because I need to send a reference to the
3698
-      // header.
3696
+	  // ----- Call the callback
3697
+	  // Here I do not use call_user_func() because I need to send a reference to the
3698
+	  // header.
3699 3699
 //      eval('$v_result = '.$p_options[PCLZIP_CB_PRE_EXTRACT].'(PCLZIP_CB_PRE_EXTRACT, $v_local_header);');
3700
-      $v_result = $p_options[PCLZIP_CB_PRE_EXTRACT](PCLZIP_CB_PRE_EXTRACT, $v_local_header);
3701
-      if ($v_result == 0) {
3702
-        // ----- Change the file status
3703
-        $p_entry['status'] = "skipped";
3704
-        $v_result = 1;
3705
-      }
3700
+	  $v_result = $p_options[PCLZIP_CB_PRE_EXTRACT](PCLZIP_CB_PRE_EXTRACT, $v_local_header);
3701
+	  if ($v_result == 0) {
3702
+		// ----- Change the file status
3703
+		$p_entry['status'] = "skipped";
3704
+		$v_result = 1;
3705
+	  }
3706 3706
       
3707
-      // ----- Look for abort result
3708
-      if ($v_result == 2) {
3709
-        // ----- This status is internal and will be changed in 'skipped'
3710
-        $p_entry['status'] = "aborted";
3711
-      	$v_result = PCLZIP_ERR_USER_ABORTED;
3712
-      }
3707
+	  // ----- Look for abort result
3708
+	  if ($v_result == 2) {
3709
+		// ----- This status is internal and will be changed in 'skipped'
3710
+		$p_entry['status'] = "aborted";
3711
+	  	$v_result = PCLZIP_ERR_USER_ABORTED;
3712
+	  }
3713 3713
 
3714
-      // ----- Update the informations
3715
-      // Only some fields can be modified
3716
-      $p_entry['filename'] = $v_local_header['filename'];
3717
-    }
3714
+	  // ----- Update the informations
3715
+	  // Only some fields can be modified
3716
+	  $p_entry['filename'] = $v_local_header['filename'];
3717
+	}
3718 3718
 
3719 3719
 
3720
-    // ----- Look if extraction should be done
3721
-    if ($p_entry['status'] == 'ok') {
3720
+	// ----- Look if extraction should be done
3721
+	if ($p_entry['status'] == 'ok') {
3722 3722
 
3723
-    // ----- Look for specific actions while the file exist
3724
-    if (file_exists($p_entry['filename']))
3725
-    {
3723
+	// ----- Look for specific actions while the file exist
3724
+	if (file_exists($p_entry['filename']))
3725
+	{
3726 3726
 
3727
-      // ----- Look if file is a directory
3728
-      if (is_dir($p_entry['filename']))
3729
-      {
3727
+	  // ----- Look if file is a directory
3728
+	  if (is_dir($p_entry['filename']))
3729
+	  {
3730 3730
 
3731
-        // ----- Change the file status
3732
-        $p_entry['status'] = "already_a_directory";
3731
+		// ----- Change the file status
3732
+		$p_entry['status'] = "already_a_directory";
3733 3733
         
3734
-        // ----- Look for PCLZIP_OPT_STOP_ON_ERROR
3735
-        // For historical reason first PclZip implementation does not stop
3736
-        // when this kind of error occurs.
3737
-        if (   (isset($p_options[PCLZIP_OPT_STOP_ON_ERROR]))
3738
-		    && ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) {
3739
-
3740
-            PclZip::privErrorLog(PCLZIP_ERR_ALREADY_A_DIRECTORY,
3741
-			                     "Filename '".$p_entry['filename']."' is "
3734
+		// ----- Look for PCLZIP_OPT_STOP_ON_ERROR
3735
+		// For historical reason first PclZip implementation does not stop
3736
+		// when this kind of error occurs.
3737
+		if (   (isset($p_options[PCLZIP_OPT_STOP_ON_ERROR]))
3738
+			&& ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) {
3739
+
3740
+			PclZip::privErrorLog(PCLZIP_ERR_ALREADY_A_DIRECTORY,
3741
+								 "Filename '".$p_entry['filename']."' is "
3742 3742
 								 ."already used by an existing directory");
3743 3743
 
3744
-            return PclZip::errorCode();
3745
-		    }
3746
-      }
3747
-      // ----- Look if file is write protected
3748
-      else if (!is_writeable($p_entry['filename']))
3749
-      {
3744
+			return PclZip::errorCode();
3745
+			}
3746
+	  }
3747
+	  // ----- Look if file is write protected
3748
+	  else if (!is_writeable($p_entry['filename']))
3749
+	  {
3750 3750
 
3751
-        // ----- Change the file status
3752
-        $p_entry['status'] = "write_protected";
3751
+		// ----- Change the file status
3752
+		$p_entry['status'] = "write_protected";
3753 3753
 
3754
-        // ----- Look for PCLZIP_OPT_STOP_ON_ERROR
3755
-        // For historical reason first PclZip implementation does not stop
3756
-        // when this kind of error occurs.
3757
-        if (   (isset($p_options[PCLZIP_OPT_STOP_ON_ERROR]))
3758
-		    && ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) {
3754
+		// ----- Look for PCLZIP_OPT_STOP_ON_ERROR
3755
+		// For historical reason first PclZip implementation does not stop
3756
+		// when this kind of error occurs.
3757
+		if (   (isset($p_options[PCLZIP_OPT_STOP_ON_ERROR]))
3758
+			&& ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) {
3759 3759
 
3760
-            PclZip::privErrorLog(PCLZIP_ERR_WRITE_OPEN_FAIL,
3761
-			                     "Filename '".$p_entry['filename']."' exists "
3760
+			PclZip::privErrorLog(PCLZIP_ERR_WRITE_OPEN_FAIL,
3761
+								 "Filename '".$p_entry['filename']."' exists "
3762 3762
 								 ."and is write protected");
3763 3763
 
3764
-            return PclZip::errorCode();
3765
-		    }
3766
-      }
3764
+			return PclZip::errorCode();
3765
+			}
3766
+	  }
3767 3767
 
3768
-      // ----- Look if the extracted file is older
3769
-      else if (filemtime($p_entry['filename']) > $p_entry['mtime'])
3770
-      {
3771
-        // ----- Change the file status
3772
-        if (   (isset($p_options[PCLZIP_OPT_REPLACE_NEWER]))
3773
-		    && ($p_options[PCLZIP_OPT_REPLACE_NEWER]===true)) {
3768
+	  // ----- Look if the extracted file is older
3769
+	  else if (filemtime($p_entry['filename']) > $p_entry['mtime'])
3770
+	  {
3771
+		// ----- Change the file status
3772
+		if (   (isset($p_options[PCLZIP_OPT_REPLACE_NEWER]))
3773
+			&& ($p_options[PCLZIP_OPT_REPLACE_NEWER]===true)) {
3774 3774
 	  	  }
3775
-		    else {
3776
-            $p_entry['status'] = "newer_exist";
3777
-
3778
-            // ----- Look for PCLZIP_OPT_STOP_ON_ERROR
3779
-            // For historical reason first PclZip implementation does not stop
3780
-            // when this kind of error occurs.
3781
-            if (   (isset($p_options[PCLZIP_OPT_STOP_ON_ERROR]))
3782
-		        && ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) {
3783
-
3784
-                PclZip::privErrorLog(PCLZIP_ERR_WRITE_OPEN_FAIL,
3785
-			             "Newer version of '".$p_entry['filename']."' exists "
3786
-					    ."and option PCLZIP_OPT_REPLACE_NEWER is not selected");
3787
-
3788
-                return PclZip::errorCode();
3789
-		      }
3790
-		    }
3791
-      }
3792
-      else {
3793
-      }
3794
-    }
3775
+			else {
3776
+			$p_entry['status'] = "newer_exist";
3777
+
3778
+			// ----- Look for PCLZIP_OPT_STOP_ON_ERROR
3779
+			// For historical reason first PclZip implementation does not stop
3780
+			// when this kind of error occurs.
3781
+			if (   (isset($p_options[PCLZIP_OPT_STOP_ON_ERROR]))
3782
+				&& ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) {
3783
+
3784
+				PclZip::privErrorLog(PCLZIP_ERR_WRITE_OPEN_FAIL,
3785
+						 "Newer version of '".$p_entry['filename']."' exists "
3786
+						."and option PCLZIP_OPT_REPLACE_NEWER is not selected");
3787
+
3788
+				return PclZip::errorCode();
3789
+			  }
3790
+			}
3791
+	  }
3792
+	  else {
3793
+	  }
3794
+	}
3795 3795
 
3796
-    // ----- Check the directory availability and create it if necessary
3797
-    else {
3798
-      if ((($p_entry['external']&0x00000010)==0x00000010) || (substr($p_entry['filename'], -1) == '/'))
3799
-        $v_dir_to_check = $p_entry['filename'];
3800
-      else if (!strstr($p_entry['filename'], "/"))
3801
-        $v_dir_to_check = "";
3802
-      else
3803
-        $v_dir_to_check = dirname($p_entry['filename']);
3804
-
3805
-        if (($v_result = $this->privDirCheck($v_dir_to_check, (($p_entry['external']&0x00000010)==0x00000010))) != 1) {
3806
-  
3807
-          // ----- Change the file status
3808
-          $p_entry['status'] = "path_creation_fail";
3796
+	// ----- Check the directory availability and create it if necessary
3797
+	else {
3798
+	  if ((($p_entry['external']&0x00000010)==0x00000010) || (substr($p_entry['filename'], -1) == '/'))
3799
+		$v_dir_to_check = $p_entry['filename'];
3800
+	  else if (!strstr($p_entry['filename'], "/"))
3801
+		$v_dir_to_check = "";
3802
+	  else
3803
+		$v_dir_to_check = dirname($p_entry['filename']);
3804
+
3805
+		if (($v_result = $this->privDirCheck($v_dir_to_check, (($p_entry['external']&0x00000010)==0x00000010))) != 1) {
3809 3806
   
3810
-          // ----- Return
3811
-          //return $v_result;
3812
-          $v_result = 1;
3813
-        }
3814
-      }
3815
-    }
3807
+		  // ----- Change the file status
3808
+		  $p_entry['status'] = "path_creation_fail";
3809
+  
3810
+		  // ----- Return
3811
+		  //return $v_result;
3812
+		  $v_result = 1;
3813
+		}
3814
+	  }
3815
+	}
3816 3816
 
3817
-    // ----- Look if extraction should be done
3818
-    if ($p_entry['status'] == 'ok') {
3817
+	// ----- Look if extraction should be done
3818
+	if ($p_entry['status'] == 'ok') {
3819 3819
 
3820
-      // ----- Do the extraction (if not a folder)
3821
-      if (!(($p_entry['external']&0x00000010)==0x00000010))
3822
-      {
3823
-        // ----- Look for not compressed file
3824
-        if ($p_entry['compression'] == 0) {
3820
+	  // ----- Do the extraction (if not a folder)
3821
+	  if (!(($p_entry['external']&0x00000010)==0x00000010))
3822
+	  {
3823
+		// ----- Look for not compressed file
3824
+		if ($p_entry['compression'] == 0) {
3825 3825
 
3826
-    		  // ----- Opening destination file
3827
-          if (($v_dest_file = @fopen($p_entry['filename'], 'wb')) == 0)
3828
-          {
3826
+			  // ----- Opening destination file
3827
+		  if (($v_dest_file = @fopen($p_entry['filename'], 'wb')) == 0)
3828
+		  {
3829 3829
 
3830
-            // ----- Change the file status
3831
-            $p_entry['status'] = "write_error";
3830
+			// ----- Change the file status
3831
+			$p_entry['status'] = "write_error";
3832 3832
 
3833
-            // ----- Return
3834
-            return $v_result;
3835
-          }
3833
+			// ----- Return
3834
+			return $v_result;
3835
+		  }
3836 3836
 
3837 3837
 
3838
-          // ----- Read the file by PCLZIP_READ_BLOCK_SIZE octets blocks
3839
-          $v_size = $p_entry['compressed_size'];
3840
-          while ($v_size != 0)
3841
-          {
3842
-            $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
3843
-            $v_buffer = @fread($this->zip_fd, $v_read_size);
3844
-            /* Try to speed up the code
3838
+		  // ----- Read the file by PCLZIP_READ_BLOCK_SIZE octets blocks
3839
+		  $v_size = $p_entry['compressed_size'];
3840
+		  while ($v_size != 0)
3841
+		  {
3842
+			$v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
3843
+			$v_buffer = @fread($this->zip_fd, $v_read_size);
3844
+			/* Try to speed up the code
3845 3845
             $v_binary_data = pack('a'.$v_read_size, $v_buffer);
3846 3846
             @fwrite($v_dest_file, $v_binary_data, $v_read_size);
3847 3847
             */
3848
-            @fwrite($v_dest_file, $v_buffer, $v_read_size);            
3849
-            $v_size -= $v_read_size;
3850
-          }
3848
+			@fwrite($v_dest_file, $v_buffer, $v_read_size);            
3849
+			$v_size -= $v_read_size;
3850
+		  }
3851 3851
 
3852
-          // ----- Closing the destination file
3853
-          fclose($v_dest_file);
3852
+		  // ----- Closing the destination file
3853
+		  fclose($v_dest_file);
3854 3854
 
3855
-          // ----- Change the file mtime
3856
-          touch($p_entry['filename'], $p_entry['mtime']);
3855
+		  // ----- Change the file mtime
3856
+		  touch($p_entry['filename'], $p_entry['mtime']);
3857 3857
           
3858 3858
 
3859
-        }
3860
-        else {
3861
-          // ----- TBC
3862
-          // Need to be finished
3863
-          if (($p_entry['flag'] & 1) == 1) {
3864
-            PclZip::privErrorLog(PCLZIP_ERR_UNSUPPORTED_ENCRYPTION, 'File \''.$p_entry['filename'].'\' is encrypted. Encrypted files are not supported.');
3865
-            return PclZip::errorCode();
3866
-          }
3859
+		}
3860
+		else {
3861
+		  // ----- TBC
3862
+		  // Need to be finished
3863
+		  if (($p_entry['flag'] & 1) == 1) {
3864
+			PclZip::privErrorLog(PCLZIP_ERR_UNSUPPORTED_ENCRYPTION, 'File \''.$p_entry['filename'].'\' is encrypted. Encrypted files are not supported.');
3865
+			return PclZip::errorCode();
3866
+		  }
3867 3867
 
3868 3868
 
3869
-          // ----- Look for using temporary file to unzip
3870
-          if ( (!isset($p_options[PCLZIP_OPT_TEMP_FILE_OFF])) 
3871
-              && (isset($p_options[PCLZIP_OPT_TEMP_FILE_ON])
3872
-                  || (isset($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD])
3873
-                      && ($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD] <= $p_entry['size'])) ) ) {
3874
-            $v_result = $this->privExtractFileUsingTempFile($p_entry, $p_options);
3875
-            if ($v_result < PCLZIP_ERR_NO_ERROR) {
3876
-              return $v_result;
3877
-            }
3878
-          }
3869
+		  // ----- Look for using temporary file to unzip
3870
+		  if ( (!isset($p_options[PCLZIP_OPT_TEMP_FILE_OFF])) 
3871
+			  && (isset($p_options[PCLZIP_OPT_TEMP_FILE_ON])
3872
+				  || (isset($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD])
3873
+					  && ($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD] <= $p_entry['size'])) ) ) {
3874
+			$v_result = $this->privExtractFileUsingTempFile($p_entry, $p_options);
3875
+			if ($v_result < PCLZIP_ERR_NO_ERROR) {
3876
+			  return $v_result;
3877
+			}
3878
+		  }
3879 3879
           
3880
-          // ----- Look for extract in memory
3881
-          else {
3880
+		  // ----- Look for extract in memory
3881
+		  else {
3882 3882
 
3883 3883
           
3884
-            // ----- Read the compressed file in a buffer (one shot)
3885
-            $v_buffer = @fread($this->zip_fd, $p_entry['compressed_size']);
3884
+			// ----- Read the compressed file in a buffer (one shot)
3885
+			$v_buffer = @fread($this->zip_fd, $p_entry['compressed_size']);
3886 3886
             
3887
-            // ----- Decompress the file
3888
-            $v_file_content = @gzinflate($v_buffer);
3889
-            unset($v_buffer);
3890
-            if ($v_file_content === FALSE) {
3887
+			// ----- Decompress the file
3888
+			$v_file_content = @gzinflate($v_buffer);
3889
+			unset($v_buffer);
3890
+			if ($v_file_content === FALSE) {
3891 3891
   
3892
-              // ----- Change the file status
3893
-              // TBC
3894
-              $p_entry['status'] = "error";
3892
+			  // ----- Change the file status
3893
+			  // TBC
3894
+			  $p_entry['status'] = "error";
3895 3895
               
3896
-              return $v_result;
3897
-            }
3896
+			  return $v_result;
3897
+			}
3898 3898
             
3899
-            // ----- Opening destination file
3900
-            if (($v_dest_file = @fopen($p_entry['filename'], 'wb')) == 0) {
3899
+			// ----- Opening destination file
3900
+			if (($v_dest_file = @fopen($p_entry['filename'], 'wb')) == 0) {
3901 3901
   
3902
-              // ----- Change the file status
3903
-              $p_entry['status'] = "write_error";
3902
+			  // ----- Change the file status
3903
+			  $p_entry['status'] = "write_error";
3904 3904
   
3905
-              return $v_result;
3906
-            }
3905
+			  return $v_result;
3906
+			}
3907 3907
   
3908
-            // ----- Write the uncompressed data
3909
-            @fwrite($v_dest_file, $v_file_content, $p_entry['size']);
3910
-            unset($v_file_content);
3908
+			// ----- Write the uncompressed data
3909
+			@fwrite($v_dest_file, $v_file_content, $p_entry['size']);
3910
+			unset($v_file_content);
3911 3911
   
3912
-            // ----- Closing the destination file
3913
-            @fclose($v_dest_file);
3912
+			// ----- Closing the destination file
3913
+			@fclose($v_dest_file);
3914 3914
             
3915
-          }
3915
+		  }
3916 3916
 
3917
-          // ----- Change the file mtime
3918
-          @touch($p_entry['filename'], $p_entry['mtime']);
3919
-        }
3917
+		  // ----- Change the file mtime
3918
+		  @touch($p_entry['filename'], $p_entry['mtime']);
3919
+		}
3920 3920
 
3921
-        // ----- Look for chmod option
3922
-        if (isset($p_options[PCLZIP_OPT_SET_CHMOD])) {
3921
+		// ----- Look for chmod option
3922
+		if (isset($p_options[PCLZIP_OPT_SET_CHMOD])) {
3923 3923
 
3924
-          // ----- Change the mode of the file
3925
-          @chmod($p_entry['filename'], $p_options[PCLZIP_OPT_SET_CHMOD]);
3926
-        }
3924
+		  // ----- Change the mode of the file
3925
+		  @chmod($p_entry['filename'], $p_options[PCLZIP_OPT_SET_CHMOD]);
3926
+		}
3927 3927
 
3928
-      }
3929
-    }
3928
+	  }
3929
+	}
3930 3930
 
3931 3931
   	// ----- Change abort status
3932 3932
   	if ($p_entry['status'] == "aborted") {
3933
-        $p_entry['status'] = "skipped";
3933
+		$p_entry['status'] = "skipped";
3934 3934
   	}
3935 3935
 	
3936
-    // ----- Look for post-extract callback
3937
-    elseif (isset($p_options[PCLZIP_CB_POST_EXTRACT])) {
3936
+	// ----- Look for post-extract callback
3937
+	elseif (isset($p_options[PCLZIP_CB_POST_EXTRACT])) {
3938 3938
 
3939
-      // ----- Generate a local information
3940
-      $v_local_header = array();
3941
-      $this->privConvertHeader2FileInfo($p_entry, $v_local_header);
3939
+	  // ----- Generate a local information
3940
+	  $v_local_header = array();
3941
+	  $this->privConvertHeader2FileInfo($p_entry, $v_local_header);
3942 3942
 
3943
-      // ----- Call the callback
3944
-      // Here I do not use call_user_func() because I need to send a reference to the
3945
-      // header.
3943
+	  // ----- Call the callback
3944
+	  // Here I do not use call_user_func() because I need to send a reference to the
3945
+	  // header.
3946 3946
 //      eval('$v_result = '.$p_options[PCLZIP_CB_POST_EXTRACT].'(PCLZIP_CB_POST_EXTRACT, $v_local_header);');
3947
-      $v_result = $p_options[PCLZIP_CB_POST_EXTRACT](PCLZIP_CB_POST_EXTRACT, $v_local_header);
3947
+	  $v_result = $p_options[PCLZIP_CB_POST_EXTRACT](PCLZIP_CB_POST_EXTRACT, $v_local_header);
3948 3948
 
3949
-      // ----- Look for abort result
3950
-      if ($v_result == 2) {
3951
-      	$v_result = PCLZIP_ERR_USER_ABORTED;
3952
-      }
3953
-    }
3949
+	  // ----- Look for abort result
3950
+	  if ($v_result == 2) {
3951
+	  	$v_result = PCLZIP_ERR_USER_ABORTED;
3952
+	  }
3953
+	}
3954 3954
 
3955
-    // ----- Return
3956
-    return $v_result;
3955
+	// ----- Return
3956
+	return $v_result;
3957 3957
   }
3958 3958
   // --------------------------------------------------------------------------------
3959 3959
 
@@ -3965,71 +3965,71 @@  discard block
 block discarded – undo
3965 3965
   // --------------------------------------------------------------------------------
3966 3966
   function privExtractFileUsingTempFile(&$p_entry, &$p_options)
3967 3967
   {
3968
-    $v_result=1;
3968
+	$v_result=1;
3969 3969
         
3970
-    // ----- Creates a temporary file
3971
-    $v_gzip_temp_name = PCLZIP_TEMPORARY_DIR.uniqid('pclzip-').'.gz';
3972
-    if (($v_dest_file = @fopen($v_gzip_temp_name, "wb")) == 0) {
3973
-      fclose($v_file);
3974
-      PclZip::privErrorLog(PCLZIP_ERR_WRITE_OPEN_FAIL, 'Unable to open temporary file \''.$v_gzip_temp_name.'\' in binary write mode');
3975
-      return PclZip::errorCode();
3976
-    }
3970
+	// ----- Creates a temporary file
3971
+	$v_gzip_temp_name = PCLZIP_TEMPORARY_DIR.uniqid('pclzip-').'.gz';
3972
+	if (($v_dest_file = @fopen($v_gzip_temp_name, "wb")) == 0) {
3973
+	  fclose($v_file);
3974
+	  PclZip::privErrorLog(PCLZIP_ERR_WRITE_OPEN_FAIL, 'Unable to open temporary file \''.$v_gzip_temp_name.'\' in binary write mode');
3975
+	  return PclZip::errorCode();
3976
+	}
3977 3977
 
3978 3978
 
3979
-    // ----- Write gz file format header
3980
-    $v_binary_data = pack('va1a1Va1a1', 0x8b1f, Chr($p_entry['compression']), Chr(0x00), time(), Chr(0x00), Chr(3));
3981
-    @fwrite($v_dest_file, $v_binary_data, 10);
3979
+	// ----- Write gz file format header
3980
+	$v_binary_data = pack('va1a1Va1a1', 0x8b1f, Chr($p_entry['compression']), Chr(0x00), time(), Chr(0x00), Chr(3));
3981
+	@fwrite($v_dest_file, $v_binary_data, 10);
3982 3982
 
3983
-    // ----- Read the file by PCLZIP_READ_BLOCK_SIZE octets blocks
3984
-    $v_size = $p_entry['compressed_size'];
3985
-    while ($v_size != 0)
3986
-    {
3987
-      $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
3988
-      $v_buffer = @fread($this->zip_fd, $v_read_size);
3989
-      //$v_binary_data = pack('a'.$v_read_size, $v_buffer);
3990
-      @fwrite($v_dest_file, $v_buffer, $v_read_size);
3991
-      $v_size -= $v_read_size;
3992
-    }
3983
+	// ----- Read the file by PCLZIP_READ_BLOCK_SIZE octets blocks
3984
+	$v_size = $p_entry['compressed_size'];
3985
+	while ($v_size != 0)
3986
+	{
3987
+	  $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
3988
+	  $v_buffer = @fread($this->zip_fd, $v_read_size);
3989
+	  //$v_binary_data = pack('a'.$v_read_size, $v_buffer);
3990
+	  @fwrite($v_dest_file, $v_buffer, $v_read_size);
3991
+	  $v_size -= $v_read_size;
3992
+	}
3993 3993
 
3994
-    // ----- Write gz file format footer
3995
-    $v_binary_data = pack('VV', $p_entry['crc'], $p_entry['size']);
3996
-    @fwrite($v_dest_file, $v_binary_data, 8);
3994
+	// ----- Write gz file format footer
3995
+	$v_binary_data = pack('VV', $p_entry['crc'], $p_entry['size']);
3996
+	@fwrite($v_dest_file, $v_binary_data, 8);
3997 3997
 
3998
-    // ----- Close the temporary file
3999
-    @fclose($v_dest_file);
3998
+	// ----- Close the temporary file
3999
+	@fclose($v_dest_file);
4000 4000
 
4001
-    // ----- Opening destination file
4002
-    if (($v_dest_file = @fopen($p_entry['filename'], 'wb')) == 0) {
4003
-      $p_entry['status'] = "write_error";
4004
-      return $v_result;
4005
-    }
4001
+	// ----- Opening destination file
4002
+	if (($v_dest_file = @fopen($p_entry['filename'], 'wb')) == 0) {
4003
+	  $p_entry['status'] = "write_error";
4004
+	  return $v_result;
4005
+	}
4006 4006
 
4007
-    // ----- Open the temporary gz file
4008
-    if (($v_src_file = @gzopen($v_gzip_temp_name, 'rb')) == 0) {
4009
-      @fclose($v_dest_file);
4010
-      $p_entry['status'] = "read_error";
4011
-      PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open temporary file \''.$v_gzip_temp_name.'\' in binary read mode');
4012
-      return PclZip::errorCode();
4013
-    }
4007
+	// ----- Open the temporary gz file
4008
+	if (($v_src_file = @gzopen($v_gzip_temp_name, 'rb')) == 0) {
4009
+	  @fclose($v_dest_file);
4010
+	  $p_entry['status'] = "read_error";
4011
+	  PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open temporary file \''.$v_gzip_temp_name.'\' in binary read mode');
4012
+	  return PclZip::errorCode();
4013
+	}
4014 4014
 
4015 4015
 
4016
-    // ----- Read the file by PCLZIP_READ_BLOCK_SIZE octets blocks
4017
-    $v_size = $p_entry['size'];
4018
-    while ($v_size != 0) {
4019
-      $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
4020
-      $v_buffer = @gzread($v_src_file, $v_read_size);
4021
-      //$v_binary_data = pack('a'.$v_read_size, $v_buffer);
4022
-      @fwrite($v_dest_file, $v_buffer, $v_read_size);
4023
-      $v_size -= $v_read_size;
4024
-    }
4025
-    @fclose($v_dest_file);
4026
-    @gzclose($v_src_file);
4016
+	// ----- Read the file by PCLZIP_READ_BLOCK_SIZE octets blocks
4017
+	$v_size = $p_entry['size'];
4018
+	while ($v_size != 0) {
4019
+	  $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
4020
+	  $v_buffer = @gzread($v_src_file, $v_read_size);
4021
+	  //$v_binary_data = pack('a'.$v_read_size, $v_buffer);
4022
+	  @fwrite($v_dest_file, $v_buffer, $v_read_size);
4023
+	  $v_size -= $v_read_size;
4024
+	}
4025
+	@fclose($v_dest_file);
4026
+	@gzclose($v_src_file);
4027 4027
 
4028
-    // ----- Delete the temporary file
4029
-    @unlink($v_gzip_temp_name);
4028
+	// ----- Delete the temporary file
4029
+	@unlink($v_gzip_temp_name);
4030 4030
     
4031
-    // ----- Return
4032
-    return $v_result;
4031
+	// ----- Return
4032
+	return $v_result;
4033 4033
   }
4034 4034
   // --------------------------------------------------------------------------------
4035 4035
 
@@ -4041,107 +4041,107 @@  discard block
 block discarded – undo
4041 4041
   // --------------------------------------------------------------------------------
4042 4042
   function privExtractFileInOutput(&$p_entry, &$p_options)
4043 4043
   {
4044
-    $v_result=1;
4044
+	$v_result=1;
4045 4045
 
4046
-    // ----- Read the file header
4047
-    if (($v_result = $this->privReadFileHeader($v_header)) != 1) {
4048
-      return $v_result;
4049
-    }
4046
+	// ----- Read the file header
4047
+	if (($v_result = $this->privReadFileHeader($v_header)) != 1) {
4048
+	  return $v_result;
4049
+	}
4050 4050
 
4051 4051
 
4052
-    // ----- Check that the file header is coherent with $p_entry info
4053
-    if ($this->privCheckFileHeaders($v_header, $p_entry) != 1) {
4054
-        // TBC
4055
-    }
4052
+	// ----- Check that the file header is coherent with $p_entry info
4053
+	if ($this->privCheckFileHeaders($v_header, $p_entry) != 1) {
4054
+		// TBC
4055
+	}
4056 4056
 
4057
-    // ----- Look for pre-extract callback
4058
-    if (isset($p_options[PCLZIP_CB_PRE_EXTRACT])) {
4057
+	// ----- Look for pre-extract callback
4058
+	if (isset($p_options[PCLZIP_CB_PRE_EXTRACT])) {
4059 4059
 
4060
-      // ----- Generate a local information
4061
-      $v_local_header = array();
4062
-      $this->privConvertHeader2FileInfo($p_entry, $v_local_header);
4060
+	  // ----- Generate a local information
4061
+	  $v_local_header = array();
4062
+	  $this->privConvertHeader2FileInfo($p_entry, $v_local_header);
4063 4063
 
4064
-      // ----- Call the callback
4065
-      // Here I do not use call_user_func() because I need to send a reference to the
4066
-      // header.
4064
+	  // ----- Call the callback
4065
+	  // Here I do not use call_user_func() because I need to send a reference to the
4066
+	  // header.
4067 4067
 //      eval('$v_result = '.$p_options[PCLZIP_CB_PRE_EXTRACT].'(PCLZIP_CB_PRE_EXTRACT, $v_local_header);');
4068
-      $v_result = $p_options[PCLZIP_CB_PRE_EXTRACT](PCLZIP_CB_PRE_EXTRACT, $v_local_header);
4069
-      if ($v_result == 0) {
4070
-        // ----- Change the file status
4071
-        $p_entry['status'] = "skipped";
4072
-        $v_result = 1;
4073
-      }
4068
+	  $v_result = $p_options[PCLZIP_CB_PRE_EXTRACT](PCLZIP_CB_PRE_EXTRACT, $v_local_header);
4069
+	  if ($v_result == 0) {
4070
+		// ----- Change the file status
4071
+		$p_entry['status'] = "skipped";
4072
+		$v_result = 1;
4073
+	  }
4074 4074
 
4075
-      // ----- Look for abort result
4076
-      if ($v_result == 2) {
4077
-        // ----- This status is internal and will be changed in 'skipped'
4078
-        $p_entry['status'] = "aborted";
4079
-      	$v_result = PCLZIP_ERR_USER_ABORTED;
4080
-      }
4075
+	  // ----- Look for abort result
4076
+	  if ($v_result == 2) {
4077
+		// ----- This status is internal and will be changed in 'skipped'
4078
+		$p_entry['status'] = "aborted";
4079
+	  	$v_result = PCLZIP_ERR_USER_ABORTED;
4080
+	  }
4081 4081
 
4082
-      // ----- Update the informations
4083
-      // Only some fields can be modified
4084
-      $p_entry['filename'] = $v_local_header['filename'];
4085
-    }
4082
+	  // ----- Update the informations
4083
+	  // Only some fields can be modified
4084
+	  $p_entry['filename'] = $v_local_header['filename'];
4085
+	}
4086 4086
 
4087
-    // ----- Trace
4087
+	// ----- Trace
4088 4088
 
4089
-    // ----- Look if extraction should be done
4090
-    if ($p_entry['status'] == 'ok') {
4089
+	// ----- Look if extraction should be done
4090
+	if ($p_entry['status'] == 'ok') {
4091 4091
 
4092
-      // ----- Do the extraction (if not a folder)
4093
-      if (!(($p_entry['external']&0x00000010)==0x00000010)) {
4094
-        // ----- Look for not compressed file
4095
-        if ($p_entry['compressed_size'] == $p_entry['size']) {
4092
+	  // ----- Do the extraction (if not a folder)
4093
+	  if (!(($p_entry['external']&0x00000010)==0x00000010)) {
4094
+		// ----- Look for not compressed file
4095
+		if ($p_entry['compressed_size'] == $p_entry['size']) {
4096 4096
 
4097
-          // ----- Read the file in a buffer (one shot)
4098
-          $v_buffer = @fread($this->zip_fd, $p_entry['compressed_size']);
4097
+		  // ----- Read the file in a buffer (one shot)
4098
+		  $v_buffer = @fread($this->zip_fd, $p_entry['compressed_size']);
4099 4099
 
4100
-          // ----- Send the file to the output
4101
-          echo $v_buffer;
4102
-          unset($v_buffer);
4103
-        }
4104
-        else {
4100
+		  // ----- Send the file to the output
4101
+		  echo $v_buffer;
4102
+		  unset($v_buffer);
4103
+		}
4104
+		else {
4105 4105
 
4106
-          // ----- Read the compressed file in a buffer (one shot)
4107
-          $v_buffer = @fread($this->zip_fd, $p_entry['compressed_size']);
4106
+		  // ----- Read the compressed file in a buffer (one shot)
4107
+		  $v_buffer = @fread($this->zip_fd, $p_entry['compressed_size']);
4108 4108
           
4109
-          // ----- Decompress the file
4110
-          $v_file_content = gzinflate($v_buffer);
4111
-          unset($v_buffer);
4112
-
4113
-          // ----- Send the file to the output
4114
-          echo $v_file_content;
4115
-          unset($v_file_content);
4116
-        }
4117
-      }
4118
-    }
4109
+		  // ----- Decompress the file
4110
+		  $v_file_content = gzinflate($v_buffer);
4111
+		  unset($v_buffer);
4112
+
4113
+		  // ----- Send the file to the output
4114
+		  echo $v_file_content;
4115
+		  unset($v_file_content);
4116
+		}
4117
+	  }
4118
+	}
4119 4119
 
4120 4120
 	// ----- Change abort status
4121 4121
 	if ($p_entry['status'] == "aborted") {
4122
-      $p_entry['status'] = "skipped";
4122
+	  $p_entry['status'] = "skipped";
4123 4123
 	}
4124 4124
 
4125
-    // ----- Look for post-extract callback
4126
-    elseif (isset($p_options[PCLZIP_CB_POST_EXTRACT])) {
4125
+	// ----- Look for post-extract callback
4126
+	elseif (isset($p_options[PCLZIP_CB_POST_EXTRACT])) {
4127 4127
 
4128
-      // ----- Generate a local information
4129
-      $v_local_header = array();
4130
-      $this->privConvertHeader2FileInfo($p_entry, $v_local_header);
4128
+	  // ----- Generate a local information
4129
+	  $v_local_header = array();
4130
+	  $this->privConvertHeader2FileInfo($p_entry, $v_local_header);
4131 4131
 
4132
-      // ----- Call the callback
4133
-      // Here I do not use call_user_func() because I need to send a reference to the
4134
-      // header.
4132
+	  // ----- Call the callback
4133
+	  // Here I do not use call_user_func() because I need to send a reference to the
4134
+	  // header.
4135 4135
 //      eval('$v_result = '.$p_options[PCLZIP_CB_POST_EXTRACT].'(PCLZIP_CB_POST_EXTRACT, $v_local_header);');
4136
-      $v_result = $p_options[PCLZIP_CB_POST_EXTRACT](PCLZIP_CB_POST_EXTRACT, $v_local_header);
4136
+	  $v_result = $p_options[PCLZIP_CB_POST_EXTRACT](PCLZIP_CB_POST_EXTRACT, $v_local_header);
4137 4137
 
4138
-      // ----- Look for abort result
4139
-      if ($v_result == 2) {
4140
-      	$v_result = PCLZIP_ERR_USER_ABORTED;
4141
-      }
4142
-    }
4138
+	  // ----- Look for abort result
4139
+	  if ($v_result == 2) {
4140
+	  	$v_result = PCLZIP_ERR_USER_ABORTED;
4141
+	  }
4142
+	}
4143 4143
 
4144
-    return $v_result;
4144
+	return $v_result;
4145 4145
   }
4146 4146
   // --------------------------------------------------------------------------------
4147 4147
 
@@ -4153,118 +4153,118 @@  discard block
 block discarded – undo
4153 4153
   // --------------------------------------------------------------------------------
4154 4154
   function privExtractFileAsString(&$p_entry, &$p_string, &$p_options)
4155 4155
   {
4156
-    $v_result=1;
4157
-
4158
-    // ----- Read the file header
4159
-    $v_header = array();
4160
-    if (($v_result = $this->privReadFileHeader($v_header)) != 1)
4161
-    {
4162
-      // ----- Return
4163
-      return $v_result;
4164
-    }
4156
+	$v_result=1;
4157
+
4158
+	// ----- Read the file header
4159
+	$v_header = array();
4160
+	if (($v_result = $this->privReadFileHeader($v_header)) != 1)
4161
+	{
4162
+	  // ----- Return
4163
+	  return $v_result;
4164
+	}
4165 4165
 
4166 4166
 
4167
-    // ----- Check that the file header is coherent with $p_entry info
4168
-    if ($this->privCheckFileHeaders($v_header, $p_entry) != 1) {
4169
-        // TBC
4170
-    }
4167
+	// ----- Check that the file header is coherent with $p_entry info
4168
+	if ($this->privCheckFileHeaders($v_header, $p_entry) != 1) {
4169
+		// TBC
4170
+	}
4171 4171
 
4172
-    // ----- Look for pre-extract callback
4173
-    if (isset($p_options[PCLZIP_CB_PRE_EXTRACT])) {
4172
+	// ----- Look for pre-extract callback
4173
+	if (isset($p_options[PCLZIP_CB_PRE_EXTRACT])) {
4174 4174
 
4175
-      // ----- Generate a local information
4176
-      $v_local_header = array();
4177
-      $this->privConvertHeader2FileInfo($p_entry, $v_local_header);
4175
+	  // ----- Generate a local information
4176
+	  $v_local_header = array();
4177
+	  $this->privConvertHeader2FileInfo($p_entry, $v_local_header);
4178 4178
 
4179
-      // ----- Call the callback
4180
-      // Here I do not use call_user_func() because I need to send a reference to the
4181
-      // header.
4179
+	  // ----- Call the callback
4180
+	  // Here I do not use call_user_func() because I need to send a reference to the
4181
+	  // header.
4182 4182
 //      eval('$v_result = '.$p_options[PCLZIP_CB_PRE_EXTRACT].'(PCLZIP_CB_PRE_EXTRACT, $v_local_header);');
4183
-      $v_result = $p_options[PCLZIP_CB_PRE_EXTRACT](PCLZIP_CB_PRE_EXTRACT, $v_local_header);
4184
-      if ($v_result == 0) {
4185
-        // ----- Change the file status
4186
-        $p_entry['status'] = "skipped";
4187
-        $v_result = 1;
4188
-      }
4183
+	  $v_result = $p_options[PCLZIP_CB_PRE_EXTRACT](PCLZIP_CB_PRE_EXTRACT, $v_local_header);
4184
+	  if ($v_result == 0) {
4185
+		// ----- Change the file status
4186
+		$p_entry['status'] = "skipped";
4187
+		$v_result = 1;
4188
+	  }
4189 4189
       
4190
-      // ----- Look for abort result
4191
-      if ($v_result == 2) {
4192
-        // ----- This status is internal and will be changed in 'skipped'
4193
-        $p_entry['status'] = "aborted";
4194
-      	$v_result = PCLZIP_ERR_USER_ABORTED;
4195
-      }
4190
+	  // ----- Look for abort result
4191
+	  if ($v_result == 2) {
4192
+		// ----- This status is internal and will be changed in 'skipped'
4193
+		$p_entry['status'] = "aborted";
4194
+	  	$v_result = PCLZIP_ERR_USER_ABORTED;
4195
+	  }
4196 4196
 
4197
-      // ----- Update the informations
4198
-      // Only some fields can be modified
4199
-      $p_entry['filename'] = $v_local_header['filename'];
4200
-    }
4197
+	  // ----- Update the informations
4198
+	  // Only some fields can be modified
4199
+	  $p_entry['filename'] = $v_local_header['filename'];
4200
+	}
4201 4201
 
4202 4202
 
4203
-    // ----- Look if extraction should be done
4204
-    if ($p_entry['status'] == 'ok') {
4203
+	// ----- Look if extraction should be done
4204
+	if ($p_entry['status'] == 'ok') {
4205 4205
 
4206
-      // ----- Do the extraction (if not a folder)
4207
-      if (!(($p_entry['external']&0x00000010)==0x00000010)) {
4208
-        // ----- Look for not compressed file
4206
+	  // ----- Do the extraction (if not a folder)
4207
+	  if (!(($p_entry['external']&0x00000010)==0x00000010)) {
4208
+		// ----- Look for not compressed file
4209 4209
   //      if ($p_entry['compressed_size'] == $p_entry['size'])
4210
-        if ($p_entry['compression'] == 0) {
4210
+		if ($p_entry['compression'] == 0) {
4211 4211
   
4212
-          // ----- Reading the file
4213
-          $p_string = @fread($this->zip_fd, $p_entry['compressed_size']);
4214
-        }
4215
-        else {
4212
+		  // ----- Reading the file
4213
+		  $p_string = @fread($this->zip_fd, $p_entry['compressed_size']);
4214
+		}
4215
+		else {
4216 4216
   
4217
-          // ----- Reading the file
4218
-          $v_data = @fread($this->zip_fd, $p_entry['compressed_size']);
4217
+		  // ----- Reading the file
4218
+		  $v_data = @fread($this->zip_fd, $p_entry['compressed_size']);
4219 4219
           
4220
-          // ----- Decompress the file
4221
-          if (($p_string = @gzinflate($v_data)) === FALSE) {
4222
-              // TBC
4223
-          }
4224
-        }
4220
+		  // ----- Decompress the file
4221
+		  if (($p_string = @gzinflate($v_data)) === FALSE) {
4222
+			  // TBC
4223
+		  }
4224
+		}
4225 4225
   
4226
-        // ----- Trace
4227
-      }
4228
-      else {
4229
-          // TBC : error : can not extract a folder in a string
4230
-      }
4226
+		// ----- Trace
4227
+	  }
4228
+	  else {
4229
+		  // TBC : error : can not extract a folder in a string
4230
+	  }
4231 4231
       
4232
-    }
4232
+	}
4233 4233
 
4234 4234
   	// ----- Change abort status
4235 4235
   	if ($p_entry['status'] == "aborted") {
4236
-        $p_entry['status'] = "skipped";
4236
+		$p_entry['status'] = "skipped";
4237 4237
   	}
4238 4238
 	
4239
-    // ----- Look for post-extract callback
4240
-    elseif (isset($p_options[PCLZIP_CB_POST_EXTRACT])) {
4239
+	// ----- Look for post-extract callback
4240
+	elseif (isset($p_options[PCLZIP_CB_POST_EXTRACT])) {
4241 4241
 
4242
-      // ----- Generate a local information
4243
-      $v_local_header = array();
4244
-      $this->privConvertHeader2FileInfo($p_entry, $v_local_header);
4242
+	  // ----- Generate a local information
4243
+	  $v_local_header = array();
4244
+	  $this->privConvertHeader2FileInfo($p_entry, $v_local_header);
4245 4245
       
4246
-      // ----- Swap the content to header
4247
-      $v_local_header['content'] = $p_string;
4248
-      $p_string = '';
4246
+	  // ----- Swap the content to header
4247
+	  $v_local_header['content'] = $p_string;
4248
+	  $p_string = '';
4249 4249
 
4250
-      // ----- Call the callback
4251
-      // Here I do not use call_user_func() because I need to send a reference to the
4252
-      // header.
4250
+	  // ----- Call the callback
4251
+	  // Here I do not use call_user_func() because I need to send a reference to the
4252
+	  // header.
4253 4253
 //      eval('$v_result = '.$p_options[PCLZIP_CB_POST_EXTRACT].'(PCLZIP_CB_POST_EXTRACT, $v_local_header);');
4254
-      $v_result = $p_options[PCLZIP_CB_POST_EXTRACT](PCLZIP_CB_POST_EXTRACT, $v_local_header);
4254
+	  $v_result = $p_options[PCLZIP_CB_POST_EXTRACT](PCLZIP_CB_POST_EXTRACT, $v_local_header);
4255 4255
 
4256
-      // ----- Swap back the content to header
4257
-      $p_string = $v_local_header['content'];
4258
-      unset($v_local_header['content']);
4256
+	  // ----- Swap back the content to header
4257
+	  $p_string = $v_local_header['content'];
4258
+	  unset($v_local_header['content']);
4259 4259
 
4260
-      // ----- Look for abort result
4261
-      if ($v_result == 2) {
4262
-      	$v_result = PCLZIP_ERR_USER_ABORTED;
4263
-      }
4264
-    }
4260
+	  // ----- Look for abort result
4261
+	  if ($v_result == 2) {
4262
+	  	$v_result = PCLZIP_ERR_USER_ABORTED;
4263
+	  }
4264
+	}
4265 4265
 
4266
-    // ----- Return
4267
-    return $v_result;
4266
+	// ----- Return
4267
+	return $v_result;
4268 4268
   }
4269 4269
   // --------------------------------------------------------------------------------
4270 4270
 
@@ -4276,98 +4276,98 @@  discard block
 block discarded – undo
4276 4276
   // --------------------------------------------------------------------------------
4277 4277
   function privReadFileHeader(&$p_header)
4278 4278
   {
4279
-    $v_result=1;
4279
+	$v_result=1;
4280 4280
 
4281
-    // ----- Read the 4 bytes signature
4282
-    $v_binary_data = @fread($this->zip_fd, 4);
4283
-    $v_data = unpack('Vid', $v_binary_data);
4281
+	// ----- Read the 4 bytes signature
4282
+	$v_binary_data = @fread($this->zip_fd, 4);
4283
+	$v_data = unpack('Vid', $v_binary_data);
4284 4284
 
4285
-    // ----- Check signature
4286
-    if ($v_data['id'] != 0x04034b50)
4287
-    {
4285
+	// ----- Check signature
4286
+	if ($v_data['id'] != 0x04034b50)
4287
+	{
4288 4288
 
4289
-      // ----- Error log
4290
-      PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'Invalid archive structure');
4289
+	  // ----- Error log
4290
+	  PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'Invalid archive structure');
4291 4291
 
4292
-      // ----- Return
4293
-      return PclZip::errorCode();
4294
-    }
4292
+	  // ----- Return
4293
+	  return PclZip::errorCode();
4294
+	}
4295 4295
 
4296
-    // ----- Read the first 42 bytes of the header
4297
-    $v_binary_data = fread($this->zip_fd, 26);
4296
+	// ----- Read the first 42 bytes of the header
4297
+	$v_binary_data = fread($this->zip_fd, 26);
4298 4298
 
4299
-    // ----- Look for invalid block size
4300
-    if (strlen($v_binary_data) != 26)
4301
-    {
4302
-      $p_header['filename'] = "";
4303
-      $p_header['status'] = "invalid_header";
4299
+	// ----- Look for invalid block size
4300
+	if (strlen($v_binary_data) != 26)
4301
+	{
4302
+	  $p_header['filename'] = "";
4303
+	  $p_header['status'] = "invalid_header";
4304 4304
 
4305
-      // ----- Error log
4306
-      PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, "Invalid block size : ".strlen($v_binary_data));
4305
+	  // ----- Error log
4306
+	  PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, "Invalid block size : ".strlen($v_binary_data));
4307 4307
 
4308
-      // ----- Return
4309
-      return PclZip::errorCode();
4310
-    }
4308
+	  // ----- Return
4309
+	  return PclZip::errorCode();
4310
+	}
4311 4311
 
4312
-    // ----- Extract the values
4313
-    $v_data = unpack('vversion/vflag/vcompression/vmtime/vmdate/Vcrc/Vcompressed_size/Vsize/vfilename_len/vextra_len', $v_binary_data);
4312
+	// ----- Extract the values
4313
+	$v_data = unpack('vversion/vflag/vcompression/vmtime/vmdate/Vcrc/Vcompressed_size/Vsize/vfilename_len/vextra_len', $v_binary_data);
4314 4314
 
4315
-    // ----- Get filename
4316
-    $p_header['filename'] = fread($this->zip_fd, $v_data['filename_len']);
4315
+	// ----- Get filename
4316
+	$p_header['filename'] = fread($this->zip_fd, $v_data['filename_len']);
4317 4317
 
4318
-    // ----- Get extra_fields
4319
-    if ($v_data['extra_len'] != 0) {
4320
-      $p_header['extra'] = fread($this->zip_fd, $v_data['extra_len']);
4321
-    }
4322
-    else {
4323
-      $p_header['extra'] = '';
4324
-    }
4318
+	// ----- Get extra_fields
4319
+	if ($v_data['extra_len'] != 0) {
4320
+	  $p_header['extra'] = fread($this->zip_fd, $v_data['extra_len']);
4321
+	}
4322
+	else {
4323
+	  $p_header['extra'] = '';
4324
+	}
4325 4325
 
4326
-    // ----- Extract properties
4327
-    $p_header['version_extracted'] = $v_data['version'];
4328
-    $p_header['compression'] = $v_data['compression'];
4329
-    $p_header['size'] = $v_data['size'];
4330
-    $p_header['compressed_size'] = $v_data['compressed_size'];
4331
-    $p_header['crc'] = $v_data['crc'];
4332
-    $p_header['flag'] = $v_data['flag'];
4333
-    $p_header['filename_len'] = $v_data['filename_len'];
4334
-
4335
-    // ----- Recuperate date in UNIX format
4336
-    $p_header['mdate'] = $v_data['mdate'];
4337
-    $p_header['mtime'] = $v_data['mtime'];
4338
-    if ($p_header['mdate'] && $p_header['mtime'])
4339
-    {
4340
-      // ----- Extract time
4341
-      $v_hour = ($p_header['mtime'] & 0xF800) >> 11;
4342
-      $v_minute = ($p_header['mtime'] & 0x07E0) >> 5;
4343
-      $v_seconde = ($p_header['mtime'] & 0x001F)*2;
4344
-
4345
-      // ----- Extract date
4346
-      $v_year = (($p_header['mdate'] & 0xFE00) >> 9) + 1980;
4347
-      $v_month = ($p_header['mdate'] & 0x01E0) >> 5;
4348
-      $v_day = $p_header['mdate'] & 0x001F;
4349
-
4350
-      // ----- Get UNIX date format
4351
-      $p_header['mtime'] = @mktime($v_hour, $v_minute, $v_seconde, $v_month, $v_day, $v_year);
4326
+	// ----- Extract properties
4327
+	$p_header['version_extracted'] = $v_data['version'];
4328
+	$p_header['compression'] = $v_data['compression'];
4329
+	$p_header['size'] = $v_data['size'];
4330
+	$p_header['compressed_size'] = $v_data['compressed_size'];
4331
+	$p_header['crc'] = $v_data['crc'];
4332
+	$p_header['flag'] = $v_data['flag'];
4333
+	$p_header['filename_len'] = $v_data['filename_len'];
4334
+
4335
+	// ----- Recuperate date in UNIX format
4336
+	$p_header['mdate'] = $v_data['mdate'];
4337
+	$p_header['mtime'] = $v_data['mtime'];
4338
+	if ($p_header['mdate'] && $p_header['mtime'])
4339
+	{
4340
+	  // ----- Extract time
4341
+	  $v_hour = ($p_header['mtime'] & 0xF800) >> 11;
4342
+	  $v_minute = ($p_header['mtime'] & 0x07E0) >> 5;
4343
+	  $v_seconde = ($p_header['mtime'] & 0x001F)*2;
4344
+
4345
+	  // ----- Extract date
4346
+	  $v_year = (($p_header['mdate'] & 0xFE00) >> 9) + 1980;
4347
+	  $v_month = ($p_header['mdate'] & 0x01E0) >> 5;
4348
+	  $v_day = $p_header['mdate'] & 0x001F;
4349
+
4350
+	  // ----- Get UNIX date format
4351
+	  $p_header['mtime'] = @mktime($v_hour, $v_minute, $v_seconde, $v_month, $v_day, $v_year);
4352 4352
 
4353
-    }
4354
-    else
4355
-    {
4356
-      $p_header['mtime'] = time();
4357
-    }
4353
+	}
4354
+	else
4355
+	{
4356
+	  $p_header['mtime'] = time();
4357
+	}
4358 4358
 
4359
-    // TBC
4360
-    //for(reset($v_data); $key = key($v_data); next($v_data)) {
4361
-    //}
4359
+	// TBC
4360
+	//for(reset($v_data); $key = key($v_data); next($v_data)) {
4361
+	//}
4362 4362
 
4363
-    // ----- Set the stored filename
4364
-    $p_header['stored_filename'] = $p_header['filename'];
4363
+	// ----- Set the stored filename
4364
+	$p_header['stored_filename'] = $p_header['filename'];
4365 4365
 
4366
-    // ----- Set the status field
4367
-    $p_header['status'] = "ok";
4366
+	// ----- Set the status field
4367
+	$p_header['status'] = "ok";
4368 4368
 
4369
-    // ----- Return
4370
-    return $v_result;
4369
+	// ----- Return
4370
+	return $v_result;
4371 4371
   }
4372 4372
   // --------------------------------------------------------------------------------
4373 4373
 
@@ -4379,101 +4379,101 @@  discard block
 block discarded – undo
4379 4379
   // --------------------------------------------------------------------------------
4380 4380
   function privReadCentralFileHeader(&$p_header)
4381 4381
   {
4382
-    $v_result=1;
4382
+	$v_result=1;
4383 4383
 
4384
-    // ----- Read the 4 bytes signature
4385
-    $v_binary_data = @fread($this->zip_fd, 4);
4386
-    $v_data = unpack('Vid', $v_binary_data);
4384
+	// ----- Read the 4 bytes signature
4385
+	$v_binary_data = @fread($this->zip_fd, 4);
4386
+	$v_data = unpack('Vid', $v_binary_data);
4387 4387
 
4388
-    // ----- Check signature
4389
-    if ($v_data['id'] != 0x02014b50)
4390
-    {
4388
+	// ----- Check signature
4389
+	if ($v_data['id'] != 0x02014b50)
4390
+	{
4391 4391
 
4392
-      // ----- Error log
4393
-      PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'Invalid archive structure');
4392
+	  // ----- Error log
4393
+	  PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'Invalid archive structure');
4394 4394
 
4395
-      // ----- Return
4396
-      return PclZip::errorCode();
4397
-    }
4395
+	  // ----- Return
4396
+	  return PclZip::errorCode();
4397
+	}
4398 4398
 
4399
-    // ----- Read the first 42 bytes of the header
4400
-    $v_binary_data = fread($this->zip_fd, 42);
4399
+	// ----- Read the first 42 bytes of the header
4400
+	$v_binary_data = fread($this->zip_fd, 42);
4401 4401
 
4402
-    // ----- Look for invalid block size
4403
-    if (strlen($v_binary_data) != 42)
4404
-    {
4405
-      $p_header['filename'] = "";
4406
-      $p_header['status'] = "invalid_header";
4402
+	// ----- Look for invalid block size
4403
+	if (strlen($v_binary_data) != 42)
4404
+	{
4405
+	  $p_header['filename'] = "";
4406
+	  $p_header['status'] = "invalid_header";
4407 4407
 
4408
-      // ----- Error log
4409
-      PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, "Invalid block size : ".strlen($v_binary_data));
4408
+	  // ----- Error log
4409
+	  PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, "Invalid block size : ".strlen($v_binary_data));
4410 4410
 
4411
-      // ----- Return
4412
-      return PclZip::errorCode();
4413
-    }
4411
+	  // ----- Return
4412
+	  return PclZip::errorCode();
4413
+	}
4414 4414
 
4415
-    // ----- Extract the values
4416
-    $p_header = unpack('vversion/vversion_extracted/vflag/vcompression/vmtime/vmdate/Vcrc/Vcompressed_size/Vsize/vfilename_len/vextra_len/vcomment_len/vdisk/vinternal/Vexternal/Voffset', $v_binary_data);
4417
-
4418
-    // ----- Get filename
4419
-    if ($p_header['filename_len'] != 0)
4420
-      $p_header['filename'] = fread($this->zip_fd, $p_header['filename_len']);
4421
-    else
4422
-      $p_header['filename'] = '';
4423
-
4424
-    // ----- Get extra
4425
-    if ($p_header['extra_len'] != 0)
4426
-      $p_header['extra'] = fread($this->zip_fd, $p_header['extra_len']);
4427
-    else
4428
-      $p_header['extra'] = '';
4429
-
4430
-    // ----- Get comment
4431
-    if ($p_header['comment_len'] != 0)
4432
-      $p_header['comment'] = fread($this->zip_fd, $p_header['comment_len']);
4433
-    else
4434
-      $p_header['comment'] = '';
4435
-
4436
-    // ----- Extract properties
4437
-
4438
-    // ----- Recuperate date in UNIX format
4439
-    //if ($p_header['mdate'] && $p_header['mtime'])
4440
-    // TBC : bug : this was ignoring time with 0/0/0
4441
-    if (1)
4442
-    {
4443
-      // ----- Extract time
4444
-      $v_hour = ($p_header['mtime'] & 0xF800) >> 11;
4445
-      $v_minute = ($p_header['mtime'] & 0x07E0) >> 5;
4446
-      $v_seconde = ($p_header['mtime'] & 0x001F)*2;
4447
-
4448
-      // ----- Extract date
4449
-      $v_year = (($p_header['mdate'] & 0xFE00) >> 9) + 1980;
4450
-      $v_month = ($p_header['mdate'] & 0x01E0) >> 5;
4451
-      $v_day = $p_header['mdate'] & 0x001F;
4452
-
4453
-      // ----- Get UNIX date format
4454
-      $p_header['mtime'] = @mktime($v_hour, $v_minute, $v_seconde, $v_month, $v_day, $v_year);
4415
+	// ----- Extract the values
4416
+	$p_header = unpack('vversion/vversion_extracted/vflag/vcompression/vmtime/vmdate/Vcrc/Vcompressed_size/Vsize/vfilename_len/vextra_len/vcomment_len/vdisk/vinternal/Vexternal/Voffset', $v_binary_data);
4417
+
4418
+	// ----- Get filename
4419
+	if ($p_header['filename_len'] != 0)
4420
+	  $p_header['filename'] = fread($this->zip_fd, $p_header['filename_len']);
4421
+	else
4422
+	  $p_header['filename'] = '';
4423
+
4424
+	// ----- Get extra
4425
+	if ($p_header['extra_len'] != 0)
4426
+	  $p_header['extra'] = fread($this->zip_fd, $p_header['extra_len']);
4427
+	else
4428
+	  $p_header['extra'] = '';
4429
+
4430
+	// ----- Get comment
4431
+	if ($p_header['comment_len'] != 0)
4432
+	  $p_header['comment'] = fread($this->zip_fd, $p_header['comment_len']);
4433
+	else
4434
+	  $p_header['comment'] = '';
4435
+
4436
+	// ----- Extract properties
4437
+
4438
+	// ----- Recuperate date in UNIX format
4439
+	//if ($p_header['mdate'] && $p_header['mtime'])
4440
+	// TBC : bug : this was ignoring time with 0/0/0
4441
+	if (1)
4442
+	{
4443
+	  // ----- Extract time
4444
+	  $v_hour = ($p_header['mtime'] & 0xF800) >> 11;
4445
+	  $v_minute = ($p_header['mtime'] & 0x07E0) >> 5;
4446
+	  $v_seconde = ($p_header['mtime'] & 0x001F)*2;
4447
+
4448
+	  // ----- Extract date
4449
+	  $v_year = (($p_header['mdate'] & 0xFE00) >> 9) + 1980;
4450
+	  $v_month = ($p_header['mdate'] & 0x01E0) >> 5;
4451
+	  $v_day = $p_header['mdate'] & 0x001F;
4452
+
4453
+	  // ----- Get UNIX date format
4454
+	  $p_header['mtime'] = @mktime($v_hour, $v_minute, $v_seconde, $v_month, $v_day, $v_year);
4455 4455
 
4456
-    }
4457
-    else
4458
-    {
4459
-      $p_header['mtime'] = time();
4460
-    }
4456
+	}
4457
+	else
4458
+	{
4459
+	  $p_header['mtime'] = time();
4460
+	}
4461 4461
 
4462
-    // ----- Set the stored filename
4463
-    $p_header['stored_filename'] = $p_header['filename'];
4462
+	// ----- Set the stored filename
4463
+	$p_header['stored_filename'] = $p_header['filename'];
4464 4464
 
4465
-    // ----- Set default status to ok
4466
-    $p_header['status'] = 'ok';
4465
+	// ----- Set default status to ok
4466
+	$p_header['status'] = 'ok';
4467 4467
 
4468
-    // ----- Look if it is a directory
4469
-    if (substr($p_header['filename'], -1) == '/') {
4470
-      //$p_header['external'] = 0x41FF0010;
4471
-      $p_header['external'] = 0x00000010;
4472
-    }
4468
+	// ----- Look if it is a directory
4469
+	if (substr($p_header['filename'], -1) == '/') {
4470
+	  //$p_header['external'] = 0x41FF0010;
4471
+	  $p_header['external'] = 0x00000010;
4472
+	}
4473 4473
 
4474 4474
 
4475
-    // ----- Return
4476
-    return $v_result;
4475
+	// ----- Return
4476
+	return $v_result;
4477 4477
   }
4478 4478
   // --------------------------------------------------------------------------------
4479 4479
 
@@ -4487,7 +4487,7 @@  discard block
 block discarded – undo
4487 4487
   // --------------------------------------------------------------------------------
4488 4488
   function privCheckFileHeaders(&$p_local_header, &$p_central_header)
4489 4489
   {
4490
-    $v_result=1;
4490
+	$v_result=1;
4491 4491
 
4492 4492
   	// ----- Check the static values
4493 4493
   	// TBC
@@ -4506,13 +4506,13 @@  discard block
 block discarded – undo
4506 4506
   
4507 4507
   	// ----- Look for flag bit 3
4508 4508
   	if (($p_local_header['flag'] & 8) == 8) {
4509
-          $p_local_header['size'] = $p_central_header['size'];
4510
-          $p_local_header['compressed_size'] = $p_central_header['compressed_size'];
4511
-          $p_local_header['crc'] = $p_central_header['crc'];
4509
+		  $p_local_header['size'] = $p_central_header['size'];
4510
+		  $p_local_header['compressed_size'] = $p_central_header['compressed_size'];
4511
+		  $p_local_header['crc'] = $p_central_header['crc'];
4512 4512
   	}
4513 4513
 
4514
-    // ----- Return
4515
-    return $v_result;
4514
+	// ----- Return
4515
+	return $v_result;
4516 4516
   }
4517 4517
   // --------------------------------------------------------------------------------
4518 4518
 
@@ -4524,152 +4524,152 @@  discard block
 block discarded – undo
4524 4524
   // --------------------------------------------------------------------------------
4525 4525
   function privReadEndCentralDir(&$p_central_dir)
4526 4526
   {
4527
-    $v_result=1;
4528
-
4529
-    // ----- Go to the end of the zip file
4530
-    $v_size = filesize($this->zipname);
4531
-    @fseek($this->zip_fd, $v_size);
4532
-    if (@ftell($this->zip_fd) != $v_size)
4533
-    {
4534
-      // ----- Error log
4535
-      PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'Unable to go to the end of the archive \''.$this->zipname.'\'');
4536
-
4537
-      // ----- Return
4538
-      return PclZip::errorCode();
4539
-    }
4527
+	$v_result=1;
4528
+
4529
+	// ----- Go to the end of the zip file
4530
+	$v_size = filesize($this->zipname);
4531
+	@fseek($this->zip_fd, $v_size);
4532
+	if (@ftell($this->zip_fd) != $v_size)
4533
+	{
4534
+	  // ----- Error log
4535
+	  PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'Unable to go to the end of the archive \''.$this->zipname.'\'');
4536
+
4537
+	  // ----- Return
4538
+	  return PclZip::errorCode();
4539
+	}
4540 4540
 
4541
-    // ----- First try : look if this is an archive with no commentaries (most of the time)
4542
-    // in this case the end of central dir is at 22 bytes of the file end
4543
-    $v_found = 0;
4544
-    if ($v_size > 26) {
4545
-      @fseek($this->zip_fd, $v_size-22);
4546
-      if (($v_pos = @ftell($this->zip_fd)) != ($v_size-22))
4547
-      {
4548
-        // ----- Error log
4549
-        PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'Unable to seek back to the middle of the archive \''.$this->zipname.'\'');
4550
-
4551
-        // ----- Return
4552
-        return PclZip::errorCode();
4553
-      }
4541
+	// ----- First try : look if this is an archive with no commentaries (most of the time)
4542
+	// in this case the end of central dir is at 22 bytes of the file end
4543
+	$v_found = 0;
4544
+	if ($v_size > 26) {
4545
+	  @fseek($this->zip_fd, $v_size-22);
4546
+	  if (($v_pos = @ftell($this->zip_fd)) != ($v_size-22))
4547
+	  {
4548
+		// ----- Error log
4549
+		PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'Unable to seek back to the middle of the archive \''.$this->zipname.'\'');
4550
+
4551
+		// ----- Return
4552
+		return PclZip::errorCode();
4553
+	  }
4554 4554
 
4555
-      // ----- Read for bytes
4556
-      $v_binary_data = @fread($this->zip_fd, 4);
4557
-      $v_data = @unpack('Vid', $v_binary_data);
4555
+	  // ----- Read for bytes
4556
+	  $v_binary_data = @fread($this->zip_fd, 4);
4557
+	  $v_data = @unpack('Vid', $v_binary_data);
4558 4558
 
4559
-      // ----- Check signature
4560
-      if ($v_data['id'] == 0x06054b50) {
4561
-        $v_found = 1;
4562
-      }
4559
+	  // ----- Check signature
4560
+	  if ($v_data['id'] == 0x06054b50) {
4561
+		$v_found = 1;
4562
+	  }
4563 4563
 
4564
-      $v_pos = ftell($this->zip_fd);
4565
-    }
4564
+	  $v_pos = ftell($this->zip_fd);
4565
+	}
4566 4566
 
4567
-    // ----- Go back to the maximum possible size of the Central Dir End Record
4568
-    if (!$v_found) {
4569
-      $v_maximum_size = 65557; // 0xFFFF + 22;
4570
-      if ($v_maximum_size > $v_size)
4571
-        $v_maximum_size = $v_size;
4572
-      @fseek($this->zip_fd, $v_size-$v_maximum_size);
4573
-      if (@ftell($this->zip_fd) != ($v_size-$v_maximum_size))
4574
-      {
4575
-        // ----- Error log
4576
-        PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'Unable to seek back to the middle of the archive \''.$this->zipname.'\'');
4577
-
4578
-        // ----- Return
4579
-        return PclZip::errorCode();
4580
-      }
4567
+	// ----- Go back to the maximum possible size of the Central Dir End Record
4568
+	if (!$v_found) {
4569
+	  $v_maximum_size = 65557; // 0xFFFF + 22;
4570
+	  if ($v_maximum_size > $v_size)
4571
+		$v_maximum_size = $v_size;
4572
+	  @fseek($this->zip_fd, $v_size-$v_maximum_size);
4573
+	  if (@ftell($this->zip_fd) != ($v_size-$v_maximum_size))
4574
+	  {
4575
+		// ----- Error log
4576
+		PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'Unable to seek back to the middle of the archive \''.$this->zipname.'\'');
4577
+
4578
+		// ----- Return
4579
+		return PclZip::errorCode();
4580
+	  }
4581 4581
 
4582
-      // ----- Read byte per byte in order to find the signature
4583
-      $v_pos = ftell($this->zip_fd);
4584
-      $v_bytes = 0x00000000;
4585
-      while ($v_pos < $v_size)
4586
-      {
4587
-        // ----- Read a byte
4588
-        $v_byte = @fread($this->zip_fd, 1);
4589
-
4590
-        // -----  Add the byte
4591
-        //$v_bytes = ($v_bytes << 8) | Ord($v_byte);
4592
-        // Note we mask the old value down such that once shifted we can never end up with more than a 32bit number 
4593
-        // Otherwise on systems where we have 64bit integers the check below for the magic number will fail. 
4594
-        $v_bytes = ( ($v_bytes & 0xFFFFFF) << 8) | Ord($v_byte); 
4595
-
4596
-        // ----- Compare the bytes
4597
-        if ($v_bytes == 0x504b0506)
4598
-        {
4599
-          $v_pos++;
4600
-          break;
4601
-        }
4602
-
4603
-        $v_pos++;
4604
-      }
4582
+	  // ----- Read byte per byte in order to find the signature
4583
+	  $v_pos = ftell($this->zip_fd);
4584
+	  $v_bytes = 0x00000000;
4585
+	  while ($v_pos < $v_size)
4586
+	  {
4587
+		// ----- Read a byte
4588
+		$v_byte = @fread($this->zip_fd, 1);
4589
+
4590
+		// -----  Add the byte
4591
+		//$v_bytes = ($v_bytes << 8) | Ord($v_byte);
4592
+		// Note we mask the old value down such that once shifted we can never end up with more than a 32bit number 
4593
+		// Otherwise on systems where we have 64bit integers the check below for the magic number will fail. 
4594
+		$v_bytes = ( ($v_bytes & 0xFFFFFF) << 8) | Ord($v_byte); 
4595
+
4596
+		// ----- Compare the bytes
4597
+		if ($v_bytes == 0x504b0506)
4598
+		{
4599
+		  $v_pos++;
4600
+		  break;
4601
+		}
4602
+
4603
+		$v_pos++;
4604
+	  }
4605 4605
 
4606
-      // ----- Look if not found end of central dir
4607
-      if ($v_pos == $v_size)
4608
-      {
4606
+	  // ----- Look if not found end of central dir
4607
+	  if ($v_pos == $v_size)
4608
+	  {
4609 4609
 
4610
-        // ----- Error log
4611
-        PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, "Unable to find End of Central Dir Record signature");
4610
+		// ----- Error log
4611
+		PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, "Unable to find End of Central Dir Record signature");
4612 4612
 
4613
-        // ----- Return
4614
-        return PclZip::errorCode();
4615
-      }
4616
-    }
4613
+		// ----- Return
4614
+		return PclZip::errorCode();
4615
+	  }
4616
+	}
4617 4617
 
4618
-    // ----- Read the first 18 bytes of the header
4619
-    $v_binary_data = fread($this->zip_fd, 18);
4618
+	// ----- Read the first 18 bytes of the header
4619
+	$v_binary_data = fread($this->zip_fd, 18);
4620 4620
 
4621
-    // ----- Look for invalid block size
4622
-    if (strlen($v_binary_data) != 18)
4623
-    {
4621
+	// ----- Look for invalid block size
4622
+	if (strlen($v_binary_data) != 18)
4623
+	{
4624 4624
 
4625
-      // ----- Error log
4626
-      PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, "Invalid End of Central Dir Record size : ".strlen($v_binary_data));
4625
+	  // ----- Error log
4626
+	  PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, "Invalid End of Central Dir Record size : ".strlen($v_binary_data));
4627 4627
 
4628
-      // ----- Return
4629
-      return PclZip::errorCode();
4630
-    }
4628
+	  // ----- Return
4629
+	  return PclZip::errorCode();
4630
+	}
4631 4631
 
4632
-    // ----- Extract the values
4633
-    $v_data = unpack('vdisk/vdisk_start/vdisk_entries/ventries/Vsize/Voffset/vcomment_size', $v_binary_data);
4632
+	// ----- Extract the values
4633
+	$v_data = unpack('vdisk/vdisk_start/vdisk_entries/ventries/Vsize/Voffset/vcomment_size', $v_binary_data);
4634 4634
 
4635
-    // ----- Check the global size
4636
-    if (($v_pos + $v_data['comment_size'] + 18) != $v_size) {
4635
+	// ----- Check the global size
4636
+	if (($v_pos + $v_data['comment_size'] + 18) != $v_size) {
4637 4637
 
4638 4638
 	  // ----- Removed in release 2.2 see readme file
4639 4639
 	  // The check of the file size is a little too strict.
4640 4640
 	  // Some bugs where found when a zip is encrypted/decrypted with 'crypt'.
4641 4641
 	  // While decrypted, zip has training 0 bytes
4642 4642
 	  if (0) {
4643
-      // ----- Error log
4644
-      PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT,
4645
-	                       'The central dir is not at the end of the archive.'
4643
+	  // ----- Error log
4644
+	  PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT,
4645
+						   'The central dir is not at the end of the archive.'
4646 4646
 						   .' Some trailing bytes exists after the archive.');
4647 4647
 
4648
-      // ----- Return
4649
-      return PclZip::errorCode();
4648
+	  // ----- Return
4649
+	  return PclZip::errorCode();
4650 4650
 	  }
4651
-    }
4651
+	}
4652 4652
 
4653
-    // ----- Get comment
4654
-    if ($v_data['comment_size'] != 0) {
4655
-      $p_central_dir['comment'] = fread($this->zip_fd, $v_data['comment_size']);
4656
-    }
4657
-    else
4658
-      $p_central_dir['comment'] = '';
4659
-
4660
-    $p_central_dir['entries'] = $v_data['entries'];
4661
-    $p_central_dir['disk_entries'] = $v_data['disk_entries'];
4662
-    $p_central_dir['offset'] = $v_data['offset'];
4663
-    $p_central_dir['size'] = $v_data['size'];
4664
-    $p_central_dir['disk'] = $v_data['disk'];
4665
-    $p_central_dir['disk_start'] = $v_data['disk_start'];
4666
-
4667
-    // TBC
4668
-    //for(reset($p_central_dir); $key = key($p_central_dir); next($p_central_dir)) {
4669
-    //}
4670
-
4671
-    // ----- Return
4672
-    return $v_result;
4653
+	// ----- Get comment
4654
+	if ($v_data['comment_size'] != 0) {
4655
+	  $p_central_dir['comment'] = fread($this->zip_fd, $v_data['comment_size']);
4656
+	}
4657
+	else
4658
+	  $p_central_dir['comment'] = '';
4659
+
4660
+	$p_central_dir['entries'] = $v_data['entries'];
4661
+	$p_central_dir['disk_entries'] = $v_data['disk_entries'];
4662
+	$p_central_dir['offset'] = $v_data['offset'];
4663
+	$p_central_dir['size'] = $v_data['size'];
4664
+	$p_central_dir['disk'] = $v_data['disk'];
4665
+	$p_central_dir['disk_start'] = $v_data['disk_start'];
4666
+
4667
+	// TBC
4668
+	//for(reset($p_central_dir); $key = key($p_central_dir); next($p_central_dir)) {
4669
+	//}
4670
+
4671
+	// ----- Return
4672
+	return $v_result;
4673 4673
   }
4674 4674
   // --------------------------------------------------------------------------------
4675 4675
 
@@ -4681,96 +4681,96 @@  discard block
 block discarded – undo
4681 4681
   // --------------------------------------------------------------------------------
4682 4682
   function privDeleteByRule(&$p_result_list, &$p_options)
4683 4683
   {
4684
-    $v_result=1;
4685
-    $v_list_detail = array();
4686
-
4687
-    // ----- Open the zip file
4688
-    if (($v_result=$this->privOpenFd('rb')) != 1)
4689
-    {
4690
-      // ----- Return
4691
-      return $v_result;
4692
-    }
4684
+	$v_result=1;
4685
+	$v_list_detail = array();
4686
+
4687
+	// ----- Open the zip file
4688
+	if (($v_result=$this->privOpenFd('rb')) != 1)
4689
+	{
4690
+	  // ----- Return
4691
+	  return $v_result;
4692
+	}
4693 4693
 
4694
-    // ----- Read the central directory informations
4695
-    $v_central_dir = array();
4696
-    if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1)
4697
-    {
4698
-      $this->privCloseFd();
4699
-      return $v_result;
4700
-    }
4694
+	// ----- Read the central directory informations
4695
+	$v_central_dir = array();
4696
+	if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1)
4697
+	{
4698
+	  $this->privCloseFd();
4699
+	  return $v_result;
4700
+	}
4701 4701
 
4702
-    // ----- Go to beginning of File
4703
-    @rewind($this->zip_fd);
4702
+	// ----- Go to beginning of File
4703
+	@rewind($this->zip_fd);
4704 4704
 
4705
-    // ----- Scan all the files
4706
-    // ----- Start at beginning of Central Dir
4707
-    $v_pos_entry = $v_central_dir['offset'];
4708
-    @rewind($this->zip_fd);
4709
-    if (@fseek($this->zip_fd, $v_pos_entry))
4710
-    {
4711
-      // ----- Close the zip file
4712
-      $this->privCloseFd();
4705
+	// ----- Scan all the files
4706
+	// ----- Start at beginning of Central Dir
4707
+	$v_pos_entry = $v_central_dir['offset'];
4708
+	@rewind($this->zip_fd);
4709
+	if (@fseek($this->zip_fd, $v_pos_entry))
4710
+	{
4711
+	  // ----- Close the zip file
4712
+	  $this->privCloseFd();
4713 4713
 
4714
-      // ----- Error log
4715
-      PclZip::privErrorLog(PCLZIP_ERR_INVALID_ARCHIVE_ZIP, 'Invalid archive size');
4714
+	  // ----- Error log
4715
+	  PclZip::privErrorLog(PCLZIP_ERR_INVALID_ARCHIVE_ZIP, 'Invalid archive size');
4716 4716
 
4717
-      // ----- Return
4718
-      return PclZip::errorCode();
4719
-    }
4717
+	  // ----- Return
4718
+	  return PclZip::errorCode();
4719
+	}
4720 4720
 
4721
-    // ----- Read each entry
4722
-    $v_header_list = array();
4723
-    $j_start = 0;
4724
-    for ($i=0, $v_nb_extracted=0; $i<$v_central_dir['entries']; $i++)
4725
-    {
4721
+	// ----- Read each entry
4722
+	$v_header_list = array();
4723
+	$j_start = 0;
4724
+	for ($i=0, $v_nb_extracted=0; $i<$v_central_dir['entries']; $i++)
4725
+	{
4726 4726
 
4727
-      // ----- Read the file header
4728
-      $v_header_list[$v_nb_extracted] = array();
4729
-      if (($v_result = $this->privReadCentralFileHeader($v_header_list[$v_nb_extracted])) != 1)
4730
-      {
4731
-        // ----- Close the zip file
4732
-        $this->privCloseFd();
4727
+	  // ----- Read the file header
4728
+	  $v_header_list[$v_nb_extracted] = array();
4729
+	  if (($v_result = $this->privReadCentralFileHeader($v_header_list[$v_nb_extracted])) != 1)
4730
+	  {
4731
+		// ----- Close the zip file
4732
+		$this->privCloseFd();
4733 4733
 
4734
-        return $v_result;
4735
-      }
4734
+		return $v_result;
4735
+	  }
4736 4736
 
4737 4737
 
4738
-      // ----- Store the index
4739
-      $v_header_list[$v_nb_extracted]['index'] = $i;
4740
-
4741
-      // ----- Look for the specific extract rules
4742
-      $v_found = false;
4743
-
4744
-      // ----- Look for extract by name rule
4745
-      if (   (isset($p_options[PCLZIP_OPT_BY_NAME]))
4746
-          && ($p_options[PCLZIP_OPT_BY_NAME] != 0)) {
4747
-
4748
-          // ----- Look if the filename is in the list
4749
-          for ($j=0; ($j<sizeof($p_options[PCLZIP_OPT_BY_NAME])) && (!$v_found); $j++) {
4750
-
4751
-              // ----- Look for a directory
4752
-              if (substr($p_options[PCLZIP_OPT_BY_NAME][$j], -1) == "/") {
4753
-
4754
-                  // ----- Look if the directory is in the filename path
4755
-                  if (   (strlen($v_header_list[$v_nb_extracted]['stored_filename']) > strlen($p_options[PCLZIP_OPT_BY_NAME][$j]))
4756
-                      && (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])) {
4757
-                      $v_found = true;
4758
-                  }
4759
-                  elseif (   (($v_header_list[$v_nb_extracted]['external']&0x00000010)==0x00000010) /* Indicates a folder */
4760
-                          && ($v_header_list[$v_nb_extracted]['stored_filename'].'/' == $p_options[PCLZIP_OPT_BY_NAME][$j])) {
4761
-                      $v_found = true;
4762
-                  }
4763
-              }
4764
-              // ----- Look for a filename
4765
-              elseif ($v_header_list[$v_nb_extracted]['stored_filename'] == $p_options[PCLZIP_OPT_BY_NAME][$j]) {
4766
-                  $v_found = true;
4767
-              }
4768
-          }
4769
-      }
4738
+	  // ----- Store the index
4739
+	  $v_header_list[$v_nb_extracted]['index'] = $i;
4740
+
4741
+	  // ----- Look for the specific extract rules
4742
+	  $v_found = false;
4743
+
4744
+	  // ----- Look for extract by name rule
4745
+	  if (   (isset($p_options[PCLZIP_OPT_BY_NAME]))
4746
+		  && ($p_options[PCLZIP_OPT_BY_NAME] != 0)) {
4747
+
4748
+		  // ----- Look if the filename is in the list
4749
+		  for ($j=0; ($j<sizeof($p_options[PCLZIP_OPT_BY_NAME])) && (!$v_found); $j++) {
4750
+
4751
+			  // ----- Look for a directory
4752
+			  if (substr($p_options[PCLZIP_OPT_BY_NAME][$j], -1) == "/") {
4753
+
4754
+				  // ----- Look if the directory is in the filename path
4755
+				  if (   (strlen($v_header_list[$v_nb_extracted]['stored_filename']) > strlen($p_options[PCLZIP_OPT_BY_NAME][$j]))
4756
+					  && (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])) {
4757
+					  $v_found = true;
4758
+				  }
4759
+				  elseif (   (($v_header_list[$v_nb_extracted]['external']&0x00000010)==0x00000010) /* Indicates a folder */
4760
+						  && ($v_header_list[$v_nb_extracted]['stored_filename'].'/' == $p_options[PCLZIP_OPT_BY_NAME][$j])) {
4761
+					  $v_found = true;
4762
+				  }
4763
+			  }
4764
+			  // ----- Look for a filename
4765
+			  elseif ($v_header_list[$v_nb_extracted]['stored_filename'] == $p_options[PCLZIP_OPT_BY_NAME][$j]) {
4766
+				  $v_found = true;
4767
+			  }
4768
+		  }
4769
+	  }
4770 4770
 
4771
-      // ----- Look for extract by ereg rule
4772
-      // ereg() is deprecated with PHP 5.3
4773
-      /*
4771
+	  // ----- Look for extract by ereg rule
4772
+	  // ereg() is deprecated with PHP 5.3
4773
+	  /*
4774 4774
       else if (   (isset($p_options[PCLZIP_OPT_BY_EREG]))
4775 4775
                && ($p_options[PCLZIP_OPT_BY_EREG] != "")) {
4776 4776
 
@@ -4780,201 +4780,201 @@  discard block
 block discarded – undo
4780 4780
       }
4781 4781
       */
4782 4782
 
4783
-      // ----- Look for extract by preg rule
4784
-      else if (   (isset($p_options[PCLZIP_OPT_BY_PREG]))
4785
-               && ($p_options[PCLZIP_OPT_BY_PREG] != "")) {
4783
+	  // ----- Look for extract by preg rule
4784
+	  else if (   (isset($p_options[PCLZIP_OPT_BY_PREG]))
4785
+			   && ($p_options[PCLZIP_OPT_BY_PREG] != "")) {
4786 4786
 
4787
-          if (preg_match($p_options[PCLZIP_OPT_BY_PREG], $v_header_list[$v_nb_extracted]['stored_filename'])) {
4788
-              $v_found = true;
4789
-          }
4790
-      }
4787
+		  if (preg_match($p_options[PCLZIP_OPT_BY_PREG], $v_header_list[$v_nb_extracted]['stored_filename'])) {
4788
+			  $v_found = true;
4789
+		  }
4790
+	  }
4791 4791
 
4792
-      // ----- Look for extract by index rule
4793
-      else if (   (isset($p_options[PCLZIP_OPT_BY_INDEX]))
4794
-               && ($p_options[PCLZIP_OPT_BY_INDEX] != 0)) {
4792
+	  // ----- Look for extract by index rule
4793
+	  else if (   (isset($p_options[PCLZIP_OPT_BY_INDEX]))
4794
+			   && ($p_options[PCLZIP_OPT_BY_INDEX] != 0)) {
4795 4795
 
4796
-          // ----- Look if the index is in the list
4797
-          for ($j=$j_start; ($j<sizeof($p_options[PCLZIP_OPT_BY_INDEX])) && (!$v_found); $j++) {
4796
+		  // ----- Look if the index is in the list
4797
+		  for ($j=$j_start; ($j<sizeof($p_options[PCLZIP_OPT_BY_INDEX])) && (!$v_found); $j++) {
4798 4798
 
4799
-              if (($i>=$p_options[PCLZIP_OPT_BY_INDEX][$j]['start']) && ($i<=$p_options[PCLZIP_OPT_BY_INDEX][$j]['end'])) {
4800
-                  $v_found = true;
4801
-              }
4802
-              if ($i>=$p_options[PCLZIP_OPT_BY_INDEX][$j]['end']) {
4803
-                  $j_start = $j+1;
4804
-              }
4799
+			  if (($i>=$p_options[PCLZIP_OPT_BY_INDEX][$j]['start']) && ($i<=$p_options[PCLZIP_OPT_BY_INDEX][$j]['end'])) {
4800
+				  $v_found = true;
4801
+			  }
4802
+			  if ($i>=$p_options[PCLZIP_OPT_BY_INDEX][$j]['end']) {
4803
+				  $j_start = $j+1;
4804
+			  }
4805 4805
 
4806
-              if ($p_options[PCLZIP_OPT_BY_INDEX][$j]['start']>$i) {
4807
-                  break;
4808
-              }
4809
-          }
4810
-      }
4811
-      else {
4812
-      	$v_found = true;
4813
-      }
4806
+			  if ($p_options[PCLZIP_OPT_BY_INDEX][$j]['start']>$i) {
4807
+				  break;
4808
+			  }
4809
+		  }
4810
+	  }
4811
+	  else {
4812
+	  	$v_found = true;
4813
+	  }
4814 4814
 
4815
-      // ----- Look for deletion
4816
-      if ($v_found)
4817
-      {
4818
-        unset($v_header_list[$v_nb_extracted]);
4819
-      }
4820
-      else
4821
-      {
4822
-        $v_nb_extracted++;
4823
-      }
4824
-    }
4815
+	  // ----- Look for deletion
4816
+	  if ($v_found)
4817
+	  {
4818
+		unset($v_header_list[$v_nb_extracted]);
4819
+	  }
4820
+	  else
4821
+	  {
4822
+		$v_nb_extracted++;
4823
+	  }
4824
+	}
4825 4825
 
4826
-    // ----- Look if something need to be deleted
4827
-    if ($v_nb_extracted > 0) {
4826
+	// ----- Look if something need to be deleted
4827
+	if ($v_nb_extracted > 0) {
4828 4828
 
4829
-        // ----- Creates a temporay file
4830
-        $v_zip_temp_name = PCLZIP_TEMPORARY_DIR.uniqid('pclzip-').'.tmp';
4829
+		// ----- Creates a temporay file
4830
+		$v_zip_temp_name = PCLZIP_TEMPORARY_DIR.uniqid('pclzip-').'.tmp';
4831 4831
 
4832
-        // ----- Creates a temporary zip archive
4833
-        $v_temp_zip = new PclZip($v_zip_temp_name);
4832
+		// ----- Creates a temporary zip archive
4833
+		$v_temp_zip = new PclZip($v_zip_temp_name);
4834 4834
 
4835
-        // ----- Open the temporary zip file in write mode
4836
-        if (($v_result = $v_temp_zip->privOpenFd('wb')) != 1) {
4837
-            $this->privCloseFd();
4835
+		// ----- Open the temporary zip file in write mode
4836
+		if (($v_result = $v_temp_zip->privOpenFd('wb')) != 1) {
4837
+			$this->privCloseFd();
4838 4838
 
4839
-            // ----- Return
4840
-            return $v_result;
4841
-        }
4839
+			// ----- Return
4840
+			return $v_result;
4841
+		}
4842 4842
 
4843
-        // ----- Look which file need to be kept
4844
-        for ($i=0; $i<sizeof($v_header_list); $i++) {
4843
+		// ----- Look which file need to be kept
4844
+		for ($i=0; $i<sizeof($v_header_list); $i++) {
4845 4845
 
4846
-            // ----- Calculate the position of the header
4847
-            @rewind($this->zip_fd);
4848
-            if (@fseek($this->zip_fd,  $v_header_list[$i]['offset'])) {
4849
-                // ----- Close the zip file
4850
-                $this->privCloseFd();
4851
-                $v_temp_zip->privCloseFd();
4852
-                @unlink($v_zip_temp_name);
4846
+			// ----- Calculate the position of the header
4847
+			@rewind($this->zip_fd);
4848
+			if (@fseek($this->zip_fd,  $v_header_list[$i]['offset'])) {
4849
+				// ----- Close the zip file
4850
+				$this->privCloseFd();
4851
+				$v_temp_zip->privCloseFd();
4852
+				@unlink($v_zip_temp_name);
4853 4853
 
4854
-                // ----- Error log
4855
-                PclZip::privErrorLog(PCLZIP_ERR_INVALID_ARCHIVE_ZIP, 'Invalid archive size');
4854
+				// ----- Error log
4855
+				PclZip::privErrorLog(PCLZIP_ERR_INVALID_ARCHIVE_ZIP, 'Invalid archive size');
4856 4856
 
4857
-                // ----- Return
4858
-                return PclZip::errorCode();
4859
-            }
4857
+				// ----- Return
4858
+				return PclZip::errorCode();
4859
+			}
4860 4860
 
4861
-            // ----- Read the file header
4862
-            $v_local_header = array();
4863
-            if (($v_result = $this->privReadFileHeader($v_local_header)) != 1) {
4864
-                // ----- Close the zip file
4865
-                $this->privCloseFd();
4866
-                $v_temp_zip->privCloseFd();
4867
-                @unlink($v_zip_temp_name);
4861
+			// ----- Read the file header
4862
+			$v_local_header = array();
4863
+			if (($v_result = $this->privReadFileHeader($v_local_header)) != 1) {
4864
+				// ----- Close the zip file
4865
+				$this->privCloseFd();
4866
+				$v_temp_zip->privCloseFd();
4867
+				@unlink($v_zip_temp_name);
4868 4868
 
4869
-                // ----- Return
4870
-                return $v_result;
4871
-            }
4869
+				// ----- Return
4870
+				return $v_result;
4871
+			}
4872 4872
             
4873
-            // ----- Check that local file header is same as central file header
4874
-            if ($this->privCheckFileHeaders($v_local_header,
4875
-			                                $v_header_list[$i]) != 1) {
4876
-                // TBC
4877
-            }
4878
-            unset($v_local_header);
4879
-
4880
-            // ----- Write the file header
4881
-            if (($v_result = $v_temp_zip->privWriteFileHeader($v_header_list[$i])) != 1) {
4882
-                // ----- Close the zip file
4883
-                $this->privCloseFd();
4884
-                $v_temp_zip->privCloseFd();
4885
-                @unlink($v_zip_temp_name);
4886
-
4887
-                // ----- Return
4888
-                return $v_result;
4889
-            }
4890
-
4891
-            // ----- Read/write the data block
4892
-            if (($v_result = PclZipUtilCopyBlock($this->zip_fd, $v_temp_zip->zip_fd, $v_header_list[$i]['compressed_size'])) != 1) {
4893
-                // ----- Close the zip file
4894
-                $this->privCloseFd();
4895
-                $v_temp_zip->privCloseFd();
4896
-                @unlink($v_zip_temp_name);
4897
-
4898
-                // ----- Return
4899
-                return $v_result;
4900
-            }
4901
-        }
4902
-
4903
-        // ----- Store the offset of the central dir
4904
-        $v_offset = @ftell($v_temp_zip->zip_fd);
4905
-
4906
-        // ----- Re-Create the Central Dir files header
4907
-        for ($i=0; $i<sizeof($v_header_list); $i++) {
4908
-            // ----- Create the file header
4909
-            if (($v_result = $v_temp_zip->privWriteCentralFileHeader($v_header_list[$i])) != 1) {
4910
-                $v_temp_zip->privCloseFd();
4911
-                $this->privCloseFd();
4912
-                @unlink($v_zip_temp_name);
4913
-
4914
-                // ----- Return
4915
-                return $v_result;
4916
-            }
4917
-
4918
-            // ----- Transform the header to a 'usable' info
4919
-            $v_temp_zip->privConvertHeader2FileInfo($v_header_list[$i], $p_result_list[$i]);
4920
-        }
4921
-
4922
-
4923
-        // ----- Zip file comment
4924
-        $v_comment = '';
4925
-        if (isset($p_options[PCLZIP_OPT_COMMENT])) {
4926
-          $v_comment = $p_options[PCLZIP_OPT_COMMENT];
4927
-        }
4928
-
4929
-        // ----- Calculate the size of the central header
4930
-        $v_size = @ftell($v_temp_zip->zip_fd)-$v_offset;
4931
-
4932
-        // ----- Create the central dir footer
4933
-        if (($v_result = $v_temp_zip->privWriteCentralHeader(sizeof($v_header_list), $v_size, $v_offset, $v_comment)) != 1) {
4934
-            // ----- Reset the file list
4935
-            unset($v_header_list);
4936
-            $v_temp_zip->privCloseFd();
4937
-            $this->privCloseFd();
4938
-            @unlink($v_zip_temp_name);
4939
-
4940
-            // ----- Return
4941
-            return $v_result;
4942
-        }
4943
-
4944
-        // ----- Close
4945
-        $v_temp_zip->privCloseFd();
4946
-        $this->privCloseFd();
4947
-
4948
-        // ----- Delete the zip file
4949
-        // TBC : I should test the result ...
4950
-        @unlink($this->zipname);
4951
-
4952
-        // ----- Rename the temporary file
4953
-        // TBC : I should test the result ...
4954
-        //@rename($v_zip_temp_name, $this->zipname);
4955
-        PclZipUtilRename($v_zip_temp_name, $this->zipname);
4873
+			// ----- Check that local file header is same as central file header
4874
+			if ($this->privCheckFileHeaders($v_local_header,
4875
+											$v_header_list[$i]) != 1) {
4876
+				// TBC
4877
+			}
4878
+			unset($v_local_header);
4879
+
4880
+			// ----- Write the file header
4881
+			if (($v_result = $v_temp_zip->privWriteFileHeader($v_header_list[$i])) != 1) {
4882
+				// ----- Close the zip file
4883
+				$this->privCloseFd();
4884
+				$v_temp_zip->privCloseFd();
4885
+				@unlink($v_zip_temp_name);
4886
+
4887
+				// ----- Return
4888
+				return $v_result;
4889
+			}
4890
+
4891
+			// ----- Read/write the data block
4892
+			if (($v_result = PclZipUtilCopyBlock($this->zip_fd, $v_temp_zip->zip_fd, $v_header_list[$i]['compressed_size'])) != 1) {
4893
+				// ----- Close the zip file
4894
+				$this->privCloseFd();
4895
+				$v_temp_zip->privCloseFd();
4896
+				@unlink($v_zip_temp_name);
4897
+
4898
+				// ----- Return
4899
+				return $v_result;
4900
+			}
4901
+		}
4902
+
4903
+		// ----- Store the offset of the central dir
4904
+		$v_offset = @ftell($v_temp_zip->zip_fd);
4905
+
4906
+		// ----- Re-Create the Central Dir files header
4907
+		for ($i=0; $i<sizeof($v_header_list); $i++) {
4908
+			// ----- Create the file header
4909
+			if (($v_result = $v_temp_zip->privWriteCentralFileHeader($v_header_list[$i])) != 1) {
4910
+				$v_temp_zip->privCloseFd();
4911
+				$this->privCloseFd();
4912
+				@unlink($v_zip_temp_name);
4913
+
4914
+				// ----- Return
4915
+				return $v_result;
4916
+			}
4917
+
4918
+			// ----- Transform the header to a 'usable' info
4919
+			$v_temp_zip->privConvertHeader2FileInfo($v_header_list[$i], $p_result_list[$i]);
4920
+		}
4921
+
4922
+
4923
+		// ----- Zip file comment
4924
+		$v_comment = '';
4925
+		if (isset($p_options[PCLZIP_OPT_COMMENT])) {
4926
+		  $v_comment = $p_options[PCLZIP_OPT_COMMENT];
4927
+		}
4928
+
4929
+		// ----- Calculate the size of the central header
4930
+		$v_size = @ftell($v_temp_zip->zip_fd)-$v_offset;
4931
+
4932
+		// ----- Create the central dir footer
4933
+		if (($v_result = $v_temp_zip->privWriteCentralHeader(sizeof($v_header_list), $v_size, $v_offset, $v_comment)) != 1) {
4934
+			// ----- Reset the file list
4935
+			unset($v_header_list);
4936
+			$v_temp_zip->privCloseFd();
4937
+			$this->privCloseFd();
4938
+			@unlink($v_zip_temp_name);
4939
+
4940
+			// ----- Return
4941
+			return $v_result;
4942
+		}
4943
+
4944
+		// ----- Close
4945
+		$v_temp_zip->privCloseFd();
4946
+		$this->privCloseFd();
4947
+
4948
+		// ----- Delete the zip file
4949
+		// TBC : I should test the result ...
4950
+		@unlink($this->zipname);
4951
+
4952
+		// ----- Rename the temporary file
4953
+		// TBC : I should test the result ...
4954
+		//@rename($v_zip_temp_name, $this->zipname);
4955
+		PclZipUtilRename($v_zip_temp_name, $this->zipname);
4956 4956
     
4957
-        // ----- Destroy the temporary archive
4958
-        unset($v_temp_zip);
4959
-    }
4957
+		// ----- Destroy the temporary archive
4958
+		unset($v_temp_zip);
4959
+	}
4960 4960
     
4961
-    // ----- Remove every files : reset the file
4962
-    else if ($v_central_dir['entries'] != 0) {
4963
-        $this->privCloseFd();
4961
+	// ----- Remove every files : reset the file
4962
+	else if ($v_central_dir['entries'] != 0) {
4963
+		$this->privCloseFd();
4964 4964
 
4965
-        if (($v_result = $this->privOpenFd('wb')) != 1) {
4966
-          return $v_result;
4967
-        }
4965
+		if (($v_result = $this->privOpenFd('wb')) != 1) {
4966
+		  return $v_result;
4967
+		}
4968 4968
 
4969
-        if (($v_result = $this->privWriteCentralHeader(0, 0, 0, '')) != 1) {
4970
-          return $v_result;
4971
-        }
4969
+		if (($v_result = $this->privWriteCentralHeader(0, 0, 0, '')) != 1) {
4970
+		  return $v_result;
4971
+		}
4972 4972
 
4973
-        $this->privCloseFd();
4974
-    }
4973
+		$this->privCloseFd();
4974
+	}
4975 4975
 
4976
-    // ----- Return
4977
-    return $v_result;
4976
+	// ----- Return
4977
+	return $v_result;
4978 4978
   }
4979 4979
   // --------------------------------------------------------------------------------
4980 4980
 
@@ -4991,49 +4991,49 @@  discard block
 block discarded – undo
4991 4991
   // --------------------------------------------------------------------------------
4992 4992
   function privDirCheck($p_dir, $p_is_dir=false)
4993 4993
   {
4994
-    $v_result = 1;
4994
+	$v_result = 1;
4995 4995
 
4996 4996
 
4997
-    // ----- Remove the final '/'
4998
-    if (($p_is_dir) && (substr($p_dir, -1)=='/'))
4999
-    {
5000
-      $p_dir = substr($p_dir, 0, strlen($p_dir)-1);
5001
-    }
4997
+	// ----- Remove the final '/'
4998
+	if (($p_is_dir) && (substr($p_dir, -1)=='/'))
4999
+	{
5000
+	  $p_dir = substr($p_dir, 0, strlen($p_dir)-1);
5001
+	}
5002 5002
 
5003
-    // ----- Check the directory availability
5004
-    if ((is_dir($p_dir)) || ($p_dir == ""))
5005
-    {
5006
-      return 1;
5007
-    }
5003
+	// ----- Check the directory availability
5004
+	if ((is_dir($p_dir)) || ($p_dir == ""))
5005
+	{
5006
+	  return 1;
5007
+	}
5008 5008
 
5009
-    // ----- Extract parent directory
5010
-    $p_parent_dir = dirname($p_dir);
5011
-
5012
-    // ----- Just a check
5013
-    if ($p_parent_dir != $p_dir)
5014
-    {
5015
-      // ----- Look for parent directory
5016
-      if ($p_parent_dir != "")
5017
-      {
5018
-        if (($v_result = $this->privDirCheck($p_parent_dir)) != 1)
5019
-        {
5020
-          return $v_result;
5021
-        }
5022
-      }
5023
-    }
5009
+	// ----- Extract parent directory
5010
+	$p_parent_dir = dirname($p_dir);
5011
+
5012
+	// ----- Just a check
5013
+	if ($p_parent_dir != $p_dir)
5014
+	{
5015
+	  // ----- Look for parent directory
5016
+	  if ($p_parent_dir != "")
5017
+	  {
5018
+		if (($v_result = $this->privDirCheck($p_parent_dir)) != 1)
5019
+		{
5020
+		  return $v_result;
5021
+		}
5022
+	  }
5023
+	}
5024 5024
 
5025
-    // ----- Create the directory
5026
-    if (!@mkdir($p_dir, 0777))
5027
-    {
5028
-      // ----- Error log
5029
-      PclZip::privErrorLog(PCLZIP_ERR_DIR_CREATE_FAIL, "Unable to create directory '$p_dir'");
5025
+	// ----- Create the directory
5026
+	if (!@mkdir($p_dir, 0777))
5027
+	{
5028
+	  // ----- Error log
5029
+	  PclZip::privErrorLog(PCLZIP_ERR_DIR_CREATE_FAIL, "Unable to create directory '$p_dir'");
5030 5030
 
5031
-      // ----- Return
5032
-      return PclZip::errorCode();
5033
-    }
5031
+	  // ----- Return
5032
+	  return PclZip::errorCode();
5033
+	}
5034 5034
 
5035
-    // ----- Return
5036
-    return $v_result;
5035
+	// ----- Return
5036
+	return $v_result;
5037 5037
   }
5038 5038
   // --------------------------------------------------------------------------------
5039 5039
 
@@ -5046,180 +5046,180 @@  discard block
 block discarded – undo
5046 5046
   // --------------------------------------------------------------------------------
5047 5047
   function privMerge(&$p_archive_to_add)
5048 5048
   {
5049
-    $v_result=1;
5049
+	$v_result=1;
5050 5050
 
5051
-    // ----- Look if the archive_to_add exists
5052
-    if (!is_file($p_archive_to_add->zipname))
5053
-    {
5051
+	// ----- Look if the archive_to_add exists
5052
+	if (!is_file($p_archive_to_add->zipname))
5053
+	{
5054 5054
 
5055
-      // ----- Nothing to merge, so merge is a success
5056
-      $v_result = 1;
5055
+	  // ----- Nothing to merge, so merge is a success
5056
+	  $v_result = 1;
5057 5057
 
5058
-      // ----- Return
5059
-      return $v_result;
5060
-    }
5058
+	  // ----- Return
5059
+	  return $v_result;
5060
+	}
5061 5061
 
5062
-    // ----- Look if the archive exists
5063
-    if (!is_file($this->zipname))
5064
-    {
5062
+	// ----- Look if the archive exists
5063
+	if (!is_file($this->zipname))
5064
+	{
5065 5065
 
5066
-      // ----- Do a duplicate
5067
-      $v_result = $this->privDuplicate($p_archive_to_add->zipname);
5066
+	  // ----- Do a duplicate
5067
+	  $v_result = $this->privDuplicate($p_archive_to_add->zipname);
5068 5068
 
5069
-      // ----- Return
5070
-      return $v_result;
5071
-    }
5069
+	  // ----- Return
5070
+	  return $v_result;
5071
+	}
5072 5072
 
5073
-    // ----- Open the zip file
5074
-    if (($v_result=$this->privOpenFd('rb')) != 1)
5075
-    {
5076
-      // ----- Return
5077
-      return $v_result;
5078
-    }
5073
+	// ----- Open the zip file
5074
+	if (($v_result=$this->privOpenFd('rb')) != 1)
5075
+	{
5076
+	  // ----- Return
5077
+	  return $v_result;
5078
+	}
5079 5079
 
5080
-    // ----- Read the central directory informations
5081
-    $v_central_dir = array();
5082
-    if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1)
5083
-    {
5084
-      $this->privCloseFd();
5085
-      return $v_result;
5086
-    }
5080
+	// ----- Read the central directory informations
5081
+	$v_central_dir = array();
5082
+	if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1)
5083
+	{
5084
+	  $this->privCloseFd();
5085
+	  return $v_result;
5086
+	}
5087 5087
 
5088
-    // ----- Go to beginning of File
5089
-    @rewind($this->zip_fd);
5088
+	// ----- Go to beginning of File
5089
+	@rewind($this->zip_fd);
5090 5090
 
5091
-    // ----- Open the archive_to_add file
5092
-    if (($v_result=$p_archive_to_add->privOpenFd('rb')) != 1)
5093
-    {
5094
-      $this->privCloseFd();
5091
+	// ----- Open the archive_to_add file
5092
+	if (($v_result=$p_archive_to_add->privOpenFd('rb')) != 1)
5093
+	{
5094
+	  $this->privCloseFd();
5095 5095
 
5096
-      // ----- Return
5097
-      return $v_result;
5098
-    }
5096
+	  // ----- Return
5097
+	  return $v_result;
5098
+	}
5099 5099
 
5100
-    // ----- Read the central directory informations
5101
-    $v_central_dir_to_add = array();
5102
-    if (($v_result = $p_archive_to_add->privReadEndCentralDir($v_central_dir_to_add)) != 1)
5103
-    {
5104
-      $this->privCloseFd();
5105
-      $p_archive_to_add->privCloseFd();
5100
+	// ----- Read the central directory informations
5101
+	$v_central_dir_to_add = array();
5102
+	if (($v_result = $p_archive_to_add->privReadEndCentralDir($v_central_dir_to_add)) != 1)
5103
+	{
5104
+	  $this->privCloseFd();
5105
+	  $p_archive_to_add->privCloseFd();
5106 5106
 
5107
-      return $v_result;
5108
-    }
5107
+	  return $v_result;
5108
+	}
5109 5109
 
5110
-    // ----- Go to beginning of File
5111
-    @rewind($p_archive_to_add->zip_fd);
5110
+	// ----- Go to beginning of File
5111
+	@rewind($p_archive_to_add->zip_fd);
5112 5112
 
5113
-    // ----- Creates a temporay file
5114
-    $v_zip_temp_name = PCLZIP_TEMPORARY_DIR.uniqid('pclzip-').'.tmp';
5113
+	// ----- Creates a temporay file
5114
+	$v_zip_temp_name = PCLZIP_TEMPORARY_DIR.uniqid('pclzip-').'.tmp';
5115 5115
 
5116
-    // ----- Open the temporary file in write mode
5117
-    if (($v_zip_temp_fd = @fopen($v_zip_temp_name, 'wb')) == 0)
5118
-    {
5119
-      $this->privCloseFd();
5120
-      $p_archive_to_add->privCloseFd();
5116
+	// ----- Open the temporary file in write mode
5117
+	if (($v_zip_temp_fd = @fopen($v_zip_temp_name, 'wb')) == 0)
5118
+	{
5119
+	  $this->privCloseFd();
5120
+	  $p_archive_to_add->privCloseFd();
5121 5121
 
5122
-      PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open temporary file \''.$v_zip_temp_name.'\' in binary write mode');
5122
+	  PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open temporary file \''.$v_zip_temp_name.'\' in binary write mode');
5123 5123
 
5124
-      // ----- Return
5125
-      return PclZip::errorCode();
5126
-    }
5124
+	  // ----- Return
5125
+	  return PclZip::errorCode();
5126
+	}
5127 5127
 
5128
-    // ----- Copy the files from the archive to the temporary file
5129
-    // TBC : Here I should better append the file and go back to erase the central dir
5130
-    $v_size = $v_central_dir['offset'];
5131
-    while ($v_size != 0)
5132
-    {
5133
-      $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
5134
-      $v_buffer = fread($this->zip_fd, $v_read_size);
5135
-      @fwrite($v_zip_temp_fd, $v_buffer, $v_read_size);
5136
-      $v_size -= $v_read_size;
5137
-    }
5128
+	// ----- Copy the files from the archive to the temporary file
5129
+	// TBC : Here I should better append the file and go back to erase the central dir
5130
+	$v_size = $v_central_dir['offset'];
5131
+	while ($v_size != 0)
5132
+	{
5133
+	  $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
5134
+	  $v_buffer = fread($this->zip_fd, $v_read_size);
5135
+	  @fwrite($v_zip_temp_fd, $v_buffer, $v_read_size);
5136
+	  $v_size -= $v_read_size;
5137
+	}
5138 5138
 
5139
-    // ----- Copy the files from the archive_to_add into the temporary file
5140
-    $v_size = $v_central_dir_to_add['offset'];
5141
-    while ($v_size != 0)
5142
-    {
5143
-      $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
5144
-      $v_buffer = fread($p_archive_to_add->zip_fd, $v_read_size);
5145
-      @fwrite($v_zip_temp_fd, $v_buffer, $v_read_size);
5146
-      $v_size -= $v_read_size;
5147
-    }
5139
+	// ----- Copy the files from the archive_to_add into the temporary file
5140
+	$v_size = $v_central_dir_to_add['offset'];
5141
+	while ($v_size != 0)
5142
+	{
5143
+	  $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
5144
+	  $v_buffer = fread($p_archive_to_add->zip_fd, $v_read_size);
5145
+	  @fwrite($v_zip_temp_fd, $v_buffer, $v_read_size);
5146
+	  $v_size -= $v_read_size;
5147
+	}
5148 5148
 
5149
-    // ----- Store the offset of the central dir
5150
-    $v_offset = @ftell($v_zip_temp_fd);
5151
-
5152
-    // ----- Copy the block of file headers from the old archive
5153
-    $v_size = $v_central_dir['size'];
5154
-    while ($v_size != 0)
5155
-    {
5156
-      $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
5157
-      $v_buffer = @fread($this->zip_fd, $v_read_size);
5158
-      @fwrite($v_zip_temp_fd, $v_buffer, $v_read_size);
5159
-      $v_size -= $v_read_size;
5160
-    }
5149
+	// ----- Store the offset of the central dir
5150
+	$v_offset = @ftell($v_zip_temp_fd);
5151
+
5152
+	// ----- Copy the block of file headers from the old archive
5153
+	$v_size = $v_central_dir['size'];
5154
+	while ($v_size != 0)
5155
+	{
5156
+	  $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
5157
+	  $v_buffer = @fread($this->zip_fd, $v_read_size);
5158
+	  @fwrite($v_zip_temp_fd, $v_buffer, $v_read_size);
5159
+	  $v_size -= $v_read_size;
5160
+	}
5161 5161
 
5162
-    // ----- Copy the block of file headers from the archive_to_add
5163
-    $v_size = $v_central_dir_to_add['size'];
5164
-    while ($v_size != 0)
5165
-    {
5166
-      $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
5167
-      $v_buffer = @fread($p_archive_to_add->zip_fd, $v_read_size);
5168
-      @fwrite($v_zip_temp_fd, $v_buffer, $v_read_size);
5169
-      $v_size -= $v_read_size;
5170
-    }
5162
+	// ----- Copy the block of file headers from the archive_to_add
5163
+	$v_size = $v_central_dir_to_add['size'];
5164
+	while ($v_size != 0)
5165
+	{
5166
+	  $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
5167
+	  $v_buffer = @fread($p_archive_to_add->zip_fd, $v_read_size);
5168
+	  @fwrite($v_zip_temp_fd, $v_buffer, $v_read_size);
5169
+	  $v_size -= $v_read_size;
5170
+	}
5171 5171
 
5172
-    // ----- Merge the file comments
5173
-    $v_comment = $v_central_dir['comment'].' '.$v_central_dir_to_add['comment'];
5172
+	// ----- Merge the file comments
5173
+	$v_comment = $v_central_dir['comment'].' '.$v_central_dir_to_add['comment'];
5174 5174
 
5175
-    // ----- Calculate the size of the (new) central header
5176
-    $v_size = @ftell($v_zip_temp_fd)-$v_offset;
5175
+	// ----- Calculate the size of the (new) central header
5176
+	$v_size = @ftell($v_zip_temp_fd)-$v_offset;
5177 5177
 
5178
-    // ----- Swap the file descriptor
5179
-    // Here is a trick : I swap the temporary fd with the zip fd, in order to use
5180
-    // the following methods on the temporary fil and not the real archive fd
5181
-    $v_swap = $this->zip_fd;
5182
-    $this->zip_fd = $v_zip_temp_fd;
5183
-    $v_zip_temp_fd = $v_swap;
5178
+	// ----- Swap the file descriptor
5179
+	// Here is a trick : I swap the temporary fd with the zip fd, in order to use
5180
+	// the following methods on the temporary fil and not the real archive fd
5181
+	$v_swap = $this->zip_fd;
5182
+	$this->zip_fd = $v_zip_temp_fd;
5183
+	$v_zip_temp_fd = $v_swap;
5184 5184
 
5185
-    // ----- Create the central dir footer
5186
-    if (($v_result = $this->privWriteCentralHeader($v_central_dir['entries']+$v_central_dir_to_add['entries'], $v_size, $v_offset, $v_comment)) != 1)
5187
-    {
5188
-      $this->privCloseFd();
5189
-      $p_archive_to_add->privCloseFd();
5190
-      @fclose($v_zip_temp_fd);
5191
-      $this->zip_fd = null;
5185
+	// ----- Create the central dir footer
5186
+	if (($v_result = $this->privWriteCentralHeader($v_central_dir['entries']+$v_central_dir_to_add['entries'], $v_size, $v_offset, $v_comment)) != 1)
5187
+	{
5188
+	  $this->privCloseFd();
5189
+	  $p_archive_to_add->privCloseFd();
5190
+	  @fclose($v_zip_temp_fd);
5191
+	  $this->zip_fd = null;
5192 5192
 
5193
-      // ----- Reset the file list
5194
-      unset($v_header_list);
5193
+	  // ----- Reset the file list
5194
+	  unset($v_header_list);
5195 5195
 
5196
-      // ----- Return
5197
-      return $v_result;
5198
-    }
5196
+	  // ----- Return
5197
+	  return $v_result;
5198
+	}
5199 5199
 
5200
-    // ----- Swap back the file descriptor
5201
-    $v_swap = $this->zip_fd;
5202
-    $this->zip_fd = $v_zip_temp_fd;
5203
-    $v_zip_temp_fd = $v_swap;
5200
+	// ----- Swap back the file descriptor
5201
+	$v_swap = $this->zip_fd;
5202
+	$this->zip_fd = $v_zip_temp_fd;
5203
+	$v_zip_temp_fd = $v_swap;
5204 5204
 
5205
-    // ----- Close
5206
-    $this->privCloseFd();
5207
-    $p_archive_to_add->privCloseFd();
5205
+	// ----- Close
5206
+	$this->privCloseFd();
5207
+	$p_archive_to_add->privCloseFd();
5208 5208
 
5209
-    // ----- Close the temporary file
5210
-    @fclose($v_zip_temp_fd);
5209
+	// ----- Close the temporary file
5210
+	@fclose($v_zip_temp_fd);
5211 5211
 
5212
-    // ----- Delete the zip file
5213
-    // TBC : I should test the result ...
5214
-    @unlink($this->zipname);
5212
+	// ----- Delete the zip file
5213
+	// TBC : I should test the result ...
5214
+	@unlink($this->zipname);
5215 5215
 
5216
-    // ----- Rename the temporary file
5217
-    // TBC : I should test the result ...
5218
-    //@rename($v_zip_temp_name, $this->zipname);
5219
-    PclZipUtilRename($v_zip_temp_name, $this->zipname);
5216
+	// ----- Rename the temporary file
5217
+	// TBC : I should test the result ...
5218
+	//@rename($v_zip_temp_name, $this->zipname);
5219
+	PclZipUtilRename($v_zip_temp_name, $this->zipname);
5220 5220
 
5221
-    // ----- Return
5222
-    return $v_result;
5221
+	// ----- Return
5222
+	return $v_result;
5223 5223
   }
5224 5224
   // --------------------------------------------------------------------------------
5225 5225
 
@@ -5231,56 +5231,56 @@  discard block
 block discarded – undo
5231 5231
   // --------------------------------------------------------------------------------
5232 5232
   function privDuplicate($p_archive_filename)
5233 5233
   {
5234
-    $v_result=1;
5234
+	$v_result=1;
5235 5235
 
5236
-    // ----- Look if the $p_archive_filename exists
5237
-    if (!is_file($p_archive_filename))
5238
-    {
5236
+	// ----- Look if the $p_archive_filename exists
5237
+	if (!is_file($p_archive_filename))
5238
+	{
5239 5239
 
5240
-      // ----- Nothing to duplicate, so duplicate is a success.
5241
-      $v_result = 1;
5240
+	  // ----- Nothing to duplicate, so duplicate is a success.
5241
+	  $v_result = 1;
5242 5242
 
5243
-      // ----- Return
5244
-      return $v_result;
5245
-    }
5243
+	  // ----- Return
5244
+	  return $v_result;
5245
+	}
5246 5246
 
5247
-    // ----- Open the zip file
5248
-    if (($v_result=$this->privOpenFd('wb')) != 1)
5249
-    {
5250
-      // ----- Return
5251
-      return $v_result;
5252
-    }
5247
+	// ----- Open the zip file
5248
+	if (($v_result=$this->privOpenFd('wb')) != 1)
5249
+	{
5250
+	  // ----- Return
5251
+	  return $v_result;
5252
+	}
5253 5253
 
5254
-    // ----- Open the temporary file in write mode
5255
-    if (($v_zip_temp_fd = @fopen($p_archive_filename, 'rb')) == 0)
5256
-    {
5257
-      $this->privCloseFd();
5254
+	// ----- Open the temporary file in write mode
5255
+	if (($v_zip_temp_fd = @fopen($p_archive_filename, 'rb')) == 0)
5256
+	{
5257
+	  $this->privCloseFd();
5258 5258
 
5259
-      PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open archive file \''.$p_archive_filename.'\' in binary write mode');
5259
+	  PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open archive file \''.$p_archive_filename.'\' in binary write mode');
5260 5260
 
5261
-      // ----- Return
5262
-      return PclZip::errorCode();
5263
-    }
5261
+	  // ----- Return
5262
+	  return PclZip::errorCode();
5263
+	}
5264 5264
 
5265
-    // ----- Copy the files from the archive to the temporary file
5266
-    // TBC : Here I should better append the file and go back to erase the central dir
5267
-    $v_size = filesize($p_archive_filename);
5268
-    while ($v_size != 0)
5269
-    {
5270
-      $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
5271
-      $v_buffer = fread($v_zip_temp_fd, $v_read_size);
5272
-      @fwrite($this->zip_fd, $v_buffer, $v_read_size);
5273
-      $v_size -= $v_read_size;
5274
-    }
5265
+	// ----- Copy the files from the archive to the temporary file
5266
+	// TBC : Here I should better append the file and go back to erase the central dir
5267
+	$v_size = filesize($p_archive_filename);
5268
+	while ($v_size != 0)
5269
+	{
5270
+	  $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
5271
+	  $v_buffer = fread($v_zip_temp_fd, $v_read_size);
5272
+	  @fwrite($this->zip_fd, $v_buffer, $v_read_size);
5273
+	  $v_size -= $v_read_size;
5274
+	}
5275 5275
 
5276
-    // ----- Close
5277
-    $this->privCloseFd();
5276
+	// ----- Close
5277
+	$this->privCloseFd();
5278 5278
 
5279
-    // ----- Close the temporary file
5280
-    @fclose($v_zip_temp_fd);
5279
+	// ----- Close the temporary file
5280
+	@fclose($v_zip_temp_fd);
5281 5281
 
5282
-    // ----- Return
5283
-    return $v_result;
5282
+	// ----- Return
5283
+	return $v_result;
5284 5284
   }
5285 5285
   // --------------------------------------------------------------------------------
5286 5286
 
@@ -5291,13 +5291,13 @@  discard block
 block discarded – undo
5291 5291
   // --------------------------------------------------------------------------------
5292 5292
   function privErrorLog($p_error_code=0, $p_error_string='')
5293 5293
   {
5294
-    if (PCLZIP_ERROR_EXTERNAL == 1) {
5295
-      PclError($p_error_code, $p_error_string);
5296
-    }
5297
-    else {
5298
-      $this->error_code = $p_error_code;
5299
-      $this->error_string = $p_error_string;
5300
-    }
5294
+	if (PCLZIP_ERROR_EXTERNAL == 1) {
5295
+	  PclError($p_error_code, $p_error_string);
5296
+	}
5297
+	else {
5298
+	  $this->error_code = $p_error_code;
5299
+	  $this->error_string = $p_error_string;
5300
+	}
5301 5301
   }
5302 5302
   // --------------------------------------------------------------------------------
5303 5303
 
@@ -5308,13 +5308,13 @@  discard block
 block discarded – undo
5308 5308
   // --------------------------------------------------------------------------------
5309 5309
   function privErrorReset()
5310 5310
   {
5311
-    if (PCLZIP_ERROR_EXTERNAL == 1) {
5312
-      PclErrorReset();
5313
-    }
5314
-    else {
5315
-      $this->error_code = 0;
5316
-      $this->error_string = '';
5317
-    }
5311
+	if (PCLZIP_ERROR_EXTERNAL == 1) {
5312
+	  PclErrorReset();
5313
+	}
5314
+	else {
5315
+	  $this->error_code = 0;
5316
+	  $this->error_string = '';
5317
+	}
5318 5318
   }
5319 5319
   // --------------------------------------------------------------------------------
5320 5320
 
@@ -5326,17 +5326,17 @@  discard block
 block discarded – undo
5326 5326
   // --------------------------------------------------------------------------------
5327 5327
   function privDisableMagicQuotes()
5328 5328
   {
5329
-    $v_result=1;
5329
+	$v_result=1;
5330 5330
 
5331
-    // ----- Look if function exists
5332
-    if (   (!function_exists("get_magic_quotes_runtime"))
5333
-	    || (!function_exists("set_magic_quotes_runtime"))) {
5334
-      return $v_result;
5331
+	// ----- Look if function exists
5332
+	if (   (!function_exists("get_magic_quotes_runtime"))
5333
+		|| (!function_exists("set_magic_quotes_runtime"))) {
5334
+	  return $v_result;
5335 5335
 	}
5336 5336
 
5337
-    // ----- Look if already done
5338
-    if ($this->magic_quotes_status != -1) {
5339
-      return $v_result;
5337
+	// ----- Look if already done
5338
+	if ($this->magic_quotes_status != -1) {
5339
+	  return $v_result;
5340 5340
 	}
5341 5341
 
5342 5342
 	// ----- Get and memorize the magic_quote value
@@ -5347,8 +5347,8 @@  discard block
 block discarded – undo
5347 5347
 	  @set_magic_quotes_runtime(0);
5348 5348
 	}
5349 5349
 
5350
-    // ----- Return
5351
-    return $v_result;
5350
+	// ----- Return
5351
+	return $v_result;
5352 5352
   }
5353 5353
   // --------------------------------------------------------------------------------
5354 5354
 
@@ -5360,17 +5360,17 @@  discard block
 block discarded – undo
5360 5360
   // --------------------------------------------------------------------------------
5361 5361
   function privSwapBackMagicQuotes()
5362 5362
   {
5363
-    $v_result=1;
5363
+	$v_result=1;
5364 5364
 
5365
-    // ----- Look if function exists
5366
-    if (   (!function_exists("get_magic_quotes_runtime"))
5367
-	    || (!function_exists("set_magic_quotes_runtime"))) {
5368
-      return $v_result;
5365
+	// ----- Look if function exists
5366
+	if (   (!function_exists("get_magic_quotes_runtime"))
5367
+		|| (!function_exists("set_magic_quotes_runtime"))) {
5368
+	  return $v_result;
5369 5369
 	}
5370 5370
 
5371
-    // ----- Look if something to do
5372
-    if ($this->magic_quotes_status != -1) {
5373
-      return $v_result;
5371
+	// ----- Look if something to do
5372
+	if ($this->magic_quotes_status != -1) {
5373
+	  return $v_result;
5374 5374
 	}
5375 5375
 
5376 5376
 	// ----- Swap back magic_quotes
@@ -5378,8 +5378,8 @@  discard block
 block discarded – undo
5378 5378
   	  @set_magic_quotes_runtime($this->magic_quotes_status);
5379 5379
 	}
5380 5380
 
5381
-    // ----- Return
5382
-    return $v_result;
5381
+	// ----- Return
5382
+	return $v_result;
5383 5383
   }
5384 5384
   // --------------------------------------------------------------------------------
5385 5385
 
@@ -5395,67 +5395,67 @@  discard block
 block discarded – undo
5395 5395
   // --------------------------------------------------------------------------------
5396 5396
   function PclZipUtilPathReduction($p_dir)
5397 5397
   {
5398
-    $v_result = "";
5399
-
5400
-    // ----- Look for not empty path
5401
-    if ($p_dir != "") {
5402
-      // ----- Explode path by directory names
5403
-      $v_list = explode("/", $p_dir);
5404
-
5405
-      // ----- Study directories from last to first
5406
-      $v_skip = 0;
5407
-      for ($i=sizeof($v_list)-1; $i>=0; $i--) {
5408
-        // ----- Look for current path
5409
-        if ($v_list[$i] == ".") {
5410
-          // ----- Ignore this directory
5411
-          // Should be the first $i=0, but no check is done
5412
-        }
5413
-        else if ($v_list[$i] == "..") {
5398
+	$v_result = "";
5399
+
5400
+	// ----- Look for not empty path
5401
+	if ($p_dir != "") {
5402
+	  // ----- Explode path by directory names
5403
+	  $v_list = explode("/", $p_dir);
5404
+
5405
+	  // ----- Study directories from last to first
5406
+	  $v_skip = 0;
5407
+	  for ($i=sizeof($v_list)-1; $i>=0; $i--) {
5408
+		// ----- Look for current path
5409
+		if ($v_list[$i] == ".") {
5410
+		  // ----- Ignore this directory
5411
+		  // Should be the first $i=0, but no check is done
5412
+		}
5413
+		else if ($v_list[$i] == "..") {
5414 5414
 		  $v_skip++;
5415
-        }
5416
-        else if ($v_list[$i] == "") {
5415
+		}
5416
+		else if ($v_list[$i] == "") {
5417 5417
 		  // ----- First '/' i.e. root slash
5418 5418
 		  if ($i == 0) {
5419
-            $v_result = "/".$v_result;
5420
-		    if ($v_skip > 0) {
5421
-		        // ----- It is an invalid path, so the path is not modified
5422
-		        // TBC
5423
-		        $v_result = $p_dir;
5424
-                $v_skip = 0;
5425
-		    }
5419
+			$v_result = "/".$v_result;
5420
+			if ($v_skip > 0) {
5421
+				// ----- It is an invalid path, so the path is not modified
5422
+				// TBC
5423
+				$v_result = $p_dir;
5424
+				$v_skip = 0;
5425
+			}
5426 5426
 		  }
5427 5427
 		  // ----- Last '/' i.e. indicates a directory
5428 5428
 		  else if ($i == (sizeof($v_list)-1)) {
5429
-            $v_result = $v_list[$i];
5429
+			$v_result = $v_list[$i];
5430 5430
 		  }
5431 5431
 		  // ----- Double '/' inside the path
5432 5432
 		  else {
5433
-            // ----- Ignore only the double '//' in path,
5434
-            // but not the first and last '/'
5433
+			// ----- Ignore only the double '//' in path,
5434
+			// but not the first and last '/'
5435 5435
 		  }
5436
-        }
5437
-        else {
5436
+		}
5437
+		else {
5438 5438
 		  // ----- Look for item to skip
5439 5439
 		  if ($v_skip > 0) {
5440
-		    $v_skip--;
5440
+			$v_skip--;
5441 5441
 		  }
5442 5442
 		  else {
5443
-            $v_result = $v_list[$i].($i!=(sizeof($v_list)-1)?"/".$v_result:"");
5443
+			$v_result = $v_list[$i].($i!=(sizeof($v_list)-1)?"/".$v_result:"");
5444 5444
 		  }
5445
-        }
5446
-      }
5445
+		}
5446
+	  }
5447 5447
       
5448
-      // ----- Look for skip
5449
-      if ($v_skip > 0) {
5450
-        while ($v_skip > 0) {
5451
-            $v_result = '../'.$v_result;
5452
-            $v_skip--;
5453
-        }
5454
-      }
5455
-    }
5448
+	  // ----- Look for skip
5449
+	  if ($v_skip > 0) {
5450
+		while ($v_skip > 0) {
5451
+			$v_result = '../'.$v_result;
5452
+			$v_skip--;
5453
+		}
5454
+	  }
5455
+	}
5456 5456
 
5457
-    // ----- Return
5458
-    return $v_result;
5457
+	// ----- Return
5458
+	return $v_result;
5459 5459
   }
5460 5460
   // --------------------------------------------------------------------------------
5461 5461
 
@@ -5476,67 +5476,67 @@  discard block
 block discarded – undo
5476 5476
   // --------------------------------------------------------------------------------
5477 5477
   function PclZipUtilPathInclusion($p_dir, $p_path)
5478 5478
   {
5479
-    $v_result = 1;
5479
+	$v_result = 1;
5480 5480
     
5481
-    // ----- Look for path beginning by ./
5482
-    if (   ($p_dir == '.')
5483
-        || ((strlen($p_dir) >=2) && (substr($p_dir, 0, 2) == './'))) {
5484
-      $p_dir = PclZipUtilTranslateWinPath(getcwd(), FALSE).'/'.substr($p_dir, 1);
5485
-    }
5486
-    if (   ($p_path == '.')
5487
-        || ((strlen($p_path) >=2) && (substr($p_path, 0, 2) == './'))) {
5488
-      $p_path = PclZipUtilTranslateWinPath(getcwd(), FALSE).'/'.substr($p_path, 1);
5489
-    }
5481
+	// ----- Look for path beginning by ./
5482
+	if (   ($p_dir == '.')
5483
+		|| ((strlen($p_dir) >=2) && (substr($p_dir, 0, 2) == './'))) {
5484
+	  $p_dir = PclZipUtilTranslateWinPath(getcwd(), FALSE).'/'.substr($p_dir, 1);
5485
+	}
5486
+	if (   ($p_path == '.')
5487
+		|| ((strlen($p_path) >=2) && (substr($p_path, 0, 2) == './'))) {
5488
+	  $p_path = PclZipUtilTranslateWinPath(getcwd(), FALSE).'/'.substr($p_path, 1);
5489
+	}
5490 5490
 
5491
-    // ----- Explode dir and path by directory separator
5492
-    $v_list_dir = explode("/", $p_dir);
5493
-    $v_list_dir_size = sizeof($v_list_dir);
5494
-    $v_list_path = explode("/", $p_path);
5495
-    $v_list_path_size = sizeof($v_list_path);
5496
-
5497
-    // ----- Study directories paths
5498
-    $i = 0;
5499
-    $j = 0;
5500
-    while (($i < $v_list_dir_size) && ($j < $v_list_path_size) && ($v_result)) {
5501
-
5502
-      // ----- Look for empty dir (path reduction)
5503
-      if ($v_list_dir[$i] == '') {
5504
-        $i++;
5505
-        continue;
5506
-      }
5507
-      if ($v_list_path[$j] == '') {
5508
-        $j++;
5509
-        continue;
5510
-      }
5491
+	// ----- Explode dir and path by directory separator
5492
+	$v_list_dir = explode("/", $p_dir);
5493
+	$v_list_dir_size = sizeof($v_list_dir);
5494
+	$v_list_path = explode("/", $p_path);
5495
+	$v_list_path_size = sizeof($v_list_path);
5496
+
5497
+	// ----- Study directories paths
5498
+	$i = 0;
5499
+	$j = 0;
5500
+	while (($i < $v_list_dir_size) && ($j < $v_list_path_size) && ($v_result)) {
5501
+
5502
+	  // ----- Look for empty dir (path reduction)
5503
+	  if ($v_list_dir[$i] == '') {
5504
+		$i++;
5505
+		continue;
5506
+	  }
5507
+	  if ($v_list_path[$j] == '') {
5508
+		$j++;
5509
+		continue;
5510
+	  }
5511 5511
 
5512
-      // ----- Compare the items
5513
-      if (($v_list_dir[$i] != $v_list_path[$j]) && ($v_list_dir[$i] != '') && ( $v_list_path[$j] != ''))  {
5514
-        $v_result = 0;
5515
-      }
5512
+	  // ----- Compare the items
5513
+	  if (($v_list_dir[$i] != $v_list_path[$j]) && ($v_list_dir[$i] != '') && ( $v_list_path[$j] != ''))  {
5514
+		$v_result = 0;
5515
+	  }
5516 5516
 
5517
-      // ----- Next items
5518
-      $i++;
5519
-      $j++;
5520
-    }
5517
+	  // ----- Next items
5518
+	  $i++;
5519
+	  $j++;
5520
+	}
5521 5521
 
5522
-    // ----- Look if everything seems to be the same
5523
-    if ($v_result) {
5524
-      // ----- Skip all the empty items
5525
-      while (($j < $v_list_path_size) && ($v_list_path[$j] == '')) $j++;
5526
-      while (($i < $v_list_dir_size) && ($v_list_dir[$i] == '')) $i++;
5522
+	// ----- Look if everything seems to be the same
5523
+	if ($v_result) {
5524
+	  // ----- Skip all the empty items
5525
+	  while (($j < $v_list_path_size) && ($v_list_path[$j] == '')) $j++;
5526
+	  while (($i < $v_list_dir_size) && ($v_list_dir[$i] == '')) $i++;
5527 5527
 
5528
-      if (($i >= $v_list_dir_size) && ($j >= $v_list_path_size)) {
5529
-        // ----- There are exactly the same
5530
-        $v_result = 2;
5531
-      }
5532
-      else if ($i < $v_list_dir_size) {
5533
-        // ----- The path is shorter than the dir
5534
-        $v_result = 0;
5535
-      }
5536
-    }
5528
+	  if (($i >= $v_list_dir_size) && ($j >= $v_list_path_size)) {
5529
+		// ----- There are exactly the same
5530
+		$v_result = 2;
5531
+	  }
5532
+	  else if ($i < $v_list_dir_size) {
5533
+		// ----- The path is shorter than the dir
5534
+		$v_result = 0;
5535
+	  }
5536
+	}
5537 5537
 
5538
-    // ----- Return
5539
-    return $v_result;
5538
+	// ----- Return
5539
+	return $v_result;
5540 5540
   }
5541 5541
   // --------------------------------------------------------------------------------
5542 5542
 
@@ -5553,51 +5553,51 @@  discard block
 block discarded – undo
5553 5553
   // --------------------------------------------------------------------------------
5554 5554
   function PclZipUtilCopyBlock($p_src, $p_dest, $p_size, $p_mode=0)
5555 5555
   {
5556
-    $v_result = 1;
5557
-
5558
-    if ($p_mode==0)
5559
-    {
5560
-      while ($p_size != 0)
5561
-      {
5562
-        $v_read_size = ($p_size < PCLZIP_READ_BLOCK_SIZE ? $p_size : PCLZIP_READ_BLOCK_SIZE);
5563
-        $v_buffer = @fread($p_src, $v_read_size);
5564
-        @fwrite($p_dest, $v_buffer, $v_read_size);
5565
-        $p_size -= $v_read_size;
5566
-      }
5567
-    }
5568
-    else if ($p_mode==1)
5569
-    {
5570
-      while ($p_size != 0)
5571
-      {
5572
-        $v_read_size = ($p_size < PCLZIP_READ_BLOCK_SIZE ? $p_size : PCLZIP_READ_BLOCK_SIZE);
5573
-        $v_buffer = @gzread($p_src, $v_read_size);
5574
-        @fwrite($p_dest, $v_buffer, $v_read_size);
5575
-        $p_size -= $v_read_size;
5576
-      }
5577
-    }
5578
-    else if ($p_mode==2)
5579
-    {
5580
-      while ($p_size != 0)
5581
-      {
5582
-        $v_read_size = ($p_size < PCLZIP_READ_BLOCK_SIZE ? $p_size : PCLZIP_READ_BLOCK_SIZE);
5583
-        $v_buffer = @fread($p_src, $v_read_size);
5584
-        @gzwrite($p_dest, $v_buffer, $v_read_size);
5585
-        $p_size -= $v_read_size;
5586
-      }
5587
-    }
5588
-    else if ($p_mode==3)
5589
-    {
5590
-      while ($p_size != 0)
5591
-      {
5592
-        $v_read_size = ($p_size < PCLZIP_READ_BLOCK_SIZE ? $p_size : PCLZIP_READ_BLOCK_SIZE);
5593
-        $v_buffer = @gzread($p_src, $v_read_size);
5594
-        @gzwrite($p_dest, $v_buffer, $v_read_size);
5595
-        $p_size -= $v_read_size;
5596
-      }
5597
-    }
5556
+	$v_result = 1;
5557
+
5558
+	if ($p_mode==0)
5559
+	{
5560
+	  while ($p_size != 0)
5561
+	  {
5562
+		$v_read_size = ($p_size < PCLZIP_READ_BLOCK_SIZE ? $p_size : PCLZIP_READ_BLOCK_SIZE);
5563
+		$v_buffer = @fread($p_src, $v_read_size);
5564
+		@fwrite($p_dest, $v_buffer, $v_read_size);
5565
+		$p_size -= $v_read_size;
5566
+	  }
5567
+	}
5568
+	else if ($p_mode==1)
5569
+	{
5570
+	  while ($p_size != 0)
5571
+	  {
5572
+		$v_read_size = ($p_size < PCLZIP_READ_BLOCK_SIZE ? $p_size : PCLZIP_READ_BLOCK_SIZE);
5573
+		$v_buffer = @gzread($p_src, $v_read_size);
5574
+		@fwrite($p_dest, $v_buffer, $v_read_size);
5575
+		$p_size -= $v_read_size;
5576
+	  }
5577
+	}
5578
+	else if ($p_mode==2)
5579
+	{
5580
+	  while ($p_size != 0)
5581
+	  {
5582
+		$v_read_size = ($p_size < PCLZIP_READ_BLOCK_SIZE ? $p_size : PCLZIP_READ_BLOCK_SIZE);
5583
+		$v_buffer = @fread($p_src, $v_read_size);
5584
+		@gzwrite($p_dest, $v_buffer, $v_read_size);
5585
+		$p_size -= $v_read_size;
5586
+	  }
5587
+	}
5588
+	else if ($p_mode==3)
5589
+	{
5590
+	  while ($p_size != 0)
5591
+	  {
5592
+		$v_read_size = ($p_size < PCLZIP_READ_BLOCK_SIZE ? $p_size : PCLZIP_READ_BLOCK_SIZE);
5593
+		$v_buffer = @gzread($p_src, $v_read_size);
5594
+		@gzwrite($p_dest, $v_buffer, $v_read_size);
5595
+		$p_size -= $v_read_size;
5596
+	  }
5597
+	}
5598 5598
 
5599
-    // ----- Return
5600
-    return $v_result;
5599
+	// ----- Return
5600
+	return $v_result;
5601 5601
   }
5602 5602
   // --------------------------------------------------------------------------------
5603 5603
 
@@ -5615,22 +5615,22 @@  discard block
 block discarded – undo
5615 5615
   // --------------------------------------------------------------------------------
5616 5616
   function PclZipUtilRename($p_src, $p_dest)
5617 5617
   {
5618
-    $v_result = 1;
5618
+	$v_result = 1;
5619 5619
 
5620
-    // ----- Try to rename the files
5621
-    if (!@rename($p_src, $p_dest)) {
5620
+	// ----- Try to rename the files
5621
+	if (!@rename($p_src, $p_dest)) {
5622 5622
 
5623
-      // ----- Try to copy & unlink the src
5624
-      if (!@copy($p_src, $p_dest)) {
5625
-        $v_result = 0;
5626
-      }
5627
-      else if (!@unlink($p_src)) {
5628
-        $v_result = 0;
5629
-      }
5630
-    }
5623
+	  // ----- Try to copy & unlink the src
5624
+	  if (!@copy($p_src, $p_dest)) {
5625
+		$v_result = 0;
5626
+	  }
5627
+	  else if (!@unlink($p_src)) {
5628
+		$v_result = 0;
5629
+	  }
5630
+	}
5631 5631
 
5632
-    // ----- Return
5633
-    return $v_result;
5632
+	// ----- Return
5633
+	return $v_result;
5634 5634
   }
5635 5635
   // --------------------------------------------------------------------------------
5636 5636
 
@@ -5646,20 +5646,20 @@  discard block
 block discarded – undo
5646 5646
   function PclZipUtilOptionText($p_option)
5647 5647
   {
5648 5648
     
5649
-    $v_list = get_defined_constants();
5650
-    for (reset($v_list); $v_key = key($v_list); next($v_list)) {
5651
-	    $v_prefix = substr($v_key, 0, 10);
5652
-	    if ((   ($v_prefix == 'PCLZIP_OPT')
5653
-           || ($v_prefix == 'PCLZIP_CB_')
5654
-           || ($v_prefix == 'PCLZIP_ATT'))
5655
-	        && ($v_list[$v_key] == $p_option)) {
5656
-        return $v_key;
5657
-	    }
5658
-    }
5649
+	$v_list = get_defined_constants();
5650
+	for (reset($v_list); $v_key = key($v_list); next($v_list)) {
5651
+		$v_prefix = substr($v_key, 0, 10);
5652
+		if ((   ($v_prefix == 'PCLZIP_OPT')
5653
+		   || ($v_prefix == 'PCLZIP_CB_')
5654
+		   || ($v_prefix == 'PCLZIP_ATT'))
5655
+			&& ($v_list[$v_key] == $p_option)) {
5656
+		return $v_key;
5657
+		}
5658
+	}
5659 5659
     
5660
-    $v_result = 'Unknown';
5660
+	$v_result = 'Unknown';
5661 5661
 
5662
-    return $v_result;
5662
+	return $v_result;
5663 5663
   }
5664 5664
   // --------------------------------------------------------------------------------
5665 5665
 
@@ -5676,17 +5676,17 @@  discard block
 block discarded – undo
5676 5676
   // --------------------------------------------------------------------------------
5677 5677
   function PclZipUtilTranslateWinPath($p_path, $p_remove_disk_letter=true)
5678 5678
   {
5679
-    if (stristr(php_uname(), 'windows')) {
5680
-      // ----- Look for potential disk letter
5681
-      if (($p_remove_disk_letter) && (($v_position = strpos($p_path, ':')) != false)) {
5682
-          $p_path = substr($p_path, $v_position+1);
5683
-      }
5684
-      // ----- Change potential windows directory separator
5685
-      if ((strpos($p_path, '\\') > 0) || (substr($p_path, 0,1) == '\\')) {
5686
-          $p_path = strtr($p_path, '\\', '/');
5687
-      }
5688
-    }
5689
-    return $p_path;
5679
+	if (stristr(php_uname(), 'windows')) {
5680
+	  // ----- Look for potential disk letter
5681
+	  if (($p_remove_disk_letter) && (($v_position = strpos($p_path, ':')) != false)) {
5682
+		  $p_path = substr($p_path, $v_position+1);
5683
+	  }
5684
+	  // ----- Change potential windows directory separator
5685
+	  if ((strpos($p_path, '\\') > 0) || (substr($p_path, 0,1) == '\\')) {
5686
+		  $p_path = strtr($p_path, '\\', '/');
5687
+	  }
5688
+	}
5689
+	return $p_path;
5690 5690
   }
5691 5691
   // --------------------------------------------------------------------------------
5692 5692
 
Please login to merge, or discard this patch.
Spacing   +325 added lines, -325 removed lines patch added patch discarded remove patch
@@ -26,8 +26,8 @@  discard block
 block discarded – undo
26 26
 // --------------------------------------------------------------------------------
27 27
 
28 28
   // ----- Constants
29
-  if (!defined('PCLZIP_READ_BLOCK_SIZE')) {
30
-    define( 'PCLZIP_READ_BLOCK_SIZE', 2048 );
29
+  if ( ! defined('PCLZIP_READ_BLOCK_SIZE')) {
30
+    define('PCLZIP_READ_BLOCK_SIZE', 2048);
31 31
   }
32 32
   
33 33
   // ----- File list separator
@@ -40,8 +40,8 @@  discard block
 block discarded – undo
40 40
   // Recommanded values for compatibility with older versions :
41 41
   //define( 'PCLZIP_SEPARATOR', ' ' );
42 42
   // Recommanded values for smart separation of filenames.
43
-  if (!defined('PCLZIP_SEPARATOR')) {
44
-    define( 'PCLZIP_SEPARATOR', ',' );
43
+  if ( ! defined('PCLZIP_SEPARATOR')) {
44
+    define('PCLZIP_SEPARATOR', ',');
45 45
   }
46 46
 
47 47
   // ----- Error configuration
@@ -49,8 +49,8 @@  discard block
 block discarded – undo
49 49
   // 1 : PclError external library error handling. By enabling this
50 50
   //     you must ensure that you have included PclError library.
51 51
   // [2,...] : reserved for futur use
52
-  if (!defined('PCLZIP_ERROR_EXTERNAL')) {
53
-    define( 'PCLZIP_ERROR_EXTERNAL', 0 );
52
+  if ( ! defined('PCLZIP_ERROR_EXTERNAL')) {
53
+    define('PCLZIP_ERROR_EXTERNAL', 0);
54 54
   }
55 55
 
56 56
   // ----- Optional static temporary directory
@@ -62,8 +62,8 @@  discard block
 block discarded – undo
62 62
   //       Samples :
63 63
   // define( 'PCLZIP_TEMPORARY_DIR', '/temp/' );
64 64
   // define( 'PCLZIP_TEMPORARY_DIR', 'C:/Temp/' );
65
-  if (!defined('PCLZIP_TEMPORARY_DIR')) {
66
-    define( 'PCLZIP_TEMPORARY_DIR', '' );
65
+  if ( ! defined('PCLZIP_TEMPORARY_DIR')) {
66
+    define('PCLZIP_TEMPORARY_DIR', '');
67 67
   }
68 68
 
69 69
   // ----- Optional threshold ratio for use of temporary files
@@ -74,8 +74,8 @@  discard block
 block discarded – undo
74 74
   //       Recommended values are under 0.5. Default 0.47.
75 75
   //       Samples :
76 76
   // define( 'PCLZIP_TEMPORARY_FILE_RATIO', 0.5 );
77
-  if (!defined('PCLZIP_TEMPORARY_FILE_RATIO')) {
78
-    define( 'PCLZIP_TEMPORARY_FILE_RATIO', 0.47 );
77
+  if ( ! defined('PCLZIP_TEMPORARY_FILE_RATIO')) {
78
+    define('PCLZIP_TEMPORARY_FILE_RATIO', 0.47);
79 79
   }
80 80
 
81 81
 // --------------------------------------------------------------------------------
@@ -100,72 +100,72 @@  discard block
 block discarded – undo
100 100
   //  -12 : Unable to rename file (rename)
101 101
   //  -13 : Invalid header checksum
102 102
   //  -14 : Invalid archive size
103
-  define( 'PCLZIP_ERR_USER_ABORTED', 2 );
104
-  define( 'PCLZIP_ERR_NO_ERROR', 0 );
105
-  define( 'PCLZIP_ERR_WRITE_OPEN_FAIL', -1 );
106
-  define( 'PCLZIP_ERR_READ_OPEN_FAIL', -2 );
107
-  define( 'PCLZIP_ERR_INVALID_PARAMETER', -3 );
108
-  define( 'PCLZIP_ERR_MISSING_FILE', -4 );
109
-  define( 'PCLZIP_ERR_FILENAME_TOO_LONG', -5 );
110
-  define( 'PCLZIP_ERR_INVALID_ZIP', -6 );
111
-  define( 'PCLZIP_ERR_BAD_EXTRACTED_FILE', -7 );
112
-  define( 'PCLZIP_ERR_DIR_CREATE_FAIL', -8 );
113
-  define( 'PCLZIP_ERR_BAD_EXTENSION', -9 );
114
-  define( 'PCLZIP_ERR_BAD_FORMAT', -10 );
115
-  define( 'PCLZIP_ERR_DELETE_FILE_FAIL', -11 );
116
-  define( 'PCLZIP_ERR_RENAME_FILE_FAIL', -12 );
117
-  define( 'PCLZIP_ERR_BAD_CHECKSUM', -13 );
118
-  define( 'PCLZIP_ERR_INVALID_ARCHIVE_ZIP', -14 );
119
-  define( 'PCLZIP_ERR_MISSING_OPTION_VALUE', -15 );
120
-  define( 'PCLZIP_ERR_INVALID_OPTION_VALUE', -16 );
121
-  define( 'PCLZIP_ERR_ALREADY_A_DIRECTORY', -17 );
122
-  define( 'PCLZIP_ERR_UNSUPPORTED_COMPRESSION', -18 );
123
-  define( 'PCLZIP_ERR_UNSUPPORTED_ENCRYPTION', -19 );
124
-  define( 'PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE', -20 );
125
-  define( 'PCLZIP_ERR_DIRECTORY_RESTRICTION', -21 );
103
+  define('PCLZIP_ERR_USER_ABORTED', 2);
104
+  define('PCLZIP_ERR_NO_ERROR', 0);
105
+  define('PCLZIP_ERR_WRITE_OPEN_FAIL', -1);
106
+  define('PCLZIP_ERR_READ_OPEN_FAIL', -2);
107
+  define('PCLZIP_ERR_INVALID_PARAMETER', -3);
108
+  define('PCLZIP_ERR_MISSING_FILE', -4);
109
+  define('PCLZIP_ERR_FILENAME_TOO_LONG', -5);
110
+  define('PCLZIP_ERR_INVALID_ZIP', -6);
111
+  define('PCLZIP_ERR_BAD_EXTRACTED_FILE', -7);
112
+  define('PCLZIP_ERR_DIR_CREATE_FAIL', -8);
113
+  define('PCLZIP_ERR_BAD_EXTENSION', -9);
114
+  define('PCLZIP_ERR_BAD_FORMAT', -10);
115
+  define('PCLZIP_ERR_DELETE_FILE_FAIL', -11);
116
+  define('PCLZIP_ERR_RENAME_FILE_FAIL', -12);
117
+  define('PCLZIP_ERR_BAD_CHECKSUM', -13);
118
+  define('PCLZIP_ERR_INVALID_ARCHIVE_ZIP', -14);
119
+  define('PCLZIP_ERR_MISSING_OPTION_VALUE', -15);
120
+  define('PCLZIP_ERR_INVALID_OPTION_VALUE', -16);
121
+  define('PCLZIP_ERR_ALREADY_A_DIRECTORY', -17);
122
+  define('PCLZIP_ERR_UNSUPPORTED_COMPRESSION', -18);
123
+  define('PCLZIP_ERR_UNSUPPORTED_ENCRYPTION', -19);
124
+  define('PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE', -20);
125
+  define('PCLZIP_ERR_DIRECTORY_RESTRICTION', -21);
126 126
 
127 127
   // ----- Options values
128
-  define( 'PCLZIP_OPT_PATH', 77001 );
129
-  define( 'PCLZIP_OPT_ADD_PATH', 77002 );
130
-  define( 'PCLZIP_OPT_REMOVE_PATH', 77003 );
131
-  define( 'PCLZIP_OPT_REMOVE_ALL_PATH', 77004 );
132
-  define( 'PCLZIP_OPT_SET_CHMOD', 77005 );
133
-  define( 'PCLZIP_OPT_EXTRACT_AS_STRING', 77006 );
134
-  define( 'PCLZIP_OPT_NO_COMPRESSION', 77007 );
135
-  define( 'PCLZIP_OPT_BY_NAME', 77008 );
136
-  define( 'PCLZIP_OPT_BY_INDEX', 77009 );
137
-  define( 'PCLZIP_OPT_BY_EREG', 77010 );
138
-  define( 'PCLZIP_OPT_BY_PREG', 77011 );
139
-  define( 'PCLZIP_OPT_COMMENT', 77012 );
140
-  define( 'PCLZIP_OPT_ADD_COMMENT', 77013 );
141
-  define( 'PCLZIP_OPT_PREPEND_COMMENT', 77014 );
142
-  define( 'PCLZIP_OPT_EXTRACT_IN_OUTPUT', 77015 );
143
-  define( 'PCLZIP_OPT_REPLACE_NEWER', 77016 );
144
-  define( 'PCLZIP_OPT_STOP_ON_ERROR', 77017 );
128
+  define('PCLZIP_OPT_PATH', 77001);
129
+  define('PCLZIP_OPT_ADD_PATH', 77002);
130
+  define('PCLZIP_OPT_REMOVE_PATH', 77003);
131
+  define('PCLZIP_OPT_REMOVE_ALL_PATH', 77004);
132
+  define('PCLZIP_OPT_SET_CHMOD', 77005);
133
+  define('PCLZIP_OPT_EXTRACT_AS_STRING', 77006);
134
+  define('PCLZIP_OPT_NO_COMPRESSION', 77007);
135
+  define('PCLZIP_OPT_BY_NAME', 77008);
136
+  define('PCLZIP_OPT_BY_INDEX', 77009);
137
+  define('PCLZIP_OPT_BY_EREG', 77010);
138
+  define('PCLZIP_OPT_BY_PREG', 77011);
139
+  define('PCLZIP_OPT_COMMENT', 77012);
140
+  define('PCLZIP_OPT_ADD_COMMENT', 77013);
141
+  define('PCLZIP_OPT_PREPEND_COMMENT', 77014);
142
+  define('PCLZIP_OPT_EXTRACT_IN_OUTPUT', 77015);
143
+  define('PCLZIP_OPT_REPLACE_NEWER', 77016);
144
+  define('PCLZIP_OPT_STOP_ON_ERROR', 77017);
145 145
   // Having big trouble with crypt. Need to multiply 2 long int
146 146
   // which is not correctly supported by PHP ...
147 147
   //define( 'PCLZIP_OPT_CRYPT', 77018 );
148
-  define( 'PCLZIP_OPT_EXTRACT_DIR_RESTRICTION', 77019 );
149
-  define( 'PCLZIP_OPT_TEMP_FILE_THRESHOLD', 77020 );
150
-  define( 'PCLZIP_OPT_ADD_TEMP_FILE_THRESHOLD', 77020 ); // alias
151
-  define( 'PCLZIP_OPT_TEMP_FILE_ON', 77021 );
152
-  define( 'PCLZIP_OPT_ADD_TEMP_FILE_ON', 77021 ); // alias
153
-  define( 'PCLZIP_OPT_TEMP_FILE_OFF', 77022 );
154
-  define( 'PCLZIP_OPT_ADD_TEMP_FILE_OFF', 77022 ); // alias
148
+  define('PCLZIP_OPT_EXTRACT_DIR_RESTRICTION', 77019);
149
+  define('PCLZIP_OPT_TEMP_FILE_THRESHOLD', 77020);
150
+  define('PCLZIP_OPT_ADD_TEMP_FILE_THRESHOLD', 77020); // alias
151
+  define('PCLZIP_OPT_TEMP_FILE_ON', 77021);
152
+  define('PCLZIP_OPT_ADD_TEMP_FILE_ON', 77021); // alias
153
+  define('PCLZIP_OPT_TEMP_FILE_OFF', 77022);
154
+  define('PCLZIP_OPT_ADD_TEMP_FILE_OFF', 77022); // alias
155 155
   
156 156
   // ----- File description attributes
157
-  define( 'PCLZIP_ATT_FILE_NAME', 79001 );
158
-  define( 'PCLZIP_ATT_FILE_NEW_SHORT_NAME', 79002 );
159
-  define( 'PCLZIP_ATT_FILE_NEW_FULL_NAME', 79003 );
160
-  define( 'PCLZIP_ATT_FILE_MTIME', 79004 );
161
-  define( 'PCLZIP_ATT_FILE_CONTENT', 79005 );
162
-  define( 'PCLZIP_ATT_FILE_COMMENT', 79006 );
157
+  define('PCLZIP_ATT_FILE_NAME', 79001);
158
+  define('PCLZIP_ATT_FILE_NEW_SHORT_NAME', 79002);
159
+  define('PCLZIP_ATT_FILE_NEW_FULL_NAME', 79003);
160
+  define('PCLZIP_ATT_FILE_MTIME', 79004);
161
+  define('PCLZIP_ATT_FILE_CONTENT', 79005);
162
+  define('PCLZIP_ATT_FILE_COMMENT', 79006);
163 163
 
164 164
   // ----- Call backs values
165
-  define( 'PCLZIP_CB_PRE_EXTRACT', 78001 );
166
-  define( 'PCLZIP_CB_POST_EXTRACT', 78002 );
167
-  define( 'PCLZIP_CB_PRE_ADD', 78003 );
168
-  define( 'PCLZIP_CB_POST_ADD', 78004 );
165
+  define('PCLZIP_CB_PRE_EXTRACT', 78001);
166
+  define('PCLZIP_CB_POST_EXTRACT', 78002);
167
+  define('PCLZIP_CB_PRE_ADD', 78003);
168
+  define('PCLZIP_CB_POST_ADD', 78004);
169 169
   /* For futur use
170 170
   define( 'PCLZIP_CB_PRE_LIST', 78005 );
171 171
   define( 'PCLZIP_CB_POST_LIST', 78006 );
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
   {
217 217
 
218 218
     // ----- Tests the zlib
219
-    if (!function_exists('gzopen'))
219
+    if ( ! function_exists('gzopen'))
220 220
     {
221 221
       die('Abort '.basename(__FILE__).' : Missing zlib extensions');
222 222
     }
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
   // --------------------------------------------------------------------------------
271 271
   function create($p_filelist)
272 272
   {
273
-    $v_result=1;
273
+    $v_result = 1;
274 274
 
275 275
     // ----- Reset the error handler
276 276
     $this->privErrorReset();
@@ -296,7 +296,7 @@  discard block
 block discarded – undo
296 296
 
297 297
         // ----- Parse the options
298 298
         $v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options,
299
-                                            array (PCLZIP_OPT_REMOVE_PATH => 'optional',
299
+                                            array(PCLZIP_OPT_REMOVE_PATH => 'optional',
300 300
                                                    PCLZIP_OPT_REMOVE_ALL_PATH => 'optional',
301 301
                                                    PCLZIP_OPT_ADD_PATH => 'optional',
302 302
                                                    PCLZIP_CB_PRE_ADD => 'optional',
@@ -382,7 +382,7 @@  discard block
 block discarded – undo
382 382
     
383 383
     // ----- For each file in the list check the attributes
384 384
     $v_supported_attributes
385
-    = array ( PCLZIP_ATT_FILE_NAME => 'mandatory'
385
+    = array(PCLZIP_ATT_FILE_NAME => 'mandatory'
386 386
              ,PCLZIP_ATT_FILE_NEW_SHORT_NAME => 'optional'
387 387
              ,PCLZIP_ATT_FILE_NEW_FULL_NAME => 'optional'
388 388
              ,PCLZIP_ATT_FILE_MTIME => 'optional'
@@ -453,7 +453,7 @@  discard block
 block discarded – undo
453 453
   // --------------------------------------------------------------------------------
454 454
   function add($p_filelist)
455 455
   {
456
-    $v_result=1;
456
+    $v_result = 1;
457 457
 
458 458
     // ----- Reset the error handler
459 459
     $this->privErrorReset();
@@ -479,7 +479,7 @@  discard block
 block discarded – undo
479 479
 
480 480
         // ----- Parse the options
481 481
         $v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options,
482
-                                            array (PCLZIP_OPT_REMOVE_PATH => 'optional',
482
+                                            array(PCLZIP_OPT_REMOVE_PATH => 'optional',
483 483
                                                    PCLZIP_OPT_REMOVE_ALL_PATH => 'optional',
484 484
                                                    PCLZIP_OPT_ADD_PATH => 'optional',
485 485
                                                    PCLZIP_CB_PRE_ADD => 'optional',
@@ -565,7 +565,7 @@  discard block
 block discarded – undo
565 565
     
566 566
     // ----- For each file in the list check the attributes
567 567
     $v_supported_attributes
568
-    = array ( PCLZIP_ATT_FILE_NAME => 'mandatory'
568
+    = array(PCLZIP_ATT_FILE_NAME => 'mandatory'
569 569
              ,PCLZIP_ATT_FILE_NEW_SHORT_NAME => 'optional'
570 570
              ,PCLZIP_ATT_FILE_NEW_FULL_NAME => 'optional'
571 571
              ,PCLZIP_ATT_FILE_MTIME => 'optional'
@@ -642,13 +642,13 @@  discard block
 block discarded – undo
642 642
   // --------------------------------------------------------------------------------
643 643
   function listContent()
644 644
   {
645
-    $v_result=1;
645
+    $v_result = 1;
646 646
 
647 647
     // ----- Reset the error handler
648 648
     $this->privErrorReset();
649 649
 
650 650
     // ----- Check archive
651
-    if (!$this->privCheckFormat()) {
651
+    if ( ! $this->privCheckFormat()) {
652 652
       return(0);
653 653
     }
654 654
 
@@ -699,13 +699,13 @@  discard block
 block discarded – undo
699 699
   // --------------------------------------------------------------------------------
700 700
   function extract()
701 701
   {
702
-    $v_result=1;
702
+    $v_result = 1;
703 703
 
704 704
     // ----- Reset the error handler
705 705
     $this->privErrorReset();
706 706
 
707 707
     // ----- Check archive
708
-    if (!$this->privCheckFormat()) {
708
+    if ( ! $this->privCheckFormat()) {
709 709
       return(0);
710 710
     }
711 711
 
@@ -732,7 +732,7 @@  discard block
 block discarded – undo
732 732
 
733 733
         // ----- Parse the options
734 734
         $v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options,
735
-                                            array (PCLZIP_OPT_PATH => 'optional',
735
+                                            array(PCLZIP_OPT_PATH => 'optional',
736 736
                                                    PCLZIP_OPT_REMOVE_PATH => 'optional',
737 737
                                                    PCLZIP_OPT_REMOVE_ALL_PATH => 'optional',
738 738
                                                    PCLZIP_OPT_ADD_PATH => 'optional',
@@ -856,13 +856,13 @@  discard block
 block discarded – undo
856 856
   //function extractByIndex($p_index, options...)
857 857
   function extractByIndex($p_index)
858 858
   {
859
-    $v_result=1;
859
+    $v_result = 1;
860 860
 
861 861
     // ----- Reset the error handler
862 862
     $this->privErrorReset();
863 863
 
864 864
     // ----- Check archive
865
-    if (!$this->privCheckFormat()) {
865
+    if ( ! $this->privCheckFormat()) {
866 866
       return(0);
867 867
     }
868 868
 
@@ -893,7 +893,7 @@  discard block
 block discarded – undo
893 893
 
894 894
         // ----- Parse the options
895 895
         $v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options,
896
-                                            array (PCLZIP_OPT_PATH => 'optional',
896
+                                            array(PCLZIP_OPT_PATH => 'optional',
897 897
                                                    PCLZIP_OPT_REMOVE_PATH => 'optional',
898 898
                                                    PCLZIP_OPT_REMOVE_ALL_PATH => 'optional',
899 899
                                                    PCLZIP_OPT_EXTRACT_AS_STRING => 'optional',
@@ -929,7 +929,7 @@  discard block
 block discarded – undo
929 929
           }
930 930
           $v_path .= $v_options[PCLZIP_OPT_ADD_PATH];
931 931
         }
932
-        if (!isset($v_options[PCLZIP_OPT_EXTRACT_AS_STRING])) {
932
+        if ( ! isset($v_options[PCLZIP_OPT_EXTRACT_AS_STRING])) {
933 933
           $v_options[PCLZIP_OPT_EXTRACT_AS_STRING] = FALSE;
934 934
         }
935 935
         else {
@@ -963,10 +963,10 @@  discard block
 block discarded – undo
963 963
     // ----- Trick
964 964
     // Here I want to reuse extractByRule(), so I need to parse the $p_index
965 965
     // with privParseOptions()
966
-    $v_arg_trick = array (PCLZIP_OPT_BY_INDEX, $p_index);
966
+    $v_arg_trick = array(PCLZIP_OPT_BY_INDEX, $p_index);
967 967
     $v_options_trick = array();
968 968
     $v_result = $this->privParseOptions($v_arg_trick, sizeof($v_arg_trick), $v_options_trick,
969
-                                        array (PCLZIP_OPT_BY_INDEX => 'optional' ));
969
+                                        array(PCLZIP_OPT_BY_INDEX => 'optional'));
970 970
     if ($v_result != 1) {
971 971
         return 0;
972 972
     }
@@ -1005,13 +1005,13 @@  discard block
 block discarded – undo
1005 1005
   // --------------------------------------------------------------------------------
1006 1006
   function delete()
1007 1007
   {
1008
-    $v_result=1;
1008
+    $v_result = 1;
1009 1009
 
1010 1010
     // ----- Reset the error handler
1011 1011
     $this->privErrorReset();
1012 1012
 
1013 1013
     // ----- Check archive
1014
-    if (!$this->privCheckFormat()) {
1014
+    if ( ! $this->privCheckFormat()) {
1015 1015
       return(0);
1016 1016
     }
1017 1017
 
@@ -1028,10 +1028,10 @@  discard block
 block discarded – undo
1028 1028
 
1029 1029
       // ----- Parse the options
1030 1030
       $v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options,
1031
-                                        array (PCLZIP_OPT_BY_NAME => 'optional',
1031
+                                        array(PCLZIP_OPT_BY_NAME => 'optional',
1032 1032
                                                PCLZIP_OPT_BY_EREG => 'optional',
1033 1033
                                                PCLZIP_OPT_BY_PREG => 'optional',
1034
-                                               PCLZIP_OPT_BY_INDEX => 'optional' ));
1034
+                                               PCLZIP_OPT_BY_INDEX => 'optional'));
1035 1035
       if ($v_result != 1) {
1036 1036
           return 0;
1037 1037
       }
@@ -1096,7 +1096,7 @@  discard block
 block discarded – undo
1096 1096
     $this->privDisableMagicQuotes();
1097 1097
 
1098 1098
     // ----- Check archive
1099
-    if (!$this->privCheckFormat()) {
1099
+    if ( ! $this->privCheckFormat()) {
1100 1100
       $this->privSwapBackMagicQuotes();
1101 1101
       return(0);
1102 1102
     }
@@ -1180,7 +1180,7 @@  discard block
 block discarded – undo
1180 1180
 
1181 1181
       // ----- Check that $p_archive is a valid zip file
1182 1182
       // TBC : Should also check the archive format
1183
-      if (!is_file($p_archive)) {
1183
+      if ( ! is_file($p_archive)) {
1184 1184
         // ----- Error log
1185 1185
         PclZip::privErrorLog(PCLZIP_ERR_MISSING_FILE, "No file with filename '".$p_archive."'");
1186 1186
         $v_result = PCLZIP_ERR_MISSING_FILE;
@@ -1226,7 +1226,7 @@  discard block
 block discarded – undo
1226 1226
     $this->privErrorReset();
1227 1227
 
1228 1228
     // ----- Check archive
1229
-    if (!$this->privCheckFormat()) {
1229
+    if ( ! $this->privCheckFormat()) {
1230 1230
       return(0);
1231 1231
     }
1232 1232
 
@@ -1285,9 +1285,9 @@  discard block
 block discarded – undo
1285 1285
   // Description :
1286 1286
   // Parameters :
1287 1287
   // --------------------------------------------------------------------------------
1288
-  function errorName($p_with_code=false)
1288
+  function errorName($p_with_code = false)
1289 1289
   {
1290
-    $v_name = array ( PCLZIP_ERR_NO_ERROR => 'PCLZIP_ERR_NO_ERROR',
1290
+    $v_name = array(PCLZIP_ERR_NO_ERROR => 'PCLZIP_ERR_NO_ERROR',
1291 1291
                       PCLZIP_ERR_WRITE_OPEN_FAIL => 'PCLZIP_ERR_WRITE_OPEN_FAIL',
1292 1292
                       PCLZIP_ERR_READ_OPEN_FAIL => 'PCLZIP_ERR_READ_OPEN_FAIL',
1293 1293
                       PCLZIP_ERR_INVALID_PARAMETER => 'PCLZIP_ERR_INVALID_PARAMETER',
@@ -1331,7 +1331,7 @@  discard block
 block discarded – undo
1331 1331
   // Description :
1332 1332
   // Parameters :
1333 1333
   // --------------------------------------------------------------------------------
1334
-  function errorInfo($p_full=false)
1334
+  function errorInfo($p_full = false)
1335 1335
   {
1336 1336
     if (PCLZIP_ERROR_EXTERNAL == 1) {
1337 1337
       return(PclErrorString());
@@ -1370,7 +1370,7 @@  discard block
 block discarded – undo
1370 1370
   //   true on success,
1371 1371
   //   false on error, the error code is set.
1372 1372
   // --------------------------------------------------------------------------------
1373
-  function privCheckFormat($p_level=0)
1373
+  function privCheckFormat($p_level = 0)
1374 1374
   {
1375 1375
     $v_result = true;
1376 1376
 
@@ -1381,14 +1381,14 @@  discard block
 block discarded – undo
1381 1381
     $this->privErrorReset();
1382 1382
 
1383 1383
     // ----- Look if the file exits
1384
-    if (!is_file($this->zipname)) {
1384
+    if ( ! is_file($this->zipname)) {
1385 1385
       // ----- Error log
1386 1386
       PclZip::privErrorLog(PCLZIP_ERR_MISSING_FILE, "Missing archive file '".$this->zipname."'");
1387 1387
       return(false);
1388 1388
     }
1389 1389
 
1390 1390
     // ----- Check that the file is readeable
1391
-    if (!is_readable($this->zipname)) {
1391
+    if ( ! is_readable($this->zipname)) {
1392 1392
       // ----- Error log
1393 1393
       PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, "Unable to read archive '".$this->zipname."'");
1394 1394
       return(false);
@@ -1423,16 +1423,16 @@  discard block
 block discarded – undo
1423 1423
   //   1 on success.
1424 1424
   //   0 on failure.
1425 1425
   // --------------------------------------------------------------------------------
1426
-  function privParseOptions(&$p_options_list, $p_size, &$v_result_list, $v_requested_options=false)
1426
+  function privParseOptions(&$p_options_list, $p_size, &$v_result_list, $v_requested_options = false)
1427 1427
   {
1428
-    $v_result=1;
1428
+    $v_result = 1;
1429 1429
     
1430 1430
     // ----- Read the options
1431
-    $i=0;
1432
-    while ($i<$p_size) {
1431
+    $i = 0;
1432
+    while ($i < $p_size) {
1433 1433
 
1434 1434
       // ----- Check if the option is supported
1435
-      if (!isset($v_requested_options[$p_options_list[$i]])) {
1435
+      if ( ! isset($v_requested_options[$p_options_list[$i]])) {
1436 1436
         // ----- Error log
1437 1437
         PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid optional parameter '".$p_options_list[$i]."' for this method");
1438 1438
 
@@ -1447,7 +1447,7 @@  discard block
 block discarded – undo
1447 1447
         case PCLZIP_OPT_REMOVE_PATH :
1448 1448
         case PCLZIP_OPT_ADD_PATH :
1449 1449
           // ----- Check the number of parameters
1450
-          if (($i+1) >= $p_size) {
1450
+          if (($i + 1) >= $p_size) {
1451 1451
             // ----- Error log
1452 1452
             PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
1453 1453
 
@@ -1456,13 +1456,13 @@  discard block
 block discarded – undo
1456 1456
           }
1457 1457
 
1458 1458
           // ----- Get the value
1459
-          $v_result_list[$p_options_list[$i]] = PclZipUtilTranslateWinPath($p_options_list[$i+1], FALSE);
1459
+          $v_result_list[$p_options_list[$i]] = PclZipUtilTranslateWinPath($p_options_list[$i + 1], FALSE);
1460 1460
           $i++;
1461 1461
         break;
1462 1462
 
1463 1463
         case PCLZIP_OPT_TEMP_FILE_THRESHOLD :
1464 1464
           // ----- Check the number of parameters
1465
-          if (($i+1) >= $p_size) {
1465
+          if (($i + 1) >= $p_size) {
1466 1466
             PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
1467 1467
             return PclZip::errorCode();
1468 1468
           }
@@ -1474,14 +1474,14 @@  discard block
 block discarded – undo
1474 1474
           }
1475 1475
           
1476 1476
           // ----- Check the value
1477
-          $v_value = $p_options_list[$i+1];
1478
-          if ((!is_integer($v_value)) || ($v_value<0)) {
1477
+          $v_value = $p_options_list[$i + 1];
1478
+          if (( ! is_integer($v_value)) || ($v_value < 0)) {
1479 1479
             PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Integer expected for option '".PclZipUtilOptionText($p_options_list[$i])."'");
1480 1480
             return PclZip::errorCode();
1481 1481
           }
1482 1482
 
1483 1483
           // ----- Get the value (and convert it in bytes)
1484
-          $v_result_list[$p_options_list[$i]] = $v_value*1048576;
1484
+          $v_result_list[$p_options_list[$i]] = $v_value * 1048576;
1485 1485
           $i++;
1486 1486
         break;
1487 1487
 
@@ -1512,7 +1512,7 @@  discard block
 block discarded – undo
1512 1512
 
1513 1513
         case PCLZIP_OPT_EXTRACT_DIR_RESTRICTION :
1514 1514
           // ----- Check the number of parameters
1515
-          if (($i+1) >= $p_size) {
1515
+          if (($i + 1) >= $p_size) {
1516 1516
             // ----- Error log
1517 1517
             PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
1518 1518
 
@@ -1521,9 +1521,9 @@  discard block
 block discarded – undo
1521 1521
           }
1522 1522
 
1523 1523
           // ----- Get the value
1524
-          if (   is_string($p_options_list[$i+1])
1525
-              && ($p_options_list[$i+1] != '')) {
1526
-            $v_result_list[$p_options_list[$i]] = PclZipUtilTranslateWinPath($p_options_list[$i+1], FALSE);
1524
+          if (is_string($p_options_list[$i + 1])
1525
+              && ($p_options_list[$i + 1] != '')) {
1526
+            $v_result_list[$p_options_list[$i]] = PclZipUtilTranslateWinPath($p_options_list[$i + 1], FALSE);
1527 1527
             $i++;
1528 1528
           }
1529 1529
           else {
@@ -1533,7 +1533,7 @@  discard block
 block discarded – undo
1533 1533
         // ----- Look for options that request an array of string for value
1534 1534
         case PCLZIP_OPT_BY_NAME :
1535 1535
           // ----- Check the number of parameters
1536
-          if (($i+1) >= $p_size) {
1536
+          if (($i + 1) >= $p_size) {
1537 1537
             // ----- Error log
1538 1538
             PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
1539 1539
 
@@ -1542,11 +1542,11 @@  discard block
 block discarded – undo
1542 1542
           }
1543 1543
 
1544 1544
           // ----- Get the value
1545
-          if (is_string($p_options_list[$i+1])) {
1546
-              $v_result_list[$p_options_list[$i]][0] = $p_options_list[$i+1];
1545
+          if (is_string($p_options_list[$i + 1])) {
1546
+              $v_result_list[$p_options_list[$i]][0] = $p_options_list[$i + 1];
1547 1547
           }
1548
-          else if (is_array($p_options_list[$i+1])) {
1549
-              $v_result_list[$p_options_list[$i]] = $p_options_list[$i+1];
1548
+          else if (is_array($p_options_list[$i + 1])) {
1549
+              $v_result_list[$p_options_list[$i]] = $p_options_list[$i + 1];
1550 1550
           }
1551 1551
           else {
1552 1552
             // ----- Error log
@@ -1566,7 +1566,7 @@  discard block
 block discarded – undo
1566 1566
         case PCLZIP_OPT_BY_PREG :
1567 1567
         //case PCLZIP_OPT_CRYPT :
1568 1568
           // ----- Check the number of parameters
1569
-          if (($i+1) >= $p_size) {
1569
+          if (($i + 1) >= $p_size) {
1570 1570
             // ----- Error log
1571 1571
             PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
1572 1572
 
@@ -1575,8 +1575,8 @@  discard block
 block discarded – undo
1575 1575
           }
1576 1576
 
1577 1577
           // ----- Get the value
1578
-          if (is_string($p_options_list[$i+1])) {
1579
-              $v_result_list[$p_options_list[$i]] = $p_options_list[$i+1];
1578
+          if (is_string($p_options_list[$i + 1])) {
1579
+              $v_result_list[$p_options_list[$i]] = $p_options_list[$i + 1];
1580 1580
           }
1581 1581
           else {
1582 1582
             // ----- Error log
@@ -1593,7 +1593,7 @@  discard block
 block discarded – undo
1593 1593
         case PCLZIP_OPT_ADD_COMMENT :
1594 1594
         case PCLZIP_OPT_PREPEND_COMMENT :
1595 1595
           // ----- Check the number of parameters
1596
-          if (($i+1) >= $p_size) {
1596
+          if (($i + 1) >= $p_size) {
1597 1597
             // ----- Error log
1598 1598
             PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE,
1599 1599
 			                     "Missing parameter value for option '"
@@ -1605,8 +1605,8 @@  discard block
 block discarded – undo
1605 1605
           }
1606 1606
 
1607 1607
           // ----- Get the value
1608
-          if (is_string($p_options_list[$i+1])) {
1609
-              $v_result_list[$p_options_list[$i]] = $p_options_list[$i+1];
1608
+          if (is_string($p_options_list[$i + 1])) {
1609
+              $v_result_list[$p_options_list[$i]] = $p_options_list[$i + 1];
1610 1610
           }
1611 1611
           else {
1612 1612
             // ----- Error log
@@ -1624,7 +1624,7 @@  discard block
 block discarded – undo
1624 1624
         // ----- Look for options that request an array of index
1625 1625
         case PCLZIP_OPT_BY_INDEX :
1626 1626
           // ----- Check the number of parameters
1627
-          if (($i+1) >= $p_size) {
1627
+          if (($i + 1) >= $p_size) {
1628 1628
             // ----- Error log
1629 1629
             PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
1630 1630
 
@@ -1634,19 +1634,19 @@  discard block
 block discarded – undo
1634 1634
 
1635 1635
           // ----- Get the value
1636 1636
           $v_work_list = array();
1637
-          if (is_string($p_options_list[$i+1])) {
1637
+          if (is_string($p_options_list[$i + 1])) {
1638 1638
 
1639 1639
               // ----- Remove spaces
1640
-              $p_options_list[$i+1] = strtr($p_options_list[$i+1], ' ', '');
1640
+              $p_options_list[$i + 1] = strtr($p_options_list[$i + 1], ' ', '');
1641 1641
 
1642 1642
               // ----- Parse items
1643
-              $v_work_list = explode(",", $p_options_list[$i+1]);
1643
+              $v_work_list = explode(",", $p_options_list[$i + 1]);
1644 1644
           }
1645
-          else if (is_integer($p_options_list[$i+1])) {
1646
-              $v_work_list[0] = $p_options_list[$i+1].'-'.$p_options_list[$i+1];
1645
+          else if (is_integer($p_options_list[$i + 1])) {
1646
+              $v_work_list[0] = $p_options_list[$i + 1].'-'.$p_options_list[$i + 1];
1647 1647
           }
1648
-          else if (is_array($p_options_list[$i+1])) {
1649
-              $v_work_list = $p_options_list[$i+1];
1648
+          else if (is_array($p_options_list[$i + 1])) {
1649
+              $v_work_list = $p_options_list[$i + 1];
1650 1650
           }
1651 1651
           else {
1652 1652
             // ----- Error log
@@ -1660,9 +1660,9 @@  discard block
 block discarded – undo
1660 1660
           // each index item in the list must be a couple with a start and
1661 1661
           // an end value : [0,3], [5-5], [8-10], ...
1662 1662
           // ----- Check the format of each item
1663
-          $v_sort_flag=false;
1664
-          $v_sort_value=0;
1665
-          for ($j=0; $j<sizeof($v_work_list); $j++) {
1663
+          $v_sort_flag = false;
1664
+          $v_sort_value = 0;
1665
+          for ($j = 0; $j < sizeof($v_work_list); $j++) {
1666 1666
               // ----- Explode the item
1667 1667
               $v_item_list = explode("-", $v_work_list[$j]);
1668 1668
               $v_size_item_list = sizeof($v_item_list);
@@ -1692,7 +1692,7 @@  discard block
 block discarded – undo
1692 1692
 
1693 1693
               // ----- Look for list sort
1694 1694
               if ($v_result_list[$p_options_list[$i]][$j]['start'] < $v_sort_value) {
1695
-                  $v_sort_flag=true;
1695
+                  $v_sort_flag = true;
1696 1696
 
1697 1697
                   // ----- TBC : An automatic sort should be writen ...
1698 1698
                   // ----- Error log
@@ -1726,7 +1726,7 @@  discard block
 block discarded – undo
1726 1726
         // ----- Look for options that request an octal value
1727 1727
         case PCLZIP_OPT_SET_CHMOD :
1728 1728
           // ----- Check the number of parameters
1729
-          if (($i+1) >= $p_size) {
1729
+          if (($i + 1) >= $p_size) {
1730 1730
             // ----- Error log
1731 1731
             PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
1732 1732
 
@@ -1735,7 +1735,7 @@  discard block
 block discarded – undo
1735 1735
           }
1736 1736
 
1737 1737
           // ----- Get the value
1738
-          $v_result_list[$p_options_list[$i]] = $p_options_list[$i+1];
1738
+          $v_result_list[$p_options_list[$i]] = $p_options_list[$i + 1];
1739 1739
           $i++;
1740 1740
         break;
1741 1741
 
@@ -1751,7 +1751,7 @@  discard block
 block discarded – undo
1751 1751
         case PCLZIP_CB_POST_LIST :
1752 1752
         */
1753 1753
           // ----- Check the number of parameters
1754
-          if (($i+1) >= $p_size) {
1754
+          if (($i + 1) >= $p_size) {
1755 1755
             // ----- Error log
1756 1756
             PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
1757 1757
 
@@ -1760,10 +1760,10 @@  discard block
 block discarded – undo
1760 1760
           }
1761 1761
 
1762 1762
           // ----- Get the value
1763
-          $v_function_name = $p_options_list[$i+1];
1763
+          $v_function_name = $p_options_list[$i + 1];
1764 1764
 
1765 1765
           // ----- Check that the value is a valid existing function
1766
-          if (!function_exists($v_function_name)) {
1766
+          if ( ! function_exists($v_function_name)) {
1767 1767
             // ----- Error log
1768 1768
             PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Function '".$v_function_name."()' is not an existing function for option '".PclZipUtilOptionText($p_options_list[$i])."'");
1769 1769
 
@@ -1792,11 +1792,11 @@  discard block
 block discarded – undo
1792 1792
 
1793 1793
     // ----- Look for mandatory options
1794 1794
     if ($v_requested_options !== false) {
1795
-      for ($key=reset($v_requested_options); $key=key($v_requested_options); $key=next($v_requested_options)) {
1795
+      for ($key = reset($v_requested_options); $key = key($v_requested_options); $key = next($v_requested_options)) {
1796 1796
         // ----- Look for mandatory option
1797 1797
         if ($v_requested_options[$key] == 'mandatory') {
1798 1798
           // ----- Look if present
1799
-          if (!isset($v_result_list[$key])) {
1799
+          if ( ! isset($v_result_list[$key])) {
1800 1800
             // ----- Error log
1801 1801
             PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Missing mandatory parameter ".PclZipUtilOptionText($key)."(".$key.")");
1802 1802
 
@@ -1808,7 +1808,7 @@  discard block
 block discarded – undo
1808 1808
     }
1809 1809
     
1810 1810
     // ----- Look for default values
1811
-    if (!isset($v_result_list[PCLZIP_OPT_TEMP_FILE_THRESHOLD])) {
1811
+    if ( ! isset($v_result_list[PCLZIP_OPT_TEMP_FILE_THRESHOLD])) {
1812 1812
       
1813 1813
     }
1814 1814
 
@@ -1825,7 +1825,7 @@  discard block
 block discarded – undo
1825 1825
   // --------------------------------------------------------------------------------
1826 1826
   function privOptionDefaultThreshold(&$p_options)
1827 1827
   {
1828
-    $v_result=1;
1828
+    $v_result = 1;
1829 1829
     
1830 1830
     if (isset($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD])
1831 1831
         || isset($p_options[PCLZIP_OPT_TEMP_FILE_OFF])) {
@@ -1837,16 +1837,16 @@  discard block
 block discarded – undo
1837 1837
     $v_memory_limit = trim($v_memory_limit);
1838 1838
     $last = strtolower(substr($v_memory_limit, -1));
1839 1839
  
1840
-    if($last == 'g')
1840
+    if ($last == 'g')
1841 1841
         //$v_memory_limit = $v_memory_limit*1024*1024*1024;
1842
-        $v_memory_limit = $v_memory_limit*1073741824;
1843
-    if($last == 'm')
1842
+        $v_memory_limit = $v_memory_limit * 1073741824;
1843
+    if ($last == 'm')
1844 1844
         //$v_memory_limit = $v_memory_limit*1024*1024;
1845
-        $v_memory_limit = $v_memory_limit*1048576;
1846
-    if($last == 'k')
1847
-        $v_memory_limit = $v_memory_limit*1024;
1845
+        $v_memory_limit = $v_memory_limit * 1048576;
1846
+    if ($last == 'k')
1847
+        $v_memory_limit = $v_memory_limit * 1024;
1848 1848
             
1849
-    $p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD] = floor($v_memory_limit*PCLZIP_TEMPORARY_FILE_RATIO);
1849
+    $p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD] = floor($v_memory_limit * PCLZIP_TEMPORARY_FILE_RATIO);
1850 1850
     
1851 1851
 
1852 1852
     // ----- Sanity check : No threshold if value lower than 1M
@@ -1867,15 +1867,15 @@  discard block
 block discarded – undo
1867 1867
   //   1 on success.
1868 1868
   //   0 on failure.
1869 1869
   // --------------------------------------------------------------------------------
1870
-  function privFileDescrParseAtt(&$p_file_list, &$p_filedescr, $v_options, $v_requested_options=false)
1870
+  function privFileDescrParseAtt(&$p_file_list, &$p_filedescr, $v_options, $v_requested_options = false)
1871 1871
   {
1872
-    $v_result=1;
1872
+    $v_result = 1;
1873 1873
     
1874 1874
     // ----- For each file in the list check the attributes
1875 1875
     foreach ($p_file_list as $v_key => $v_value) {
1876 1876
     
1877 1877
       // ----- Check if the option is supported
1878
-      if (!isset($v_requested_options[$v_key])) {
1878
+      if ( ! isset($v_requested_options[$v_key])) {
1879 1879
         // ----- Error log
1880 1880
         PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid file attribute '".$v_key."' for this file");
1881 1881
 
@@ -1886,7 +1886,7 @@  discard block
 block discarded – undo
1886 1886
       // ----- Look for attribute
1887 1887
       switch ($v_key) {
1888 1888
         case PCLZIP_ATT_FILE_NAME :
1889
-          if (!is_string($v_value)) {
1889
+          if ( ! is_string($v_value)) {
1890 1890
             PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid type ".gettype($v_value).". String expected for attribute '".PclZipUtilOptionText($v_key)."'");
1891 1891
             return PclZip::errorCode();
1892 1892
           }
@@ -1901,7 +1901,7 @@  discard block
 block discarded – undo
1901 1901
         break;
1902 1902
 
1903 1903
         case PCLZIP_ATT_FILE_NEW_SHORT_NAME :
1904
-          if (!is_string($v_value)) {
1904
+          if ( ! is_string($v_value)) {
1905 1905
             PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid type ".gettype($v_value).". String expected for attribute '".PclZipUtilOptionText($v_key)."'");
1906 1906
             return PclZip::errorCode();
1907 1907
           }
@@ -1915,7 +1915,7 @@  discard block
 block discarded – undo
1915 1915
         break;
1916 1916
 
1917 1917
         case PCLZIP_ATT_FILE_NEW_FULL_NAME :
1918
-          if (!is_string($v_value)) {
1918
+          if ( ! is_string($v_value)) {
1919 1919
             PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid type ".gettype($v_value).". String expected for attribute '".PclZipUtilOptionText($v_key)."'");
1920 1920
             return PclZip::errorCode();
1921 1921
           }
@@ -1930,7 +1930,7 @@  discard block
 block discarded – undo
1930 1930
 
1931 1931
         // ----- Look for options that takes a string
1932 1932
         case PCLZIP_ATT_FILE_COMMENT :
1933
-          if (!is_string($v_value)) {
1933
+          if ( ! is_string($v_value)) {
1934 1934
             PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid type ".gettype($v_value).". String expected for attribute '".PclZipUtilOptionText($v_key)."'");
1935 1935
             return PclZip::errorCode();
1936 1936
           }
@@ -1939,7 +1939,7 @@  discard block
 block discarded – undo
1939 1939
         break;
1940 1940
 
1941 1941
         case PCLZIP_ATT_FILE_MTIME :
1942
-          if (!is_integer($v_value)) {
1942
+          if ( ! is_integer($v_value)) {
1943 1943
             PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid type ".gettype($v_value).". Integer expected for attribute '".PclZipUtilOptionText($v_key)."'");
1944 1944
             return PclZip::errorCode();
1945 1945
           }
@@ -1962,11 +1962,11 @@  discard block
 block discarded – undo
1962 1962
 
1963 1963
       // ----- Look for mandatory options
1964 1964
       if ($v_requested_options !== false) {
1965
-        for ($key=reset($v_requested_options); $key=key($v_requested_options); $key=next($v_requested_options)) {
1965
+        for ($key = reset($v_requested_options); $key = key($v_requested_options); $key = next($v_requested_options)) {
1966 1966
           // ----- Look for mandatory option
1967 1967
           if ($v_requested_options[$key] == 'mandatory') {
1968 1968
             // ----- Look if present
1969
-            if (!isset($p_file_list[$key])) {
1969
+            if ( ! isset($p_file_list[$key])) {
1970 1970
               PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Missing mandatory parameter ".PclZipUtilOptionText($key)."(".$key.")");
1971 1971
               return PclZip::errorCode();
1972 1972
             }
@@ -1998,13 +1998,13 @@  discard block
 block discarded – undo
1998 1998
   // --------------------------------------------------------------------------------
1999 1999
   function privFileDescrExpand(&$p_filedescr_list, &$p_options)
2000 2000
   {
2001
-    $v_result=1;
2001
+    $v_result = 1;
2002 2002
     
2003 2003
     // ----- Create a result list
2004 2004
     $v_result_list = array();
2005 2005
     
2006 2006
     // ----- Look each entry
2007
-    for ($i=0; $i<sizeof($p_filedescr_list); $i++) {
2007
+    for ($i = 0; $i < sizeof($p_filedescr_list); $i++) {
2008 2008
       
2009 2009
       // ----- Get filedescr
2010 2010
       $v_descr = $p_filedescr_list[$i];
@@ -2071,7 +2071,7 @@  discard block
 block discarded – undo
2071 2071
             // Because the name of the folder was changed, the name of the
2072 2072
             // files/sub-folders also change
2073 2073
             if (($v_descr['stored_filename'] != $v_descr['filename'])
2074
-                 && (!isset($p_options[PCLZIP_OPT_REMOVE_ALL_PATH]))) {
2074
+                 && ( ! isset($p_options[PCLZIP_OPT_REMOVE_ALL_PATH]))) {
2075 2075
               if ($v_descr['stored_filename'] != '') {
2076 2076
                 $v_dirlist_descr[$v_dirlist_nb]['new_full_name'] = $v_descr['stored_filename'].'/'.$v_item_handler;
2077 2077
               }
@@ -2123,7 +2123,7 @@  discard block
 block discarded – undo
2123 2123
   // --------------------------------------------------------------------------------
2124 2124
   function privCreate($p_filedescr_list, &$p_result_list, &$p_options)
2125 2125
   {
2126
-    $v_result=1;
2126
+    $v_result = 1;
2127 2127
     $v_list_detail = array();
2128 2128
     
2129 2129
     // ----- Magic quotes trick
@@ -2158,11 +2158,11 @@  discard block
 block discarded – undo
2158 2158
   // --------------------------------------------------------------------------------
2159 2159
   function privAdd($p_filedescr_list, &$p_result_list, &$p_options)
2160 2160
   {
2161
-    $v_result=1;
2161
+    $v_result = 1;
2162 2162
     $v_list_detail = array();
2163 2163
 
2164 2164
     // ----- Look if the archive exists or is empty
2165
-    if ((!is_file($this->zipname)) || (filesize($this->zipname) == 0))
2165
+    if (( ! is_file($this->zipname)) || (filesize($this->zipname) == 0))
2166 2166
     {
2167 2167
 
2168 2168
       // ----- Do a create
@@ -2175,7 +2175,7 @@  discard block
 block discarded – undo
2175 2175
     $this->privDisableMagicQuotes();
2176 2176
 
2177 2177
     // ----- Open the zip file
2178
-    if (($v_result=$this->privOpenFd('rb')) != 1)
2178
+    if (($v_result = $this->privOpenFd('rb')) != 1)
2179 2179
     {
2180 2180
       // ----- Magic quotes trick
2181 2181
       $this->privSwapBackMagicQuotes();
@@ -2256,7 +2256,7 @@  discard block
 block discarded – undo
2256 2256
     }
2257 2257
 
2258 2258
     // ----- Create the Central Dir files header
2259
-    for ($i=0, $v_count=0; $i<sizeof($v_header_list); $i++)
2259
+    for ($i = 0, $v_count = 0; $i < sizeof($v_header_list); $i++)
2260 2260
     {
2261 2261
       // ----- Create the file header
2262 2262
       if ($v_header_list[$i]['status'] == 'ok') {
@@ -2289,10 +2289,10 @@  discard block
 block discarded – undo
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
-    if (($v_result = $this->privWriteCentralHeader($v_count+$v_central_dir['entries'], $v_size, $v_offset, $v_comment)) != 1)
2295
+    if (($v_result = $this->privWriteCentralHeader($v_count + $v_central_dir['entries'], $v_size, $v_offset, $v_comment)) != 1)
2296 2296
     {
2297 2297
       // ----- Reset the file list
2298 2298
       unset($v_header_list);
@@ -2337,7 +2337,7 @@  discard block
 block discarded – undo
2337 2337
   // --------------------------------------------------------------------------------
2338 2338
   function privOpenFd($p_mode)
2339 2339
   {
2340
-    $v_result=1;
2340
+    $v_result = 1;
2341 2341
 
2342 2342
     // ----- Look if already open
2343 2343
     if ($this->zip_fd != 0)
@@ -2371,7 +2371,7 @@  discard block
 block discarded – undo
2371 2371
   // --------------------------------------------------------------------------------
2372 2372
   function privCloseFd()
2373 2373
   {
2374
-    $v_result=1;
2374
+    $v_result = 1;
2375 2375
 
2376 2376
     if ($this->zip_fd != 0)
2377 2377
       @fclose($this->zip_fd);
@@ -2398,7 +2398,7 @@  discard block
 block discarded – undo
2398 2398
 //  function privAddList($p_list, &$p_result_list, $p_add_dir, $p_remove_dir, $p_remove_all_dir, &$p_options)
2399 2399
   function privAddList($p_filedescr_list, &$p_result_list, &$p_options)
2400 2400
   {
2401
-    $v_result=1;
2401
+    $v_result = 1;
2402 2402
 
2403 2403
     // ----- Add the files
2404 2404
     $v_header_list = array();
@@ -2412,7 +2412,7 @@  discard block
 block discarded – undo
2412 2412
     $v_offset = @ftell($this->zip_fd);
2413 2413
 
2414 2414
     // ----- Create the Central Dir files header
2415
-    for ($i=0,$v_count=0; $i<sizeof($v_header_list); $i++)
2415
+    for ($i = 0, $v_count = 0; $i < sizeof($v_header_list); $i++)
2416 2416
     {
2417 2417
       // ----- Create the file header
2418 2418
       if ($v_header_list[$i]['status'] == 'ok') {
@@ -2434,7 +2434,7 @@  discard block
 block discarded – undo
2434 2434
     }
2435 2435
 
2436 2436
     // ----- Calculate the size of the central header
2437
-    $v_size = @ftell($this->zip_fd)-$v_offset;
2437
+    $v_size = @ftell($this->zip_fd) - $v_offset;
2438 2438
 
2439 2439
     // ----- Create the central dir footer
2440 2440
     if (($v_result = $this->privWriteCentralHeader($v_count, $v_size, $v_offset, $v_comment)) != 1)
@@ -2462,14 +2462,14 @@  discard block
 block discarded – undo
2462 2462
   // --------------------------------------------------------------------------------
2463 2463
   function privAddFileList($p_filedescr_list, &$p_result_list, &$p_options)
2464 2464
   {
2465
-    $v_result=1;
2465
+    $v_result = 1;
2466 2466
     $v_header = array();
2467 2467
 
2468 2468
     // ----- Recuperate the current number of elt in list
2469 2469
     $v_nb = sizeof($p_result_list);
2470 2470
 
2471 2471
     // ----- Loop on the files
2472
-    for ($j=0; ($j<sizeof($p_filedescr_list)) && ($v_result==1); $j++) {
2472
+    for ($j = 0; ($j < sizeof($p_filedescr_list)) && ($v_result == 1); $j++) {
2473 2473
       // ----- Format the filename
2474 2474
       $p_filedescr_list[$j]['filename']
2475 2475
       = PclZipUtilTranslateWinPath($p_filedescr_list[$j]['filename'], false);
@@ -2482,8 +2482,8 @@  discard block
 block discarded – undo
2482 2482
       }
2483 2483
 
2484 2484
       // ----- Check the filename
2485
-      if (   ($p_filedescr_list[$j]['type'] != 'virtual_file')
2486
-          && (!file_exists($p_filedescr_list[$j]['filename']))) {
2485
+      if (($p_filedescr_list[$j]['type'] != 'virtual_file')
2486
+          && ( ! file_exists($p_filedescr_list[$j]['filename']))) {
2487 2487
         PclZip::privErrorLog(PCLZIP_ERR_MISSING_FILE, "File '".$p_filedescr_list[$j]['filename']."' does not exist");
2488 2488
         return PclZip::errorCode();
2489 2489
       }
@@ -2492,11 +2492,11 @@  discard block
 block discarded – undo
2492 2492
       // or a dir with all its path removed
2493 2493
 //      if (   (is_file($p_filedescr_list[$j]['filename']))
2494 2494
 //          || (   is_dir($p_filedescr_list[$j]['filename'])
2495
-      if (   ($p_filedescr_list[$j]['type'] == 'file')
2495
+      if (($p_filedescr_list[$j]['type'] == 'file')
2496 2496
           || ($p_filedescr_list[$j]['type'] == 'virtual_file')
2497
-          || (   ($p_filedescr_list[$j]['type'] == 'folder')
2498
-              && (   !isset($p_options[PCLZIP_OPT_REMOVE_ALL_PATH])
2499
-                  || !$p_options[PCLZIP_OPT_REMOVE_ALL_PATH]))
2497
+          || (($p_filedescr_list[$j]['type'] == 'folder')
2498
+              && ( ! isset($p_options[PCLZIP_OPT_REMOVE_ALL_PATH])
2499
+                  || ! $p_options[PCLZIP_OPT_REMOVE_ALL_PATH]))
2500 2500
           ) {
2501 2501
 
2502 2502
         // ----- Add the file
@@ -2524,7 +2524,7 @@  discard block
 block discarded – undo
2524 2524
   // --------------------------------------------------------------------------------
2525 2525
   function privAddFile($p_filedescr, &$p_header, &$p_options)
2526 2526
   {
2527
-    $v_result=1;
2527
+    $v_result = 1;
2528 2528
     
2529 2529
     // ----- Working variable
2530 2530
     $p_filename = $p_filedescr['filename'];
@@ -2569,13 +2569,13 @@  discard block
 block discarded – undo
2569 2569
     $p_header['index'] = -1;
2570 2570
 
2571 2571
     // ----- Look for regular file
2572
-    if ($p_filedescr['type']=='file') {
2572
+    if ($p_filedescr['type'] == 'file') {
2573 2573
       $p_header['external'] = 0x00000000;
2574 2574
       $p_header['size'] = filesize($p_filename);
2575 2575
     }
2576 2576
     
2577 2577
     // ----- Look for regular folder
2578
-    else if ($p_filedescr['type']=='folder') {
2578
+    else if ($p_filedescr['type'] == 'folder') {
2579 2579
       $p_header['external'] = 0x00000010;
2580 2580
       $p_header['mtime'] = filemtime($p_filename);
2581 2581
       $p_header['size'] = filesize($p_filename);
@@ -2650,10 +2650,10 @@  discard block
 block discarded – undo
2650 2650
       // ----- Look for a file
2651 2651
       if ($p_filedescr['type'] == 'file') {
2652 2652
         // ----- Look for using temporary file to zip
2653
-        if ( (!isset($p_options[PCLZIP_OPT_TEMP_FILE_OFF])) 
2653
+        if (( ! isset($p_options[PCLZIP_OPT_TEMP_FILE_OFF])) 
2654 2654
             && (isset($p_options[PCLZIP_OPT_TEMP_FILE_ON])
2655 2655
                 || (isset($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD])
2656
-                    && ($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD] <= $p_header['size'])) ) ) {
2656
+                    && ($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD] <= $p_header['size'])))) {
2657 2657
           $v_result = $this->privAddFileUsingTempFile($p_filedescr, $p_header, $p_options);
2658 2658
           if ($v_result < PCLZIP_ERR_NO_ERROR) {
2659 2659
             return $v_result;
@@ -2753,7 +2753,7 @@  discard block
 block discarded – undo
2753 2753
         // ----- Set the file properties
2754 2754
         $p_header['size'] = 0;
2755 2755
         //$p_header['external'] = 0x41FF0010;   // Value for a folder : to be checked
2756
-        $p_header['external'] = 0x00000010;   // Value for a folder : to be checked
2756
+        $p_header['external'] = 0x00000010; // Value for a folder : to be checked
2757 2757
 
2758 2758
         // ----- Call the header generation
2759 2759
         if (($v_result = $this->privWriteFileHeader($p_header)) != 1)
@@ -2797,7 +2797,7 @@  discard block
 block discarded – undo
2797 2797
   // --------------------------------------------------------------------------------
2798 2798
   function privAddFileUsingTempFile($p_filedescr, &$p_header, &$p_options)
2799 2799
   {
2800
-    $v_result=PCLZIP_ERR_NO_ERROR;
2800
+    $v_result = PCLZIP_ERR_NO_ERROR;
2801 2801
     
2802 2802
     // ----- Working variable
2803 2803
     $p_filename = $p_filedescr['filename'];
@@ -2851,7 +2851,7 @@  discard block
 block discarded – undo
2851 2851
     $v_data_header['os'] = bin2hex($v_data_header['os']);
2852 2852
 
2853 2853
     // ----- Read the gzip file footer
2854
-    @fseek($v_file_compressed, filesize($v_gzip_temp_name)-8);
2854
+    @fseek($v_file_compressed, filesize($v_gzip_temp_name) - 8);
2855 2855
     $v_binary_data = @fread($v_file_compressed, 8);
2856 2856
     $v_data_footer = unpack('Vcrc/Vcompressed_size', $v_binary_data);
2857 2857
 
@@ -2859,7 +2859,7 @@  discard block
 block discarded – undo
2859 2859
     $p_header['compression'] = ord($v_data_header['cm']);
2860 2860
     //$p_header['mtime'] = $v_data_header['mtime'];
2861 2861
     $p_header['crc'] = $v_data_footer['crc'];
2862
-    $p_header['compressed_size'] = filesize($v_gzip_temp_name)-18;
2862
+    $p_header['compressed_size'] = filesize($v_gzip_temp_name) - 18;
2863 2863
 
2864 2864
     // ----- Close the file
2865 2865
     @fclose($v_file_compressed);
@@ -2909,7 +2909,7 @@  discard block
 block discarded – undo
2909 2909
   // --------------------------------------------------------------------------------
2910 2910
   function privCalculateStoredFilename(&$p_filedescr, &$p_options)
2911 2911
   {
2912
-    $v_result=1;
2912
+    $v_result = 1;
2913 2913
     
2914 2914
     // ----- Working variables
2915 2915
     $p_filename = $p_filedescr['filename'];
@@ -2966,14 +2966,14 @@  discard block
 block discarded – undo
2966 2966
         if (substr($p_remove_dir, -1) != '/')
2967 2967
           $p_remove_dir .= "/";
2968 2968
 
2969
-        if (   (substr($p_filename, 0, 2) == "./")
2969
+        if ((substr($p_filename, 0, 2) == "./")
2970 2970
             || (substr($p_remove_dir, 0, 2) == "./")) {
2971 2971
             
2972
-          if (   (substr($p_filename, 0, 2) == "./")
2972
+          if ((substr($p_filename, 0, 2) == "./")
2973 2973
               && (substr($p_remove_dir, 0, 2) != "./")) {
2974 2974
             $p_remove_dir = "./".$p_remove_dir;
2975 2975
           }
2976
-          if (   (substr($p_filename, 0, 2) != "./")
2976
+          if ((substr($p_filename, 0, 2) != "./")
2977 2977
               && (substr($p_remove_dir, 0, 2) == "./")) {
2978 2978
             $p_remove_dir = substr($p_remove_dir, 2);
2979 2979
           }
@@ -3021,15 +3021,15 @@  discard block
 block discarded – undo
3021 3021
   // --------------------------------------------------------------------------------
3022 3022
   function privWriteFileHeader(&$p_header)
3023 3023
   {
3024
-    $v_result=1;
3024
+    $v_result = 1;
3025 3025
 
3026 3026
     // ----- Store the offset position of the file
3027 3027
     $p_header['offset'] = ftell($this->zip_fd);
3028 3028
 
3029 3029
     // ----- Transform UNIX mtime to DOS format mdate/mtime
3030 3030
     $v_date = getdate($p_header['mtime']);
3031
-    $v_mtime = ($v_date['hours']<<11) + ($v_date['minutes']<<5) + $v_date['seconds']/2;
3032
-    $v_mdate = (($v_date['year']-1980)<<9) + ($v_date['mon']<<5) + $v_date['mday'];
3031
+    $v_mtime = ($v_date['hours'] << 11) + ($v_date['minutes'] << 5) + $v_date['seconds'] / 2;
3032
+    $v_mdate = (($v_date['year'] - 1980) << 9) + ($v_date['mon'] << 5) + $v_date['mday'];
3033 3033
 
3034 3034
     // ----- Packed data
3035 3035
     $v_binary_data = pack("VvvvvvVVVvv", 0x04034b50,
@@ -3066,7 +3066,7 @@  discard block
 block discarded – undo
3066 3066
   // --------------------------------------------------------------------------------
3067 3067
   function privWriteCentralFileHeader(&$p_header)
3068 3068
   {
3069
-    $v_result=1;
3069
+    $v_result = 1;
3070 3070
 
3071 3071
     // TBC
3072 3072
     //for(reset($p_header); $key = key($p_header); next($p_header)) {
@@ -3074,8 +3074,8 @@  discard block
 block discarded – undo
3074 3074
 
3075 3075
     // ----- Transform UNIX mtime to DOS format mdate/mtime
3076 3076
     $v_date = getdate($p_header['mtime']);
3077
-    $v_mtime = ($v_date['hours']<<11) + ($v_date['minutes']<<5) + $v_date['seconds']/2;
3078
-    $v_mdate = (($v_date['year']-1980)<<9) + ($v_date['mon']<<5) + $v_date['mday'];
3077
+    $v_mtime = ($v_date['hours'] << 11) + ($v_date['minutes'] << 5) + $v_date['seconds'] / 2;
3078
+    $v_mdate = (($v_date['year'] - 1980) << 9) + ($v_date['mon'] << 5) + $v_date['mday'];
3079 3079
 
3080 3080
 
3081 3081
     // ----- Packed data
@@ -3119,7 +3119,7 @@  discard block
 block discarded – undo
3119 3119
   // --------------------------------------------------------------------------------
3120 3120
   function privWriteCentralHeader($p_nb_entries, $p_size, $p_offset, $p_comment)
3121 3121
   {
3122
-    $v_result=1;
3122
+    $v_result = 1;
3123 3123
 
3124 3124
     // ----- Packed data
3125 3125
     $v_binary_data = pack("VvvvvVVv", 0x06054b50, 0, 0, $p_nb_entries,
@@ -3148,7 +3148,7 @@  discard block
 block discarded – undo
3148 3148
   // --------------------------------------------------------------------------------
3149 3149
   function privList(&$p_list)
3150 3150
   {
3151
-    $v_result=1;
3151
+    $v_result = 1;
3152 3152
 
3153 3153
     // ----- Magic quotes trick
3154 3154
     $this->privDisableMagicQuotes();
@@ -3188,7 +3188,7 @@  discard block
 block discarded – undo
3188 3188
     }
3189 3189
 
3190 3190
     // ----- Read each entry
3191
-    for ($i=0; $i<$v_central_dir['entries']; $i++)
3191
+    for ($i = 0; $i < $v_central_dir['entries']; $i++)
3192 3192
     {
3193 3193
       // ----- Read the file header
3194 3194
       if (($v_result = $this->privReadCentralFileHeader($v_header)) != 1)
@@ -3235,7 +3235,7 @@  discard block
 block discarded – undo
3235 3235
   // --------------------------------------------------------------------------------
3236 3236
   function privConvertHeader2FileInfo($p_header, &$p_info)
3237 3237
   {
3238
-    $v_result=1;
3238
+    $v_result = 1;
3239 3239
 
3240 3240
     // ----- Get the interesting attributes
3241 3241
     $v_temp_path = PclZipUtilPathReduction($p_header['filename']);
@@ -3246,7 +3246,7 @@  discard block
 block discarded – undo
3246 3246
     $p_info['compressed_size'] = $p_header['compressed_size'];
3247 3247
     $p_info['mtime'] = $p_header['mtime'];
3248 3248
     $p_info['comment'] = $p_header['comment'];
3249
-    $p_info['folder'] = (($p_header['external']&0x00000010)==0x00000010);
3249
+    $p_info['folder'] = (($p_header['external'] & 0x00000010) == 0x00000010);
3250 3250
     $p_info['index'] = $p_header['index'];
3251 3251
     $p_info['status'] = $p_header['status'];
3252 3252
     $p_info['crc'] = $p_header['crc'];
@@ -3274,16 +3274,16 @@  discard block
 block discarded – undo
3274 3274
   // --------------------------------------------------------------------------------
3275 3275
   function privExtractByRule(&$p_file_list, $p_path, $p_remove_path, $p_remove_all_path, &$p_options)
3276 3276
   {
3277
-    $v_result=1;
3277
+    $v_result = 1;
3278 3278
 
3279 3279
     // ----- Magic quotes trick
3280 3280
     $this->privDisableMagicQuotes();
3281 3281
 
3282 3282
     // ----- Check the path
3283
-    if (   ($p_path == "")
3284
-	    || (   (substr($p_path, 0, 1) != "/")
3283
+    if (($p_path == "")
3284
+	    || ((substr($p_path, 0, 1) != "/")
3285 3285
 		    && (substr($p_path, 0, 3) != "../")
3286
-			&& (substr($p_path,1,2)!=":/")))
3286
+			&& (substr($p_path, 1, 2) != ":/")))
3287 3287
       $p_path = "./".$p_path;
3288 3288
 
3289 3289
     // ----- Reduce the path last (and duplicated) '/'
@@ -3292,7 +3292,7 @@  discard block
 block discarded – undo
3292 3292
       // ----- Look for the path end '/'
3293 3293
       while (substr($p_path, -1) == "/")
3294 3294
       {
3295
-        $p_path = substr($p_path, 0, strlen($p_path)-1);
3295
+        $p_path = substr($p_path, 0, strlen($p_path) - 1);
3296 3296
       }
3297 3297
     }
3298 3298
 
@@ -3326,7 +3326,7 @@  discard block
 block discarded – undo
3326 3326
 
3327 3327
     // ----- Read each entry
3328 3328
     $j_start = 0;
3329
-    for ($i=0, $v_nb_extracted=0; $i<$v_central_dir['entries']; $i++)
3329
+    for ($i = 0, $v_nb_extracted = 0; $i < $v_central_dir['entries']; $i++)
3330 3330
     {
3331 3331
 
3332 3332
       // ----- Read next Central dir entry
@@ -3365,17 +3365,17 @@  discard block
 block discarded – undo
3365 3365
       $v_extract = false;
3366 3366
 
3367 3367
       // ----- Look for extract by name rule
3368
-      if (   (isset($p_options[PCLZIP_OPT_BY_NAME]))
3368
+      if ((isset($p_options[PCLZIP_OPT_BY_NAME]))
3369 3369
           && ($p_options[PCLZIP_OPT_BY_NAME] != 0)) {
3370 3370
 
3371 3371
           // ----- Look if the filename is in the list
3372
-          for ($j=0; ($j<sizeof($p_options[PCLZIP_OPT_BY_NAME])) && (!$v_extract); $j++) {
3372
+          for ($j = 0; ($j < sizeof($p_options[PCLZIP_OPT_BY_NAME])) && ( ! $v_extract); $j++) {
3373 3373
 
3374 3374
               // ----- Look for a directory
3375 3375
               if (substr($p_options[PCLZIP_OPT_BY_NAME][$j], -1) == "/") {
3376 3376
 
3377 3377
                   // ----- Look if the directory is in the filename path
3378
-                  if (   (strlen($v_header['stored_filename']) > strlen($p_options[PCLZIP_OPT_BY_NAME][$j]))
3378
+                  if ((strlen($v_header['stored_filename']) > strlen($p_options[PCLZIP_OPT_BY_NAME][$j]))
3379 3379
                       && (substr($v_header['stored_filename'], 0, strlen($p_options[PCLZIP_OPT_BY_NAME][$j])) == $p_options[PCLZIP_OPT_BY_NAME][$j])) {
3380 3380
                       $v_extract = true;
3381 3381
                   }
@@ -3400,7 +3400,7 @@  discard block
 block discarded – undo
3400 3400
       */
3401 3401
 
3402 3402
       // ----- Look for extract by preg rule
3403
-      else if (   (isset($p_options[PCLZIP_OPT_BY_PREG]))
3403
+      else if ((isset($p_options[PCLZIP_OPT_BY_PREG]))
3404 3404
                && ($p_options[PCLZIP_OPT_BY_PREG] != "")) {
3405 3405
 
3406 3406
           if (preg_match($p_options[PCLZIP_OPT_BY_PREG], $v_header['stored_filename'])) {
@@ -3409,20 +3409,20 @@  discard block
 block discarded – undo
3409 3409
       }
3410 3410
 
3411 3411
       // ----- Look for extract by index rule
3412
-      else if (   (isset($p_options[PCLZIP_OPT_BY_INDEX]))
3412
+      else if ((isset($p_options[PCLZIP_OPT_BY_INDEX]))
3413 3413
                && ($p_options[PCLZIP_OPT_BY_INDEX] != 0)) {
3414 3414
           
3415 3415
           // ----- Look if the index is in the list
3416
-          for ($j=$j_start; ($j<sizeof($p_options[PCLZIP_OPT_BY_INDEX])) && (!$v_extract); $j++) {
3416
+          for ($j = $j_start; ($j < sizeof($p_options[PCLZIP_OPT_BY_INDEX])) && ( ! $v_extract); $j++) {
3417 3417
 
3418
-              if (($i>=$p_options[PCLZIP_OPT_BY_INDEX][$j]['start']) && ($i<=$p_options[PCLZIP_OPT_BY_INDEX][$j]['end'])) {
3418
+              if (($i >= $p_options[PCLZIP_OPT_BY_INDEX][$j]['start']) && ($i <= $p_options[PCLZIP_OPT_BY_INDEX][$j]['end'])) {
3419 3419
                   $v_extract = true;
3420 3420
               }
3421
-              if ($i>=$p_options[PCLZIP_OPT_BY_INDEX][$j]['end']) {
3422
-                  $j_start = $j+1;
3421
+              if ($i >= $p_options[PCLZIP_OPT_BY_INDEX][$j]['end']) {
3422
+                  $j_start = $j + 1;
3423 3423
               }
3424 3424
 
3425
-              if ($p_options[PCLZIP_OPT_BY_INDEX][$j]['start']>$i) {
3425
+              if ($p_options[PCLZIP_OPT_BY_INDEX][$j]['start'] > $i) {
3426 3426
                   break;
3427 3427
               }
3428 3428
           }
@@ -3434,14 +3434,14 @@  discard block
 block discarded – undo
3434 3434
       }
3435 3435
 
3436 3436
 	  // ----- Check compression method
3437
-	  if (   ($v_extract)
3438
-	      && (   ($v_header['compression'] != 8)
3437
+	  if (($v_extract)
3438
+	      && (($v_header['compression'] != 8)
3439 3439
 		      && ($v_header['compression'] != 0))) {
3440 3440
           $v_header['status'] = 'unsupported_compression';
3441 3441
 
3442 3442
           // ----- Look for PCLZIP_OPT_STOP_ON_ERROR
3443
-          if (   (isset($p_options[PCLZIP_OPT_STOP_ON_ERROR]))
3444
-		      && ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) {
3443
+          if ((isset($p_options[PCLZIP_OPT_STOP_ON_ERROR]))
3444
+		      && ($p_options[PCLZIP_OPT_STOP_ON_ERROR] === true)) {
3445 3445
 
3446 3446
               $this->privSwapBackMagicQuotes();
3447 3447
               
@@ -3459,8 +3459,8 @@  discard block
 block discarded – undo
3459 3459
           $v_header['status'] = 'unsupported_encryption';
3460 3460
 
3461 3461
           // ----- Look for PCLZIP_OPT_STOP_ON_ERROR
3462
-          if (   (isset($p_options[PCLZIP_OPT_STOP_ON_ERROR]))
3463
-		      && ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) {
3462
+          if ((isset($p_options[PCLZIP_OPT_STOP_ON_ERROR]))
3463
+		      && ($p_options[PCLZIP_OPT_STOP_ON_ERROR] === true)) {
3464 3464
 
3465 3465
               $this->privSwapBackMagicQuotes();
3466 3466
 
@@ -3541,7 +3541,7 @@  discard block
 block discarded – undo
3541 3541
           }
3542 3542
         }
3543 3543
         // ----- Look for extraction in standard output
3544
-        elseif (   (isset($p_options[PCLZIP_OPT_EXTRACT_IN_OUTPUT]))
3544
+        elseif ((isset($p_options[PCLZIP_OPT_EXTRACT_IN_OUTPUT]))
3545 3545
 		        && ($p_options[PCLZIP_OPT_EXTRACT_IN_OUTPUT])) {
3546 3546
           // ----- Extracting the file in standard output
3547 3547
           $v_result1 = $this->privExtractFileInOutput($v_header, $p_options);
@@ -3614,7 +3614,7 @@  discard block
 block discarded – undo
3614 3614
   // --------------------------------------------------------------------------------
3615 3615
   function privExtractFile(&$p_entry, $p_path, $p_remove_path, $p_remove_all_path, &$p_options)
3616 3616
   {
3617
-    $v_result=1;
3617
+    $v_result = 1;
3618 3618
 
3619 3619
     // ----- Read the file header
3620 3620
     if (($v_result = $this->privReadFileHeader($v_header)) != 1)
@@ -3632,7 +3632,7 @@  discard block
 block discarded – undo
3632 3632
     // ----- Look for all path to remove
3633 3633
     if ($p_remove_all_path == true) {
3634 3634
         // ----- Look for folder entry that not need to be extracted
3635
-        if (($p_entry['external']&0x00000010)==0x00000010) {
3635
+        if (($p_entry['external'] & 0x00000010) == 0x00000010) {
3636 3636
 
3637 3637
             $p_entry['status'] = "filtered";
3638 3638
 
@@ -3734,8 +3734,8 @@  discard block
 block discarded – undo
3734 3734
         // ----- Look for PCLZIP_OPT_STOP_ON_ERROR
3735 3735
         // For historical reason first PclZip implementation does not stop
3736 3736
         // when this kind of error occurs.
3737
-        if (   (isset($p_options[PCLZIP_OPT_STOP_ON_ERROR]))
3738
-		    && ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) {
3737
+        if ((isset($p_options[PCLZIP_OPT_STOP_ON_ERROR]))
3738
+		    && ($p_options[PCLZIP_OPT_STOP_ON_ERROR] === true)) {
3739 3739
 
3740 3740
             PclZip::privErrorLog(PCLZIP_ERR_ALREADY_A_DIRECTORY,
3741 3741
 			                     "Filename '".$p_entry['filename']."' is "
@@ -3745,7 +3745,7 @@  discard block
 block discarded – undo
3745 3745
 		    }
3746 3746
       }
3747 3747
       // ----- Look if file is write protected
3748
-      else if (!is_writeable($p_entry['filename']))
3748
+      else if ( ! is_writeable($p_entry['filename']))
3749 3749
       {
3750 3750
 
3751 3751
         // ----- Change the file status
@@ -3754,8 +3754,8 @@  discard block
 block discarded – undo
3754 3754
         // ----- Look for PCLZIP_OPT_STOP_ON_ERROR
3755 3755
         // For historical reason first PclZip implementation does not stop
3756 3756
         // when this kind of error occurs.
3757
-        if (   (isset($p_options[PCLZIP_OPT_STOP_ON_ERROR]))
3758
-		    && ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) {
3757
+        if ((isset($p_options[PCLZIP_OPT_STOP_ON_ERROR]))
3758
+		    && ($p_options[PCLZIP_OPT_STOP_ON_ERROR] === true)) {
3759 3759
 
3760 3760
             PclZip::privErrorLog(PCLZIP_ERR_WRITE_OPEN_FAIL,
3761 3761
 			                     "Filename '".$p_entry['filename']."' exists "
@@ -3769,8 +3769,8 @@  discard block
 block discarded – undo
3769 3769
       else if (filemtime($p_entry['filename']) > $p_entry['mtime'])
3770 3770
       {
3771 3771
         // ----- Change the file status
3772
-        if (   (isset($p_options[PCLZIP_OPT_REPLACE_NEWER]))
3773
-		    && ($p_options[PCLZIP_OPT_REPLACE_NEWER]===true)) {
3772
+        if ((isset($p_options[PCLZIP_OPT_REPLACE_NEWER]))
3773
+		    && ($p_options[PCLZIP_OPT_REPLACE_NEWER] === true)) {
3774 3774
 	  	  }
3775 3775
 		    else {
3776 3776
             $p_entry['status'] = "newer_exist";
@@ -3778,8 +3778,8 @@  discard block
 block discarded – undo
3778 3778
             // ----- Look for PCLZIP_OPT_STOP_ON_ERROR
3779 3779
             // For historical reason first PclZip implementation does not stop
3780 3780
             // when this kind of error occurs.
3781
-            if (   (isset($p_options[PCLZIP_OPT_STOP_ON_ERROR]))
3782
-		        && ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) {
3781
+            if ((isset($p_options[PCLZIP_OPT_STOP_ON_ERROR]))
3782
+		        && ($p_options[PCLZIP_OPT_STOP_ON_ERROR] === true)) {
3783 3783
 
3784 3784
                 PclZip::privErrorLog(PCLZIP_ERR_WRITE_OPEN_FAIL,
3785 3785
 			             "Newer version of '".$p_entry['filename']."' exists "
@@ -3795,14 +3795,14 @@  discard block
 block discarded – undo
3795 3795
 
3796 3796
     // ----- Check the directory availability and create it if necessary
3797 3797
     else {
3798
-      if ((($p_entry['external']&0x00000010)==0x00000010) || (substr($p_entry['filename'], -1) == '/'))
3798
+      if ((($p_entry['external'] & 0x00000010) == 0x00000010) || (substr($p_entry['filename'], -1) == '/'))
3799 3799
         $v_dir_to_check = $p_entry['filename'];
3800
-      else if (!strstr($p_entry['filename'], "/"))
3800
+      else if ( ! strstr($p_entry['filename'], "/"))
3801 3801
         $v_dir_to_check = "";
3802 3802
       else
3803 3803
         $v_dir_to_check = dirname($p_entry['filename']);
3804 3804
 
3805
-        if (($v_result = $this->privDirCheck($v_dir_to_check, (($p_entry['external']&0x00000010)==0x00000010))) != 1) {
3805
+        if (($v_result = $this->privDirCheck($v_dir_to_check, (($p_entry['external'] & 0x00000010) == 0x00000010))) != 1) {
3806 3806
   
3807 3807
           // ----- Change the file status
3808 3808
           $p_entry['status'] = "path_creation_fail";
@@ -3818,7 +3818,7 @@  discard block
 block discarded – undo
3818 3818
     if ($p_entry['status'] == 'ok') {
3819 3819
 
3820 3820
       // ----- Do the extraction (if not a folder)
3821
-      if (!(($p_entry['external']&0x00000010)==0x00000010))
3821
+      if ( ! (($p_entry['external'] & 0x00000010) == 0x00000010))
3822 3822
       {
3823 3823
         // ----- Look for not compressed file
3824 3824
         if ($p_entry['compression'] == 0) {
@@ -3867,10 +3867,10 @@  discard block
 block discarded – undo
3867 3867
 
3868 3868
 
3869 3869
           // ----- Look for using temporary file to unzip
3870
-          if ( (!isset($p_options[PCLZIP_OPT_TEMP_FILE_OFF])) 
3870
+          if (( ! isset($p_options[PCLZIP_OPT_TEMP_FILE_OFF])) 
3871 3871
               && (isset($p_options[PCLZIP_OPT_TEMP_FILE_ON])
3872 3872
                   || (isset($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD])
3873
-                      && ($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD] <= $p_entry['size'])) ) ) {
3873
+                      && ($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD] <= $p_entry['size'])))) {
3874 3874
             $v_result = $this->privExtractFileUsingTempFile($p_entry, $p_options);
3875 3875
             if ($v_result < PCLZIP_ERR_NO_ERROR) {
3876 3876
               return $v_result;
@@ -3965,7 +3965,7 @@  discard block
 block discarded – undo
3965 3965
   // --------------------------------------------------------------------------------
3966 3966
   function privExtractFileUsingTempFile(&$p_entry, &$p_options)
3967 3967
   {
3968
-    $v_result=1;
3968
+    $v_result = 1;
3969 3969
         
3970 3970
     // ----- Creates a temporary file
3971 3971
     $v_gzip_temp_name = PCLZIP_TEMPORARY_DIR.uniqid('pclzip-').'.gz';
@@ -4041,7 +4041,7 @@  discard block
 block discarded – undo
4041 4041
   // --------------------------------------------------------------------------------
4042 4042
   function privExtractFileInOutput(&$p_entry, &$p_options)
4043 4043
   {
4044
-    $v_result=1;
4044
+    $v_result = 1;
4045 4045
 
4046 4046
     // ----- Read the file header
4047 4047
     if (($v_result = $this->privReadFileHeader($v_header)) != 1) {
@@ -4090,7 +4090,7 @@  discard block
 block discarded – undo
4090 4090
     if ($p_entry['status'] == 'ok') {
4091 4091
 
4092 4092
       // ----- Do the extraction (if not a folder)
4093
-      if (!(($p_entry['external']&0x00000010)==0x00000010)) {
4093
+      if ( ! (($p_entry['external'] & 0x00000010) == 0x00000010)) {
4094 4094
         // ----- Look for not compressed file
4095 4095
         if ($p_entry['compressed_size'] == $p_entry['size']) {
4096 4096
 
@@ -4153,7 +4153,7 @@  discard block
 block discarded – undo
4153 4153
   // --------------------------------------------------------------------------------
4154 4154
   function privExtractFileAsString(&$p_entry, &$p_string, &$p_options)
4155 4155
   {
4156
-    $v_result=1;
4156
+    $v_result = 1;
4157 4157
 
4158 4158
     // ----- Read the file header
4159 4159
     $v_header = array();
@@ -4204,7 +4204,7 @@  discard block
 block discarded – undo
4204 4204
     if ($p_entry['status'] == 'ok') {
4205 4205
 
4206 4206
       // ----- Do the extraction (if not a folder)
4207
-      if (!(($p_entry['external']&0x00000010)==0x00000010)) {
4207
+      if ( ! (($p_entry['external'] & 0x00000010) == 0x00000010)) {
4208 4208
         // ----- Look for not compressed file
4209 4209
   //      if ($p_entry['compressed_size'] == $p_entry['size'])
4210 4210
         if ($p_entry['compression'] == 0) {
@@ -4276,7 +4276,7 @@  discard block
 block discarded – undo
4276 4276
   // --------------------------------------------------------------------------------
4277 4277
   function privReadFileHeader(&$p_header)
4278 4278
   {
4279
-    $v_result=1;
4279
+    $v_result = 1;
4280 4280
 
4281 4281
     // ----- Read the 4 bytes signature
4282 4282
     $v_binary_data = @fread($this->zip_fd, 4);
@@ -4340,7 +4340,7 @@  discard block
 block discarded – undo
4340 4340
       // ----- Extract time
4341 4341
       $v_hour = ($p_header['mtime'] & 0xF800) >> 11;
4342 4342
       $v_minute = ($p_header['mtime'] & 0x07E0) >> 5;
4343
-      $v_seconde = ($p_header['mtime'] & 0x001F)*2;
4343
+      $v_seconde = ($p_header['mtime'] & 0x001F) * 2;
4344 4344
 
4345 4345
       // ----- Extract date
4346 4346
       $v_year = (($p_header['mdate'] & 0xFE00) >> 9) + 1980;
@@ -4379,7 +4379,7 @@  discard block
 block discarded – undo
4379 4379
   // --------------------------------------------------------------------------------
4380 4380
   function privReadCentralFileHeader(&$p_header)
4381 4381
   {
4382
-    $v_result=1;
4382
+    $v_result = 1;
4383 4383
 
4384 4384
     // ----- Read the 4 bytes signature
4385 4385
     $v_binary_data = @fread($this->zip_fd, 4);
@@ -4443,7 +4443,7 @@  discard block
 block discarded – undo
4443 4443
       // ----- Extract time
4444 4444
       $v_hour = ($p_header['mtime'] & 0xF800) >> 11;
4445 4445
       $v_minute = ($p_header['mtime'] & 0x07E0) >> 5;
4446
-      $v_seconde = ($p_header['mtime'] & 0x001F)*2;
4446
+      $v_seconde = ($p_header['mtime'] & 0x001F) * 2;
4447 4447
 
4448 4448
       // ----- Extract date
4449 4449
       $v_year = (($p_header['mdate'] & 0xFE00) >> 9) + 1980;
@@ -4487,7 +4487,7 @@  discard block
 block discarded – undo
4487 4487
   // --------------------------------------------------------------------------------
4488 4488
   function privCheckFileHeaders(&$p_local_header, &$p_central_header)
4489 4489
   {
4490
-    $v_result=1;
4490
+    $v_result = 1;
4491 4491
 
4492 4492
   	// ----- Check the static values
4493 4493
   	// TBC
@@ -4524,7 +4524,7 @@  discard block
 block discarded – undo
4524 4524
   // --------------------------------------------------------------------------------
4525 4525
   function privReadEndCentralDir(&$p_central_dir)
4526 4526
   {
4527
-    $v_result=1;
4527
+    $v_result = 1;
4528 4528
 
4529 4529
     // ----- Go to the end of the zip file
4530 4530
     $v_size = filesize($this->zipname);
@@ -4542,8 +4542,8 @@  discard block
 block discarded – undo
4542 4542
     // in this case the end of central dir is at 22 bytes of the file end
4543 4543
     $v_found = 0;
4544 4544
     if ($v_size > 26) {
4545
-      @fseek($this->zip_fd, $v_size-22);
4546
-      if (($v_pos = @ftell($this->zip_fd)) != ($v_size-22))
4545
+      @fseek($this->zip_fd, $v_size - 22);
4546
+      if (($v_pos = @ftell($this->zip_fd)) != ($v_size - 22))
4547 4547
       {
4548 4548
         // ----- Error log
4549 4549
         PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'Unable to seek back to the middle of the archive \''.$this->zipname.'\'');
@@ -4565,12 +4565,12 @@  discard block
 block discarded – undo
4565 4565
     }
4566 4566
 
4567 4567
     // ----- Go back to the maximum possible size of the Central Dir End Record
4568
-    if (!$v_found) {
4568
+    if ( ! $v_found) {
4569 4569
       $v_maximum_size = 65557; // 0xFFFF + 22;
4570 4570
       if ($v_maximum_size > $v_size)
4571 4571
         $v_maximum_size = $v_size;
4572
-      @fseek($this->zip_fd, $v_size-$v_maximum_size);
4573
-      if (@ftell($this->zip_fd) != ($v_size-$v_maximum_size))
4572
+      @fseek($this->zip_fd, $v_size - $v_maximum_size);
4573
+      if (@ftell($this->zip_fd) != ($v_size - $v_maximum_size))
4574 4574
       {
4575 4575
         // ----- Error log
4576 4576
         PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'Unable to seek back to the middle of the archive \''.$this->zipname.'\'');
@@ -4591,7 +4591,7 @@  discard block
 block discarded – undo
4591 4591
         //$v_bytes = ($v_bytes << 8) | Ord($v_byte);
4592 4592
         // Note we mask the old value down such that once shifted we can never end up with more than a 32bit number 
4593 4593
         // Otherwise on systems where we have 64bit integers the check below for the magic number will fail. 
4594
-        $v_bytes = ( ($v_bytes & 0xFFFFFF) << 8) | Ord($v_byte); 
4594
+        $v_bytes = (($v_bytes & 0xFFFFFF) << 8) | Ord($v_byte); 
4595 4595
 
4596 4596
         // ----- Compare the bytes
4597 4597
         if ($v_bytes == 0x504b0506)
@@ -4681,11 +4681,11 @@  discard block
 block discarded – undo
4681 4681
   // --------------------------------------------------------------------------------
4682 4682
   function privDeleteByRule(&$p_result_list, &$p_options)
4683 4683
   {
4684
-    $v_result=1;
4684
+    $v_result = 1;
4685 4685
     $v_list_detail = array();
4686 4686
 
4687 4687
     // ----- Open the zip file
4688
-    if (($v_result=$this->privOpenFd('rb')) != 1)
4688
+    if (($v_result = $this->privOpenFd('rb')) != 1)
4689 4689
     {
4690 4690
       // ----- Return
4691 4691
       return $v_result;
@@ -4721,7 +4721,7 @@  discard block
 block discarded – undo
4721 4721
     // ----- Read each entry
4722 4722
     $v_header_list = array();
4723 4723
     $j_start = 0;
4724
-    for ($i=0, $v_nb_extracted=0; $i<$v_central_dir['entries']; $i++)
4724
+    for ($i = 0, $v_nb_extracted = 0; $i < $v_central_dir['entries']; $i++)
4725 4725
     {
4726 4726
 
4727 4727
       // ----- Read the file header
@@ -4742,21 +4742,21 @@  discard block
 block discarded – undo
4742 4742
       $v_found = false;
4743 4743
 
4744 4744
       // ----- Look for extract by name rule
4745
-      if (   (isset($p_options[PCLZIP_OPT_BY_NAME]))
4745
+      if ((isset($p_options[PCLZIP_OPT_BY_NAME]))
4746 4746
           && ($p_options[PCLZIP_OPT_BY_NAME] != 0)) {
4747 4747
 
4748 4748
           // ----- Look if the filename is in the list
4749
-          for ($j=0; ($j<sizeof($p_options[PCLZIP_OPT_BY_NAME])) && (!$v_found); $j++) {
4749
+          for ($j = 0; ($j < sizeof($p_options[PCLZIP_OPT_BY_NAME])) && ( ! $v_found); $j++) {
4750 4750
 
4751 4751
               // ----- Look for a directory
4752 4752
               if (substr($p_options[PCLZIP_OPT_BY_NAME][$j], -1) == "/") {
4753 4753
 
4754 4754
                   // ----- Look if the directory is in the filename path
4755
-                  if (   (strlen($v_header_list[$v_nb_extracted]['stored_filename']) > strlen($p_options[PCLZIP_OPT_BY_NAME][$j]))
4755
+                  if ((strlen($v_header_list[$v_nb_extracted]['stored_filename']) > strlen($p_options[PCLZIP_OPT_BY_NAME][$j]))
4756 4756
                       && (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])) {
4757 4757
                       $v_found = true;
4758 4758
                   }
4759
-                  elseif (   (($v_header_list[$v_nb_extracted]['external']&0x00000010)==0x00000010) /* Indicates a folder */
4759
+                  elseif ((($v_header_list[$v_nb_extracted]['external'] & 0x00000010) == 0x00000010) /* Indicates a folder */
4760 4760
                           && ($v_header_list[$v_nb_extracted]['stored_filename'].'/' == $p_options[PCLZIP_OPT_BY_NAME][$j])) {
4761 4761
                       $v_found = true;
4762 4762
                   }
@@ -4781,7 +4781,7 @@  discard block
 block discarded – undo
4781 4781
       */
4782 4782
 
4783 4783
       // ----- Look for extract by preg rule
4784
-      else if (   (isset($p_options[PCLZIP_OPT_BY_PREG]))
4784
+      else if ((isset($p_options[PCLZIP_OPT_BY_PREG]))
4785 4785
                && ($p_options[PCLZIP_OPT_BY_PREG] != "")) {
4786 4786
 
4787 4787
           if (preg_match($p_options[PCLZIP_OPT_BY_PREG], $v_header_list[$v_nb_extracted]['stored_filename'])) {
@@ -4790,20 +4790,20 @@  discard block
 block discarded – undo
4790 4790
       }
4791 4791
 
4792 4792
       // ----- Look for extract by index rule
4793
-      else if (   (isset($p_options[PCLZIP_OPT_BY_INDEX]))
4793
+      else if ((isset($p_options[PCLZIP_OPT_BY_INDEX]))
4794 4794
                && ($p_options[PCLZIP_OPT_BY_INDEX] != 0)) {
4795 4795
 
4796 4796
           // ----- Look if the index is in the list
4797
-          for ($j=$j_start; ($j<sizeof($p_options[PCLZIP_OPT_BY_INDEX])) && (!$v_found); $j++) {
4797
+          for ($j = $j_start; ($j < sizeof($p_options[PCLZIP_OPT_BY_INDEX])) && ( ! $v_found); $j++) {
4798 4798
 
4799
-              if (($i>=$p_options[PCLZIP_OPT_BY_INDEX][$j]['start']) && ($i<=$p_options[PCLZIP_OPT_BY_INDEX][$j]['end'])) {
4799
+              if (($i >= $p_options[PCLZIP_OPT_BY_INDEX][$j]['start']) && ($i <= $p_options[PCLZIP_OPT_BY_INDEX][$j]['end'])) {
4800 4800
                   $v_found = true;
4801 4801
               }
4802
-              if ($i>=$p_options[PCLZIP_OPT_BY_INDEX][$j]['end']) {
4803
-                  $j_start = $j+1;
4802
+              if ($i >= $p_options[PCLZIP_OPT_BY_INDEX][$j]['end']) {
4803
+                  $j_start = $j + 1;
4804 4804
               }
4805 4805
 
4806
-              if ($p_options[PCLZIP_OPT_BY_INDEX][$j]['start']>$i) {
4806
+              if ($p_options[PCLZIP_OPT_BY_INDEX][$j]['start'] > $i) {
4807 4807
                   break;
4808 4808
               }
4809 4809
           }
@@ -4841,11 +4841,11 @@  discard block
 block discarded – undo
4841 4841
         }
4842 4842
 
4843 4843
         // ----- Look which file need to be kept
4844
-        for ($i=0; $i<sizeof($v_header_list); $i++) {
4844
+        for ($i = 0; $i < sizeof($v_header_list); $i++) {
4845 4845
 
4846 4846
             // ----- Calculate the position of the header
4847 4847
             @rewind($this->zip_fd);
4848
-            if (@fseek($this->zip_fd,  $v_header_list[$i]['offset'])) {
4848
+            if (@fseek($this->zip_fd, $v_header_list[$i]['offset'])) {
4849 4849
                 // ----- Close the zip file
4850 4850
                 $this->privCloseFd();
4851 4851
                 $v_temp_zip->privCloseFd();
@@ -4904,7 +4904,7 @@  discard block
 block discarded – undo
4904 4904
         $v_offset = @ftell($v_temp_zip->zip_fd);
4905 4905
 
4906 4906
         // ----- Re-Create the Central Dir files header
4907
-        for ($i=0; $i<sizeof($v_header_list); $i++) {
4907
+        for ($i = 0; $i < sizeof($v_header_list); $i++) {
4908 4908
             // ----- Create the file header
4909 4909
             if (($v_result = $v_temp_zip->privWriteCentralFileHeader($v_header_list[$i])) != 1) {
4910 4910
                 $v_temp_zip->privCloseFd();
@@ -4927,7 +4927,7 @@  discard block
 block discarded – undo
4927 4927
         }
4928 4928
 
4929 4929
         // ----- Calculate the size of the central header
4930
-        $v_size = @ftell($v_temp_zip->zip_fd)-$v_offset;
4930
+        $v_size = @ftell($v_temp_zip->zip_fd) - $v_offset;
4931 4931
 
4932 4932
         // ----- Create the central dir footer
4933 4933
         if (($v_result = $v_temp_zip->privWriteCentralHeader(sizeof($v_header_list), $v_size, $v_offset, $v_comment)) != 1) {
@@ -4989,15 +4989,15 @@  discard block
 block discarded – undo
4989 4989
   //    1 : OK
4990 4990
   //   -1 : Unable to create directory
4991 4991
   // --------------------------------------------------------------------------------
4992
-  function privDirCheck($p_dir, $p_is_dir=false)
4992
+  function privDirCheck($p_dir, $p_is_dir = false)
4993 4993
   {
4994 4994
     $v_result = 1;
4995 4995
 
4996 4996
 
4997 4997
     // ----- Remove the final '/'
4998
-    if (($p_is_dir) && (substr($p_dir, -1)=='/'))
4998
+    if (($p_is_dir) && (substr($p_dir, -1) == '/'))
4999 4999
     {
5000
-      $p_dir = substr($p_dir, 0, strlen($p_dir)-1);
5000
+      $p_dir = substr($p_dir, 0, strlen($p_dir) - 1);
5001 5001
     }
5002 5002
 
5003 5003
     // ----- Check the directory availability
@@ -5023,7 +5023,7 @@  discard block
 block discarded – undo
5023 5023
     }
5024 5024
 
5025 5025
     // ----- Create the directory
5026
-    if (!@mkdir($p_dir, 0777))
5026
+    if ( ! @mkdir($p_dir, 0777))
5027 5027
     {
5028 5028
       // ----- Error log
5029 5029
       PclZip::privErrorLog(PCLZIP_ERR_DIR_CREATE_FAIL, "Unable to create directory '$p_dir'");
@@ -5046,10 +5046,10 @@  discard block
 block discarded – undo
5046 5046
   // --------------------------------------------------------------------------------
5047 5047
   function privMerge(&$p_archive_to_add)
5048 5048
   {
5049
-    $v_result=1;
5049
+    $v_result = 1;
5050 5050
 
5051 5051
     // ----- Look if the archive_to_add exists
5052
-    if (!is_file($p_archive_to_add->zipname))
5052
+    if ( ! is_file($p_archive_to_add->zipname))
5053 5053
     {
5054 5054
 
5055 5055
       // ----- Nothing to merge, so merge is a success
@@ -5060,7 +5060,7 @@  discard block
 block discarded – undo
5060 5060
     }
5061 5061
 
5062 5062
     // ----- Look if the archive exists
5063
-    if (!is_file($this->zipname))
5063
+    if ( ! is_file($this->zipname))
5064 5064
     {
5065 5065
 
5066 5066
       // ----- Do a duplicate
@@ -5071,7 +5071,7 @@  discard block
 block discarded – undo
5071 5071
     }
5072 5072
 
5073 5073
     // ----- Open the zip file
5074
-    if (($v_result=$this->privOpenFd('rb')) != 1)
5074
+    if (($v_result = $this->privOpenFd('rb')) != 1)
5075 5075
     {
5076 5076
       // ----- Return
5077 5077
       return $v_result;
@@ -5089,7 +5089,7 @@  discard block
 block discarded – undo
5089 5089
     @rewind($this->zip_fd);
5090 5090
 
5091 5091
     // ----- Open the archive_to_add file
5092
-    if (($v_result=$p_archive_to_add->privOpenFd('rb')) != 1)
5092
+    if (($v_result = $p_archive_to_add->privOpenFd('rb')) != 1)
5093 5093
     {
5094 5094
       $this->privCloseFd();
5095 5095
 
@@ -5173,7 +5173,7 @@  discard block
 block discarded – undo
5173 5173
     $v_comment = $v_central_dir['comment'].' '.$v_central_dir_to_add['comment'];
5174 5174
 
5175 5175
     // ----- Calculate the size of the (new) central header
5176
-    $v_size = @ftell($v_zip_temp_fd)-$v_offset;
5176
+    $v_size = @ftell($v_zip_temp_fd) - $v_offset;
5177 5177
 
5178 5178
     // ----- Swap the file descriptor
5179 5179
     // Here is a trick : I swap the temporary fd with the zip fd, in order to use
@@ -5183,7 +5183,7 @@  discard block
 block discarded – undo
5183 5183
     $v_zip_temp_fd = $v_swap;
5184 5184
 
5185 5185
     // ----- Create the central dir footer
5186
-    if (($v_result = $this->privWriteCentralHeader($v_central_dir['entries']+$v_central_dir_to_add['entries'], $v_size, $v_offset, $v_comment)) != 1)
5186
+    if (($v_result = $this->privWriteCentralHeader($v_central_dir['entries'] + $v_central_dir_to_add['entries'], $v_size, $v_offset, $v_comment)) != 1)
5187 5187
     {
5188 5188
       $this->privCloseFd();
5189 5189
       $p_archive_to_add->privCloseFd();
@@ -5231,10 +5231,10 @@  discard block
 block discarded – undo
5231 5231
   // --------------------------------------------------------------------------------
5232 5232
   function privDuplicate($p_archive_filename)
5233 5233
   {
5234
-    $v_result=1;
5234
+    $v_result = 1;
5235 5235
 
5236 5236
     // ----- Look if the $p_archive_filename exists
5237
-    if (!is_file($p_archive_filename))
5237
+    if ( ! is_file($p_archive_filename))
5238 5238
     {
5239 5239
 
5240 5240
       // ----- Nothing to duplicate, so duplicate is a success.
@@ -5245,7 +5245,7 @@  discard block
 block discarded – undo
5245 5245
     }
5246 5246
 
5247 5247
     // ----- Open the zip file
5248
-    if (($v_result=$this->privOpenFd('wb')) != 1)
5248
+    if (($v_result = $this->privOpenFd('wb')) != 1)
5249 5249
     {
5250 5250
       // ----- Return
5251 5251
       return $v_result;
@@ -5289,7 +5289,7 @@  discard block
 block discarded – undo
5289 5289
   // Description :
5290 5290
   // Parameters :
5291 5291
   // --------------------------------------------------------------------------------
5292
-  function privErrorLog($p_error_code=0, $p_error_string='')
5292
+  function privErrorLog($p_error_code = 0, $p_error_string = '')
5293 5293
   {
5294 5294
     if (PCLZIP_ERROR_EXTERNAL == 1) {
5295 5295
       PclError($p_error_code, $p_error_string);
@@ -5326,11 +5326,11 @@  discard block
 block discarded – undo
5326 5326
   // --------------------------------------------------------------------------------
5327 5327
   function privDisableMagicQuotes()
5328 5328
   {
5329
-    $v_result=1;
5329
+    $v_result = 1;
5330 5330
 
5331 5331
     // ----- Look if function exists
5332
-    if (   (!function_exists("get_magic_quotes_runtime"))
5333
-	    || (!function_exists("set_magic_quotes_runtime"))) {
5332
+    if (( ! function_exists("get_magic_quotes_runtime"))
5333
+	    || ( ! function_exists("set_magic_quotes_runtime"))) {
5334 5334
       return $v_result;
5335 5335
 	}
5336 5336
 
@@ -5360,11 +5360,11 @@  discard block
 block discarded – undo
5360 5360
   // --------------------------------------------------------------------------------
5361 5361
   function privSwapBackMagicQuotes()
5362 5362
   {
5363
-    $v_result=1;
5363
+    $v_result = 1;
5364 5364
 
5365 5365
     // ----- Look if function exists
5366
-    if (   (!function_exists("get_magic_quotes_runtime"))
5367
-	    || (!function_exists("set_magic_quotes_runtime"))) {
5366
+    if (( ! function_exists("get_magic_quotes_runtime"))
5367
+	    || ( ! function_exists("set_magic_quotes_runtime"))) {
5368 5368
       return $v_result;
5369 5369
 	}
5370 5370
 
@@ -5404,7 +5404,7 @@  discard block
 block discarded – undo
5404 5404
 
5405 5405
       // ----- Study directories from last to first
5406 5406
       $v_skip = 0;
5407
-      for ($i=sizeof($v_list)-1; $i>=0; $i--) {
5407
+      for ($i = sizeof($v_list) - 1; $i >= 0; $i--) {
5408 5408
         // ----- Look for current path
5409 5409
         if ($v_list[$i] == ".") {
5410 5410
           // ----- Ignore this directory
@@ -5425,7 +5425,7 @@  discard block
 block discarded – undo
5425 5425
 		    }
5426 5426
 		  }
5427 5427
 		  // ----- Last '/' i.e. indicates a directory
5428
-		  else if ($i == (sizeof($v_list)-1)) {
5428
+		  else if ($i == (sizeof($v_list) - 1)) {
5429 5429
             $v_result = $v_list[$i];
5430 5430
 		  }
5431 5431
 		  // ----- Double '/' inside the path
@@ -5440,7 +5440,7 @@  discard block
 block discarded – undo
5440 5440
 		    $v_skip--;
5441 5441
 		  }
5442 5442
 		  else {
5443
-            $v_result = $v_list[$i].($i!=(sizeof($v_list)-1)?"/".$v_result:"");
5443
+            $v_result = $v_list[$i].($i != (sizeof($v_list) - 1) ? "/".$v_result : "");
5444 5444
 		  }
5445 5445
         }
5446 5446
       }
@@ -5479,12 +5479,12 @@  discard block
 block discarded – undo
5479 5479
     $v_result = 1;
5480 5480
     
5481 5481
     // ----- Look for path beginning by ./
5482
-    if (   ($p_dir == '.')
5483
-        || ((strlen($p_dir) >=2) && (substr($p_dir, 0, 2) == './'))) {
5482
+    if (($p_dir == '.')
5483
+        || ((strlen($p_dir) >= 2) && (substr($p_dir, 0, 2) == './'))) {
5484 5484
       $p_dir = PclZipUtilTranslateWinPath(getcwd(), FALSE).'/'.substr($p_dir, 1);
5485 5485
     }
5486
-    if (   ($p_path == '.')
5487
-        || ((strlen($p_path) >=2) && (substr($p_path, 0, 2) == './'))) {
5486
+    if (($p_path == '.')
5487
+        || ((strlen($p_path) >= 2) && (substr($p_path, 0, 2) == './'))) {
5488 5488
       $p_path = PclZipUtilTranslateWinPath(getcwd(), FALSE).'/'.substr($p_path, 1);
5489 5489
     }
5490 5490
 
@@ -5510,7 +5510,7 @@  discard block
 block discarded – undo
5510 5510
       }
5511 5511
 
5512 5512
       // ----- Compare the items
5513
-      if (($v_list_dir[$i] != $v_list_path[$j]) && ($v_list_dir[$i] != '') && ( $v_list_path[$j] != ''))  {
5513
+      if (($v_list_dir[$i] != $v_list_path[$j]) && ($v_list_dir[$i] != '') && ($v_list_path[$j] != '')) {
5514 5514
         $v_result = 0;
5515 5515
       }
5516 5516
 
@@ -5551,11 +5551,11 @@  discard block
 block discarded – undo
5551 5551
   //             3 : src & dest gzip
5552 5552
   // Return Values :
5553 5553
   // --------------------------------------------------------------------------------
5554
-  function PclZipUtilCopyBlock($p_src, $p_dest, $p_size, $p_mode=0)
5554
+  function PclZipUtilCopyBlock($p_src, $p_dest, $p_size, $p_mode = 0)
5555 5555
   {
5556 5556
     $v_result = 1;
5557 5557
 
5558
-    if ($p_mode==0)
5558
+    if ($p_mode == 0)
5559 5559
     {
5560 5560
       while ($p_size != 0)
5561 5561
       {
@@ -5565,7 +5565,7 @@  discard block
 block discarded – undo
5565 5565
         $p_size -= $v_read_size;
5566 5566
       }
5567 5567
     }
5568
-    else if ($p_mode==1)
5568
+    else if ($p_mode == 1)
5569 5569
     {
5570 5570
       while ($p_size != 0)
5571 5571
       {
@@ -5575,7 +5575,7 @@  discard block
 block discarded – undo
5575 5575
         $p_size -= $v_read_size;
5576 5576
       }
5577 5577
     }
5578
-    else if ($p_mode==2)
5578
+    else if ($p_mode == 2)
5579 5579
     {
5580 5580
       while ($p_size != 0)
5581 5581
       {
@@ -5585,7 +5585,7 @@  discard block
 block discarded – undo
5585 5585
         $p_size -= $v_read_size;
5586 5586
       }
5587 5587
     }
5588
-    else if ($p_mode==3)
5588
+    else if ($p_mode == 3)
5589 5589
     {
5590 5590
       while ($p_size != 0)
5591 5591
       {
@@ -5618,13 +5618,13 @@  discard block
 block discarded – undo
5618 5618
     $v_result = 1;
5619 5619
 
5620 5620
     // ----- Try to rename the files
5621
-    if (!@rename($p_src, $p_dest)) {
5621
+    if ( ! @rename($p_src, $p_dest)) {
5622 5622
 
5623 5623
       // ----- Try to copy & unlink the src
5624
-      if (!@copy($p_src, $p_dest)) {
5624
+      if ( ! @copy($p_src, $p_dest)) {
5625 5625
         $v_result = 0;
5626 5626
       }
5627
-      else if (!@unlink($p_src)) {
5627
+      else if ( ! @unlink($p_src)) {
5628 5628
         $v_result = 0;
5629 5629
       }
5630 5630
     }
@@ -5649,7 +5649,7 @@  discard block
 block discarded – undo
5649 5649
     $v_list = get_defined_constants();
5650 5650
     for (reset($v_list); $v_key = key($v_list); next($v_list)) {
5651 5651
 	    $v_prefix = substr($v_key, 0, 10);
5652
-	    if ((   ($v_prefix == 'PCLZIP_OPT')
5652
+	    if ((($v_prefix == 'PCLZIP_OPT')
5653 5653
            || ($v_prefix == 'PCLZIP_CB_')
5654 5654
            || ($v_prefix == 'PCLZIP_ATT'))
5655 5655
 	        && ($v_list[$v_key] == $p_option)) {
@@ -5674,15 +5674,15 @@  discard block
 block discarded – undo
5674 5674
   // Return Values :
5675 5675
   //   The path translated.
5676 5676
   // --------------------------------------------------------------------------------
5677
-  function PclZipUtilTranslateWinPath($p_path, $p_remove_disk_letter=true)
5677
+  function PclZipUtilTranslateWinPath($p_path, $p_remove_disk_letter = true)
5678 5678
   {
5679 5679
     if (stristr(php_uname(), 'windows')) {
5680 5680
       // ----- Look for potential disk letter
5681 5681
       if (($p_remove_disk_letter) && (($v_position = strpos($p_path, ':')) != false)) {
5682
-          $p_path = substr($p_path, $v_position+1);
5682
+          $p_path = substr($p_path, $v_position + 1);
5683 5683
       }
5684 5684
       // ----- Change potential windows directory separator
5685
-      if ((strpos($p_path, '\\') > 0) || (substr($p_path, 0,1) == '\\')) {
5685
+      if ((strpos($p_path, '\\') > 0) || (substr($p_path, 0, 1) == '\\')) {
5686 5686
           $p_path = strtr($p_path, '\\', '/');
5687 5687
       }
5688 5688
     }
Please login to merge, or discard this patch.
Braces   +115 added lines, -158 removed lines patch added patch discarded remove patch
@@ -324,8 +324,7 @@  discard block
 block discarded – undo
324 324
         // ----- Look for the optional second argument
325 325
         if ($v_size == 2) {
326 326
           $v_options[PCLZIP_OPT_REMOVE_PATH] = $v_arg_list[1];
327
-        }
328
-        else if ($v_size > 2) {
327
+        } else if ($v_size > 2) {
329 328
           PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER,
330 329
 		                       "Invalid number / type of arguments");
331 330
           return 0;
@@ -374,8 +373,7 @@  discard block
 block discarded – undo
374 373
       foreach ($v_string_list as $v_string) {
375 374
         if ($v_string != '') {
376 375
           $v_att_list[][PCLZIP_ATT_FILE_NAME] = $v_string;
377
-        }
378
-        else {
376
+        } else {
379 377
         }
380 378
       }
381 379
     }
@@ -509,8 +507,7 @@  discard block
 block discarded – undo
509 507
         // ----- Look for the optional second argument
510 508
         if ($v_size == 2) {
511 509
           $v_options[PCLZIP_OPT_REMOVE_PATH] = $v_arg_list[1];
512
-        }
513
-        else if ($v_size > 2) {
510
+        } else if ($v_size > 2) {
514 511
           // ----- Error log
515 512
           PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid number / type of arguments");
516 513
 
@@ -786,8 +783,7 @@  discard block
 block discarded – undo
786 783
         // ----- Look for the optional second argument
787 784
         if ($v_size == 2) {
788 785
           $v_remove_path = $v_arg_list[1];
789
-        }
790
-        else if ($v_size > 2) {
786
+        } else if ($v_size > 2) {
791 787
           // ----- Error log
792 788
           PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid number / type of arguments");
793 789
 
@@ -931,8 +927,7 @@  discard block
 block discarded – undo
931 927
         }
932 928
         if (!isset($v_options[PCLZIP_OPT_EXTRACT_AS_STRING])) {
933 929
           $v_options[PCLZIP_OPT_EXTRACT_AS_STRING] = FALSE;
934
-        }
935
-        else {
930
+        } else {
936 931
         }
937 932
       }
938 933
 
@@ -947,8 +942,7 @@  discard block
 block discarded – undo
947 942
         // ----- Look for the optional second argument
948 943
         if ($v_size == 2) {
949 944
           $v_remove_path = $v_arg_list[1];
950
-        }
951
-        else if ($v_size > 2) {
945
+        } else if ($v_size > 2) {
952 946
           // ----- Error log
953 947
           PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid number / type of arguments");
954 948
 
@@ -1184,8 +1178,7 @@  discard block
 block discarded – undo
1184 1178
         // ----- Error log
1185 1179
         PclZip::privErrorLog(PCLZIP_ERR_MISSING_FILE, "No file with filename '".$p_archive."'");
1186 1180
         $v_result = PCLZIP_ERR_MISSING_FILE;
1187
-      }
1188
-      else {
1181
+      } else {
1189 1182
         // ----- Duplicate the archive
1190 1183
         $v_result = $this->privDuplicate($p_archive);
1191 1184
       }
@@ -1273,8 +1266,7 @@  discard block
 block discarded – undo
1273 1266
   {
1274 1267
     if (PCLZIP_ERROR_EXTERNAL == 1) {
1275 1268
       return(PclErrorCode());
1276
-    }
1277
-    else {
1269
+    } else {
1278 1270
       return($this->error_code);
1279 1271
     }
1280 1272
   }
@@ -1312,15 +1304,13 @@  discard block
 block discarded – undo
1312 1304
 
1313 1305
     if (isset($v_name[$this->error_code])) {
1314 1306
       $v_value = $v_name[$this->error_code];
1315
-    }
1316
-    else {
1307
+    } else {
1317 1308
       $v_value = 'NoName';
1318 1309
     }
1319 1310
 
1320 1311
     if ($p_with_code) {
1321 1312
       return($v_value.' ('.$this->error_code.')');
1322
-    }
1323
-    else {
1313
+    } else {
1324 1314
       return($v_value);
1325 1315
     }
1326 1316
   }
@@ -1335,12 +1325,10 @@  discard block
 block discarded – undo
1335 1325
   {
1336 1326
     if (PCLZIP_ERROR_EXTERNAL == 1) {
1337 1327
       return(PclErrorString());
1338
-    }
1339
-    else {
1328
+    } else {
1340 1329
       if ($p_full) {
1341 1330
         return($this->errorName(true)." : ".$this->error_string);
1342
-      }
1343
-      else {
1331
+      } else {
1344 1332
         return($this->error_string." [code ".$this->error_code."]");
1345 1333
       }
1346 1334
     }
@@ -1525,8 +1513,7 @@  discard block
 block discarded – undo
1525 1513
               && ($p_options_list[$i+1] != '')) {
1526 1514
             $v_result_list[$p_options_list[$i]] = PclZipUtilTranslateWinPath($p_options_list[$i+1], FALSE);
1527 1515
             $i++;
1528
-          }
1529
-          else {
1516
+          } else {
1530 1517
           }
1531 1518
         break;
1532 1519
 
@@ -1544,11 +1531,9 @@  discard block
 block discarded – undo
1544 1531
           // ----- Get the value
1545 1532
           if (is_string($p_options_list[$i+1])) {
1546 1533
               $v_result_list[$p_options_list[$i]][0] = $p_options_list[$i+1];
1547
-          }
1548
-          else if (is_array($p_options_list[$i+1])) {
1534
+          } else if (is_array($p_options_list[$i+1])) {
1549 1535
               $v_result_list[$p_options_list[$i]] = $p_options_list[$i+1];
1550
-          }
1551
-          else {
1536
+          } else {
1552 1537
             // ----- Error log
1553 1538
             PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Wrong parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
1554 1539
 
@@ -1577,8 +1562,7 @@  discard block
 block discarded – undo
1577 1562
           // ----- Get the value
1578 1563
           if (is_string($p_options_list[$i+1])) {
1579 1564
               $v_result_list[$p_options_list[$i]] = $p_options_list[$i+1];
1580
-          }
1581
-          else {
1565
+          } else {
1582 1566
             // ----- Error log
1583 1567
             PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Wrong parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
1584 1568
 
@@ -1607,8 +1591,7 @@  discard block
 block discarded – undo
1607 1591
           // ----- Get the value
1608 1592
           if (is_string($p_options_list[$i+1])) {
1609 1593
               $v_result_list[$p_options_list[$i]] = $p_options_list[$i+1];
1610
-          }
1611
-          else {
1594
+          } else {
1612 1595
             // ----- Error log
1613 1596
             PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE,
1614 1597
 			                     "Wrong parameter value for option '"
@@ -1641,14 +1624,11 @@  discard block
 block discarded – undo
1641 1624
 
1642 1625
               // ----- Parse items
1643 1626
               $v_work_list = explode(",", $p_options_list[$i+1]);
1644
-          }
1645
-          else if (is_integer($p_options_list[$i+1])) {
1627
+          } else if (is_integer($p_options_list[$i+1])) {
1646 1628
               $v_work_list[0] = $p_options_list[$i+1].'-'.$p_options_list[$i+1];
1647
-          }
1648
-          else if (is_array($p_options_list[$i+1])) {
1629
+          } else if (is_array($p_options_list[$i+1])) {
1649 1630
               $v_work_list = $p_options_list[$i+1];
1650
-          }
1651
-          else {
1631
+          } else {
1652 1632
             // ----- Error log
1653 1633
             PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Value must be integer, string or array for option '".PclZipUtilOptionText($p_options_list[$i])."'");
1654 1634
 
@@ -1675,13 +1655,11 @@  discard block
 block discarded – undo
1675 1655
                   // ----- Set the option value
1676 1656
                   $v_result_list[$p_options_list[$i]][$j]['start'] = $v_item_list[0];
1677 1657
                   $v_result_list[$p_options_list[$i]][$j]['end'] = $v_item_list[0];
1678
-              }
1679
-              elseif ($v_size_item_list == 2) {
1658
+              } elseif ($v_size_item_list == 2) {
1680 1659
                   // ----- Set the option value
1681 1660
                   $v_result_list[$p_options_list[$i]][$j]['start'] = $v_item_list[0];
1682 1661
                   $v_result_list[$p_options_list[$i]][$j]['end'] = $v_item_list[1];
1683
-              }
1684
-              else {
1662
+              } else {
1685 1663
                   // ----- Error log
1686 1664
                   PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Too many values in index range for option '".PclZipUtilOptionText($p_options_list[$i])."'");
1687 1665
 
@@ -1837,14 +1815,17 @@  discard block
 block discarded – undo
1837 1815
     $v_memory_limit = trim($v_memory_limit);
1838 1816
     $last = strtolower(substr($v_memory_limit, -1));
1839 1817
  
1840
-    if($last == 'g')
1841
-        //$v_memory_limit = $v_memory_limit*1024*1024*1024;
1818
+    if($last == 'g') {
1819
+            //$v_memory_limit = $v_memory_limit*1024*1024*1024;
1842 1820
         $v_memory_limit = $v_memory_limit*1073741824;
1843
-    if($last == 'm')
1844
-        //$v_memory_limit = $v_memory_limit*1024*1024;
1821
+    }
1822
+    if($last == 'm') {
1823
+            //$v_memory_limit = $v_memory_limit*1024*1024;
1845 1824
         $v_memory_limit = $v_memory_limit*1048576;
1846
-    if($last == 'k')
1847
-        $v_memory_limit = $v_memory_limit*1024;
1825
+    }
1826
+    if($last == 'k') {
1827
+            $v_memory_limit = $v_memory_limit*1024;
1828
+    }
1848 1829
             
1849 1830
     $p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD] = floor($v_memory_limit*PCLZIP_TEMPORARY_FILE_RATIO);
1850 1831
     
@@ -2017,15 +1998,12 @@  discard block
 block discarded – undo
2017 1998
       if (file_exists($v_descr['filename'])) {
2018 1999
         if (@is_file($v_descr['filename'])) {
2019 2000
           $v_descr['type'] = 'file';
2020
-        }
2021
-        else if (@is_dir($v_descr['filename'])) {
2001
+        } else if (@is_dir($v_descr['filename'])) {
2022 2002
           $v_descr['type'] = 'folder';
2023
-        }
2024
-        else if (@is_link($v_descr['filename'])) {
2003
+        } else if (@is_link($v_descr['filename'])) {
2025 2004
           // skip
2026 2005
           continue;
2027
-        }
2028
-        else {
2006
+        } else {
2029 2007
           // skip
2030 2008
           continue;
2031 2009
         }
@@ -2074,8 +2052,7 @@  discard block
 block discarded – undo
2074 2052
                  && (!isset($p_options[PCLZIP_OPT_REMOVE_ALL_PATH]))) {
2075 2053
               if ($v_descr['stored_filename'] != '') {
2076 2054
                 $v_dirlist_descr[$v_dirlist_nb]['new_full_name'] = $v_descr['stored_filename'].'/'.$v_item_handler;
2077
-              }
2078
-              else {
2055
+              } else {
2079 2056
                 $v_dirlist_descr[$v_dirlist_nb]['new_full_name'] = $v_item_handler;
2080 2057
               }
2081 2058
             }
@@ -2084,8 +2061,7 @@  discard block
 block discarded – undo
2084 2061
           }
2085 2062
           
2086 2063
           @closedir($v_folder_handler);
2087
-        }
2088
-        else {
2064
+        } else {
2089 2065
           // TBC : unable to open folder in read mode
2090 2066
         }
2091 2067
         
@@ -2098,8 +2074,7 @@  discard block
 block discarded – undo
2098 2074
           
2099 2075
           // ----- Concat the resulting list
2100 2076
           $v_result_list = array_merge($v_result_list, $v_dirlist_descr);
2101
-        }
2102
-        else {
2077
+        } else {
2103 2078
         }
2104 2079
           
2105 2080
         // ----- Free local array
@@ -2373,8 +2348,9 @@  discard block
 block discarded – undo
2373 2348
   {
2374 2349
     $v_result=1;
2375 2350
 
2376
-    if ($this->zip_fd != 0)
2377
-      @fclose($this->zip_fd);
2351
+    if ($this->zip_fd != 0) {
2352
+          @fclose($this->zip_fd);
2353
+    }
2378 2354
     $this->zip_fd = 0;
2379 2355
 
2380 2356
     // ----- Return
@@ -2591,11 +2567,9 @@  discard block
 block discarded – undo
2591 2567
     // ----- Look for filetime
2592 2568
     if (isset($p_filedescr['mtime'])) {
2593 2569
       $p_header['mtime'] = $p_filedescr['mtime'];
2594
-    }
2595
-    else if ($p_filedescr['type'] == 'virtual_file') {
2570
+    } else if ($p_filedescr['type'] == 'virtual_file') {
2596 2571
       $p_header['mtime'] = time();
2597
-    }
2598
-    else {
2572
+    } else {
2599 2573
       $p_header['mtime'] = filemtime($p_filename);
2600 2574
     }
2601 2575
 
@@ -2603,8 +2577,7 @@  discard block
 block discarded – undo
2603 2577
     if (isset($p_filedescr['comment'])) {
2604 2578
       $p_header['comment_len'] = strlen($p_filedescr['comment']);
2605 2579
       $p_header['comment'] = $p_filedescr['comment'];
2606
-    }
2607
-    else {
2580
+    } else {
2608 2581
       $p_header['comment_len'] = 0;
2609 2582
       $p_header['comment'] = '';
2610 2583
     }
@@ -2915,20 +2888,17 @@  discard block
 block discarded – undo
2915 2888
     $p_filename = $p_filedescr['filename'];
2916 2889
     if (isset($p_options[PCLZIP_OPT_ADD_PATH])) {
2917 2890
       $p_add_dir = $p_options[PCLZIP_OPT_ADD_PATH];
2918
-    }
2919
-    else {
2891
+    } else {
2920 2892
       $p_add_dir = '';
2921 2893
     }
2922 2894
     if (isset($p_options[PCLZIP_OPT_REMOVE_PATH])) {
2923 2895
       $p_remove_dir = $p_options[PCLZIP_OPT_REMOVE_PATH];
2924
-    }
2925
-    else {
2896
+    } else {
2926 2897
       $p_remove_dir = '';
2927 2898
     }
2928 2899
     if (isset($p_options[PCLZIP_OPT_REMOVE_ALL_PATH])) {
2929 2900
       $p_remove_all_dir = $p_options[PCLZIP_OPT_REMOVE_ALL_PATH];
2930
-    }
2931
-    else {
2901
+    } else {
2932 2902
       $p_remove_all_dir = 0;
2933 2903
     }
2934 2904
 
@@ -2951,8 +2921,7 @@  discard block
 block discarded – undo
2951 2921
           $v_dir = $v_path_info['dirname'].'/';
2952 2922
         }
2953 2923
         $v_stored_filename = $v_dir.$p_filedescr['new_short_name'];
2954
-      }
2955
-      else {
2924
+      } else {
2956 2925
         // ----- Calculate the stored filename
2957 2926
         $v_stored_filename = $p_filename;
2958 2927
       }
@@ -2963,8 +2932,9 @@  discard block
 block discarded – undo
2963 2932
       }
2964 2933
       // ----- Look for partial path remove
2965 2934
       else if ($p_remove_dir != "") {
2966
-        if (substr($p_remove_dir, -1) != '/')
2967
-          $p_remove_dir .= "/";
2935
+        if (substr($p_remove_dir, -1) != '/') {
2936
+                  $p_remove_dir .= "/";
2937
+        }
2968 2938
 
2969 2939
         if (   (substr($p_filename, 0, 2) == "./")
2970 2940
             || (substr($p_remove_dir, 0, 2) == "./")) {
@@ -2984,8 +2954,7 @@  discard block
 block discarded – undo
2984 2954
         if ($v_compare > 0) {
2985 2955
           if ($v_compare == 2) {
2986 2956
             $v_stored_filename = "";
2987
-          }
2988
-          else {
2957
+          } else {
2989 2958
             $v_stored_filename = substr($v_stored_filename,
2990 2959
                                         strlen($p_remove_dir));
2991 2960
           }
@@ -2997,10 +2966,11 @@  discard block
 block discarded – undo
2997 2966
       
2998 2967
       // ----- Look for path to add
2999 2968
       if ($p_add_dir != "") {
3000
-        if (substr($p_add_dir, -1) == "/")
3001
-          $v_stored_filename = $p_add_dir.$v_stored_filename;
3002
-        else
3003
-          $v_stored_filename = $p_add_dir."/".$v_stored_filename;
2969
+        if (substr($p_add_dir, -1) == "/") {
2970
+                  $v_stored_filename = $p_add_dir.$v_stored_filename;
2971
+        } else {
2972
+                  $v_stored_filename = $p_add_dir."/".$v_stored_filename;
2973
+        }
3004 2974
       }
3005 2975
     }
3006 2976
 
@@ -3283,8 +3253,9 @@  discard block
 block discarded – undo
3283 3253
     if (   ($p_path == "")
3284 3254
 	    || (   (substr($p_path, 0, 1) != "/")
3285 3255
 		    && (substr($p_path, 0, 3) != "../")
3286
-			&& (substr($p_path,1,2)!=":/")))
3287
-      $p_path = "./".$p_path;
3256
+			&& (substr($p_path,1,2)!=":/"))) {
3257
+          $p_path = "./".$p_path;
3258
+    }
3288 3259
 
3289 3260
     // ----- Reduce the path last (and duplicated) '/'
3290 3261
     if (($p_path != "./") && ($p_path != "/"))
@@ -3771,8 +3742,7 @@  discard block
 block discarded – undo
3771 3742
         // ----- Change the file status
3772 3743
         if (   (isset($p_options[PCLZIP_OPT_REPLACE_NEWER]))
3773 3744
 		    && ($p_options[PCLZIP_OPT_REPLACE_NEWER]===true)) {
3774
-	  	  }
3775
-		    else {
3745
+	  	  } else {
3776 3746
             $p_entry['status'] = "newer_exist";
3777 3747
 
3778 3748
             // ----- Look for PCLZIP_OPT_STOP_ON_ERROR
@@ -3788,19 +3758,19 @@  discard block
 block discarded – undo
3788 3758
                 return PclZip::errorCode();
3789 3759
 		      }
3790 3760
 		    }
3791
-      }
3792
-      else {
3761
+      } else {
3793 3762
       }
3794 3763
     }
3795 3764
 
3796 3765
     // ----- Check the directory availability and create it if necessary
3797 3766
     else {
3798
-      if ((($p_entry['external']&0x00000010)==0x00000010) || (substr($p_entry['filename'], -1) == '/'))
3799
-        $v_dir_to_check = $p_entry['filename'];
3800
-      else if (!strstr($p_entry['filename'], "/"))
3801
-        $v_dir_to_check = "";
3802
-      else
3803
-        $v_dir_to_check = dirname($p_entry['filename']);
3767
+      if ((($p_entry['external']&0x00000010)==0x00000010) || (substr($p_entry['filename'], -1) == '/')) {
3768
+              $v_dir_to_check = $p_entry['filename'];
3769
+      } else if (!strstr($p_entry['filename'], "/")) {
3770
+              $v_dir_to_check = "";
3771
+      } else {
3772
+              $v_dir_to_check = dirname($p_entry['filename']);
3773
+      }
3804 3774
 
3805 3775
         if (($v_result = $this->privDirCheck($v_dir_to_check, (($p_entry['external']&0x00000010)==0x00000010))) != 1) {
3806 3776
   
@@ -3856,8 +3826,7 @@  discard block
 block discarded – undo
3856 3826
           touch($p_entry['filename'], $p_entry['mtime']);
3857 3827
           
3858 3828
 
3859
-        }
3860
-        else {
3829
+        } else {
3861 3830
           // ----- TBC
3862 3831
           // Need to be finished
3863 3832
           if (($p_entry['flag'] & 1) == 1) {
@@ -4100,8 +4069,7 @@  discard block
 block discarded – undo
4100 4069
           // ----- Send the file to the output
4101 4070
           echo $v_buffer;
4102 4071
           unset($v_buffer);
4103
-        }
4104
-        else {
4072
+        } else {
4105 4073
 
4106 4074
           // ----- Read the compressed file in a buffer (one shot)
4107 4075
           $v_buffer = @fread($this->zip_fd, $p_entry['compressed_size']);
@@ -4211,8 +4179,7 @@  discard block
 block discarded – undo
4211 4179
   
4212 4180
           // ----- Reading the file
4213 4181
           $p_string = @fread($this->zip_fd, $p_entry['compressed_size']);
4214
-        }
4215
-        else {
4182
+        } else {
4216 4183
   
4217 4184
           // ----- Reading the file
4218 4185
           $v_data = @fread($this->zip_fd, $p_entry['compressed_size']);
@@ -4224,8 +4191,7 @@  discard block
 block discarded – undo
4224 4191
         }
4225 4192
   
4226 4193
         // ----- Trace
4227
-      }
4228
-      else {
4194
+      } else {
4229 4195
           // TBC : error : can not extract a folder in a string
4230 4196
       }
4231 4197
       
@@ -4318,8 +4284,7 @@  discard block
 block discarded – undo
4318 4284
     // ----- Get extra_fields
4319 4285
     if ($v_data['extra_len'] != 0) {
4320 4286
       $p_header['extra'] = fread($this->zip_fd, $v_data['extra_len']);
4321
-    }
4322
-    else {
4287
+    } else {
4323 4288
       $p_header['extra'] = '';
4324 4289
     }
4325 4290
 
@@ -4350,8 +4315,7 @@  discard block
 block discarded – undo
4350 4315
       // ----- Get UNIX date format
4351 4316
       $p_header['mtime'] = @mktime($v_hour, $v_minute, $v_seconde, $v_month, $v_day, $v_year);
4352 4317
 
4353
-    }
4354
-    else
4318
+    } else
4355 4319
     {
4356 4320
       $p_header['mtime'] = time();
4357 4321
     }
@@ -4416,22 +4380,25 @@  discard block
 block discarded – undo
4416 4380
     $p_header = unpack('vversion/vversion_extracted/vflag/vcompression/vmtime/vmdate/Vcrc/Vcompressed_size/Vsize/vfilename_len/vextra_len/vcomment_len/vdisk/vinternal/Vexternal/Voffset', $v_binary_data);
4417 4381
 
4418 4382
     // ----- Get filename
4419
-    if ($p_header['filename_len'] != 0)
4420
-      $p_header['filename'] = fread($this->zip_fd, $p_header['filename_len']);
4421
-    else
4422
-      $p_header['filename'] = '';
4383
+    if ($p_header['filename_len'] != 0) {
4384
+          $p_header['filename'] = fread($this->zip_fd, $p_header['filename_len']);
4385
+    } else {
4386
+          $p_header['filename'] = '';
4387
+    }
4423 4388
 
4424 4389
     // ----- Get extra
4425
-    if ($p_header['extra_len'] != 0)
4426
-      $p_header['extra'] = fread($this->zip_fd, $p_header['extra_len']);
4427
-    else
4428
-      $p_header['extra'] = '';
4390
+    if ($p_header['extra_len'] != 0) {
4391
+          $p_header['extra'] = fread($this->zip_fd, $p_header['extra_len']);
4392
+    } else {
4393
+          $p_header['extra'] = '';
4394
+    }
4429 4395
 
4430 4396
     // ----- Get comment
4431
-    if ($p_header['comment_len'] != 0)
4432
-      $p_header['comment'] = fread($this->zip_fd, $p_header['comment_len']);
4433
-    else
4434
-      $p_header['comment'] = '';
4397
+    if ($p_header['comment_len'] != 0) {
4398
+          $p_header['comment'] = fread($this->zip_fd, $p_header['comment_len']);
4399
+    } else {
4400
+          $p_header['comment'] = '';
4401
+    }
4435 4402
 
4436 4403
     // ----- Extract properties
4437 4404
 
@@ -4453,8 +4420,7 @@  discard block
 block discarded – undo
4453 4420
       // ----- Get UNIX date format
4454 4421
       $p_header['mtime'] = @mktime($v_hour, $v_minute, $v_seconde, $v_month, $v_day, $v_year);
4455 4422
 
4456
-    }
4457
-    else
4423
+    } else
4458 4424
     {
4459 4425
       $p_header['mtime'] = time();
4460 4426
     }
@@ -4567,8 +4533,9 @@  discard block
 block discarded – undo
4567 4533
     // ----- Go back to the maximum possible size of the Central Dir End Record
4568 4534
     if (!$v_found) {
4569 4535
       $v_maximum_size = 65557; // 0xFFFF + 22;
4570
-      if ($v_maximum_size > $v_size)
4571
-        $v_maximum_size = $v_size;
4536
+      if ($v_maximum_size > $v_size) {
4537
+              $v_maximum_size = $v_size;
4538
+      }
4572 4539
       @fseek($this->zip_fd, $v_size-$v_maximum_size);
4573 4540
       if (@ftell($this->zip_fd) != ($v_size-$v_maximum_size))
4574 4541
       {
@@ -4653,9 +4620,9 @@  discard block
 block discarded – undo
4653 4620
     // ----- Get comment
4654 4621
     if ($v_data['comment_size'] != 0) {
4655 4622
       $p_central_dir['comment'] = fread($this->zip_fd, $v_data['comment_size']);
4623
+    } else {
4624
+          $p_central_dir['comment'] = '';
4656 4625
     }
4657
-    else
4658
-      $p_central_dir['comment'] = '';
4659 4626
 
4660 4627
     $p_central_dir['entries'] = $v_data['entries'];
4661 4628
     $p_central_dir['disk_entries'] = $v_data['disk_entries'];
@@ -4755,8 +4722,7 @@  discard block
 block discarded – undo
4755 4722
                   if (   (strlen($v_header_list[$v_nb_extracted]['stored_filename']) > strlen($p_options[PCLZIP_OPT_BY_NAME][$j]))
4756 4723
                       && (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])) {
4757 4724
                       $v_found = true;
4758
-                  }
4759
-                  elseif (   (($v_header_list[$v_nb_extracted]['external']&0x00000010)==0x00000010) /* Indicates a folder */
4725
+                  } elseif (   (($v_header_list[$v_nb_extracted]['external']&0x00000010)==0x00000010) /* Indicates a folder */
4760 4726
                           && ($v_header_list[$v_nb_extracted]['stored_filename'].'/' == $p_options[PCLZIP_OPT_BY_NAME][$j])) {
4761 4727
                       $v_found = true;
4762 4728
                   }
@@ -4807,8 +4773,7 @@  discard block
 block discarded – undo
4807 4773
                   break;
4808 4774
               }
4809 4775
           }
4810
-      }
4811
-      else {
4776
+      } else {
4812 4777
       	$v_found = true;
4813 4778
       }
4814 4779
 
@@ -4816,8 +4781,7 @@  discard block
 block discarded – undo
4816 4781
       if ($v_found)
4817 4782
       {
4818 4783
         unset($v_header_list[$v_nb_extracted]);
4819
-      }
4820
-      else
4784
+      } else
4821 4785
       {
4822 4786
         $v_nb_extracted++;
4823 4787
       }
@@ -5293,8 +5257,7 @@  discard block
 block discarded – undo
5293 5257
   {
5294 5258
     if (PCLZIP_ERROR_EXTERNAL == 1) {
5295 5259
       PclError($p_error_code, $p_error_string);
5296
-    }
5297
-    else {
5260
+    } else {
5298 5261
       $this->error_code = $p_error_code;
5299 5262
       $this->error_string = $p_error_string;
5300 5263
     }
@@ -5310,8 +5273,7 @@  discard block
 block discarded – undo
5310 5273
   {
5311 5274
     if (PCLZIP_ERROR_EXTERNAL == 1) {
5312 5275
       PclErrorReset();
5313
-    }
5314
-    else {
5276
+    } else {
5315 5277
       $this->error_code = 0;
5316 5278
       $this->error_string = '';
5317 5279
     }
@@ -5409,11 +5371,9 @@  discard block
 block discarded – undo
5409 5371
         if ($v_list[$i] == ".") {
5410 5372
           // ----- Ignore this directory
5411 5373
           // Should be the first $i=0, but no check is done
5412
-        }
5413
-        else if ($v_list[$i] == "..") {
5374
+        } else if ($v_list[$i] == "..") {
5414 5375
 		  $v_skip++;
5415
-        }
5416
-        else if ($v_list[$i] == "") {
5376
+        } else if ($v_list[$i] == "") {
5417 5377
 		  // ----- First '/' i.e. root slash
5418 5378
 		  if ($i == 0) {
5419 5379
             $v_result = "/".$v_result;
@@ -5433,13 +5393,11 @@  discard block
 block discarded – undo
5433 5393
             // ----- Ignore only the double '//' in path,
5434 5394
             // but not the first and last '/'
5435 5395
 		  }
5436
-        }
5437
-        else {
5396
+        } else {
5438 5397
 		  // ----- Look for item to skip
5439 5398
 		  if ($v_skip > 0) {
5440 5399
 		    $v_skip--;
5441
-		  }
5442
-		  else {
5400
+		  } else {
5443 5401
             $v_result = $v_list[$i].($i!=(sizeof($v_list)-1)?"/".$v_result:"");
5444 5402
 		  }
5445 5403
         }
@@ -5522,14 +5480,17 @@  discard block
 block discarded – undo
5522 5480
     // ----- Look if everything seems to be the same
5523 5481
     if ($v_result) {
5524 5482
       // ----- Skip all the empty items
5525
-      while (($j < $v_list_path_size) && ($v_list_path[$j] == '')) $j++;
5526
-      while (($i < $v_list_dir_size) && ($v_list_dir[$i] == '')) $i++;
5483
+      while (($j < $v_list_path_size) && ($v_list_path[$j] == '')) {
5484
+      	$j++;
5485
+      }
5486
+      while (($i < $v_list_dir_size) && ($v_list_dir[$i] == '')) {
5487
+      	$i++;
5488
+      }
5527 5489
 
5528 5490
       if (($i >= $v_list_dir_size) && ($j >= $v_list_path_size)) {
5529 5491
         // ----- There are exactly the same
5530 5492
         $v_result = 2;
5531
-      }
5532
-      else if ($i < $v_list_dir_size) {
5493
+      } else if ($i < $v_list_dir_size) {
5533 5494
         // ----- The path is shorter than the dir
5534 5495
         $v_result = 0;
5535 5496
       }
@@ -5564,8 +5525,7 @@  discard block
 block discarded – undo
5564 5525
         @fwrite($p_dest, $v_buffer, $v_read_size);
5565 5526
         $p_size -= $v_read_size;
5566 5527
       }
5567
-    }
5568
-    else if ($p_mode==1)
5528
+    } else if ($p_mode==1)
5569 5529
     {
5570 5530
       while ($p_size != 0)
5571 5531
       {
@@ -5574,8 +5534,7 @@  discard block
 block discarded – undo
5574 5534
         @fwrite($p_dest, $v_buffer, $v_read_size);
5575 5535
         $p_size -= $v_read_size;
5576 5536
       }
5577
-    }
5578
-    else if ($p_mode==2)
5537
+    } else if ($p_mode==2)
5579 5538
     {
5580 5539
       while ($p_size != 0)
5581 5540
       {
@@ -5584,8 +5543,7 @@  discard block
 block discarded – undo
5584 5543
         @gzwrite($p_dest, $v_buffer, $v_read_size);
5585 5544
         $p_size -= $v_read_size;
5586 5545
       }
5587
-    }
5588
-    else if ($p_mode==3)
5546
+    } else if ($p_mode==3)
5589 5547
     {
5590 5548
       while ($p_size != 0)
5591 5549
       {
@@ -5623,8 +5581,7 @@  discard block
 block discarded – undo
5623 5581
       // ----- Try to copy & unlink the src
5624 5582
       if (!@copy($p_src, $p_dest)) {
5625 5583
         $v_result = 0;
5626
-      }
5627
-      else if (!@unlink($p_src)) {
5584
+      } else if (!@unlink($p_src)) {
5628 5585
         $v_result = 0;
5629 5586
       }
5630 5587
     }
Please login to merge, or discard this patch.
app/Vendor/PHPExcel/PHPExcel/Shared/PDF/barcodes.php 3 patches
Doc Comments   +4 added lines, -5 removed lines patch added patch discarded remove patch
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
 	/**
319 319
 	 * Encode a string to be used for CODE 39 Extended mode.
320 320
 	 * @param string $code code to represent.
321
-	 * @return encoded string.
321
+	 * @return false|string string.
322 322
 	 * @access protected
323 323
 	 */
324 324
 	protected function encode_code39_ext($code) {
@@ -369,7 +369,7 @@  discard block
 block discarded – undo
369 369
 	/**
370 370
 	 * Calculate CODE 39 checksum (modulo 43).
371 371
 	 * @param string $code code to represent.
372
-	 * @return char checksum.
372
+	 * @return string checksum.
373 373
 	 * @access protected
374 374
 	 */
375 375
 	protected function checksum_code39($code) {
@@ -392,7 +392,6 @@  discard block
 block discarded – undo
392 392
 	 * CODE 93 - USS-93
393 393
 	 * Compact code similar to Code 39
394 394
 	 * @param string $code code to represent.
395
-	 * @param boolean $checksum if true add a checksum to the code
396 395
 	 * @return array barcode representation.
397 396
 	 * @access protected
398 397
 	 */
@@ -981,7 +980,7 @@  discard block
 block discarded – undo
981 980
 	 * UPC-A: Universal product code seen on almost all retail products in the USA and Canada
982 981
 	 * UPC-E: Short version of UPC symbol
983 982
 	 * @param string $code code to represent.
984
-	 * @param string $len barcode type: 6 = UPC-E, 8 = EAN8, 13 = EAN13, 12 = UPC-A
983
+	 * @param integer $len barcode type: 6 = UPC-E, 8 = EAN8, 13 = EAN13, 12 = UPC-A
985 984
 	 * @return array barcode representation.
986 985
 	 * @access protected
987 986
 	 */
@@ -1174,7 +1173,7 @@  discard block
 block discarded – undo
1174 1173
 	 * 2-Digit Ext.: Used to indicate magazines and newspaper issue numbers
1175 1174
 	 * 5-Digit Ext.: Used to mark suggested retail price of books
1176 1175
 	 * @param string $code code to represent.
1177
-	 * @param string $len barcode type: 2 = 2-Digit, 5 = 5-Digit
1176
+	 * @param integer $len barcode type: 2 = 2-Digit, 5 = 5-Digit
1178 1177
 	 * @return array barcode representation.
1179 1178
 	 * @access protected
1180 1179
 	 */
Please login to merge, or discard this patch.
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -44,14 +44,14 @@  discard block
 block discarded – undo
44 44
  */
45 45
 
46 46
 	/**
47
-	* PHP class to creates array representations for common 1D barcodes to be used with TCPDF (http://www.tcpdf.org).<br>
48
-	* @name TCPDFBarcode
49
-	* @package com.tecnick.tcpdf
50
-	* @version 1.0.011
51
-	* @author Nicola Asuni
52
-	* @link http://www.tcpdf.org
53
-	* @license http://www.gnu.org/copyleft/lesser.html LGPL
54
-	*/
47
+	 * PHP class to creates array representations for common 1D barcodes to be used with TCPDF (http://www.tcpdf.org).<br>
48
+	 * @name TCPDFBarcode
49
+	 * @package com.tecnick.tcpdf
50
+	 * @version 1.0.011
51
+	 * @author Nicola Asuni
52
+	 * @link http://www.tcpdf.org
53
+	 * @license http://www.gnu.org/copyleft/lesser.html LGPL
54
+	 */
55 55
 class TCPDFBarcode {
56 56
 
57 57
 	/**
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 	 * <li>$arrcode['bcode'][$k]['h'] bar height in units.</li>
73 73
 	 * <li>$arrcode['bcode'][$k]['p'] bar top position (0 = top, 1 = middle)</li></ul>
74 74
 	 * @param string $code code to print
75
- 	 * @param string $type type of barcode: <ul><li>C39 : CODE 39 - ANSI MH10.8M-1983 - USD-3 - 3 of 9.</li><li>C39+ : CODE 39 with checksum</li><li>C39E : CODE 39 EXTENDED</li><li>C39E+ : CODE 39 EXTENDED + CHECKSUM</li><li>C93 : CODE 93 - USS-93</li><li>S25 : Standard 2 of 5</li><li>S25+ : Standard 2 of 5 + CHECKSUM</li><li>I25 : Interleaved 2 of 5</li><li>I25+ : Interleaved 2 of 5 + CHECKSUM</li><li>C128A : CODE 128 A</li><li>C128B : CODE 128 B</li><li>C128C : CODE 128 C</li><li>EAN2 : 2-Digits UPC-Based Extention</li><li>EAN5 : 5-Digits UPC-Based Extention</li><li>EAN8 : EAN 8</li><li>EAN13 : EAN 13</li><li>UPCA : UPC-A</li><li>UPCE : UPC-E</li><li>MSI : MSI (Variation of Plessey code)</li><li>MSI+ : MSI + CHECKSUM (modulo 11)</li><li>POSTNET : POSTNET</li><li>PLANET : PLANET</li><li>RMS4CC : RMS4CC (Royal Mail 4-state Customer Code) - CBC (Customer Bar Code)</li><li>KIX : KIX (Klant index - Customer index)</li><li>IMB: Intelligent Mail Barcode - Onecode - USPS-B-3200</li><li>CODABAR : CODABAR</li><li>CODE11 : CODE 11</li><li>PHARMA : PHARMACODE</li><li>PHARMA2T : PHARMACODE TWO-TRACKS</li></ul>
75
+	 * @param string $type type of barcode: <ul><li>C39 : CODE 39 - ANSI MH10.8M-1983 - USD-3 - 3 of 9.</li><li>C39+ : CODE 39 with checksum</li><li>C39E : CODE 39 EXTENDED</li><li>C39E+ : CODE 39 EXTENDED + CHECKSUM</li><li>C93 : CODE 93 - USS-93</li><li>S25 : Standard 2 of 5</li><li>S25+ : Standard 2 of 5 + CHECKSUM</li><li>I25 : Interleaved 2 of 5</li><li>I25+ : Interleaved 2 of 5 + CHECKSUM</li><li>C128A : CODE 128 A</li><li>C128B : CODE 128 B</li><li>C128C : CODE 128 C</li><li>EAN2 : 2-Digits UPC-Based Extention</li><li>EAN5 : 5-Digits UPC-Based Extention</li><li>EAN8 : EAN 8</li><li>EAN13 : EAN 13</li><li>UPCA : UPC-A</li><li>UPCE : UPC-E</li><li>MSI : MSI (Variation of Plessey code)</li><li>MSI+ : MSI + CHECKSUM (modulo 11)</li><li>POSTNET : POSTNET</li><li>PLANET : PLANET</li><li>RMS4CC : RMS4CC (Royal Mail 4-state Customer Code) - CBC (Customer Bar Code)</li><li>KIX : KIX (Klant index - Customer index)</li><li>IMB: Intelligent Mail Barcode - Onecode - USPS-B-3200</li><li>CODABAR : CODABAR</li><li>CODE11 : CODE 11</li><li>PHARMA : PHARMACODE</li><li>PHARMA2T : PHARMACODE TWO-TRACKS</li></ul>
76 76
 	 */
77 77
 	public function __construct($code, $type) {
78 78
 		$this->setBarcode($code, $type);
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 
81 81
 	/**
82 82
 	 * Return an array representations of barcode.
83
- 	 * @return array
83
+	 * @return array
84 84
 	 */
85 85
 	public function getBarcodeArray() {
86 86
 		return $this->barcode_array;
@@ -89,8 +89,8 @@  discard block
 block discarded – undo
89 89
 	/**
90 90
 	 * Set the barcode.
91 91
 	 * @param string $code code to print
92
- 	 * @param string $type type of barcode: <ul><li>C39 : CODE 39 - ANSI MH10.8M-1983 - USD-3 - 3 of 9.</li><li>C39+ : CODE 39 with checksum</li><li>C39E : CODE 39 EXTENDED</li><li>C39E+ : CODE 39 EXTENDED + CHECKSUM</li><li>C93 : CODE 93 - USS-93</li><li>S25 : Standard 2 of 5</li><li>S25+ : Standard 2 of 5 + CHECKSUM</li><li>I25 : Interleaved 2 of 5</li><li>I25+ : Interleaved 2 of 5 + CHECKSUM</li><li>C128A : CODE 128 A</li><li>C128B : CODE 128 B</li><li>C128C : CODE 128 C</li><li>EAN2 : 2-Digits UPC-Based Extention</li><li>EAN5 : 5-Digits UPC-Based Extention</li><li>EAN8 : EAN 8</li><li>EAN13 : EAN 13</li><li>UPCA : UPC-A</li><li>UPCE : UPC-E</li><li>MSI : MSI (Variation of Plessey code)</li><li>MSI+ : MSI + CHECKSUM (modulo 11)</li><li>POSTNET : POSTNET</li><li>PLANET : PLANET</li><li>RMS4CC : RMS4CC (Royal Mail 4-state Customer Code) - CBC (Customer Bar Code)</li><li>KIX : KIX (Klant index - Customer index)</li><li>IMB: Intelligent Mail Barcode - Onecode - USPS-B-3200</li><li>CODABAR : CODABAR</li><li>CODE11 : CODE 11</li><li>PHARMA : PHARMACODE</li><li>PHARMA2T : PHARMACODE TWO-TRACKS</li></ul>
93
- 	 * @return array
92
+	 * @param string $type type of barcode: <ul><li>C39 : CODE 39 - ANSI MH10.8M-1983 - USD-3 - 3 of 9.</li><li>C39+ : CODE 39 with checksum</li><li>C39E : CODE 39 EXTENDED</li><li>C39E+ : CODE 39 EXTENDED + CHECKSUM</li><li>C93 : CODE 93 - USS-93</li><li>S25 : Standard 2 of 5</li><li>S25+ : Standard 2 of 5 + CHECKSUM</li><li>I25 : Interleaved 2 of 5</li><li>I25+ : Interleaved 2 of 5 + CHECKSUM</li><li>C128A : CODE 128 A</li><li>C128B : CODE 128 B</li><li>C128C : CODE 128 C</li><li>EAN2 : 2-Digits UPC-Based Extention</li><li>EAN5 : 5-Digits UPC-Based Extention</li><li>EAN8 : EAN 8</li><li>EAN13 : EAN 13</li><li>UPCA : UPC-A</li><li>UPCE : UPC-E</li><li>MSI : MSI (Variation of Plessey code)</li><li>MSI+ : MSI + CHECKSUM (modulo 11)</li><li>POSTNET : POSTNET</li><li>PLANET : PLANET</li><li>RMS4CC : RMS4CC (Royal Mail 4-state Customer Code) - CBC (Customer Bar Code)</li><li>KIX : KIX (Klant index - Customer index)</li><li>IMB: Intelligent Mail Barcode - Onecode - USPS-B-3200</li><li>CODABAR : CODABAR</li><li>CODE11 : CODE 11</li><li>PHARMA : PHARMACODE</li><li>PHARMA2T : PHARMACODE TWO-TRACKS</li></ul>
93
+	 * @return array
94 94
 	 */
95 95
 	public function setBarcode($code, $type) {
96 96
 		switch (strtoupper($type)) {
Please login to merge, or discard this patch.
Spacing   +187 added lines, -187 removed lines patch added patch discarded remove patch
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
 	 * @return array barcode representation.
228 228
 	 * @access protected
229 229
 	 */
230
-	protected function barcode_code39($code, $extended=false, $checksum=false) {
230
+	protected function barcode_code39($code, $extended = false, $checksum = false) {
231 231
 		$chr['0'] = '111221211';
232 232
 		$chr['1'] = '211211112';
233 233
 		$chr['2'] = '112211112';
@@ -293,7 +293,7 @@  discard block
 block discarded – undo
293 293
 		$clen = strlen($code);
294 294
 		for ($i = 0; $i < $clen; ++$i) {
295 295
 			$char = $code{$i};
296
-			if(!isset($chr[$char])) {
296
+			if ( ! isset($chr[$char])) {
297 297
 				// invalid character
298 298
 				return false;
299 299
 			}
@@ -357,7 +357,7 @@  discard block
 block discarded – undo
357 357
 			chr(124) => '%Q', chr(125) => '%R', chr(126) => '%S', chr(127) => '%T');
358 358
 		$code_ext = '';
359 359
 		$clen = strlen($code);
360
-		for ($i = 0 ; $i < $clen; ++$i) {
360
+		for ($i = 0; $i < $clen; ++$i) {
361 361
 			if (ord($code{$i}) > 127) {
362 362
 				return false;
363 363
 			}
@@ -380,7 +380,7 @@  discard block
 block discarded – undo
380 380
 			'W', 'X', 'Y', 'Z', '-', '.', ' ', '$', '/', '+', '%');
381 381
 		$sum = 0;
382 382
 		$clen = strlen($code);
383
-		for ($i = 0 ; $i < $clen; ++$i) {
383
+		for ($i = 0; $i < $clen; ++$i) {
384 384
 			$k = array_keys($chars, $code{$i});
385 385
 			$sum += $k[0];
386 386
 		}
@@ -481,7 +481,7 @@  discard block
 block discarded – undo
481 481
 			chr(124) => chr(131).'Q', chr(125) => chr(131).'R', chr(126) => chr(131).'S', chr(127) => chr(131).'T');
482 482
 		$code_ext = '';
483 483
 		$clen = strlen($code);
484
-		for ($i = 0 ; $i < $clen; ++$i) {
484
+		for ($i = 0; $i < $clen; ++$i) {
485 485
 			if (ord($code{$i}) > 127) {
486 486
 				return false;
487 487
 			}
@@ -496,7 +496,7 @@  discard block
 block discarded – undo
496 496
 		$clen = strlen($code);
497 497
 		for ($i = 0; $i < $clen; ++$i) {
498 498
 			$char = $code{$i};
499
-			if(!isset($chr[$char])) {
499
+			if ( ! isset($chr[$char])) {
500 500
 				// invalid character
501 501
 				return false;
502 502
 			}
@@ -572,15 +572,15 @@  discard block
 block discarded – undo
572 572
 	protected function checksum_s25($code) {
573 573
 		$len = strlen($code);
574 574
 		$sum = 0;
575
-		for ($i = 0; $i < $len; $i+=2) {
575
+		for ($i = 0; $i < $len; $i += 2) {
576 576
 			$sum += $code{$i};
577 577
 		}
578 578
 		$sum *= 3;
579
-		for ($i = 1; $i < $len; $i+=2) {
579
+		for ($i = 1; $i < $len; $i += 2) {
580 580
 			$sum += ($code{$i});
581 581
 		}
582 582
 		$r = $sum % 10;
583
-		if($r > 0) {
583
+		if ($r > 0) {
584 584
 			$r = (10 - $r);
585 585
 		}
586 586
 		return $r;
@@ -595,7 +595,7 @@  discard block
 block discarded – undo
595 595
 	 * @return array barcode representation.
596 596
 	 * @access protected
597 597
 	 */
598
-	protected function barcode_msi($code, $checksum=false) {
598
+	protected function barcode_msi($code, $checksum = false) {
599 599
 		$chr['0'] = '100100100100';
600 600
 		$chr['1'] = '100100100110';
601 601
 		$chr['2'] = '100100110100';
@@ -634,7 +634,7 @@  discard block
 block discarded – undo
634 634
 		$clen = strlen($code);
635 635
 		for ($i = 0; $i < $clen; ++$i) {
636 636
 			$digit = $code{$i};
637
-			if (!isset($chr[$digit])) {
637
+			if ( ! isset($chr[$digit])) {
638 638
 				// invalid character
639 639
 				return false;
640 640
 			}
@@ -654,7 +654,7 @@  discard block
 block discarded – undo
654 654
 	 * @return array barcode representation.
655 655
 	 * @access protected
656 656
 	 */
657
-	protected function barcode_s25($code, $checksum=false) {
657
+	protected function barcode_s25($code, $checksum = false) {
658 658
 		$chr['0'] = '10101110111010';
659 659
 		$chr['1'] = '11101010101110';
660 660
 		$chr['2'] = '10111010101110';
@@ -669,7 +669,7 @@  discard block
 block discarded – undo
669 669
 			// add checksum
670 670
 			$code .= $this->checksum_s25($code);
671 671
 		}
672
-		if((strlen($code) % 2) != 0) {
672
+		if ((strlen($code) % 2) != 0) {
673 673
 			// add leading zero if code-length is odd
674 674
 			$code = '0'.$code;
675 675
 		}
@@ -677,7 +677,7 @@  discard block
 block discarded – undo
677 677
 		$clen = strlen($code);
678 678
 		for ($i = 0; $i < $clen; ++$i) {
679 679
 			$digit = $code{$i};
680
-			if (!isset($chr[$digit])) {
680
+			if ( ! isset($chr[$digit])) {
681 681
 				// invalid character
682 682
 				return false;
683 683
 			}
@@ -701,7 +701,7 @@  discard block
 block discarded – undo
701 701
 		$k = 0;
702 702
 		for ($i = 0; $i < $len; ++$i) {
703 703
 			$w += 1;
704
-			if (($i == ($len - 1)) OR (($i < ($len - 1)) AND ($seq{$i} != $seq{($i+1)}))) {
704
+			if (($i == ($len - 1)) OR (($i < ($len - 1)) AND ($seq{$i} != $seq{($i + 1)}))) {
705 705
 				if ($seq{$i} == '1') {
706 706
 					$t = true; // bar
707 707
 				} else {
@@ -725,7 +725,7 @@  discard block
 block discarded – undo
725 725
 	 * @return array barcode representation.
726 726
 	 * @access protected
727 727
 	 */
728
-	protected function barcode_i25($code, $checksum=false) {
728
+	protected function barcode_i25($code, $checksum = false) {
729 729
 		$chr['0'] = '11221';
730 730
 		$chr['1'] = '21112';
731 731
 		$chr['2'] = '12112';
@@ -742,7 +742,7 @@  discard block
 block discarded – undo
742 742
 			// add checksum
743 743
 			$code .= $this->checksum_s25($code);
744 744
 		}
745
-		if((strlen($code) % 2) != 0) {
745
+		if ((strlen($code) % 2) != 0) {
746 746
 			// add leading zero if code-length is odd
747 747
 			$code = '0'.$code;
748 748
 		}
@@ -754,16 +754,16 @@  discard block
 block discarded – undo
754 754
 		$clen = strlen($code);
755 755
 		for ($i = 0; $i < $clen; $i = ($i + 2)) {
756 756
 			$char_bar = $code{$i};
757
-			$char_space = $code{$i+1};
758
-			if((!isset($chr[$char_bar])) OR (!isset($chr[$char_space]))) {
757
+			$char_space = $code{$i + 1};
758
+			if (( ! isset($chr[$char_bar])) OR ( ! isset($chr[$char_space]))) {
759 759
 				// invalid character
760 760
 				return false;
761 761
 			}
762 762
 			// create a bar-space sequence
763 763
 			$seq = '';
764 764
 			$chrlen = strlen($chr[$char_bar]);
765
-			for ($s = 0; $s < $chrlen; $s++){
766
-				$seq .= $chr[$char_bar]{$s} . $chr[$char_space]{$s};
765
+			for ($s = 0; $s < $chrlen; $s++) {
766
+				$seq .= $chr[$char_bar]{$s}.$chr[$char_space]{$s};
767 767
 			}
768 768
 			$seqlen = strlen($seq);
769 769
 			for ($j = 0; $j < $seqlen; ++$j) {
@@ -789,7 +789,7 @@  discard block
 block discarded – undo
789 789
 	 * @return array barcode representation.
790 790
 	 * @access protected
791 791
 	 */
792
-	protected function barcode_c128($code, $type='B') {
792
+	protected function barcode_c128($code, $type = 'B') {
793 793
 		$chr = array(
794 794
 			'212222', /* 00 */
795 795
 			'222122', /* 01 */
@@ -901,7 +901,7 @@  discard block
 block discarded – undo
901 901
 			'200000'  /* END */
902 902
 		);
903 903
 		$keys = '';
904
-		switch(strtoupper($type)) {
904
+		switch (strtoupper($type)) {
905 905
 			case 'A': {
906 906
 				$startid = 103;
907 907
 				$keys = ' !"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_';
@@ -941,7 +941,7 @@  discard block
 block discarded – undo
941 941
 		$sum = $startid;
942 942
 		$clen = strlen($code);
943 943
 		for ($i = 0; $i < $clen; ++$i) {
944
-			$sum +=  (strpos($keys, $code{$i}) * ($i+1));
944
+			$sum += (strpos($keys, $code{$i}) * ($i + 1));
945 945
 		}
946 946
 		$check = ($sum % 103);
947 947
 		// add start, check and stop codes
@@ -951,10 +951,10 @@  discard block
 block discarded – undo
951 951
 		$len = strlen($code);
952 952
 		for ($i = 0; $i < $len; ++$i) {
953 953
 			$ck = strpos($keys, $code{$i});
954
-			if (($i == 0) OR ($i > ($len-4))) {
954
+			if (($i == 0) OR ($i > ($len - 4))) {
955 955
 				$char_num = ord($code{$i});
956 956
 				$seq = $chr[$char_num];
957
-			} elseif(($ck >= 0) AND isset($chr[$ck])) {
957
+			} elseif (($ck >= 0) AND isset($chr[$ck])) {
958 958
 					$seq = $chr[$ck];
959 959
 			} else {
960 960
 				// invalid character
@@ -985,7 +985,7 @@  discard block
 block discarded – undo
985 985
 	 * @return array barcode representation.
986 986
 	 * @access protected
987 987
 	 */
988
-	protected function barcode_eanupc($code, $len=13) {
988
+	protected function barcode_eanupc($code, $len = 13) {
989 989
 		$upce = false;
990 990
 		if ($len == 6) {
991 991
 			$len = 12; // UPC-A
@@ -997,21 +997,21 @@  discard block
 block discarded – undo
997 997
 		$code_len = strlen($code);
998 998
 		// calculate check digit
999 999
 		$sum_a = 0;
1000
-		for ($i = 1; $i < $data_len; $i+=2) {
1000
+		for ($i = 1; $i < $data_len; $i += 2) {
1001 1001
 			$sum_a += $code{$i};
1002 1002
 		}
1003 1003
 		if ($len > 12) {
1004 1004
 			$sum_a *= 3;
1005 1005
 		}
1006 1006
 		$sum_b = 0;
1007
-		for ($i = 0; $i < $data_len; $i+=2) {
1007
+		for ($i = 0; $i < $data_len; $i += 2) {
1008 1008
 			$sum_b += ($code{$i});
1009 1009
 		}
1010 1010
 		if ($len < 13) {
1011 1011
 			$sum_b *= 3;
1012 1012
 		}
1013 1013
 		$r = ($sum_a + $sum_b) % 10;
1014
-		if($r > 0) {
1014
+		if ($r > 0) {
1015 1015
 			$r = (10 - $r);
1016 1016
 		}
1017 1017
 		if ($code_len == $data_len) {
@@ -1086,41 +1086,41 @@  discard block
 block discarded – undo
1086 1086
 				'9'=>'1110100')
1087 1087
 		);
1088 1088
 		$parities = array(
1089
-			'0'=>array('A','A','A','A','A','A'),
1090
-			'1'=>array('A','A','B','A','B','B'),
1091
-			'2'=>array('A','A','B','B','A','B'),
1092
-			'3'=>array('A','A','B','B','B','A'),
1093
-			'4'=>array('A','B','A','A','B','B'),
1094
-			'5'=>array('A','B','B','A','A','B'),
1095
-			'6'=>array('A','B','B','B','A','A'),
1096
-			'7'=>array('A','B','A','B','A','B'),
1097
-			'8'=>array('A','B','A','B','B','A'),
1098
-			'9'=>array('A','B','B','A','B','A')
1089
+			'0'=>array('A', 'A', 'A', 'A', 'A', 'A'),
1090
+			'1'=>array('A', 'A', 'B', 'A', 'B', 'B'),
1091
+			'2'=>array('A', 'A', 'B', 'B', 'A', 'B'),
1092
+			'3'=>array('A', 'A', 'B', 'B', 'B', 'A'),
1093
+			'4'=>array('A', 'B', 'A', 'A', 'B', 'B'),
1094
+			'5'=>array('A', 'B', 'B', 'A', 'A', 'B'),
1095
+			'6'=>array('A', 'B', 'B', 'B', 'A', 'A'),
1096
+			'7'=>array('A', 'B', 'A', 'B', 'A', 'B'),
1097
+			'8'=>array('A', 'B', 'A', 'B', 'B', 'A'),
1098
+			'9'=>array('A', 'B', 'B', 'A', 'B', 'A')
1099 1099
 		);
1100 1100
 		$upce_parities = array();
1101 1101
 		$upce_parities[0] = array(
1102
-			'0'=>array('B','B','B','A','A','A'),
1103
-			'1'=>array('B','B','A','B','A','A'),
1104
-			'2'=>array('B','B','A','A','B','A'),
1105
-			'3'=>array('B','B','A','A','A','B'),
1106
-			'4'=>array('B','A','B','B','A','A'),
1107
-			'5'=>array('B','A','A','B','B','A'),
1108
-			'6'=>array('B','A','A','A','B','B'),
1109
-			'7'=>array('B','A','B','A','B','A'),
1110
-			'8'=>array('B','A','B','A','A','B'),
1111
-			'9'=>array('B','A','A','B','A','B')
1102
+			'0'=>array('B', 'B', 'B', 'A', 'A', 'A'),
1103
+			'1'=>array('B', 'B', 'A', 'B', 'A', 'A'),
1104
+			'2'=>array('B', 'B', 'A', 'A', 'B', 'A'),
1105
+			'3'=>array('B', 'B', 'A', 'A', 'A', 'B'),
1106
+			'4'=>array('B', 'A', 'B', 'B', 'A', 'A'),
1107
+			'5'=>array('B', 'A', 'A', 'B', 'B', 'A'),
1108
+			'6'=>array('B', 'A', 'A', 'A', 'B', 'B'),
1109
+			'7'=>array('B', 'A', 'B', 'A', 'B', 'A'),
1110
+			'8'=>array('B', 'A', 'B', 'A', 'A', 'B'),
1111
+			'9'=>array('B', 'A', 'A', 'B', 'A', 'B')
1112 1112
 		);
1113 1113
 		$upce_parities[1] = array(
1114
-			'0'=>array('A','A','A','B','B','B'),
1115
-			'1'=>array('A','A','B','A','B','B'),
1116
-			'2'=>array('A','A','B','B','A','B'),
1117
-			'3'=>array('A','A','B','B','B','A'),
1118
-			'4'=>array('A','B','A','A','B','B'),
1119
-			'5'=>array('A','B','B','A','A','B'),
1120
-			'6'=>array('A','B','B','B','A','A'),
1121
-			'7'=>array('A','B','A','B','A','B'),
1122
-			'8'=>array('A','B','A','B','B','A'),
1123
-			'9'=>array('A','B','B','A','B','A')
1114
+			'0'=>array('A', 'A', 'A', 'B', 'B', 'B'),
1115
+			'1'=>array('A', 'A', 'B', 'A', 'B', 'B'),
1116
+			'2'=>array('A', 'A', 'B', 'B', 'A', 'B'),
1117
+			'3'=>array('A', 'A', 'B', 'B', 'B', 'A'),
1118
+			'4'=>array('A', 'B', 'A', 'A', 'B', 'B'),
1119
+			'5'=>array('A', 'B', 'B', 'A', 'A', 'B'),
1120
+			'6'=>array('A', 'B', 'B', 'B', 'A', 'A'),
1121
+			'7'=>array('A', 'B', 'A', 'B', 'A', 'B'),
1122
+			'8'=>array('A', 'B', 'A', 'B', 'B', 'A'),
1123
+			'9'=>array('A', 'B', 'B', 'A', 'B', 'A')
1124 1124
 		);
1125 1125
 		$k = 0;
1126 1126
 		$seq = '101'; // left guard bar
@@ -1141,7 +1141,7 @@  discard block
 block discarded – undo
1141 1141
 			} else {
1142 1142
 				$p = $parities[$code{0}];
1143 1143
 				for ($i = 1; $i < $half_len; ++$i) {
1144
-					$seq .= $codes[$p[$i-1]][$code{$i}];
1144
+					$seq .= $codes[$p[$i - 1]][$code{$i}];
1145 1145
 				}
1146 1146
 			}
1147 1147
 			$seq .= '01010'; // center guard bar
@@ -1154,7 +1154,7 @@  discard block
 block discarded – undo
1154 1154
 		$w = 0;
1155 1155
 		for ($i = 0; $i < $clen; ++$i) {
1156 1156
 			$w += 1;
1157
-			if (($i == ($clen - 1)) OR (($i < ($clen - 1)) AND ($seq{$i} != $seq{($i+1)}))) {
1157
+			if (($i == ($clen - 1)) OR (($i < ($clen - 1)) AND ($seq{$i} != $seq{($i + 1)}))) {
1158 1158
 				if ($seq{$i} == '1') {
1159 1159
 					$t = true; // bar
1160 1160
 				} else {
@@ -1178,14 +1178,14 @@  discard block
 block discarded – undo
1178 1178
 	 * @return array barcode representation.
1179 1179
 	 * @access protected
1180 1180
 	 */
1181
-	protected function barcode_eanext($code, $len=5) {
1181
+	protected function barcode_eanext($code, $len = 5) {
1182 1182
 		//Padding
1183 1183
 		$code = str_pad($code, $len, '0', STR_PAD_LEFT);
1184 1184
 		// calculate check digit
1185 1185
 		if ($len == 2) {
1186 1186
 			$r = $code % 4;
1187 1187
 		} elseif ($len == 5) {
1188
-			$r = (3 * ($code{0} + $code{2} + $code{4})) + (9 * ($code{1} + $code{3}));
1188
+			$r = (3 * ($code{0} +$code{2} +$code{4})) + (9 * ($code{1} +$code{3}));
1189 1189
 			$r %= 10;
1190 1190
 		} else {
1191 1191
 			return false;
@@ -1217,22 +1217,22 @@  discard block
 block discarded – undo
1217 1217
 		);
1218 1218
 		$parities = array();
1219 1219
 		$parities[2] = array(
1220
-			'0'=>array('A','A'),
1221
-			'1'=>array('A','B'),
1222
-			'2'=>array('B','A'),
1223
-			'3'=>array('B','B')
1220
+			'0'=>array('A', 'A'),
1221
+			'1'=>array('A', 'B'),
1222
+			'2'=>array('B', 'A'),
1223
+			'3'=>array('B', 'B')
1224 1224
 		);
1225 1225
 		$parities[5] = array(
1226
-			'0'=>array('B','B','A','A','A'),
1227
-			'1'=>array('B','A','B','A','A'),
1228
-			'2'=>array('B','A','A','B','A'),
1229
-			'3'=>array('B','A','A','A','B'),
1230
-			'4'=>array('A','B','B','A','A'),
1231
-			'5'=>array('A','A','B','B','A'),
1232
-			'6'=>array('A','A','A','B','B'),
1233
-			'7'=>array('A','B','A','B','A'),
1234
-			'8'=>array('A','B','A','A','B'),
1235
-			'9'=>array('A','A','B','A','B')
1226
+			'0'=>array('B', 'B', 'A', 'A', 'A'),
1227
+			'1'=>array('B', 'A', 'B', 'A', 'A'),
1228
+			'2'=>array('B', 'A', 'A', 'B', 'A'),
1229
+			'3'=>array('B', 'A', 'A', 'A', 'B'),
1230
+			'4'=>array('A', 'B', 'B', 'A', 'A'),
1231
+			'5'=>array('A', 'A', 'B', 'B', 'A'),
1232
+			'6'=>array('A', 'A', 'A', 'B', 'B'),
1233
+			'7'=>array('A', 'B', 'A', 'B', 'A'),
1234
+			'8'=>array('A', 'B', 'A', 'A', 'B'),
1235
+			'9'=>array('A', 'A', 'B', 'A', 'B')
1236 1236
 		);
1237 1237
 		$p = $parities[$len][$r];
1238 1238
 		$seq = '1011'; // left guard bar
@@ -1253,33 +1253,33 @@  discard block
 block discarded – undo
1253 1253
 	 * @return array barcode representation.
1254 1254
 	 * @access protected
1255 1255
 	 */
1256
-	protected function barcode_postnet($code, $planet=false) {
1256
+	protected function barcode_postnet($code, $planet = false) {
1257 1257
 		// bar lenght
1258 1258
 		if ($planet) {
1259 1259
 			$barlen = Array(
1260
-				0 => Array(1,1,2,2,2),
1261
-				1 => Array(2,2,2,1,1),
1262
-				2 => Array(2,2,1,2,1),
1263
-				3 => Array(2,2,1,1,2),
1264
-				4 => Array(2,1,2,2,1),
1265
-				5 => Array(2,1,2,1,2),
1266
-				6 => Array(2,1,1,2,2),
1267
-				7 => Array(1,2,2,2,1),
1268
-				8 => Array(1,2,2,1,2),
1269
-				9 => Array(1,2,1,2,2)
1260
+				0 => Array(1, 1, 2, 2, 2),
1261
+				1 => Array(2, 2, 2, 1, 1),
1262
+				2 => Array(2, 2, 1, 2, 1),
1263
+				3 => Array(2, 2, 1, 1, 2),
1264
+				4 => Array(2, 1, 2, 2, 1),
1265
+				5 => Array(2, 1, 2, 1, 2),
1266
+				6 => Array(2, 1, 1, 2, 2),
1267
+				7 => Array(1, 2, 2, 2, 1),
1268
+				8 => Array(1, 2, 2, 1, 2),
1269
+				9 => Array(1, 2, 1, 2, 2)
1270 1270
 			);
1271 1271
 		} else {
1272 1272
 			$barlen = Array(
1273
-				0 => Array(2,2,1,1,1),
1274
-				1 => Array(1,1,1,2,2),
1275
-				2 => Array(1,1,2,1,2),
1276
-				3 => Array(1,1,2,2,1),
1277
-				4 => Array(1,2,1,1,2),
1278
-				5 => Array(1,2,1,2,1),
1279
-				6 => Array(1,2,2,1,1),
1280
-				7 => Array(2,1,1,1,2),
1281
-				8 => Array(2,1,1,2,1),
1282
-				9 => Array(2,1,2,1,1)
1273
+				0 => Array(2, 2, 1, 1, 1),
1274
+				1 => Array(1, 1, 1, 2, 2),
1275
+				2 => Array(1, 1, 2, 1, 2),
1276
+				3 => Array(1, 1, 2, 2, 1),
1277
+				4 => Array(1, 2, 1, 1, 2),
1278
+				5 => Array(1, 2, 1, 2, 1),
1279
+				6 => Array(1, 2, 2, 1, 1),
1280
+				7 => Array(2, 1, 1, 1, 2),
1281
+				8 => Array(2, 1, 1, 2, 1),
1282
+				9 => Array(2, 1, 2, 1, 1)
1283 1283
 			);
1284 1284
 		}
1285 1285
 		$bararray = array('code' => $code, 'maxw' => 0, 'maxh' => 2, 'bcode' => array());
@@ -1293,7 +1293,7 @@  discard block
 block discarded – undo
1293 1293
 			$sum += intval($code{$i});
1294 1294
 		}
1295 1295
 		$chkd = ($sum % 10);
1296
-		if($chkd > 0) {
1296
+		if ($chkd > 0) {
1297 1297
 			$chkd = (10 - $chkd);
1298 1298
 		}
1299 1299
 		$code .= $chkd;
@@ -1326,50 +1326,50 @@  discard block
 block discarded – undo
1326 1326
 	 * @return array barcode representation.
1327 1327
 	 * @access protected
1328 1328
 	 */
1329
-	protected function barcode_rms4cc($code, $kix=false) {
1330
-		$notkix = !$kix;
1329
+	protected function barcode_rms4cc($code, $kix = false) {
1330
+		$notkix = ! $kix;
1331 1331
 		// bar mode
1332 1332
 		// 1 = pos 1, length 2
1333 1333
 		// 2 = pos 1, length 3
1334 1334
 		// 3 = pos 2, length 1
1335 1335
 		// 4 = pos 2, length 2
1336 1336
 		$barmode = array(
1337
-			'0' => array(3,3,2,2),
1338
-			'1' => array(3,4,1,2),
1339
-			'2' => array(3,4,2,1),
1340
-			'3' => array(4,3,1,2),
1341
-			'4' => array(4,3,2,1),
1342
-			'5' => array(4,4,1,1),
1343
-			'6' => array(3,1,4,2),
1344
-			'7' => array(3,2,3,2),
1345
-			'8' => array(3,2,4,1),
1346
-			'9' => array(4,1,3,2),
1347
-			'A' => array(4,1,4,1),
1348
-			'B' => array(4,2,3,1),
1349
-			'C' => array(3,1,2,4),
1350
-			'D' => array(3,2,1,4),
1351
-			'E' => array(3,2,2,3),
1352
-			'F' => array(4,1,1,4),
1353
-			'G' => array(4,1,2,3),
1354
-			'H' => array(4,2,1,3),
1355
-			'I' => array(1,3,4,2),
1356
-			'J' => array(1,4,3,2),
1357
-			'K' => array(1,4,4,1),
1358
-			'L' => array(2,3,3,2),
1359
-			'M' => array(2,3,4,1),
1360
-			'N' => array(2,4,3,1),
1361
-			'O' => array(1,3,2,4),
1362
-			'P' => array(1,4,1,4),
1363
-			'Q' => array(1,4,2,3),
1364
-			'R' => array(2,3,1,4),
1365
-			'S' => array(2,3,2,3),
1366
-			'T' => array(2,4,1,3),
1367
-			'U' => array(1,1,4,4),
1368
-			'V' => array(1,2,3,4),
1369
-			'W' => array(1,2,4,3),
1370
-			'X' => array(2,1,3,4),
1371
-			'Y' => array(2,1,4,3),
1372
-			'Z' => array(2,2,3,3)
1337
+			'0' => array(3, 3, 2, 2),
1338
+			'1' => array(3, 4, 1, 2),
1339
+			'2' => array(3, 4, 2, 1),
1340
+			'3' => array(4, 3, 1, 2),
1341
+			'4' => array(4, 3, 2, 1),
1342
+			'5' => array(4, 4, 1, 1),
1343
+			'6' => array(3, 1, 4, 2),
1344
+			'7' => array(3, 2, 3, 2),
1345
+			'8' => array(3, 2, 4, 1),
1346
+			'9' => array(4, 1, 3, 2),
1347
+			'A' => array(4, 1, 4, 1),
1348
+			'B' => array(4, 2, 3, 1),
1349
+			'C' => array(3, 1, 2, 4),
1350
+			'D' => array(3, 2, 1, 4),
1351
+			'E' => array(3, 2, 2, 3),
1352
+			'F' => array(4, 1, 1, 4),
1353
+			'G' => array(4, 1, 2, 3),
1354
+			'H' => array(4, 2, 1, 3),
1355
+			'I' => array(1, 3, 4, 2),
1356
+			'J' => array(1, 4, 3, 2),
1357
+			'K' => array(1, 4, 4, 1),
1358
+			'L' => array(2, 3, 3, 2),
1359
+			'M' => array(2, 3, 4, 1),
1360
+			'N' => array(2, 4, 3, 1),
1361
+			'O' => array(1, 3, 2, 4),
1362
+			'P' => array(1, 4, 1, 4),
1363
+			'Q' => array(1, 4, 2, 3),
1364
+			'R' => array(2, 3, 1, 4),
1365
+			'S' => array(2, 3, 2, 3),
1366
+			'T' => array(2, 4, 1, 3),
1367
+			'U' => array(1, 1, 4, 4),
1368
+			'V' => array(1, 2, 3, 4),
1369
+			'W' => array(1, 2, 4, 3),
1370
+			'X' => array(2, 1, 3, 4),
1371
+			'Y' => array(2, 1, 4, 3),
1372
+			'Z' => array(2, 2, 3, 3)
1373 1373
 		);
1374 1374
 		$code = strtoupper($code);
1375 1375
 		$len = strlen($code);
@@ -1377,42 +1377,42 @@  discard block
 block discarded – undo
1377 1377
 		if ($notkix) {
1378 1378
 			// table for checksum calculation (row,col)
1379 1379
 			$checktable = array(
1380
-				'0' => array(1,1),
1381
-				'1' => array(1,2),
1382
-				'2' => array(1,3),
1383
-				'3' => array(1,4),
1384
-				'4' => array(1,5),
1385
-				'5' => array(1,0),
1386
-				'6' => array(2,1),
1387
-				'7' => array(2,2),
1388
-				'8' => array(2,3),
1389
-				'9' => array(2,4),
1390
-				'A' => array(2,5),
1391
-				'B' => array(2,0),
1392
-				'C' => array(3,1),
1393
-				'D' => array(3,2),
1394
-				'E' => array(3,3),
1395
-				'F' => array(3,4),
1396
-				'G' => array(3,5),
1397
-				'H' => array(3,0),
1398
-				'I' => array(4,1),
1399
-				'J' => array(4,2),
1400
-				'K' => array(4,3),
1401
-				'L' => array(4,4),
1402
-				'M' => array(4,5),
1403
-				'N' => array(4,0),
1404
-				'O' => array(5,1),
1405
-				'P' => array(5,2),
1406
-				'Q' => array(5,3),
1407
-				'R' => array(5,4),
1408
-				'S' => array(5,5),
1409
-				'T' => array(5,0),
1410
-				'U' => array(0,1),
1411
-				'V' => array(0,2),
1412
-				'W' => array(0,3),
1413
-				'X' => array(0,4),
1414
-				'Y' => array(0,5),
1415
-				'Z' => array(0,0)
1380
+				'0' => array(1, 1),
1381
+				'1' => array(1, 2),
1382
+				'2' => array(1, 3),
1383
+				'3' => array(1, 4),
1384
+				'4' => array(1, 5),
1385
+				'5' => array(1, 0),
1386
+				'6' => array(2, 1),
1387
+				'7' => array(2, 2),
1388
+				'8' => array(2, 3),
1389
+				'9' => array(2, 4),
1390
+				'A' => array(2, 5),
1391
+				'B' => array(2, 0),
1392
+				'C' => array(3, 1),
1393
+				'D' => array(3, 2),
1394
+				'E' => array(3, 3),
1395
+				'F' => array(3, 4),
1396
+				'G' => array(3, 5),
1397
+				'H' => array(3, 0),
1398
+				'I' => array(4, 1),
1399
+				'J' => array(4, 2),
1400
+				'K' => array(4, 3),
1401
+				'L' => array(4, 4),
1402
+				'M' => array(4, 5),
1403
+				'N' => array(4, 0),
1404
+				'O' => array(5, 1),
1405
+				'P' => array(5, 2),
1406
+				'Q' => array(5, 3),
1407
+				'R' => array(5, 4),
1408
+				'S' => array(5, 5),
1409
+				'T' => array(5, 0),
1410
+				'U' => array(0, 1),
1411
+				'V' => array(0, 2),
1412
+				'W' => array(0, 3),
1413
+				'X' => array(0, 4),
1414
+				'Y' => array(0, 5),
1415
+				'Z' => array(0, 0)
1416 1416
 			);
1417 1417
 			$row = 0;
1418 1418
 			$col = 0;
@@ -1422,7 +1422,7 @@  discard block
 block discarded – undo
1422 1422
 			}
1423 1423
 			$row %= 6;
1424 1424
 			$col %= 6;
1425
-			$chk = array_keys($checktable, array($row,$col));
1425
+			$chk = array_keys($checktable, array($row, $col));
1426 1426
 			$code .= $chk[0];
1427 1427
 			++$len;
1428 1428
 		}
@@ -1507,7 +1507,7 @@  discard block
 block discarded – undo
1507 1507
 		$code = 'A'.strtoupper($code).'A';
1508 1508
 		$len = strlen($code);
1509 1509
 		for ($i = 0; $i < $len; ++$i) {
1510
-			if (!isset($chr[$code{$i}])) {
1510
+			if ( ! isset($chr[$code{$i}])) {
1511 1511
 				return false;
1512 1512
 			}
1513 1513
 			$seq = $chr[$code{$i}];
@@ -1599,7 +1599,7 @@  discard block
 block discarded – undo
1599 1599
 		$code = 'S'.$code.'S';
1600 1600
 		$len += 3;
1601 1601
 		for ($i = 0; $i < $len; ++$i) {
1602
-			if (!isset($chr[$code{$i}])) {
1602
+			if ( ! isset($chr[$code{$i}])) {
1603 1603
 				return false;
1604 1604
 			}
1605 1605
 			$seq = $chr[$code{$i}];
@@ -1672,7 +1672,7 @@  discard block
 block discarded – undo
1672 1672
 					break;
1673 1673
 				}
1674 1674
 			}
1675
-		} while($code != 0);
1675
+		} while ($code != 0);
1676 1676
 		$seq = strrev($seq);
1677 1677
 		$k = 0;
1678 1678
 		$bararray = array('code' => $code, 'maxw' => 0, 'maxh' => 2, 'bcode' => array());
@@ -1715,10 +1715,10 @@  discard block
 block discarded – undo
1715 1715
 	 * @access protected
1716 1716
 	 */
1717 1717
 	protected function barcode_imb($code) {
1718
-		$asc_chr = array(4,0,2,6,3,5,1,9,8,7,1,2,0,6,4,8,2,9,5,3,0,1,3,7,4,6,8,9,2,0,5,1,9,4,3,8,6,7,1,2,4,3,9,5,7,8,3,0,2,1,4,0,9,1,7,0,2,4,6,3,7,1,9,5,8);
1719
-		$dsc_chr = array(7,1,9,5,8,0,2,4,6,3,5,8,9,7,3,0,6,1,7,4,6,8,9,2,5,1,7,5,4,3,8,7,6,0,2,5,4,9,3,0,1,6,8,2,0,4,5,9,6,7,5,2,6,3,8,5,1,9,8,7,4,0,2,6,3);
1720
-		$asc_pos = array(3,0,8,11,1,12,8,11,10,6,4,12,2,7,9,6,7,9,2,8,4,0,12,7,10,9,0,7,10,5,7,9,6,8,2,12,1,4,2,0,1,5,4,6,12,1,0,9,4,7,5,10,2,6,9,11,2,12,6,7,5,11,0,3,2);
1721
-		$dsc_pos = array(2,10,12,5,9,1,5,4,3,9,11,5,10,1,6,3,4,1,10,0,2,11,8,6,1,12,3,8,6,4,4,11,0,6,1,9,11,5,3,7,3,10,7,11,8,2,10,3,5,8,0,3,12,11,8,4,5,1,3,0,7,12,9,8,10);
1718
+		$asc_chr = array(4, 0, 2, 6, 3, 5, 1, 9, 8, 7, 1, 2, 0, 6, 4, 8, 2, 9, 5, 3, 0, 1, 3, 7, 4, 6, 8, 9, 2, 0, 5, 1, 9, 4, 3, 8, 6, 7, 1, 2, 4, 3, 9, 5, 7, 8, 3, 0, 2, 1, 4, 0, 9, 1, 7, 0, 2, 4, 6, 3, 7, 1, 9, 5, 8);
1719
+		$dsc_chr = array(7, 1, 9, 5, 8, 0, 2, 4, 6, 3, 5, 8, 9, 7, 3, 0, 6, 1, 7, 4, 6, 8, 9, 2, 5, 1, 7, 5, 4, 3, 8, 7, 6, 0, 2, 5, 4, 9, 3, 0, 1, 6, 8, 2, 0, 4, 5, 9, 6, 7, 5, 2, 6, 3, 8, 5, 1, 9, 8, 7, 4, 0, 2, 6, 3);
1720
+		$asc_pos = array(3, 0, 8, 11, 1, 12, 8, 11, 10, 6, 4, 12, 2, 7, 9, 6, 7, 9, 2, 8, 4, 0, 12, 7, 10, 9, 0, 7, 10, 5, 7, 9, 6, 8, 2, 12, 1, 4, 2, 0, 1, 5, 4, 6, 12, 1, 0, 9, 4, 7, 5, 10, 2, 6, 9, 11, 2, 12, 6, 7, 5, 11, 0, 3, 2);
1721
+		$dsc_pos = array(2, 10, 12, 5, 9, 1, 5, 4, 3, 9, 11, 5, 10, 1, 6, 3, 4, 1, 10, 0, 2, 11, 8, 6, 1, 12, 3, 8, 6, 4, 4, 11, 0, 6, 1, 9, 11, 5, 3, 7, 3, 10, 7, 11, 8, 2, 10, 3, 5, 8, 0, 3, 12, 11, 8, 4, 5, 1, 3, 0, 7, 12, 9, 8, 10);
1722 1722
 		$code_arr = explode('-', $code);
1723 1723
 		$tracking_number = $code_arr[0];
1724 1724
 		if (isset($code_arr[1])) {
@@ -1786,7 +1786,7 @@  discard block
 block discarded – undo
1786 1786
 		// convert codewords to characters
1787 1787
 		$characters = array();
1788 1788
 		$bitmask = 512;
1789
-		foreach($codewords as $k => $val) {
1789
+		foreach ($codewords as $k => $val) {
1790 1790
 			if ($val <= 1286) {
1791 1791
 				$chrcode = $table5of13[$val];
1792 1792
 			} else {
@@ -1841,11 +1841,11 @@  discard block
 block discarded – undo
1841 1841
 	public function dec_to_hex($number) {
1842 1842
 		$i = 0;
1843 1843
 		$hex = array();
1844
-		if($number == 0) {
1844
+		if ($number == 0) {
1845 1845
 			return '00';
1846 1846
 		}
1847
-		while($number > 0) {
1848
-			if($number == 0) {
1847
+		while ($number > 0) {
1848
+			if ($number == 0) {
1849 1849
 				array_push($hex, '0');
1850 1850
 			} else {
1851 1851
 				array_push($hex, strtoupper(dechex(bcmod($number, '16'))));
@@ -1866,7 +1866,7 @@  discard block
 block discarded – undo
1866 1866
 		$dec = 0;
1867 1867
 		$bitval = 1;
1868 1868
 		$len = strlen($hex);
1869
-		for($pos = ($len - 1); $pos >= 0; --$pos) {
1869
+		for ($pos = ($len - 1); $pos >= 0; --$pos) {
1870 1870
 			$dec = bcadd($dec, bcmul(hexdec($hex{$pos}), $bitval));
1871 1871
 			$bitval = bcmul($bitval, 16);
1872 1872
 		}
Please login to merge, or discard this patch.
app/Vendor/PHPExcel/PHPExcel/Shared/PDF/fonts/utils/makefont.php 2 patches
Doc Comments   +10 added lines patch added patch discarded remove patch
@@ -236,6 +236,8 @@  discard block
 block discarded – undo
236 236
 
237 237
 /**
238 238
  * Read UFM file
239
+ * @param string $file
240
+ * @param string $cidtogidmap
239 241
  */
240 242
 function ReadUFM($file, &$cidtogidmap) {
241 243
 	//Prepare empty CIDToGIDMap
@@ -311,6 +313,7 @@  discard block
 block discarded – undo
311 313
 
312 314
 /**
313 315
  * Read AFM file
316
+ * @param string $file
314 317
  */
315 318
 function ReadAFM($file,&$map) {
316 319
 	//Read a font metric file
@@ -528,6 +531,10 @@  discard block
 block discarded – undo
528 531
 	return rtrim($s);
529 532
 }
530 533
 
534
+/**
535
+ * @param string $file
536
+ * @param string $s
537
+ */
531 538
 function SaveToFile($file, $s, $mode='t') {
532 539
 	$f = fopen($file, 'w'.$mode);
533 540
 	if(!$f) {
@@ -547,6 +554,9 @@  discard block
 block discarded – undo
547 554
 	return $a['N'];
548 555
 }
549 556
 
557
+/**
558
+ * @param string $file
559
+ */
550 560
 function CheckTTF($file) {
551 561
 	//Check if font license allows embedding
552 562
 	$f = fopen($file, 'rb');
Please login to merge, or discard this patch.
Spacing   +91 added lines, -91 removed lines patch added patch discarded remove patch
@@ -57,14 +57,14 @@  discard block
 block discarded – undo
57 57
  * @param string $enc Name of the encoding table to use. Omit this parameter for TrueType Unicode, OpenType Unicode and symbolic fonts like Symbol or ZapfDingBats.
58 58
  * @param array $patch Optional modification of the encoding
59 59
  */
60
-function MakeFont($fontfile, $fmfile, $embedded=true, $enc='cp1252', $patch=array()) {
60
+function MakeFont($fontfile, $fmfile, $embedded = true, $enc = 'cp1252', $patch = array()) {
61 61
 	//Generate a font definition file
62 62
 	set_magic_quotes_runtime(0);
63 63
 	ini_set('auto_detect_line_endings', '1');
64
-	if (!file_exists($fontfile)) {
64
+	if ( ! file_exists($fontfile)) {
65 65
 		die('Error: file not found: '.$fontfile);
66 66
 	}
67
-	if (!file_exists($fmfile)) {
67
+	if ( ! file_exists($fmfile)) {
68 68
 		die('Error: file not found: '.$fmfile);
69 69
 	}
70 70
 	$cidtogidmap = '';
@@ -111,10 +111,10 @@  discard block
 block discarded – undo
111 111
 	$s .= '$type=\''.$type."';\n";
112 112
 	$s .= '$name=\''.$fm['FontName']."';\n";
113 113
 	$s .= '$desc='.$fd.";\n";
114
-	if (!isset($fm['UnderlinePosition'])) {
114
+	if ( ! isset($fm['UnderlinePosition'])) {
115 115
 		$fm['UnderlinePosition'] = -100;
116 116
 	}
117
-	if (!isset($fm['UnderlineThickness'])) {
117
+	if ( ! isset($fm['UnderlineThickness'])) {
118 118
 		$fm['UnderlineThickness'] = 50;
119 119
 	}
120 120
 	$s .= '$up='.$fm['UnderlinePosition'].";\n";
@@ -138,8 +138,8 @@  discard block
 block discarded – undo
138 138
 		if (($type == 'TrueType') OR ($type == 'TrueTypeUnicode')) {
139 139
 			CheckTTF($fontfile);
140 140
 		}
141
-		$f = fopen($fontfile,'rb');
142
-		if (!$f) {
141
+		$f = fopen($fontfile, 'rb');
142
+		if ( ! $f) {
143 143
 			die('Error: Unable to open '.$fontfile);
144 144
 		}
145 145
 		$file = fread($f, filesize($fontfile));
@@ -152,16 +152,16 @@  discard block
 block discarded – undo
152 152
 				$file = substr($file, 6);
153 153
 			}
154 154
 			$pos = strpos($file, 'eexec');
155
-			if (!$pos) {
155
+			if ( ! $pos) {
156 156
 				die('Error: font file does not seem to be valid Type1');
157 157
 			}
158 158
 			$size1 = $pos + 6;
159 159
 			if ($header AND (ord($file{$size1}) == 128)) {
160 160
 				//Strip second binary header
161
-				$file = substr($file, 0, $size1).substr($file, $size1+6);
161
+				$file = substr($file, 0, $size1).substr($file, $size1 + 6);
162 162
 			}
163 163
 			$pos = strpos($file, '00000000');
164
-			if (!$pos) {
164
+			if ( ! $pos) {
165 165
 				die('Error: font file does not seem to be valid Type1');
166 166
 			}
167 167
 			$size2 = $pos - $size1;
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
 			SaveToFile($cmp, gzcompress($file, 9), 'b');
174 174
 			$s .= '$file=\''.$cmp."';\n";
175 175
 			print "Font file compressed (".$cmp.")\n";
176
-			if (!empty($cidtogidmap)) {
176
+			if ( ! empty($cidtogidmap)) {
177 177
 				$cmp = $basename.'.ctg.z';
178 178
 				SaveToFile($cmp, gzcompress($cidtogidmap, 9), 'b');
179 179
 				print "CIDToGIDMap created and compressed (".$cmp.")\n";
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
 		} else {
183 183
 			$s .= '$file=\''.basename($fontfile)."';\n";
184 184
 			print "Notice: font file could not be compressed (zlib extension not available)\n";
185
-			if (!empty($cidtogidmap)) {
185
+			if ( ! empty($cidtogidmap)) {
186 186
 				$cmp = $basename.'.ctg';
187 187
 				$f = fopen($cmp, 'wb');
188 188
 				fwrite($f, $cidtogidmap);
@@ -191,18 +191,18 @@  discard block
 block discarded – undo
191 191
 				$s .= '$ctg=\''.$cmp."';\n";
192 192
 			}
193 193
 		}
194
-		if($type == 'Type1') {
194
+		if ($type == 'Type1') {
195 195
 			$s .= '$size1='.$size1.";\n";
196 196
 			$s .= '$size2='.$size2.";\n";
197 197
 		} else {
198
-			$s.='$originalsize='.filesize($fontfile).";\n";
198
+			$s .= '$originalsize='.filesize($fontfile).";\n";
199 199
 		}
200 200
 	} else {
201 201
 		//Not embedded font
202 202
 		$s .= '$file='."'';\n";
203 203
 	}
204 204
 	$s .= '// --- EOF ---';
205
-	SaveToFile($basename.'.php',$s);
205
+	SaveToFile($basename.'.php', $s);
206 206
 	print "Font definition file generated (".$basename.".php)\n";
207 207
 }
208 208
 
@@ -220,14 +220,14 @@  discard block
 block discarded – undo
220 220
 	$cc2gn = array();
221 221
 	foreach ($a as $l) {
222 222
 		if ($l{0} == '!') {
223
-			$e = preg_split('/[ \\t]+/',rtrim($l));
224
-			$cc = hexdec(substr($e[0],1));
223
+			$e = preg_split('/[ \\t]+/', rtrim($l));
224
+			$cc = hexdec(substr($e[0], 1));
225 225
 			$gn = $e[2];
226 226
 			$cc2gn[$cc] = $gn;
227 227
 		}
228 228
 	}
229
-	for($i = 0; $i <= 255; $i++) {
230
-		if(!isset($cc2gn[$i])) {
229
+	for ($i = 0; $i <= 255; $i++) {
230
+		if ( ! isset($cc2gn[$i])) {
231 231
 			$cc2gn[$i] = '.notdef';
232 232
 		}
233 233
 	}
@@ -247,23 +247,23 @@  discard block
 block discarded – undo
247 247
 	}
248 248
 	$widths = array();
249 249
 	$fm = array();
250
-	foreach($a as $l) {
251
-		$e = explode(' ',chop($l));
252
-		if(count($e) < 2) {
250
+	foreach ($a as $l) {
251
+		$e = explode(' ', chop($l));
252
+		if (count($e) < 2) {
253 253
 			continue;
254 254
 		}
255 255
 		$code = $e[0];
256 256
 		$param = $e[1];
257
-		if($code == 'U') {
257
+		if ($code == 'U') {
258 258
 			// U 827 ; WX 0 ; N squaresubnosp ; G 675 ;
259 259
 			//Character metrics
260
-			$cc = (int)$e[1];
260
+			$cc = (int) $e[1];
261 261
 			if ($cc != -1) {
262 262
 			$gn = $e[7];
263 263
 			$w = $e[4];
264 264
 			$glyph = $e[10];
265 265
 			$widths[$cc] = $w;
266
-			if($cc == ord('X')) {
266
+			if ($cc == ord('X')) {
267 267
 				$fm['CapXHeight'] = $e[13];
268 268
 			}
269 269
 			// Set GID
@@ -272,37 +272,37 @@  discard block
 block discarded – undo
272 272
 				$cidtogidmap{(($cc * 2) + 1)} = chr($glyph & 0xFF);
273 273
 			}
274 274
 		}
275
-		if((isset($gn) AND ($gn == '.notdef')) AND (!isset($fm['MissingWidth']))) {
275
+		if ((isset($gn) AND ($gn == '.notdef')) AND ( ! isset($fm['MissingWidth']))) {
276 276
 			$fm['MissingWidth'] = $w;
277 277
 		}
278
-		} elseif($code == 'FontName') {
278
+		} elseif ($code == 'FontName') {
279 279
 			$fm['FontName'] = $param;
280
-		} elseif($code == 'Weight') {
280
+		} elseif ($code == 'Weight') {
281 281
 			$fm['Weight'] = $param;
282
-		} elseif($code == 'ItalicAngle') {
283
-			$fm['ItalicAngle'] = (double)$param;
284
-		} elseif($code == 'Ascender') {
285
-			$fm['Ascender'] = (int)$param;
286
-		} elseif($code == 'Descender') {
287
-			$fm['Descender'] = (int)$param;
288
-		} elseif($code == 'UnderlineThickness') {
289
-			$fm['UnderlineThickness'] = (int)$param;
290
-		} elseif($code == 'UnderlinePosition') {
291
-			$fm['UnderlinePosition'] = (int)$param;
292
-		} elseif($code == 'IsFixedPitch') {
282
+		} elseif ($code == 'ItalicAngle') {
283
+			$fm['ItalicAngle'] = (double) $param;
284
+		} elseif ($code == 'Ascender') {
285
+			$fm['Ascender'] = (int) $param;
286
+		} elseif ($code == 'Descender') {
287
+			$fm['Descender'] = (int) $param;
288
+		} elseif ($code == 'UnderlineThickness') {
289
+			$fm['UnderlineThickness'] = (int) $param;
290
+		} elseif ($code == 'UnderlinePosition') {
291
+			$fm['UnderlinePosition'] = (int) $param;
292
+		} elseif ($code == 'IsFixedPitch') {
293 293
 			$fm['IsFixedPitch'] = ($param == 'true');
294
-		} elseif($code == 'FontBBox') {
294
+		} elseif ($code == 'FontBBox') {
295 295
 			$fm['FontBBox'] = array($e[1], $e[2], $e[3], $e[4]);
296
-		} elseif($code == 'CapHeight') {
297
-			$fm['CapHeight'] = (int)$param;
298
-		} elseif($code == 'StdVW') {
299
-			$fm['StdVW'] = (int)$param;
296
+		} elseif ($code == 'CapHeight') {
297
+			$fm['CapHeight'] = (int) $param;
298
+		} elseif ($code == 'StdVW') {
299
+			$fm['StdVW'] = (int) $param;
300 300
 		}
301 301
 	}
302
-	if(!isset($fm['MissingWidth'])) {
302
+	if ( ! isset($fm['MissingWidth'])) {
303 303
 		$fm['MissingWidth'] = 600;
304 304
 	}
305
-	if(!isset($fm['FontName'])) {
305
+	if ( ! isset($fm['FontName'])) {
306 306
 		die('FontName not found');
307 307
 	}
308 308
 	$fm['Widths'] = $widths;
@@ -312,10 +312,10 @@  discard block
 block discarded – undo
312 312
 /**
313 313
  * Read AFM file
314 314
  */
315
-function ReadAFM($file,&$map) {
315
+function ReadAFM($file, &$map) {
316 316
 	//Read a font metric file
317 317
 	$a = file($file);
318
-	if(empty($a)) {
318
+	if (empty($a)) {
319 319
 		die('File not found');
320 320
 	}
321 321
 	$widths = array();
@@ -355,7 +355,7 @@  discard block
 block discarded – undo
355 355
 		'combiningdotbelow'=>'dotbelowcomb',
356 356
 		'dongsign'=>'dong'
357 357
 		);
358
-	foreach($a as $l) {
358
+	foreach ($a as $l) {
359 359
 		$e = explode(' ', rtrim($l));
360 360
 		if (count($e) < 2) {
361 361
 			continue;
@@ -364,7 +364,7 @@  discard block
 block discarded – undo
364 364
 		$param = $e[1];
365 365
 		if ($code == 'C') {
366 366
 			//Character metrics
367
-			$cc = (int)$e[1];
367
+			$cc = (int) $e[1];
368 368
 			$w = $e[4];
369 369
 			$gn = $e[7];
370 370
 			if (substr($gn, -4) == '20AC') {
@@ -383,50 +383,50 @@  discard block
 block discarded – undo
383 383
 				$widths[$cc] = $w;
384 384
 			} else {
385 385
 				$widths[$gn] = $w;
386
-				if($gn == 'X') {
386
+				if ($gn == 'X') {
387 387
 					$fm['CapXHeight'] = $e[13];
388 388
 				}
389 389
 			}
390
-			if($gn == '.notdef') {
390
+			if ($gn == '.notdef') {
391 391
 				$fm['MissingWidth'] = $w;
392 392
 			}
393
-		} elseif($code == 'FontName') {
393
+		} elseif ($code == 'FontName') {
394 394
 			$fm['FontName'] = $param;
395
-		} elseif($code == 'Weight') {
395
+		} elseif ($code == 'Weight') {
396 396
 			$fm['Weight'] = $param;
397
-		} elseif($code == 'ItalicAngle') {
398
-			$fm['ItalicAngle'] = (double)$param;
399
-		} elseif($code == 'Ascender') {
400
-			$fm['Ascender'] = (int)$param;
401
-		} elseif($code == 'Descender') {
402
-			$fm['Descender'] = (int)$param;
403
-		} elseif($code == 'UnderlineThickness') {
404
-			$fm['UnderlineThickness'] = (int)$param;
405
-		} elseif($code == 'UnderlinePosition') {
406
-			$fm['UnderlinePosition'] = (int)$param;
407
-		} elseif($code == 'IsFixedPitch') {
397
+		} elseif ($code == 'ItalicAngle') {
398
+			$fm['ItalicAngle'] = (double) $param;
399
+		} elseif ($code == 'Ascender') {
400
+			$fm['Ascender'] = (int) $param;
401
+		} elseif ($code == 'Descender') {
402
+			$fm['Descender'] = (int) $param;
403
+		} elseif ($code == 'UnderlineThickness') {
404
+			$fm['UnderlineThickness'] = (int) $param;
405
+		} elseif ($code == 'UnderlinePosition') {
406
+			$fm['UnderlinePosition'] = (int) $param;
407
+		} elseif ($code == 'IsFixedPitch') {
408 408
 			$fm['IsFixedPitch'] = ($param == 'true');
409
-		} elseif($code == 'FontBBox') {
409
+		} elseif ($code == 'FontBBox') {
410 410
 			$fm['FontBBox'] = array($e[1], $e[2], $e[3], $e[4]);
411
-		} elseif($code == 'CapHeight') {
412
-			$fm['CapHeight'] = (int)$param;
413
-		} elseif($code == 'StdVW') {
414
-			$fm['StdVW'] = (int)$param;
411
+		} elseif ($code == 'CapHeight') {
412
+			$fm['CapHeight'] = (int) $param;
413
+		} elseif ($code == 'StdVW') {
414
+			$fm['StdVW'] = (int) $param;
415 415
 		}
416 416
 	}
417
-	if (!isset($fm['FontName'])) {
417
+	if ( ! isset($fm['FontName'])) {
418 418
 		die('FontName not found');
419 419
 	}
420
-	if (!empty($map)) {
421
-		if (!isset($widths['.notdef'])) {
420
+	if ( ! empty($map)) {
421
+		if ( ! isset($widths['.notdef'])) {
422 422
 			$widths['.notdef'] = 600;
423 423
 		}
424
-		if (!isset($widths['Delta']) AND isset($widths['increment'])) {
424
+		if ( ! isset($widths['Delta']) AND isset($widths['increment'])) {
425 425
 			$widths['Delta'] = $widths['increment'];
426 426
 		}
427 427
 		//Order widths according to map
428 428
 		for ($i = 0; $i <= 255; $i++) {
429
-			if (!isset($widths[$map[$i]])) {
429
+			if ( ! isset($widths[$map[$i]])) {
430 430
 				print "Warning: character ".$map[$i]." is missing\n";
431 431
 				$widths[$i] = $widths['.notdef'];
432 432
 			} else {
@@ -438,7 +438,7 @@  discard block
 block discarded – undo
438 438
 	return $fm;
439 439
 }
440 440
 
441
-function MakeFontDescriptor($fm, $symbolic=false) {
441
+function MakeFontDescriptor($fm, $symbolic = false) {
442 442
 	//Ascent
443 443
 	$asc = (isset($fm['Ascender']) ? $fm['Ascender'] : 1000);
444 444
 	$fd = "array('Ascent'=>".$asc;
@@ -457,15 +457,15 @@  discard block
 block discarded – undo
457 457
 	//Flags
458 458
 	$flags = 0;
459 459
 	if (isset($fm['IsFixedPitch']) AND $fm['IsFixedPitch']) {
460
-		$flags += 1<<0;
460
+		$flags += 1 << 0;
461 461
 	}
462 462
 	if ($symbolic) {
463
-		$flags += 1<<2;
463
+		$flags += 1 << 2;
464 464
 	} else {
465
-		$flags += 1<<5;
465
+		$flags += 1 << 5;
466 466
 	}
467 467
 	if (isset($fm['ItalicAngle']) AND ($fm['ItalicAngle'] != 0)) {
468
-		$flags += 1<<6;
468
+		$flags += 1 << 6;
469 469
 	}
470 470
 	$fd .= ",'Flags'=>".$flags;
471 471
 	//FontBBox
@@ -488,7 +488,7 @@  discard block
 block discarded – undo
488 488
 	}
489 489
 	$fd .= ",'StemV'=>".$stemv;
490 490
 	//MissingWidth
491
-	if(isset($fm['MissingWidth'])) {
491
+	if (isset($fm['MissingWidth'])) {
492 492
 		$fd .= ",'MissingWidth'=>".$fm['MissingWidth'];
493 493
 	}
494 494
 	$fd .= ')';
@@ -503,7 +503,7 @@  discard block
 block discarded – undo
503 503
 	$c = 0;
504 504
 	foreach ($cw as $i => $w) {
505 505
 		if (is_numeric($i)) {
506
-			$els[] = (((($c++)%10) == 0) ? "\n" : '').$i.'=>'.$w;
506
+			$els[] = (((($c++) % 10) == 0) ? "\n" : '').$i.'=>'.$w;
507 507
 		}
508 508
 	}
509 509
 	$s .= implode(',', $els);
@@ -518,7 +518,7 @@  discard block
 block discarded – undo
518 518
 	$last = 0;
519 519
 	for ($i = 32; $i <= 255; $i++) {
520 520
 		if ($map[$i] != $ref[$i]) {
521
-			if ($i != $last+1) {
521
+			if ($i != $last + 1) {
522 522
 				$s .= $i.' ';
523 523
 			}
524 524
 			$last = $i;
@@ -528,9 +528,9 @@  discard block
 block discarded – undo
528 528
 	return rtrim($s);
529 529
 }
530 530
 
531
-function SaveToFile($file, $s, $mode='t') {
531
+function SaveToFile($file, $s, $mode = 't') {
532 532
 	$f = fopen($file, 'w'.$mode);
533
-	if(!$f) {
533
+	if ( ! $f) {
534 534
 		die('Can\'t write to file '.$file);
535 535
 	}
536 536
 	fwrite($f, $s, strlen($s));
@@ -550,7 +550,7 @@  discard block
 block discarded – undo
550 550
 function CheckTTF($file) {
551 551
 	//Check if font license allows embedding
552 552
 	$f = fopen($file, 'rb');
553
-	if (!$f) {
553
+	if ( ! $f) {
554 554
 		die('Error: unable to open '.$file);
555 555
 	}
556 556
 	//Extract number of tables
@@ -566,7 +566,7 @@  discard block
 block discarded – undo
566 566
 		}
567 567
 		fseek($f, 12, SEEK_CUR);
568 568
 	}
569
-	if (!$found) {
569
+	if ( ! $found) {
570 570
 		fclose($f);
571 571
 		return;
572 572
 	}
@@ -580,7 +580,7 @@  discard block
 block discarded – undo
580 580
 	$pp = ($fsType & 0x04) != 0;
581 581
 	$e = ($fsType & 0x08) != 0;
582 582
 	fclose($f);
583
-	if($rl AND (!$pp) AND (!$e)) {
583
+	if ($rl AND ( ! $pp) AND ( ! $e)) {
584 584
 		print "Warning: font license does not allow embedding\n";
585 585
 	}
586 586
 }
@@ -593,14 +593,14 @@  discard block
 block discarded – undo
593 593
 		$arg[3] = $arg[2];
594 594
 		$arg[2] = true;
595 595
 	} else {
596
-		if (!isset($arg[2])) {
596
+		if ( ! isset($arg[2])) {
597 597
 			$arg[2] = true;
598 598
 		}
599
-		if (!isset($arg[3])) {
599
+		if ( ! isset($arg[3])) {
600 600
 			$arg[3] = 'cp1252';
601 601
 		}
602 602
 	}
603
-	if (!isset($arg[4])) {
603
+	if ( ! isset($arg[4])) {
604 604
 		$arg[4] = array();
605 605
 	}
606 606
 	MakeFont($arg[0], $arg[1], $arg[2], $arg[3], $arg[4]);
Please login to merge, or discard this patch.
app/Vendor/PHPExcel/PHPExcel/Shared/PDF/pdf417.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -536,7 +536,7 @@
 block discarded – undo
536 536
 		 * Creates a PDF417 object
537 537
 		 * @param string $code code to represent using PDF417
538 538
 		 * @param int $ecl error correction level (0-8); default -1 = automatic correction level
539
-		 * @param float $aspectratio the width to height of the symbol (excluding quiet zones)
539
+		 * @param integer $aspectratio the width to height of the symbol (excluding quiet zones)
540 540
 		 * òparam array $macro information for macro block
541 541
 		 * @access public
542 542
 		 */
Please login to merge, or discard this patch.
Spacing   +367 added lines, -367 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
  */
58 58
 
59 59
 // definitions
60
-if (!defined('PDF417DEFS')) {
60
+if ( ! defined('PDF417DEFS')) {
61 61
 
62 62
 	/**
63 63
 	 * Indicate that definitions for this class are set
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 
88 88
 // #*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#
89 89
 
90
-if (!class_exists('PDF417', false)) {
90
+if ( ! class_exists('PDF417', false)) {
91 91
 
92 92
 	/**
93 93
 	 * Class to create PDF417 barcode arrays for TCPDF class.
@@ -126,10 +126,10 @@  discard block
 block discarded – undo
126 126
 		 * @access protected
127 127
 		 */
128 128
 		protected $textsubmodes = array(
129
-			array(0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4a,0x4b,0x4c,0x4d,0x4e,0x4f,0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5a,0x20,0xFD,0xFE,0xFF), // Alpha
130
-			array(0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6a,0x6b,0x6c,0x6d,0x6e,0x6f,0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7a,0x20,0xFD,0xFE,0xFF), // Lower
131
-			array(0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x26,0x0d,0x09,0x2c,0x3a,0x23,0x2d,0x2e,0x24,0x2f,0x2b,0x25,0x2a,0x3d,0x5e,0xFB,0x20,0xFD,0xFE,0xFF), // Mixed
132
-			array(0x3b,0x3c,0x3e,0x40,0x5b,0x5c,0x5d,0x5f,0x60,0x7e,0x21,0x0d,0x09,0x2c,0x3a,0x0a,0x2d,0x2e,0x24,0x2f,0x22,0x7c,0x2a,0x28,0x29,0x3f,0x7b,0x7d,0x27,0xFF) // Puntuaction
129
+			array(0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x20, 0xFD, 0xFE, 0xFF), // Alpha
130
+			array(0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0x20, 0xFD, 0xFE, 0xFF), // Lower
131
+			array(0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x26, 0x0d, 0x09, 0x2c, 0x3a, 0x23, 0x2d, 0x2e, 0x24, 0x2f, 0x2b, 0x25, 0x2a, 0x3d, 0x5e, 0xFB, 0x20, 0xFD, 0xFE, 0xFF), // Mixed
132
+			array(0x3b, 0x3c, 0x3e, 0x40, 0x5b, 0x5c, 0x5d, 0x5f, 0x60, 0x7e, 0x21, 0x0d, 0x09, 0x2c, 0x3a, 0x0a, 0x2d, 0x2e, 0x24, 0x2f, 0x22, 0x7c, 0x2a, 0x28, 0x29, 0x3f, 0x7b, 0x7d, 0x27, 0xFF) // Puntuaction
133 133
 		);
134 134
 
135 135
 		/**
@@ -137,10 +137,10 @@  discard block
 block discarded – undo
137 137
 		 * @access protected
138 138
 		 */
139 139
 		protected $textlatch = array(
140
-			'01' => array(27), '02' => array(28), '03' => array(28,25), //
141
-			'10' => array(28,28), '12' => array(28), '13' => array(28,25), //
140
+			'01' => array(27), '02' => array(28), '03' => array(28, 25), //
141
+			'10' => array(28, 28), '12' => array(28), '13' => array(28, 25), //
142 142
 			'20' => array(28), '21' => array(27), '23' => array(25), //
143
-			'30' => array(29), '31' => array(29,27), '32' => array(29,28) //
143
+			'30' => array(29), '31' => array(29, 27), '32' => array(29, 28) //
144 144
 		);
145 145
 
146 146
 		/**
@@ -166,287 +166,287 @@  discard block
 block discarded – undo
166 166
 		 */
167 167
 		protected $clusters = array(
168 168
 			array( // cluster 0 -----------------------------------------------------------------------
169
-				0x1d5c0,0x1eaf0,0x1f57c,0x1d4e0,0x1ea78,0x1f53e,0x1a8c0,0x1d470,0x1a860,0x15040, //  10
170
-				0x1a830,0x15020,0x1adc0,0x1d6f0,0x1eb7c,0x1ace0,0x1d678,0x1eb3e,0x158c0,0x1ac70, //  20
171
-				0x15860,0x15dc0,0x1aef0,0x1d77c,0x15ce0,0x1ae78,0x1d73e,0x15c70,0x1ae3c,0x15ef0, //  30
172
-				0x1af7c,0x15e78,0x1af3e,0x15f7c,0x1f5fa,0x1d2e0,0x1e978,0x1f4be,0x1a4c0,0x1d270, //  40
173
-				0x1e93c,0x1a460,0x1d238,0x14840,0x1a430,0x1d21c,0x14820,0x1a418,0x14810,0x1a6e0, //  50
174
-				0x1d378,0x1e9be,0x14cc0,0x1a670,0x1d33c,0x14c60,0x1a638,0x1d31e,0x14c30,0x1a61c, //  60
175
-				0x14ee0,0x1a778,0x1d3be,0x14e70,0x1a73c,0x14e38,0x1a71e,0x14f78,0x1a7be,0x14f3c, //  70
176
-				0x14f1e,0x1a2c0,0x1d170,0x1e8bc,0x1a260,0x1d138,0x1e89e,0x14440,0x1a230,0x1d11c, //  80
177
-				0x14420,0x1a218,0x14410,0x14408,0x146c0,0x1a370,0x1d1bc,0x14660,0x1a338,0x1d19e, //  90
178
-				0x14630,0x1a31c,0x14618,0x1460c,0x14770,0x1a3bc,0x14738,0x1a39e,0x1471c,0x147bc, // 100
179
-				0x1a160,0x1d0b8,0x1e85e,0x14240,0x1a130,0x1d09c,0x14220,0x1a118,0x1d08e,0x14210, // 110
180
-				0x1a10c,0x14208,0x1a106,0x14360,0x1a1b8,0x1d0de,0x14330,0x1a19c,0x14318,0x1a18e, // 120
181
-				0x1430c,0x14306,0x1a1de,0x1438e,0x14140,0x1a0b0,0x1d05c,0x14120,0x1a098,0x1d04e, // 130
182
-				0x14110,0x1a08c,0x14108,0x1a086,0x14104,0x141b0,0x14198,0x1418c,0x140a0,0x1d02e, // 140
183
-				0x1a04c,0x1a046,0x14082,0x1cae0,0x1e578,0x1f2be,0x194c0,0x1ca70,0x1e53c,0x19460, // 150
184
-				0x1ca38,0x1e51e,0x12840,0x19430,0x12820,0x196e0,0x1cb78,0x1e5be,0x12cc0,0x19670, // 160
185
-				0x1cb3c,0x12c60,0x19638,0x12c30,0x12c18,0x12ee0,0x19778,0x1cbbe,0x12e70,0x1973c, // 170
186
-				0x12e38,0x12e1c,0x12f78,0x197be,0x12f3c,0x12fbe,0x1dac0,0x1ed70,0x1f6bc,0x1da60, // 180
187
-				0x1ed38,0x1f69e,0x1b440,0x1da30,0x1ed1c,0x1b420,0x1da18,0x1ed0e,0x1b410,0x1da0c, // 190
188
-				0x192c0,0x1c970,0x1e4bc,0x1b6c0,0x19260,0x1c938,0x1e49e,0x1b660,0x1db38,0x1ed9e, // 200
189
-				0x16c40,0x12420,0x19218,0x1c90e,0x16c20,0x1b618,0x16c10,0x126c0,0x19370,0x1c9bc, // 210
190
-				0x16ec0,0x12660,0x19338,0x1c99e,0x16e60,0x1b738,0x1db9e,0x16e30,0x12618,0x16e18, // 220
191
-				0x12770,0x193bc,0x16f70,0x12738,0x1939e,0x16f38,0x1b79e,0x16f1c,0x127bc,0x16fbc, // 230
192
-				0x1279e,0x16f9e,0x1d960,0x1ecb8,0x1f65e,0x1b240,0x1d930,0x1ec9c,0x1b220,0x1d918, // 240
193
-				0x1ec8e,0x1b210,0x1d90c,0x1b208,0x1b204,0x19160,0x1c8b8,0x1e45e,0x1b360,0x19130, // 250
194
-				0x1c89c,0x16640,0x12220,0x1d99c,0x1c88e,0x16620,0x12210,0x1910c,0x16610,0x1b30c, // 260
195
-				0x19106,0x12204,0x12360,0x191b8,0x1c8de,0x16760,0x12330,0x1919c,0x16730,0x1b39c, // 270
196
-				0x1918e,0x16718,0x1230c,0x12306,0x123b8,0x191de,0x167b8,0x1239c,0x1679c,0x1238e, // 280
197
-				0x1678e,0x167de,0x1b140,0x1d8b0,0x1ec5c,0x1b120,0x1d898,0x1ec4e,0x1b110,0x1d88c, // 290
198
-				0x1b108,0x1d886,0x1b104,0x1b102,0x12140,0x190b0,0x1c85c,0x16340,0x12120,0x19098, // 300
199
-				0x1c84e,0x16320,0x1b198,0x1d8ce,0x16310,0x12108,0x19086,0x16308,0x1b186,0x16304, // 310
200
-				0x121b0,0x190dc,0x163b0,0x12198,0x190ce,0x16398,0x1b1ce,0x1638c,0x12186,0x16386, // 320
201
-				0x163dc,0x163ce,0x1b0a0,0x1d858,0x1ec2e,0x1b090,0x1d84c,0x1b088,0x1d846,0x1b084, // 330
202
-				0x1b082,0x120a0,0x19058,0x1c82e,0x161a0,0x12090,0x1904c,0x16190,0x1b0cc,0x19046, // 340
203
-				0x16188,0x12084,0x16184,0x12082,0x120d8,0x161d8,0x161cc,0x161c6,0x1d82c,0x1d826, // 350
204
-				0x1b042,0x1902c,0x12048,0x160c8,0x160c4,0x160c2,0x18ac0,0x1c570,0x1e2bc,0x18a60, // 360
205
-				0x1c538,0x11440,0x18a30,0x1c51c,0x11420,0x18a18,0x11410,0x11408,0x116c0,0x18b70, // 370
206
-				0x1c5bc,0x11660,0x18b38,0x1c59e,0x11630,0x18b1c,0x11618,0x1160c,0x11770,0x18bbc, // 380
207
-				0x11738,0x18b9e,0x1171c,0x117bc,0x1179e,0x1cd60,0x1e6b8,0x1f35e,0x19a40,0x1cd30, // 390
208
-				0x1e69c,0x19a20,0x1cd18,0x1e68e,0x19a10,0x1cd0c,0x19a08,0x1cd06,0x18960,0x1c4b8, // 400
209
-				0x1e25e,0x19b60,0x18930,0x1c49c,0x13640,0x11220,0x1cd9c,0x1c48e,0x13620,0x19b18, // 410
210
-				0x1890c,0x13610,0x11208,0x13608,0x11360,0x189b8,0x1c4de,0x13760,0x11330,0x1cdde, // 420
211
-				0x13730,0x19b9c,0x1898e,0x13718,0x1130c,0x1370c,0x113b8,0x189de,0x137b8,0x1139c, // 430
212
-				0x1379c,0x1138e,0x113de,0x137de,0x1dd40,0x1eeb0,0x1f75c,0x1dd20,0x1ee98,0x1f74e, // 440
213
-				0x1dd10,0x1ee8c,0x1dd08,0x1ee86,0x1dd04,0x19940,0x1ccb0,0x1e65c,0x1bb40,0x19920, // 450
214
-				0x1eedc,0x1e64e,0x1bb20,0x1dd98,0x1eece,0x1bb10,0x19908,0x1cc86,0x1bb08,0x1dd86, // 460
215
-				0x19902,0x11140,0x188b0,0x1c45c,0x13340,0x11120,0x18898,0x1c44e,0x17740,0x13320, // 470
216
-				0x19998,0x1ccce,0x17720,0x1bb98,0x1ddce,0x18886,0x17710,0x13308,0x19986,0x17708, // 480
217
-				0x11102,0x111b0,0x188dc,0x133b0,0x11198,0x188ce,0x177b0,0x13398,0x199ce,0x17798, // 490
218
-				0x1bbce,0x11186,0x13386,0x111dc,0x133dc,0x111ce,0x177dc,0x133ce,0x1dca0,0x1ee58, // 500
219
-				0x1f72e,0x1dc90,0x1ee4c,0x1dc88,0x1ee46,0x1dc84,0x1dc82,0x198a0,0x1cc58,0x1e62e, // 510
220
-				0x1b9a0,0x19890,0x1ee6e,0x1b990,0x1dccc,0x1cc46,0x1b988,0x19884,0x1b984,0x19882, // 520
221
-				0x1b982,0x110a0,0x18858,0x1c42e,0x131a0,0x11090,0x1884c,0x173a0,0x13190,0x198cc, // 530
222
-				0x18846,0x17390,0x1b9cc,0x11084,0x17388,0x13184,0x11082,0x13182,0x110d8,0x1886e, // 540
223
-				0x131d8,0x110cc,0x173d8,0x131cc,0x110c6,0x173cc,0x131c6,0x110ee,0x173ee,0x1dc50, // 550
224
-				0x1ee2c,0x1dc48,0x1ee26,0x1dc44,0x1dc42,0x19850,0x1cc2c,0x1b8d0,0x19848,0x1cc26, // 560
225
-				0x1b8c8,0x1dc66,0x1b8c4,0x19842,0x1b8c2,0x11050,0x1882c,0x130d0,0x11048,0x18826, // 570
226
-				0x171d0,0x130c8,0x19866,0x171c8,0x1b8e6,0x11042,0x171c4,0x130c2,0x171c2,0x130ec, // 580
227
-				0x171ec,0x171e6,0x1ee16,0x1dc22,0x1cc16,0x19824,0x19822,0x11028,0x13068,0x170e8, // 590
228
-				0x11022,0x13062,0x18560,0x10a40,0x18530,0x10a20,0x18518,0x1c28e,0x10a10,0x1850c, // 600
229
-				0x10a08,0x18506,0x10b60,0x185b8,0x1c2de,0x10b30,0x1859c,0x10b18,0x1858e,0x10b0c, // 610
230
-				0x10b06,0x10bb8,0x185de,0x10b9c,0x10b8e,0x10bde,0x18d40,0x1c6b0,0x1e35c,0x18d20, // 620
231
-				0x1c698,0x18d10,0x1c68c,0x18d08,0x1c686,0x18d04,0x10940,0x184b0,0x1c25c,0x11b40, // 630
232
-				0x10920,0x1c6dc,0x1c24e,0x11b20,0x18d98,0x1c6ce,0x11b10,0x10908,0x18486,0x11b08, // 640
233
-				0x18d86,0x10902,0x109b0,0x184dc,0x11bb0,0x10998,0x184ce,0x11b98,0x18dce,0x11b8c, // 650
234
-				0x10986,0x109dc,0x11bdc,0x109ce,0x11bce,0x1cea0,0x1e758,0x1f3ae,0x1ce90,0x1e74c, // 660
235
-				0x1ce88,0x1e746,0x1ce84,0x1ce82,0x18ca0,0x1c658,0x19da0,0x18c90,0x1c64c,0x19d90, // 670
236
-				0x1cecc,0x1c646,0x19d88,0x18c84,0x19d84,0x18c82,0x19d82,0x108a0,0x18458,0x119a0, // 680
237
-				0x10890,0x1c66e,0x13ba0,0x11990,0x18ccc,0x18446,0x13b90,0x19dcc,0x10884,0x13b88, // 690
238
-				0x11984,0x10882,0x11982,0x108d8,0x1846e,0x119d8,0x108cc,0x13bd8,0x119cc,0x108c6, // 700
239
-				0x13bcc,0x119c6,0x108ee,0x119ee,0x13bee,0x1ef50,0x1f7ac,0x1ef48,0x1f7a6,0x1ef44, // 710
240
-				0x1ef42,0x1ce50,0x1e72c,0x1ded0,0x1ef6c,0x1e726,0x1dec8,0x1ef66,0x1dec4,0x1ce42, // 720
241
-				0x1dec2,0x18c50,0x1c62c,0x19cd0,0x18c48,0x1c626,0x1bdd0,0x19cc8,0x1ce66,0x1bdc8, // 730
242
-				0x1dee6,0x18c42,0x1bdc4,0x19cc2,0x1bdc2,0x10850,0x1842c,0x118d0,0x10848,0x18426, // 740
243
-				0x139d0,0x118c8,0x18c66,0x17bd0,0x139c8,0x19ce6,0x10842,0x17bc8,0x1bde6,0x118c2, // 750
244
-				0x17bc4,0x1086c,0x118ec,0x10866,0x139ec,0x118e6,0x17bec,0x139e6,0x17be6,0x1ef28, // 760
245
-				0x1f796,0x1ef24,0x1ef22,0x1ce28,0x1e716,0x1de68,0x1ef36,0x1de64,0x1ce22,0x1de62, // 770
246
-				0x18c28,0x1c616,0x19c68,0x18c24,0x1bce8,0x19c64,0x18c22,0x1bce4,0x19c62,0x1bce2, // 780
247
-				0x10828,0x18416,0x11868,0x18c36,0x138e8,0x11864,0x10822,0x179e8,0x138e4,0x11862, // 790
248
-				0x179e4,0x138e2,0x179e2,0x11876,0x179f6,0x1ef12,0x1de34,0x1de32,0x19c34,0x1bc74, // 800
249
-				0x1bc72,0x11834,0x13874,0x178f4,0x178f2,0x10540,0x10520,0x18298,0x10510,0x10508, // 810
250
-				0x10504,0x105b0,0x10598,0x1058c,0x10586,0x105dc,0x105ce,0x186a0,0x18690,0x1c34c, // 820
251
-				0x18688,0x1c346,0x18684,0x18682,0x104a0,0x18258,0x10da0,0x186d8,0x1824c,0x10d90, // 830
252
-				0x186cc,0x10d88,0x186c6,0x10d84,0x10482,0x10d82,0x104d8,0x1826e,0x10dd8,0x186ee, // 840
253
-				0x10dcc,0x104c6,0x10dc6,0x104ee,0x10dee,0x1c750,0x1c748,0x1c744,0x1c742,0x18650, // 850
254
-				0x18ed0,0x1c76c,0x1c326,0x18ec8,0x1c766,0x18ec4,0x18642,0x18ec2,0x10450,0x10cd0, // 860
255
-				0x10448,0x18226,0x11dd0,0x10cc8,0x10444,0x11dc8,0x10cc4,0x10442,0x11dc4,0x10cc2, // 870
256
-				0x1046c,0x10cec,0x10466,0x11dec,0x10ce6,0x11de6,0x1e7a8,0x1e7a4,0x1e7a2,0x1c728, // 880
257
-				0x1cf68,0x1e7b6,0x1cf64,0x1c722,0x1cf62,0x18628,0x1c316,0x18e68,0x1c736,0x19ee8, // 890
258
-				0x18e64,0x18622,0x19ee4,0x18e62,0x19ee2,0x10428,0x18216,0x10c68,0x18636,0x11ce8, // 900
259
-				0x10c64,0x10422,0x13de8,0x11ce4,0x10c62,0x13de4,0x11ce2,0x10436,0x10c76,0x11cf6, // 910
260
-				0x13df6,0x1f7d4,0x1f7d2,0x1e794,0x1efb4,0x1e792,0x1efb2,0x1c714,0x1cf34,0x1c712, // 920
261
-				0x1df74,0x1cf32,0x1df72,0x18614,0x18e34,0x18612,0x19e74,0x18e32,0x1bef4),        // 929
169
+				0x1d5c0, 0x1eaf0, 0x1f57c, 0x1d4e0, 0x1ea78, 0x1f53e, 0x1a8c0, 0x1d470, 0x1a860, 0x15040, //  10
170
+				0x1a830, 0x15020, 0x1adc0, 0x1d6f0, 0x1eb7c, 0x1ace0, 0x1d678, 0x1eb3e, 0x158c0, 0x1ac70, //  20
171
+				0x15860, 0x15dc0, 0x1aef0, 0x1d77c, 0x15ce0, 0x1ae78, 0x1d73e, 0x15c70, 0x1ae3c, 0x15ef0, //  30
172
+				0x1af7c, 0x15e78, 0x1af3e, 0x15f7c, 0x1f5fa, 0x1d2e0, 0x1e978, 0x1f4be, 0x1a4c0, 0x1d270, //  40
173
+				0x1e93c, 0x1a460, 0x1d238, 0x14840, 0x1a430, 0x1d21c, 0x14820, 0x1a418, 0x14810, 0x1a6e0, //  50
174
+				0x1d378, 0x1e9be, 0x14cc0, 0x1a670, 0x1d33c, 0x14c60, 0x1a638, 0x1d31e, 0x14c30, 0x1a61c, //  60
175
+				0x14ee0, 0x1a778, 0x1d3be, 0x14e70, 0x1a73c, 0x14e38, 0x1a71e, 0x14f78, 0x1a7be, 0x14f3c, //  70
176
+				0x14f1e, 0x1a2c0, 0x1d170, 0x1e8bc, 0x1a260, 0x1d138, 0x1e89e, 0x14440, 0x1a230, 0x1d11c, //  80
177
+				0x14420, 0x1a218, 0x14410, 0x14408, 0x146c0, 0x1a370, 0x1d1bc, 0x14660, 0x1a338, 0x1d19e, //  90
178
+				0x14630, 0x1a31c, 0x14618, 0x1460c, 0x14770, 0x1a3bc, 0x14738, 0x1a39e, 0x1471c, 0x147bc, // 100
179
+				0x1a160, 0x1d0b8, 0x1e85e, 0x14240, 0x1a130, 0x1d09c, 0x14220, 0x1a118, 0x1d08e, 0x14210, // 110
180
+				0x1a10c, 0x14208, 0x1a106, 0x14360, 0x1a1b8, 0x1d0de, 0x14330, 0x1a19c, 0x14318, 0x1a18e, // 120
181
+				0x1430c, 0x14306, 0x1a1de, 0x1438e, 0x14140, 0x1a0b0, 0x1d05c, 0x14120, 0x1a098, 0x1d04e, // 130
182
+				0x14110, 0x1a08c, 0x14108, 0x1a086, 0x14104, 0x141b0, 0x14198, 0x1418c, 0x140a0, 0x1d02e, // 140
183
+				0x1a04c, 0x1a046, 0x14082, 0x1cae0, 0x1e578, 0x1f2be, 0x194c0, 0x1ca70, 0x1e53c, 0x19460, // 150
184
+				0x1ca38, 0x1e51e, 0x12840, 0x19430, 0x12820, 0x196e0, 0x1cb78, 0x1e5be, 0x12cc0, 0x19670, // 160
185
+				0x1cb3c, 0x12c60, 0x19638, 0x12c30, 0x12c18, 0x12ee0, 0x19778, 0x1cbbe, 0x12e70, 0x1973c, // 170
186
+				0x12e38, 0x12e1c, 0x12f78, 0x197be, 0x12f3c, 0x12fbe, 0x1dac0, 0x1ed70, 0x1f6bc, 0x1da60, // 180
187
+				0x1ed38, 0x1f69e, 0x1b440, 0x1da30, 0x1ed1c, 0x1b420, 0x1da18, 0x1ed0e, 0x1b410, 0x1da0c, // 190
188
+				0x192c0, 0x1c970, 0x1e4bc, 0x1b6c0, 0x19260, 0x1c938, 0x1e49e, 0x1b660, 0x1db38, 0x1ed9e, // 200
189
+				0x16c40, 0x12420, 0x19218, 0x1c90e, 0x16c20, 0x1b618, 0x16c10, 0x126c0, 0x19370, 0x1c9bc, // 210
190
+				0x16ec0, 0x12660, 0x19338, 0x1c99e, 0x16e60, 0x1b738, 0x1db9e, 0x16e30, 0x12618, 0x16e18, // 220
191
+				0x12770, 0x193bc, 0x16f70, 0x12738, 0x1939e, 0x16f38, 0x1b79e, 0x16f1c, 0x127bc, 0x16fbc, // 230
192
+				0x1279e, 0x16f9e, 0x1d960, 0x1ecb8, 0x1f65e, 0x1b240, 0x1d930, 0x1ec9c, 0x1b220, 0x1d918, // 240
193
+				0x1ec8e, 0x1b210, 0x1d90c, 0x1b208, 0x1b204, 0x19160, 0x1c8b8, 0x1e45e, 0x1b360, 0x19130, // 250
194
+				0x1c89c, 0x16640, 0x12220, 0x1d99c, 0x1c88e, 0x16620, 0x12210, 0x1910c, 0x16610, 0x1b30c, // 260
195
+				0x19106, 0x12204, 0x12360, 0x191b8, 0x1c8de, 0x16760, 0x12330, 0x1919c, 0x16730, 0x1b39c, // 270
196
+				0x1918e, 0x16718, 0x1230c, 0x12306, 0x123b8, 0x191de, 0x167b8, 0x1239c, 0x1679c, 0x1238e, // 280
197
+				0x1678e, 0x167de, 0x1b140, 0x1d8b0, 0x1ec5c, 0x1b120, 0x1d898, 0x1ec4e, 0x1b110, 0x1d88c, // 290
198
+				0x1b108, 0x1d886, 0x1b104, 0x1b102, 0x12140, 0x190b0, 0x1c85c, 0x16340, 0x12120, 0x19098, // 300
199
+				0x1c84e, 0x16320, 0x1b198, 0x1d8ce, 0x16310, 0x12108, 0x19086, 0x16308, 0x1b186, 0x16304, // 310
200
+				0x121b0, 0x190dc, 0x163b0, 0x12198, 0x190ce, 0x16398, 0x1b1ce, 0x1638c, 0x12186, 0x16386, // 320
201
+				0x163dc, 0x163ce, 0x1b0a0, 0x1d858, 0x1ec2e, 0x1b090, 0x1d84c, 0x1b088, 0x1d846, 0x1b084, // 330
202
+				0x1b082, 0x120a0, 0x19058, 0x1c82e, 0x161a0, 0x12090, 0x1904c, 0x16190, 0x1b0cc, 0x19046, // 340
203
+				0x16188, 0x12084, 0x16184, 0x12082, 0x120d8, 0x161d8, 0x161cc, 0x161c6, 0x1d82c, 0x1d826, // 350
204
+				0x1b042, 0x1902c, 0x12048, 0x160c8, 0x160c4, 0x160c2, 0x18ac0, 0x1c570, 0x1e2bc, 0x18a60, // 360
205
+				0x1c538, 0x11440, 0x18a30, 0x1c51c, 0x11420, 0x18a18, 0x11410, 0x11408, 0x116c0, 0x18b70, // 370
206
+				0x1c5bc, 0x11660, 0x18b38, 0x1c59e, 0x11630, 0x18b1c, 0x11618, 0x1160c, 0x11770, 0x18bbc, // 380
207
+				0x11738, 0x18b9e, 0x1171c, 0x117bc, 0x1179e, 0x1cd60, 0x1e6b8, 0x1f35e, 0x19a40, 0x1cd30, // 390
208
+				0x1e69c, 0x19a20, 0x1cd18, 0x1e68e, 0x19a10, 0x1cd0c, 0x19a08, 0x1cd06, 0x18960, 0x1c4b8, // 400
209
+				0x1e25e, 0x19b60, 0x18930, 0x1c49c, 0x13640, 0x11220, 0x1cd9c, 0x1c48e, 0x13620, 0x19b18, // 410
210
+				0x1890c, 0x13610, 0x11208, 0x13608, 0x11360, 0x189b8, 0x1c4de, 0x13760, 0x11330, 0x1cdde, // 420
211
+				0x13730, 0x19b9c, 0x1898e, 0x13718, 0x1130c, 0x1370c, 0x113b8, 0x189de, 0x137b8, 0x1139c, // 430
212
+				0x1379c, 0x1138e, 0x113de, 0x137de, 0x1dd40, 0x1eeb0, 0x1f75c, 0x1dd20, 0x1ee98, 0x1f74e, // 440
213
+				0x1dd10, 0x1ee8c, 0x1dd08, 0x1ee86, 0x1dd04, 0x19940, 0x1ccb0, 0x1e65c, 0x1bb40, 0x19920, // 450
214
+				0x1eedc, 0x1e64e, 0x1bb20, 0x1dd98, 0x1eece, 0x1bb10, 0x19908, 0x1cc86, 0x1bb08, 0x1dd86, // 460
215
+				0x19902, 0x11140, 0x188b0, 0x1c45c, 0x13340, 0x11120, 0x18898, 0x1c44e, 0x17740, 0x13320, // 470
216
+				0x19998, 0x1ccce, 0x17720, 0x1bb98, 0x1ddce, 0x18886, 0x17710, 0x13308, 0x19986, 0x17708, // 480
217
+				0x11102, 0x111b0, 0x188dc, 0x133b0, 0x11198, 0x188ce, 0x177b0, 0x13398, 0x199ce, 0x17798, // 490
218
+				0x1bbce, 0x11186, 0x13386, 0x111dc, 0x133dc, 0x111ce, 0x177dc, 0x133ce, 0x1dca0, 0x1ee58, // 500
219
+				0x1f72e, 0x1dc90, 0x1ee4c, 0x1dc88, 0x1ee46, 0x1dc84, 0x1dc82, 0x198a0, 0x1cc58, 0x1e62e, // 510
220
+				0x1b9a0, 0x19890, 0x1ee6e, 0x1b990, 0x1dccc, 0x1cc46, 0x1b988, 0x19884, 0x1b984, 0x19882, // 520
221
+				0x1b982, 0x110a0, 0x18858, 0x1c42e, 0x131a0, 0x11090, 0x1884c, 0x173a0, 0x13190, 0x198cc, // 530
222
+				0x18846, 0x17390, 0x1b9cc, 0x11084, 0x17388, 0x13184, 0x11082, 0x13182, 0x110d8, 0x1886e, // 540
223
+				0x131d8, 0x110cc, 0x173d8, 0x131cc, 0x110c6, 0x173cc, 0x131c6, 0x110ee, 0x173ee, 0x1dc50, // 550
224
+				0x1ee2c, 0x1dc48, 0x1ee26, 0x1dc44, 0x1dc42, 0x19850, 0x1cc2c, 0x1b8d0, 0x19848, 0x1cc26, // 560
225
+				0x1b8c8, 0x1dc66, 0x1b8c4, 0x19842, 0x1b8c2, 0x11050, 0x1882c, 0x130d0, 0x11048, 0x18826, // 570
226
+				0x171d0, 0x130c8, 0x19866, 0x171c8, 0x1b8e6, 0x11042, 0x171c4, 0x130c2, 0x171c2, 0x130ec, // 580
227
+				0x171ec, 0x171e6, 0x1ee16, 0x1dc22, 0x1cc16, 0x19824, 0x19822, 0x11028, 0x13068, 0x170e8, // 590
228
+				0x11022, 0x13062, 0x18560, 0x10a40, 0x18530, 0x10a20, 0x18518, 0x1c28e, 0x10a10, 0x1850c, // 600
229
+				0x10a08, 0x18506, 0x10b60, 0x185b8, 0x1c2de, 0x10b30, 0x1859c, 0x10b18, 0x1858e, 0x10b0c, // 610
230
+				0x10b06, 0x10bb8, 0x185de, 0x10b9c, 0x10b8e, 0x10bde, 0x18d40, 0x1c6b0, 0x1e35c, 0x18d20, // 620
231
+				0x1c698, 0x18d10, 0x1c68c, 0x18d08, 0x1c686, 0x18d04, 0x10940, 0x184b0, 0x1c25c, 0x11b40, // 630
232
+				0x10920, 0x1c6dc, 0x1c24e, 0x11b20, 0x18d98, 0x1c6ce, 0x11b10, 0x10908, 0x18486, 0x11b08, // 640
233
+				0x18d86, 0x10902, 0x109b0, 0x184dc, 0x11bb0, 0x10998, 0x184ce, 0x11b98, 0x18dce, 0x11b8c, // 650
234
+				0x10986, 0x109dc, 0x11bdc, 0x109ce, 0x11bce, 0x1cea0, 0x1e758, 0x1f3ae, 0x1ce90, 0x1e74c, // 660
235
+				0x1ce88, 0x1e746, 0x1ce84, 0x1ce82, 0x18ca0, 0x1c658, 0x19da0, 0x18c90, 0x1c64c, 0x19d90, // 670
236
+				0x1cecc, 0x1c646, 0x19d88, 0x18c84, 0x19d84, 0x18c82, 0x19d82, 0x108a0, 0x18458, 0x119a0, // 680
237
+				0x10890, 0x1c66e, 0x13ba0, 0x11990, 0x18ccc, 0x18446, 0x13b90, 0x19dcc, 0x10884, 0x13b88, // 690
238
+				0x11984, 0x10882, 0x11982, 0x108d8, 0x1846e, 0x119d8, 0x108cc, 0x13bd8, 0x119cc, 0x108c6, // 700
239
+				0x13bcc, 0x119c6, 0x108ee, 0x119ee, 0x13bee, 0x1ef50, 0x1f7ac, 0x1ef48, 0x1f7a6, 0x1ef44, // 710
240
+				0x1ef42, 0x1ce50, 0x1e72c, 0x1ded0, 0x1ef6c, 0x1e726, 0x1dec8, 0x1ef66, 0x1dec4, 0x1ce42, // 720
241
+				0x1dec2, 0x18c50, 0x1c62c, 0x19cd0, 0x18c48, 0x1c626, 0x1bdd0, 0x19cc8, 0x1ce66, 0x1bdc8, // 730
242
+				0x1dee6, 0x18c42, 0x1bdc4, 0x19cc2, 0x1bdc2, 0x10850, 0x1842c, 0x118d0, 0x10848, 0x18426, // 740
243
+				0x139d0, 0x118c8, 0x18c66, 0x17bd0, 0x139c8, 0x19ce6, 0x10842, 0x17bc8, 0x1bde6, 0x118c2, // 750
244
+				0x17bc4, 0x1086c, 0x118ec, 0x10866, 0x139ec, 0x118e6, 0x17bec, 0x139e6, 0x17be6, 0x1ef28, // 760
245
+				0x1f796, 0x1ef24, 0x1ef22, 0x1ce28, 0x1e716, 0x1de68, 0x1ef36, 0x1de64, 0x1ce22, 0x1de62, // 770
246
+				0x18c28, 0x1c616, 0x19c68, 0x18c24, 0x1bce8, 0x19c64, 0x18c22, 0x1bce4, 0x19c62, 0x1bce2, // 780
247
+				0x10828, 0x18416, 0x11868, 0x18c36, 0x138e8, 0x11864, 0x10822, 0x179e8, 0x138e4, 0x11862, // 790
248
+				0x179e4, 0x138e2, 0x179e2, 0x11876, 0x179f6, 0x1ef12, 0x1de34, 0x1de32, 0x19c34, 0x1bc74, // 800
249
+				0x1bc72, 0x11834, 0x13874, 0x178f4, 0x178f2, 0x10540, 0x10520, 0x18298, 0x10510, 0x10508, // 810
250
+				0x10504, 0x105b0, 0x10598, 0x1058c, 0x10586, 0x105dc, 0x105ce, 0x186a0, 0x18690, 0x1c34c, // 820
251
+				0x18688, 0x1c346, 0x18684, 0x18682, 0x104a0, 0x18258, 0x10da0, 0x186d8, 0x1824c, 0x10d90, // 830
252
+				0x186cc, 0x10d88, 0x186c6, 0x10d84, 0x10482, 0x10d82, 0x104d8, 0x1826e, 0x10dd8, 0x186ee, // 840
253
+				0x10dcc, 0x104c6, 0x10dc6, 0x104ee, 0x10dee, 0x1c750, 0x1c748, 0x1c744, 0x1c742, 0x18650, // 850
254
+				0x18ed0, 0x1c76c, 0x1c326, 0x18ec8, 0x1c766, 0x18ec4, 0x18642, 0x18ec2, 0x10450, 0x10cd0, // 860
255
+				0x10448, 0x18226, 0x11dd0, 0x10cc8, 0x10444, 0x11dc8, 0x10cc4, 0x10442, 0x11dc4, 0x10cc2, // 870
256
+				0x1046c, 0x10cec, 0x10466, 0x11dec, 0x10ce6, 0x11de6, 0x1e7a8, 0x1e7a4, 0x1e7a2, 0x1c728, // 880
257
+				0x1cf68, 0x1e7b6, 0x1cf64, 0x1c722, 0x1cf62, 0x18628, 0x1c316, 0x18e68, 0x1c736, 0x19ee8, // 890
258
+				0x18e64, 0x18622, 0x19ee4, 0x18e62, 0x19ee2, 0x10428, 0x18216, 0x10c68, 0x18636, 0x11ce8, // 900
259
+				0x10c64, 0x10422, 0x13de8, 0x11ce4, 0x10c62, 0x13de4, 0x11ce2, 0x10436, 0x10c76, 0x11cf6, // 910
260
+				0x13df6, 0x1f7d4, 0x1f7d2, 0x1e794, 0x1efb4, 0x1e792, 0x1efb2, 0x1c714, 0x1cf34, 0x1c712, // 920
261
+				0x1df74, 0x1cf32, 0x1df72, 0x18614, 0x18e34, 0x18612, 0x19e74, 0x18e32, 0x1bef4), // 929
262 262
 			array( // cluster 3 -----------------------------------------------------------------------
263
-				0x1f560,0x1fab8,0x1ea40,0x1f530,0x1fa9c,0x1ea20,0x1f518,0x1fa8e,0x1ea10,0x1f50c, //  10
264
-				0x1ea08,0x1f506,0x1ea04,0x1eb60,0x1f5b8,0x1fade,0x1d640,0x1eb30,0x1f59c,0x1d620, //  20
265
-				0x1eb18,0x1f58e,0x1d610,0x1eb0c,0x1d608,0x1eb06,0x1d604,0x1d760,0x1ebb8,0x1f5de, //  30
266
-				0x1ae40,0x1d730,0x1eb9c,0x1ae20,0x1d718,0x1eb8e,0x1ae10,0x1d70c,0x1ae08,0x1d706, //  40
267
-				0x1ae04,0x1af60,0x1d7b8,0x1ebde,0x15e40,0x1af30,0x1d79c,0x15e20,0x1af18,0x1d78e, //  50
268
-				0x15e10,0x1af0c,0x15e08,0x1af06,0x15f60,0x1afb8,0x1d7de,0x15f30,0x1af9c,0x15f18, //  60
269
-				0x1af8e,0x15f0c,0x15fb8,0x1afde,0x15f9c,0x15f8e,0x1e940,0x1f4b0,0x1fa5c,0x1e920, //  70
270
-				0x1f498,0x1fa4e,0x1e910,0x1f48c,0x1e908,0x1f486,0x1e904,0x1e902,0x1d340,0x1e9b0, //  80
271
-				0x1f4dc,0x1d320,0x1e998,0x1f4ce,0x1d310,0x1e98c,0x1d308,0x1e986,0x1d304,0x1d302, //  90
272
-				0x1a740,0x1d3b0,0x1e9dc,0x1a720,0x1d398,0x1e9ce,0x1a710,0x1d38c,0x1a708,0x1d386, // 100
273
-				0x1a704,0x1a702,0x14f40,0x1a7b0,0x1d3dc,0x14f20,0x1a798,0x1d3ce,0x14f10,0x1a78c, // 110
274
-				0x14f08,0x1a786,0x14f04,0x14fb0,0x1a7dc,0x14f98,0x1a7ce,0x14f8c,0x14f86,0x14fdc, // 120
275
-				0x14fce,0x1e8a0,0x1f458,0x1fa2e,0x1e890,0x1f44c,0x1e888,0x1f446,0x1e884,0x1e882, // 130
276
-				0x1d1a0,0x1e8d8,0x1f46e,0x1d190,0x1e8cc,0x1d188,0x1e8c6,0x1d184,0x1d182,0x1a3a0, // 140
277
-				0x1d1d8,0x1e8ee,0x1a390,0x1d1cc,0x1a388,0x1d1c6,0x1a384,0x1a382,0x147a0,0x1a3d8, // 150
278
-				0x1d1ee,0x14790,0x1a3cc,0x14788,0x1a3c6,0x14784,0x14782,0x147d8,0x1a3ee,0x147cc, // 160
279
-				0x147c6,0x147ee,0x1e850,0x1f42c,0x1e848,0x1f426,0x1e844,0x1e842,0x1d0d0,0x1e86c, // 170
280
-				0x1d0c8,0x1e866,0x1d0c4,0x1d0c2,0x1a1d0,0x1d0ec,0x1a1c8,0x1d0e6,0x1a1c4,0x1a1c2, // 180
281
-				0x143d0,0x1a1ec,0x143c8,0x1a1e6,0x143c4,0x143c2,0x143ec,0x143e6,0x1e828,0x1f416, // 190
282
-				0x1e824,0x1e822,0x1d068,0x1e836,0x1d064,0x1d062,0x1a0e8,0x1d076,0x1a0e4,0x1a0e2, // 200
283
-				0x141e8,0x1a0f6,0x141e4,0x141e2,0x1e814,0x1e812,0x1d034,0x1d032,0x1a074,0x1a072, // 210
284
-				0x1e540,0x1f2b0,0x1f95c,0x1e520,0x1f298,0x1f94e,0x1e510,0x1f28c,0x1e508,0x1f286, // 220
285
-				0x1e504,0x1e502,0x1cb40,0x1e5b0,0x1f2dc,0x1cb20,0x1e598,0x1f2ce,0x1cb10,0x1e58c, // 230
286
-				0x1cb08,0x1e586,0x1cb04,0x1cb02,0x19740,0x1cbb0,0x1e5dc,0x19720,0x1cb98,0x1e5ce, // 240
287
-				0x19710,0x1cb8c,0x19708,0x1cb86,0x19704,0x19702,0x12f40,0x197b0,0x1cbdc,0x12f20, // 250
288
-				0x19798,0x1cbce,0x12f10,0x1978c,0x12f08,0x19786,0x12f04,0x12fb0,0x197dc,0x12f98, // 260
289
-				0x197ce,0x12f8c,0x12f86,0x12fdc,0x12fce,0x1f6a0,0x1fb58,0x16bf0,0x1f690,0x1fb4c, // 270
290
-				0x169f8,0x1f688,0x1fb46,0x168fc,0x1f684,0x1f682,0x1e4a0,0x1f258,0x1f92e,0x1eda0, // 280
291
-				0x1e490,0x1fb6e,0x1ed90,0x1f6cc,0x1f246,0x1ed88,0x1e484,0x1ed84,0x1e482,0x1ed82, // 290
292
-				0x1c9a0,0x1e4d8,0x1f26e,0x1dba0,0x1c990,0x1e4cc,0x1db90,0x1edcc,0x1e4c6,0x1db88, // 300
293
-				0x1c984,0x1db84,0x1c982,0x1db82,0x193a0,0x1c9d8,0x1e4ee,0x1b7a0,0x19390,0x1c9cc, // 310
294
-				0x1b790,0x1dbcc,0x1c9c6,0x1b788,0x19384,0x1b784,0x19382,0x1b782,0x127a0,0x193d8, // 320
295
-				0x1c9ee,0x16fa0,0x12790,0x193cc,0x16f90,0x1b7cc,0x193c6,0x16f88,0x12784,0x16f84, // 330
296
-				0x12782,0x127d8,0x193ee,0x16fd8,0x127cc,0x16fcc,0x127c6,0x16fc6,0x127ee,0x1f650, // 340
297
-				0x1fb2c,0x165f8,0x1f648,0x1fb26,0x164fc,0x1f644,0x1647e,0x1f642,0x1e450,0x1f22c, // 350
298
-				0x1ecd0,0x1e448,0x1f226,0x1ecc8,0x1f666,0x1ecc4,0x1e442,0x1ecc2,0x1c8d0,0x1e46c, // 360
299
-				0x1d9d0,0x1c8c8,0x1e466,0x1d9c8,0x1ece6,0x1d9c4,0x1c8c2,0x1d9c2,0x191d0,0x1c8ec, // 370
300
-				0x1b3d0,0x191c8,0x1c8e6,0x1b3c8,0x1d9e6,0x1b3c4,0x191c2,0x1b3c2,0x123d0,0x191ec, // 380
301
-				0x167d0,0x123c8,0x191e6,0x167c8,0x1b3e6,0x167c4,0x123c2,0x167c2,0x123ec,0x167ec, // 390
302
-				0x123e6,0x167e6,0x1f628,0x1fb16,0x162fc,0x1f624,0x1627e,0x1f622,0x1e428,0x1f216, // 400
303
-				0x1ec68,0x1f636,0x1ec64,0x1e422,0x1ec62,0x1c868,0x1e436,0x1d8e8,0x1c864,0x1d8e4, // 410
304
-				0x1c862,0x1d8e2,0x190e8,0x1c876,0x1b1e8,0x1d8f6,0x1b1e4,0x190e2,0x1b1e2,0x121e8, // 420
305
-				0x190f6,0x163e8,0x121e4,0x163e4,0x121e2,0x163e2,0x121f6,0x163f6,0x1f614,0x1617e, // 430
306
-				0x1f612,0x1e414,0x1ec34,0x1e412,0x1ec32,0x1c834,0x1d874,0x1c832,0x1d872,0x19074, // 440
307
-				0x1b0f4,0x19072,0x1b0f2,0x120f4,0x161f4,0x120f2,0x161f2,0x1f60a,0x1e40a,0x1ec1a, // 450
308
-				0x1c81a,0x1d83a,0x1903a,0x1b07a,0x1e2a0,0x1f158,0x1f8ae,0x1e290,0x1f14c,0x1e288, // 460
309
-				0x1f146,0x1e284,0x1e282,0x1c5a0,0x1e2d8,0x1f16e,0x1c590,0x1e2cc,0x1c588,0x1e2c6, // 470
310
-				0x1c584,0x1c582,0x18ba0,0x1c5d8,0x1e2ee,0x18b90,0x1c5cc,0x18b88,0x1c5c6,0x18b84, // 480
311
-				0x18b82,0x117a0,0x18bd8,0x1c5ee,0x11790,0x18bcc,0x11788,0x18bc6,0x11784,0x11782, // 490
312
-				0x117d8,0x18bee,0x117cc,0x117c6,0x117ee,0x1f350,0x1f9ac,0x135f8,0x1f348,0x1f9a6, // 500
313
-				0x134fc,0x1f344,0x1347e,0x1f342,0x1e250,0x1f12c,0x1e6d0,0x1e248,0x1f126,0x1e6c8, // 510
314
-				0x1f366,0x1e6c4,0x1e242,0x1e6c2,0x1c4d0,0x1e26c,0x1cdd0,0x1c4c8,0x1e266,0x1cdc8, // 520
315
-				0x1e6e6,0x1cdc4,0x1c4c2,0x1cdc2,0x189d0,0x1c4ec,0x19bd0,0x189c8,0x1c4e6,0x19bc8, // 530
316
-				0x1cde6,0x19bc4,0x189c2,0x19bc2,0x113d0,0x189ec,0x137d0,0x113c8,0x189e6,0x137c8, // 540
317
-				0x19be6,0x137c4,0x113c2,0x137c2,0x113ec,0x137ec,0x113e6,0x137e6,0x1fba8,0x175f0, // 550
318
-				0x1bafc,0x1fba4,0x174f8,0x1ba7e,0x1fba2,0x1747c,0x1743e,0x1f328,0x1f996,0x132fc, // 560
319
-				0x1f768,0x1fbb6,0x176fc,0x1327e,0x1f764,0x1f322,0x1767e,0x1f762,0x1e228,0x1f116, // 570
320
-				0x1e668,0x1e224,0x1eee8,0x1f776,0x1e222,0x1eee4,0x1e662,0x1eee2,0x1c468,0x1e236, // 580
321
-				0x1cce8,0x1c464,0x1dde8,0x1cce4,0x1c462,0x1dde4,0x1cce2,0x1dde2,0x188e8,0x1c476, // 590
322
-				0x199e8,0x188e4,0x1bbe8,0x199e4,0x188e2,0x1bbe4,0x199e2,0x1bbe2,0x111e8,0x188f6, // 600
323
-				0x133e8,0x111e4,0x177e8,0x133e4,0x111e2,0x177e4,0x133e2,0x177e2,0x111f6,0x133f6, // 610
324
-				0x1fb94,0x172f8,0x1b97e,0x1fb92,0x1727c,0x1723e,0x1f314,0x1317e,0x1f734,0x1f312, // 620
325
-				0x1737e,0x1f732,0x1e214,0x1e634,0x1e212,0x1ee74,0x1e632,0x1ee72,0x1c434,0x1cc74, // 630
326
-				0x1c432,0x1dcf4,0x1cc72,0x1dcf2,0x18874,0x198f4,0x18872,0x1b9f4,0x198f2,0x1b9f2, // 640
327
-				0x110f4,0x131f4,0x110f2,0x173f4,0x131f2,0x173f2,0x1fb8a,0x1717c,0x1713e,0x1f30a, // 650
328
-				0x1f71a,0x1e20a,0x1e61a,0x1ee3a,0x1c41a,0x1cc3a,0x1dc7a,0x1883a,0x1987a,0x1b8fa, // 660
329
-				0x1107a,0x130fa,0x171fa,0x170be,0x1e150,0x1f0ac,0x1e148,0x1f0a6,0x1e144,0x1e142, // 670
330
-				0x1c2d0,0x1e16c,0x1c2c8,0x1e166,0x1c2c4,0x1c2c2,0x185d0,0x1c2ec,0x185c8,0x1c2e6, // 680
331
-				0x185c4,0x185c2,0x10bd0,0x185ec,0x10bc8,0x185e6,0x10bc4,0x10bc2,0x10bec,0x10be6, // 690
332
-				0x1f1a8,0x1f8d6,0x11afc,0x1f1a4,0x11a7e,0x1f1a2,0x1e128,0x1f096,0x1e368,0x1e124, // 700
333
-				0x1e364,0x1e122,0x1e362,0x1c268,0x1e136,0x1c6e8,0x1c264,0x1c6e4,0x1c262,0x1c6e2, // 710
334
-				0x184e8,0x1c276,0x18de8,0x184e4,0x18de4,0x184e2,0x18de2,0x109e8,0x184f6,0x11be8, // 720
335
-				0x109e4,0x11be4,0x109e2,0x11be2,0x109f6,0x11bf6,0x1f9d4,0x13af8,0x19d7e,0x1f9d2, // 730
336
-				0x13a7c,0x13a3e,0x1f194,0x1197e,0x1f3b4,0x1f192,0x13b7e,0x1f3b2,0x1e114,0x1e334, // 740
337
-				0x1e112,0x1e774,0x1e332,0x1e772,0x1c234,0x1c674,0x1c232,0x1cef4,0x1c672,0x1cef2, // 750
338
-				0x18474,0x18cf4,0x18472,0x19df4,0x18cf2,0x19df2,0x108f4,0x119f4,0x108f2,0x13bf4, // 760
339
-				0x119f2,0x13bf2,0x17af0,0x1bd7c,0x17a78,0x1bd3e,0x17a3c,0x17a1e,0x1f9ca,0x1397c, // 770
340
-				0x1fbda,0x17b7c,0x1393e,0x17b3e,0x1f18a,0x1f39a,0x1f7ba,0x1e10a,0x1e31a,0x1e73a, // 780
341
-				0x1ef7a,0x1c21a,0x1c63a,0x1ce7a,0x1defa,0x1843a,0x18c7a,0x19cfa,0x1bdfa,0x1087a, // 790
342
-				0x118fa,0x139fa,0x17978,0x1bcbe,0x1793c,0x1791e,0x138be,0x179be,0x178bc,0x1789e, // 800
343
-				0x1785e,0x1e0a8,0x1e0a4,0x1e0a2,0x1c168,0x1e0b6,0x1c164,0x1c162,0x182e8,0x1c176, // 810
344
-				0x182e4,0x182e2,0x105e8,0x182f6,0x105e4,0x105e2,0x105f6,0x1f0d4,0x10d7e,0x1f0d2, // 820
345
-				0x1e094,0x1e1b4,0x1e092,0x1e1b2,0x1c134,0x1c374,0x1c132,0x1c372,0x18274,0x186f4, // 830
346
-				0x18272,0x186f2,0x104f4,0x10df4,0x104f2,0x10df2,0x1f8ea,0x11d7c,0x11d3e,0x1f0ca, // 840
347
-				0x1f1da,0x1e08a,0x1e19a,0x1e3ba,0x1c11a,0x1c33a,0x1c77a,0x1823a,0x1867a,0x18efa, // 850
348
-				0x1047a,0x10cfa,0x11dfa,0x13d78,0x19ebe,0x13d3c,0x13d1e,0x11cbe,0x13dbe,0x17d70, // 860
349
-				0x1bebc,0x17d38,0x1be9e,0x17d1c,0x17d0e,0x13cbc,0x17dbc,0x13c9e,0x17d9e,0x17cb8, // 870
350
-				0x1be5e,0x17c9c,0x17c8e,0x13c5e,0x17cde,0x17c5c,0x17c4e,0x17c2e,0x1c0b4,0x1c0b2, // 880
351
-				0x18174,0x18172,0x102f4,0x102f2,0x1e0da,0x1c09a,0x1c1ba,0x1813a,0x1837a,0x1027a, // 890
352
-				0x106fa,0x10ebe,0x11ebc,0x11e9e,0x13eb8,0x19f5e,0x13e9c,0x13e8e,0x11e5e,0x13ede, // 900
353
-				0x17eb0,0x1bf5c,0x17e98,0x1bf4e,0x17e8c,0x17e86,0x13e5c,0x17edc,0x13e4e,0x17ece, // 910
354
-				0x17e58,0x1bf2e,0x17e4c,0x17e46,0x13e2e,0x17e6e,0x17e2c,0x17e26,0x10f5e,0x11f5c, // 920
355
-				0x11f4e,0x13f58,0x19fae,0x13f4c,0x13f46,0x11f2e,0x13f6e,0x13f2c,0x13f26),        // 929
263
+				0x1f560, 0x1fab8, 0x1ea40, 0x1f530, 0x1fa9c, 0x1ea20, 0x1f518, 0x1fa8e, 0x1ea10, 0x1f50c, //  10
264
+				0x1ea08, 0x1f506, 0x1ea04, 0x1eb60, 0x1f5b8, 0x1fade, 0x1d640, 0x1eb30, 0x1f59c, 0x1d620, //  20
265
+				0x1eb18, 0x1f58e, 0x1d610, 0x1eb0c, 0x1d608, 0x1eb06, 0x1d604, 0x1d760, 0x1ebb8, 0x1f5de, //  30
266
+				0x1ae40, 0x1d730, 0x1eb9c, 0x1ae20, 0x1d718, 0x1eb8e, 0x1ae10, 0x1d70c, 0x1ae08, 0x1d706, //  40
267
+				0x1ae04, 0x1af60, 0x1d7b8, 0x1ebde, 0x15e40, 0x1af30, 0x1d79c, 0x15e20, 0x1af18, 0x1d78e, //  50
268
+				0x15e10, 0x1af0c, 0x15e08, 0x1af06, 0x15f60, 0x1afb8, 0x1d7de, 0x15f30, 0x1af9c, 0x15f18, //  60
269
+				0x1af8e, 0x15f0c, 0x15fb8, 0x1afde, 0x15f9c, 0x15f8e, 0x1e940, 0x1f4b0, 0x1fa5c, 0x1e920, //  70
270
+				0x1f498, 0x1fa4e, 0x1e910, 0x1f48c, 0x1e908, 0x1f486, 0x1e904, 0x1e902, 0x1d340, 0x1e9b0, //  80
271
+				0x1f4dc, 0x1d320, 0x1e998, 0x1f4ce, 0x1d310, 0x1e98c, 0x1d308, 0x1e986, 0x1d304, 0x1d302, //  90
272
+				0x1a740, 0x1d3b0, 0x1e9dc, 0x1a720, 0x1d398, 0x1e9ce, 0x1a710, 0x1d38c, 0x1a708, 0x1d386, // 100
273
+				0x1a704, 0x1a702, 0x14f40, 0x1a7b0, 0x1d3dc, 0x14f20, 0x1a798, 0x1d3ce, 0x14f10, 0x1a78c, // 110
274
+				0x14f08, 0x1a786, 0x14f04, 0x14fb0, 0x1a7dc, 0x14f98, 0x1a7ce, 0x14f8c, 0x14f86, 0x14fdc, // 120
275
+				0x14fce, 0x1e8a0, 0x1f458, 0x1fa2e, 0x1e890, 0x1f44c, 0x1e888, 0x1f446, 0x1e884, 0x1e882, // 130
276
+				0x1d1a0, 0x1e8d8, 0x1f46e, 0x1d190, 0x1e8cc, 0x1d188, 0x1e8c6, 0x1d184, 0x1d182, 0x1a3a0, // 140
277
+				0x1d1d8, 0x1e8ee, 0x1a390, 0x1d1cc, 0x1a388, 0x1d1c6, 0x1a384, 0x1a382, 0x147a0, 0x1a3d8, // 150
278
+				0x1d1ee, 0x14790, 0x1a3cc, 0x14788, 0x1a3c6, 0x14784, 0x14782, 0x147d8, 0x1a3ee, 0x147cc, // 160
279
+				0x147c6, 0x147ee, 0x1e850, 0x1f42c, 0x1e848, 0x1f426, 0x1e844, 0x1e842, 0x1d0d0, 0x1e86c, // 170
280
+				0x1d0c8, 0x1e866, 0x1d0c4, 0x1d0c2, 0x1a1d0, 0x1d0ec, 0x1a1c8, 0x1d0e6, 0x1a1c4, 0x1a1c2, // 180
281
+				0x143d0, 0x1a1ec, 0x143c8, 0x1a1e6, 0x143c4, 0x143c2, 0x143ec, 0x143e6, 0x1e828, 0x1f416, // 190
282
+				0x1e824, 0x1e822, 0x1d068, 0x1e836, 0x1d064, 0x1d062, 0x1a0e8, 0x1d076, 0x1a0e4, 0x1a0e2, // 200
283
+				0x141e8, 0x1a0f6, 0x141e4, 0x141e2, 0x1e814, 0x1e812, 0x1d034, 0x1d032, 0x1a074, 0x1a072, // 210
284
+				0x1e540, 0x1f2b0, 0x1f95c, 0x1e520, 0x1f298, 0x1f94e, 0x1e510, 0x1f28c, 0x1e508, 0x1f286, // 220
285
+				0x1e504, 0x1e502, 0x1cb40, 0x1e5b0, 0x1f2dc, 0x1cb20, 0x1e598, 0x1f2ce, 0x1cb10, 0x1e58c, // 230
286
+				0x1cb08, 0x1e586, 0x1cb04, 0x1cb02, 0x19740, 0x1cbb0, 0x1e5dc, 0x19720, 0x1cb98, 0x1e5ce, // 240
287
+				0x19710, 0x1cb8c, 0x19708, 0x1cb86, 0x19704, 0x19702, 0x12f40, 0x197b0, 0x1cbdc, 0x12f20, // 250
288
+				0x19798, 0x1cbce, 0x12f10, 0x1978c, 0x12f08, 0x19786, 0x12f04, 0x12fb0, 0x197dc, 0x12f98, // 260
289
+				0x197ce, 0x12f8c, 0x12f86, 0x12fdc, 0x12fce, 0x1f6a0, 0x1fb58, 0x16bf0, 0x1f690, 0x1fb4c, // 270
290
+				0x169f8, 0x1f688, 0x1fb46, 0x168fc, 0x1f684, 0x1f682, 0x1e4a0, 0x1f258, 0x1f92e, 0x1eda0, // 280
291
+				0x1e490, 0x1fb6e, 0x1ed90, 0x1f6cc, 0x1f246, 0x1ed88, 0x1e484, 0x1ed84, 0x1e482, 0x1ed82, // 290
292
+				0x1c9a0, 0x1e4d8, 0x1f26e, 0x1dba0, 0x1c990, 0x1e4cc, 0x1db90, 0x1edcc, 0x1e4c6, 0x1db88, // 300
293
+				0x1c984, 0x1db84, 0x1c982, 0x1db82, 0x193a0, 0x1c9d8, 0x1e4ee, 0x1b7a0, 0x19390, 0x1c9cc, // 310
294
+				0x1b790, 0x1dbcc, 0x1c9c6, 0x1b788, 0x19384, 0x1b784, 0x19382, 0x1b782, 0x127a0, 0x193d8, // 320
295
+				0x1c9ee, 0x16fa0, 0x12790, 0x193cc, 0x16f90, 0x1b7cc, 0x193c6, 0x16f88, 0x12784, 0x16f84, // 330
296
+				0x12782, 0x127d8, 0x193ee, 0x16fd8, 0x127cc, 0x16fcc, 0x127c6, 0x16fc6, 0x127ee, 0x1f650, // 340
297
+				0x1fb2c, 0x165f8, 0x1f648, 0x1fb26, 0x164fc, 0x1f644, 0x1647e, 0x1f642, 0x1e450, 0x1f22c, // 350
298
+				0x1ecd0, 0x1e448, 0x1f226, 0x1ecc8, 0x1f666, 0x1ecc4, 0x1e442, 0x1ecc2, 0x1c8d0, 0x1e46c, // 360
299
+				0x1d9d0, 0x1c8c8, 0x1e466, 0x1d9c8, 0x1ece6, 0x1d9c4, 0x1c8c2, 0x1d9c2, 0x191d0, 0x1c8ec, // 370
300
+				0x1b3d0, 0x191c8, 0x1c8e6, 0x1b3c8, 0x1d9e6, 0x1b3c4, 0x191c2, 0x1b3c2, 0x123d0, 0x191ec, // 380
301
+				0x167d0, 0x123c8, 0x191e6, 0x167c8, 0x1b3e6, 0x167c4, 0x123c2, 0x167c2, 0x123ec, 0x167ec, // 390
302
+				0x123e6, 0x167e6, 0x1f628, 0x1fb16, 0x162fc, 0x1f624, 0x1627e, 0x1f622, 0x1e428, 0x1f216, // 400
303
+				0x1ec68, 0x1f636, 0x1ec64, 0x1e422, 0x1ec62, 0x1c868, 0x1e436, 0x1d8e8, 0x1c864, 0x1d8e4, // 410
304
+				0x1c862, 0x1d8e2, 0x190e8, 0x1c876, 0x1b1e8, 0x1d8f6, 0x1b1e4, 0x190e2, 0x1b1e2, 0x121e8, // 420
305
+				0x190f6, 0x163e8, 0x121e4, 0x163e4, 0x121e2, 0x163e2, 0x121f6, 0x163f6, 0x1f614, 0x1617e, // 430
306
+				0x1f612, 0x1e414, 0x1ec34, 0x1e412, 0x1ec32, 0x1c834, 0x1d874, 0x1c832, 0x1d872, 0x19074, // 440
307
+				0x1b0f4, 0x19072, 0x1b0f2, 0x120f4, 0x161f4, 0x120f2, 0x161f2, 0x1f60a, 0x1e40a, 0x1ec1a, // 450
308
+				0x1c81a, 0x1d83a, 0x1903a, 0x1b07a, 0x1e2a0, 0x1f158, 0x1f8ae, 0x1e290, 0x1f14c, 0x1e288, // 460
309
+				0x1f146, 0x1e284, 0x1e282, 0x1c5a0, 0x1e2d8, 0x1f16e, 0x1c590, 0x1e2cc, 0x1c588, 0x1e2c6, // 470
310
+				0x1c584, 0x1c582, 0x18ba0, 0x1c5d8, 0x1e2ee, 0x18b90, 0x1c5cc, 0x18b88, 0x1c5c6, 0x18b84, // 480
311
+				0x18b82, 0x117a0, 0x18bd8, 0x1c5ee, 0x11790, 0x18bcc, 0x11788, 0x18bc6, 0x11784, 0x11782, // 490
312
+				0x117d8, 0x18bee, 0x117cc, 0x117c6, 0x117ee, 0x1f350, 0x1f9ac, 0x135f8, 0x1f348, 0x1f9a6, // 500
313
+				0x134fc, 0x1f344, 0x1347e, 0x1f342, 0x1e250, 0x1f12c, 0x1e6d0, 0x1e248, 0x1f126, 0x1e6c8, // 510
314
+				0x1f366, 0x1e6c4, 0x1e242, 0x1e6c2, 0x1c4d0, 0x1e26c, 0x1cdd0, 0x1c4c8, 0x1e266, 0x1cdc8, // 520
315
+				0x1e6e6, 0x1cdc4, 0x1c4c2, 0x1cdc2, 0x189d0, 0x1c4ec, 0x19bd0, 0x189c8, 0x1c4e6, 0x19bc8, // 530
316
+				0x1cde6, 0x19bc4, 0x189c2, 0x19bc2, 0x113d0, 0x189ec, 0x137d0, 0x113c8, 0x189e6, 0x137c8, // 540
317
+				0x19be6, 0x137c4, 0x113c2, 0x137c2, 0x113ec, 0x137ec, 0x113e6, 0x137e6, 0x1fba8, 0x175f0, // 550
318
+				0x1bafc, 0x1fba4, 0x174f8, 0x1ba7e, 0x1fba2, 0x1747c, 0x1743e, 0x1f328, 0x1f996, 0x132fc, // 560
319
+				0x1f768, 0x1fbb6, 0x176fc, 0x1327e, 0x1f764, 0x1f322, 0x1767e, 0x1f762, 0x1e228, 0x1f116, // 570
320
+				0x1e668, 0x1e224, 0x1eee8, 0x1f776, 0x1e222, 0x1eee4, 0x1e662, 0x1eee2, 0x1c468, 0x1e236, // 580
321
+				0x1cce8, 0x1c464, 0x1dde8, 0x1cce4, 0x1c462, 0x1dde4, 0x1cce2, 0x1dde2, 0x188e8, 0x1c476, // 590
322
+				0x199e8, 0x188e4, 0x1bbe8, 0x199e4, 0x188e2, 0x1bbe4, 0x199e2, 0x1bbe2, 0x111e8, 0x188f6, // 600
323
+				0x133e8, 0x111e4, 0x177e8, 0x133e4, 0x111e2, 0x177e4, 0x133e2, 0x177e2, 0x111f6, 0x133f6, // 610
324
+				0x1fb94, 0x172f8, 0x1b97e, 0x1fb92, 0x1727c, 0x1723e, 0x1f314, 0x1317e, 0x1f734, 0x1f312, // 620
325
+				0x1737e, 0x1f732, 0x1e214, 0x1e634, 0x1e212, 0x1ee74, 0x1e632, 0x1ee72, 0x1c434, 0x1cc74, // 630
326
+				0x1c432, 0x1dcf4, 0x1cc72, 0x1dcf2, 0x18874, 0x198f4, 0x18872, 0x1b9f4, 0x198f2, 0x1b9f2, // 640
327
+				0x110f4, 0x131f4, 0x110f2, 0x173f4, 0x131f2, 0x173f2, 0x1fb8a, 0x1717c, 0x1713e, 0x1f30a, // 650
328
+				0x1f71a, 0x1e20a, 0x1e61a, 0x1ee3a, 0x1c41a, 0x1cc3a, 0x1dc7a, 0x1883a, 0x1987a, 0x1b8fa, // 660
329
+				0x1107a, 0x130fa, 0x171fa, 0x170be, 0x1e150, 0x1f0ac, 0x1e148, 0x1f0a6, 0x1e144, 0x1e142, // 670
330
+				0x1c2d0, 0x1e16c, 0x1c2c8, 0x1e166, 0x1c2c4, 0x1c2c2, 0x185d0, 0x1c2ec, 0x185c8, 0x1c2e6, // 680
331
+				0x185c4, 0x185c2, 0x10bd0, 0x185ec, 0x10bc8, 0x185e6, 0x10bc4, 0x10bc2, 0x10bec, 0x10be6, // 690
332
+				0x1f1a8, 0x1f8d6, 0x11afc, 0x1f1a4, 0x11a7e, 0x1f1a2, 0x1e128, 0x1f096, 0x1e368, 0x1e124, // 700
333
+				0x1e364, 0x1e122, 0x1e362, 0x1c268, 0x1e136, 0x1c6e8, 0x1c264, 0x1c6e4, 0x1c262, 0x1c6e2, // 710
334
+				0x184e8, 0x1c276, 0x18de8, 0x184e4, 0x18de4, 0x184e2, 0x18de2, 0x109e8, 0x184f6, 0x11be8, // 720
335
+				0x109e4, 0x11be4, 0x109e2, 0x11be2, 0x109f6, 0x11bf6, 0x1f9d4, 0x13af8, 0x19d7e, 0x1f9d2, // 730
336
+				0x13a7c, 0x13a3e, 0x1f194, 0x1197e, 0x1f3b4, 0x1f192, 0x13b7e, 0x1f3b2, 0x1e114, 0x1e334, // 740
337
+				0x1e112, 0x1e774, 0x1e332, 0x1e772, 0x1c234, 0x1c674, 0x1c232, 0x1cef4, 0x1c672, 0x1cef2, // 750
338
+				0x18474, 0x18cf4, 0x18472, 0x19df4, 0x18cf2, 0x19df2, 0x108f4, 0x119f4, 0x108f2, 0x13bf4, // 760
339
+				0x119f2, 0x13bf2, 0x17af0, 0x1bd7c, 0x17a78, 0x1bd3e, 0x17a3c, 0x17a1e, 0x1f9ca, 0x1397c, // 770
340
+				0x1fbda, 0x17b7c, 0x1393e, 0x17b3e, 0x1f18a, 0x1f39a, 0x1f7ba, 0x1e10a, 0x1e31a, 0x1e73a, // 780
341
+				0x1ef7a, 0x1c21a, 0x1c63a, 0x1ce7a, 0x1defa, 0x1843a, 0x18c7a, 0x19cfa, 0x1bdfa, 0x1087a, // 790
342
+				0x118fa, 0x139fa, 0x17978, 0x1bcbe, 0x1793c, 0x1791e, 0x138be, 0x179be, 0x178bc, 0x1789e, // 800
343
+				0x1785e, 0x1e0a8, 0x1e0a4, 0x1e0a2, 0x1c168, 0x1e0b6, 0x1c164, 0x1c162, 0x182e8, 0x1c176, // 810
344
+				0x182e4, 0x182e2, 0x105e8, 0x182f6, 0x105e4, 0x105e2, 0x105f6, 0x1f0d4, 0x10d7e, 0x1f0d2, // 820
345
+				0x1e094, 0x1e1b4, 0x1e092, 0x1e1b2, 0x1c134, 0x1c374, 0x1c132, 0x1c372, 0x18274, 0x186f4, // 830
346
+				0x18272, 0x186f2, 0x104f4, 0x10df4, 0x104f2, 0x10df2, 0x1f8ea, 0x11d7c, 0x11d3e, 0x1f0ca, // 840
347
+				0x1f1da, 0x1e08a, 0x1e19a, 0x1e3ba, 0x1c11a, 0x1c33a, 0x1c77a, 0x1823a, 0x1867a, 0x18efa, // 850
348
+				0x1047a, 0x10cfa, 0x11dfa, 0x13d78, 0x19ebe, 0x13d3c, 0x13d1e, 0x11cbe, 0x13dbe, 0x17d70, // 860
349
+				0x1bebc, 0x17d38, 0x1be9e, 0x17d1c, 0x17d0e, 0x13cbc, 0x17dbc, 0x13c9e, 0x17d9e, 0x17cb8, // 870
350
+				0x1be5e, 0x17c9c, 0x17c8e, 0x13c5e, 0x17cde, 0x17c5c, 0x17c4e, 0x17c2e, 0x1c0b4, 0x1c0b2, // 880
351
+				0x18174, 0x18172, 0x102f4, 0x102f2, 0x1e0da, 0x1c09a, 0x1c1ba, 0x1813a, 0x1837a, 0x1027a, // 890
352
+				0x106fa, 0x10ebe, 0x11ebc, 0x11e9e, 0x13eb8, 0x19f5e, 0x13e9c, 0x13e8e, 0x11e5e, 0x13ede, // 900
353
+				0x17eb0, 0x1bf5c, 0x17e98, 0x1bf4e, 0x17e8c, 0x17e86, 0x13e5c, 0x17edc, 0x13e4e, 0x17ece, // 910
354
+				0x17e58, 0x1bf2e, 0x17e4c, 0x17e46, 0x13e2e, 0x17e6e, 0x17e2c, 0x17e26, 0x10f5e, 0x11f5c, // 920
355
+				0x11f4e, 0x13f58, 0x19fae, 0x13f4c, 0x13f46, 0x11f2e, 0x13f6e, 0x13f2c, 0x13f26), // 929
356 356
 			array( // cluster 6 -----------------------------------------------------------------------
357
-				0x1abe0,0x1d5f8,0x153c0,0x1a9f0,0x1d4fc,0x151e0,0x1a8f8,0x1d47e,0x150f0,0x1a87c, //  10
358
-				0x15078,0x1fad0,0x15be0,0x1adf8,0x1fac8,0x159f0,0x1acfc,0x1fac4,0x158f8,0x1ac7e, //  20
359
-				0x1fac2,0x1587c,0x1f5d0,0x1faec,0x15df8,0x1f5c8,0x1fae6,0x15cfc,0x1f5c4,0x15c7e, //  30
360
-				0x1f5c2,0x1ebd0,0x1f5ec,0x1ebc8,0x1f5e6,0x1ebc4,0x1ebc2,0x1d7d0,0x1ebec,0x1d7c8, //  40
361
-				0x1ebe6,0x1d7c4,0x1d7c2,0x1afd0,0x1d7ec,0x1afc8,0x1d7e6,0x1afc4,0x14bc0,0x1a5f0, //  50
362
-				0x1d2fc,0x149e0,0x1a4f8,0x1d27e,0x148f0,0x1a47c,0x14878,0x1a43e,0x1483c,0x1fa68, //  60
363
-				0x14df0,0x1a6fc,0x1fa64,0x14cf8,0x1a67e,0x1fa62,0x14c7c,0x14c3e,0x1f4e8,0x1fa76, //  70
364
-				0x14efc,0x1f4e4,0x14e7e,0x1f4e2,0x1e9e8,0x1f4f6,0x1e9e4,0x1e9e2,0x1d3e8,0x1e9f6, //  80
365
-				0x1d3e4,0x1d3e2,0x1a7e8,0x1d3f6,0x1a7e4,0x1a7e2,0x145e0,0x1a2f8,0x1d17e,0x144f0, //  90
366
-				0x1a27c,0x14478,0x1a23e,0x1443c,0x1441e,0x1fa34,0x146f8,0x1a37e,0x1fa32,0x1467c, // 100
367
-				0x1463e,0x1f474,0x1477e,0x1f472,0x1e8f4,0x1e8f2,0x1d1f4,0x1d1f2,0x1a3f4,0x1a3f2, // 110
368
-				0x142f0,0x1a17c,0x14278,0x1a13e,0x1423c,0x1421e,0x1fa1a,0x1437c,0x1433e,0x1f43a, // 120
369
-				0x1e87a,0x1d0fa,0x14178,0x1a0be,0x1413c,0x1411e,0x141be,0x140bc,0x1409e,0x12bc0, // 130
370
-				0x195f0,0x1cafc,0x129e0,0x194f8,0x1ca7e,0x128f0,0x1947c,0x12878,0x1943e,0x1283c, // 140
371
-				0x1f968,0x12df0,0x196fc,0x1f964,0x12cf8,0x1967e,0x1f962,0x12c7c,0x12c3e,0x1f2e8, // 150
372
-				0x1f976,0x12efc,0x1f2e4,0x12e7e,0x1f2e2,0x1e5e8,0x1f2f6,0x1e5e4,0x1e5e2,0x1cbe8, // 160
373
-				0x1e5f6,0x1cbe4,0x1cbe2,0x197e8,0x1cbf6,0x197e4,0x197e2,0x1b5e0,0x1daf8,0x1ed7e, // 170
374
-				0x169c0,0x1b4f0,0x1da7c,0x168e0,0x1b478,0x1da3e,0x16870,0x1b43c,0x16838,0x1b41e, // 180
375
-				0x1681c,0x125e0,0x192f8,0x1c97e,0x16de0,0x124f0,0x1927c,0x16cf0,0x1b67c,0x1923e, // 190
376
-				0x16c78,0x1243c,0x16c3c,0x1241e,0x16c1e,0x1f934,0x126f8,0x1937e,0x1fb74,0x1f932, // 200
377
-				0x16ef8,0x1267c,0x1fb72,0x16e7c,0x1263e,0x16e3e,0x1f274,0x1277e,0x1f6f4,0x1f272, // 210
378
-				0x16f7e,0x1f6f2,0x1e4f4,0x1edf4,0x1e4f2,0x1edf2,0x1c9f4,0x1dbf4,0x1c9f2,0x1dbf2, // 220
379
-				0x193f4,0x193f2,0x165c0,0x1b2f0,0x1d97c,0x164e0,0x1b278,0x1d93e,0x16470,0x1b23c, // 230
380
-				0x16438,0x1b21e,0x1641c,0x1640e,0x122f0,0x1917c,0x166f0,0x12278,0x1913e,0x16678, // 240
381
-				0x1b33e,0x1663c,0x1221e,0x1661e,0x1f91a,0x1237c,0x1fb3a,0x1677c,0x1233e,0x1673e, // 250
382
-				0x1f23a,0x1f67a,0x1e47a,0x1ecfa,0x1c8fa,0x1d9fa,0x191fa,0x162e0,0x1b178,0x1d8be, // 260
383
-				0x16270,0x1b13c,0x16238,0x1b11e,0x1621c,0x1620e,0x12178,0x190be,0x16378,0x1213c, // 270
384
-				0x1633c,0x1211e,0x1631e,0x121be,0x163be,0x16170,0x1b0bc,0x16138,0x1b09e,0x1611c, // 280
385
-				0x1610e,0x120bc,0x161bc,0x1209e,0x1619e,0x160b8,0x1b05e,0x1609c,0x1608e,0x1205e, // 290
386
-				0x160de,0x1605c,0x1604e,0x115e0,0x18af8,0x1c57e,0x114f0,0x18a7c,0x11478,0x18a3e, // 300
387
-				0x1143c,0x1141e,0x1f8b4,0x116f8,0x18b7e,0x1f8b2,0x1167c,0x1163e,0x1f174,0x1177e, // 310
388
-				0x1f172,0x1e2f4,0x1e2f2,0x1c5f4,0x1c5f2,0x18bf4,0x18bf2,0x135c0,0x19af0,0x1cd7c, // 320
389
-				0x134e0,0x19a78,0x1cd3e,0x13470,0x19a3c,0x13438,0x19a1e,0x1341c,0x1340e,0x112f0, // 330
390
-				0x1897c,0x136f0,0x11278,0x1893e,0x13678,0x19b3e,0x1363c,0x1121e,0x1361e,0x1f89a, // 340
391
-				0x1137c,0x1f9ba,0x1377c,0x1133e,0x1373e,0x1f13a,0x1f37a,0x1e27a,0x1e6fa,0x1c4fa, // 350
392
-				0x1cdfa,0x189fa,0x1bae0,0x1dd78,0x1eebe,0x174c0,0x1ba70,0x1dd3c,0x17460,0x1ba38, // 360
393
-				0x1dd1e,0x17430,0x1ba1c,0x17418,0x1ba0e,0x1740c,0x132e0,0x19978,0x1ccbe,0x176e0, // 370
394
-				0x13270,0x1993c,0x17670,0x1bb3c,0x1991e,0x17638,0x1321c,0x1761c,0x1320e,0x1760e, // 380
395
-				0x11178,0x188be,0x13378,0x1113c,0x17778,0x1333c,0x1111e,0x1773c,0x1331e,0x1771e, // 390
396
-				0x111be,0x133be,0x177be,0x172c0,0x1b970,0x1dcbc,0x17260,0x1b938,0x1dc9e,0x17230, // 400
397
-				0x1b91c,0x17218,0x1b90e,0x1720c,0x17206,0x13170,0x198bc,0x17370,0x13138,0x1989e, // 410
398
-				0x17338,0x1b99e,0x1731c,0x1310e,0x1730e,0x110bc,0x131bc,0x1109e,0x173bc,0x1319e, // 420
399
-				0x1739e,0x17160,0x1b8b8,0x1dc5e,0x17130,0x1b89c,0x17118,0x1b88e,0x1710c,0x17106, // 430
400
-				0x130b8,0x1985e,0x171b8,0x1309c,0x1719c,0x1308e,0x1718e,0x1105e,0x130de,0x171de, // 440
401
-				0x170b0,0x1b85c,0x17098,0x1b84e,0x1708c,0x17086,0x1305c,0x170dc,0x1304e,0x170ce, // 450
402
-				0x17058,0x1b82e,0x1704c,0x17046,0x1302e,0x1706e,0x1702c,0x17026,0x10af0,0x1857c, // 460
403
-				0x10a78,0x1853e,0x10a3c,0x10a1e,0x10b7c,0x10b3e,0x1f0ba,0x1e17a,0x1c2fa,0x185fa, // 470
404
-				0x11ae0,0x18d78,0x1c6be,0x11a70,0x18d3c,0x11a38,0x18d1e,0x11a1c,0x11a0e,0x10978, // 480
405
-				0x184be,0x11b78,0x1093c,0x11b3c,0x1091e,0x11b1e,0x109be,0x11bbe,0x13ac0,0x19d70, // 490
406
-				0x1cebc,0x13a60,0x19d38,0x1ce9e,0x13a30,0x19d1c,0x13a18,0x19d0e,0x13a0c,0x13a06, // 500
407
-				0x11970,0x18cbc,0x13b70,0x11938,0x18c9e,0x13b38,0x1191c,0x13b1c,0x1190e,0x13b0e, // 510
408
-				0x108bc,0x119bc,0x1089e,0x13bbc,0x1199e,0x13b9e,0x1bd60,0x1deb8,0x1ef5e,0x17a40, // 520
409
-				0x1bd30,0x1de9c,0x17a20,0x1bd18,0x1de8e,0x17a10,0x1bd0c,0x17a08,0x1bd06,0x17a04, // 530
410
-				0x13960,0x19cb8,0x1ce5e,0x17b60,0x13930,0x19c9c,0x17b30,0x1bd9c,0x19c8e,0x17b18, // 540
411
-				0x1390c,0x17b0c,0x13906,0x17b06,0x118b8,0x18c5e,0x139b8,0x1189c,0x17bb8,0x1399c, // 550
412
-				0x1188e,0x17b9c,0x1398e,0x17b8e,0x1085e,0x118de,0x139de,0x17bde,0x17940,0x1bcb0, // 560
413
-				0x1de5c,0x17920,0x1bc98,0x1de4e,0x17910,0x1bc8c,0x17908,0x1bc86,0x17904,0x17902, // 570
414
-				0x138b0,0x19c5c,0x179b0,0x13898,0x19c4e,0x17998,0x1bcce,0x1798c,0x13886,0x17986, // 580
415
-				0x1185c,0x138dc,0x1184e,0x179dc,0x138ce,0x179ce,0x178a0,0x1bc58,0x1de2e,0x17890, // 590
416
-				0x1bc4c,0x17888,0x1bc46,0x17884,0x17882,0x13858,0x19c2e,0x178d8,0x1384c,0x178cc, // 600
417
-				0x13846,0x178c6,0x1182e,0x1386e,0x178ee,0x17850,0x1bc2c,0x17848,0x1bc26,0x17844, // 610
418
-				0x17842,0x1382c,0x1786c,0x13826,0x17866,0x17828,0x1bc16,0x17824,0x17822,0x13816, // 620
419
-				0x17836,0x10578,0x182be,0x1053c,0x1051e,0x105be,0x10d70,0x186bc,0x10d38,0x1869e, // 630
420
-				0x10d1c,0x10d0e,0x104bc,0x10dbc,0x1049e,0x10d9e,0x11d60,0x18eb8,0x1c75e,0x11d30, // 640
421
-				0x18e9c,0x11d18,0x18e8e,0x11d0c,0x11d06,0x10cb8,0x1865e,0x11db8,0x10c9c,0x11d9c, // 650
422
-				0x10c8e,0x11d8e,0x1045e,0x10cde,0x11dde,0x13d40,0x19eb0,0x1cf5c,0x13d20,0x19e98, // 660
423
-				0x1cf4e,0x13d10,0x19e8c,0x13d08,0x19e86,0x13d04,0x13d02,0x11cb0,0x18e5c,0x13db0, // 670
424
-				0x11c98,0x18e4e,0x13d98,0x19ece,0x13d8c,0x11c86,0x13d86,0x10c5c,0x11cdc,0x10c4e, // 680
425
-				0x13ddc,0x11cce,0x13dce,0x1bea0,0x1df58,0x1efae,0x1be90,0x1df4c,0x1be88,0x1df46, // 690
426
-				0x1be84,0x1be82,0x13ca0,0x19e58,0x1cf2e,0x17da0,0x13c90,0x19e4c,0x17d90,0x1becc, // 700
427
-				0x19e46,0x17d88,0x13c84,0x17d84,0x13c82,0x17d82,0x11c58,0x18e2e,0x13cd8,0x11c4c, // 710
428
-				0x17dd8,0x13ccc,0x11c46,0x17dcc,0x13cc6,0x17dc6,0x10c2e,0x11c6e,0x13cee,0x17dee, // 720
429
-				0x1be50,0x1df2c,0x1be48,0x1df26,0x1be44,0x1be42,0x13c50,0x19e2c,0x17cd0,0x13c48, // 730
430
-				0x19e26,0x17cc8,0x1be66,0x17cc4,0x13c42,0x17cc2,0x11c2c,0x13c6c,0x11c26,0x17cec, // 740
431
-				0x13c66,0x17ce6,0x1be28,0x1df16,0x1be24,0x1be22,0x13c28,0x19e16,0x17c68,0x13c24, // 750
432
-				0x17c64,0x13c22,0x17c62,0x11c16,0x13c36,0x17c76,0x1be14,0x1be12,0x13c14,0x17c34, // 760
433
-				0x13c12,0x17c32,0x102bc,0x1029e,0x106b8,0x1835e,0x1069c,0x1068e,0x1025e,0x106de, // 770
434
-				0x10eb0,0x1875c,0x10e98,0x1874e,0x10e8c,0x10e86,0x1065c,0x10edc,0x1064e,0x10ece, // 780
435
-				0x11ea0,0x18f58,0x1c7ae,0x11e90,0x18f4c,0x11e88,0x18f46,0x11e84,0x11e82,0x10e58, // 790
436
-				0x1872e,0x11ed8,0x18f6e,0x11ecc,0x10e46,0x11ec6,0x1062e,0x10e6e,0x11eee,0x19f50, // 800
437
-				0x1cfac,0x19f48,0x1cfa6,0x19f44,0x19f42,0x11e50,0x18f2c,0x13ed0,0x19f6c,0x18f26, // 810
438
-				0x13ec8,0x11e44,0x13ec4,0x11e42,0x13ec2,0x10e2c,0x11e6c,0x10e26,0x13eec,0x11e66, // 820
439
-				0x13ee6,0x1dfa8,0x1efd6,0x1dfa4,0x1dfa2,0x19f28,0x1cf96,0x1bf68,0x19f24,0x1bf64, // 830
440
-				0x19f22,0x1bf62,0x11e28,0x18f16,0x13e68,0x11e24,0x17ee8,0x13e64,0x11e22,0x17ee4, // 840
441
-				0x13e62,0x17ee2,0x10e16,0x11e36,0x13e76,0x17ef6,0x1df94,0x1df92,0x19f14,0x1bf34, // 850
442
-				0x19f12,0x1bf32,0x11e14,0x13e34,0x11e12,0x17e74,0x13e32,0x17e72,0x1df8a,0x19f0a, // 860
443
-				0x1bf1a,0x11e0a,0x13e1a,0x17e3a,0x1035c,0x1034e,0x10758,0x183ae,0x1074c,0x10746, // 870
444
-				0x1032e,0x1076e,0x10f50,0x187ac,0x10f48,0x187a6,0x10f44,0x10f42,0x1072c,0x10f6c, // 880
445
-				0x10726,0x10f66,0x18fa8,0x1c7d6,0x18fa4,0x18fa2,0x10f28,0x18796,0x11f68,0x18fb6, // 890
446
-				0x11f64,0x10f22,0x11f62,0x10716,0x10f36,0x11f76,0x1cfd4,0x1cfd2,0x18f94,0x19fb4, // 900
447
-				0x18f92,0x19fb2,0x10f14,0x11f34,0x10f12,0x13f74,0x11f32,0x13f72,0x1cfca,0x18f8a, // 910
448
-				0x19f9a,0x10f0a,0x11f1a,0x13f3a,0x103ac,0x103a6,0x107a8,0x183d6,0x107a4,0x107a2, // 920
449
-				0x10396,0x107b6,0x187d4,0x187d2,0x10794,0x10fb4,0x10792,0x10fb2,0x1c7ea)         // 929
357
+				0x1abe0, 0x1d5f8, 0x153c0, 0x1a9f0, 0x1d4fc, 0x151e0, 0x1a8f8, 0x1d47e, 0x150f0, 0x1a87c, //  10
358
+				0x15078, 0x1fad0, 0x15be0, 0x1adf8, 0x1fac8, 0x159f0, 0x1acfc, 0x1fac4, 0x158f8, 0x1ac7e, //  20
359
+				0x1fac2, 0x1587c, 0x1f5d0, 0x1faec, 0x15df8, 0x1f5c8, 0x1fae6, 0x15cfc, 0x1f5c4, 0x15c7e, //  30
360
+				0x1f5c2, 0x1ebd0, 0x1f5ec, 0x1ebc8, 0x1f5e6, 0x1ebc4, 0x1ebc2, 0x1d7d0, 0x1ebec, 0x1d7c8, //  40
361
+				0x1ebe6, 0x1d7c4, 0x1d7c2, 0x1afd0, 0x1d7ec, 0x1afc8, 0x1d7e6, 0x1afc4, 0x14bc0, 0x1a5f0, //  50
362
+				0x1d2fc, 0x149e0, 0x1a4f8, 0x1d27e, 0x148f0, 0x1a47c, 0x14878, 0x1a43e, 0x1483c, 0x1fa68, //  60
363
+				0x14df0, 0x1a6fc, 0x1fa64, 0x14cf8, 0x1a67e, 0x1fa62, 0x14c7c, 0x14c3e, 0x1f4e8, 0x1fa76, //  70
364
+				0x14efc, 0x1f4e4, 0x14e7e, 0x1f4e2, 0x1e9e8, 0x1f4f6, 0x1e9e4, 0x1e9e2, 0x1d3e8, 0x1e9f6, //  80
365
+				0x1d3e4, 0x1d3e2, 0x1a7e8, 0x1d3f6, 0x1a7e4, 0x1a7e2, 0x145e0, 0x1a2f8, 0x1d17e, 0x144f0, //  90
366
+				0x1a27c, 0x14478, 0x1a23e, 0x1443c, 0x1441e, 0x1fa34, 0x146f8, 0x1a37e, 0x1fa32, 0x1467c, // 100
367
+				0x1463e, 0x1f474, 0x1477e, 0x1f472, 0x1e8f4, 0x1e8f2, 0x1d1f4, 0x1d1f2, 0x1a3f4, 0x1a3f2, // 110
368
+				0x142f0, 0x1a17c, 0x14278, 0x1a13e, 0x1423c, 0x1421e, 0x1fa1a, 0x1437c, 0x1433e, 0x1f43a, // 120
369
+				0x1e87a, 0x1d0fa, 0x14178, 0x1a0be, 0x1413c, 0x1411e, 0x141be, 0x140bc, 0x1409e, 0x12bc0, // 130
370
+				0x195f0, 0x1cafc, 0x129e0, 0x194f8, 0x1ca7e, 0x128f0, 0x1947c, 0x12878, 0x1943e, 0x1283c, // 140
371
+				0x1f968, 0x12df0, 0x196fc, 0x1f964, 0x12cf8, 0x1967e, 0x1f962, 0x12c7c, 0x12c3e, 0x1f2e8, // 150
372
+				0x1f976, 0x12efc, 0x1f2e4, 0x12e7e, 0x1f2e2, 0x1e5e8, 0x1f2f6, 0x1e5e4, 0x1e5e2, 0x1cbe8, // 160
373
+				0x1e5f6, 0x1cbe4, 0x1cbe2, 0x197e8, 0x1cbf6, 0x197e4, 0x197e2, 0x1b5e0, 0x1daf8, 0x1ed7e, // 170
374
+				0x169c0, 0x1b4f0, 0x1da7c, 0x168e0, 0x1b478, 0x1da3e, 0x16870, 0x1b43c, 0x16838, 0x1b41e, // 180
375
+				0x1681c, 0x125e0, 0x192f8, 0x1c97e, 0x16de0, 0x124f0, 0x1927c, 0x16cf0, 0x1b67c, 0x1923e, // 190
376
+				0x16c78, 0x1243c, 0x16c3c, 0x1241e, 0x16c1e, 0x1f934, 0x126f8, 0x1937e, 0x1fb74, 0x1f932, // 200
377
+				0x16ef8, 0x1267c, 0x1fb72, 0x16e7c, 0x1263e, 0x16e3e, 0x1f274, 0x1277e, 0x1f6f4, 0x1f272, // 210
378
+				0x16f7e, 0x1f6f2, 0x1e4f4, 0x1edf4, 0x1e4f2, 0x1edf2, 0x1c9f4, 0x1dbf4, 0x1c9f2, 0x1dbf2, // 220
379
+				0x193f4, 0x193f2, 0x165c0, 0x1b2f0, 0x1d97c, 0x164e0, 0x1b278, 0x1d93e, 0x16470, 0x1b23c, // 230
380
+				0x16438, 0x1b21e, 0x1641c, 0x1640e, 0x122f0, 0x1917c, 0x166f0, 0x12278, 0x1913e, 0x16678, // 240
381
+				0x1b33e, 0x1663c, 0x1221e, 0x1661e, 0x1f91a, 0x1237c, 0x1fb3a, 0x1677c, 0x1233e, 0x1673e, // 250
382
+				0x1f23a, 0x1f67a, 0x1e47a, 0x1ecfa, 0x1c8fa, 0x1d9fa, 0x191fa, 0x162e0, 0x1b178, 0x1d8be, // 260
383
+				0x16270, 0x1b13c, 0x16238, 0x1b11e, 0x1621c, 0x1620e, 0x12178, 0x190be, 0x16378, 0x1213c, // 270
384
+				0x1633c, 0x1211e, 0x1631e, 0x121be, 0x163be, 0x16170, 0x1b0bc, 0x16138, 0x1b09e, 0x1611c, // 280
385
+				0x1610e, 0x120bc, 0x161bc, 0x1209e, 0x1619e, 0x160b8, 0x1b05e, 0x1609c, 0x1608e, 0x1205e, // 290
386
+				0x160de, 0x1605c, 0x1604e, 0x115e0, 0x18af8, 0x1c57e, 0x114f0, 0x18a7c, 0x11478, 0x18a3e, // 300
387
+				0x1143c, 0x1141e, 0x1f8b4, 0x116f8, 0x18b7e, 0x1f8b2, 0x1167c, 0x1163e, 0x1f174, 0x1177e, // 310
388
+				0x1f172, 0x1e2f4, 0x1e2f2, 0x1c5f4, 0x1c5f2, 0x18bf4, 0x18bf2, 0x135c0, 0x19af0, 0x1cd7c, // 320
389
+				0x134e0, 0x19a78, 0x1cd3e, 0x13470, 0x19a3c, 0x13438, 0x19a1e, 0x1341c, 0x1340e, 0x112f0, // 330
390
+				0x1897c, 0x136f0, 0x11278, 0x1893e, 0x13678, 0x19b3e, 0x1363c, 0x1121e, 0x1361e, 0x1f89a, // 340
391
+				0x1137c, 0x1f9ba, 0x1377c, 0x1133e, 0x1373e, 0x1f13a, 0x1f37a, 0x1e27a, 0x1e6fa, 0x1c4fa, // 350
392
+				0x1cdfa, 0x189fa, 0x1bae0, 0x1dd78, 0x1eebe, 0x174c0, 0x1ba70, 0x1dd3c, 0x17460, 0x1ba38, // 360
393
+				0x1dd1e, 0x17430, 0x1ba1c, 0x17418, 0x1ba0e, 0x1740c, 0x132e0, 0x19978, 0x1ccbe, 0x176e0, // 370
394
+				0x13270, 0x1993c, 0x17670, 0x1bb3c, 0x1991e, 0x17638, 0x1321c, 0x1761c, 0x1320e, 0x1760e, // 380
395
+				0x11178, 0x188be, 0x13378, 0x1113c, 0x17778, 0x1333c, 0x1111e, 0x1773c, 0x1331e, 0x1771e, // 390
396
+				0x111be, 0x133be, 0x177be, 0x172c0, 0x1b970, 0x1dcbc, 0x17260, 0x1b938, 0x1dc9e, 0x17230, // 400
397
+				0x1b91c, 0x17218, 0x1b90e, 0x1720c, 0x17206, 0x13170, 0x198bc, 0x17370, 0x13138, 0x1989e, // 410
398
+				0x17338, 0x1b99e, 0x1731c, 0x1310e, 0x1730e, 0x110bc, 0x131bc, 0x1109e, 0x173bc, 0x1319e, // 420
399
+				0x1739e, 0x17160, 0x1b8b8, 0x1dc5e, 0x17130, 0x1b89c, 0x17118, 0x1b88e, 0x1710c, 0x17106, // 430
400
+				0x130b8, 0x1985e, 0x171b8, 0x1309c, 0x1719c, 0x1308e, 0x1718e, 0x1105e, 0x130de, 0x171de, // 440
401
+				0x170b0, 0x1b85c, 0x17098, 0x1b84e, 0x1708c, 0x17086, 0x1305c, 0x170dc, 0x1304e, 0x170ce, // 450
402
+				0x17058, 0x1b82e, 0x1704c, 0x17046, 0x1302e, 0x1706e, 0x1702c, 0x17026, 0x10af0, 0x1857c, // 460
403
+				0x10a78, 0x1853e, 0x10a3c, 0x10a1e, 0x10b7c, 0x10b3e, 0x1f0ba, 0x1e17a, 0x1c2fa, 0x185fa, // 470
404
+				0x11ae0, 0x18d78, 0x1c6be, 0x11a70, 0x18d3c, 0x11a38, 0x18d1e, 0x11a1c, 0x11a0e, 0x10978, // 480
405
+				0x184be, 0x11b78, 0x1093c, 0x11b3c, 0x1091e, 0x11b1e, 0x109be, 0x11bbe, 0x13ac0, 0x19d70, // 490
406
+				0x1cebc, 0x13a60, 0x19d38, 0x1ce9e, 0x13a30, 0x19d1c, 0x13a18, 0x19d0e, 0x13a0c, 0x13a06, // 500
407
+				0x11970, 0x18cbc, 0x13b70, 0x11938, 0x18c9e, 0x13b38, 0x1191c, 0x13b1c, 0x1190e, 0x13b0e, // 510
408
+				0x108bc, 0x119bc, 0x1089e, 0x13bbc, 0x1199e, 0x13b9e, 0x1bd60, 0x1deb8, 0x1ef5e, 0x17a40, // 520
409
+				0x1bd30, 0x1de9c, 0x17a20, 0x1bd18, 0x1de8e, 0x17a10, 0x1bd0c, 0x17a08, 0x1bd06, 0x17a04, // 530
410
+				0x13960, 0x19cb8, 0x1ce5e, 0x17b60, 0x13930, 0x19c9c, 0x17b30, 0x1bd9c, 0x19c8e, 0x17b18, // 540
411
+				0x1390c, 0x17b0c, 0x13906, 0x17b06, 0x118b8, 0x18c5e, 0x139b8, 0x1189c, 0x17bb8, 0x1399c, // 550
412
+				0x1188e, 0x17b9c, 0x1398e, 0x17b8e, 0x1085e, 0x118de, 0x139de, 0x17bde, 0x17940, 0x1bcb0, // 560
413
+				0x1de5c, 0x17920, 0x1bc98, 0x1de4e, 0x17910, 0x1bc8c, 0x17908, 0x1bc86, 0x17904, 0x17902, // 570
414
+				0x138b0, 0x19c5c, 0x179b0, 0x13898, 0x19c4e, 0x17998, 0x1bcce, 0x1798c, 0x13886, 0x17986, // 580
415
+				0x1185c, 0x138dc, 0x1184e, 0x179dc, 0x138ce, 0x179ce, 0x178a0, 0x1bc58, 0x1de2e, 0x17890, // 590
416
+				0x1bc4c, 0x17888, 0x1bc46, 0x17884, 0x17882, 0x13858, 0x19c2e, 0x178d8, 0x1384c, 0x178cc, // 600
417
+				0x13846, 0x178c6, 0x1182e, 0x1386e, 0x178ee, 0x17850, 0x1bc2c, 0x17848, 0x1bc26, 0x17844, // 610
418
+				0x17842, 0x1382c, 0x1786c, 0x13826, 0x17866, 0x17828, 0x1bc16, 0x17824, 0x17822, 0x13816, // 620
419
+				0x17836, 0x10578, 0x182be, 0x1053c, 0x1051e, 0x105be, 0x10d70, 0x186bc, 0x10d38, 0x1869e, // 630
420
+				0x10d1c, 0x10d0e, 0x104bc, 0x10dbc, 0x1049e, 0x10d9e, 0x11d60, 0x18eb8, 0x1c75e, 0x11d30, // 640
421
+				0x18e9c, 0x11d18, 0x18e8e, 0x11d0c, 0x11d06, 0x10cb8, 0x1865e, 0x11db8, 0x10c9c, 0x11d9c, // 650
422
+				0x10c8e, 0x11d8e, 0x1045e, 0x10cde, 0x11dde, 0x13d40, 0x19eb0, 0x1cf5c, 0x13d20, 0x19e98, // 660
423
+				0x1cf4e, 0x13d10, 0x19e8c, 0x13d08, 0x19e86, 0x13d04, 0x13d02, 0x11cb0, 0x18e5c, 0x13db0, // 670
424
+				0x11c98, 0x18e4e, 0x13d98, 0x19ece, 0x13d8c, 0x11c86, 0x13d86, 0x10c5c, 0x11cdc, 0x10c4e, // 680
425
+				0x13ddc, 0x11cce, 0x13dce, 0x1bea0, 0x1df58, 0x1efae, 0x1be90, 0x1df4c, 0x1be88, 0x1df46, // 690
426
+				0x1be84, 0x1be82, 0x13ca0, 0x19e58, 0x1cf2e, 0x17da0, 0x13c90, 0x19e4c, 0x17d90, 0x1becc, // 700
427
+				0x19e46, 0x17d88, 0x13c84, 0x17d84, 0x13c82, 0x17d82, 0x11c58, 0x18e2e, 0x13cd8, 0x11c4c, // 710
428
+				0x17dd8, 0x13ccc, 0x11c46, 0x17dcc, 0x13cc6, 0x17dc6, 0x10c2e, 0x11c6e, 0x13cee, 0x17dee, // 720
429
+				0x1be50, 0x1df2c, 0x1be48, 0x1df26, 0x1be44, 0x1be42, 0x13c50, 0x19e2c, 0x17cd0, 0x13c48, // 730
430
+				0x19e26, 0x17cc8, 0x1be66, 0x17cc4, 0x13c42, 0x17cc2, 0x11c2c, 0x13c6c, 0x11c26, 0x17cec, // 740
431
+				0x13c66, 0x17ce6, 0x1be28, 0x1df16, 0x1be24, 0x1be22, 0x13c28, 0x19e16, 0x17c68, 0x13c24, // 750
432
+				0x17c64, 0x13c22, 0x17c62, 0x11c16, 0x13c36, 0x17c76, 0x1be14, 0x1be12, 0x13c14, 0x17c34, // 760
433
+				0x13c12, 0x17c32, 0x102bc, 0x1029e, 0x106b8, 0x1835e, 0x1069c, 0x1068e, 0x1025e, 0x106de, // 770
434
+				0x10eb0, 0x1875c, 0x10e98, 0x1874e, 0x10e8c, 0x10e86, 0x1065c, 0x10edc, 0x1064e, 0x10ece, // 780
435
+				0x11ea0, 0x18f58, 0x1c7ae, 0x11e90, 0x18f4c, 0x11e88, 0x18f46, 0x11e84, 0x11e82, 0x10e58, // 790
436
+				0x1872e, 0x11ed8, 0x18f6e, 0x11ecc, 0x10e46, 0x11ec6, 0x1062e, 0x10e6e, 0x11eee, 0x19f50, // 800
437
+				0x1cfac, 0x19f48, 0x1cfa6, 0x19f44, 0x19f42, 0x11e50, 0x18f2c, 0x13ed0, 0x19f6c, 0x18f26, // 810
438
+				0x13ec8, 0x11e44, 0x13ec4, 0x11e42, 0x13ec2, 0x10e2c, 0x11e6c, 0x10e26, 0x13eec, 0x11e66, // 820
439
+				0x13ee6, 0x1dfa8, 0x1efd6, 0x1dfa4, 0x1dfa2, 0x19f28, 0x1cf96, 0x1bf68, 0x19f24, 0x1bf64, // 830
440
+				0x19f22, 0x1bf62, 0x11e28, 0x18f16, 0x13e68, 0x11e24, 0x17ee8, 0x13e64, 0x11e22, 0x17ee4, // 840
441
+				0x13e62, 0x17ee2, 0x10e16, 0x11e36, 0x13e76, 0x17ef6, 0x1df94, 0x1df92, 0x19f14, 0x1bf34, // 850
442
+				0x19f12, 0x1bf32, 0x11e14, 0x13e34, 0x11e12, 0x17e74, 0x13e32, 0x17e72, 0x1df8a, 0x19f0a, // 860
443
+				0x1bf1a, 0x11e0a, 0x13e1a, 0x17e3a, 0x1035c, 0x1034e, 0x10758, 0x183ae, 0x1074c, 0x10746, // 870
444
+				0x1032e, 0x1076e, 0x10f50, 0x187ac, 0x10f48, 0x187a6, 0x10f44, 0x10f42, 0x1072c, 0x10f6c, // 880
445
+				0x10726, 0x10f66, 0x18fa8, 0x1c7d6, 0x18fa4, 0x18fa2, 0x10f28, 0x18796, 0x11f68, 0x18fb6, // 890
446
+				0x11f64, 0x10f22, 0x11f62, 0x10716, 0x10f36, 0x11f76, 0x1cfd4, 0x1cfd2, 0x18f94, 0x19fb4, // 900
447
+				0x18f92, 0x19fb2, 0x10f14, 0x11f34, 0x10f12, 0x13f74, 0x11f32, 0x13f72, 0x1cfca, 0x18f8a, // 910
448
+				0x19f9a, 0x10f0a, 0x11f1a, 0x13f3a, 0x103ac, 0x103a6, 0x107a8, 0x183d6, 0x107a4, 0x107a2, // 920
449
+				0x10396, 0x107b6, 0x187d4, 0x187d2, 0x10794, 0x10fb4, 0x10792, 0x10fb2, 0x1c7ea)         // 929
450 450
 		); // end of $clusters array
451 451
 
452 452
 		/**
@@ -455,80 +455,80 @@  discard block
 block discarded – undo
455 455
 		 */
456 456
 		protected $rsfactors = array(
457 457
 			array( // ECL 0 (2 factors) -------------------------------------------------------------------------------
458
-				0x01b,0x395),                                                                                    //   2
458
+				0x01b, 0x395), //   2
459 459
 			array( // ECL 1 (4 factors) -------------------------------------------------------------------------------
460
-				0x20a,0x238,0x2d3,0x329),                                                                        //   4
460
+				0x20a, 0x238, 0x2d3, 0x329), //   4
461 461
 			array( // ECL 2 (8 factors) -------------------------------------------------------------------------------
462
-				0x0ed,0x134,0x1b4,0x11c,0x286,0x28d,0x1ac,0x17b),                                                //   8
462
+				0x0ed, 0x134, 0x1b4, 0x11c, 0x286, 0x28d, 0x1ac, 0x17b), //   8
463 463
 			array( // ECL 3 (16 factors) ------------------------------------------------------------------------------
464
-				0x112,0x232,0x0e8,0x2f3,0x257,0x20c,0x321,0x084,0x127,0x074,0x1ba,0x1ac,0x127,0x02a,0x0b0,0x041),//  16
464
+				0x112, 0x232, 0x0e8, 0x2f3, 0x257, 0x20c, 0x321, 0x084, 0x127, 0x074, 0x1ba, 0x1ac, 0x127, 0x02a, 0x0b0, 0x041), //  16
465 465
 			array( // ECL 4 (32 factors) ------------------------------------------------------------------------------
466
-				0x169,0x23f,0x39a,0x20d,0x0b0,0x24a,0x280,0x141,0x218,0x2e6,0x2a5,0x2e6,0x2af,0x11c,0x0c1,0x205, //  16
467
-				0x111,0x1ee,0x107,0x093,0x251,0x320,0x23b,0x140,0x323,0x085,0x0e7,0x186,0x2ad,0x14a,0x03f,0x19a),//  32
466
+				0x169, 0x23f, 0x39a, 0x20d, 0x0b0, 0x24a, 0x280, 0x141, 0x218, 0x2e6, 0x2a5, 0x2e6, 0x2af, 0x11c, 0x0c1, 0x205, //  16
467
+				0x111, 0x1ee, 0x107, 0x093, 0x251, 0x320, 0x23b, 0x140, 0x323, 0x085, 0x0e7, 0x186, 0x2ad, 0x14a, 0x03f, 0x19a), //  32
468 468
 			array( // ECL 5 (64 factors) ------------------------------------------------------------------------------
469
-				0x21b,0x1a6,0x006,0x05d,0x35e,0x303,0x1c5,0x06a,0x262,0x11f,0x06b,0x1f9,0x2dd,0x36d,0x17d,0x264, //  16
470
-				0x2d3,0x1dc,0x1ce,0x0ac,0x1ae,0x261,0x35a,0x336,0x21f,0x178,0x1ff,0x190,0x2a0,0x2fa,0x11b,0x0b8, //  32
471
-				0x1b8,0x023,0x207,0x01f,0x1cc,0x252,0x0e1,0x217,0x205,0x160,0x25d,0x09e,0x28b,0x0c9,0x1e8,0x1f6, //  48
472
-				0x288,0x2dd,0x2cd,0x053,0x194,0x061,0x118,0x303,0x348,0x275,0x004,0x17d,0x34b,0x26f,0x108,0x21f),//  64
469
+				0x21b, 0x1a6, 0x006, 0x05d, 0x35e, 0x303, 0x1c5, 0x06a, 0x262, 0x11f, 0x06b, 0x1f9, 0x2dd, 0x36d, 0x17d, 0x264, //  16
470
+				0x2d3, 0x1dc, 0x1ce, 0x0ac, 0x1ae, 0x261, 0x35a, 0x336, 0x21f, 0x178, 0x1ff, 0x190, 0x2a0, 0x2fa, 0x11b, 0x0b8, //  32
471
+				0x1b8, 0x023, 0x207, 0x01f, 0x1cc, 0x252, 0x0e1, 0x217, 0x205, 0x160, 0x25d, 0x09e, 0x28b, 0x0c9, 0x1e8, 0x1f6, //  48
472
+				0x288, 0x2dd, 0x2cd, 0x053, 0x194, 0x061, 0x118, 0x303, 0x348, 0x275, 0x004, 0x17d, 0x34b, 0x26f, 0x108, 0x21f), //  64
473 473
 			array( // ECL 6 (128 factors) -----------------------------------------------------------------------------
474
-				0x209,0x136,0x360,0x223,0x35a,0x244,0x128,0x17b,0x035,0x30b,0x381,0x1bc,0x190,0x39d,0x2ed,0x19f, //  16
475
-				0x336,0x05d,0x0d9,0x0d0,0x3a0,0x0f4,0x247,0x26c,0x0f6,0x094,0x1bf,0x277,0x124,0x38c,0x1ea,0x2c0, //  32
476
-				0x204,0x102,0x1c9,0x38b,0x252,0x2d3,0x2a2,0x124,0x110,0x060,0x2ac,0x1b0,0x2ae,0x25e,0x35c,0x239, //  48
477
-				0x0c1,0x0db,0x081,0x0ba,0x0ec,0x11f,0x0c0,0x307,0x116,0x0ad,0x028,0x17b,0x2c8,0x1cf,0x286,0x308, //  64
478
-				0x0ab,0x1eb,0x129,0x2fb,0x09c,0x2dc,0x05f,0x10e,0x1bf,0x05a,0x1fb,0x030,0x0e4,0x335,0x328,0x382, //  80
479
-				0x310,0x297,0x273,0x17a,0x17e,0x106,0x17c,0x25a,0x2f2,0x150,0x059,0x266,0x057,0x1b0,0x29e,0x268, //  96
480
-				0x09d,0x176,0x0f2,0x2d6,0x258,0x10d,0x177,0x382,0x34d,0x1c6,0x162,0x082,0x32e,0x24b,0x324,0x022, // 112
481
-				0x0d3,0x14a,0x21b,0x129,0x33b,0x361,0x025,0x205,0x342,0x13b,0x226,0x056,0x321,0x004,0x06c,0x21b),// 128
474
+				0x209, 0x136, 0x360, 0x223, 0x35a, 0x244, 0x128, 0x17b, 0x035, 0x30b, 0x381, 0x1bc, 0x190, 0x39d, 0x2ed, 0x19f, //  16
475
+				0x336, 0x05d, 0x0d9, 0x0d0, 0x3a0, 0x0f4, 0x247, 0x26c, 0x0f6, 0x094, 0x1bf, 0x277, 0x124, 0x38c, 0x1ea, 0x2c0, //  32
476
+				0x204, 0x102, 0x1c9, 0x38b, 0x252, 0x2d3, 0x2a2, 0x124, 0x110, 0x060, 0x2ac, 0x1b0, 0x2ae, 0x25e, 0x35c, 0x239, //  48
477
+				0x0c1, 0x0db, 0x081, 0x0ba, 0x0ec, 0x11f, 0x0c0, 0x307, 0x116, 0x0ad, 0x028, 0x17b, 0x2c8, 0x1cf, 0x286, 0x308, //  64
478
+				0x0ab, 0x1eb, 0x129, 0x2fb, 0x09c, 0x2dc, 0x05f, 0x10e, 0x1bf, 0x05a, 0x1fb, 0x030, 0x0e4, 0x335, 0x328, 0x382, //  80
479
+				0x310, 0x297, 0x273, 0x17a, 0x17e, 0x106, 0x17c, 0x25a, 0x2f2, 0x150, 0x059, 0x266, 0x057, 0x1b0, 0x29e, 0x268, //  96
480
+				0x09d, 0x176, 0x0f2, 0x2d6, 0x258, 0x10d, 0x177, 0x382, 0x34d, 0x1c6, 0x162, 0x082, 0x32e, 0x24b, 0x324, 0x022, // 112
481
+				0x0d3, 0x14a, 0x21b, 0x129, 0x33b, 0x361, 0x025, 0x205, 0x342, 0x13b, 0x226, 0x056, 0x321, 0x004, 0x06c, 0x21b), // 128
482 482
 			array( // ECL 7 (256 factors) -----------------------------------------------------------------------------
483
-				0x20c,0x37e,0x04b,0x2fe,0x372,0x359,0x04a,0x0cc,0x052,0x24a,0x2c4,0x0fa,0x389,0x312,0x08a,0x2d0, //  16
484
-				0x35a,0x0c2,0x137,0x391,0x113,0x0be,0x177,0x352,0x1b6,0x2dd,0x0c2,0x118,0x0c9,0x118,0x33c,0x2f5, //  32
485
-				0x2c6,0x32e,0x397,0x059,0x044,0x239,0x00b,0x0cc,0x31c,0x25d,0x21c,0x391,0x321,0x2bc,0x31f,0x089, //  48
486
-				0x1b7,0x1a2,0x250,0x29c,0x161,0x35b,0x172,0x2b6,0x145,0x0f0,0x0d8,0x101,0x11c,0x225,0x0d1,0x374, //  64
487
-				0x13b,0x046,0x149,0x319,0x1ea,0x112,0x36d,0x0a2,0x2ed,0x32c,0x2ac,0x1cd,0x14e,0x178,0x351,0x209, //  80
488
-				0x133,0x123,0x323,0x2c8,0x013,0x166,0x18f,0x38c,0x067,0x1ff,0x033,0x008,0x205,0x0e1,0x121,0x1d6, //  96
489
-				0x27d,0x2db,0x042,0x0ff,0x395,0x10d,0x1cf,0x33e,0x2da,0x1b1,0x350,0x249,0x088,0x21a,0x38a,0x05a, // 112
490
-				0x002,0x122,0x2e7,0x0c7,0x28f,0x387,0x149,0x031,0x322,0x244,0x163,0x24c,0x0bc,0x1ce,0x00a,0x086, // 128
491
-				0x274,0x140,0x1df,0x082,0x2e3,0x047,0x107,0x13e,0x176,0x259,0x0c0,0x25d,0x08e,0x2a1,0x2af,0x0ea, // 144
492
-				0x2d2,0x180,0x0b1,0x2f0,0x25f,0x280,0x1c7,0x0c1,0x2b1,0x2c3,0x325,0x281,0x030,0x03c,0x2dc,0x26d, // 160
493
-				0x37f,0x220,0x105,0x354,0x28f,0x135,0x2b9,0x2f3,0x2f4,0x03c,0x0e7,0x305,0x1b2,0x1a5,0x2d6,0x210, // 176
494
-				0x1f7,0x076,0x031,0x31b,0x020,0x090,0x1f4,0x0ee,0x344,0x18a,0x118,0x236,0x13f,0x009,0x287,0x226, // 192
495
-				0x049,0x392,0x156,0x07e,0x020,0x2a9,0x14b,0x318,0x26c,0x03c,0x261,0x1b9,0x0b4,0x317,0x37d,0x2f2, // 208
496
-				0x25d,0x17f,0x0e4,0x2ed,0x2f8,0x0d5,0x036,0x129,0x086,0x036,0x342,0x12b,0x39a,0x0bf,0x38e,0x214, // 224
497
-				0x261,0x33d,0x0bd,0x014,0x0a7,0x01d,0x368,0x1c1,0x053,0x192,0x029,0x290,0x1f9,0x243,0x1e1,0x0ad, // 240
498
-				0x194,0x0fb,0x2b0,0x05f,0x1f1,0x22b,0x282,0x21f,0x133,0x09f,0x39c,0x22e,0x288,0x037,0x1f1,0x00a),// 256
483
+				0x20c, 0x37e, 0x04b, 0x2fe, 0x372, 0x359, 0x04a, 0x0cc, 0x052, 0x24a, 0x2c4, 0x0fa, 0x389, 0x312, 0x08a, 0x2d0, //  16
484
+				0x35a, 0x0c2, 0x137, 0x391, 0x113, 0x0be, 0x177, 0x352, 0x1b6, 0x2dd, 0x0c2, 0x118, 0x0c9, 0x118, 0x33c, 0x2f5, //  32
485
+				0x2c6, 0x32e, 0x397, 0x059, 0x044, 0x239, 0x00b, 0x0cc, 0x31c, 0x25d, 0x21c, 0x391, 0x321, 0x2bc, 0x31f, 0x089, //  48
486
+				0x1b7, 0x1a2, 0x250, 0x29c, 0x161, 0x35b, 0x172, 0x2b6, 0x145, 0x0f0, 0x0d8, 0x101, 0x11c, 0x225, 0x0d1, 0x374, //  64
487
+				0x13b, 0x046, 0x149, 0x319, 0x1ea, 0x112, 0x36d, 0x0a2, 0x2ed, 0x32c, 0x2ac, 0x1cd, 0x14e, 0x178, 0x351, 0x209, //  80
488
+				0x133, 0x123, 0x323, 0x2c8, 0x013, 0x166, 0x18f, 0x38c, 0x067, 0x1ff, 0x033, 0x008, 0x205, 0x0e1, 0x121, 0x1d6, //  96
489
+				0x27d, 0x2db, 0x042, 0x0ff, 0x395, 0x10d, 0x1cf, 0x33e, 0x2da, 0x1b1, 0x350, 0x249, 0x088, 0x21a, 0x38a, 0x05a, // 112
490
+				0x002, 0x122, 0x2e7, 0x0c7, 0x28f, 0x387, 0x149, 0x031, 0x322, 0x244, 0x163, 0x24c, 0x0bc, 0x1ce, 0x00a, 0x086, // 128
491
+				0x274, 0x140, 0x1df, 0x082, 0x2e3, 0x047, 0x107, 0x13e, 0x176, 0x259, 0x0c0, 0x25d, 0x08e, 0x2a1, 0x2af, 0x0ea, // 144
492
+				0x2d2, 0x180, 0x0b1, 0x2f0, 0x25f, 0x280, 0x1c7, 0x0c1, 0x2b1, 0x2c3, 0x325, 0x281, 0x030, 0x03c, 0x2dc, 0x26d, // 160
493
+				0x37f, 0x220, 0x105, 0x354, 0x28f, 0x135, 0x2b9, 0x2f3, 0x2f4, 0x03c, 0x0e7, 0x305, 0x1b2, 0x1a5, 0x2d6, 0x210, // 176
494
+				0x1f7, 0x076, 0x031, 0x31b, 0x020, 0x090, 0x1f4, 0x0ee, 0x344, 0x18a, 0x118, 0x236, 0x13f, 0x009, 0x287, 0x226, // 192
495
+				0x049, 0x392, 0x156, 0x07e, 0x020, 0x2a9, 0x14b, 0x318, 0x26c, 0x03c, 0x261, 0x1b9, 0x0b4, 0x317, 0x37d, 0x2f2, // 208
496
+				0x25d, 0x17f, 0x0e4, 0x2ed, 0x2f8, 0x0d5, 0x036, 0x129, 0x086, 0x036, 0x342, 0x12b, 0x39a, 0x0bf, 0x38e, 0x214, // 224
497
+				0x261, 0x33d, 0x0bd, 0x014, 0x0a7, 0x01d, 0x368, 0x1c1, 0x053, 0x192, 0x029, 0x290, 0x1f9, 0x243, 0x1e1, 0x0ad, // 240
498
+				0x194, 0x0fb, 0x2b0, 0x05f, 0x1f1, 0x22b, 0x282, 0x21f, 0x133, 0x09f, 0x39c, 0x22e, 0x288, 0x037, 0x1f1, 0x00a), // 256
499 499
 			array( // ECL 8 (512 factors) -----------------------------------------------------------------------------
500
-				0x160,0x04d,0x175,0x1f8,0x023,0x257,0x1ac,0x0cf,0x199,0x23e,0x076,0x1f2,0x11d,0x17c,0x15e,0x1ec, //  16
501
-				0x0c5,0x109,0x398,0x09b,0x392,0x12b,0x0e5,0x283,0x126,0x367,0x132,0x058,0x057,0x0c1,0x160,0x30d, //  32
502
-				0x34e,0x04b,0x147,0x208,0x1b3,0x21f,0x0cb,0x29a,0x0f9,0x15a,0x30d,0x26d,0x280,0x10c,0x31a,0x216, //  48
503
-				0x21b,0x30d,0x198,0x186,0x284,0x066,0x1dc,0x1f3,0x122,0x278,0x221,0x025,0x35a,0x394,0x228,0x029, //  64
504
-				0x21e,0x121,0x07a,0x110,0x17f,0x320,0x1e5,0x062,0x2f0,0x1d8,0x2f9,0x06b,0x310,0x35c,0x292,0x2e5, //  80
505
-				0x122,0x0cc,0x2a9,0x197,0x357,0x055,0x063,0x03e,0x1e2,0x0b4,0x014,0x129,0x1c3,0x251,0x391,0x08e, //  96
506
-				0x328,0x2ac,0x11f,0x218,0x231,0x04c,0x28d,0x383,0x2d9,0x237,0x2e8,0x186,0x201,0x0c0,0x204,0x102, // 112
507
-				0x0f0,0x206,0x31a,0x18b,0x300,0x350,0x033,0x262,0x180,0x0a8,0x0be,0x33a,0x148,0x254,0x312,0x12f, // 128
508
-				0x23a,0x17d,0x19f,0x281,0x09c,0x0ed,0x097,0x1ad,0x213,0x0cf,0x2a4,0x2c6,0x059,0x0a8,0x130,0x192, // 144
509
-				0x028,0x2c4,0x23f,0x0a2,0x360,0x0e5,0x041,0x35d,0x349,0x200,0x0a4,0x1dd,0x0dd,0x05c,0x166,0x311, // 160
510
-				0x120,0x165,0x352,0x344,0x33b,0x2e0,0x2c3,0x05e,0x008,0x1ee,0x072,0x209,0x002,0x1f3,0x353,0x21f, // 176
511
-				0x098,0x2d9,0x303,0x05f,0x0f8,0x169,0x242,0x143,0x358,0x31d,0x121,0x033,0x2ac,0x1d2,0x215,0x334, // 192
512
-				0x29d,0x02d,0x386,0x1c4,0x0a7,0x156,0x0f4,0x0ad,0x023,0x1cf,0x28b,0x033,0x2bb,0x24f,0x1c4,0x242, // 208
513
-				0x025,0x07c,0x12a,0x14c,0x228,0x02b,0x1ab,0x077,0x296,0x309,0x1db,0x352,0x2fc,0x16c,0x242,0x38f, // 224
514
-				0x11b,0x2c7,0x1d8,0x1a4,0x0f5,0x120,0x252,0x18a,0x1ff,0x147,0x24d,0x309,0x2bb,0x2b0,0x02b,0x198, // 240
515
-				0x34a,0x17f,0x2d1,0x209,0x230,0x284,0x2ca,0x22f,0x03e,0x091,0x369,0x297,0x2c9,0x09f,0x2a0,0x2d9, // 256
516
-				0x270,0x03b,0x0c1,0x1a1,0x09e,0x0d1,0x233,0x234,0x157,0x2b5,0x06d,0x260,0x233,0x16d,0x0b5,0x304, // 272
517
-				0x2a5,0x136,0x0f8,0x161,0x2c4,0x19a,0x243,0x366,0x269,0x349,0x278,0x35c,0x121,0x218,0x023,0x309, // 288
518
-				0x26a,0x24a,0x1a8,0x341,0x04d,0x255,0x15a,0x10d,0x2f5,0x278,0x2b7,0x2ef,0x14b,0x0f7,0x0b8,0x02d, // 304
519
-				0x313,0x2a8,0x012,0x042,0x197,0x171,0x036,0x1ec,0x0e4,0x265,0x33e,0x39a,0x1b5,0x207,0x284,0x389, // 320
520
-				0x315,0x1a4,0x131,0x1b9,0x0cf,0x12c,0x37c,0x33b,0x08d,0x219,0x17d,0x296,0x201,0x038,0x0fc,0x155, // 336
521
-				0x0f2,0x31d,0x346,0x345,0x2d0,0x0e0,0x133,0x277,0x03d,0x057,0x230,0x136,0x2f4,0x299,0x18d,0x328, // 352
522
-				0x353,0x135,0x1d9,0x31b,0x17a,0x01f,0x287,0x393,0x1cb,0x326,0x24e,0x2db,0x1a9,0x0d8,0x224,0x0f9, // 368
523
-				0x141,0x371,0x2bb,0x217,0x2a1,0x30e,0x0d2,0x32f,0x389,0x12f,0x34b,0x39a,0x119,0x049,0x1d5,0x317, // 384
524
-				0x294,0x0a2,0x1f2,0x134,0x09b,0x1a6,0x38b,0x331,0x0bb,0x03e,0x010,0x1a9,0x217,0x150,0x11e,0x1b5, // 400
525
-				0x177,0x111,0x262,0x128,0x0b7,0x39b,0x074,0x29b,0x2ef,0x161,0x03e,0x16e,0x2b3,0x17b,0x2af,0x34a, // 416
526
-				0x025,0x165,0x2d0,0x2e6,0x14a,0x005,0x027,0x39b,0x137,0x1a8,0x0f2,0x2ed,0x141,0x036,0x29d,0x13c, // 432
527
-				0x156,0x12b,0x216,0x069,0x29b,0x1e8,0x280,0x2a0,0x240,0x21c,0x13c,0x1e6,0x2d1,0x262,0x02e,0x290, // 448
528
-				0x1bf,0x0ab,0x268,0x1d0,0x0be,0x213,0x129,0x141,0x2fa,0x2f0,0x215,0x0af,0x086,0x00e,0x17d,0x1b1, // 464
529
-				0x2cd,0x02d,0x06f,0x014,0x254,0x11c,0x2e0,0x08a,0x286,0x19b,0x36d,0x29d,0x08d,0x397,0x02d,0x30c, // 480
530
-				0x197,0x0a4,0x14c,0x383,0x0a5,0x2d6,0x258,0x145,0x1f2,0x28f,0x165,0x2f0,0x300,0x0df,0x351,0x287, // 496
531
-				0x03f,0x136,0x35f,0x0fb,0x16e,0x130,0x11a,0x2e2,0x2a3,0x19a,0x185,0x0f4,0x01f,0x079,0x12f,0x107) // 512
500
+				0x160, 0x04d, 0x175, 0x1f8, 0x023, 0x257, 0x1ac, 0x0cf, 0x199, 0x23e, 0x076, 0x1f2, 0x11d, 0x17c, 0x15e, 0x1ec, //  16
501
+				0x0c5, 0x109, 0x398, 0x09b, 0x392, 0x12b, 0x0e5, 0x283, 0x126, 0x367, 0x132, 0x058, 0x057, 0x0c1, 0x160, 0x30d, //  32
502
+				0x34e, 0x04b, 0x147, 0x208, 0x1b3, 0x21f, 0x0cb, 0x29a, 0x0f9, 0x15a, 0x30d, 0x26d, 0x280, 0x10c, 0x31a, 0x216, //  48
503
+				0x21b, 0x30d, 0x198, 0x186, 0x284, 0x066, 0x1dc, 0x1f3, 0x122, 0x278, 0x221, 0x025, 0x35a, 0x394, 0x228, 0x029, //  64
504
+				0x21e, 0x121, 0x07a, 0x110, 0x17f, 0x320, 0x1e5, 0x062, 0x2f0, 0x1d8, 0x2f9, 0x06b, 0x310, 0x35c, 0x292, 0x2e5, //  80
505
+				0x122, 0x0cc, 0x2a9, 0x197, 0x357, 0x055, 0x063, 0x03e, 0x1e2, 0x0b4, 0x014, 0x129, 0x1c3, 0x251, 0x391, 0x08e, //  96
506
+				0x328, 0x2ac, 0x11f, 0x218, 0x231, 0x04c, 0x28d, 0x383, 0x2d9, 0x237, 0x2e8, 0x186, 0x201, 0x0c0, 0x204, 0x102, // 112
507
+				0x0f0, 0x206, 0x31a, 0x18b, 0x300, 0x350, 0x033, 0x262, 0x180, 0x0a8, 0x0be, 0x33a, 0x148, 0x254, 0x312, 0x12f, // 128
508
+				0x23a, 0x17d, 0x19f, 0x281, 0x09c, 0x0ed, 0x097, 0x1ad, 0x213, 0x0cf, 0x2a4, 0x2c6, 0x059, 0x0a8, 0x130, 0x192, // 144
509
+				0x028, 0x2c4, 0x23f, 0x0a2, 0x360, 0x0e5, 0x041, 0x35d, 0x349, 0x200, 0x0a4, 0x1dd, 0x0dd, 0x05c, 0x166, 0x311, // 160
510
+				0x120, 0x165, 0x352, 0x344, 0x33b, 0x2e0, 0x2c3, 0x05e, 0x008, 0x1ee, 0x072, 0x209, 0x002, 0x1f3, 0x353, 0x21f, // 176
511
+				0x098, 0x2d9, 0x303, 0x05f, 0x0f8, 0x169, 0x242, 0x143, 0x358, 0x31d, 0x121, 0x033, 0x2ac, 0x1d2, 0x215, 0x334, // 192
512
+				0x29d, 0x02d, 0x386, 0x1c4, 0x0a7, 0x156, 0x0f4, 0x0ad, 0x023, 0x1cf, 0x28b, 0x033, 0x2bb, 0x24f, 0x1c4, 0x242, // 208
513
+				0x025, 0x07c, 0x12a, 0x14c, 0x228, 0x02b, 0x1ab, 0x077, 0x296, 0x309, 0x1db, 0x352, 0x2fc, 0x16c, 0x242, 0x38f, // 224
514
+				0x11b, 0x2c7, 0x1d8, 0x1a4, 0x0f5, 0x120, 0x252, 0x18a, 0x1ff, 0x147, 0x24d, 0x309, 0x2bb, 0x2b0, 0x02b, 0x198, // 240
515
+				0x34a, 0x17f, 0x2d1, 0x209, 0x230, 0x284, 0x2ca, 0x22f, 0x03e, 0x091, 0x369, 0x297, 0x2c9, 0x09f, 0x2a0, 0x2d9, // 256
516
+				0x270, 0x03b, 0x0c1, 0x1a1, 0x09e, 0x0d1, 0x233, 0x234, 0x157, 0x2b5, 0x06d, 0x260, 0x233, 0x16d, 0x0b5, 0x304, // 272
517
+				0x2a5, 0x136, 0x0f8, 0x161, 0x2c4, 0x19a, 0x243, 0x366, 0x269, 0x349, 0x278, 0x35c, 0x121, 0x218, 0x023, 0x309, // 288
518
+				0x26a, 0x24a, 0x1a8, 0x341, 0x04d, 0x255, 0x15a, 0x10d, 0x2f5, 0x278, 0x2b7, 0x2ef, 0x14b, 0x0f7, 0x0b8, 0x02d, // 304
519
+				0x313, 0x2a8, 0x012, 0x042, 0x197, 0x171, 0x036, 0x1ec, 0x0e4, 0x265, 0x33e, 0x39a, 0x1b5, 0x207, 0x284, 0x389, // 320
520
+				0x315, 0x1a4, 0x131, 0x1b9, 0x0cf, 0x12c, 0x37c, 0x33b, 0x08d, 0x219, 0x17d, 0x296, 0x201, 0x038, 0x0fc, 0x155, // 336
521
+				0x0f2, 0x31d, 0x346, 0x345, 0x2d0, 0x0e0, 0x133, 0x277, 0x03d, 0x057, 0x230, 0x136, 0x2f4, 0x299, 0x18d, 0x328, // 352
522
+				0x353, 0x135, 0x1d9, 0x31b, 0x17a, 0x01f, 0x287, 0x393, 0x1cb, 0x326, 0x24e, 0x2db, 0x1a9, 0x0d8, 0x224, 0x0f9, // 368
523
+				0x141, 0x371, 0x2bb, 0x217, 0x2a1, 0x30e, 0x0d2, 0x32f, 0x389, 0x12f, 0x34b, 0x39a, 0x119, 0x049, 0x1d5, 0x317, // 384
524
+				0x294, 0x0a2, 0x1f2, 0x134, 0x09b, 0x1a6, 0x38b, 0x331, 0x0bb, 0x03e, 0x010, 0x1a9, 0x217, 0x150, 0x11e, 0x1b5, // 400
525
+				0x177, 0x111, 0x262, 0x128, 0x0b7, 0x39b, 0x074, 0x29b, 0x2ef, 0x161, 0x03e, 0x16e, 0x2b3, 0x17b, 0x2af, 0x34a, // 416
526
+				0x025, 0x165, 0x2d0, 0x2e6, 0x14a, 0x005, 0x027, 0x39b, 0x137, 0x1a8, 0x0f2, 0x2ed, 0x141, 0x036, 0x29d, 0x13c, // 432
527
+				0x156, 0x12b, 0x216, 0x069, 0x29b, 0x1e8, 0x280, 0x2a0, 0x240, 0x21c, 0x13c, 0x1e6, 0x2d1, 0x262, 0x02e, 0x290, // 448
528
+				0x1bf, 0x0ab, 0x268, 0x1d0, 0x0be, 0x213, 0x129, 0x141, 0x2fa, 0x2f0, 0x215, 0x0af, 0x086, 0x00e, 0x17d, 0x1b1, // 464
529
+				0x2cd, 0x02d, 0x06f, 0x014, 0x254, 0x11c, 0x2e0, 0x08a, 0x286, 0x19b, 0x36d, 0x29d, 0x08d, 0x397, 0x02d, 0x30c, // 480
530
+				0x197, 0x0a4, 0x14c, 0x383, 0x0a5, 0x2d6, 0x258, 0x145, 0x1f2, 0x28f, 0x165, 0x2f0, 0x300, 0x0df, 0x351, 0x287, // 496
531
+				0x03f, 0x136, 0x35f, 0x0fb, 0x16e, 0x130, 0x11a, 0x2e2, 0x2a3, 0x19a, 0x185, 0x0f4, 0x01f, 0x079, 0x12f, 0x107) // 512
532 532
 		);
533 533
 
534 534
 		/**
@@ -540,7 +540,7 @@  discard block
 block discarded – undo
540 540
 		 * òparam array $macro information for macro block
541 541
 		 * @access public
542 542
 		 */
543
-		public function __construct($code, $ecl=-1, $aspectratio=2, $macro=array()) {
543
+		public function __construct($code, $ecl = -1, $aspectratio = 2, $macro = array()) {
544 544
 			$barcode_array = array();
545 545
 			if ((is_null($code)) OR ($code == '\0') OR ($code == '')) {
546 546
 				return false;
@@ -548,7 +548,7 @@  discard block
 block discarded – undo
548 548
 			// get the input sequence array
549 549
 			$sequence = $this->getInputSequences($code);
550 550
 			$codewords = array(); // array of code-words
551
-			foreach($sequence as $seq) {
551
+			foreach ($sequence as $seq) {
552 552
 				$cw = $this->getCompaction($seq[0], $seq[1], true);
553 553
 				$codewords = array_merge($codewords, $cw);
554 554
 			}
@@ -563,7 +563,7 @@  discard block
 block discarded – undo
563 563
 				return false;
564 564
 			}
565 565
 			// build macro control block codewords
566
-			if (!empty($macro)) {
566
+			if ( ! empty($macro)) {
567 567
 				$macrocw = array();
568 568
 				// beginning of macro control block
569 569
 				$macrocw[] = 928;
@@ -574,8 +574,8 @@  discard block
 block discarded – undo
574 574
 				$cw = $this->getCompaction(900, $macro['file_id'], false);
575 575
 				$macrocw = array_merge($macrocw, $cw);
576 576
 				// optional fields
577
-				$optmodes = array(900,902,902,900,900,902,902);
578
-				$optsize = array(-1,2,4,-1,-1,-1,2);
577
+				$optmodes = array(900, 902, 902, 900, 900, 902, 902);
578
+				$optsize = array(-1, 2, 4, -1, -1, -1, 2);
579 579
 				foreach ($optmodes as $k => $omode) {
580 580
 					if (isset($macro['option_'.$k])) {
581 581
 						$macrocw[] = 923;
@@ -643,7 +643,7 @@  discard block
 block discarded – undo
643 643
 					$codewords = array_merge($codewords, array_fill(0, $pad, 900));
644 644
 				}
645 645
 			}
646
-			if (!empty($macro)) {
646
+			if ( ! empty($macro)) {
647 647
 				// add macro section
648 648
 				$codewords = array_merge($codewords, $macrocw);
649 649
 			}
@@ -798,7 +798,7 @@  discard block
 block discarded – undo
798 798
 			// initialize array of error correction codewords
799 799
 			$ecw = array_fill(0, $eclsize, 0);
800 800
 			// for each data codeword
801
-			foreach($cw as $k => $d) {
801
+			foreach ($cw as $k => $d) {
802 802
 				$t1 = ($d + $ecw[$eclmaxid]) % 929;
803 803
 				for ($j = $eclmaxid; $j > 0; --$j) {
804 804
 					$t2 = ($t1 * $ecc[$j]) % 929;
@@ -809,7 +809,7 @@  discard block
 block discarded – undo
809 809
 				$t3 = 929 - $t2;
810 810
 				$ecw[0] = $t3 % 929;
811 811
 			}
812
-			foreach($ecw as $j => $e) {
812
+			foreach ($ecw as $j => $e) {
813 813
 				if ($e != 0) {
814 814
 					$ecw[$j] = 929 - $e;
815 815
 				}
@@ -831,7 +831,7 @@  discard block
 block discarded – undo
831 831
 			preg_match_all('/([0-9]{13,})/', $code, $numseq, PREG_OFFSET_CAPTURE);
832 832
 			$numseq[1][] = array('', strlen($code));
833 833
 			$offset = 0;
834
-			foreach($numseq[1] as $seq) {
834
+			foreach ($numseq[1] as $seq) {
835 835
 				$seqlen = strlen($seq[0]);
836 836
 				if ($seq[1] > 0) {
837 837
 					// extract text sequence before the number sequence
@@ -841,7 +841,7 @@  discard block
 block discarded – undo
841 841
 					preg_match_all('/([\x09\x0a\x0d\x20-\x7e]{5,})/', $prevseq, $textseq, PREG_OFFSET_CAPTURE);
842 842
 					$textseq[1][] = array('', strlen($prevseq));
843 843
 					$txtoffset = 0;
844
-					foreach($textseq[1] as $txtseq) {
844
+					foreach ($textseq[1] as $txtseq) {
845 845
 						$txtseqlen = strlen($txtseq[0]);
846 846
 						if ($txtseq[1] > 0) {
847 847
 							// extract byte sequence before the text sequence
@@ -881,9 +881,9 @@  discard block
 block discarded – undo
881 881
 		 * @return array of codewords
882 882
 		 * @access protected
883 883
 		 */
884
-		protected function getCompaction($mode, $code, $addmode=true) {
884
+		protected function getCompaction($mode, $code, $addmode = true) {
885 885
 			$cw = array(); // array of codewords to return
886
-			switch($mode) {
886
+			switch ($mode) {
887 887
 				case 900: { // Text Compaction mode latch
888 888
 					$submode = 0; // default Alpha sub-mode
889 889
 					$txtarr = array(); // array of characters and sub-mode switching characters
@@ -910,7 +910,7 @@  discard block
 block discarded – undo
910 910
 										}
911 911
 									} else {
912 912
 										// latch
913
-										$txtarr	= array_merge($txtarr, $this->textlatch[''.$submode.$s]);
913
+										$txtarr = array_merge($txtarr, $this->textlatch[''.$submode.$s]);
914 914
 										// set new submode
915 915
 										$submode = $s;
916 916
 									}
Please login to merge, or discard this patch.
app/Vendor/PHPExcel/PHPExcel/Shared/PDF/qrcode.php 3 patches
Doc Comments   +12 added lines, -14 removed lines patch added patch discarded remove patch
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
     	 * Convert a string to an array (needed for PHP4 compatibility)
261 261
     	 * @param string $string The input string.
262 262
     	 * @param int $split_length Maximum length of the chunk.
263
-    	 * @return  If the optional split_length  parameter is specified, the returned array will be broken down into chunks with each being split_length  in length, otherwise each chunk will be one character in length. FALSE is returned if split_length is less than 1. If the split_length length exceeds the length of string , the entire string is returned as the first (and only) array element.
263
+    	 * @return  string[] the optional split_length  parameter is specified, the returned array will be broken down into chunks with each being split_length  in length, otherwise each chunk will be one character in length. FALSE is returned if split_length is less than 1. If the split_length length exceeds the length of string , the entire string is returned as the first (and only) array element.
264 264
     	 */
265 265
 		function str_split($string, $split_length=1) {
266 266
 			if ((strlen($string) > $split_length) OR (!$split_length)) {
@@ -798,7 +798,7 @@  discard block
 block discarded – undo
798 798
 		/**
799 799
 		 * Get frame value at specified position
800 800
 		 * @param array $at x,y position
801
-		 * @return value at specified position
801
+		 * @return integer at specified position
802 802
 		 */
803 803
 		protected function getFrameAt($at) {
804 804
 			return ord($this->frame[$at['y']][$at['x']]);
@@ -941,8 +941,8 @@  discard block
 block discarded – undo
941 941
 		/**
942 942
 		 * Write Format Information on frame and returns the number of black bits
943 943
 		 * @param int $width frame width
944
-		 * @param array $frame frame
945
-		 * @param array $mask masking mode
944
+		 * @param integer $frame frame
945
+		 * @param integer $mask masking mode
946 946
 		 * @param int $level error correction level
947 947
 		 * @return int blacks
948 948
 		 */
@@ -1066,7 +1066,7 @@  discard block
 block discarded – undo
1066 1066
 		 * Return bitmask
1067 1067
 		 * @param int $maskNo mask number
1068 1068
 		 * @param int $width width
1069
-		 * @param array $frame frame
1069
+		 * @param integer $frame frame
1070 1070
 		 * @return array bitmask
1071 1071
 		 */
1072 1072
 		protected function generateMaskNo($maskNo, $width, $frame) {
@@ -1698,7 +1698,7 @@  discard block
 block discarded – undo
1698 1698
 		 * @param array items input items
1699 1699
 		 * @param int $mode encoding mode.
1700 1700
 		 * @param int $size size of data (byte).
1701
-		 * @param array $data array of input data.
1701
+		 * @param string[] $data array of input data.
1702 1702
 		 * @return items
1703 1703
 		 *
1704 1704
 		 */
@@ -1787,7 +1787,7 @@  discard block
 block discarded – undo
1787 1787
 		/**
1788 1788
 		 * Look up the alphabet-numeric convesion table (see JIS X0510:2004, pp.19).
1789 1789
 		 * @param int $c character value
1790
-		 * @return value
1790
+		 * @return integer
1791 1791
 		 */
1792 1792
 		protected function lookAnTable($c) {
1793 1793
 			return (($c > 127)?-1:$this->anTable[$c]);
@@ -2092,7 +2092,7 @@  discard block
 block discarded – undo
2092 2092
 
2093 2093
 		/**
2094 2094
 		 * mergeBitStream
2095
-		 * @param array $bstream
2095
+		 * @param integer $items
2096 2096
 		 * @return array bitstream
2097 2097
 		 */
2098 2098
 		 protected function mergeBitStream($items) {
@@ -2232,7 +2232,7 @@  discard block
 block discarded – undo
2232 2232
 
2233 2233
 		/**
2234 2234
 		 * Convert bitstream to bytes
2235
-		 * @param array $bitstream original bitstream
2235
+		 * @param array $bstream original bitstream
2236 2236
 		 * @return array of bytes
2237 2237
 		 */
2238 2238
 		 protected function bitstreamToByte($bstream) {
@@ -2388,7 +2388,7 @@  discard block
 block discarded – undo
2388 2388
 		 * Return an array of ECC specification.
2389 2389
 		 * @param int $version version
2390 2390
 		 * @param int $level error correction level
2391
-		 * @param array $spec an array of ECC specification contains as following: {# of type1 blocks, # of data code, # of ecc code, # of type2 blocks, # of data code}
2391
+		 * @param integer[] $spec an array of ECC specification contains as following: {# of type1 blocks, # of data code, # of ecc code, # of type2 blocks, # of data code}
2392 2392
 		 * @return array spec
2393 2393
 		 */
2394 2394
 		protected function getEccSpec($version, $level, $spec) {
@@ -2418,7 +2418,6 @@  discard block
 block discarded – undo
2418 2418
 		/**
2419 2419
 		 * Put an alignment marker.
2420 2420
 		 * @param array $frame frame
2421
-		 * @param int $width width
2422 2421
 		 * @param int $ox X center coordinate of the pattern
2423 2422
 		 * @param int $oy Y center coordinate of the pattern
2424 2423
 		 * @return array frame
@@ -2442,7 +2441,7 @@  discard block
 block discarded – undo
2442 2441
 		/**
2443 2442
 		 * Put an alignment pattern.
2444 2443
 		 * @param int $version version
2445
-		 * @param array $fram frame
2444
+		 * @param array $frame frame
2446 2445
 		 * @param int $width width
2447 2446
 		 * @return array frame
2448 2447
 		 */
@@ -2512,7 +2511,6 @@  discard block
 block discarded – undo
2512 2511
 		/**
2513 2512
 		 * Put a finder pattern.
2514 2513
 		 * @param array $frame frame
2515
-		 * @param int $width width
2516 2514
 		 * @param int $ox X center coordinate of the pattern
2517 2515
 		 * @param int $oy Y center coordinate of the pattern
2518 2516
 		 * @return array frame
@@ -2682,7 +2680,7 @@  discard block
 block discarded – undo
2682 2680
 		/**
2683 2681
 		 * Return data length
2684 2682
 		 * @param array $spec
2685
-		 * @return int value
2683
+		 * @return double value
2686 2684
 		 */
2687 2685
 		 protected function rsDataLength($spec) {
2688 2686
 			return ($spec[0] * $spec[1]) + ($spec[3] * $spec[4]);
Please login to merge, or discard this patch.
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -165,29 +165,29 @@  discard block
 block discarded – undo
165 165
 	/**
166 166
 	 * Maximum matrix size for maximum version (version 40 is 177*177 matrix).
167 167
 	 */
168
-    define('QRSPEC_WIDTH_MAX', 177);
168
+	define('QRSPEC_WIDTH_MAX', 177);
169 169
 
170 170
 	// -----------------------------------------------------
171 171
 
172 172
 	/**
173 173
 	 * Matrix index to get width from $capacity array.
174 174
 	 */
175
-    define('QRCAP_WIDTH',    0);
175
+	define('QRCAP_WIDTH',    0);
176 176
 
177
-    /**
177
+	/**
178 178
 	 * Matrix index to get number of words from $capacity array.
179 179
 	 */
180
-    define('QRCAP_WORDS',    1);
180
+	define('QRCAP_WORDS',    1);
181 181
 
182
-    /**
182
+	/**
183 183
 	 * Matrix index to get remainder from $capacity array.
184 184
 	 */
185
-    define('QRCAP_REMINDER', 2);
185
+	define('QRCAP_REMINDER', 2);
186 186
 
187
-    /**
187
+	/**
188 188
 	 * Matrix index to get error correction level from $capacity array.
189 189
 	 */
190
-    define('QRCAP_EC',       3);
190
+	define('QRCAP_EC',       3);
191 191
 
192 192
 	// -----------------------------------------------------
193 193
 
@@ -196,33 +196,33 @@  discard block
 block discarded – undo
196 196
 	/**
197 197
 	 * Number of header bits for structured mode
198 198
 	 */
199
-    define('STRUCTURE_HEADER_BITS',  20);
199
+	define('STRUCTURE_HEADER_BITS',  20);
200 200
 
201
-    /**
201
+	/**
202 202
 	 * Max number of symbols for structured mode
203 203
 	 */
204
-    define('MAX_STRUCTURED_SYMBOLS', 16);
204
+	define('MAX_STRUCTURED_SYMBOLS', 16);
205 205
 
206 206
 	// -----------------------------------------------------
207 207
 
208
-    // Masks
208
+	// Masks
209 209
 
210
-    /**
210
+	/**
211 211
 	 * Down point base value for case 1 mask pattern (concatenation of same color in a line or a column)
212 212
 	 */
213
-    define('N1',  3);
213
+	define('N1',  3);
214 214
 
215
-    /**
215
+	/**
216 216
 	 * Down point base value for case 2 mask pattern (module block of same color)
217 217
 	 */
218 218
 	define('N2',  3);
219 219
 
220
-    /**
220
+	/**
221 221
 	 * Down point base value for case 3 mask pattern (1:1:3:1:1(dark:bright:dark:bright:dark)pattern in a line or a column)
222 222
 	 */
223 223
 	define('N3', 40);
224 224
 
225
-    /**
225
+	/**
226 226
 	 * Down point base value for case 4 mask pattern (ration of dark modules in whole)
227 227
 	 */
228 228
 	define('N4', 10);
@@ -256,12 +256,12 @@  discard block
 block discarded – undo
256 256
 
257 257
 	// for compatibility with PHP4
258 258
 	if (!function_exists('str_split')) {
259
-    	/**
260
-    	 * Convert a string to an array (needed for PHP4 compatibility)
261
-    	 * @param string $string The input string.
262
-    	 * @param int $split_length Maximum length of the chunk.
263
-    	 * @return  If the optional split_length  parameter is specified, the returned array will be broken down into chunks with each being split_length  in length, otherwise each chunk will be one character in length. FALSE is returned if split_length is less than 1. If the split_length length exceeds the length of string , the entire string is returned as the first (and only) array element.
264
-    	 */
259
+		/**
260
+		 * Convert a string to an array (needed for PHP4 compatibility)
261
+		 * @param string $string The input string.
262
+		 * @param int $split_length Maximum length of the chunk.
263
+		 * @return  If the optional split_length  parameter is specified, the returned array will be broken down into chunks with each being split_length  in length, otherwise each chunk will be one character in length. FALSE is returned if split_length is less than 1. If the split_length length exceeds the length of string , the entire string is returned as the first (and only) array element.
264
+		 */
265 265
 		function str_split($string, $split_length=1) {
266 266
 			if ((strlen($string) > $split_length) OR (!$split_length)) {
267 267
 				do {
@@ -2626,7 +2626,7 @@  discard block
 block discarded – undo
2626 2626
 		}
2627 2627
 
2628 2628
 		/**
2629
-		* Return block number 1
2629
+		 * Return block number 1
2630 2630
 		 * @param array $spec
2631 2631
 		 * @return int value
2632 2632
 		 */
Please login to merge, or discard this patch.
Spacing   +272 added lines, -272 removed lines patch added patch discarded remove patch
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
  */
84 84
 
85 85
 // definitions
86
-if (!defined('QRCODEDEFS')) {
86
+if ( ! defined('QRCODEDEFS')) {
87 87
 
88 88
 	/**
89 89
 	 * Indicate that definitions for this class are set
@@ -172,12 +172,12 @@  discard block
 block discarded – undo
172 172
 	/**
173 173
 	 * Matrix index to get width from $capacity array.
174 174
 	 */
175
-    define('QRCAP_WIDTH',    0);
175
+    define('QRCAP_WIDTH', 0);
176 176
 
177 177
     /**
178 178
 	 * Matrix index to get number of words from $capacity array.
179 179
 	 */
180
-    define('QRCAP_WORDS',    1);
180
+    define('QRCAP_WORDS', 1);
181 181
 
182 182
     /**
183 183
 	 * Matrix index to get remainder from $capacity array.
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
     /**
188 188
 	 * Matrix index to get error correction level from $capacity array.
189 189
 	 */
190
-    define('QRCAP_EC',       3);
190
+    define('QRCAP_EC', 3);
191 191
 
192 192
 	// -----------------------------------------------------
193 193
 
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
 	/**
197 197
 	 * Number of header bits for structured mode
198 198
 	 */
199
-    define('STRUCTURE_HEADER_BITS',  20);
199
+    define('STRUCTURE_HEADER_BITS', 20);
200 200
 
201 201
     /**
202 202
 	 * Max number of symbols for structured mode
@@ -210,12 +210,12 @@  discard block
 block discarded – undo
210 210
     /**
211 211
 	 * Down point base value for case 1 mask pattern (concatenation of same color in a line or a column)
212 212
 	 */
213
-    define('N1',  3);
213
+    define('N1', 3);
214 214
 
215 215
     /**
216 216
 	 * Down point base value for case 2 mask pattern (module block of same color)
217 217
 	 */
218
-	define('N2',  3);
218
+	define('N2', 3);
219 219
 
220 220
     /**
221 221
 	 * Down point base value for case 3 mask pattern (1:1:3:1:1(dark:bright:dark:bright:dark)pattern in a line or a column)
@@ -252,18 +252,18 @@  discard block
 block discarded – undo
252 252
 
253 253
 // #*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#
254 254
 
255
-if (!class_exists('QRcode', false)) {
255
+if ( ! class_exists('QRcode', false)) {
256 256
 
257 257
 	// for compatibility with PHP4
258
-	if (!function_exists('str_split')) {
258
+	if ( ! function_exists('str_split')) {
259 259
     	/**
260 260
     	 * Convert a string to an array (needed for PHP4 compatibility)
261 261
     	 * @param string $string The input string.
262 262
     	 * @param int $split_length Maximum length of the chunk.
263 263
     	 * @return  If the optional split_length  parameter is specified, the returned array will be broken down into chunks with each being split_length  in length, otherwise each chunk will be one character in length. FALSE is returned if split_length is less than 1. If the split_length length exceeds the length of string , the entire string is returned as the first (and only) array element.
264 264
     	 */
265
-		function str_split($string, $split_length=1) {
266
-			if ((strlen($string) > $split_length) OR (!$split_length)) {
265
+		function str_split($string, $split_length = 1) {
266
+			if ((strlen($string) > $split_length) OR ( ! $split_length)) {
267 267
 				do {
268 268
 					$c = strlen($string);
269 269
 					$parts[] = substr($string, 0, $split_length);
@@ -473,7 +473,7 @@  discard block
 block discarded – undo
473 473
 			-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, //
474 474
 			-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, //
475 475
 			36, -1, -1, -1, 37, 38, -1, -1, -1, -1, 39, 40, -1, 41, 42, 43, //
476
-			 0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 44, -1, -1, -1, -1, -1, //
476
+			 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 44, -1, -1, -1, -1, -1, //
477 477
 			-1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, //
478 478
 			25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, -1, -1, -1, -1, -1, //
479 479
 			-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, //
@@ -486,47 +486,47 @@  discard block
 block discarded – undo
486 486
 		 * @access protected
487 487
 		 */
488 488
 		protected $capacity = array(
489
-			array(  0,    0, 0, array(   0,    0,    0,    0)), //
490
-			array( 21,   26, 0, array(   7,   10,   13,   17)), //  1
491
-			array( 25,   44, 7, array(  10,   16,   22,   28)), //
492
-			array( 29,   70, 7, array(  15,   26,   36,   44)), //
493
-			array( 33,  100, 7, array(  20,   36,   52,   64)), //
494
-			array( 37,  134, 7, array(  26,   48,   72,   88)), //  5
495
-			array( 41,  172, 7, array(  36,   64,   96,  112)), //
496
-			array( 45,  196, 0, array(  40,   72,  108,  130)), //
497
-			array( 49,  242, 0, array(  48,   88,  132,  156)), //
498
-			array( 53,  292, 0, array(  60,  110,  160,  192)), //
499
-			array( 57,  346, 0, array(  72,  130,  192,  224)), // 10
500
-			array( 61,  404, 0, array(  80,  150,  224,  264)), //
501
-			array( 65,  466, 0, array(  96,  176,  260,  308)), //
502
-			array( 69,  532, 0, array( 104,  198,  288,  352)), //
503
-			array( 73,  581, 3, array( 120,  216,  320,  384)), //
504
-			array( 77,  655, 3, array( 132,  240,  360,  432)), // 15
505
-			array( 81,  733, 3, array( 144,  280,  408,  480)), //
506
-			array( 85,  815, 3, array( 168,  308,  448,  532)), //
507
-			array( 89,  901, 3, array( 180,  338,  504,  588)), //
508
-			array( 93,  991, 3, array( 196,  364,  546,  650)), //
509
-			array( 97, 1085, 3, array( 224,  416,  600,  700)), // 20
510
-			array(101, 1156, 4, array( 224,  442,  644,  750)), //
511
-			array(105, 1258, 4, array( 252,  476,  690,  816)), //
512
-			array(109, 1364, 4, array( 270,  504,  750,  900)), //
513
-			array(113, 1474, 4, array( 300,  560,  810,  960)), //
514
-			array(117, 1588, 4, array( 312,  588,  870, 1050)), // 25
515
-			array(121, 1706, 4, array( 336,  644,  952, 1110)), //
516
-			array(125, 1828, 4, array( 360,  700, 1020, 1200)), //
517
-			array(129, 1921, 3, array( 390,  728, 1050, 1260)), //
518
-			array(133, 2051, 3, array( 420,  784, 1140, 1350)), //
519
-			array(137, 2185, 3, array( 450,  812, 1200, 1440)), // 30
520
-			array(141, 2323, 3, array( 480,  868, 1290, 1530)), //
521
-			array(145, 2465, 3, array( 510,  924, 1350, 1620)), //
522
-			array(149, 2611, 3, array( 540,  980, 1440, 1710)), //
523
-			array(153, 2761, 3, array( 570, 1036, 1530, 1800)), //
524
-			array(157, 2876, 0, array( 570, 1064, 1590, 1890)), // 35
525
-			array(161, 3034, 0, array( 600, 1120, 1680, 1980)), //
526
-			array(165, 3196, 0, array( 630, 1204, 1770, 2100)), //
527
-			array(169, 3362, 0, array( 660, 1260, 1860, 2220)), //
528
-			array(173, 3532, 0, array( 720, 1316, 1950, 2310)), //
529
-			array(177, 3706, 0, array( 750, 1372, 2040, 2430))  // 40
489
+			array(0, 0, 0, array(0, 0, 0, 0)), //
490
+			array(21, 26, 0, array(7, 10, 13, 17)), //  1
491
+			array(25, 44, 7, array(10, 16, 22, 28)), //
492
+			array(29, 70, 7, array(15, 26, 36, 44)), //
493
+			array(33, 100, 7, array(20, 36, 52, 64)), //
494
+			array(37, 134, 7, array(26, 48, 72, 88)), //  5
495
+			array(41, 172, 7, array(36, 64, 96, 112)), //
496
+			array(45, 196, 0, array(40, 72, 108, 130)), //
497
+			array(49, 242, 0, array(48, 88, 132, 156)), //
498
+			array(53, 292, 0, array(60, 110, 160, 192)), //
499
+			array(57, 346, 0, array(72, 130, 192, 224)), // 10
500
+			array(61, 404, 0, array(80, 150, 224, 264)), //
501
+			array(65, 466, 0, array(96, 176, 260, 308)), //
502
+			array(69, 532, 0, array(104, 198, 288, 352)), //
503
+			array(73, 581, 3, array(120, 216, 320, 384)), //
504
+			array(77, 655, 3, array(132, 240, 360, 432)), // 15
505
+			array(81, 733, 3, array(144, 280, 408, 480)), //
506
+			array(85, 815, 3, array(168, 308, 448, 532)), //
507
+			array(89, 901, 3, array(180, 338, 504, 588)), //
508
+			array(93, 991, 3, array(196, 364, 546, 650)), //
509
+			array(97, 1085, 3, array(224, 416, 600, 700)), // 20
510
+			array(101, 1156, 4, array(224, 442, 644, 750)), //
511
+			array(105, 1258, 4, array(252, 476, 690, 816)), //
512
+			array(109, 1364, 4, array(270, 504, 750, 900)), //
513
+			array(113, 1474, 4, array(300, 560, 810, 960)), //
514
+			array(117, 1588, 4, array(312, 588, 870, 1050)), // 25
515
+			array(121, 1706, 4, array(336, 644, 952, 1110)), //
516
+			array(125, 1828, 4, array(360, 700, 1020, 1200)), //
517
+			array(129, 1921, 3, array(390, 728, 1050, 1260)), //
518
+			array(133, 2051, 3, array(420, 784, 1140, 1350)), //
519
+			array(137, 2185, 3, array(450, 812, 1200, 1440)), // 30
520
+			array(141, 2323, 3, array(480, 868, 1290, 1530)), //
521
+			array(145, 2465, 3, array(510, 924, 1350, 1620)), //
522
+			array(149, 2611, 3, array(540, 980, 1440, 1710)), //
523
+			array(153, 2761, 3, array(570, 1036, 1530, 1800)), //
524
+			array(157, 2876, 0, array(570, 1064, 1590, 1890)), // 35
525
+			array(161, 3034, 0, array(600, 1120, 1680, 1980)), //
526
+			array(165, 3196, 0, array(630, 1204, 1770, 2100)), //
527
+			array(169, 3362, 0, array(660, 1260, 1860, 2220)), //
528
+			array(173, 3532, 0, array(720, 1316, 1950, 2310)), //
529
+			array(177, 3706, 0, array(750, 1372, 2040, 2430))  // 40
530 530
 		);
531 531
 
532 532
 		/**
@@ -535,9 +535,9 @@  discard block
 block discarded – undo
535 535
 		 */
536 536
 		protected $lengthTableBits = array(
537 537
 			array(10, 12, 14),
538
-			array( 9, 11, 13),
539
-			array( 8, 16, 16),
540
-			array( 8, 10, 12)
538
+			array(9, 11, 13),
539
+			array(8, 16, 16),
540
+			array(8, 10, 12)
541 541
 		);
542 542
 
543 543
 		/**
@@ -546,47 +546,47 @@  discard block
 block discarded – undo
546 546
 		 * @access protected
547 547
 		 */
548 548
 		protected $eccTable = array(
549
-			array(array( 0,  0), array( 0,  0), array( 0,  0), array( 0,  0)), //
550
-			array(array( 1,  0), array( 1,  0), array( 1,  0), array( 1,  0)), //  1
551
-			array(array( 1,  0), array( 1,  0), array( 1,  0), array( 1,  0)), //
552
-			array(array( 1,  0), array( 1,  0), array( 2,  0), array( 2,  0)), //
553
-			array(array( 1,  0), array( 2,  0), array( 2,  0), array( 4,  0)), //
554
-			array(array( 1,  0), array( 2,  0), array( 2,  2), array( 2,  2)), //  5
555
-			array(array( 2,  0), array( 4,  0), array( 4,  0), array( 4,  0)), //
556
-			array(array( 2,  0), array( 4,  0), array( 2,  4), array( 4,  1)), //
557
-			array(array( 2,  0), array( 2,  2), array( 4,  2), array( 4,  2)), //
558
-			array(array( 2,  0), array( 3,  2), array( 4,  4), array( 4,  4)), //
559
-			array(array( 2,  2), array( 4,  1), array( 6,  2), array( 6,  2)), // 10
560
-			array(array( 4,  0), array( 1,  4), array( 4,  4), array( 3,  8)), //
561
-			array(array( 2,  2), array( 6,  2), array( 4,  6), array( 7,  4)), //
562
-			array(array( 4,  0), array( 8,  1), array( 8,  4), array(12,  4)), //
563
-			array(array( 3,  1), array( 4,  5), array(11,  5), array(11,  5)), //
564
-			array(array( 5,  1), array( 5,  5), array( 5,  7), array(11,  7)), // 15
565
-			array(array( 5,  1), array( 7,  3), array(15,  2), array( 3, 13)), //
566
-			array(array( 1,  5), array(10,  1), array( 1, 15), array( 2, 17)), //
567
-			array(array( 5,  1), array( 9,  4), array(17,  1), array( 2, 19)), //
568
-			array(array( 3,  4), array( 3, 11), array(17,  4), array( 9, 16)), //
569
-			array(array( 3,  5), array( 3, 13), array(15,  5), array(15, 10)), // 20
570
-			array(array( 4,  4), array(17,  0), array(17,  6), array(19,  6)), //
571
-			array(array( 2,  7), array(17,  0), array( 7, 16), array(34,  0)), //
572
-			array(array( 4,  5), array( 4, 14), array(11, 14), array(16, 14)), //
573
-			array(array( 6,  4), array( 6, 14), array(11, 16), array(30,  2)), //
574
-			array(array( 8,  4), array( 8, 13), array( 7, 22), array(22, 13)), // 25
575
-			array(array(10,  2), array(19,  4), array(28,  6), array(33,  4)), //
576
-			array(array( 8,  4), array(22,  3), array( 8, 26), array(12, 28)), //
577
-			array(array( 3, 10), array( 3, 23), array( 4, 31), array(11, 31)), //
578
-			array(array( 7,  7), array(21,  7), array( 1, 37), array(19, 26)), //
579
-			array(array( 5, 10), array(19, 10), array(15, 25), array(23, 25)), // 30
580
-			array(array(13,  3), array( 2, 29), array(42,  1), array(23, 28)), //
581
-			array(array(17,  0), array(10, 23), array(10, 35), array(19, 35)), //
582
-			array(array(17,  1), array(14, 21), array(29, 19), array(11, 46)), //
583
-			array(array(13,  6), array(14, 23), array(44,  7), array(59,  1)), //
584
-			array(array(12,  7), array(12, 26), array(39, 14), array(22, 41)), // 35
585
-			array(array( 6, 14), array( 6, 34), array(46, 10), array( 2, 64)), //
586
-			array(array(17,  4), array(29, 14), array(49, 10), array(24, 46)), //
587
-			array(array( 4, 18), array(13, 32), array(48, 14), array(42, 32)), //
588
-			array(array(20,  4), array(40,  7), array(43, 22), array(10, 67)), //
589
-			array(array(19,  6), array(18, 31), array(34, 34), array(20, 61))  // 40
549
+			array(array(0, 0), array(0, 0), array(0, 0), array(0, 0)), //
550
+			array(array(1, 0), array(1, 0), array(1, 0), array(1, 0)), //  1
551
+			array(array(1, 0), array(1, 0), array(1, 0), array(1, 0)), //
552
+			array(array(1, 0), array(1, 0), array(2, 0), array(2, 0)), //
553
+			array(array(1, 0), array(2, 0), array(2, 0), array(4, 0)), //
554
+			array(array(1, 0), array(2, 0), array(2, 2), array(2, 2)), //  5
555
+			array(array(2, 0), array(4, 0), array(4, 0), array(4, 0)), //
556
+			array(array(2, 0), array(4, 0), array(2, 4), array(4, 1)), //
557
+			array(array(2, 0), array(2, 2), array(4, 2), array(4, 2)), //
558
+			array(array(2, 0), array(3, 2), array(4, 4), array(4, 4)), //
559
+			array(array(2, 2), array(4, 1), array(6, 2), array(6, 2)), // 10
560
+			array(array(4, 0), array(1, 4), array(4, 4), array(3, 8)), //
561
+			array(array(2, 2), array(6, 2), array(4, 6), array(7, 4)), //
562
+			array(array(4, 0), array(8, 1), array(8, 4), array(12, 4)), //
563
+			array(array(3, 1), array(4, 5), array(11, 5), array(11, 5)), //
564
+			array(array(5, 1), array(5, 5), array(5, 7), array(11, 7)), // 15
565
+			array(array(5, 1), array(7, 3), array(15, 2), array(3, 13)), //
566
+			array(array(1, 5), array(10, 1), array(1, 15), array(2, 17)), //
567
+			array(array(5, 1), array(9, 4), array(17, 1), array(2, 19)), //
568
+			array(array(3, 4), array(3, 11), array(17, 4), array(9, 16)), //
569
+			array(array(3, 5), array(3, 13), array(15, 5), array(15, 10)), // 20
570
+			array(array(4, 4), array(17, 0), array(17, 6), array(19, 6)), //
571
+			array(array(2, 7), array(17, 0), array(7, 16), array(34, 0)), //
572
+			array(array(4, 5), array(4, 14), array(11, 14), array(16, 14)), //
573
+			array(array(6, 4), array(6, 14), array(11, 16), array(30, 2)), //
574
+			array(array(8, 4), array(8, 13), array(7, 22), array(22, 13)), // 25
575
+			array(array(10, 2), array(19, 4), array(28, 6), array(33, 4)), //
576
+			array(array(8, 4), array(22, 3), array(8, 26), array(12, 28)), //
577
+			array(array(3, 10), array(3, 23), array(4, 31), array(11, 31)), //
578
+			array(array(7, 7), array(21, 7), array(1, 37), array(19, 26)), //
579
+			array(array(5, 10), array(19, 10), array(15, 25), array(23, 25)), // 30
580
+			array(array(13, 3), array(2, 29), array(42, 1), array(23, 28)), //
581
+			array(array(17, 0), array(10, 23), array(10, 35), array(19, 35)), //
582
+			array(array(17, 1), array(14, 21), array(29, 19), array(11, 46)), //
583
+			array(array(13, 6), array(14, 23), array(44, 7), array(59, 1)), //
584
+			array(array(12, 7), array(12, 26), array(39, 14), array(22, 41)), // 35
585
+			array(array(6, 14), array(6, 34), array(46, 10), array(2, 64)), //
586
+			array(array(17, 4), array(29, 14), array(49, 10), array(24, 46)), //
587
+			array(array(4, 18), array(13, 32), array(48, 14), array(42, 32)), //
588
+			array(array(20, 4), array(40, 7), array(43, 22), array(10, 67)), //
589
+			array(array(19, 6), array(18, 31), array(34, 34), array(20, 61))  // 40
590 590
 		);
591 591
 
592 592
 		/**
@@ -596,9 +596,9 @@  discard block
 block discarded – undo
596 596
 		 * @access protected
597 597
 		 */
598 598
 		protected $alignmentPattern = array(
599
-			array( 0,  0),
600
-			array( 0,  0), array(18,  0), array(22,  0), array(26,  0), array(30,  0), //  1- 5
601
-			array(34,  0), array(22, 38), array(24, 42), array(26, 46), array(28, 50), //  6-10
599
+			array(0, 0),
600
+			array(0, 0), array(18, 0), array(22, 0), array(26, 0), array(30, 0), //  1- 5
601
+			array(34, 0), array(22, 38), array(24, 42), array(26, 46), array(28, 50), //  6-10
602 602
 			array(30, 54), array(32, 58), array(34, 62), array(26, 46), array(26, 48), // 11-15
603 603
 			array(26, 50), array(30, 54), array(30, 56), array(30, 58), array(34, 62), // 16-20
604 604
 			array(28, 50), array(26, 50), array(30, 54), array(28, 54), array(32, 58), // 21-25
@@ -674,7 +674,7 @@  discard block
 block discarded – undo
674 674
 			foreach ($qrTab as $line) {
675 675
 				$arrAdd = array();
676 676
 				foreach (str_split($line) as $char) {
677
-					$arrAdd[] = ($char=='1')?1:0;
677
+					$arrAdd[] = ($char == '1') ? 1 : 0;
678 678
 				}
679 679
 				$barcode_array['bcode'][] = $arrAdd;
680 680
 			}
@@ -699,8 +699,8 @@  discard block
 block discarded – undo
699 699
 			$len = count($frame);
700 700
 			// the frame is square (width = height)
701 701
 			foreach ($frame as &$frameLine) {
702
-				for ($i=0; $i<$len; $i++) {
703
-					$frameLine[$i] = (ord($frameLine[$i])&1)?'1':'0';
702
+				for ($i = 0; $i < $len; $i++) {
703
+					$frameLine[$i] = (ord($frameLine[$i]) & 1) ? '1' : '0';
704 704
 				}
705 705
 			}
706 706
 			return $frame;
@@ -712,7 +712,7 @@  discard block
 block discarded – undo
712 712
 		 */
713 713
 		protected function encodeString($string) {
714 714
 			$this->dataStr = $string;
715
-			if (!$this->casesensitive) {
715
+			if ( ! $this->casesensitive) {
716 716
 				$this->toUpper();
717 717
 			}
718 718
 			$ret = $this->splitString();
@@ -750,10 +750,10 @@  discard block
 block discarded – undo
750 750
 			$this->dir = -1;
751 751
 			$this->bit = -1;
752 752
 			// inteleaved data and ecc codes
753
-			for ($i=0; $i < ($this->dataLength + $this->eccLength); $i++) {
753
+			for ($i = 0; $i < ($this->dataLength + $this->eccLength); $i++) {
754 754
 				$code = $this->getCode();
755 755
 				$bit = 0x80;
756
-				for ($j=0; $j<8; $j++) {
756
+				for ($j = 0; $j < 8; $j++) {
757 757
 					$addr = $this->getNextPosition();
758 758
 					$this->setFrameAt($addr, 0x02 | (($bit & $code) != 0));
759 759
 					$bit = $bit >> 1;
@@ -761,7 +761,7 @@  discard block
 block discarded – undo
761 761
 			}
762 762
 			// remainder bits
763 763
 			$j = $this->getRemainder($this->version);
764
-			for ($i=0; $i<$j; $i++) {
764
+			for ($i = 0; $i < $j; $i++) {
765 765
 				$addr = $this->getNextPosition();
766 766
 				$this->setFrameAt($addr, 0x02);
767 767
 			}
@@ -851,7 +851,7 @@  discard block
 block discarded – undo
851 851
 				}
852 852
 				$this->x = $x;
853 853
 				$this->y = $y;
854
-			} while(ord($this->frame[$y][$x]) & 0x80);
854
+			} while (ord($this->frame[$y][$x]) & 0x80);
855 855
 			return array('x'=>$x, 'y'=>$y);
856 856
 		}
857 857
 
@@ -872,7 +872,7 @@  discard block
 block discarded – undo
872 872
 			$dataPos = 0;
873 873
 			$eccPos = 0;
874 874
 			$endfor = $this->rsBlockNum1($spec);
875
-			for ($i=0; $i < $endfor; ++$i) {
875
+			for ($i = 0; $i < $endfor; ++$i) {
876 876
 				$ecc = array_slice($this->ecccode, $eccPos);
877 877
 				$this->rsblocks[$blockNo] = array();
878 878
 				$this->rsblocks[$blockNo]['dataLength'] = $dl;
@@ -880,7 +880,7 @@  discard block
 block discarded – undo
880 880
 				$this->rsblocks[$blockNo]['eccLength'] = $el;
881 881
 				$ecc = $this->encode_rs_char($rs, $this->rsblocks[$blockNo]['data'], $ecc);
882 882
 				$this->rsblocks[$blockNo]['ecc'] = $ecc;
883
-				$this->ecccode = array_merge(array_slice($this->ecccode,0, $eccPos), $ecc);
883
+				$this->ecccode = array_merge(array_slice($this->ecccode, 0, $eccPos), $ecc);
884 884
 				$dataPos += $dl;
885 885
 				$eccPos += $el;
886 886
 				$blockNo++;
@@ -895,7 +895,7 @@  discard block
 block discarded – undo
895 895
 				return -1;
896 896
 			}
897 897
 			$endfor = $this->rsBlockNum2($spec);
898
-			for ($i=0; $i < $endfor; ++$i) {
898
+			for ($i = 0; $i < $endfor; ++$i) {
899 899
 				$ecc = array_slice($this->ecccode, $eccPos);
900 900
 				$this->rsblocks[$blockNo] = array();
901 901
 				$this->rsblocks[$blockNo]['dataLength'] = $dl;
@@ -948,8 +948,8 @@  discard block
 block discarded – undo
948 948
 		 */
949 949
 		 protected function writeFormatInformation($width, &$frame, $mask, $level) {
950 950
 			$blacks = 0;
951
-			$format =  $this->getFormatInfo($mask, $level);
952
-			for ($i=0; $i<8; ++$i) {
951
+			$format = $this->getFormatInfo($mask, $level);
952
+			for ($i = 0; $i < 8; ++$i) {
953 953
 				if ($format & 1) {
954 954
 					$blacks += 2;
955 955
 					$v = 0x85;
@@ -964,7 +964,7 @@  discard block
 block discarded – undo
964 964
 				}
965 965
 				$format = $format >> 1;
966 966
 			}
967
-			for ($i=0; $i<7; ++$i) {
967
+			for ($i = 0; $i < 7; ++$i) {
968 968
 			if ($format & 1) {
969 969
 				$blacks += 2;
970 970
 				$v = 0x85;
@@ -1029,7 +1029,7 @@  discard block
 block discarded – undo
1029 1029
 		 * @return int mask
1030 1030
 		 */
1031 1031
 		 protected function mask4($x, $y) {
1032
-			return (((int)($y / 2)) + ((int)($x / 3))) & 1;
1032
+			return (((int) ($y / 2)) + ((int) ($x / 3))) & 1;
1033 1033
 		}
1034 1034
 
1035 1035
 		/**
@@ -1071,13 +1071,13 @@  discard block
 block discarded – undo
1071 1071
 		 */
1072 1072
 		protected function generateMaskNo($maskNo, $width, $frame) {
1073 1073
 			$bitMask = array_fill(0, $width, array_fill(0, $width, 0));
1074
-			for ($y=0; $y<$width; ++$y) {
1075
-				for ($x=0; $x<$width; ++$x) {
1074
+			for ($y = 0; $y < $width; ++$y) {
1075
+				for ($x = 0; $x < $width; ++$x) {
1076 1076
 					if (ord($frame[$y][$x]) & 0x80) {
1077 1077
 						$bitMask[$y][$x] = 0;
1078 1078
 					} else {
1079 1079
 						$maskFunc = call_user_func(array($this, 'mask'.$maskNo), $x, $y);
1080
-						$bitMask[$y][$x] = ($maskFunc == 0)?1:0;
1080
+						$bitMask[$y][$x] = ($maskFunc == 0) ? 1 : 0;
1081 1081
 					}
1082 1082
 				}
1083 1083
 			}
@@ -1093,7 +1093,7 @@  discard block
 block discarded – undo
1093 1093
 		 * @param boolean $maskGenOnly
1094 1094
 		 * @return int b
1095 1095
 		 */
1096
-		 protected function makeMaskNo($maskNo, $width, $s, &$d, $maskGenOnly=false) {
1096
+		 protected function makeMaskNo($maskNo, $width, $s, &$d, $maskGenOnly = false) {
1097 1097
 			$b = 0;
1098 1098
 			$bitMask = array();
1099 1099
 			$bitMask = $this->generateMaskNo($maskNo, $width, $s, $d);
@@ -1101,12 +1101,12 @@  discard block
 block discarded – undo
1101 1101
 				return;
1102 1102
 			}
1103 1103
 			$d = $s;
1104
-			for ($y=0; $y<$width; ++$y) {
1105
-				for ($x=0; $x<$width; ++$x) {
1104
+			for ($y = 0; $y < $width; ++$y) {
1105
+				for ($x = 0; $x < $width; ++$x) {
1106 1106
 					if ($bitMask[$y][$x] == 1) {
1107
-						$d[$y][$x] = chr(ord($s[$y][$x]) ^ (int)$bitMask[$y][$x]);
1107
+						$d[$y][$x] = chr(ord($s[$y][$x]) ^ (int) $bitMask[$y][$x]);
1108 1108
 					}
1109
-					$b += (int)(ord($d[$y][$x]) & 1);
1109
+					$b += (int) (ord($d[$y][$x]) & 1);
1110 1110
 				}
1111 1111
 			}
1112 1112
 			return $b;
@@ -1134,20 +1134,20 @@  discard block
 block discarded – undo
1134 1134
 		 */
1135 1135
 		 protected function calcN1N3($length) {
1136 1136
 			$demerit = 0;
1137
-			for ($i=0; $i<$length; ++$i) {
1137
+			for ($i = 0; $i < $length; ++$i) {
1138 1138
 				if ($this->runLength[$i] >= 5) {
1139 1139
 					$demerit += (N1 + ($this->runLength[$i] - 5));
1140 1140
 				}
1141 1141
 				if ($i & 1) {
1142
-					if (($i >= 3) AND ($i < ($length-2)) AND ($this->runLength[$i] % 3 == 0)) {
1143
-						$fact = (int)($this->runLength[$i] / 3);
1144
-						if (($this->runLength[$i-2] == $fact)
1145
-							AND ($this->runLength[$i-1] == $fact)
1146
-							AND ($this->runLength[$i+1] == $fact)
1147
-							AND ($this->runLength[$i+2] == $fact)) {
1148
-							if (($this->runLength[$i-3] < 0) OR ($this->runLength[$i-3] >= (4 * $fact))) {
1142
+					if (($i >= 3) AND ($i < ($length - 2)) AND ($this->runLength[$i] % 3 == 0)) {
1143
+						$fact = (int) ($this->runLength[$i] / 3);
1144
+						if (($this->runLength[$i - 2] == $fact)
1145
+							AND ($this->runLength[$i - 1] == $fact)
1146
+							AND ($this->runLength[$i + 1] == $fact)
1147
+							AND ($this->runLength[$i + 2] == $fact)) {
1148
+							if (($this->runLength[$i - 3] < 0) OR ($this->runLength[$i - 3] >= (4 * $fact))) {
1149 1149
 								$demerit += N3;
1150
-							} elseif ((($i+3) >= $length) OR ($this->runLength[$i+3] >= (4 * $fact))) {
1150
+							} elseif ((($i + 3) >= $length) OR ($this->runLength[$i + 3] >= (4 * $fact))) {
1151 1151
 								$demerit += N3;
1152 1152
 							}
1153 1153
 						}
@@ -1166,17 +1166,17 @@  discard block
 block discarded – undo
1166 1166
 		 protected function evaluateSymbol($width, $frame) {
1167 1167
 			$head = 0;
1168 1168
 			$demerit = 0;
1169
-			for ($y=0; $y<$width; ++$y) {
1169
+			for ($y = 0; $y < $width; ++$y) {
1170 1170
 				$head = 0;
1171 1171
 				$this->runLength[0] = 1;
1172 1172
 				$frameY = $frame[$y];
1173 1173
 				if ($y > 0) {
1174
-					$frameYM = $frame[$y-1];
1174
+					$frameYM = $frame[$y - 1];
1175 1175
 				}
1176
-				for ($x=0; $x<$width; ++$x) {
1176
+				for ($x = 0; $x < $width; ++$x) {
1177 1177
 					if (($x > 0) AND ($y > 0)) {
1178
-						$b22 = ord($frameY[$x]) & ord($frameY[$x-1]) & ord($frameYM[$x]) & ord($frameYM[$x-1]);
1179
-						$w22 = ord($frameY[$x]) | ord($frameY[$x-1]) | ord($frameYM[$x]) | ord($frameYM[$x-1]);
1178
+						$b22 = ord($frameY[$x]) & ord($frameY[$x - 1]) & ord($frameYM[$x]) & ord($frameYM[$x - 1]);
1179
+						$w22 = ord($frameY[$x]) | ord($frameY[$x - 1]) | ord($frameYM[$x]) | ord($frameYM[$x - 1]);
1180 1180
 						if (($b22 | ($w22 ^ 1)) & 1) {
1181 1181
 							$demerit += N2;
1182 1182
 						}
@@ -1186,7 +1186,7 @@  discard block
 block discarded – undo
1186 1186
 						$head = 1;
1187 1187
 						$this->runLength[$head] = 1;
1188 1188
 					} elseif ($x > 0) {
1189
-						if ((ord($frameY[$x]) ^ ord($frameY[$x-1])) & 1) {
1189
+						if ((ord($frameY[$x]) ^ ord($frameY[$x - 1])) & 1) {
1190 1190
 							$head++;
1191 1191
 							$this->runLength[$head] = 1;
1192 1192
 						} else {
@@ -1194,18 +1194,18 @@  discard block
 block discarded – undo
1194 1194
 						}
1195 1195
 					}
1196 1196
 				}
1197
-				$demerit += $this->calcN1N3($head+1);
1197
+				$demerit += $this->calcN1N3($head + 1);
1198 1198
 			}
1199
-			for ($x=0; $x<$width; ++$x) {
1199
+			for ($x = 0; $x < $width; ++$x) {
1200 1200
 				$head = 0;
1201 1201
 				$this->runLength[0] = 1;
1202
-				for ($y=0; $y<$width; ++$y) {
1202
+				for ($y = 0; $y < $width; ++$y) {
1203 1203
 					if (($y == 0) AND (ord($frame[$y][$x]) & 1)) {
1204 1204
 						$this->runLength[0] = -1;
1205 1205
 						$head = 1;
1206 1206
 						$this->runLength[$head] = 1;
1207 1207
 					} elseif ($y > 0) {
1208
-						if ((ord($frame[$y][$x]) ^ ord($frame[$y-1][$x])) & 1) {
1208
+						if ((ord($frame[$y][$x]) ^ ord($frame[$y - 1][$x])) & 1) {
1209 1209
 							$head++;
1210 1210
 							$this->runLength[$head] = 1;
1211 1211
 						} else {
@@ -1213,7 +1213,7 @@  discard block
 block discarded – undo
1213 1213
 						}
1214 1214
 					}
1215 1215
 				}
1216
-				$demerit += $this->calcN1N3($head+1);
1216
+				$demerit += $this->calcN1N3($head + 1);
1217 1217
 			}
1218 1218
 			return $demerit;
1219 1219
 		}
@@ -1232,8 +1232,8 @@  discard block
 block discarded – undo
1232 1232
 			$checked_masks = array(0, 1, 2, 3, 4, 5, 6, 7);
1233 1233
 			if (QR_FIND_FROM_RANDOM !== false) {
1234 1234
 				$howManuOut = 8 - (QR_FIND_FROM_RANDOM % 9);
1235
-				for ($i = 0; $i <  $howManuOut; ++$i) {
1236
-					$remPos = rand (0, count($checked_masks)-1);
1235
+				for ($i = 0; $i < $howManuOut; ++$i) {
1236
+					$remPos = rand(0, count($checked_masks) - 1);
1237 1237
 					unset($checked_masks[$remPos]);
1238 1238
 					$checked_masks = array_values($checked_masks);
1239 1239
 				}
@@ -1245,8 +1245,8 @@  discard block
 block discarded – undo
1245 1245
 				$blacks = 0;
1246 1246
 				$blacks  = $this->makeMaskNo($i, $width, $frame, $mask);
1247 1247
 				$blacks += $this->writeFormatInformation($width, $mask, $i, $level);
1248
-				$blacks  = (int)(100 * $blacks / ($width * $width));
1249
-				$demerit = (int)((int)(abs($blacks - 50) / 5) * N4);
1248
+				$blacks  = (int) (100 * $blacks / ($width * $width));
1249
+				$demerit = (int) ((int) (abs($blacks - 50) / 5) * N4);
1250 1250
 				$demerit += $this->evaluateSymbol($width, $mask);
1251 1251
 				if ($demerit < $minDemerit) {
1252 1252
 					$minDemerit = $demerit;
@@ -1271,7 +1271,7 @@  discard block
 block discarded – undo
1271 1271
 			if ($pos >= strlen($str)) {
1272 1272
 				return false;
1273 1273
 			}
1274
-			return ((ord($str[$pos]) >= ord('0'))&&(ord($str[$pos]) <= ord('9')));
1274
+			return ((ord($str[$pos]) >= ord('0')) && (ord($str[$pos]) <= ord('9')));
1275 1275
 		}
1276 1276
 
1277 1277
 		/**
@@ -1302,8 +1302,8 @@  discard block
 block discarded – undo
1302 1302
 			} elseif ($this->isalnumat($this->dataStr, $pos)) {
1303 1303
 				return QR_MODE_AN;
1304 1304
 			} elseif ($this->hint == QR_MODE_KJ) {
1305
-				if ($pos+1 < strlen($this->dataStr)) {
1306
-					$d = $this->dataStr[$pos+1];
1305
+				if ($pos + 1 < strlen($this->dataStr)) {
1306
+					$d = $this->dataStr[$pos + 1];
1307 1307
 					$word = (ord($c) << 8) | ord($d);
1308 1308
 					if (($word >= 0x8140 && $word <= 0x9ffc) OR ($word >= 0xe040 && $word <= 0xebbf)) {
1309 1309
 						return QR_MODE_KJ;
@@ -1320,7 +1320,7 @@  discard block
 block discarded – undo
1320 1320
 		 protected function eatNum() {
1321 1321
 			$ln = $this->lengthIndicator(QR_MODE_NM, $this->version);
1322 1322
 			$p = 0;
1323
-			while($this->isdigitat($this->dataStr, $p)) {
1323
+			while ($this->isdigitat($this->dataStr, $p)) {
1324 1324
 				$p++;
1325 1325
 			}
1326 1326
 			$run = $p;
@@ -1336,7 +1336,7 @@  discard block
 block discarded – undo
1336 1336
 			if ($mode == QR_MODE_AN) {
1337 1337
 				$dif = $this->estimateBitsModeNum($run) + 4 + $ln
1338 1338
 				+ $this->estimateBitsModeAn(1)        // + 4 + la
1339
-				- $this->estimateBitsModeAn($run + 1);// - 4 - la
1339
+				- $this->estimateBitsModeAn($run + 1); // - 4 - la
1340 1340
 				if ($dif > 0) {
1341 1341
 					return $this->eatAn();
1342 1342
 				}
@@ -1350,13 +1350,13 @@  discard block
 block discarded – undo
1350 1350
 		 * @return int run
1351 1351
 		 */
1352 1352
 		 protected function eatAn() {
1353
-			$la = $this->lengthIndicator(QR_MODE_AN,  $this->version);
1353
+			$la = $this->lengthIndicator(QR_MODE_AN, $this->version);
1354 1354
 			$ln = $this->lengthIndicator(QR_MODE_NM, $this->version);
1355 1355
 			$p = 0;
1356
-			while($this->isalnumat($this->dataStr, $p)) {
1356
+			while ($this->isalnumat($this->dataStr, $p)) {
1357 1357
 				if ($this->isdigitat($this->dataStr, $p)) {
1358 1358
 					$q = $p;
1359
-					while($this->isdigitat($this->dataStr, $q)) {
1359
+					while ($this->isdigitat($this->dataStr, $q)) {
1360 1360
 						$q++;
1361 1361
 					}
1362 1362
 					$dif = $this->estimateBitsModeAn($p) // + 4 + la
@@ -1372,7 +1372,7 @@  discard block
 block discarded – undo
1372 1372
 				}
1373 1373
 			}
1374 1374
 			$run = $p;
1375
-			if (!$this->isalnumat($this->dataStr, $p)) {
1375
+			if ( ! $this->isalnumat($this->dataStr, $p)) {
1376 1376
 				$dif = $this->estimateBitsModeAn($run) + 4 + $la
1377 1377
 				+ $this->estimateBitsMode8(1) // + 4 + l8
1378 1378
 				- $this->estimateBitsMode8($run + 1); // - 4 - l8
@@ -1390,7 +1390,7 @@  discard block
 block discarded – undo
1390 1390
 		 */
1391 1391
 		 protected function eatKanji() {
1392 1392
 			$p = 0;
1393
-			while($this->identifyMode($p) == QR_MODE_KJ) {
1393
+			while ($this->identifyMode($p) == QR_MODE_KJ) {
1394 1394
 				$p += 2;
1395 1395
 			}
1396 1396
 			$this->items = $this->appendNewInputItem($this->items, QR_MODE_KJ, $p, str_split($this->dataStr));
@@ -1406,14 +1406,14 @@  discard block
 block discarded – undo
1406 1406
 			$ln = $this->lengthIndicator(QR_MODE_NM, $this->version);
1407 1407
 			$p = 1;
1408 1408
 			$dataStrLen = strlen($this->dataStr);
1409
-			while($p < $dataStrLen) {
1409
+			while ($p < $dataStrLen) {
1410 1410
 				$mode = $this->identifyMode($p);
1411 1411
 				if ($mode == QR_MODE_KJ) {
1412 1412
 					break;
1413 1413
 				}
1414 1414
 				if ($mode == QR_MODE_NM) {
1415 1415
 					$q = $p;
1416
-					while($this->isdigitat($this->dataStr, $q)) {
1416
+					while ($this->isdigitat($this->dataStr, $q)) {
1417 1417
 						$q++;
1418 1418
 					}
1419 1419
 					$dif = $this->estimateBitsMode8($p) // + 4 + l8
@@ -1426,7 +1426,7 @@  discard block
 block discarded – undo
1426 1426
 					}
1427 1427
 				} elseif ($mode == QR_MODE_AN) {
1428 1428
 					$q = $p;
1429
-					while($this->isalnumat($this->dataStr, $q)) {
1429
+					while ($this->isalnumat($this->dataStr, $q)) {
1430 1430
 						$q++;
1431 1431
 					}
1432 1432
 					$dif = $this->estimateBitsMode8($p)  // + 4 + l8
@@ -1519,12 +1519,12 @@  discard block
 block discarded – undo
1519 1519
 		 * @param array $bstream
1520 1520
 		 * @return array input item
1521 1521
 		 */
1522
-		 protected function newInputItem($mode, $size, $data, $bstream=null) {
1522
+		 protected function newInputItem($mode, $size, $data, $bstream = null) {
1523 1523
 			$setData = array_slice($data, 0, $size);
1524 1524
 			if (count($setData) < $size) {
1525 1525
 				$setData = array_merge($setData, array_fill(0, ($size - count($setData)), 0));
1526 1526
 			}
1527
-			if (!$this->check($mode, $size, $setData)) {
1527
+			if ( ! $this->check($mode, $size, $setData)) {
1528 1528
 				return NULL;
1529 1529
 			}
1530 1530
 			$inputitem = array();
@@ -1542,23 +1542,23 @@  discard block
 block discarded – undo
1542 1542
 		 * @return array input item
1543 1543
 		 */
1544 1544
 		 protected function encodeModeNum($inputitem, $version) {
1545
-			$words = (int)($inputitem['size'] / 3);
1545
+			$words = (int) ($inputitem['size'] / 3);
1546 1546
 			$inputitem['bstream'] = array();
1547 1547
 			$val = 0x1;
1548 1548
 			$inputitem['bstream'] = $this->appendNum($inputitem['bstream'], 4, $val);
1549 1549
 			$inputitem['bstream'] = $this->appendNum($inputitem['bstream'], $this->lengthIndicator(QR_MODE_NM, $version), $inputitem['size']);
1550
-			for ($i=0; $i < $words; ++$i) {
1551
-				$val  = (ord($inputitem['data'][$i*3  ]) - ord('0')) * 100;
1552
-				$val += (ord($inputitem['data'][$i*3+1]) - ord('0')) * 10;
1553
-				$val += (ord($inputitem['data'][$i*3+2]) - ord('0'));
1550
+			for ($i = 0; $i < $words; ++$i) {
1551
+				$val  = (ord($inputitem['data'][$i * 3]) - ord('0')) * 100;
1552
+				$val += (ord($inputitem['data'][$i * 3 + 1]) - ord('0')) * 10;
1553
+				$val += (ord($inputitem['data'][$i * 3 + 2]) - ord('0'));
1554 1554
 				$inputitem['bstream'] = $this->appendNum($inputitem['bstream'], 10, $val);
1555 1555
 			}
1556 1556
 			if ($inputitem['size'] - $words * 3 == 1) {
1557
-				$val = ord($inputitem['data'][$words*3]) - ord('0');
1557
+				$val = ord($inputitem['data'][$words * 3]) - ord('0');
1558 1558
 				$inputitem['bstream'] = $this->appendNum($inputitem['bstream'], 4, $val);
1559 1559
 			} elseif (($inputitem['size'] - ($words * 3)) == 2) {
1560
-				$val  = (ord($inputitem['data'][$words*3  ]) - ord('0')) * 10;
1561
-				$val += (ord($inputitem['data'][$words*3+1]) - ord('0'));
1560
+				$val  = (ord($inputitem['data'][$words * 3]) - ord('0')) * 10;
1561
+				$val += (ord($inputitem['data'][$words * 3 + 1]) - ord('0'));
1562 1562
 				$inputitem['bstream'] = $this->appendNum($inputitem['bstream'], 7, $val);
1563 1563
 			}
1564 1564
 			return $inputitem;
@@ -1571,13 +1571,13 @@  discard block
 block discarded – undo
1571 1571
 		 * @return array input item
1572 1572
 		 */
1573 1573
 		 protected function encodeModeAn($inputitem, $version) {
1574
-			$words = (int)($inputitem['size'] / 2);
1574
+			$words = (int) ($inputitem['size'] / 2);
1575 1575
 			$inputitem['bstream'] = array();
1576 1576
 			$inputitem['bstream'] = $this->appendNum($inputitem['bstream'], 4, 0x02);
1577 1577
 			$inputitem['bstream'] = $this->appendNum($inputitem['bstream'], $this->lengthIndicator(QR_MODE_AN, $version), $inputitem['size']);
1578
-			for ($i=0; $i < $words; ++$i) {
1579
-				$val  = (int)$this->lookAnTable(ord($inputitem['data'][$i*2  ])) * 45;
1580
-				$val += (int)$this->lookAnTable(ord($inputitem['data'][$i*2+1]));
1578
+			for ($i = 0; $i < $words; ++$i) {
1579
+				$val  = (int) $this->lookAnTable(ord($inputitem['data'][$i * 2])) * 45;
1580
+				$val += (int) $this->lookAnTable(ord($inputitem['data'][$i * 2 + 1]));
1581 1581
 				$inputitem['bstream'] = $this->appendNum($inputitem['bstream'], 11, $val);
1582 1582
 			}
1583 1583
 			if ($inputitem['size'] & 1) {
@@ -1597,7 +1597,7 @@  discard block
 block discarded – undo
1597 1597
 			$inputitem['bstream'] = array();
1598 1598
 			$inputitem['bstream'] = $this->appendNum($inputitem['bstream'], 4, 0x4);
1599 1599
 			$inputitem['bstream'] = $this->appendNum($inputitem['bstream'], $this->lengthIndicator(QR_MODE_8B, $version), $inputitem['size']);
1600
-			for ($i=0; $i < $inputitem['size']; ++$i) {
1600
+			for ($i = 0; $i < $inputitem['size']; ++$i) {
1601 1601
 				$inputitem['bstream'] = $this->appendNum($inputitem['bstream'], 8, ord($inputitem['data'][$i]));
1602 1602
 			}
1603 1603
 			return $inputitem;
@@ -1612,9 +1612,9 @@  discard block
 block discarded – undo
1612 1612
 		 protected function encodeModeKanji($inputitem, $version) {
1613 1613
 			$inputitem['bstream'] = array();
1614 1614
 			$inputitem['bstream'] = $this->appendNum($inputitem['bstream'], 4, 0x8);
1615
-			$inputitem['bstream'] = $this->appendNum($inputitem['bstream'], $this->lengthIndicator(QR_MODE_KJ, $version), (int)($inputitem['size'] / 2));
1616
-			for ($i=0; $i<$inputitem['size']; $i+=2) {
1617
-				$val = (ord($inputitem['data'][$i]) << 8) | ord($inputitem['data'][$i+1]);
1615
+			$inputitem['bstream'] = $this->appendNum($inputitem['bstream'], $this->lengthIndicator(QR_MODE_KJ, $version), (int) ($inputitem['size'] / 2));
1616
+			for ($i = 0; $i < $inputitem['size']; $i += 2) {
1617
+				$val = (ord($inputitem['data'][$i]) << 8) | ord($inputitem['data'][$i + 1]);
1618 1618
 				if ($val <= 0x9ffc) {
1619 1619
 					$val -= 0x8140;
1620 1620
 				} else {
@@ -1659,7 +1659,7 @@  discard block
 block discarded – undo
1659 1659
 				$inputitem['bstream'] = $this->appendBitstream($inputitem['bstream'], $st1['bstream']);
1660 1660
 				$inputitem['bstream'] = $this->appendBitstream($inputitem['bstream'], $st2['bstream']);
1661 1661
 			} else {
1662
-				switch($inputitem['mode']) {
1662
+				switch ($inputitem['mode']) {
1663 1663
 					case QR_MODE_NM: {
1664 1664
 						$inputitem = $this->encodeModeNum($inputitem, $version);
1665 1665
 						break;
@@ -1737,7 +1737,7 @@  discard block
 block discarded – undo
1737 1737
 			$parity = 0;
1738 1738
 			foreach ($items as $item) {
1739 1739
 				if ($item['mode'] != QR_MODE_ST) {
1740
-					for ($i=$item['size']-1; $i>=0; --$i) {
1740
+					for ($i = $item['size'] - 1; $i >= 0; --$i) {
1741 1741
 						$parity ^= $item['data'][$i];
1742 1742
 					}
1743 1743
 				}
@@ -1752,8 +1752,8 @@  discard block
 block discarded – undo
1752 1752
 		 * @return boolean true or false
1753 1753
 		 */
1754 1754
 		 protected function checkModeNum($size, $data) {
1755
-			for ($i=0; $i<$size; ++$i) {
1756
-				if ((ord($data[$i]) < ord('0')) OR (ord($data[$i]) > ord('9'))){
1755
+			for ($i = 0; $i < $size; ++$i) {
1756
+				if ((ord($data[$i]) < ord('0')) OR (ord($data[$i]) > ord('9'))) {
1757 1757
 					return false;
1758 1758
 				}
1759 1759
 			}
@@ -1766,9 +1766,9 @@  discard block
 block discarded – undo
1766 1766
 		 * @return int number of bits
1767 1767
 		 */
1768 1768
 		 protected function estimateBitsModeNum($size) {
1769
-			$w = (int)$size / 3;
1769
+			$w = (int) $size / 3;
1770 1770
 			$bits = $w * 10;
1771
-			switch($size - $w * 3) {
1771
+			switch ($size - $w * 3) {
1772 1772
 				case 1: {
1773 1773
 					$bits += 4;
1774 1774
 					break;
@@ -1790,7 +1790,7 @@  discard block
 block discarded – undo
1790 1790
 		 * @return value
1791 1791
 		 */
1792 1792
 		protected function lookAnTable($c) {
1793
-			return (($c > 127)?-1:$this->anTable[$c]);
1793
+			return (($c > 127) ?-1 : $this->anTable[$c]);
1794 1794
 		}
1795 1795
 
1796 1796
 		/**
@@ -1800,7 +1800,7 @@  discard block
 block discarded – undo
1800 1800
 		 * @return boolean true or false
1801 1801
 		 */
1802 1802
 		 protected function checkModeAn($size, $data) {
1803
-			for ($i=0; $i<$size; ++$i) {
1803
+			for ($i = 0; $i < $size; ++$i) {
1804 1804
 				if ($this->lookAnTable(ord($data[$i])) == -1) {
1805 1805
 					return false;
1806 1806
 				}
@@ -1814,7 +1814,7 @@  discard block
 block discarded – undo
1814 1814
 		 * @return int number of bits
1815 1815
 		 */
1816 1816
 		 protected function estimateBitsModeAn($size) {
1817
-			$w = (int)($size / 2);
1817
+			$w = (int) ($size / 2);
1818 1818
 			$bits = $w * 11;
1819 1819
 			if ($size & 1) {
1820 1820
 				$bits += 6;
@@ -1837,7 +1837,7 @@  discard block
 block discarded – undo
1837 1837
 		 * @return int number of bits
1838 1838
 		 */
1839 1839
 		 protected function estimateBitsModeKanji($size) {
1840
-			return (int)(($size / 2) * 13);
1840
+			return (int) (($size / 2) * 13);
1841 1841
 		}
1842 1842
 
1843 1843
 		/**
@@ -1850,8 +1850,8 @@  discard block
 block discarded – undo
1850 1850
 			if ($size & 1) {
1851 1851
 				return false;
1852 1852
 			}
1853
-			for ($i=0; $i<$size; $i+=2) {
1854
-				$val = (ord($data[$i]) << 8) | ord($data[$i+1]);
1853
+			for ($i = 0; $i < $size; $i += 2) {
1854
+				$val = (ord($data[$i]) << 8) | ord($data[$i + 1]);
1855 1855
 				if (($val < 0x8140) OR (($val > 0x9ffc) AND ($val < 0xe040)) OR ($val > 0xebbf)) {
1856 1856
 					return false;
1857 1857
 				}
@@ -1870,7 +1870,7 @@  discard block
 block discarded – undo
1870 1870
 			if ($size <= 0) {
1871 1871
 				return false;
1872 1872
 			}
1873
-			switch($mode) {
1873
+			switch ($mode) {
1874 1874
 				case QR_MODE_NM: {
1875 1875
 					return $this->checkModeNum($size, $data);
1876 1876
 				}
@@ -1905,7 +1905,7 @@  discard block
 block discarded – undo
1905 1905
 				$version = 1;
1906 1906
 			}
1907 1907
 			foreach ($items as $item) {
1908
-				switch($item['mode']) {
1908
+				switch ($item['mode']) {
1909 1909
 					case QR_MODE_NM: {
1910 1910
 						$bits = $this->estimateBitsModeNum($item['size']);
1911 1911
 						break;
@@ -1931,7 +1931,7 @@  discard block
 block discarded – undo
1931 1931
 				}
1932 1932
 				$l = $this->lengthIndicator($item['mode'], $version);
1933 1933
 				$m = 1 << $l;
1934
-				$num = (int)(($item['size'] + $m - 1) / $m);
1934
+				$num = (int) (($item['size'] + $m - 1) / $m);
1935 1935
 				$bits += $num * (4 + $l);
1936 1936
 			}
1937 1937
 			return $bits;
@@ -1948,7 +1948,7 @@  discard block
 block discarded – undo
1948 1948
 			do {
1949 1949
 				$prev = $version;
1950 1950
 				$bits = $this->estimateBitStreamSize($items, $prev);
1951
-				$version = $this->getMinimumVersion((int)(($bits + 7) / 8), $this->level);
1951
+				$version = $this->getMinimumVersion((int) (($bits + 7) / 8), $this->level);
1952 1952
 				if ($version < 0) {
1953 1953
 					return -1;
1954 1954
 				}
@@ -1965,9 +1965,9 @@  discard block
 block discarded – undo
1965 1965
 		 */
1966 1966
 		 protected function lengthOfCode($mode, $version, $bits) {
1967 1967
 			$payload = $bits - 4 - $this->lengthIndicator($mode, $version);
1968
-			switch($mode) {
1968
+			switch ($mode) {
1969 1969
 				case QR_MODE_NM: {
1970
-					$chunks = (int)($payload / 10);
1970
+					$chunks = (int) ($payload / 10);
1971 1971
 					$remain = $payload - $chunks * 10;
1972 1972
 					$size = $chunks * 3;
1973 1973
 					if ($remain >= 7) {
@@ -1978,7 +1978,7 @@  discard block
 block discarded – undo
1978 1978
 					break;
1979 1979
 				}
1980 1980
 				case QR_MODE_AN: {
1981
-					$chunks = (int)($payload / 11);
1981
+					$chunks = (int) ($payload / 11);
1982 1982
 					$remain = $payload - $chunks * 11;
1983 1983
 					$size = $chunks * 2;
1984 1984
 					if ($remain >= 6) {
@@ -1987,15 +1987,15 @@  discard block
 block discarded – undo
1987 1987
 					break;
1988 1988
 				}
1989 1989
 				case QR_MODE_8B: {
1990
-					$size = (int)($payload / 8);
1990
+					$size = (int) ($payload / 8);
1991 1991
 					break;
1992 1992
 				}
1993 1993
 				case QR_MODE_KJ: {
1994
-					$size = (int)(($payload / 13) * 2);
1994
+					$size = (int) (($payload / 13) * 2);
1995 1995
 					break;
1996 1996
 				}
1997 1997
 				case QR_MODE_ST: {
1998
-					$size = (int)($payload / 8);
1998
+					$size = (int) ($payload / 8);
1999 1999
 					break;
2000 2000
 				}
2001 2001
 				default: {
@@ -2045,7 +2045,7 @@  discard block
 block discarded – undo
2045 2045
 				if ($bits < 0) {
2046 2046
 					return -1;
2047 2047
 				}
2048
-				$ver = $this->getMinimumVersion((int)(($bits + 7) / 8), $this->level);
2048
+				$ver = $this->getMinimumVersion((int) (($bits + 7) / 8), $this->level);
2049 2049
 				if ($ver < 0) {
2050 2050
 					return -1;
2051 2051
 				} elseif ($ver > $this->version) {
@@ -2076,14 +2076,14 @@  discard block
 block discarded – undo
2076 2076
 				return $this->appendNum($bstream, $maxbits - $bits, 0);
2077 2077
 			}
2078 2078
 			$bits += 4;
2079
-			$words = (int)(($bits + 7) / 8);
2079
+			$words = (int) (($bits + 7) / 8);
2080 2080
 			$padding = array();
2081 2081
 			$padding = $this->appendNum($padding, $words * 8 - $bits + 4, 0);
2082 2082
 			$padlen = $maxwords - $words;
2083 2083
 			if ($padlen > 0) {
2084 2084
 				$padbuf = array();
2085
-				for ($i=0; $i<$padlen; ++$i) {
2086
-					$padbuf[$i] = ($i&1)?0x11:0xec;
2085
+				for ($i = 0; $i < $padlen; ++$i) {
2086
+					$padbuf[$i] = ($i & 1) ? 0x11 : 0xec;
2087 2087
 				}
2088 2088
 				$padding = $this->appendBytes($padding, $padlen, $padbuf);
2089 2089
 			}
@@ -2097,7 +2097,7 @@  discard block
 block discarded – undo
2097 2097
 		 */
2098 2098
 		 protected function mergeBitStream($items) {
2099 2099
 			$items = $this->convertData($items);
2100
-			if (!is_array($items)) {
2100
+			if ( ! is_array($items)) {
2101 2101
 				return null;
2102 2102
 			}
2103 2103
 			$bstream = array();
@@ -2149,7 +2149,7 @@  discard block
 block discarded – undo
2149 2149
 		 protected function newFromNum($bits, $num) {
2150 2150
 			$bstream = $this->allocate($bits);
2151 2151
 			$mask = 1 << ($bits - 1);
2152
-			for ($i=0; $i<$bits; ++$i) {
2152
+			for ($i = 0; $i < $bits; ++$i) {
2153 2153
 				if ($num & $mask) {
2154 2154
 					$bstream[$i] = 1;
2155 2155
 				} else {
@@ -2168,10 +2168,10 @@  discard block
 block discarded – undo
2168 2168
 		 */
2169 2169
 		 protected function newFromBytes($size, $data) {
2170 2170
 			$bstream = $this->allocate($size * 8);
2171
-			$p=0;
2172
-			for ($i=0; $i<$size; ++$i) {
2171
+			$p = 0;
2172
+			for ($i = 0; $i < $size; ++$i) {
2173 2173
 				$mask = 0x80;
2174
-				for ($j=0; $j<8; ++$j) {
2174
+				for ($j = 0; $j < 8; ++$j) {
2175 2175
 					if ($data[$i] & $mask) {
2176 2176
 						$bstream[$p] = 1;
2177 2177
 					} else {
@@ -2191,7 +2191,7 @@  discard block
 block discarded – undo
2191 2191
 		 * @return array bitstream
2192 2192
 		 */
2193 2193
 		 protected function appendBitstream($bitstream, $append) {
2194
-			if ((!is_array($append)) OR (count($append) == 0)) {
2194
+			if (( ! is_array($append)) OR (count($append) == 0)) {
2195 2195
 				return $bitstream;
2196 2196
 			}
2197 2197
 			if (count($bitstream) == 0) {
@@ -2243,12 +2243,12 @@  discard block
 block discarded – undo
2243 2243
 			if ($size == 0) {
2244 2244
 				return array();
2245 2245
 			}
2246
-			$data = array_fill(0, (int)(($size + 7) / 8), 0);
2247
-			$bytes = (int)($size / 8);
2246
+			$data = array_fill(0, (int) (($size + 7) / 8), 0);
2247
+			$bytes = (int) ($size / 8);
2248 2248
 			$p = 0;
2249
-			for ($i=0; $i<$bytes; $i++) {
2249
+			for ($i = 0; $i < $bytes; $i++) {
2250 2250
 				$v = 0;
2251
-				for ($j=0; $j<8; $j++) {
2251
+				for ($j = 0; $j < 8; $j++) {
2252 2252
 					$v = $v << 1;
2253 2253
 					$v |= $bstream[$p];
2254 2254
 					$p++;
@@ -2257,7 +2257,7 @@  discard block
 block discarded – undo
2257 2257
 			}
2258 2258
 			if ($size & 7) {
2259 2259
 				$v = 0;
2260
-				for ($j=0; $j<($size & 7); $j++) {
2260
+				for ($j = 0; $j < ($size & 7); $j++) {
2261 2261
 					$v = $v << 1;
2262 2262
 					$v |= $bstream[$p];
2263 2263
 					$p++;
@@ -2280,8 +2280,8 @@  discard block
 block discarded – undo
2280 2280
 		 * @param int $replLen length of the repl string
2281 2281
 		 * @return array srctab
2282 2282
 		 */
2283
-		 protected function qrstrset($srctab, $x, $y, $repl, $replLen=false) {
2284
-			$srctab[$y] = substr_replace($srctab[$y], ($replLen !== false)?substr($repl,0,$replLen):$repl, $x, ($replLen !== false)?$replLen:strlen($repl));
2283
+		 protected function qrstrset($srctab, $x, $y, $repl, $replLen = false) {
2284
+			$srctab[$y] = substr_replace($srctab[$y], ($replLen !== false) ? substr($repl, 0, $replLen) : $repl, $x, ($replLen !== false) ? $replLen : strlen($repl));
2285 2285
 			return $srctab;
2286 2286
 		}
2287 2287
 
@@ -2301,7 +2301,7 @@  discard block
 block discarded – undo
2301 2301
 		 * @param int $level error correction level
2302 2302
 		 * @return int ECC size (bytes)
2303 2303
 		 */
2304
-		protected function getECCLength($version, $level){
2304
+		protected function getECCLength($version, $level) {
2305 2305
 			return $this->capacity[$version][QRCAP_EC][$level];
2306 2306
 		}
2307 2307
 
@@ -2330,8 +2330,8 @@  discard block
 block discarded – undo
2330 2330
 		 * @return int version number
2331 2331
 		 */
2332 2332
 		protected function getMinimumVersion($size, $level) {
2333
-			for ($i=1; $i <= QRSPEC_VERSION_MAX; ++$i) {
2334
-				$words  = $this->capacity[$i][QRCAP_WORDS] - $this->capacity[$i][QRCAP_EC][$level];
2333
+			for ($i = 1; $i <= QRSPEC_VERSION_MAX; ++$i) {
2334
+				$words = $this->capacity[$i][QRCAP_WORDS] - $this->capacity[$i][QRCAP_EC][$level];
2335 2335
 				if ($words >= $size) {
2336 2336
 					return $i;
2337 2337
 				}
@@ -2401,14 +2401,14 @@  discard block
 block discarded – undo
2401 2401
 			$ecc = $this->getECCLength($version, $level);
2402 2402
 			if ($b2 == 0) {
2403 2403
 				$spec[0] = $b1;
2404
-				$spec[1] = (int)($data / $b1);
2405
-				$spec[2] = (int)($ecc / $b1);
2404
+				$spec[1] = (int) ($data / $b1);
2405
+				$spec[2] = (int) ($ecc / $b1);
2406 2406
 				$spec[3] = 0;
2407 2407
 				$spec[4] = 0;
2408 2408
 			} else {
2409 2409
 				$spec[0] = $b1;
2410
-				$spec[1] = (int)($data / ($b1 + $b2));
2411
-				$spec[2] = (int)($ecc  / ($b1 + $b2));
2410
+				$spec[1] = (int) ($data / ($b1 + $b2));
2411
+				$spec[2] = (int) ($ecc / ($b1 + $b2));
2412 2412
 				$spec[3] = $b2;
2413 2413
 				$spec[4] = $spec[1] + 1;
2414 2414
 			}
@@ -2433,8 +2433,8 @@  discard block
 block discarded – undo
2433 2433
 				);
2434 2434
 			$yStart = $oy - 2;
2435 2435
 			$xStart = $ox - 2;
2436
-			for ($y=0; $y < 5; $y++) {
2437
-				$frame = $this->qrstrset($frame, $xStart, $yStart+$y, $finder[$y]);
2436
+			for ($y = 0; $y < 5; $y++) {
2437
+				$frame = $this->qrstrset($frame, $xStart, $yStart + $y, $finder[$y]);
2438 2438
 			}
2439 2439
 			return $frame;
2440 2440
 		}
@@ -2454,7 +2454,7 @@  discard block
 block discarded – undo
2454 2454
 			if ($d < 0) {
2455 2455
 				$w = 2;
2456 2456
 			} else {
2457
-				$w = (int)(($width - $this->alignmentPattern[$version][0]) / $d + 2);
2457
+				$w = (int) (($width - $this->alignmentPattern[$version][0]) / $d + 2);
2458 2458
 			}
2459 2459
 			if ($w * $w - 3 == 1) {
2460 2460
 				$x = $this->alignmentPattern[$version][0];
@@ -2464,15 +2464,15 @@  discard block
 block discarded – undo
2464 2464
 			}
2465 2465
 			$cx = $this->alignmentPattern[$version][0];
2466 2466
 			$wo = $w - 1;
2467
-			for ($x=1; $x < $wo; ++$x) {
2467
+			for ($x = 1; $x < $wo; ++$x) {
2468 2468
 				$frame = $this->putAlignmentMarker($frame, 6, $cx);
2469
-				$frame = $this->putAlignmentMarker($frame, $cx,  6);
2469
+				$frame = $this->putAlignmentMarker($frame, $cx, 6);
2470 2470
 				$cx += $d;
2471 2471
 			}
2472 2472
 			$cy = $this->alignmentPattern[$version][0];
2473
-			for ($y=0; $y < $wo; ++$y) {
2473
+			for ($y = 0; $y < $wo; ++$y) {
2474 2474
 				$cx = $this->alignmentPattern[$version][0];
2475
-				for ($x=0; $x < $wo; ++$x) {
2475
+				for ($x = 0; $x < $wo; ++$x) {
2476 2476
 					$frame = $this->putAlignmentMarker($frame, $cx, $cy);
2477 2477
 					$cx += $d;
2478 2478
 				}
@@ -2527,7 +2527,7 @@  discard block
 block discarded – undo
2527 2527
 			"\xc1\xc0\xc0\xc0\xc0\xc0\xc1",
2528 2528
 			"\xc1\xc1\xc1\xc1\xc1\xc1\xc1"
2529 2529
 			);
2530
-			for ($y=0; $y < 7; $y++) {
2530
+			for ($y = 0; $y < 7; $y++) {
2531 2531
 				$frame = $this->qrstrset($frame, $ox, ($oy + $y), $finder[$y]);
2532 2532
 			}
2533 2533
 			return $frame;
@@ -2540,7 +2540,7 @@  discard block
 block discarded – undo
2540 2540
 		 */
2541 2541
 		protected function createFrame($version) {
2542 2542
 			$width = $this->capacity[$version][QRCAP_WIDTH];
2543
-			$frameLine = str_repeat ("\0", $width);
2543
+			$frameLine = str_repeat("\0", $width);
2544 2544
 			$frame = array_fill(0, $width, $frameLine);
2545 2545
 			// Finder pattern
2546 2546
 			$frame = $this->putFinderPattern($frame, 0, 0);
@@ -2548,7 +2548,7 @@  discard block
 block discarded – undo
2548 2548
 			$frame = $this->putFinderPattern($frame, 0, $width - 7);
2549 2549
 			// Separator
2550 2550
 			$yOffset = $width - 7;
2551
-			for ($y=0; $y < 7; ++$y) {
2551
+			for ($y = 0; $y < 7; ++$y) {
2552 2552
 				$frame[$y][7] = "\xc0";
2553 2553
 				$frame[$y][$width - 8] = "\xc0";
2554 2554
 				$frame[$yOffset][7] = "\xc0";
@@ -2556,22 +2556,22 @@  discard block
 block discarded – undo
2556 2556
 			}
2557 2557
 			$setPattern = str_repeat("\xc0", 8);
2558 2558
 			$frame = $this->qrstrset($frame, 0, 7, $setPattern);
2559
-			$frame = $this->qrstrset($frame, $width-8, 7, $setPattern);
2559
+			$frame = $this->qrstrset($frame, $width - 8, 7, $setPattern);
2560 2560
 			$frame = $this->qrstrset($frame, 0, $width - 8, $setPattern);
2561 2561
 			// Format info
2562 2562
 			$setPattern = str_repeat("\x84", 9);
2563 2563
 			$frame = $this->qrstrset($frame, 0, 8, $setPattern);
2564 2564
 			$frame = $this->qrstrset($frame, $width - 8, 8, $setPattern, 8);
2565 2565
 			$yOffset = $width - 8;
2566
-			for ($y=0; $y < 8; ++$y,++$yOffset) {
2566
+			for ($y = 0; $y < 8; ++$y, ++$yOffset) {
2567 2567
 				$frame[$y][8] = "\x84";
2568 2568
 				$frame[$yOffset][8] = "\x84";
2569 2569
 			}
2570 2570
 			// Timing pattern
2571 2571
 			$wo = $width - 15;
2572
-			for ($i=1; $i < $wo; ++$i) {
2573
-				$frame[6][7+$i] = chr(0x90 | ($i & 1));
2574
-				$frame[7+$i][6] = chr(0x90 | ($i & 1));
2572
+			for ($i = 1; $i < $wo; ++$i) {
2573
+				$frame[6][7 + $i] = chr(0x90 | ($i & 1));
2574
+				$frame[7 + $i][6] = chr(0x90 | ($i & 1));
2575 2575
 			}
2576 2576
 			// Alignment pattern
2577 2577
 			$frame = $this->putAlignmentPattern($version, $frame, $width);
@@ -2579,16 +2579,16 @@  discard block
 block discarded – undo
2579 2579
 			if ($version >= 7) {
2580 2580
 				$vinf = $this->getVersionPattern($version);
2581 2581
 				$v = $vinf;
2582
-				for ($x=0; $x<6; ++$x) {
2583
-					for ($y=0; $y<3; ++$y) {
2584
-						$frame[($width - 11)+$y][$x] = chr(0x88 | ($v & 1));
2582
+				for ($x = 0; $x < 6; ++$x) {
2583
+					for ($y = 0; $y < 3; ++$y) {
2584
+						$frame[($width - 11) + $y][$x] = chr(0x88 | ($v & 1));
2585 2585
 						$v = $v >> 1;
2586 2586
 					}
2587 2587
 				}
2588 2588
 				$v = $vinf;
2589
-				for ($y=0; $y<6; ++$y) {
2590
-					for ($x=0; $x<3; ++$x) {
2591
-						$frame[$y][$x+($width - 11)] = chr(0x88 | ($v & 1));
2589
+				for ($y = 0; $y < 6; ++$y) {
2590
+					for ($x = 0; $x < 3; ++$x) {
2591
+						$frame[$y][$x + ($width - 11)] = chr(0x88 | ($v & 1));
2592 2592
 						$v = $v >> 1;
2593 2593
 					}
2594 2594
 				}
@@ -2607,7 +2607,7 @@  discard block
 block discarded – undo
2607 2607
 			if (($version < 1) OR ($version > QRSPEC_VERSION_MAX)) {
2608 2608
 				return NULL;
2609 2609
 			}
2610
-			if (!isset($this->frames[$version])) {
2610
+			if ( ! isset($this->frames[$version])) {
2611 2611
 				$this->frames[$version] = $this->createFrame($version);
2612 2612
 			}
2613 2613
 			if (is_null($this->frames[$version])) {
@@ -2759,16 +2759,16 @@  discard block
 block discarded – undo
2759 2759
 			if (($symsize < 0) OR ($symsize > 8)) {
2760 2760
 				return $rs;
2761 2761
 			}
2762
-			if (($fcr < 0) OR ($fcr >= (1<<$symsize))) {
2762
+			if (($fcr < 0) OR ($fcr >= (1 << $symsize))) {
2763 2763
 				return $rs;
2764 2764
 			}
2765
-			if (($prim <= 0) OR ($prim >= (1<<$symsize))) {
2765
+			if (($prim <= 0) OR ($prim >= (1 << $symsize))) {
2766 2766
 				return $rs;
2767 2767
 			}
2768
-			if (($nroots < 0) OR ($nroots >= (1<<$symsize))) {
2768
+			if (($nroots < 0) OR ($nroots >= (1 << $symsize))) {
2769 2769
 				return $rs;
2770 2770
 			}
2771
-			if (($pad < 0) OR ($pad >= ((1<<$symsize) -1 - $nroots))) {
2771
+			if (($pad < 0) OR ($pad >= ((1 << $symsize) - 1 - $nroots))) {
2772 2772
 				return $rs;
2773 2773
 			}
2774 2774
 			$rs = array();
@@ -2778,13 +2778,13 @@  discard block
 block discarded – undo
2778 2778
 			$rs['alpha_to'] = array_fill(0, ($rs['nn'] + 1), 0);
2779 2779
 			$rs['index_of'] = array_fill(0, ($rs['nn'] + 1), 0);
2780 2780
 			// PHP style macro replacement ;)
2781
-			$NN =& $rs['nn'];
2782
-			$A0 =& $NN;
2781
+			$NN = & $rs['nn'];
2782
+			$A0 = & $NN;
2783 2783
 			// Generate Galois field lookup tables
2784 2784
 			$rs['index_of'][0] = $A0; // log(zero) = -inf
2785 2785
 			$rs['alpha_to'][$A0] = 0; // alpha**-inf = 0
2786 2786
 			$sr = 1;
2787
-			for ($i=0; $i<$rs['nn']; ++$i) {
2787
+			for ($i = 0; $i < $rs['nn']; ++$i) {
2788 2788
 				$rs['index_of'][$sr] = $i;
2789 2789
 				$rs['alpha_to'][$i] = $sr;
2790 2790
 				$sr <<= 1;
@@ -2804,19 +2804,19 @@  discard block
 block discarded – undo
2804 2804
 			$rs['nroots'] = $nroots;
2805 2805
 			$rs['gfpoly'] = $gfpoly;
2806 2806
 			// Find prim-th root of 1, used in decoding
2807
-			for ($iprim=1; ($iprim % $prim) != 0; $iprim += $rs['nn']) {
2807
+			for ($iprim = 1; ($iprim % $prim) != 0; $iprim += $rs['nn']) {
2808 2808
 				; // intentional empty-body loop!
2809 2809
 			}
2810
-			$rs['iprim'] = (int)($iprim / $prim);
2810
+			$rs['iprim'] = (int) ($iprim / $prim);
2811 2811
 			$rs['genpoly'][0] = 1;
2812
-			for ($i = 0,$root=$fcr*$prim; $i < $nroots; $i++, $root += $prim) {
2813
-				$rs['genpoly'][$i+1] = 1;
2812
+			for ($i = 0, $root = $fcr * $prim; $i < $nroots; $i++, $root += $prim) {
2813
+				$rs['genpoly'][$i + 1] = 1;
2814 2814
 				// Multiply rs->genpoly[] by  @**(root + x)
2815 2815
 				for ($j = $i; $j > 0; --$j) {
2816 2816
 					if ($rs['genpoly'][$j] != 0) {
2817
-						$rs['genpoly'][$j] = $rs['genpoly'][$j-1] ^ $rs['alpha_to'][$this->modnn($rs, $rs['index_of'][$rs['genpoly'][$j]] + $root)];
2817
+						$rs['genpoly'][$j] = $rs['genpoly'][$j - 1] ^ $rs['alpha_to'][$this->modnn($rs, $rs['index_of'][$rs['genpoly'][$j]] + $root)];
2818 2818
 					} else {
2819
-						$rs['genpoly'][$j] = $rs['genpoly'][$j-1];
2819
+						$rs['genpoly'][$j] = $rs['genpoly'][$j - 1];
2820 2820
 					}
2821 2821
 				}
2822 2822
 				// rs->genpoly[0] can never be zero
@@ -2837,26 +2837,26 @@  discard block
 block discarded – undo
2837 2837
 		 * @return parity array
2838 2838
 		 */
2839 2839
 		 protected function encode_rs_char($rs, $data, $parity) {
2840
-			$MM       =& $rs['mm']; // bits per symbol
2841
-			$NN       =& $rs['nn']; // the total number of symbols in a RS block
2842
-			$ALPHA_TO =& $rs['alpha_to']; // the address of an array of NN elements to convert Galois field elements in index (log) form to polynomial form
2843
-			$INDEX_OF =& $rs['index_of']; // the address of an array of NN elements to convert Galois field elements in polynomial form to index (log) form
2844
-			$GENPOLY  =& $rs['genpoly']; // an array of NROOTS+1 elements containing the generator polynomial in index form
2845
-			$NROOTS   =& $rs['nroots']; // the number of roots in the RS code generator polynomial, which is the same as the number of parity symbols in a block
2846
-			$FCR      =& $rs['fcr']; // first consecutive root, index form
2847
-			$PRIM     =& $rs['prim']; // primitive element, index form
2848
-			$IPRIM    =& $rs['iprim']; // prim-th root of 1, index form
2849
-			$PAD      =& $rs['pad']; // the number of pad symbols in a block
2850
-			$A0       =& $NN;
2840
+			$MM       = & $rs['mm']; // bits per symbol
2841
+			$NN       = & $rs['nn']; // the total number of symbols in a RS block
2842
+			$ALPHA_TO = & $rs['alpha_to']; // the address of an array of NN elements to convert Galois field elements in index (log) form to polynomial form
2843
+			$INDEX_OF = & $rs['index_of']; // the address of an array of NN elements to convert Galois field elements in polynomial form to index (log) form
2844
+			$GENPOLY  = & $rs['genpoly']; // an array of NROOTS+1 elements containing the generator polynomial in index form
2845
+			$NROOTS   = & $rs['nroots']; // the number of roots in the RS code generator polynomial, which is the same as the number of parity symbols in a block
2846
+			$FCR      = & $rs['fcr']; // first consecutive root, index form
2847
+			$PRIM     = & $rs['prim']; // primitive element, index form
2848
+			$IPRIM    = & $rs['iprim']; // prim-th root of 1, index form
2849
+			$PAD      = & $rs['pad']; // the number of pad symbols in a block
2850
+			$A0       = & $NN;
2851 2851
 			$parity = array_fill(0, $NROOTS, 0);
2852
-			for ($i=0; $i < ($NN - $NROOTS - $PAD); $i++) {
2852
+			for ($i = 0; $i < ($NN - $NROOTS - $PAD); $i++) {
2853 2853
 				$feedback = $INDEX_OF[$data[$i] ^ $parity[0]];
2854 2854
 				if ($feedback != $A0) {
2855 2855
 					// feedback term is non-zero
2856 2856
 					// This line is unnecessary when GENPOLY[NROOTS] is unity, as it must
2857 2857
 					// always be for the polynomials constructed by init_rs()
2858 2858
 					$feedback = $this->modnn($rs, $NN - $GENPOLY[$NROOTS] + $feedback);
2859
-					for ($j=1; $j < $NROOTS; ++$j) {
2859
+					for ($j = 1; $j < $NROOTS; ++$j) {
2860 2860
 					$parity[$j] ^= $ALPHA_TO[$this->modnn($rs, $feedback + $GENPOLY[($NROOTS - $j)])];
2861 2861
 					}
2862 2862
 				}
Please login to merge, or discard this patch.
app/Vendor/PHPExcel/PHPExcel/Shared/String.php 4 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -566,8 +566,8 @@
 block discarded – undo
566 566
 	 * Get a substring of a UTF-8 encoded string
567 567
 	 *
568 568
 	 * @param string $pValue UTF-8 encoded string
569
-	 * @param int $start Start offset
570
-	 * @param int $length Maximum number of characters in substring
569
+	 * @param int $pStart Start offset
570
+	 * @param int $pLength Maximum number of characters in substring
571 571
 	 * @return string
572 572
 	 */
573 573
 	public static function Substring($pValue = '', $pStart = 0, $pLength = 0)
Please login to merge, or discard this patch.
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -1,29 +1,29 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * PHPExcel
4
- *
5
- * Copyright (c) 2006 - 2012 PHPExcel
6
- *
7
- * This library is free software; you can redistribute it and/or
8
- * modify it under the terms of the GNU Lesser General Public
9
- * License as published by the Free Software Foundation; either
10
- * version 2.1 of the License, or (at your option) any later version.
11
- *
12
- * This library is distributed in the hope that it will be useful,
13
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15
- * Lesser General Public License for more details.
16
- *
17
- * You should have received a copy of the GNU Lesser General Public
18
- * License along with this library; if not, write to the Free Software
19
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
20
- *
21
- * @category   PHPExcel
22
- * @package    PHPExcel_Shared
23
- * @copyright  Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
24
- * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt	LGPL
25
- * @version    1.7.7, 2012-05-19
26
- */
3
+	 * PHPExcel
4
+	 *
5
+	 * Copyright (c) 2006 - 2012 PHPExcel
6
+	 *
7
+	 * This library is free software; you can redistribute it and/or
8
+	 * modify it under the terms of the GNU Lesser General Public
9
+	 * License as published by the Free Software Foundation; either
10
+	 * version 2.1 of the License, or (at your option) any later version.
11
+	 *
12
+	 * This library is distributed in the hope that it will be useful,
13
+	 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+	 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15
+	 * Lesser General Public License for more details.
16
+	 *
17
+	 * You should have received a copy of the GNU Lesser General Public
18
+	 * License along with this library; if not, write to the Free Software
19
+	 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
20
+	 *
21
+	 * @category   PHPExcel
22
+	 * @package    PHPExcel_Shared
23
+	 * @copyright  Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
24
+	 * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt	LGPL
25
+	 * @version    1.7.7, 2012-05-19
26
+	 */
27 27
 
28 28
 
29 29
 /**
Please login to merge, or discard this patch.
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 	/**	Constants				*/
39 39
 	/**	Regular Expressions		*/
40 40
 	//	Fraction
41
-	const STRING_REGEXP_FRACTION	= '(-?)(\d+)\s+(\d+\/\d+)';
41
+	const STRING_REGEXP_FRACTION = '(-?)(\d+)\s+(\d+\/\d+)';
42 42
 
43 43
 
44 44
 	/**
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 	private static function _buildControlCharacters() {
97 97
 		for ($i = 0; $i <= 31; ++$i) {
98 98
 			if ($i != 9 && $i != 10 && $i != 13) {
99
-				$find = '_x' . sprintf('%04s' , strtoupper(dechex($i))) . '_';
99
+				$find = '_x'.sprintf('%04s', strtoupper(dechex($i))).'_';
100 100
 				$replace = chr($i);
101 101
 				self::$_controlCharacters[$find] = $replace;
102 102
 			}
@@ -297,28 +297,28 @@  discard block
 block discarded – undo
297 297
 		}
298 298
 
299 299
 		// Fail if iconv doesn't exist
300
-		if (!function_exists('iconv')) {
300
+		if ( ! function_exists('iconv')) {
301 301
 			self::$_isIconvEnabled = false;
302 302
 			return false;
303 303
 		}
304 304
 
305 305
 		// Sometimes iconv is not working, and e.g. iconv('UTF-8', 'UTF-16LE', 'x') just returns false,
306
-		if (!@iconv('UTF-8', 'UTF-16LE', 'x')) {
306
+		if ( ! @iconv('UTF-8', 'UTF-16LE', 'x')) {
307 307
 			self::$_isIconvEnabled = false;
308 308
 			return false;
309 309
 		}
310 310
 
311 311
 		// Sometimes iconv_substr('A', 0, 1, 'UTF-8') just returns false in PHP 5.2.0
312 312
 		// we cannot use iconv in that case either (http://bugs.php.net/bug.php?id=37773)
313
-		if (!@iconv_substr('A', 0, 1, 'UTF-8')) {
313
+		if ( ! @iconv_substr('A', 0, 1, 'UTF-8')) {
314 314
 			self::$_isIconvEnabled = false;
315 315
 			return false;
316 316
 		}
317 317
 
318 318
 		// CUSTOM: IBM AIX iconv() does not work
319
-		if ( defined('PHP_OS') && @stristr(PHP_OS, 'AIX')
319
+		if (defined('PHP_OS') && @stristr(PHP_OS, 'AIX')
320 320
 				&& defined('ICONV_IMPL') && (@strcasecmp(ICONV_IMPL, 'unknown') == 0)
321
-				&& defined('ICONV_VERSION') && (@strcasecmp(ICONV_VERSION, 'unknown') == 0) )
321
+				&& defined('ICONV_VERSION') && (@strcasecmp(ICONV_VERSION, 'unknown') == 0))
322 322
 		{
323 323
 			self::$_isIconvEnabled = false;
324 324
 			return false;
@@ -330,10 +330,10 @@  discard block
 block discarded – undo
330 330
 	}
331 331
 
332 332
 	public static function buildCharacterSets() {
333
-		if(empty(self::$_controlCharacters)) {
333
+		if (empty(self::$_controlCharacters)) {
334 334
 			self::_buildControlCharacters();
335 335
 		}
336
-		if(empty(self::$_SYLKCharacters)) {
336
+		if (empty(self::$_SYLKCharacters)) {
337 337
 			self::_buildSYLKCharacters();
338 338
 		}
339 339
 	}
@@ -353,7 +353,7 @@  discard block
 block discarded – undo
353 353
 	 * @return 	string
354 354
 	 */
355 355
 	public static function ControlCharacterOOXML2PHP($value = '') {
356
-		return str_replace( array_keys(self::$_controlCharacters), array_values(self::$_controlCharacters), $value );
356
+		return str_replace(array_keys(self::$_controlCharacters), array_values(self::$_controlCharacters), $value);
357 357
 	}
358 358
 
359 359
 	/**
@@ -371,7 +371,7 @@  discard block
 block discarded – undo
371 371
 	 * @return 	string
372 372
 	 */
373 373
 	public static function ControlCharacterPHP2OOXML($value = '') {
374
-		return str_replace( array_values(self::$_controlCharacters), array_keys(self::$_controlCharacters), $value );
374
+		return str_replace(array_values(self::$_controlCharacters), array_keys(self::$_controlCharacters), $value);
375 375
 	}
376 376
 
377 377
 	/**
@@ -436,7 +436,7 @@  discard block
 block discarded – undo
436 436
 		$ln = self::CountCharacters($value, 'UTF-8');
437 437
 
438 438
 		// option flags
439
-		if(empty($arrcRuns)){
439
+		if (empty($arrcRuns)) {
440 440
 			$opt = (self::getIsIconvEnabled() || self::getIsMbstringEnabled()) ?
441 441
 				0x0001 : 0x0000;
442 442
 			$data = pack('CC', $ln, $opt);
@@ -448,7 +448,7 @@  discard block
 block discarded – undo
448 448
 			$data .= pack('v', count($arrcRuns));
449 449
 			// characters
450 450
 			$data .= $value;
451
-			foreach ($arrcRuns as $cRun){
451
+			foreach ($arrcRuns as $cRun) {
452 452
 				$data .= pack('v', $cRun['strlen']);
453 453
 				$data .= pack('v', $cRun['fontidx']);
454 454
 			}
@@ -478,7 +478,7 @@  discard block
 block discarded – undo
478 478
 		// characters
479 479
 		$chars = self::ConvertEncoding($value, 'UTF-16LE', 'UTF-8');
480 480
 
481
-		$data = pack('vC', $ln, $opt) . $chars;
481
+		$data = pack('vC', $ln, $opt).$chars;
482 482
 		return $data;
483 483
 	}
484 484
 
@@ -501,9 +501,9 @@  discard block
 block discarded – undo
501 501
 			$value = mb_convert_encoding($value, $to, $from);
502 502
 			return $value;
503 503
 		}
504
-		if($from == 'UTF-16LE'){
504
+		if ($from == 'UTF-16LE') {
505 505
 			return self::utf16_decode($value, false);
506
-		}else if($from == 'UTF-16BE'){
506
+		} else if ($from == 'UTF-16BE') {
507 507
 			return self::utf16_decode($value);
508 508
 		}
509 509
 		// else, no conversion
@@ -525,17 +525,17 @@  discard block
 block discarded – undo
525 525
 	 * @author  Rasmus Andersson {@link http://rasmusandersson.se/}
526 526
 	 * @author vadik56
527 527
 	 */
528
-	public static function utf16_decode( $str, $bom_be=true ) {
529
-		if( strlen($str) < 2 ) return $str;
528
+	public static function utf16_decode($str, $bom_be = true) {
529
+		if (strlen($str) < 2) return $str;
530 530
 		$c0 = ord($str{0});
531 531
 		$c1 = ord($str{1});
532
-		if( $c0 == 0xfe && $c1 == 0xff ) { $str = substr($str,2); }
533
-		elseif( $c0 == 0xff && $c1 == 0xfe ) { $str = substr($str,2); $bom_be = false; }
532
+		if ($c0 == 0xfe && $c1 == 0xff) { $str = substr($str, 2); }
533
+		elseif ($c0 == 0xff && $c1 == 0xfe) { $str = substr($str, 2); $bom_be = false; }
534 534
 		$len = strlen($str);
535 535
 		$newstr = '';
536
-		for($i=0;$i<$len;$i+=2) {
537
-			if( $bom_be ) { $val = ord($str{$i})   << 4; $val += ord($str{$i+1}); }
538
-			else {        $val = ord($str{$i+1}) << 4; $val += ord($str{$i}); }
536
+		for ($i = 0; $i < $len; $i += 2) {
537
+			if ($bom_be) { $val = ord($str{$i}) << 4; $val += ord($str{$i + 1}); }
538
+			else {        $val = ord($str{$i + 1}) << 4; $val += ord($str{$i}); }
539 539
 			$newstr .= ($val == 0x228) ? "\n" : chr($val);
540 540
 		}
541 541
 		return $newstr;
@@ -610,7 +610,7 @@  discard block
 block discarded – undo
610 610
 	 */
611 611
 	public static function getDecimalSeparator()
612 612
 	{
613
-		if (!isset(self::$_decimalSeparator)) {
613
+		if ( ! isset(self::$_decimalSeparator)) {
614 614
 			$localeconv = localeconv();
615 615
 			self::$_decimalSeparator = $localeconv['decimal_point'] != ''
616 616
 				? $localeconv['decimal_point'] : $localeconv['mon_decimal_point'];
@@ -642,7 +642,7 @@  discard block
 block discarded – undo
642 642
 	 */
643 643
 	public static function getThousandsSeparator()
644 644
 	{
645
-		if (!isset(self::$_thousandsSeparator)) {
645
+		if ( ! isset(self::$_thousandsSeparator)) {
646 646
 			$localeconv = localeconv();
647 647
 			self::$_thousandsSeparator = $localeconv['thousands_sep'] != ''
648 648
 				? $localeconv['thousands_sep'] : $localeconv['mon_thousands_sep'];
@@ -669,7 +669,7 @@  discard block
 block discarded – undo
669 669
 	 */
670 670
 	public static function getCurrencyCode()
671 671
 	{
672
-		if (!isset(self::$_currencyCode)) {
672
+		if ( ! isset(self::$_currencyCode)) {
673 673
 			$localeconv = localeconv();
674 674
 			self::$_currencyCode = $localeconv['currency_symbol'] != ''
675 675
 				? $localeconv['currency_symbol'] : $localeconv['int_curr_symbol'];
@@ -725,6 +725,6 @@  discard block
 block discarded – undo
725 725
 		if (is_numeric($value))
726 726
 			return $value;
727 727
 		$v = floatval($value);
728
-		return (is_numeric(substr($value,0,strlen($v)))) ? $v : $value;
728
+		return (is_numeric(substr($value, 0, strlen($v)))) ? $v : $value;
729 729
 	}
730 730
 }
Please login to merge, or discard this patch.
Braces   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -442,8 +442,7 @@  discard block
 block discarded – undo
442 442
 			$data = pack('CC', $ln, $opt);
443 443
 			// characters
444 444
 			$data .= self::ConvertEncoding($value, 'UTF-16LE', 'UTF-8');
445
-		}
446
-		else {
445
+		} else {
447 446
 			$data = pack('vC', $ln, 0x08);
448 447
 			$data .= pack('v', count($arrcRuns));
449 448
 			// characters
@@ -503,7 +502,7 @@  discard block
 block discarded – undo
503 502
 		}
504 503
 		if($from == 'UTF-16LE'){
505 504
 			return self::utf16_decode($value, false);
506
-		}else if($from == 'UTF-16BE'){
505
+		} else if($from == 'UTF-16BE'){
507 506
 			return self::utf16_decode($value);
508 507
 		}
509 508
 		// else, no conversion
@@ -526,16 +525,16 @@  discard block
 block discarded – undo
526 525
 	 * @author vadik56
527 526
 	 */
528 527
 	public static function utf16_decode( $str, $bom_be=true ) {
529
-		if( strlen($str) < 2 ) return $str;
528
+		if( strlen($str) < 2 ) {
529
+			return $str;
530
+		}
530 531
 		$c0 = ord($str{0});
531 532
 		$c1 = ord($str{1});
532
-		if( $c0 == 0xfe && $c1 == 0xff ) { $str = substr($str,2); }
533
-		elseif( $c0 == 0xff && $c1 == 0xfe ) { $str = substr($str,2); $bom_be = false; }
533
+		if( $c0 == 0xfe && $c1 == 0xff ) { $str = substr($str,2); } elseif( $c0 == 0xff && $c1 == 0xfe ) { $str = substr($str,2); $bom_be = false; }
534 534
 		$len = strlen($str);
535 535
 		$newstr = '';
536 536
 		for($i=0;$i<$len;$i+=2) {
537
-			if( $bom_be ) { $val = ord($str{$i})   << 4; $val += ord($str{$i+1}); }
538
-			else {        $val = ord($str{$i+1}) << 4; $val += ord($str{$i}); }
537
+			if( $bom_be ) { $val = ord($str{$i})   << 4; $val += ord($str{$i+1}); } else {        $val = ord($str{$i+1}) << 4; $val += ord($str{$i}); }
539 538
 			$newstr .= ($val == 0x228) ? "\n" : chr($val);
540 539
 		}
541 540
 		return $newstr;
@@ -722,8 +721,9 @@  discard block
 block discarded – undo
722 721
 	 */
723 722
 	public static function testStringAsNumeric($value)
724 723
 	{
725
-		if (is_numeric($value))
726
-			return $value;
724
+		if (is_numeric($value)) {
725
+					return $value;
726
+		}
727 727
 		$v = floatval($value);
728 728
 		return (is_numeric(substr($value,0,strlen($v)))) ? $v : $value;
729 729
 	}
Please login to merge, or discard this patch.
app/Vendor/PHPExcel/PHPExcel/Shared/trend/bestFitClass.php 3 patches
Doc Comments   +11 added lines, -3 removed lines patch added patch discarded remove patch
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
 	 * Return the Y-Value for a specified value of X
128 128
 	 *
129 129
 	 * @param	 float		$xValue			X-Value
130
-	 * @return	 float						Y-Value
130
+	 * @return	 boolean						Y-Value
131 131
 	 */
132 132
 	public function getValueOfYForX($xValue) {
133 133
 		return False;
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
 	 * Return the X-Value for a specified value of Y
139 139
 	 *
140 140
 	 * @param	 float		$yValue			Y-Value
141
-	 * @return	 float						X-Value
141
+	 * @return	 boolean						X-Value
142 142
 	 */
143 143
 	public function getValueOfXForY($yValue) {
144 144
 		return False;
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 	 * Return the Equation of the best-fit line
160 160
 	 *
161 161
 	 * @param	 int		$dp		Number of places of decimal precision to display
162
-	 * @return	 string
162
+	 * @return	 boolean
163 163
 	 */
164 164
 	public function getEquation($dp=0) {
165 165
 		return False;
@@ -311,6 +311,9 @@  discard block
 block discarded – undo
311 311
 	}	//	function getYBestFitValues()
312 312
 
313 313
 
314
+	/**
315
+	 * @param double $sumY2
316
+	 */
314 317
 	protected function _calculateGoodnessOfFit($sumX,$sumY,$sumX2,$sumY2,$sumXY,$meanX,$meanY, $const) {
315 318
 		$SSres = $SScov = $SScor = $SStot = $SSsex = 0.0;
316 319
 		foreach($this->_xValues as $xKey => $xValue) {
@@ -365,6 +368,11 @@  discard block
 block discarded – undo
365 368
 	}	//	function _calculateGoodnessOfFit()
366 369
 
367 370
 
371
+	/**
372
+	 * @param double[] $yValues
373
+	 * @param double[] $xValues
374
+	 * @param boolean $const
375
+	 */
368 376
 	protected function _leastSquareFit($yValues, $xValues, $const) {
369 377
 		// calculate sums
370 378
 		$x_sum = array_sum($xValues);
Please login to merge, or discard this patch.
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -1,29 +1,29 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * PHPExcel
4
- *
5
- * Copyright (c) 2006 - 2012 PHPExcel
6
- *
7
- * This library is free software; you can redistribute it and/or
8
- * modify it under the terms of the GNU Lesser General Public
9
- * License as published by the Free Software Foundation; either
10
- * version 2.1 of the License, or (at your option) any later version.
11
- *
12
- * This library is distributed in the hope that it will be useful,
13
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15
- * Lesser General Public License for more details.
16
- *
17
- * You should have received a copy of the GNU Lesser General Public
18
- * License along with this library; if not, write to the Free Software
19
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
20
- *
21
- * @category   PHPExcel
22
- * @package    PHPExcel_Shared_Trend
23
- * @copyright  Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
24
- * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt	LGPL
25
- * @version    1.7.7, 2012-05-19
26
- */
3
+	 * PHPExcel
4
+	 *
5
+	 * Copyright (c) 2006 - 2012 PHPExcel
6
+	 *
7
+	 * This library is free software; you can redistribute it and/or
8
+	 * modify it under the terms of the GNU Lesser General Public
9
+	 * License as published by the Free Software Foundation; either
10
+	 * version 2.1 of the License, or (at your option) any later version.
11
+	 *
12
+	 * This library is distributed in the hope that it will be useful,
13
+	 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+	 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15
+	 * Lesser General Public License for more details.
16
+	 *
17
+	 * You should have received a copy of the GNU Lesser General Public
18
+	 * License along with this library; if not, write to the Free Software
19
+	 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
20
+	 *
21
+	 * @category   PHPExcel
22
+	 * @package    PHPExcel_Shared_Trend
23
+	 * @copyright  Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
24
+	 * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt	LGPL
25
+	 * @version    1.7.7, 2012-05-19
26
+	 */
27 27
 
28 28
 
29 29
 /**
Please login to merge, or discard this patch.
Spacing   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -40,42 +40,42 @@  discard block
 block discarded – undo
40 40
 	 *
41 41
 	 * @var	boolean
42 42
 	 **/
43
-	protected $_error				= False;
43
+	protected $_error = False;
44 44
 
45 45
 	/**
46 46
 	 * Algorithm type to use for best-fit
47 47
 	 *
48 48
 	 * @var	string
49 49
 	 **/
50
-	protected $_bestFitType			= 'undetermined';
50
+	protected $_bestFitType = 'undetermined';
51 51
 
52 52
 	/**
53 53
 	 * Number of entries in the sets of x- and y-value arrays
54 54
 	 *
55 55
 	 * @var	int
56 56
 	 **/
57
-	protected $_valueCount			= 0;
57
+	protected $_valueCount = 0;
58 58
 
59 59
 	/**
60 60
 	 * X-value dataseries of values
61 61
 	 *
62 62
 	 * @var	float[]
63 63
 	 **/
64
-	protected $_xValues				= array();
64
+	protected $_xValues = array();
65 65
 
66 66
 	/**
67 67
 	 * Y-value dataseries of values
68 68
 	 *
69 69
 	 * @var	float[]
70 70
 	 **/
71
-	protected $_yValues				= array();
71
+	protected $_yValues = array();
72 72
 
73 73
 	/**
74 74
 	 * Flag indicating whether values should be adjusted to Y=0
75 75
 	 *
76 76
 	 * @var	boolean
77 77
 	 **/
78
-	protected $_adjustToZero		= False;
78
+	protected $_adjustToZero = False;
79 79
 
80 80
 	/**
81 81
 	 * Y-value series of best-fit values
@@ -86,9 +86,9 @@  discard block
 block discarded – undo
86 86
 
87 87
 	protected $_goodnessOfFit 		= 1;
88 88
 
89
-	protected $_stdevOfResiduals	= 0;
89
+	protected $_stdevOfResiduals = 0;
90 90
 
91
-	protected $_covariance			= 0;
91
+	protected $_covariance = 0;
92 92
 
93 93
 	protected $_correlation			= 0;
94 94
 
@@ -98,15 +98,15 @@  discard block
 block discarded – undo
98 98
 
99 99
 	protected $_DFResiduals			= 0;
100 100
 
101
-	protected $_F					= 0;
101
+	protected $_F = 0;
102 102
 
103
-	protected $_slope				= 0;
103
+	protected $_slope = 0;
104 104
 
105
-	protected $_slopeSE				= 0;
105
+	protected $_slopeSE = 0;
106 106
 
107
-	protected $_intersect			= 0;
107
+	protected $_intersect = 0;
108 108
 
109
-	protected $_intersectSE			= 0;
109
+	protected $_intersectSE = 0;
110 110
 
111 111
 	protected $_Xoffset				= 0;
112 112
 
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
 	 * @param	 int		$dp		Number of places of decimal precision to display
162 162
 	 * @return	 string
163 163
 	 */
164
-	public function getEquation($dp=0) {
164
+	public function getEquation($dp = 0) {
165 165
 		return False;
166 166
 	}	//	function getEquation()
167 167
 
@@ -172,9 +172,9 @@  discard block
 block discarded – undo
172 172
 	 * @param	 int		$dp		Number of places of decimal precision to display
173 173
 	 * @return	 string
174 174
 	 */
175
-	public function getSlope($dp=0) {
175
+	public function getSlope($dp = 0) {
176 176
 		if ($dp != 0) {
177
-			return round($this->_slope,$dp);
177
+			return round($this->_slope, $dp);
178 178
 		}
179 179
 		return $this->_slope;
180 180
 	}	//	function getSlope()
@@ -186,9 +186,9 @@  discard block
 block discarded – undo
186 186
 	 * @param	 int		$dp		Number of places of decimal precision to display
187 187
 	 * @return	 string
188 188
 	 */
189
-	public function getSlopeSE($dp=0) {
189
+	public function getSlopeSE($dp = 0) {
190 190
 		if ($dp != 0) {
191
-			return round($this->_slopeSE,$dp);
191
+			return round($this->_slopeSE, $dp);
192 192
 		}
193 193
 		return $this->_slopeSE;
194 194
 	}	//	function getSlopeSE()
@@ -200,9 +200,9 @@  discard block
 block discarded – undo
200 200
 	 * @param	 int		$dp		Number of places of decimal precision to display
201 201
 	 * @return	 string
202 202
 	 */
203
-	public function getIntersect($dp=0) {
203
+	public function getIntersect($dp = 0) {
204 204
 		if ($dp != 0) {
205
-			return round($this->_intersect,$dp);
205
+			return round($this->_intersect, $dp);
206 206
 		}
207 207
 		return $this->_intersect;
208 208
 	}	//	function getIntersect()
@@ -214,9 +214,9 @@  discard block
 block discarded – undo
214 214
 	 * @param	 int		$dp		Number of places of decimal precision to display
215 215
 	 * @return	 string
216 216
 	 */
217
-	public function getIntersectSE($dp=0) {
217
+	public function getIntersectSE($dp = 0) {
218 218
 		if ($dp != 0) {
219
-			return round($this->_intersectSE,$dp);
219
+			return round($this->_intersectSE, $dp);
220 220
 		}
221 221
 		return $this->_intersectSE;
222 222
 	}	//	function getIntersectSE()
@@ -228,17 +228,17 @@  discard block
 block discarded – undo
228 228
 	 * @param	 int		$dp		Number of places of decimal precision to return
229 229
 	 * @return	 float
230 230
 	 */
231
-	public function getGoodnessOfFit($dp=0) {
231
+	public function getGoodnessOfFit($dp = 0) {
232 232
 		if ($dp != 0) {
233
-			return round($this->_goodnessOfFit,$dp);
233
+			return round($this->_goodnessOfFit, $dp);
234 234
 		}
235 235
 		return $this->_goodnessOfFit;
236 236
 	}	//	function getGoodnessOfFit()
237 237
 
238 238
 
239
-	public function getGoodnessOfFitPercent($dp=0) {
239
+	public function getGoodnessOfFitPercent($dp = 0) {
240 240
 		if ($dp != 0) {
241
-			return round($this->_goodnessOfFit * 100,$dp);
241
+			return round($this->_goodnessOfFit * 100, $dp);
242 242
 		}
243 243
 		return $this->_goodnessOfFit * 100;
244 244
 	}	//	function getGoodnessOfFitPercent()
@@ -250,57 +250,57 @@  discard block
 block discarded – undo
250 250
 	 * @param	 int		$dp		Number of places of decimal precision to return
251 251
 	 * @return	 float
252 252
 	 */
253
-	public function getStdevOfResiduals($dp=0) {
253
+	public function getStdevOfResiduals($dp = 0) {
254 254
 		if ($dp != 0) {
255
-			return round($this->_stdevOfResiduals,$dp);
255
+			return round($this->_stdevOfResiduals, $dp);
256 256
 		}
257 257
 		return $this->_stdevOfResiduals;
258 258
 	}	//	function getStdevOfResiduals()
259 259
 
260 260
 
261
-	public function getSSRegression($dp=0) {
261
+	public function getSSRegression($dp = 0) {
262 262
 		if ($dp != 0) {
263
-			return round($this->_SSRegression,$dp);
263
+			return round($this->_SSRegression, $dp);
264 264
 		}
265 265
 		return $this->_SSRegression;
266 266
 	}	//	function getSSRegression()
267 267
 
268 268
 
269
-	public function getSSResiduals($dp=0) {
269
+	public function getSSResiduals($dp = 0) {
270 270
 		if ($dp != 0) {
271
-			return round($this->_SSResiduals,$dp);
271
+			return round($this->_SSResiduals, $dp);
272 272
 		}
273 273
 		return $this->_SSResiduals;
274 274
 	}	//	function getSSResiduals()
275 275
 
276 276
 
277
-	public function getDFResiduals($dp=0) {
277
+	public function getDFResiduals($dp = 0) {
278 278
 		if ($dp != 0) {
279
-			return round($this->_DFResiduals,$dp);
279
+			return round($this->_DFResiduals, $dp);
280 280
 		}
281 281
 		return $this->_DFResiduals;
282 282
 	}	//	function getDFResiduals()
283 283
 
284 284
 
285
-	public function getF($dp=0) {
285
+	public function getF($dp = 0) {
286 286
 		if ($dp != 0) {
287
-			return round($this->_F,$dp);
287
+			return round($this->_F, $dp);
288 288
 		}
289 289
 		return $this->_F;
290 290
 	}	//	function getF()
291 291
 
292 292
 
293
-	public function getCovariance($dp=0) {
293
+	public function getCovariance($dp = 0) {
294 294
 		if ($dp != 0) {
295
-			return round($this->_covariance,$dp);
295
+			return round($this->_covariance, $dp);
296 296
 		}
297 297
 		return $this->_covariance;
298 298
 	}	//	function getCovariance()
299 299
 
300 300
 
301
-	public function getCorrelation($dp=0) {
301
+	public function getCorrelation($dp = 0) {
302 302
 		if ($dp != 0) {
303
-			return round($this->_correlation,$dp);
303
+			return round($this->_correlation, $dp);
304 304
 		}
305 305
 		return $this->_correlation;
306 306
 	}	//	function getCorrelation()
@@ -311,9 +311,9 @@  discard block
 block discarded – undo
311 311
 	}	//	function getYBestFitValues()
312 312
 
313 313
 
314
-	protected function _calculateGoodnessOfFit($sumX,$sumY,$sumX2,$sumY2,$sumXY,$meanX,$meanY, $const) {
314
+	protected function _calculateGoodnessOfFit($sumX, $sumY, $sumX2, $sumY2, $sumXY, $meanX, $meanY, $const) {
315 315
 		$SSres = $SScov = $SScor = $SStot = $SSsex = 0.0;
316
-		foreach($this->_xValues as $xKey => $xValue) {
316
+		foreach ($this->_xValues as $xKey => $xValue) {
317 317
 			$bestFitY = $this->_yBestFitValues[$xKey] = $this->getValueOfYForX($xValue);
318 318
 
319 319
 			$SSres += ($this->_yValues[$xKey] - $bestFitY) * ($this->_yValues[$xKey] - $bestFitY);
@@ -346,7 +346,7 @@  discard block
 block discarded – undo
346 346
 
347 347
 		$this->_SSRegression = $this->_goodnessOfFit * $SStot;
348 348
 		$this->_covariance = $SScov / $this->_valueCount;
349
-		$this->_correlation = ($this->_valueCount * $sumXY - $sumX * $sumY) / sqrt(($this->_valueCount * $sumX2 - pow($sumX,2)) * ($this->_valueCount * $sumY2 - pow($sumY,2)));
349
+		$this->_correlation = ($this->_valueCount * $sumXY - $sumX * $sumY) / sqrt(($this->_valueCount * $sumX2 - pow($sumX, 2)) * ($this->_valueCount * $sumY2 - pow($sumY, 2)));
350 350
 		$this->_slopeSE = $this->_stdevOfResiduals / sqrt($SSsex);
351 351
 		$this->_intersectSE = $this->_stdevOfResiduals * sqrt(1 / ($this->_valueCount - ($sumX * $sumX) / $sumX2));
352 352
 		if ($this->_SSResiduals != 0.0) {
@@ -372,7 +372,7 @@  discard block
 block discarded – undo
372 372
 		$meanX = $x_sum / $this->_valueCount;
373 373
 		$meanY = $y_sum / $this->_valueCount;
374 374
 		$mBase = $mDivisor = $xx_sum = $xy_sum = $yy_sum = 0.0;
375
-		for($i = 0; $i < $this->_valueCount; ++$i) {
375
+		for ($i = 0; $i < $this->_valueCount; ++$i) {
376 376
 			$xy_sum += $xValues[$i] * $yValues[$i];
377 377
 			$xx_sum += $xValues[$i] * $xValues[$i];
378 378
 			$yy_sum += $yValues[$i] * $yValues[$i];
@@ -398,7 +398,7 @@  discard block
 block discarded – undo
398 398
 			$this->_intersect = 0;
399 399
 		}
400 400
 
401
-		$this->_calculateGoodnessOfFit($x_sum,$y_sum,$xx_sum,$yy_sum,$xy_sum,$meanX,$meanY,$const);
401
+		$this->_calculateGoodnessOfFit($x_sum, $y_sum, $xx_sum, $yy_sum, $xy_sum, $meanX, $meanY, $const);
402 402
 	}	//	function _leastSquareFit()
403 403
 
404 404
 
@@ -409,14 +409,14 @@  discard block
 block discarded – undo
409 409
 	 * @param	float[]		$xValues	The set of X-values for this regression
410 410
 	 * @param	boolean		$const
411 411
 	 */
412
-	function __construct($yValues, $xValues=array(), $const=True) {
412
+	function __construct($yValues, $xValues = array(), $const = True) {
413 413
 		//	Calculate number of points
414 414
 		$nY = count($yValues);
415 415
 		$nX = count($xValues);
416 416
 
417 417
 		//	Define X Values if necessary
418 418
 		if ($nX == 0) {
419
-			$xValues = range(1,$nY);
419
+			$xValues = range(1, $nY);
420 420
 			$nX = $nY;
421 421
 		} elseif ($nY != $nX) {
422 422
 			//	Ensure both arrays of points are the same size
Please login to merge, or discard this patch.
app/Vendor/PHPExcel/PHPExcel/Shared/trend/exponentialBestFitClass.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 	 * Return the Slope of the line
88 88
 	 *
89 89
 	 * @param	 int		$dp		Number of places of decimal precision to display
90
-	 * @return	 string
90
+	 * @return	 double
91 91
 	 **/
92 92
 	public function getSlope($dp=0) {
93 93
 		if ($dp != 0) {
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 	 * Return the Value of X where it intersects Y = 0
102 102
 	 *
103 103
 	 * @param	 int		$dp		Number of places of decimal precision to display
104
-	 * @return	 string
104
+	 * @return	 double
105 105
 	 **/
106 106
 	public function getIntersect($dp=0) {
107 107
 		if ($dp != 0) {
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
  */
27 27
 
28 28
 
29
-require_once(PHPEXCEL_ROOT . 'PHPExcel/Shared/trend/bestFitClass.php');
29
+require_once(PHPEXCEL_ROOT.'PHPExcel/Shared/trend/bestFitClass.php');
30 30
 
31 31
 
32 32
 /**
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 	 *
45 45
 	 * @var	string
46 46
 	 **/
47
-	protected $_bestFitType		= 'exponential';
47
+	protected $_bestFitType = 'exponential';
48 48
 
49 49
 
50 50
 	/**
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 	 * @return	 float						Y-Value
55 55
 	 **/
56 56
 	public function getValueOfYForX($xValue) {
57
-		return $this->getIntersect() * pow($this->getSlope(),($xValue - $this->_Xoffset));
57
+		return $this->getIntersect() * pow($this->getSlope(), ($xValue - $this->_Xoffset));
58 58
 	}	//	function getValueOfYForX()
59 59
 
60 60
 
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 	 * @param	 int		$dp		Number of places of decimal precision to display
76 76
 	 * @return	 string
77 77
 	 **/
78
-	public function getEquation($dp=0) {
78
+	public function getEquation($dp = 0) {
79 79
 		$slope = $this->getSlope($dp);
80 80
 		$intersect = $this->getIntersect($dp);
81 81
 
@@ -89,9 +89,9 @@  discard block
 block discarded – undo
89 89
 	 * @param	 int		$dp		Number of places of decimal precision to display
90 90
 	 * @return	 string
91 91
 	 **/
92
-	public function getSlope($dp=0) {
92
+	public function getSlope($dp = 0) {
93 93
 		if ($dp != 0) {
94
-			return round(exp($this->_slope),$dp);
94
+			return round(exp($this->_slope), $dp);
95 95
 		}
96 96
 		return exp($this->_slope);
97 97
 	}	//	function getSlope()
@@ -103,9 +103,9 @@  discard block
 block discarded – undo
103 103
 	 * @param	 int		$dp		Number of places of decimal precision to display
104 104
 	 * @return	 string
105 105
 	 **/
106
-	public function getIntersect($dp=0) {
106
+	public function getIntersect($dp = 0) {
107 107
 		if ($dp != 0) {
108
-			return round(exp($this->_intersect),$dp);
108
+			return round(exp($this->_intersect), $dp);
109 109
 		}
110 110
 		return exp($this->_intersect);
111 111
 	}	//	function getIntersect()
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 	 * @param	 boolean	$const
120 120
 	 */
121 121
 	private function _exponential_regression($yValues, $xValues, $const) {
122
-		foreach($yValues as &$value) {
122
+		foreach ($yValues as &$value) {
123 123
 			if ($value < 0.0) {
124 124
 				$value = 0 - log(abs($value));
125 125
 			} elseif ($value > 0.0) {
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
 	 * @param	float[]		$xValues	The set of X-values for this regression
140 140
 	 * @param	boolean		$const
141 141
 	 */
142
-	function __construct($yValues, $xValues=array(), $const=True) {
142
+	function __construct($yValues, $xValues = array(), $const = True) {
143 143
 		if (parent::__construct($yValues, $xValues) !== False) {
144 144
 			$this->_exponential_regression($yValues, $xValues, $const);
145 145
 		}
Please login to merge, or discard this patch.
app/Vendor/PHPExcel/PHPExcel/Shared/trend/powerBestFitClass.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -87,7 +87,7 @@
 block discarded – undo
87 87
 	 * Return the Value of X where it intersects Y = 0
88 88
 	 *
89 89
 	 * @param	 int		$dp		Number of places of decimal precision to display
90
-	 * @return	 string
90
+	 * @return	 double
91 91
 	 **/
92 92
 	public function getIntersect($dp=0) {
93 93
 		if ($dp != 0) {
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
  */
27 27
 
28 28
 
29
-require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/trend/bestFitClass.php';
29
+require_once PHPEXCEL_ROOT.'PHPExcel/Shared/trend/bestFitClass.php';
30 30
 
31 31
 
32 32
 /**
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 	 *
45 45
 	 * @var	string
46 46
 	 **/
47
-	protected $_bestFitType		= 'power';
47
+	protected $_bestFitType = 'power';
48 48
 
49 49
 
50 50
 	/**
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 	 * @return	 float						Y-Value
55 55
 	 **/
56 56
 	public function getValueOfYForX($xValue) {
57
-		return $this->getIntersect() * pow(($xValue - $this->_Xoffset),$this->getSlope());
57
+		return $this->getIntersect() * pow(($xValue - $this->_Xoffset), $this->getSlope());
58 58
 	}	//	function getValueOfYForX()
59 59
 
60 60
 
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 	 * @return	 float						X-Value
66 66
 	 **/
67 67
 	public function getValueOfXForY($yValue) {
68
-		return pow((($yValue + $this->_Yoffset) / $this->getIntersect()),(1 / $this->getSlope()));
68
+		return pow((($yValue + $this->_Yoffset) / $this->getIntersect()), (1 / $this->getSlope()));
69 69
 	}	//	function getValueOfXForY()
70 70
 
71 71
 
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 	 * @param	 int		$dp		Number of places of decimal precision to display
76 76
 	 * @return	 string
77 77
 	 **/
78
-	public function getEquation($dp=0) {
78
+	public function getEquation($dp = 0) {
79 79
 		$slope = $this->getSlope($dp);
80 80
 		$intersect = $this->getIntersect($dp);
81 81
 
@@ -89,9 +89,9 @@  discard block
 block discarded – undo
89 89
 	 * @param	 int		$dp		Number of places of decimal precision to display
90 90
 	 * @return	 string
91 91
 	 **/
92
-	public function getIntersect($dp=0) {
92
+	public function getIntersect($dp = 0) {
93 93
 		if ($dp != 0) {
94
-			return round(exp($this->_intersect),$dp);
94
+			return round(exp($this->_intersect), $dp);
95 95
 		}
96 96
 		return exp($this->_intersect);
97 97
 	}	//	function getIntersect()
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 	 * @param	 boolean	$const
106 106
 	 */
107 107
 	private function _power_regression($yValues, $xValues, $const) {
108
-		foreach($xValues as &$value) {
108
+		foreach ($xValues as &$value) {
109 109
 			if ($value < 0.0) {
110 110
 				$value = 0 - log(abs($value));
111 111
 			} elseif ($value > 0.0) {
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 			}
114 114
 		}
115 115
 		unset($value);
116
-		foreach($yValues as &$value) {
116
+		foreach ($yValues as &$value) {
117 117
 			if ($value < 0.0) {
118 118
 				$value = 0 - log(abs($value));
119 119
 			} elseif ($value > 0.0) {
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 	 * @param	 float[]	$xValues	The set of X-values for this regression
134 134
 	 * @param	 boolean	$const
135 135
 	 */
136
-	function __construct($yValues, $xValues=array(), $const=True) {
136
+	function __construct($yValues, $xValues = array(), $const = True) {
137 137
 		if (parent::__construct($yValues, $xValues) !== False) {
138 138
 			$this->_power_regression($yValues, $xValues, $const);
139 139
 		}
Please login to merge, or discard this patch.