Duplicator – WordPress Migration Plugin - Version 1.3.10

Version Description

Download this release

Release Info

Developer cory@lamle.org
Plugin Icon 128x128 Duplicator – WordPress Migration Plugin
Version 1.3.10
Comparing to
See all releases

Code changes from version 1.3.8 to 1.3.10

Files changed (48) hide show
  1. classes/class.archive.config.php +2 -0
  2. classes/class.db.php +14 -1
  3. classes/class.settings.php +3 -0
  4. classes/package/class.pack.archive.php +132 -126
  5. classes/package/class.pack.database.php +111 -8
  6. classes/package/class.pack.installer.php +21 -19
  7. classes/package/class.pack.php +1 -5
  8. classes/utilities/class.u.json.php +69 -43
  9. classes/utilities/class.u.php +82 -21
  10. define.php +4 -3
  11. duplicator.php +8 -1
  12. installer/dup-installer/assets/inc.css.php +134 -7
  13. installer/dup-installer/assets/inc.js.php +1 -1
  14. installer/dup-installer/classes/Crypt/Base.php +2660 -0
  15. installer/dup-installer/classes/Crypt/Random.php +338 -0
  16. installer/dup-installer/classes/Crypt/Rijndael.php +1050 -0
  17. installer/dup-installer/classes/class.csrf.php +1 -0
  18. installer/dup-installer/classes/class.engine.php +33 -4
  19. installer/dup-installer/classes/class.logging.php +0 -1
  20. installer/dup-installer/classes/config/class.constants.php +16 -5
  21. installer/dup-installer/classes/config/class.wp.config.tranformer.php +48 -2
  22. installer/dup-installer/classes/utilities/class.u.exceptions.php +86 -0
  23. installer/dup-installer/classes/utilities/class.u.notices.manager.php +921 -0
  24. installer/dup-installer/classes/utilities/class.u.php +8 -6
  25. installer/dup-installer/ctrls/ctrl.s1.php +22 -13
  26. installer/dup-installer/ctrls/ctrl.s2.base.php +11 -10
  27. installer/dup-installer/ctrls/ctrl.s2.dbinstall.php +71 -46
  28. installer/dup-installer/ctrls/ctrl.s3.php +210 -124
  29. installer/dup-installer/main.installer.php +89 -7
  30. installer/dup-installer/views/duplicator.php +1392 -0
  31. installer/dup-installer/views/view.exception.php +15 -1
  32. installer/dup-installer/views/view.help.php +639 -570
  33. installer/dup-installer/views/view.s1.base.php +30 -21
  34. installer/dup-installer/views/view.s2.base.php +4 -1
  35. installer/dup-installer/views/view.s3.php +2 -1
  36. installer/dup-installer/views/view.s4.php +213 -125
  37. installer/installer.tpl +4066 -2
  38. languages/duplicator.pot +3362 -0
  39. lib/snaplib/class.snaplib.exceptions.php +4 -0
  40. lib/snaplib/class.snaplib.u.util.php +113 -1
  41. lib/snaplib/class.snaplib.u.wp.php +134 -0
  42. lib/snaplib/snaplib.all.php +3 -1
  43. lib/snaplib/wordpress.core.files.php +1765 -0
  44. readme.txt +1 -1
  45. views/packages/main/s1.setup2.php +1 -2
  46. views/packages/main/s2.scan3.php +50 -23
  47. views/packages/main/s3.build.php +17 -7
  48. views/settings/general.php +21 -9
classes/class.archive.config.php CHANGED
@@ -42,4 +42,6 @@ class DUP_Archive_Config
42
 
43
  public $is_outer_root_wp_config_file;
44
  public $is_outer_root_wp_content_dir;
 
 
45
  }
42
 
43
  public $is_outer_root_wp_config_file;
44
  public $is_outer_root_wp_content_dir;
45
+
46
+ public $csrf_crypt;
47
  }
classes/class.db.php CHANGED
@@ -98,7 +98,20 @@ class DUP_DB extends wpdb
98
  return false;
99
  }
100
 
101
- /**
 
 
 
 
 
 
 
 
 
 
 
 
 
102
  * Returns the mysqldump path if the server is enabled to execute it otherwise false
103
  *
104
  * @return boolean|string
98
  return false;
99
  }
100
 
101
+ /**
102
+ * Returns the correct database build mode PHP, MYSQLDUMP, PHPCHUNKING
103
+ *
104
+ * @return string Returns a string with one of theses three values PHP, MYSQLDUMP, PHPCHUNKING
105
+ */
106
+ public static function getBuildMode()
107
+ {
108
+ $package_mysqldump = DUP_Settings::Get('package_mysqldump');
109
+ $mysqlDumpPath = DUP_DB::getMySqlDumpPath();
110
+
111
+ return ($mysqlDumpPath && $package_mysqldump) ? 'MYSQLDUMP' : 'PHP';
112
+ }
113
+
114
+ /**
115
  * Returns the mysqldump path if the server is enabled to execute it otherwise false
116
  *
117
  * @return boolean|string
classes/class.settings.php CHANGED
@@ -131,6 +131,9 @@ class DUP_Settings
131
  // Initial archive build mode
132
  $default['archive_build_mode'] = isset(self::$Data['archive_build_mode']) ? self::$Data['archive_build_mode'] : DUP_Archive_Build_Mode::ZipArchive;
133
 
 
 
 
134
  $default['active_package_id'] = -1;
135
 
136
  return $default;
131
  // Initial archive build mode
132
  $default['archive_build_mode'] = isset(self::$Data['archive_build_mode']) ? self::$Data['archive_build_mode'] : DUP_Archive_Build_Mode::ZipArchive;
133
 
134
+ //Skip scan archive
135
+ $default['skip_archive_scan'] = isset(self::$Data['skip_archive_scan']) ? self::$Data['skip_archive_scan'] : false;
136
+
137
  $default['active_package_id'] = -1;
138
 
139
  return $default;
classes/package/class.pack.archive.php CHANGED
@@ -379,146 +379,152 @@ class DUP_Archive
379
  }
380
 
381
  /**
382
- * Get All Directories then filter
383
- *
384
- * @return null
385
- */
386
- private function setDirFilters()
387
- {
388
- $this->FilterInfo->Dirs->Warning = array();
389
- $this->FilterInfo->Dirs->Unreadable = array();
390
- $this->FilterInfo->Dirs->AddonSites = array();
391
-
392
- $utf8_key_list = array();
393
- $unset_key_list = array();
394
-
395
- //Filter directories invalid test checks for:
396
- // - characters over 250
397
- // - invlaid characters
398
- // - empty string
399
- // - directories ending with period (Windows incompatable)
400
- foreach ($this->Dirs as $key => $val) {
401
- $name = basename($val);
402
-
403
- //Dir is not readble remove flag for removal
404
- if (!is_readable($this->Dirs[$key])) {
405
- $unset_key_list[] = $key;
406
- $this->FilterInfo->Dirs->Unreadable[] = DUP_Encoding::toUTF8($val);
407
- }
408
-
409
- //Locate invalid directories and warn
410
- $invalid_test = strlen($val) > 244 || preg_match('/(\/|\*|\?|\>|\<|\:|\\|\|)/', $name) || trim($name) == '' || (strrpos($name, '.') == strlen($name) - 1 && substr($name, -1) == '.') || preg_match('/[^\x20-\x7f]/',
411
- $name);
412
 
413
- if ($invalid_test) {
414
- $utf8_key_list[] = $key;
415
- $this->FilterInfo->Dirs->Warning[] = DUP_Encoding::toUTF8($val);
416
- }
417
 
418
- //Check for other WordPress installs
419
- if ($name === 'wp-admin') {
420
- $parent_dir = realpath(dirname($this->Dirs[$key]));
421
- if ($parent_dir != realpath(DUPLICATOR_WPROOTPATH)) {
422
- if (file_exists("$parent_dir/wp-includes")) {
423
- if (file_exists("$parent_dir/wp-config.php")) {
424
- // Ensure we aren't adding any critical directories
425
- $parent_name = basename($parent_dir);
426
- if (($parent_name != 'wp-includes') && ($parent_name != 'wp-content') && ($parent_name != 'wp-admin')) {
427
- $this->FilterInfo->Dirs->AddonSites[] = str_replace("\\", '/', $parent_dir);
428
- }
429
- }
430
- }
431
- }
432
- }
433
- }
434
 
435
- //Try to repair utf8 paths
436
- foreach ($utf8_key_list as $key) {
437
- $this->Dirs[$key] = DUP_Encoding::toUTF8($this->Dirs[$key]);
438
- }
 
 
 
 
 
 
 
 
 
 
 
 
439
 
440
- //Remove unreadable items outside of main loop for performance
441
- if (count($unset_key_list)) {
442
- foreach ($unset_key_list as $key) {
443
- unset($this->Dirs[$key]);
444
- }
445
- $this->Dirs = array_values($this->Dirs);
446
- }
447
- }
448
 
449
- /**
450
- * Get all files and filter out error prone subsets
451
- *
452
- * @return null
453
- */
454
- private function setFileFilters()
455
- {
456
- //Init for each call to prevent concatination from stored entity objects
457
- $this->Size = 0;
458
- $this->FilterInfo->Files->Size = array();
459
- $this->FilterInfo->Files->Warning = array();
460
- $this->FilterInfo->Files->Unreadable = array();
461
-
462
- $utf8_key_list = array();
463
- $unset_key_list = array();
464
-
465
- $wpconfig_filepath = $this->getWPConfigFilePath();
466
- if (!is_readable($wpconfig_filepath)) {
467
- $this->FilterInfo->Files->Unreadable[] = $wpconfig_filepath;
468
- }
469
 
470
- foreach ($this->Files as $key => $filePath) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
471
 
472
- $fileName = basename($filePath);
473
 
474
- if (!is_readable($filePath)) {
475
- $unset_key_list[] = $key;
476
- $this->FilterInfo->Files->Unreadable[] = $filePath;
477
- continue;
478
- }
479
 
480
- $invalid_test = strlen($filePath) > 250 || preg_match('/(\/|\*|\?|\>|\<|\:|\\|\|)/', $fileName) || trim($fileName) == "" || preg_match('/[^\x20-\x7f]/', $fileName);
 
 
 
 
481
 
482
- if ($invalid_test) {
483
- $utf8_key_list[] = $key;
484
- $filePath = DUP_Encoding::toUTF8($filePath);
485
- $fileName = basename($filePath);
486
- $this->FilterInfo->Files->Warning[] = array(
487
- 'name' => $fileName,
488
- 'dir' => pathinfo($filePath, PATHINFO_DIRNAME),
489
- 'path' => $filePath);
490
- }
 
 
 
 
 
 
 
491
 
492
- $fileSize = @filesize($filePath);
493
- $fileSize = empty($fileSize) ? 0 : $fileSize;
494
- $this->Size += $fileSize;
495
-
496
- if ($fileSize > DUPLICATOR_SCAN_WARNFILESIZE) {
497
- //$ext = pathinfo($filePath, PATHINFO_EXTENSION);
498
- $this->FilterInfo->Files->Size[] = array(
499
- 'ubytes' => $fileSize,
500
- 'bytes' => DUP_Util::byteSize($fileSize, 0),
501
- 'name' => $fileName,
502
- 'dir' => pathinfo($filePath, PATHINFO_DIRNAME),
503
- 'path' => $filePath);
504
- }
505
- }
506
 
507
- //Try to repair utf8 paths
508
- foreach ($utf8_key_list as $key) {
509
- $this->Files[$key] = DUP_Encoding::toUTF8($this->Files[$key]);
510
- }
511
 
512
- //Remove unreadable items outside of main loop for performance
513
- if (count($unset_key_list)) {
514
- foreach ($unset_key_list as $key) {
515
- unset($this->Files[$key]);
516
- }
517
- $this->Files = array_values($this->Files);
518
- }
519
- }
520
 
521
- /**
522
  * Recursive function to get all directories in a wp install
523
  *
524
  * @notes:
379
  }
380
 
381
  /**
382
+ * Get All Directories then filter
383
+ *
384
+ * @return null
385
+ */
386
+ private function setDirFilters()
387
+ {
388
+ $this->FilterInfo->Dirs->Warning = array();
389
+ $this->FilterInfo->Dirs->Unreadable = array();
390
+ $this->FilterInfo->Dirs->AddonSites = array();
391
+ $skip_archive_scan = DUP_Settings::Get('skip_archive_scan');
392
+
393
+ $utf8_key_list = array();
394
+ $unset_key_list = array();
395
+
396
+ //Filter directories invalid test checks for:
397
+ // - characters over 250
398
+ // - invlaid characters
399
+ // - empty string
400
+ // - directories ending with period (Windows incompatable)
401
+ foreach ($this->Dirs as $key => $val) {
402
+ $name = basename($val);
403
+
404
+ //Dir is not readble remove flag for removal
405
+ if (!is_readable($this->Dirs[$key])) {
406
+ $unset_key_list[] = $key;
407
+ $this->FilterInfo->Dirs->Unreadable[] = DUP_Encoding::toUTF8($val);
408
+ }
 
 
 
409
 
410
+ if (!$skip_archive_scan) {
411
+ //Locate invalid directories and warn
412
+ $invalid_test = strlen($val) > PHP_MAXPATHLEN || preg_match('/(\/|\*|\?|\>|\<|\:|\\|\|)/', $name) || trim($name) == '' || (strrpos($name, '.') == strlen($name) - 1 && substr($name, -1)
413
+ == '.') || preg_match('/[^\x20-\x7f]/', $name);
414
 
415
+ if ($invalid_test) {
416
+ $utf8_key_list[] = $key;
417
+ $this->FilterInfo->Dirs->Warning[] = DUP_Encoding::toUTF8($val);
418
+ }
419
+ }
 
 
 
 
 
 
 
 
 
 
 
420
 
421
+ //Check for other WordPress installs
422
+ if ($name === 'wp-admin') {
423
+ $parent_dir = realpath(dirname($this->Dirs[$key]));
424
+ if ($parent_dir != realpath(DUPLICATOR_WPROOTPATH)) {
425
+ if (file_exists("$parent_dir/wp-includes")) {
426
+ if (file_exists("$parent_dir/wp-config.php")) {
427
+ // Ensure we aren't adding any critical directories
428
+ $parent_name = basename($parent_dir);
429
+ if (($parent_name != 'wp-includes') && ($parent_name != 'wp-content') && ($parent_name != 'wp-admin')) {
430
+ $this->FilterInfo->Dirs->AddonSites[] = str_replace("\\", '/', $parent_dir);
431
+ }
432
+ }
433
+ }
434
+ }
435
+ }
436
+ }
437
 
438
+ //Try to repair utf8 paths
439
+ foreach ($utf8_key_list as $key) {
440
+ $this->Dirs[$key] = DUP_Encoding::toUTF8($this->Dirs[$key]);
441
+ }
 
 
 
 
442
 
443
+ //Remove unreadable items outside of main loop for performance
444
+ if (count($unset_key_list)) {
445
+ foreach ($unset_key_list as $key) {
446
+ unset($this->Dirs[$key]);
447
+ }
448
+ $this->Dirs = array_values($this->Dirs);
449
+ }
450
+ }
 
 
 
 
 
 
 
 
 
 
 
 
451
 
452
+ /**
453
+ * Get all files and filter out error prone subsets
454
+ *
455
+ * @return null
456
+ */
457
+ private function setFileFilters()
458
+ {
459
+ //Init for each call to prevent concatination from stored entity objects
460
+ $this->Size = 0;
461
+ $this->FilterInfo->Files->Size = array();
462
+ $this->FilterInfo->Files->Warning = array();
463
+ $this->FilterInfo->Files->Unreadable = array();
464
+ $skip_archive_scan = DUP_Settings::Get('skip_archive_scan');
465
+
466
+ $utf8_key_list = array();
467
+ $unset_key_list = array();
468
+
469
+ $wpconfig_filepath = $this->getWPConfigFilePath();
470
+ if (!is_readable($wpconfig_filepath)) {
471
+ $this->FilterInfo->Files->Unreadable[] = $wpconfig_filepath;
472
+ }
473
 
474
+ foreach ($this->Files as $key => $filePath) {
475
 
476
+ $fileName = basename($filePath);
 
 
 
 
477
 
478
+ if (!is_readable($filePath)) {
479
+ $unset_key_list[] = $key;
480
+ $this->FilterInfo->Files->Unreadable[] = $filePath;
481
+ continue;
482
+ }
483
 
484
+ $fileSize = @filesize($filePath);
485
+ $fileSize = empty($fileSize) ? 0 : $fileSize;
486
+ $this->Size += $fileSize;
487
+
488
+ if (!$skip_archive_scan) {
489
+ $invalid_test = strlen($filePath) > PHP_MAXPATHLEN || preg_match('/(\/|\*|\?|\>|\<|\:|\\|\|)/', $fileName) || trim($fileName) == "" || preg_match('/[^\x20-\x7f]/', $fileName);
490
+
491
+ if ($invalid_test) {
492
+ $utf8_key_list[] = $key;
493
+ $filePath = DUP_Encoding::toUTF8($filePath);
494
+ $fileName = basename($filePath);
495
+ $this->FilterInfo->Files->Warning[] = array(
496
+ 'name' => $fileName,
497
+ 'dir' => pathinfo($filePath, PATHINFO_DIRNAME),
498
+ 'path' => $filePath);
499
+ }
500
 
501
+ if ($fileSize > DUPLICATOR_SCAN_WARNFILESIZE) {
502
+ //$ext = pathinfo($filePath, PATHINFO_EXTENSION);
503
+ $this->FilterInfo->Files->Size[] = array(
504
+ 'ubytes' => $fileSize,
505
+ 'bytes' => DUP_Util::byteSize($fileSize, 0),
506
+ 'name' => $fileName,
507
+ 'dir' => pathinfo($filePath, PATHINFO_DIRNAME),
508
+ 'path' => $filePath);
509
+ }
510
+ }
511
+ }
 
 
 
512
 
513
+ //Try to repair utf8 paths
514
+ foreach ($utf8_key_list as $key) {
515
+ $this->Files[$key] = DUP_Encoding::toUTF8($this->Files[$key]);
516
+ }
517
 
518
+ //Remove unreadable items outside of main loop for performance
519
+ if (count($unset_key_list)) {
520
+ foreach ($unset_key_list as $key) {
521
+ unset($this->Files[$key]);
522
+ }
523
+ $this->Files = array_values($this->Files);
524
+ }
525
+ }
526
 
527
+ /**
528
  * Recursive function to get all directories in a wp install
529
  *
530
  * @notes:
classes/package/class.pack.database.php CHANGED
@@ -11,11 +11,21 @@ if (! defined('DUPLICATOR_VERSION')) exit;
11
  */
12
  class DUP_DatabaseInfo
13
  {
 
 
 
 
 
14
  /**
15
  * A unique list of all the collation table types used in the database
16
  */
17
  public $collationList;
18
 
 
 
 
 
 
19
  /**
20
  * Does the database name have any filtered characters in it
21
  */
@@ -26,10 +36,69 @@ class DUP_DatabaseInfo
26
  */
27
  public $name;
28
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
29
  //CONSTRUCTOR
30
  function __construct()
31
  {
32
  $this->collationList = array();
 
33
  }
34
  }
35
 
@@ -45,6 +114,12 @@ class DUP_Database
45
  public $Name;
46
  public $Compatible;
47
  public $Comments;
 
 
 
 
 
 
48
  //PROTECTED
49
  protected $Package;
50
  //PRIVATE
@@ -62,6 +137,7 @@ class DUP_Database
62
  $package_zip_flush = DUP_Settings::Get('package_zip_flush');
63
  $this->networkFlush = empty($package_zip_flush) ? false : $package_zip_flush;
64
  $this->info = new DUP_DatabaseInfo();
 
65
  }
66
 
67
  /**
@@ -86,7 +162,7 @@ class DUP_Database
86
  $package_phpdump_qrylimit = DUP_Settings::Get('package_phpdump_qrylimit');
87
 
88
  $mysqlDumpPath = DUP_DB::getMySqlDumpPath();
89
- $mode = ($mysqlDumpPath && $package_mysqldump) ? 'MYSQLDUMP' : 'PHP';
90
  $reserved_db_filepath = DUPLICATOR_WPROOTPATH.'database.sql';
91
 
92
  $log = "\n********************************************************************************\n";
@@ -148,7 +224,7 @@ class DUP_Database
148
  DUP_Log::Info("SQL RUNTIME: {$time_sum}");
149
 
150
  $this->Size = @filesize($this->dbStorePath);
151
-
152
  $this->Package->setStatus(DUP_PackageStatus::DBDONE);
153
  } catch (Exception $e) {
154
  do_action('duplicator_lite_build_database_fail' , $package);
@@ -165,7 +241,8 @@ class DUP_Database
165
  {
166
  global $wpdb;
167
 
168
- $filterTables = isset($this->FilterTables) ? explode(',', $this->FilterTables) : null;
 
169
  $tblCount = 0;
170
 
171
  $tables = $wpdb->get_results("SHOW TABLE STATUS", ARRAY_A);
@@ -189,6 +266,7 @@ class DUP_Database
189
 
190
  //Grab Table Stats
191
  foreach ($tables as $table) {
 
192
  $name = $table["Name"];
193
  if ($this->FilterOn && is_array($filterTables)) {
194
  if (in_array($name, $filterTables)) {
@@ -233,7 +311,6 @@ class DUP_Database
233
  $info['Status']['DB_Rows'] = ($info['Rows'] > DUPLICATOR_SCAN_DB_ALL_ROWS) ? 'Warn' : 'Good';
234
  $info['Status']['DB_Size'] = ($info['Size'] > DUPLICATOR_SCAN_DB_ALL_SIZE) ? 'Warn' : 'Good';
235
 
236
-
237
  $info['Status']['TBL_Case'] = ($tblCaseFound) ? 'Warn' : 'Good';
238
  $info['Status']['TBL_Rows'] = ($tblRowsFound) ? 'Warn' : 'Good';
239
  $info['Status']['TBL_Size'] = ($tblSizeFound) ? 'Warn' : 'Good';
@@ -244,12 +321,24 @@ class DUP_Database
244
  $info['TableList'] = $info['TableList'] or "unknown";
245
  $info['TableCount'] = $tblCount;
246
 
 
 
 
 
 
 
 
247
  return $info;
248
  }
249
 
250
  public function setInfoObj() {
251
  global $wpdb;
 
252
 
 
 
 
 
253
  $this->info->name = $wpdb->dbname;
254
  $this->info->isNameUpperCase = preg_match('/[A-Z]/', $wpdb->dbname) ? 1 : 0;
255
  $this->info->collationList = DUP_DB::getTableCollationList($filterTables);
@@ -290,7 +379,15 @@ class DUP_Database
290
  }
291
 
292
  //Filter tables
293
- $tables = $wpdb->get_col('SHOW TABLES');
 
 
 
 
 
 
 
 
294
  $filterTables = isset($this->FilterTables) ? explode(',', $this->FilterTables) : null;
295
  $tblAllCount = count($tables);
296
  //$tblFilterOn = ($this->FilterOn) ? 'ON' : 'OFF';
@@ -416,7 +513,13 @@ class DUP_Database
416
  $sql_footer = "\n\n/* Duplicator WordPress Timestamp: ".date("Y-m-d H:i:s")."*/\n";
417
  $sql_footer .= "/* ".DUPLICATOR_DB_EOF_MARKER." */\n";
418
  file_put_contents($this->dbStorePath, $sql_footer, FILE_APPEND);
419
-
 
 
 
 
 
 
420
  return ($output) ? false : true;
421
  }
422
 
@@ -500,6 +603,8 @@ class DUP_Database
500
  }
501
 
502
  $row_count = $wpdb->get_var("SELECT Count(*) FROM `{$table}`");
 
 
503
 
504
  if ($row_count > $qryLimit) {
505
  $row_count = ceil($row_count / $qryLimit);
@@ -511,8 +616,6 @@ class DUP_Database
511
  fwrite($handle, "\n/* INSERT TABLE DATA: {$table} */\n");
512
  }
513
 
514
- $rewrite_table_as = $this->rewriteTableNameAs($table);
515
-
516
  for ($i = 0; $i < $row_count; $i++) {
517
  $sql = "";
518
  $limit = $i * $qryLimit;
11
  */
12
  class DUP_DatabaseInfo
13
  {
14
+ /**
15
+ * The SQL file was built with mysqldump or PHP
16
+ */
17
+ public $buildMode;
18
+
19
  /**
20
  * A unique list of all the collation table types used in the database
21
  */
22
  public $collationList;
23
 
24
+ /**
25
+ * Does any filtered table have an upper case character in it
26
+ */
27
+ public $isTablesUpperCase;
28
+
29
  /**
30
  * Does the database name have any filtered characters in it
31
  */
36
  */
37
  public $name;
38
 
39
+ /**
40
+ * The full count of all tables in the database
41
+ */
42
+ public $tablesBaseCount;
43
+
44
+ /**
45
+ * The count of tables after the tables filter has been applied
46
+ */
47
+ public $tablesFinalCount;
48
+
49
+ /**
50
+ * The number of rows from all filtered tables in the database
51
+ */
52
+ public $tablesRowCount;
53
+
54
+ /**
55
+ * The estimated data size on disk from all filtered tables in the database
56
+ */
57
+ public $tablesSizeOnDisk;
58
+
59
+ /**
60
+ * Gets the server variable lower_case_table_names
61
+ *
62
+ * 0 store=lowercase; compare=sensitive (works only on case sensitive file systems )
63
+ * 1 store=lowercase; compare=insensitive
64
+ * 2 store=exact; compare=insensitive (works only on case INsensitive file systems )
65
+ * default is 0/Linux ; 1/Windows
66
+ */
67
+ public $varLowerCaseTables;
68
+
69
+ /**
70
+ * The simple numeric version number of the database server
71
+ * @exmaple: 5.5
72
+ */
73
+ public $version;
74
+
75
+ /**
76
+ * The full text version number of the database server
77
+ * @exmaple: 10.2 mariadb.org binary distribution
78
+ */
79
+ public $versionComment;
80
+
81
+ /**
82
+ * table wise row counts array, Key as table name and value as row count
83
+ * table name => row count
84
+ */
85
+ public $tableWiseRowCounts;
86
+
87
+ /**
88
+ * Integer field file structure of table, table name as key
89
+ */
90
+ private $intFieldsStruct = array();
91
+
92
+ /**
93
+ * $currentIndex => processedSchemaSize
94
+ */
95
+ private $indexProcessedSchemaSize = array();
96
+
97
  //CONSTRUCTOR
98
  function __construct()
99
  {
100
  $this->collationList = array();
101
+ $this->tableWiseRowCounts = array();
102
  }
103
  }
104
 
114
  public $Name;
115
  public $Compatible;
116
  public $Comments;
117
+
118
+ /**
119
+ *
120
+ * @var DUP_DatabaseInfo
121
+ */
122
+ public $info = null;
123
  //PROTECTED
124
  protected $Package;
125
  //PRIVATE
137
  $package_zip_flush = DUP_Settings::Get('package_zip_flush');
138
  $this->networkFlush = empty($package_zip_flush) ? false : $package_zip_flush;
139
  $this->info = new DUP_DatabaseInfo();
140
+ $this->info->varLowerCaseTables = DUP_Util::isWindows() ? 1 : 0;
141
  }
142
 
143
  /**
162
  $package_phpdump_qrylimit = DUP_Settings::Get('package_phpdump_qrylimit');
163
 
164
  $mysqlDumpPath = DUP_DB::getMySqlDumpPath();
165
+ $mode = DUP_DB::getBuildMode();
166
  $reserved_db_filepath = DUPLICATOR_WPROOTPATH.'database.sql';
167
 
168
  $log = "\n********************************************************************************\n";
224
  DUP_Log::Info("SQL RUNTIME: {$time_sum}");
225
 
226
  $this->Size = @filesize($this->dbStorePath);
227
+
228
  $this->Package->setStatus(DUP_PackageStatus::DBDONE);
229
  } catch (Exception $e) {
230
  do_action('duplicator_lite_build_database_fail' , $package);
241
  {
242
  global $wpdb;
243
 
244
+ $filterTables = isset($this->FilterTables) ? explode(',', $this->FilterTables) : array();
245
+ $tblBaseCount = 0;
246
  $tblCount = 0;
247
 
248
  $tables = $wpdb->get_results("SHOW TABLE STATUS", ARRAY_A);
266
 
267
  //Grab Table Stats
268
  foreach ($tables as $table) {
269
+ $tblBaseCount++;
270
  $name = $table["Name"];
271
  if ($this->FilterOn && is_array($filterTables)) {
272
  if (in_array($name, $filterTables)) {
311
  $info['Status']['DB_Rows'] = ($info['Rows'] > DUPLICATOR_SCAN_DB_ALL_ROWS) ? 'Warn' : 'Good';
312
  $info['Status']['DB_Size'] = ($info['Size'] > DUPLICATOR_SCAN_DB_ALL_SIZE) ? 'Warn' : 'Good';
313
 
 
314
  $info['Status']['TBL_Case'] = ($tblCaseFound) ? 'Warn' : 'Good';
315
  $info['Status']['TBL_Rows'] = ($tblRowsFound) ? 'Warn' : 'Good';
316
  $info['Status']['TBL_Size'] = ($tblSizeFound) ? 'Warn' : 'Good';
321
  $info['TableList'] = $info['TableList'] or "unknown";
322
  $info['TableCount'] = $tblCount;
323
 
324
+ $this->setInfoObj();
325
+ $this->info->isTablesUpperCase = $tblCaseFound;
326
+ $this->info->tablesBaseCount = $tblBaseCount;
327
+ $this->info->tablesFinalCount = $tblCount;
328
+ $this->info->tablesRowCount = $info['Rows'];
329
+ $this->info->tablesSizeOnDisk = $info['Size'];
330
+
331
  return $info;
332
  }
333
 
334
  public function setInfoObj() {
335
  global $wpdb;
336
+ $filterTables = isset($this->FilterTables) ? explode(',', $this->FilterTables) : array();
337
 
338
+ $this->info->buildMode = DUP_DB::getBuildMode();
339
+ $this->info->version = DUP_DB::getVersion();
340
+ $this->info->versionComment = DUP_DB::getVariable('version_comment');
341
+ $this->info->varLowerCaseTables = DUP_DB::getVariable('lower_case_table_names');
342
  $this->info->name = $wpdb->dbname;
343
  $this->info->isNameUpperCase = preg_match('/[A-Z]/', $wpdb->dbname) ? 1 : 0;
344
  $this->info->collationList = DUP_DB::getTableCollationList($filterTables);
379
  }
380
 
381
  //Filter tables
382
+ $res = $wpdb->get_results('SHOW FULL TABLES', ARRAY_N);
383
+ $tables = array();
384
+ $baseTables = array();
385
+ foreach ($res as $row) {
386
+ $tables[] = $row[0];
387
+ if ('BASE TABLE' == $row[1]) {
388
+ $baseTables[] = $row[0];
389
+ }
390
+ }
391
  $filterTables = isset($this->FilterTables) ? explode(',', $this->FilterTables) : null;
392
  $tblAllCount = count($tables);
393
  //$tblFilterOn = ($this->FilterOn) ? 'ON' : 'OFF';
513
  $sql_footer = "\n\n/* Duplicator WordPress Timestamp: ".date("Y-m-d H:i:s")."*/\n";
514
  $sql_footer .= "/* ".DUPLICATOR_DB_EOF_MARKER." */\n";
515
  file_put_contents($this->dbStorePath, $sql_footer, FILE_APPEND);
516
+ foreach ($tables as $table) {
517
+ if (in_array($table, $baseTables)) {
518
+ $row_count = $GLOBALS['wpdb']->get_var("SELECT Count(*) FROM `{$table}`");
519
+ $rewrite_table_as = $this->rewriteTableNameAs($table);
520
+ $this->Package->Database->info->tableWiseRowCounts[$rewrite_table_as] = $row_count;
521
+ }
522
+ }
523
  return ($output) ? false : true;
524
  }
525
 
603
  }
604
 
605
  $row_count = $wpdb->get_var("SELECT Count(*) FROM `{$table}`");
606
+ $rewrite_table_as = $this->rewriteTableNameAs($table);
607
+ $this->Package->Database->info->tableWiseRowCounts[$rewrite_table_as] = $row_count;
608
 
609
  if ($row_count > $qryLimit) {
610
  $row_count = ceil($row_count / $qryLimit);
616
  fwrite($handle, "\n/* INSERT TABLE DATA: {$table} */\n");
617
  }
618
 
 
 
619
  for ($i = 0; $i < $row_count; $i++) {
620
  $sql = "";
621
  $limit = $i * $qryLimit;
classes/package/class.pack.installer.php CHANGED
@@ -93,9 +93,9 @@ class DUP_Installer
93
  $mini_expander_string = '';
94
  }
95
 
96
- $search_array = array('@@ARCHIVE@@', '@@VERSION@@', '@@ARCHIVE_SIZE@@', '@@PACKAGE_HASH@@', '@@DUPARCHIVE_MINI_EXPANDER@@');
97
  $package_hash = $this->Package->getPackageHash();
98
- $replace_array = array($this->Package->Archive->File, DUPLICATOR_VERSION, @filesize($archive_filepath), $package_hash, $mini_expander_string);
99
  $installer_contents = str_replace($search_array, $replace_array, $installer_contents);
100
 
101
  if (@file_put_contents($installer_filepath, $installer_contents) === false) {
@@ -125,6 +125,8 @@ class DUP_Installer
125
  $hasher = new DUP_PasswordHash(8, FALSE);
126
  $pass_hash = $hasher->HashPassword($this->Package->Installer->OptsSecurePass);
127
 
 
 
128
  //READ-ONLY: COMPARE VALUES
129
  $ac->created = $this->Package->Created;
130
  $ac->version_dup = DUPLICATOR_VERSION;
@@ -136,20 +138,20 @@ class DUP_Installer
136
 
137
  //READ-ONLY: GENERAL
138
  // $ac->installer_base_name = $global->installer_base_name;
139
- $ac->installer_base_name = 'installer.php';
140
- $ac->package_name = "{$this->Package->NameHash}_archive.{$extension}";
141
- $ac->package_hash = $this->Package->getPackageHash();
142
- $ac->package_notes = $this->Package->Notes;
143
- $ac->url_old = get_option('siteurl');
144
- $ac->opts_delete = json_encode($GLOBALS['DUPLICATOR_OPTS_DELETE']);
145
- $ac->blogname = esc_html(get_option('blogname'));
146
- $ac->wproot = DUPLICATOR_WPROOTPATH;
147
- $ac->relative_content_dir = str_replace(ABSPATH, '', WP_CONTENT_DIR);
148
- $ac->exportOnlyDB = $this->Package->Archive->ExportOnlyDB;
149
- $ac->installSiteOverwriteOn = DUPLICATOR_INSTALL_SITE_OVERWRITE_ON;
150
- $ac->wplogin_url = wp_login_url();
151
-
152
- //PRE-FILLED: GENERAL
153
  $ac->secure_on = $this->Package->Installer->OptsSecureOn;
154
  $ac->secure_pass = $pass_hash;
155
  $ac->skipscan = false;
@@ -162,10 +164,10 @@ class DUP_Installer
162
  $ac->mu_mode = DUP_MU::getMode();
163
  $ac->is_outer_root_wp_config_file = (!file_exists(DUPLICATOR_WPROOTPATH.'wp-config.php')) ? true : false;
164
  $ac->is_outer_root_wp_content_dir = $this->Package->Archive->isOuterWPContentDir();
 
165
 
166
- $json = json_encode($ac);
167
-
168
- DUP_Log::TraceObject('json', $json);
169
 
170
  if (file_put_contents($archive_config_filepath, $json) === false) {
171
  DUP_Log::error("Error writing archive config", "Couldn't write archive config at $archive_config_filepath", Dup_ErrorBehavior::LogOnly);
93
  $mini_expander_string = '';
94
  }
95
 
96
+ $search_array = array('@@ARCHIVE@@', '@@VERSION@@', '@@ARCHIVE_SIZE@@', '@@PACKAGE_HASH@@', '@@CSRF_CRYPT@@', '@@DUPARCHIVE_MINI_EXPANDER@@');
97
  $package_hash = $this->Package->getPackageHash();
98
+ $replace_array = array($this->Package->Archive->File, DUPLICATOR_VERSION, @filesize($archive_filepath), $package_hash, DUPLICATOR_INSTALLER_CSRF_CRYPT, $mini_expander_string);
99
  $installer_contents = str_replace($search_array, $replace_array, $installer_contents);
100
 
101
  if (@file_put_contents($installer_filepath, $installer_contents) === false) {
125
  $hasher = new DUP_PasswordHash(8, FALSE);
126
  $pass_hash = $hasher->HashPassword($this->Package->Installer->OptsSecurePass);
127
 
128
+ $this->Package->Database->getScannerData();
129
+
130
  //READ-ONLY: COMPARE VALUES
131
  $ac->created = $this->Package->Created;
132
  $ac->version_dup = DUPLICATOR_VERSION;
138
 
139
  //READ-ONLY: GENERAL
140
  // $ac->installer_base_name = $global->installer_base_name;
141
+ $ac->installer_base_name = 'installer.php';
142
+ $ac->package_name = "{$this->Package->NameHash}_archive.{$extension}";
143
+ $ac->package_hash = $this->Package->getPackageHash();
144
+ $ac->package_notes = $this->Package->Notes;
145
+ $ac->url_old = get_option('siteurl');
146
+ $ac->opts_delete = DUP_JSON::encode($GLOBALS['DUPLICATOR_OPTS_DELETE']);
147
+ $ac->blogname = esc_html(get_option('blogname'));
148
+ $ac->wproot = DUPLICATOR_WPROOTPATH;
149
+ $ac->relative_content_dir = str_replace(ABSPATH, '', WP_CONTENT_DIR);
150
+ $ac->exportOnlyDB = $this->Package->Archive->ExportOnlyDB;
151
+ $ac->installSiteOverwriteOn = DUPLICATOR_INSTALL_SITE_OVERWRITE_ON;
152
+ $ac->wplogin_url = wp_login_url();
153
+
154
+ //PRE-FILLED: GENERAL
155
  $ac->secure_on = $this->Package->Installer->OptsSecureOn;
156
  $ac->secure_pass = $pass_hash;
157
  $ac->skipscan = false;
164
  $ac->mu_mode = DUP_MU::getMode();
165
  $ac->is_outer_root_wp_config_file = (!file_exists(DUPLICATOR_WPROOTPATH.'wp-config.php')) ? true : false;
166
  $ac->is_outer_root_wp_content_dir = $this->Package->Archive->isOuterWPContentDir();
167
+ $ac->csrf_crypt = DUPLICATOR_INSTALLER_CSRF_CRYPT;
168
 
169
+ $json = DUP_JSON::encodePrettyPrint($ac);
170
+ DUP_Log::TraceObject('json', $json);
 
171
 
172
  if (file_put_contents($archive_config_filepath, $json) === false) {
173
  DUP_Log::error("Error writing archive config", "Couldn't write archive config at $archive_config_filepath", Dup_ErrorBehavior::LogOnly);
classes/package/class.pack.php CHANGED
@@ -284,11 +284,7 @@ class DUP_Package
284
  $report['RPT']['ScanTime'] = DUP_Util::elapsedTime(DUP_Util::getMicrotime(), $timerStart);
285
  $fp = fopen(DUPLICATOR_SSDIR_PATH_TMP."/{$this->ScanFile}", 'w');
286
 
287
- if (function_exists('wp_json_encode')) {
288
- fwrite($fp, wp_json_encode($report));
289
- } else {
290
- fwrite($fp, json_encode($report));
291
- }
292
  fclose($fp);
293
 
294
  return $report;
284
  $report['RPT']['ScanTime'] = DUP_Util::elapsedTime(DUP_Util::getMicrotime(), $timerStart);
285
  $fp = fopen(DUPLICATOR_SSDIR_PATH_TMP."/{$this->ScanFile}", 'w');
286
 
287
+ fwrite($fp, DUP_JSON::encodePrettyPrint($report));
 
 
 
 
288
  fclose($fp);
289
 
290
  return $report;
classes/utilities/class.u.json.php CHANGED
@@ -66,49 +66,75 @@ class DUP_JSON
66
  }
67
  }
68
 
69
- /**
70
- * Attempts to only call the json_encode method directly
71
- *
72
- * Returns a string containing the JSON representation of the supplied value
73
- *
74
- * @return string
75
- */
76
- public static function encode($value, $options = 0)
77
- {
78
- $result = json_encode($value, $options);
79
-
80
- if ($result !== FALSE) {
81
- return $result;
82
- }
83
-
84
- if (function_exists('json_last_error')) {
85
- $message = self::$_messages[json_last_error()];
86
- } else {
87
- $message = esc_html__("One or more filenames isn't compatible with JSON encoding", 'duplicator');
88
- }
89
-
90
- throw new RuntimeException($message);
91
- }
92
-
93
- /**
94
- * Attempts to call json_encode upon error DUP_JSON::customEncode is called
95
- *
96
- * Returns a string containing the JSON representation of the supplied value
97
- *
98
- * @return string
99
- */
100
- public static function safeEncode($value)
101
- {
102
- $jsonString = json_encode($value);
103
- if (($jsonString === false) || trim($jsonString) == '') {
104
- $jsonString = self::customEncode($value);
105
-
106
- if (($jsonString === false) || trim($jsonString) == '') {
107
- throw new Exception('Unable to generate JSON from object');
108
- }
109
- }
110
- return $jsonString;
111
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
112
 
113
  /**
114
  * Attempts to only call the json_decode method directly
66
  }
67
  }
68
 
69
+ /**
70
+ *
71
+ * @param mixed $data Variable (usually an array or object) to encode as JSON.
72
+ * @param int $options Optional. Options to be passed to json_encode(). Default 0.
73
+ * @param int $depth Optional. Maximum depth to walk through $data. Must be
74
+ * greater than 0. Default 512.
75
+ * @return string|false The JSON encoded string, or false if it cannot be encoded.
76
+ */
77
+ public static function encodePrettyPrint($data, $options = 0, $depth = 512)
78
+ {
79
+ if (defined('JSON_PRETTY_PRINT')) {
80
+ return self::encode($data, JSON_PRETTY_PRINT | $options, $depth);
81
+ } else {
82
+ return self::encode($data, $options, $depth);
83
+ }
84
+ }
85
+
86
+ /**
87
+ * @param mixed $data Variable (usually an array or object) to encode as JSON.
88
+ * @param int $options Optional. Options to be passed to json_encode(). Default 0.
89
+ * @param int $depth Optional. Maximum depth to walk through $data. Must be
90
+ * greater than 0. Default 512.
91
+ * @return string|false The JSON encoded string, or false if it cannot be encoded.
92
+ */
93
+ public static function encode($data, $options = 0, $depth = 512)
94
+ {
95
+ $result = false;
96
+
97
+ if (function_exists('wp_json_encode')) {
98
+ $result = wp_json_encode($data, $options, $depth);
99
+ } else {
100
+ if (version_compare(PHP_VERSION, '5.5', '>=')) {
101
+ $result = json_encode($data, $options, $depth);
102
+ } elseif (version_compare(PHP_VERSION, '5.3', '>=')) {
103
+ $result = json_encode($data, $options);
104
+ } else {
105
+ $result = json_encode($data);
106
+ }
107
+ }
108
+
109
+ if ($result === false) {
110
+ if (function_exists('json_last_error')) {
111
+ $message = self::$_messages[json_last_error()];
112
+ } else {
113
+ $message = esc_html__("One or more filenames isn't compatible with JSON encoding", 'duplicator');
114
+ }
115
+ throw new RuntimeException($message);
116
+ }
117
+
118
+ return $result;
119
+ }
120
+
121
+ public static function safeEncode($data, $options = 0, $depth = 512)
122
+ {
123
+ try {
124
+ $jsonString = self::encode($data, $options, $depth);
125
+ } catch (Exception $e) {
126
+ $jsonString = false;
127
+ }
128
+
129
+ if (($jsonString === false) || trim($jsonString) == '') {
130
+ $jsonString = self::customEncode($value);
131
+
132
+ if (($jsonString === false) || trim($jsonString) == '') {
133
+ throw new Exception('Unable to generate JSON from object');
134
+ }
135
+ }
136
+ return $jsonString;
137
+ }
138
 
139
  /**
140
  * Attempts to only call the json_decode method directly
classes/utilities/class.u.php CHANGED
@@ -650,27 +650,88 @@ class DUP_Util
650
  }
651
 
652
  /**
653
- * Returns an array of the WordPress core tables.
654
- *
655
- * @return array Returns all WP core tables
656
- */
657
- public static function getWPCoreTables()
658
- {
659
- global $wpdb;
660
- return array(
661
- "{$wpdb->prefix}commentmeta",
662
- "{$wpdb->prefix}comments",
663
- "{$wpdb->prefix}links",
664
- "{$wpdb->prefix}options",
665
- "{$wpdb->prefix}postmeta",
666
- "{$wpdb->prefix}posts",
667
- "{$wpdb->prefix}term_relationships",
668
- "{$wpdb->prefix}term_taxonomy",
669
- "{$wpdb->prefix}termmeta",
670
- "{$wpdb->prefix}terms",
671
- "{$wpdb->prefix}usermeta",
672
- "{$wpdb->prefix}users");
673
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
674
 
675
  /**
676
  * Finds if its a valid executable or not
650
  }
651
 
652
  /**
653
+ * Returns an array of the WordPress core tables.
654
+ *
655
+ * @return array Returns all WP core tables
656
+ */
657
+ public static function getWPCoreTables()
658
+ {
659
+ global $wpdb;
660
+ $result = array();
661
+ foreach (self::getWPCoreTablesEnd() as $tend) {
662
+ $result[] = $wpdb->prefix.$tend;
663
+ }
664
+ return $result;
665
+ }
666
+
667
+ public static function getWPCoreTablesEnd()
668
+ {
669
+ return array(
670
+ 'commentmeta',
671
+ 'comments',
672
+ 'links',
673
+ 'options',
674
+ 'postmeta',
675
+ 'posts',
676
+ 'term_relationships',
677
+ 'term_taxonomy',
678
+ 'termmeta',
679
+ 'terms',
680
+ 'usermeta',
681
+ 'blogs',
682
+ 'blog_versions',
683
+ 'blogmeta',
684
+ 'users',
685
+ 'site',
686
+ 'sitemeta',
687
+ 'signups',
688
+ 'registration_log',
689
+ 'blog_versions');
690
+ }
691
+
692
+ public static function isWPCoreTable($table)
693
+ {
694
+ global $wpdb;
695
+
696
+ if (strpos($table, $wpdb->prefix) !== 0) {
697
+ return false;
698
+ }
699
+
700
+ $subTName = substr($table, strlen($wpdb->prefix));
701
+ $coreEnds = self::getWPCoreTablesEnd();
702
+
703
+ if (in_array($subTName, $coreEnds)) {
704
+ return true;
705
+ } else if (is_multisite()) {
706
+ $exTable = explode('_', $subTName);
707
+ if (count($exTable) >= 2 && is_numeric($exTable[0])) {
708
+ $tChekc = implode('_', array_slice($exTable, 1));
709
+ if (get_blog_details((int) $exTable[0], false) !== false && in_array($tChekc, $coreEnds)) {
710
+ return true;
711
+ }
712
+ }
713
+ }
714
+
715
+ return false;
716
+ }
717
+
718
+ public static function getWPBlogIdTable($table)
719
+ {
720
+ global $wpdb;
721
+
722
+ if (!is_multisite() || strpos($table, $wpdb->prefix) !== 0) {
723
+ return 0;
724
+ }
725
+
726
+ $subTName = substr($table, strlen($wpdb->prefix));
727
+ $exTable = explode('_', $subTName);
728
+ if (count($exTable) >= 2 && is_numeric($exTable[0]) && get_blog_details((int) $exTable[0], false) !== false) {
729
+ return (int) $exTable[0];
730
+ } else {
731
+ return 0;
732
+ }
733
+ }
734
+
735
 
736
  /**
737
  * Finds if its a valid executable or not
define.php CHANGED
@@ -2,8 +2,8 @@
2
  //Prevent directly browsing to the file
3
  if (function_exists('plugin_dir_url'))
4
  {
5
- define('DUPLICATOR_VERSION', '1.3.8');
6
- define('DUPLICATOR_VERSION_BUILD', '2019-02-22_12:20');
7
  define('DUPLICATOR_PLUGIN_URL', plugin_dir_url(__FILE__));
8
  define('DUPLICATOR_SITE_URL', get_site_url());
9
 
@@ -54,7 +54,8 @@ if (function_exists('plugin_dir_url'))
54
  define('DUPLICATOR_WEBCONFIG_ORIG_FILENAME', 'web.config.orig');
55
  define("DUPLICATOR_INSTALLER_DIRECTORY", DUPLICATOR_WPROOTPATH . 'dup-installer');
56
  define('DUPLICATOR_MAX_LOG_SIZE', 400000); // The higher this is the more overhead
57
-
 
58
  $GLOBALS['DUPLICATOR_SERVER_LIST'] = array('Apache','LiteSpeed', 'Nginx', 'Lighttpd', 'IIS', 'WebServerX', 'uWSGI');
59
  $GLOBALS['DUPLICATOR_OPTS_DELETE'] = array('duplicator_ui_view_state', 'duplicator_package_active', 'duplicator_settings');
60
  $GLOBALS['DUPLICATOR_GLOBAL_FILE_FILTERS_ON'] = true;
2
  //Prevent directly browsing to the file
3
  if (function_exists('plugin_dir_url'))
4
  {
5
+ define('DUPLICATOR_VERSION', '1.3.10');
6
+ define('DUPLICATOR_VERSION_BUILD', '2019-03-16_12:15');
7
  define('DUPLICATOR_PLUGIN_URL', plugin_dir_url(__FILE__));
8
  define('DUPLICATOR_SITE_URL', get_site_url());
9
 
54
  define('DUPLICATOR_WEBCONFIG_ORIG_FILENAME', 'web.config.orig');
55
  define("DUPLICATOR_INSTALLER_DIRECTORY", DUPLICATOR_WPROOTPATH . 'dup-installer');
56
  define('DUPLICATOR_MAX_LOG_SIZE', 400000); // The higher this is the more overhead
57
+ define("DUPLICATOR_INSTALLER_CSRF_CRYPT", 1);
58
+
59
  $GLOBALS['DUPLICATOR_SERVER_LIST'] = array('Apache','LiteSpeed', 'Nginx', 'Lighttpd', 'IIS', 'WebServerX', 'uWSGI');
60
  $GLOBALS['DUPLICATOR_OPTS_DELETE'] = array('duplicator_ui_view_state', 'duplicator_package_active', 'duplicator_settings');
61
  $GLOBALS['DUPLICATOR_GLOBAL_FILE_FILTERS_ON'] = true;
duplicator.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Duplicator
4
  Plugin URI: https://snapcreek.com/duplicator/duplicator-free/
5
  Description: Migrate and backup a copy of your WordPress files and database. Duplicate and move a site from one location to another quickly.
6
- Version: 1.3.8
7
  Author: Snap Creek
8
  Author URI: http://www.snapcreek.com/duplicator/
9
  Text Domain: duplicator
@@ -243,6 +243,13 @@ if (is_admin() == true)
243
  * ===================================================== */
244
  add_action('plugins_loaded', 'duplicator_update');
245
  add_action('plugins_loaded', 'duplicator_wpfront_integrate');
 
 
 
 
 
 
 
246
  add_action('admin_init', 'duplicator_init');
247
  add_action('admin_menu', 'duplicator_menu');
248
  add_action('admin_enqueue_scripts', 'duplicator_admin_enqueue_scripts' );
3
  Plugin Name: Duplicator
4
  Plugin URI: https://snapcreek.com/duplicator/duplicator-free/
5
  Description: Migrate and backup a copy of your WordPress files and database. Duplicate and move a site from one location to another quickly.
6
+ Version: 1.3.10
7
  Author: Snap Creek
8
  Author URI: http://www.snapcreek.com/duplicator/
9
  Text Domain: duplicator
243
  * ===================================================== */
244
  add_action('plugins_loaded', 'duplicator_update');
245
  add_action('plugins_loaded', 'duplicator_wpfront_integrate');
246
+
247
+ function duplicator_load_textdomain()
248
+ {
249
+ load_plugin_textdomain('duplicator', false, false);
250
+ }
251
+ add_action('plugins_loaded', 'duplicator_load_textdomain');
252
+
253
  add_action('admin_init', 'duplicator_init');
254
  add_action('admin_menu', 'duplicator_menu');
255
  add_action('admin_enqueue_scripts', 'duplicator_admin_enqueue_scripts' );
installer/dup-installer/assets/inc.css.php CHANGED
@@ -9,6 +9,7 @@
9
  select {padding-left:0; width:99%}
10
  select:disabled {background:#EBEBE4}
11
  input.readonly {background-color:#efefef;}
 
12
 
13
  /* ============================
14
  COMMON VIEWS
@@ -58,6 +59,84 @@
58
  div.toggle-hdr:hover {cursor:pointer; background-color:#f1f1f1; border:1px solid #dcdcdc; }
59
  div.toggle-hdr:hover a{color:#000}
60
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
61
  /*Adv Opts */
62
  table.dupx-opts {width:100%; border:0px;}
63
  table.dupx-opts td{padding:3px;}
@@ -238,10 +317,10 @@
238
  div.s4-final-title {color:#BE2323; font-size:18px}
239
  div.s4-connect {font-size:12px; text-align:center; font-style:italic; position:absolute; bottom:10px; padding:10px; width:100%; margin-top:20px}
240
  table.s4-report-results,
241
- table.s4-report-errs {border-collapse:collapse;}
242
  table.s4-report-errs td {text-align:center; width:33%}
243
- table.s4-report-results th, table.s4-report-errs th {background-color:#efefef; padding:0; font-size:12px; padding:0}
244
- table.s4-report-results td, table.s4-report-errs td {padding:0; white-space:nowrap; border:1px solid #dfdfdf; text-align:center; font-size:11px}
245
  table.s4-report-results td:first-child {text-align:left; font-weight:bold; padding-left:3px}
246
  div.s4-err-title {background-color:#dfdfdf; font-weight: bold; margin:-3px 0 15px 0; padding:5px; border-radius:3px; font-size:13px}
247
 
@@ -252,7 +331,7 @@
252
  table.s4-final-step {width:100%;}
253
  table.s4-final-step td {padding:5px 15px 5px 5px;font-size:13px; }
254
  table.s4-final-step td:first-child {white-space:nowrap; width:165px}
255
- div.s4-go-back {border-top:1px dotted #dfdfdf; margin:auto; font-style:italic; font-size:11px; color:#333; padding-top:4px}
256
  div.s4-go-back ul {line-height:18px}
257
  button.s4-final-btns {cursor:pointer; color:#fff; font-size:16px; border-radius:5px; padding:7px; background-color:#13659C; border:1px solid gray; width:145px;}
258
  button.s4-final-btns:hover {background-color: #dfdfdf;}
@@ -263,15 +342,13 @@
263
  /* ============================
264
  STEP 5 HELP
265
  ============================ */
266
- div.help-target {float:right;}
267
  div.help-target a {float:right; font-size:16px; color:#13659C}
268
  div#main-help sup {font-size:11px; font-weight:normal; font-style:italic; color:blue}
269
  div.help-online {text-align:center; font-size:18px; padding:10px 0 0 0; line-height:24px}
270
  div.help {color:#555; font-style:italic; font-size:11px; padding:4px; border-top:1px solid #dfdfdf}
271
- div.help-page {padding:5px 0 0 5px}
272
  div.help-page fieldset {margin-bottom:25px}
273
  div#main-help {font-size:13px; line-height:17px}
274
- div#main-help h2 {background-color:#F1F1F1; border:1px solid silver; border-radius:4px; padding:15px; margin:28px 0 8px 0; font-size:24px; }
275
  div#main-help h3 {border-bottom:1px solid silver; padding:8px; margin:4px 0 8px 0; font-size:20px}
276
  div#main-help span.step {color:#DB4B38}
277
  table.help-opt {width: 100%; border: none; border-collapse: collapse; margin:5px 0 0 0;}
@@ -280,6 +357,56 @@
280
  table.help-opt td:first-child {font-weight:bold; padding-right:10px; white-space:nowrap}
281
  table.help-opt th {background: #333; color: #fff;border:1px solid #333; padding:3px}
282
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
283
  /* ============================
284
  VIEW EXCEPTION
285
  ============================ */
9
  select {padding-left:0; width:99%}
10
  select:disabled {background:#EBEBE4}
11
  input.readonly {background-color:#efefef;}
12
+ .no-display { display: none; }
13
 
14
  /* ============================
15
  COMMON VIEWS
59
  div.toggle-hdr:hover {cursor:pointer; background-color:#f1f1f1; border:1px solid #dcdcdc; }
60
  div.toggle-hdr:hover a{color:#000}
61
 
62
+ [data-type="toggle"] > i.fa,
63
+ i.fa.fa-toggle-empty { min-width: 8px; }
64
+
65
+ /* ============================
66
+ NOTICES
67
+ ============================ */
68
+ /* step messages */
69
+ #step-messages { padding: 10px 25px 0; }
70
+ .notice {
71
+ background: #fff;
72
+ border:1px solid #dfdfdf;
73
+ border-left: 4px solid #fff;
74
+ margin: 4px;
75
+ padding: 2px;
76
+ border-radius: 4px;
77
+ }
78
+
79
+ .notice-report {
80
+ border-left: 4px solid #fff;
81
+ padding-left: 0;
82
+ padding-right: 0;
83
+ margin-bottom: 4px;
84
+ }
85
+
86
+ .notice-report .title {
87
+ padding: 0 10px;
88
+ }
89
+
90
+ .notice-report .info {
91
+ border-top: 1px solid #dedede;
92
+ padding: 10px;
93
+ font-size: 10px;
94
+ background: #FAFAFA;
95
+ }
96
+
97
+ .notice.l-info,
98
+ .notice.l-notice {border-left-color: #197b19;}
99
+ .notice.l-swarning {border-left-color: #636363;}
100
+ .notice.l-hwarning {border-left-color: #636363;}
101
+ .notice.l-critical {border-left-color: maroon;}
102
+ .notice.l-fatal {border-left-color: #000000;}
103
+
104
+ .report-sections-list .section {
105
+ border: 1px solid #DFDFDF;
106
+ margin-bottom: 25px;
107
+ box-shadow: 4px 8px 11px -8px rgba(0,0,0,0.41);
108
+ }
109
+
110
+ .report-sections-list .section > .section-title {
111
+ background-color: #efefef;
112
+ padding: 3px;
113
+ font-weight: bold;
114
+ text-align: center;
115
+ font-size: 14px;
116
+ }
117
+
118
+ .report-sections-list .section > .section-content {
119
+ padding: 5px;
120
+ }
121
+
122
+ .notice-level-status {
123
+ border-radius: 4px;
124
+ padding: 2px;
125
+ margin: 1px;
126
+ font-size: 10px;
127
+ display: inline-block;
128
+ color: #FFF;
129
+ font-weight: bold;
130
+ min-width:55px;
131
+ }
132
+
133
+ .notice-level-status.l-info,
134
+ .notice-level-status.l-notice {background: #197b19;}
135
+ .notice-level-status.l-swarning {background: #636363;}
136
+ .notice-level-status.l-hwarning {background: #636363;}
137
+ .notice-level-status.l-critical {background: maroon;}
138
+ .notice-level-status.l-fatal {background: #000000;}
139
+
140
  /*Adv Opts */
141
  table.dupx-opts {width:100%; border:0px;}
142
  table.dupx-opts td{padding:3px;}
317
  div.s4-final-title {color:#BE2323; font-size:18px}
318
  div.s4-connect {font-size:12px; text-align:center; font-style:italic; position:absolute; bottom:10px; padding:10px; width:100%; margin-top:20px}
319
  table.s4-report-results,
320
+ table.s4-report-errs {border-collapse:collapse; box-shadow: 4px 8px 11px -8px rgba(0,0,0,0.41);}
321
  table.s4-report-errs td {text-align:center; width:33%}
322
+ table.s4-report-results th, table.s4-report-errs th {background-color:#d0d0d0; padding:3px; font-size:14px;}
323
+ table.s4-report-results td, table.s4-report-errs td {padding:3px; white-space:nowrap; border:1px solid #dfdfdf; text-align:center; font-size:11px}
324
  table.s4-report-results td:first-child {text-align:left; font-weight:bold; padding-left:3px}
325
  div.s4-err-title {background-color:#dfdfdf; font-weight: bold; margin:-3px 0 15px 0; padding:5px; border-radius:3px; font-size:13px}
326
 
331
  table.s4-final-step {width:100%;}
332
  table.s4-final-step td {padding:5px 15px 5px 5px;font-size:13px; }
333
  table.s4-final-step td:first-child {white-space:nowrap; width:165px}
334
+ div.s4-go-back {border-top:1px dotted #dfdfdf; margin:auto;font-size:11px; color:#333; padding-top:4px}
335
  div.s4-go-back ul {line-height:18px}
336
  button.s4-final-btns {cursor:pointer; color:#fff; font-size:16px; border-radius:5px; padding:7px; background-color:#13659C; border:1px solid gray; width:145px;}
337
  button.s4-final-btns:hover {background-color: #dfdfdf;}
342
  /* ============================
343
  STEP 5 HELP
344
  ============================ */
345
+ div.help-target {float:right;}
346
  div.help-target a {float:right; font-size:16px; color:#13659C}
347
  div#main-help sup {font-size:11px; font-weight:normal; font-style:italic; color:blue}
348
  div.help-online {text-align:center; font-size:18px; padding:10px 0 0 0; line-height:24px}
349
  div.help {color:#555; font-style:italic; font-size:11px; padding:4px; border-top:1px solid #dfdfdf}
 
350
  div.help-page fieldset {margin-bottom:25px}
351
  div#main-help {font-size:13px; line-height:17px}
 
352
  div#main-help h3 {border-bottom:1px solid silver; padding:8px; margin:4px 0 8px 0; font-size:20px}
353
  div#main-help span.step {color:#DB4B38}
354
  table.help-opt {width: 100%; border: none; border-collapse: collapse; margin:5px 0 0 0;}
357
  table.help-opt td:first-child {font-weight:bold; padding-right:10px; white-space:nowrap}
358
  table.help-opt th {background: #333; color: #fff;border:1px solid #333; padding:3px}
359
 
360
+ #main-help section {
361
+ border: 1px solid silver;
362
+ margin-top: 28px;
363
+ border-radius: 4px;
364
+ overflow: hidden;
365
+ }
366
+
367
+ #main-help section h2.header {
368
+ background-color:#F1F1F1;
369
+ padding:15px;
370
+ margin:0;
371
+ font-size:20px;
372
+ }
373
+
374
+ #main-help section .content {
375
+ padding: 10px;
376
+ }
377
+
378
+ /* ============================
379
+ Expandable section
380
+ ============================ */
381
+ .expandable.close .expand-header {
382
+ cursor:pointer;
383
+ }
384
+
385
+ .expandable.open .expand-header {
386
+ cursor:pointer;
387
+ }
388
+
389
+ .expandable .expand-header::before {
390
+ font-family: FontAwesome;
391
+ margin-right: 10px;
392
+ }
393
+
394
+ .expandable.close .expand-header::before {
395
+ content: "\f0fe";
396
+ }
397
+
398
+ .expandable.open .expand-header::before {
399
+ content: "\f146";
400
+ }
401
+
402
+ .expandable.close .content {
403
+ display: none;
404
+ }
405
+
406
+ .expandable.open .content {
407
+ display: block;
408
+ }
409
+
410
  /* ============================
411
  VIEW EXCEPTION
412
  ============================ */
installer/dup-installer/assets/inc.js.php CHANGED
@@ -118,7 +118,7 @@
118
  (icon.length)
119
  ? $(icon).addClass(style[src].open )
120
  : $(this).html("- " + text );
121
- target.show();
122
  } else {
123
  (icon.length)
124
  ? $(icon).addClass(style[src].close)
118
  (icon.length)
119
  ? $(icon).addClass(style[src].open )
120
  : $(this).html("- " + text );
121
+ target.show().removeClass('no-display');
122
  } else {
123
  (icon.length)
124
  ? $(icon).addClass(style[src].close)
installer/dup-installer/classes/Crypt/Base.php ADDED
@@ -0,0 +1,2660 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Base Class for all Crypt_* cipher classes
5
+ *
6
+ * PHP versions 4 and 5
7
+ *
8
+ * Internally for phpseclib developers:
9
+ * If you plan to add a new cipher class, please note following rules:
10
+ *
11
+ * - The new Crypt_* cipher class should extend Crypt_Base
12
+ *
13
+ * - Following methods are then required to be overridden/overloaded:
14
+ *
15
+ * - _encryptBlock()
16
+ *
17
+ * - _decryptBlock()
18
+ *
19
+ * - _setupKey()
20
+ *
21
+ * - All other methods are optional to be overridden/overloaded
22
+ *
23
+ * - Look at the source code of the current ciphers how they extend Crypt_Base
24
+ * and take one of them as a start up for the new cipher class.
25
+ *
26
+ * - Please read all the other comments/notes/hints here also for each class var/method
27
+ *
28
+ * LICENSE: Permission is hereby granted, free of charge, to any person obtaining a copy
29
+ * of this software and associated documentation files (the "Software"), to deal
30
+ * in the Software without restriction, including without limitation the rights
31
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
32
+ * copies of the Software, and to permit persons to whom the Software is
33
+ * furnished to do so, subject to the following conditions:
34
+ *
35
+ * The above copyright notice and this permission notice shall be included in
36
+ * all copies or substantial portions of the Software.
37
+ *
38
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
39
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
40
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
41
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
42
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
43
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
44
+ * THE SOFTWARE.
45
+ *
46
+ * @category Crypt
47
+ * @package Crypt_Base
48
+ * @author Jim Wigginton <terrafrost@php.net>
49
+ * @author Hans-Juergen Petrich <petrich@tronic-media.com>
50
+ * @copyright 2007 Jim Wigginton
51
+ * @license http://www.opensource.org/licenses/mit-license.html MIT License
52
+ * @link http://phpseclib.sourceforge.net
53
+ */
54
+
55
+ /**#@+
56
+ * @access public
57
+ * @see self::encrypt()
58
+ * @see self::decrypt()
59
+ */
60
+ /**
61
+ * Encrypt / decrypt using the Counter mode.
62
+ *
63
+ * Set to -1 since that's what Crypt/Random.php uses to index the CTR mode.
64
+ *
65
+ * @link http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation#Counter_.28CTR.29
66
+ */
67
+ define('CRYPT_MODE_CTR', -1);
68
+ /**
69
+ * Encrypt / decrypt using the Electronic Code Book mode.
70
+ *
71
+ * @link http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation#Electronic_codebook_.28ECB.29
72
+ */
73
+ define('CRYPT_MODE_ECB', 1);
74
+ /**
75
+ * Encrypt / decrypt using the Code Book Chaining mode.
76
+ *
77
+ * @link http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation#Cipher-block_chaining_.28CBC.29
78
+ */
79
+ define('CRYPT_MODE_CBC', 2);
80
+ /**
81
+ * Encrypt / decrypt using the Cipher Feedback mode.
82
+ *
83
+ * @link http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation#Cipher_feedback_.28CFB.29
84
+ */
85
+ define('CRYPT_MODE_CFB', 3);
86
+ /**
87
+ * Encrypt / decrypt using the Output Feedback mode.
88
+ *
89
+ * @link http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation#Output_feedback_.28OFB.29
90
+ */
91
+ define('CRYPT_MODE_OFB', 4);
92
+ /**
93
+ * Encrypt / decrypt using streaming mode.
94
+ */
95
+ define('CRYPT_MODE_STREAM', 5);
96
+ /**#@-*/
97
+
98
+ /**#@+
99
+ * @access private
100
+ * @see self::Crypt_Base()
101
+ * @internal These constants are for internal use only
102
+ */
103
+ /**
104
+ * Base value for the internal implementation $engine switch
105
+ */
106
+ define('CRYPT_ENGINE_INTERNAL', 1);
107
+ /**
108
+ * Base value for the mcrypt implementation $engine switch
109
+ */
110
+ define('CRYPT_ENGINE_MCRYPT', 2);
111
+ /**
112
+ * Base value for the OpenSSL implementation $engine switch
113
+ */
114
+ define('CRYPT_ENGINE_OPENSSL', 3);
115
+ /**#@-*/
116
+
117
+ /**
118
+ * Base Class for all Crypt_* cipher classes
119
+ *
120
+ * @package Crypt_Base
121
+ * @author Jim Wigginton <terrafrost@php.net>
122
+ * @author Hans-Juergen Petrich <petrich@tronic-media.com>
123
+ * @access public
124
+ */
125
+ class Crypt_Base
126
+ {
127
+ /**
128
+ * The Encryption Mode
129
+ *
130
+ * @see self::Crypt_Base()
131
+ * @var int
132
+ * @access private
133
+ */
134
+ var $mode;
135
+
136
+ /**
137
+ * The Block Length of the block cipher
138
+ *
139
+ * @var int
140
+ * @access private
141
+ */
142
+ var $block_size = 16;
143
+
144
+ /**
145
+ * The Key
146
+ *
147
+ * @see self::setKey()
148
+ * @var string
149
+ * @access private
150
+ */
151
+ var $key = "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0";
152
+
153
+ /**
154
+ * The Initialization Vector
155
+ *
156
+ * @see self::setIV()
157
+ * @var string
158
+ * @access private
159
+ */
160
+ var $iv;
161
+
162
+ /**
163
+ * A "sliding" Initialization Vector
164
+ *
165
+ * @see self::enableContinuousBuffer()
166
+ * @see self::_clearBuffers()
167
+ * @var string
168
+ * @access private
169
+ */
170
+ var $encryptIV;
171
+
172
+ /**
173
+ * A "sliding" Initialization Vector
174
+ *
175
+ * @see self::enableContinuousBuffer()
176
+ * @see self::_clearBuffers()
177
+ * @var string
178
+ * @access private
179
+ */
180
+ var $decryptIV;
181
+
182
+ /**
183
+ * Continuous Buffer status
184
+ *
185
+ * @see self::enableContinuousBuffer()
186
+ * @var bool
187
+ * @access private
188
+ */
189
+ var $continuousBuffer = false;
190
+
191
+ /**
192
+ * Encryption buffer for CTR, OFB and CFB modes
193
+ *
194
+ * @see self::encrypt()
195
+ * @see self::_clearBuffers()
196
+ * @var array
197
+ * @access private
198
+ */
199
+ var $enbuffer;
200
+
201
+ /**
202
+ * Decryption buffer for CTR, OFB and CFB modes
203
+ *
204
+ * @see self::decrypt()
205
+ * @see self::_clearBuffers()
206
+ * @var array
207
+ * @access private
208
+ */
209
+ var $debuffer;
210
+
211
+ /**
212
+ * mcrypt resource for encryption
213
+ *
214
+ * The mcrypt resource can be recreated every time something needs to be created or it can be created just once.
215
+ * Since mcrypt operates in continuous mode, by default, it'll need to be recreated when in non-continuous mode.
216
+ *
217
+ * @see self::encrypt()
218
+ * @var resource
219
+ * @access private
220
+ */
221
+ var $enmcrypt;
222
+
223
+ /**
224
+ * mcrypt resource for decryption
225
+ *
226
+ * The mcrypt resource can be recreated every time something needs to be created or it can be created just once.
227
+ * Since mcrypt operates in continuous mode, by default, it'll need to be recreated when in non-continuous mode.
228
+ *
229
+ * @see self::decrypt()
230
+ * @var resource
231
+ * @access private
232
+ */
233
+ var $demcrypt;
234
+
235
+ /**
236
+ * Does the enmcrypt resource need to be (re)initialized?
237
+ *
238
+ * @see Crypt_Twofish::setKey()
239
+ * @see Crypt_Twofish::setIV()
240
+ * @var bool
241
+ * @access private
242
+ */
243
+ var $enchanged = true;
244
+
245
+ /**
246
+ * Does the demcrypt resource need to be (re)initialized?
247
+ *
248
+ * @see Crypt_Twofish::setKey()
249
+ * @see Crypt_Twofish::setIV()
250
+ * @var bool
251
+ * @access private
252
+ */
253
+ var $dechanged = true;
254
+
255
+ /**
256
+ * mcrypt resource for CFB mode
257
+ *
258
+ * mcrypt's CFB mode, in (and only in) buffered context,
259
+ * is broken, so phpseclib implements the CFB mode by it self,
260
+ * even when the mcrypt php extension is available.
261
+ *
262
+ * In order to do the CFB-mode work (fast) phpseclib
263
+ * use a separate ECB-mode mcrypt resource.
264
+ *
265
+ * @link http://phpseclib.sourceforge.net/cfb-demo.phps
266
+ * @see self::encrypt()
267
+ * @see self::decrypt()
268
+ * @see self::_setupMcrypt()
269
+ * @var resource
270
+ * @access private
271
+ */
272
+ var $ecb;
273
+
274
+ /**
275
+ * Optimizing value while CFB-encrypting
276
+ *
277
+ * Only relevant if $continuousBuffer enabled
278
+ * and $engine == CRYPT_ENGINE_MCRYPT
279
+ *
280
+ * It's faster to re-init $enmcrypt if
281
+ * $buffer bytes > $cfb_init_len than
282
+ * using the $ecb resource furthermore.
283
+ *
284
+ * This value depends of the chosen cipher
285
+ * and the time it would be needed for it's
286
+ * initialization [by mcrypt_generic_init()]
287
+ * which, typically, depends on the complexity
288
+ * on its internaly Key-expanding algorithm.
289
+ *
290
+ * @see self::encrypt()
291
+ * @var int
292
+ * @access private
293
+ */
294
+ var $cfb_init_len = 600;
295
+
296
+ /**
297
+ * Does internal cipher state need to be (re)initialized?
298
+ *
299
+ * @see self::setKey()
300
+ * @see self::setIV()
301
+ * @see self::disableContinuousBuffer()
302
+ * @var bool
303
+ * @access private
304
+ */
305
+ var $changed = true;
306
+
307
+ /**
308
+ * Padding status
309
+ *
310
+ * @see self::enablePadding()
311
+ * @var bool
312
+ * @access private
313
+ */
314
+ var $padding = true;
315
+
316
+ /**
317
+ * Is the mode one that is paddable?
318
+ *
319
+ * @see self::Crypt_Base()
320
+ * @var bool
321
+ * @access private
322
+ */
323
+ var $paddable = false;
324
+
325
+ /**
326
+ * Holds which crypt engine internaly should be use,
327
+ * which will be determined automatically on __construct()
328
+ *
329
+ * Currently available $engines are:
330
+ * - CRYPT_ENGINE_OPENSSL (very fast, php-extension: openssl, extension_loaded('openssl') required)
331
+ * - CRYPT_ENGINE_MCRYPT (fast, php-extension: mcrypt, extension_loaded('mcrypt') required)
332
+ * - CRYPT_ENGINE_INTERNAL (slower, pure php-engine, no php-extension required)
333
+ *
334
+ * @see self::_setEngine()
335
+ * @see self::encrypt()
336
+ * @see self::decrypt()
337
+ * @var int
338
+ * @access private
339
+ */
340
+ var $engine;
341
+
342
+ /**
343
+ * Holds the preferred crypt engine
344
+ *
345
+ * @see self::_setEngine()
346
+ * @see self::setPreferredEngine()
347
+ * @var int
348
+ * @access private
349
+ */
350
+ var $preferredEngine;
351
+
352
+ /**
353
+ * The mcrypt specific name of the cipher
354
+ *
355
+ * Only used if $engine == CRYPT_ENGINE_MCRYPT
356
+ *
357
+ * @link http://www.php.net/mcrypt_module_open
358
+ * @link http://www.php.net/mcrypt_list_algorithms
359
+ * @see self::_setupMcrypt()
360
+ * @var string
361
+ * @access private
362
+ */
363
+ var $cipher_name_mcrypt;
364
+
365
+ /**
366
+ * The openssl specific name of the cipher
367
+ *
368
+ * Only used if $engine == CRYPT_ENGINE_OPENSSL
369
+ *
370
+ * @link http://www.php.net/openssl-get-cipher-methods
371
+ * @var string
372
+ * @access private
373
+ */
374
+ var $cipher_name_openssl;
375
+
376
+ /**
377
+ * The openssl specific name of the cipher in ECB mode
378
+ *
379
+ * If OpenSSL does not support the mode we're trying to use (CTR)
380
+ * it can still be emulated with ECB mode.
381
+ *
382
+ * @link http://www.php.net/openssl-get-cipher-methods
383
+ * @var string
384
+ * @access private
385
+ */
386
+ var $cipher_name_openssl_ecb;
387
+
388
+ /**
389
+ * The default salt used by setPassword()
390
+ *
391
+ * @see self::setPassword()
392
+ * @var string
393
+ * @access private
394
+ */
395
+ var $password_default_salt = 'phpseclib/salt';
396
+
397
+ /**
398
+ * The namespace used by the cipher for its constants.
399
+ *
400
+ * ie: AES.php is using CRYPT_AES_MODE_* for its constants
401
+ * so $const_namespace is AES
402
+ *
403
+ * DES.php is using CRYPT_DES_MODE_* for its constants
404
+ * so $const_namespace is DES... and so on
405
+ *
406
+ * All CRYPT_<$const_namespace>_MODE_* are aliases of
407
+ * the generic CRYPT_MODE_* constants, so both could be used
408
+ * for each cipher.
409
+ *
410
+ * Example:
411
+ * $aes = new Crypt_AES(CRYPT_AES_MODE_CFB); // $aes will operate in cfb mode
412
+ * $aes = new Crypt_AES(CRYPT_MODE_CFB); // identical
413
+ *
414
+ * @see self::Crypt_Base()
415
+ * @var string
416
+ * @access private
417
+ */
418
+ var $const_namespace;
419
+
420
+ /**
421
+ * The name of the performance-optimized callback function
422
+ *
423
+ * Used by encrypt() / decrypt()
424
+ * only if $engine == CRYPT_ENGINE_INTERNAL
425
+ *
426
+ * @see self::encrypt()
427
+ * @see self::decrypt()
428
+ * @see self::_setupInlineCrypt()
429
+ * @see self::$use_inline_crypt
430
+ * @var Callback
431
+ * @access private
432
+ */
433
+ var $inline_crypt;
434
+
435
+ /**
436
+ * Holds whether performance-optimized $inline_crypt() can/should be used.
437
+ *
438
+ * @see self::encrypt()
439
+ * @see self::decrypt()
440
+ * @see self::inline_crypt
441
+ * @var mixed
442
+ * @access private
443
+ */
444
+ var $use_inline_crypt;
445
+
446
+ /**
447
+ * If OpenSSL can be used in ECB but not in CTR we can emulate CTR
448
+ *
449
+ * @see self::_openssl_ctr_process()
450
+ * @var bool
451
+ * @access private
452
+ */
453
+ var $openssl_emulate_ctr = false;
454
+
455
+ /**
456
+ * Determines what options are passed to openssl_encrypt/decrypt
457
+ *
458
+ * @see self::isValidEngine()
459
+ * @var mixed
460
+ * @access private
461
+ */
462
+ var $openssl_options;
463
+
464
+ /**
465
+ * Has the key length explicitly been set or should it be derived from the key, itself?
466
+ *
467
+ * @see self::setKeyLength()
468
+ * @var bool
469
+ * @access private
470
+ */
471
+ var $explicit_key_length = false;
472
+
473
+ /**
474
+ * Don't truncate / null pad key
475
+ *
476
+ * @see self::_clearBuffers()
477
+ * @var bool
478
+ * @access private
479
+ */
480
+ var $skip_key_adjustment = false;
481
+
482
+ /**
483
+ * Default Constructor.
484
+ *
485
+ * Determines whether or not the mcrypt extension should be used.
486
+ *
487
+ * $mode could be:
488
+ *
489
+ * - CRYPT_MODE_ECB
490
+ *
491
+ * - CRYPT_MODE_CBC
492
+ *
493
+ * - CRYPT_MODE_CTR
494
+ *
495
+ * - CRYPT_MODE_CFB
496
+ *
497
+ * - CRYPT_MODE_OFB
498
+ *
499
+ * (or the alias constants of the chosen cipher, for example for AES: CRYPT_AES_MODE_ECB or CRYPT_AES_MODE_CBC ...)
500
+ *
501
+ * If not explicitly set, CRYPT_MODE_CBC will be used.
502
+ *
503
+ * @param int $mode
504
+ * @access public
505
+ */
506
+ function __construct($mode = CRYPT_MODE_CBC)
507
+ {
508
+ // $mode dependent settings
509
+ switch ($mode) {
510
+ case CRYPT_MODE_ECB:
511
+ $this->paddable = true;
512
+ $this->mode = CRYPT_MODE_ECB;
513
+ break;
514
+ case CRYPT_MODE_CTR:
515
+ case CRYPT_MODE_CFB:
516
+ case CRYPT_MODE_OFB:
517
+ case CRYPT_MODE_STREAM:
518
+ $this->mode = $mode;
519
+ break;
520
+ case CRYPT_MODE_CBC:
521
+ default:
522
+ $this->paddable = true;
523
+ $this->mode = CRYPT_MODE_CBC;
524
+ }
525
+
526
+ $this->_setEngine();
527
+
528
+ // Determining whether inline crypting can be used by the cipher
529
+ if ($this->use_inline_crypt !== false) {
530
+ $this->use_inline_crypt = version_compare(PHP_VERSION, '5.3.0') >= 0 || function_exists('create_function');
531
+ }
532
+ }
533
+
534
+ /**
535
+ * PHP4 compatible Default Constructor.
536
+ *
537
+ * @see self::__construct()
538
+ * @param int $mode
539
+ * @access public
540
+ */
541
+ function Crypt_Base($mode = CRYPT_MODE_CBC)
542
+ {
543
+ $this->__construct($mode);
544
+ }
545
+
546
+ /**
547
+ * Sets the initialization vector. (optional)
548
+ *
549
+ * SetIV is not required when CRYPT_MODE_ECB (or ie for AES: CRYPT_AES_MODE_ECB) is being used. If not explicitly set, it'll be assumed
550
+ * to be all zero's.
551
+ *
552
+ * @access public
553
+ * @param string $iv
554
+ * @internal Can be overwritten by a sub class, but does not have to be
555
+ */
556
+ function setIV($iv)
557
+ {
558
+ if ($this->mode == CRYPT_MODE_ECB) {
559
+ return;
560
+ }
561
+
562
+ $this->iv = $iv;
563
+ $this->changed = true;
564
+ }
565
+
566
+ /**
567
+ * Sets the key length.
568
+ *
569
+ * Keys with explicitly set lengths need to be treated accordingly
570
+ *
571
+ * @access public
572
+ * @param int $length
573
+ */
574
+ function setKeyLength($length)
575
+ {
576
+ $this->explicit_key_length = true;
577
+ $this->changed = true;
578
+ $this->_setEngine();
579
+ }
580
+
581
+ /**
582
+ * Returns the current key length in bits
583
+ *
584
+ * @access public
585
+ * @return int
586
+ */
587
+ function getKeyLength()
588
+ {
589
+ return $this->key_length << 3;
590
+ }
591
+
592
+ /**
593
+ * Returns the current block length in bits
594
+ *
595
+ * @access public
596
+ * @return int
597
+ */
598
+ function getBlockLength()
599
+ {
600
+ return $this->block_size << 3;
601
+ }
602
+
603
+ /**
604
+ * Sets the key.
605
+ *
606
+ * The min/max length(s) of the key depends on the cipher which is used.
607
+ * If the key not fits the length(s) of the cipher it will paded with null bytes
608
+ * up to the closest valid key length. If the key is more than max length,
609
+ * we trim the excess bits.
610
+ *
611
+ * If the key is not explicitly set, it'll be assumed to be all null bytes.
612
+ *
613
+ * @access public
614
+ * @param string $key
615
+ * @internal Could, but not must, extend by the child Crypt_* class
616
+ */
617
+ function setKey($key)
618
+ {
619
+ if (!$this->explicit_key_length) {
620
+ $this->setKeyLength(strlen($key) << 3);
621
+ $this->explicit_key_length = false;
622
+ }
623
+
624
+ $this->key = $key;
625
+ $this->changed = true;
626
+ $this->_setEngine();
627
+ }
628
+
629
+ /**
630
+ * Sets the password.
631
+ *
632
+ * Depending on what $method is set to, setPassword()'s (optional) parameters are as follows:
633
+ * {@link http://en.wikipedia.org/wiki/PBKDF2 pbkdf2} or pbkdf1:
634
+ * $hash, $salt, $count, $dkLen
635
+ *
636
+ * Where $hash (default = sha1) currently supports the following hashes: see: Crypt/Hash.php
637
+ *
638
+ * @see Crypt/Hash.php
639
+ * @param string $password
640
+ * @param string $method
641
+ * @return bool
642
+ * @access public
643
+ * @internal Could, but not must, extend by the child Crypt_* class
644
+ */
645
+ function setPassword($password, $method = 'pbkdf2')
646
+ {
647
+ $key = '';
648
+
649
+ switch ($method) {
650
+ default: // 'pbkdf2' or 'pbkdf1'
651
+ $func_args = func_get_args();
652
+
653
+ // Hash function
654
+ $hash = isset($func_args[2]) ? $func_args[2] : 'sha1';
655
+
656
+ // WPA and WPA2 use the SSID as the salt
657
+ $salt = isset($func_args[3]) ? $func_args[3] : $this->password_default_salt;
658
+
659
+ // RFC2898#section-4.2 uses 1,000 iterations by default
660
+ // WPA and WPA2 use 4,096.
661
+ $count = isset($func_args[4]) ? $func_args[4] : 1000;
662
+
663
+ // Keylength
664
+ if (isset($func_args[5]) && $func_args[5] > 0) {
665
+ $dkLen = $func_args[5];
666
+ } else {
667
+ $dkLen = $method == 'pbkdf1' ? 2 * $this->key_length : $this->key_length;
668
+ }
669
+
670
+ switch (true) {
671
+ case $method == 'pbkdf1':
672
+ if (!class_exists('Crypt_Hash')) {
673
+ include_once 'Crypt/Hash.php';
674
+ }
675
+ $hashObj = new Crypt_Hash();
676
+ $hashObj->setHash($hash);
677
+ if ($dkLen > $hashObj->getLength()) {
678
+ user_error('Derived key too long');
679
+ return false;
680
+ }
681
+ $t = $password . $salt;
682
+ for ($i = 0; $i < $count; ++$i) {
683
+ $t = $hashObj->hash($t);
684
+ }
685
+ $key = substr($t, 0, $dkLen);
686
+
687
+ $this->setKey(substr($key, 0, $dkLen >> 1));
688
+ $this->setIV(substr($key, $dkLen >> 1));
689
+
690
+ return true;
691
+ // Determining if php[>=5.5.0]'s hash_pbkdf2() function avail- and useable
692
+ case !function_exists('hash_pbkdf2'):
693
+ case !function_exists('hash_algos'):
694
+ case !in_array($hash, hash_algos()):
695
+ if (!class_exists('Crypt_Hash')) {
696
+ include_once 'Crypt/Hash.php';
697
+ }
698
+ $i = 1;
699
+ $hmac = new Crypt_Hash();
700
+ $hmac->setHash($hash);
701
+ $hmac->setKey($password);
702
+ while (strlen($key) < $dkLen) {
703
+ $f = $u = $hmac->hash($salt . pack('N', $i++));
704
+ for ($j = 2; $j <= $count; ++$j) {
705
+ $u = $hmac->hash($u);
706
+ $f^= $u;
707
+ }
708
+ $key.= $f;
709
+ }
710
+ $key = substr($key, 0, $dkLen);
711
+ break;
712
+ default:
713
+ $key = hash_pbkdf2($hash, $password, $salt, $count, $dkLen, true);
714
+ }
715
+ }
716
+
717
+ $this->setKey($key);
718
+
719
+ return true;
720
+ }
721
+
722
+ /**
723
+ * Encrypts a message.
724
+ *
725
+ * $plaintext will be padded with additional bytes such that it's length is a multiple of the block size. Other cipher
726
+ * implementations may or may not pad in the same manner. Other common approaches to padding and the reasons why it's
727
+ * necessary are discussed in the following
728
+ * URL:
729
+ *
730
+ * {@link http://www.di-mgt.com.au/cryptopad.html http://www.di-mgt.com.au/cryptopad.html}
731
+ *
732
+ * An alternative to padding is to, separately, send the length of the file. This is what SSH, in fact, does.
733
+ * strlen($plaintext) will still need to be a multiple of the block size, however, arbitrary values can be added to make it that
734
+ * length.
735
+ *
736
+ * @see self::decrypt()
737
+ * @access public
738
+ * @param string $plaintext
739
+ * @return string $ciphertext
740
+ * @internal Could, but not must, extend by the child Crypt_* class
741
+ */
742
+ function encrypt($plaintext)
743
+ {
744
+ if ($this->paddable) {
745
+ $plaintext = $this->_pad($plaintext);
746
+ }
747
+
748
+ if ($this->engine === CRYPT_ENGINE_OPENSSL) {
749
+ if ($this->changed) {
750
+ $this->_clearBuffers();
751
+ $this->changed = false;
752
+ }
753
+ switch ($this->mode) {
754
+ case CRYPT_MODE_STREAM:
755
+ return openssl_encrypt($plaintext, $this->cipher_name_openssl, $this->key, $this->openssl_options);
756
+ case CRYPT_MODE_ECB:
757
+ $result = openssl_encrypt($plaintext, $this->cipher_name_openssl, $this->key, $this->openssl_options);
758
+ return !defined('OPENSSL_RAW_DATA') ? substr($result, 0, -$this->block_size) : $result;
759
+ case CRYPT_MODE_CBC:
760
+ $result = openssl_encrypt($plaintext, $this->cipher_name_openssl, $this->key, $this->openssl_options, $this->encryptIV);
761
+ if (!defined('OPENSSL_RAW_DATA')) {
762
+ $result = substr($result, 0, -$this->block_size);
763
+ }
764
+ if ($this->continuousBuffer) {
765
+ $this->encryptIV = substr($result, -$this->block_size);
766
+ }
767
+ return $result;
768
+ case CRYPT_MODE_CTR:
769
+ return $this->_openssl_ctr_process($plaintext, $this->encryptIV, $this->enbuffer);
770
+ case CRYPT_MODE_CFB:
771
+ // cfb loosely routines inspired by openssl's:
772
+ // {@link http://cvs.openssl.org/fileview?f=openssl/crypto/modes/cfb128.c&v=1.3.2.2.2.1}
773
+ $ciphertext = '';
774
+ if ($this->continuousBuffer) {
775
+ $iv = &$this->encryptIV;
776
+ $pos = &$this->enbuffer['pos'];
777
+ } else {
778
+ $iv = $this->encryptIV;
779
+ $pos = 0;
780
+ }
781
+ $len = strlen($plaintext);
782
+ $i = 0;
783
+ if ($pos) {
784
+ $orig_pos = $pos;
785
+ $max = $this->block_size - $pos;
786
+ if ($len >= $max) {
787
+ $i = $max;
788
+ $len-= $max;
789
+ $pos = 0;
790
+ } else {
791
+ $i = $len;
792
+ $pos+= $len;
793
+ $len = 0;
794
+ }
795
+ // ie. $i = min($max, $len), $len-= $i, $pos+= $i, $pos%= $blocksize
796
+ $ciphertext = substr($iv, $orig_pos) ^ $plaintext;
797
+ $iv = substr_replace($iv, $ciphertext, $orig_pos, $i);
798
+ $plaintext = substr($plaintext, $i);
799
+ }
800
+
801
+ $overflow = $len % $this->block_size;
802
+
803
+ if ($overflow) {
804
+ $ciphertext.= openssl_encrypt(substr($plaintext, 0, -$overflow) . str_repeat("\0", $this->block_size), $this->cipher_name_openssl, $this->key, $this->openssl_options, $iv);
805
+ $iv = $this->_string_pop($ciphertext, $this->block_size);
806
+
807
+ $size = $len - $overflow;
808
+ $block = $iv ^ substr($plaintext, -$overflow);
809
+ $iv = substr_replace($iv, $block, 0, $overflow);
810
+ $ciphertext.= $block;
811
+ $pos = $overflow;
812
+ } elseif ($len) {
813
+ $ciphertext = openssl_encrypt($plaintext, $this->cipher_name_openssl, $this->key, $this->openssl_options, $iv);
814
+ $iv = substr($ciphertext, -$this->block_size);
815
+ }
816
+
817
+ return $ciphertext;
818
+ case CRYPT_MODE_OFB:
819
+ return $this->_openssl_ofb_process($plaintext, $this->encryptIV, $this->enbuffer);
820
+ }
821
+ }
822
+
823
+ if ($this->engine === CRYPT_ENGINE_MCRYPT) {
824
+ if ($this->changed) {
825
+ $this->_setupMcrypt();
826
+ $this->changed = false;
827
+ }
828
+ if ($this->enchanged) {
829
+ @mcrypt_generic_init($this->enmcrypt, $this->key, $this->encryptIV);
830
+ $this->enchanged = false;
831
+ }
832
+
833
+ // re: {@link http://phpseclib.sourceforge.net/cfb-demo.phps}
834
+ // using mcrypt's default handing of CFB the above would output two different things. using phpseclib's
835
+ // rewritten CFB implementation the above outputs the same thing twice.
836
+ if ($this->mode == CRYPT_MODE_CFB && $this->continuousBuffer) {
837
+ $block_size = $this->block_size;
838
+ $iv = &$this->encryptIV;
839
+ $pos = &$this->enbuffer['pos'];
840
+ $len = strlen($plaintext);
841
+ $ciphertext = '';
842
+ $i = 0;
843
+ if ($pos) {
844
+ $orig_pos = $pos;
845
+ $max = $block_size - $pos;
846
+ if ($len >= $max) {
847
+ $i = $max;
848
+ $len-= $max;
849
+ $pos = 0;
850
+ } else {
851
+ $i = $len;
852
+ $pos+= $len;
853
+ $len = 0;
854
+ }
855
+ $ciphertext = substr($iv, $orig_pos) ^ $plaintext;
856
+ $iv = substr_replace($iv, $ciphertext, $orig_pos, $i);
857
+ $this->enbuffer['enmcrypt_init'] = true;
858
+ }
859
+ if ($len >= $block_size) {
860
+ if ($this->enbuffer['enmcrypt_init'] === false || $len > $this->cfb_init_len) {
861
+ if ($this->enbuffer['enmcrypt_init'] === true) {
862
+ @mcrypt_generic_init($this->enmcrypt, $this->key, $iv);
863
+ $this->enbuffer['enmcrypt_init'] = false;
864
+ }
865
+ $ciphertext.= @mcrypt_generic($this->enmcrypt, substr($plaintext, $i, $len - $len % $block_size));
866
+ $iv = substr($ciphertext, -$block_size);
867
+ $len%= $block_size;
868
+ } else {
869
+ while ($len >= $block_size) {
870
+ $iv = @mcrypt_generic($this->ecb, $iv) ^ substr($plaintext, $i, $block_size);
871
+ $ciphertext.= $iv;
872
+ $len-= $block_size;
873
+ $i+= $block_size;
874
+ }
875
+ }
876
+ }
877
+
878
+ if ($len) {
879
+ $iv = @mcrypt_generic($this->ecb, $iv);
880
+ $block = $iv ^ substr($plaintext, -$len);
881
+ $iv = substr_replace($iv, $block, 0, $len);
882
+ $ciphertext.= $block;
883
+ $pos = $len;
884
+ }
885
+
886
+ return $ciphertext;
887
+ }
888
+
889
+ $ciphertext = @mcrypt_generic($this->enmcrypt, $plaintext);
890
+
891
+ if (!$this->continuousBuffer) {
892
+ @mcrypt_generic_init($this->enmcrypt, $this->key, $this->encryptIV);
893
+ }
894
+
895
+ return $ciphertext;
896
+ }
897
+
898
+ if ($this->changed) {
899
+ $this->_setup();
900
+ $this->changed = false;
901
+ }
902
+ if ($this->use_inline_crypt) {
903
+ $inline = $this->inline_crypt;
904
+ return $inline('encrypt', $this, $plaintext);
905
+ }
906
+
907
+ $buffer = &$this->enbuffer;
908
+ $block_size = $this->block_size;
909
+ $ciphertext = '';
910
+ switch ($this->mode) {
911
+ case CRYPT_MODE_ECB:
912
+ for ($i = 0; $i < strlen($plaintext); $i+=$block_size) {
913
+ $ciphertext.= $this->_encryptBlock(substr($plaintext, $i, $block_size));
914
+ }
915
+ break;
916
+ case CRYPT_MODE_CBC:
917
+ $xor = $this->encryptIV;
918
+ for ($i = 0; $i < strlen($plaintext); $i+=$block_size) {
919
+ $block = substr($plaintext, $i, $block_size);
920
+ $block = $this->_encryptBlock($block ^ $xor);
921
+ $xor = $block;
922
+ $ciphertext.= $block;
923
+ }
924
+ if ($this->continuousBuffer) {
925
+ $this->encryptIV = $xor;
926
+ }
927
+ break;
928
+ case CRYPT_MODE_CTR:
929
+ $xor = $this->encryptIV;
930
+ if (strlen($buffer['ciphertext'])) {
931
+ for ($i = 0; $i < strlen($plaintext); $i+=$block_size) {
932
+ $block = substr($plaintext, $i, $block_size);
933
+ if (strlen($block) > strlen($buffer['ciphertext'])) {
934
+ $buffer['ciphertext'].= $this->_encryptBlock($xor);
935
+ }
936
+ $this->_increment_str($xor);
937
+ $key = $this->_string_shift($buffer['ciphertext'], $block_size);
938
+ $ciphertext.= $block ^ $key;
939
+ }
940
+ } else {
941
+ for ($i = 0; $i < strlen($plaintext); $i+=$block_size) {
942
+ $block = substr($plaintext, $i, $block_size);
943
+ $key = $this->_encryptBlock($xor);
944
+ $this->_increment_str($xor);
945
+ $ciphertext.= $block ^ $key;
946
+ }
947
+ }
948
+ if ($this->continuousBuffer) {
949
+ $this->encryptIV = $xor;
950
+ if ($start = strlen($plaintext) % $block_size) {
951
+ $buffer['ciphertext'] = substr($key, $start) . $buffer['ciphertext'];
952
+ }
953
+ }
954
+ break;
955
+ case CRYPT_MODE_CFB:
956
+ // cfb loosely routines inspired by openssl's:
957
+ // {@link http://cvs.openssl.org/fileview?f=openssl/crypto/modes/cfb128.c&v=1.3.2.2.2.1}
958
+ if ($this->continuousBuffer) {
959
+ $iv = &$this->encryptIV;
960
+ $pos = &$buffer['pos'];
961
+ } else {
962
+ $iv = $this->encryptIV;
963
+ $pos = 0;
964
+ }
965
+ $len = strlen($plaintext);
966
+ $i = 0;
967
+ if ($pos) {
968
+ $orig_pos = $pos;
969
+ $max = $block_size - $pos;
970
+ if ($len >= $max) {
971
+ $i = $max;
972
+ $len-= $max;
973
+ $pos = 0;
974
+ } else {
975
+ $i = $len;
976
+ $pos+= $len;
977
+ $len = 0;
978
+ }
979
+ // ie. $i = min($max, $len), $len-= $i, $pos+= $i, $pos%= $blocksize
980
+ $ciphertext = substr($iv, $orig_pos) ^ $plaintext;
981
+ $iv = substr_replace($iv, $ciphertext, $orig_pos, $i);
982
+ }
983
+ while ($len >= $block_size) {
984
+ $iv = $this->_encryptBlock($iv) ^ substr($plaintext, $i, $block_size);
985
+ $ciphertext.= $iv;
986
+ $len-= $block_size;
987
+ $i+= $block_size;
988
+ }
989
+ if ($len) {
990
+ $iv = $this->_encryptBlock($iv);
991
+ $block = $iv ^ substr($plaintext, $i);
992
+ $iv = substr_replace($iv, $block, 0, $len);
993
+ $ciphertext.= $block;
994
+ $pos = $len;
995
+ }
996
+ break;
997
+ case CRYPT_MODE_OFB:
998
+ $xor = $this->encryptIV;
999
+ if (strlen($buffer['xor'])) {
1000
+ for ($i = 0; $i < strlen($plaintext); $i+=$block_size) {
1001
+ $block = substr($plaintext, $i, $block_size);
1002
+ if (strlen($block) > strlen($buffer['xor'])) {
1003
+ $xor = $this->_encryptBlock($xor);
1004
+ $buffer['xor'].= $xor;
1005
+ }
1006
+ $key = $this->_string_shift($buffer['xor'], $block_size);
1007
+ $ciphertext.= $block ^ $key;
1008
+ }
1009
+ } else {
1010
+ for ($i = 0; $i < strlen($plaintext); $i+=$block_size) {
1011
+ $xor = $this->_encryptBlock($xor);
1012
+ $ciphertext.= substr($plaintext, $i, $block_size) ^ $xor;
1013
+ }
1014
+ $key = $xor;
1015
+ }
1016
+ if ($this->continuousBuffer) {
1017
+ $this->encryptIV = $xor;
1018
+ if ($start = strlen($plaintext) % $block_size) {
1019
+ $buffer['xor'] = substr($key, $start) . $buffer['xor'];
1020
+ }
1021
+ }
1022
+ break;
1023
+ case CRYPT_MODE_STREAM:
1024
+ $ciphertext = $this->_encryptBlock($plaintext);
1025
+ break;
1026
+ }
1027
+
1028
+ return $ciphertext;
1029
+ }
1030
+
1031
+ /**
1032
+ * Decrypts a message.
1033
+ *
1034
+ * If strlen($ciphertext) is not a multiple of the block size, null bytes will be added to the end of the string until
1035
+ * it is.
1036
+ *
1037
+ * @see self::encrypt()
1038
+ * @access public
1039
+ * @param string $ciphertext
1040
+ * @return string $plaintext
1041
+ * @internal Could, but not must, extend by the child Crypt_* class
1042
+ */
1043
+ function decrypt($ciphertext)
1044
+ {
1045
+ if ($this->paddable) {
1046
+ // we pad with chr(0) since that's what mcrypt_generic does. to quote from {@link http://www.php.net/function.mcrypt-generic}:
1047
+ // "The data is padded with "\0" to make sure the length of the data is n * blocksize."
1048
+ $ciphertext = str_pad($ciphertext, strlen($ciphertext) + ($this->block_size - strlen($ciphertext) % $this->block_size) % $this->block_size, chr(0));
1049
+ }
1050
+
1051
+ if ($this->engine === CRYPT_ENGINE_OPENSSL) {
1052
+ if ($this->changed) {
1053
+ $this->_clearBuffers();
1054
+ $this->changed = false;
1055
+ }
1056
+ switch ($this->mode) {
1057
+ case CRYPT_MODE_STREAM:
1058
+ $plaintext = openssl_decrypt($ciphertext, $this->cipher_name_openssl, $this->key, $this->openssl_options);
1059
+ break;
1060
+ case CRYPT_MODE_ECB:
1061
+ if (!defined('OPENSSL_RAW_DATA')) {
1062
+ $ciphertext.= openssl_encrypt('', $this->cipher_name_openssl_ecb, $this->key, true);
1063
+ }
1064
+ $plaintext = openssl_decrypt($ciphertext, $this->cipher_name_openssl, $this->key, $this->openssl_options);
1065
+ break;
1066
+ case CRYPT_MODE_CBC:
1067
+ if (!defined('OPENSSL_RAW_DATA')) {
1068
+ $padding = str_repeat(chr($this->block_size), $this->block_size) ^ substr($ciphertext, -$this->block_size);
1069
+ $ciphertext.= substr(openssl_encrypt($padding, $this->cipher_name_openssl_ecb, $this->key, true), 0, $this->block_size);
1070
+ $offset = 2 * $this->block_size;
1071
+ } else {
1072
+ $offset = $this->block_size;
1073
+ }
1074
+ $plaintext = openssl_decrypt($ciphertext, $this->cipher_name_openssl, $this->key, $this->openssl_options, $this->decryptIV);
1075
+ if ($this->continuousBuffer) {
1076
+ $this->decryptIV = substr($ciphertext, -$offset, $this->block_size);
1077
+ }
1078
+ break;
1079
+ case CRYPT_MODE_CTR:
1080
+ $plaintext = $this->_openssl_ctr_process($ciphertext, $this->decryptIV, $this->debuffer);
1081
+ break;
1082
+ case CRYPT_MODE_CFB:
1083
+ // cfb loosely routines inspired by openssl's:
1084
+ // {@link http://cvs.openssl.org/fileview?f=openssl/crypto/modes/cfb128.c&v=1.3.2.2.2.1}
1085
+ $plaintext = '';
1086
+ if ($this->continuousBuffer) {
1087
+ $iv = &$this->decryptIV;
1088
+ $pos = &$this->buffer['pos'];
1089
+ } else {
1090
+ $iv = $this->decryptIV;
1091
+ $pos = 0;
1092
+ }
1093
+ $len = strlen($ciphertext);
1094
+ $i = 0;
1095
+ if ($pos) {
1096
+ $orig_pos = $pos;
1097
+ $max = $this->block_size - $pos;
1098
+ if ($len >= $max) {
1099
+ $i = $max;
1100
+ $len-= $max;
1101
+ $pos = 0;
1102
+ } else {
1103
+ $i = $len;
1104
+ $pos+= $len;
1105
+ $len = 0;
1106
+ }
1107
+ // ie. $i = min($max, $len), $len-= $i, $pos+= $i, $pos%= $this->blocksize
1108
+ $plaintext = substr($iv, $orig_pos) ^ $ciphertext;
1109
+ $iv = substr_replace($iv, substr($ciphertext, 0, $i), $orig_pos, $i);
1110
+ $ciphertext = substr($ciphertext, $i);
1111
+ }
1112
+ $overflow = $len % $this->block_size;
1113
+ if ($overflow) {
1114
+ $plaintext.= openssl_decrypt(substr($ciphertext, 0, -$overflow), $this->cipher_name_openssl, $this->key, $this->openssl_options, $iv);
1115
+ if ($len - $overflow) {
1116
+ $iv = substr($ciphertext, -$overflow - $this->block_size, -$overflow);
1117
+ }
1118
+ $iv = openssl_encrypt(str_repeat("\0", $this->block_size), $this->cipher_name_openssl, $this->key, $this->openssl_options, $iv);
1119
+ $plaintext.= $iv ^ substr($ciphertext, -$overflow);
1120
+ $iv = substr_replace($iv, substr($ciphertext, -$overflow), 0, $overflow);
1121
+ $pos = $overflow;
1122
+ } elseif ($len) {
1123
+ $plaintext.= openssl_decrypt($ciphertext, $this->cipher_name_openssl, $this->key, $this->openssl_options, $iv);
1124
+ $iv = substr($ciphertext, -$this->block_size);
1125
+ }
1126
+ break;
1127
+ case CRYPT_MODE_OFB:
1128
+ $plaintext = $this->_openssl_ofb_process($ciphertext, $this->decryptIV, $this->debuffer);
1129
+ }
1130
+
1131
+ return $this->paddable ? $this->_unpad($plaintext) : $plaintext;
1132
+ }
1133
+
1134
+ if ($this->engine === CRYPT_ENGINE_MCRYPT) {
1135
+ $block_size = $this->block_size;
1136
+ if ($this->changed) {
1137
+ $this->_setupMcrypt();
1138
+ $this->changed = false;
1139
+ }
1140
+ if ($this->dechanged) {
1141
+ @mcrypt_generic_init($this->demcrypt, $this->key, $this->decryptIV);
1142
+ $this->dechanged = false;
1143
+ }
1144
+
1145
+ if ($this->mode == CRYPT_MODE_CFB && $this->continuousBuffer) {
1146
+ $iv = &$this->decryptIV;
1147
+ $pos = &$this->debuffer['pos'];
1148
+ $len = strlen($ciphertext);
1149
+ $plaintext = '';
1150
+ $i = 0;
1151
+ if ($pos) {
1152
+ $orig_pos = $pos;
1153
+ $max = $block_size - $pos;
1154
+ if ($len >= $max) {
1155
+ $i = $max;
1156
+ $len-= $max;
1157
+ $pos = 0;
1158
+ } else {
1159
+ $i = $len;
1160
+ $pos+= $len;
1161
+ $len = 0;
1162
+ }
1163
+ // ie. $i = min($max, $len), $len-= $i, $pos+= $i, $pos%= $blocksize
1164
+ $plaintext = substr($iv, $orig_pos) ^ $ciphertext;
1165
+ $iv = substr_replace($iv, substr($ciphertext, 0, $i), $orig_pos, $i);
1166
+ }
1167
+ if ($len >= $block_size) {
1168
+ $cb = substr($ciphertext, $i, $len - $len % $block_size);
1169
+ $plaintext.= @mcrypt_generic($this->ecb, $iv . $cb) ^ $cb;
1170
+ $iv = substr($cb, -$block_size);
1171
+ $len%= $block_size;
1172
+ }
1173
+ if ($len) {
1174
+ $iv = @mcrypt_generic($this->ecb, $iv);
1175
+ $plaintext.= $iv ^ substr($ciphertext, -$len);
1176
+ $iv = substr_replace($iv, substr($ciphertext, -$len), 0, $len);
1177
+ $pos = $len;
1178
+ }
1179
+
1180
+ return $plaintext;
1181
+ }
1182
+
1183
+ $plaintext = @mdecrypt_generic($this->demcrypt, $ciphertext);
1184
+
1185
+ if (!$this->continuousBuffer) {
1186
+ @mcrypt_generic_init($this->demcrypt, $this->key, $this->decryptIV);
1187
+ }
1188
+
1189
+ return $this->paddable ? $this->_unpad($plaintext) : $plaintext;
1190
+ }
1191
+
1192
+ if ($this->changed) {
1193
+ $this->_setup();
1194
+ $this->changed = false;
1195
+ }
1196
+ if ($this->use_inline_crypt) {
1197
+ $inline = $this->inline_crypt;
1198
+ return $inline('decrypt', $this, $ciphertext);
1199
+ }
1200
+
1201
+ $block_size = $this->block_size;
1202
+
1203
+ $buffer = &$this->debuffer;
1204
+ $plaintext = '';
1205
+ switch ($this->mode) {
1206
+ case CRYPT_MODE_ECB:
1207
+ for ($i = 0; $i < strlen($ciphertext); $i+=$block_size) {
1208
+ $plaintext.= $this->_decryptBlock(substr($ciphertext, $i, $block_size));
1209
+ }
1210
+ break;
1211
+ case CRYPT_MODE_CBC:
1212
+ $xor = $this->decryptIV;
1213
+ for ($i = 0; $i < strlen($ciphertext); $i+=$block_size) {
1214
+ $block = substr($ciphertext, $i, $block_size);
1215
+ $plaintext.= $this->_decryptBlock($block) ^ $xor;
1216
+ $xor = $block;
1217
+ }
1218
+ if ($this->continuousBuffer) {
1219
+ $this->decryptIV = $xor;
1220
+ }
1221
+ break;
1222
+ case CRYPT_MODE_CTR:
1223
+ $xor = $this->decryptIV;
1224
+ if (strlen($buffer['ciphertext'])) {
1225
+ for ($i = 0; $i < strlen($ciphertext); $i+=$block_size) {
1226
+ $block = substr($ciphertext, $i, $block_size);
1227
+ if (strlen($block) > strlen($buffer['ciphertext'])) {
1228
+ $buffer['ciphertext'].= $this->_encryptBlock($xor);
1229
+ $this->_increment_str($xor);
1230
+ }
1231
+ $key = $this->_string_shift($buffer['ciphertext'], $block_size);
1232
+ $plaintext.= $block ^ $key;
1233
+ }
1234
+ } else {
1235
+ for ($i = 0; $i < strlen($ciphertext); $i+=$block_size) {
1236
+ $block = substr($ciphertext, $i, $block_size);
1237
+ $key = $this->_encryptBlock($xor);
1238
+ $this->_increment_str($xor);
1239
+ $plaintext.= $block ^ $key;
1240
+ }
1241
+ }
1242
+ if ($this->continuousBuffer) {
1243
+ $this->decryptIV = $xor;
1244
+ if ($start = strlen($ciphertext) % $block_size) {
1245
+ $buffer['ciphertext'] = substr($key, $start) . $buffer['ciphertext'];
1246
+ }
1247
+ }
1248
+ break;
1249
+ case CRYPT_MODE_CFB:
1250
+ if ($this->continuousBuffer) {
1251
+ $iv = &$this->decryptIV;
1252
+ $pos = &$buffer['pos'];
1253
+ } else {
1254
+ $iv = $this->decryptIV;
1255
+ $pos = 0;
1256
+ }
1257
+ $len = strlen($ciphertext);
1258
+ $i = 0;
1259
+ if ($pos) {
1260
+ $orig_pos = $pos;
1261
+ $max = $block_size - $pos;
1262
+ if ($len >= $max) {
1263
+ $i = $max;
1264
+ $len-= $max;
1265
+ $pos = 0;
1266
+ } else {
1267
+ $i = $len;
1268
+ $pos+= $len;
1269
+ $len = 0;
1270
+ }
1271
+ // ie. $i = min($max, $len), $len-= $i, $pos+= $i, $pos%= $blocksize
1272
+ $plaintext = substr($iv, $orig_pos) ^ $ciphertext;
1273
+ $iv = substr_replace($iv, substr($ciphertext, 0, $i), $orig_pos, $i);
1274
+ }
1275
+ while ($len >= $block_size) {
1276
+ $iv = $this->_encryptBlock($iv);
1277
+ $cb = substr($ciphertext, $i, $block_size);
1278
+ $plaintext.= $iv ^ $cb;
1279
+ $iv = $cb;
1280
+ $len-= $block_size;
1281
+ $i+= $block_size;
1282
+ }
1283
+ if ($len) {
1284
+ $iv = $this->_encryptBlock($iv);
1285
+ $plaintext.= $iv ^ substr($ciphertext, $i);
1286
+ $iv = substr_replace($iv, substr($ciphertext, $i), 0, $len);
1287
+ $pos = $len;
1288
+ }
1289
+ break;
1290
+ case CRYPT_MODE_OFB:
1291
+ $xor = $this->decryptIV;
1292
+ if (strlen($buffer['xor'])) {
1293
+ for ($i = 0; $i < strlen($ciphertext); $i+=$block_size) {
1294
+ $block = substr($ciphertext, $i, $block_size);
1295
+ if (strlen($block) > strlen($buffer['xor'])) {
1296
+ $xor = $this->_encryptBlock($xor);
1297
+ $buffer['xor'].= $xor;
1298
+ }
1299
+ $key = $this->_string_shift($buffer['xor'], $block_size);
1300
+ $plaintext.= $block ^ $key;
1301
+ }
1302
+ } else {
1303
+ for ($i = 0; $i < strlen($ciphertext); $i+=$block_size) {
1304
+ $xor = $this->_encryptBlock($xor);
1305
+ $plaintext.= substr($ciphertext, $i, $block_size) ^ $xor;
1306
+ }
1307
+ $key = $xor;
1308
+ }
1309
+ if ($this->continuousBuffer) {
1310
+ $this->decryptIV = $xor;
1311
+ if ($start = strlen($ciphertext) % $block_size) {
1312
+ $buffer['xor'] = substr($key, $start) . $buffer['xor'];
1313
+ }
1314
+ }
1315
+ break;
1316
+ case CRYPT_MODE_STREAM:
1317
+ $plaintext = $this->_decryptBlock($ciphertext);
1318
+ break;
1319
+ }
1320
+ return $this->paddable ? $this->_unpad($plaintext) : $plaintext;
1321
+ }
1322
+
1323
+ /**
1324
+ * OpenSSL CTR Processor
1325
+ *
1326
+ * PHP's OpenSSL bindings do not operate in continuous mode so we'll wrap around it. Since the keystream
1327
+ * for CTR is the same for both encrypting and decrypting this function is re-used by both Crypt_Base::encrypt()
1328
+ * and Crypt_Base::decrypt(). Also, OpenSSL doesn't implement CTR for all of it's symmetric ciphers so this
1329
+ * function will emulate CTR with ECB when necessary.
1330
+ *
1331
+ * @see self::encrypt()
1332
+ * @see self::decrypt()
1333
+ * @param string $plaintext
1334
+ * @param string $encryptIV
1335
+ * @param array $buffer
1336
+ * @return string
1337
+ * @access private
1338
+ */
1339
+ function _openssl_ctr_process($plaintext, &$encryptIV, &$buffer)
1340
+ {
1341
+ $ciphertext = '';
1342
+
1343
+ $block_size = $this->block_size;
1344
+ $key = $this->key;
1345
+
1346
+ if ($this->openssl_emulate_ctr) {
1347
+ $xor = $encryptIV;
1348
+ if (strlen($buffer['ciphertext'])) {
1349
+ for ($i = 0; $i < strlen($plaintext); $i+=$block_size) {
1350
+ $block = substr($plaintext, $i, $block_size);
1351
+ if (strlen($block) > strlen($buffer['ciphertext'])) {
1352
+ $result = openssl_encrypt($xor, $this->cipher_name_openssl_ecb, $key, $this->openssl_options);
1353
+ $result = !defined('OPENSSL_RAW_DATA') ? substr($result, 0, -$this->block_size) : $result;
1354
+ $buffer['ciphertext'].= $result;
1355
+ }
1356
+ $this->_increment_str($xor);
1357
+ $otp = $this->_string_shift($buffer['ciphertext'], $block_size);
1358
+ $ciphertext.= $block ^ $otp;
1359
+ }
1360
+ } else {
1361
+ for ($i = 0; $i < strlen($plaintext); $i+=$block_size) {
1362
+ $block = substr($plaintext, $i, $block_size);
1363
+ $otp = openssl_encrypt($xor, $this->cipher_name_openssl_ecb, $key, $this->openssl_options);
1364
+ $otp = !defined('OPENSSL_RAW_DATA') ? substr($otp, 0, -$this->block_size) : $otp;
1365
+ $this->_increment_str($xor);
1366
+ $ciphertext.= $block ^ $otp;
1367
+ }
1368
+ }
1369
+ if ($this->continuousBuffer) {
1370
+ $encryptIV = $xor;
1371
+ if ($start = strlen($plaintext) % $block_size) {
1372
+ $buffer['ciphertext'] = substr($key, $start) . $buffer['ciphertext'];
1373
+ }
1374
+ }
1375
+
1376
+ return $ciphertext;
1377
+ }
1378
+
1379
+ if (strlen($buffer['ciphertext'])) {
1380
+ $ciphertext = $plaintext ^ $this->_string_shift($buffer['ciphertext'], strlen($plaintext));
1381
+ $plaintext = substr($plaintext, strlen($ciphertext));
1382
+
1383
+ if (!strlen($plaintext)) {
1384
+ return $ciphertext;
1385
+ }
1386
+ }
1387
+
1388
+ $overflow = strlen($plaintext) % $block_size;
1389
+ if ($overflow) {
1390
+ $plaintext2 = $this->_string_pop($plaintext, $overflow); // ie. trim $plaintext to a multiple of $block_size and put rest of $plaintext in $plaintext2
1391
+ $encrypted = openssl_encrypt($plaintext . str_repeat("\0", $block_size), $this->cipher_name_openssl, $key, $this->openssl_options, $encryptIV);
1392
+ $temp = $this->_string_pop($encrypted, $block_size);
1393
+ $ciphertext.= $encrypted . ($plaintext2 ^ $temp);
1394
+ if ($this->continuousBuffer) {
1395
+ $buffer['ciphertext'] = substr($temp, $overflow);
1396
+ $encryptIV = $temp;
1397
+ }
1398
+ } elseif (!strlen($buffer['ciphertext'])) {
1399
+ $ciphertext.= openssl_encrypt($plaintext . str_repeat("\0", $block_size), $this->cipher_name_openssl, $key, $this->openssl_options, $encryptIV);
1400
+ $temp = $this->_string_pop($ciphertext, $block_size);
1401
+ if ($this->continuousBuffer) {
1402
+ $encryptIV = $temp;
1403
+ }
1404
+ }
1405
+ if ($this->continuousBuffer) {
1406
+ if (!defined('OPENSSL_RAW_DATA')) {
1407
+ $encryptIV.= openssl_encrypt('', $this->cipher_name_openssl_ecb, $key, $this->openssl_options);
1408
+ }
1409
+ $encryptIV = openssl_decrypt($encryptIV, $this->cipher_name_openssl_ecb, $key, $this->openssl_options);
1410
+ if ($overflow) {
1411
+ $this->_increment_str($encryptIV);
1412
+ }
1413
+ }
1414
+
1415
+ return $ciphertext;
1416
+ }
1417
+
1418
+ /**
1419
+ * OpenSSL OFB Processor
1420
+ *
1421
+ * PHP's OpenSSL bindings do not operate in continuous mode so we'll wrap around it. Since the keystream
1422
+ * for OFB is the same for both encrypting and decrypting this function is re-used by both Crypt_Base::encrypt()
1423
+ * and Crypt_Base::decrypt().
1424
+ *
1425
+ * @see self::encrypt()
1426
+ * @see self::decrypt()
1427
+ * @param string $plaintext
1428
+ * @param string $encryptIV
1429
+ * @param array $buffer
1430
+ * @return string
1431
+ * @access private
1432
+ */
1433
+ function _openssl_ofb_process($plaintext, &$encryptIV, &$buffer)
1434
+ {
1435
+ if (strlen($buffer['xor'])) {
1436
+ $ciphertext = $plaintext ^ $buffer['xor'];
1437
+ $buffer['xor'] = substr($buffer['xor'], strlen($ciphertext));
1438
+ $plaintext = substr($plaintext, strlen($ciphertext));
1439
+ } else {
1440
+ $ciphertext = '';
1441
+ }
1442
+
1443
+ $block_size = $this->block_size;
1444
+
1445
+ $len = strlen($plaintext);
1446
+ $key = $this->key;
1447
+ $overflow = $len % $block_size;
1448
+
1449
+ if (strlen($plaintext)) {
1450
+ if ($overflow) {
1451
+ $ciphertext.= openssl_encrypt(substr($plaintext, 0, -$overflow) . str_repeat("\0", $block_size), $this->cipher_name_openssl, $key, $this->openssl_options, $encryptIV);
1452
+ $xor = $this->_string_pop($ciphertext, $block_size);
1453
+ if ($this->continuousBuffer) {
1454
+ $encryptIV = $xor;
1455
+ }
1456
+ $ciphertext.= $this->_string_shift($xor, $overflow) ^ substr($plaintext, -$overflow);
1457
+ if ($this->continuousBuffer) {
1458
+ $buffer['xor'] = $xor;
1459
+ }
1460
+ } else {
1461
+ $ciphertext = openssl_encrypt($plaintext, $this->cipher_name_openssl, $key, $this->openssl_options, $encryptIV);
1462
+ if ($this->continuousBuffer) {
1463
+ $encryptIV = substr($ciphertext, -$block_size) ^ substr($plaintext, -$block_size);
1464
+ }
1465
+ }
1466
+ }
1467
+
1468
+ return $ciphertext;
1469
+ }
1470
+
1471
+ /**
1472
+ * phpseclib <-> OpenSSL Mode Mapper
1473
+ *
1474
+ * May need to be overwritten by classes extending this one in some cases
1475
+ *
1476
+ * @return int
1477
+ * @access private
1478
+ */
1479
+ function _openssl_translate_mode()
1480
+ {
1481
+ switch ($this->mode) {
1482
+ case CRYPT_MODE_ECB:
1483
+ return 'ecb';
1484
+ case CRYPT_MODE_CBC:
1485
+ return 'cbc';
1486
+ case CRYPT_MODE_CTR:
1487
+ return 'ctr';
1488
+ case CRYPT_MODE_CFB:
1489
+ return 'cfb';
1490
+ case CRYPT_MODE_OFB:
1491
+ return 'ofb';
1492
+ }
1493
+ }
1494
+
1495
+ /**
1496
+ * Pad "packets".
1497
+ *
1498
+ * Block ciphers working by encrypting between their specified [$this->]block_size at a time
1499
+ * If you ever need to encrypt or decrypt something that isn't of the proper length, it becomes necessary to
1500
+ * pad the input so that it is of the proper length.
1501
+ *
1502
+ * Padding is enabled by default. Sometimes, however, it is undesirable to pad strings. Such is the case in SSH,
1503
+ * where "packets" are padded with random bytes before being encrypted. Unpad these packets and you risk stripping
1504
+ * away characters that shouldn't be stripped away. (SSH knows how many bytes are added because the length is
1505
+ * transmitted separately)
1506
+ *
1507
+ * @see self::disablePadding()
1508
+ * @access public
1509
+ */
1510
+ function enablePadding()
1511
+ {
1512
+ $this->padding = true;
1513
+ }
1514
+
1515
+ /**
1516
+ * Do not pad packets.
1517
+ *
1518
+ * @see self::enablePadding()
1519
+ * @access public
1520
+ */
1521
+ function disablePadding()
1522
+ {
1523
+ $this->padding = false;
1524
+ }
1525
+
1526
+ /**
1527
+ * Treat consecutive "packets" as if they are a continuous buffer.
1528
+ *
1529
+ * Say you have a 32-byte plaintext $plaintext. Using the default behavior, the two following code snippets
1530
+ * will yield different outputs:
1531
+ *
1532
+ * <code>
1533
+ * echo $rijndael->encrypt(substr($plaintext, 0, 16));
1534
+ * echo $rijndael->encrypt(substr($plaintext, 16, 16));
1535
+ * </code>
1536
+ * <code>
1537
+ * echo $rijndael->encrypt($plaintext);
1538
+ * </code>
1539
+ *
1540
+ * The solution is to enable the continuous buffer. Although this will resolve the above discrepancy, it creates
1541
+ * another, as demonstrated with the following:
1542
+ *
1543
+ * <code>
1544
+ * $rijndael->encrypt(substr($plaintext, 0, 16));
1545
+ * echo $rijndael->decrypt($rijndael->encrypt(substr($plaintext, 16, 16)));
1546
+ * </code>
1547
+ * <code>
1548
+ * echo $rijndael->decrypt($rijndael->encrypt(substr($plaintext, 16, 16)));
1549
+ * </code>
1550
+ *
1551
+ * With the continuous buffer disabled, these would yield the same output. With it enabled, they yield different
1552
+ * outputs. The reason is due to the fact that the initialization vector's change after every encryption /
1553
+ * decryption round when the continuous buffer is enabled. When it's disabled, they remain constant.
1554
+ *
1555
+ * Put another way, when the continuous buffer is enabled, the state of the Crypt_*() object changes after each
1556
+ * encryption / decryption round, whereas otherwise, it'd remain constant. For this reason, it's recommended that
1557
+ * continuous buffers not be used. They do offer better security and are, in fact, sometimes required (SSH uses them),
1558
+ * however, they are also less intuitive and more likely to cause you problems.
1559
+ *
1560
+ * @see self::disableContinuousBuffer()
1561
+ * @access public
1562
+ * @internal Could, but not must, extend by the child Crypt_* class
1563
+ */
1564
+ function enableContinuousBuffer()
1565
+ {
1566
+ if ($this->mode == CRYPT_MODE_ECB) {
1567
+ return;
1568
+ }
1569
+
1570
+ $this->continuousBuffer = true;
1571
+
1572
+ $this->_setEngine();
1573
+ }
1574
+
1575
+ /**
1576
+ * Treat consecutive packets as if they are a discontinuous buffer.
1577
+ *
1578
+ * The default behavior.
1579
+ *
1580
+ * @see self::enableContinuousBuffer()
1581
+ * @access public
1582
+ * @internal Could, but not must, extend by the child Crypt_* class
1583
+ */
1584
+ function disableContinuousBuffer()
1585
+ {
1586
+ if ($this->mode == CRYPT_MODE_ECB) {
1587
+ return;
1588
+ }
1589
+ if (!$this->continuousBuffer) {
1590
+ return;
1591
+ }
1592
+
1593
+ $this->continuousBuffer = false;
1594
+ $this->changed = true;
1595
+
1596
+ $this->_setEngine();
1597
+ }
1598
+
1599
+ /**
1600
+ * Test for engine validity
1601
+ *
1602
+ * @see self::Crypt_Base()
1603
+ * @param int $engine
1604
+ * @access public
1605
+ * @return bool
1606
+ */
1607
+ function isValidEngine($engine)
1608
+ {
1609
+ switch ($engine) {
1610
+ case CRYPT_ENGINE_OPENSSL:
1611
+ if ($this->mode == CRYPT_MODE_STREAM && $this->continuousBuffer) {
1612
+ return false;
1613
+ }
1614
+ $this->openssl_emulate_ctr = false;
1615
+ $result = $this->cipher_name_openssl &&
1616
+ extension_loaded('openssl') &&
1617
+ // PHP 5.3.0 - 5.3.2 did not let you set IV's
1618
+ version_compare(PHP_VERSION, '5.3.3', '>=');
1619
+ if (!$result) {
1620
+ return false;
1621
+ }
1622
+
1623
+ // prior to PHP 5.4.0 OPENSSL_RAW_DATA and OPENSSL_ZERO_PADDING were not defined. instead of expecting an integer
1624
+ // $options openssl_encrypt expected a boolean $raw_data.
1625
+ if (!defined('OPENSSL_RAW_DATA')) {
1626
+ $this->openssl_options = true;
1627
+ } else {
1628
+ $this->openssl_options = OPENSSL_RAW_DATA | OPENSSL_ZERO_PADDING;
1629
+ }
1630
+
1631
+ $methods = openssl_get_cipher_methods();
1632
+ if (in_array($this->cipher_name_openssl, $methods)) {
1633
+ return true;
1634
+ }
1635
+ // not all of openssl's symmetric cipher's support ctr. for those
1636
+ // that don't we'll emulate it
1637
+ switch ($this->mode) {
1638
+ case CRYPT_MODE_CTR:
1639
+ if (in_array($this->cipher_name_openssl_ecb, $methods)) {
1640
+ $this->openssl_emulate_ctr = true;
1641
+ return true;
1642
+ }
1643
+ }
1644
+ return false;
1645
+ case CRYPT_ENGINE_MCRYPT:
1646
+ return $this->cipher_name_mcrypt &&
1647
+ extension_loaded('mcrypt') &&
1648
+ in_array($this->cipher_name_mcrypt, @mcrypt_list_algorithms());
1649
+ case CRYPT_ENGINE_INTERNAL:
1650
+ return true;
1651
+ }
1652
+
1653
+ return false;
1654
+ }
1655
+
1656
+ /**
1657
+ * Sets the preferred crypt engine
1658
+ *
1659
+ * Currently, $engine could be:
1660
+ *
1661
+ * - CRYPT_ENGINE_OPENSSL [very fast]
1662
+ *
1663
+ * - CRYPT_ENGINE_MCRYPT [fast]
1664
+ *
1665
+ * - CRYPT_ENGINE_INTERNAL [slow]
1666
+ *
1667
+ * If the preferred crypt engine is not available the fastest available one will be used
1668
+ *
1669
+ * @see self::Crypt_Base()
1670
+ * @param int $engine
1671
+ * @access public
1672
+ */
1673
+ function setPreferredEngine($engine)
1674
+ {
1675
+ switch ($engine) {
1676
+ //case CRYPT_ENGINE_OPENSSL:
1677
+ case CRYPT_ENGINE_MCRYPT:
1678
+ case CRYPT_ENGINE_INTERNAL:
1679
+ $this->preferredEngine = $engine;
1680
+ break;
1681
+ default:
1682
+ $this->preferredEngine = CRYPT_ENGINE_OPENSSL;
1683
+ }
1684
+
1685
+ $this->_setEngine();
1686
+ }
1687
+
1688
+ /**
1689
+ * Returns the engine currently being utilized
1690
+ *
1691
+ * @see self::_setEngine()
1692
+ * @access public
1693
+ */
1694
+ function getEngine()
1695
+ {
1696
+ return $this->engine;
1697
+ }
1698
+
1699
+ /**
1700
+ * Sets the engine as appropriate
1701
+ *
1702
+ * @see self::Crypt_Base()
1703
+ * @access private
1704
+ */
1705
+ function _setEngine()
1706
+ {
1707
+ $this->engine = null;
1708
+
1709
+ $candidateEngines = array(
1710
+ $this->preferredEngine,
1711
+ CRYPT_ENGINE_OPENSSL,
1712
+ CRYPT_ENGINE_MCRYPT
1713
+ );
1714
+ foreach ($candidateEngines as $engine) {
1715
+ if ($this->isValidEngine($engine)) {
1716
+ $this->engine = $engine;
1717
+ break;
1718
+ }
1719
+ }
1720
+ if (!$this->engine) {
1721
+ $this->engine = CRYPT_ENGINE_INTERNAL;
1722
+ }
1723
+
1724
+ if ($this->engine != CRYPT_ENGINE_MCRYPT && $this->enmcrypt) {
1725
+ // Closing the current mcrypt resource(s). _mcryptSetup() will, if needed,
1726
+ // (re)open them with the module named in $this->cipher_name_mcrypt
1727
+ @mcrypt_module_close($this->enmcrypt);
1728
+ @mcrypt_module_close($this->demcrypt);
1729
+ $this->enmcrypt = null;
1730
+ $this->demcrypt = null;
1731
+
1732
+ if ($this->ecb) {
1733
+ @mcrypt_module_close($this->ecb);
1734
+ $this->ecb = null;
1735
+ }
1736
+ }
1737
+
1738
+ $this->changed = true;
1739
+ }
1740
+
1741
+ /**
1742
+ * Encrypts a block
1743
+ *
1744
+ * @access private
1745
+ * @param string $in
1746
+ * @return string
1747
+ * @internal Must be extended by the child Crypt_* class
1748
+ */
1749
+ function _encryptBlock($in)
1750
+ {
1751
+ user_error((version_compare(PHP_VERSION, '5.0.0', '>=') ? __METHOD__ : __FUNCTION__) . '() must extend by class ' . get_class($this), E_USER_ERROR);
1752
+ }
1753
+
1754
+ /**
1755
+ * Decrypts a block
1756
+ *
1757
+ * @access private
1758
+ * @param string $in
1759
+ * @return string
1760
+ * @internal Must be extended by the child Crypt_* class
1761
+ */
1762
+ function _decryptBlock($in)
1763
+ {
1764
+ user_error((version_compare(PHP_VERSION, '5.0.0', '>=') ? __METHOD__ : __FUNCTION__) . '() must extend by class ' . get_class($this), E_USER_ERROR);
1765
+ }
1766
+
1767
+ /**
1768
+ * Setup the key (expansion)
1769
+ *
1770
+ * Only used if $engine == CRYPT_ENGINE_INTERNAL
1771
+ *
1772
+ * @see self::_setup()
1773
+ * @access private
1774
+ * @internal Must be extended by the child Crypt_* class
1775
+ */
1776
+ function _setupKey()
1777
+ {
1778
+ user_error((version_compare(PHP_VERSION, '5.0.0', '>=') ? __METHOD__ : __FUNCTION__) . '() must extend by class ' . get_class($this), E_USER_ERROR);
1779
+ }
1780
+
1781
+ /**
1782
+ * Setup the CRYPT_ENGINE_INTERNAL $engine
1783
+ *
1784
+ * (re)init, if necessary, the internal cipher $engine and flush all $buffers
1785
+ * Used (only) if $engine == CRYPT_ENGINE_INTERNAL
1786
+ *
1787
+ * _setup() will be called each time if $changed === true
1788
+ * typically this happens when using one or more of following public methods:
1789
+ *
1790
+ * - setKey()
1791
+ *
1792
+ * - setIV()
1793
+ *
1794
+ * - disableContinuousBuffer()
1795
+ *
1796
+ * - First run of encrypt() / decrypt() with no init-settings
1797
+ *
1798
+ * @see self::setKey()
1799
+ * @see self::setIV()
1800
+ * @see self::disableContinuousBuffer()
1801
+ * @access private
1802
+ * @internal _setup() is always called before en/decryption.
1803
+ * @internal Could, but not must, extend by the child Crypt_* class
1804
+ */
1805
+ function _setup()
1806
+ {
1807
+ $this->_clearBuffers();
1808
+ $this->_setupKey();
1809
+
1810
+ if ($this->use_inline_crypt) {
1811
+ $this->_setupInlineCrypt();
1812
+ }
1813
+ }
1814
+
1815
+ /**
1816
+ * Setup the CRYPT_ENGINE_MCRYPT $engine
1817
+ *
1818
+ * (re)init, if necessary, the (ext)mcrypt resources and flush all $buffers
1819
+ * Used (only) if $engine = CRYPT_ENGINE_MCRYPT
1820
+ *
1821
+ * _setupMcrypt() will be called each time if $changed === true
1822
+ * typically this happens when using one or more of following public methods:
1823
+ *
1824
+ * - setKey()
1825
+ *
1826
+ * - setIV()
1827
+ *
1828
+ * - disableContinuousBuffer()
1829
+ *
1830
+ * - First run of encrypt() / decrypt()
1831
+ *
1832
+ * @see self::setKey()
1833
+ * @see self::setIV()
1834
+ * @see self::disableContinuousBuffer()
1835
+ * @access private
1836
+ * @internal Could, but not must, extend by the child Crypt_* class
1837
+ */
1838
+ function _setupMcrypt()
1839
+ {
1840
+ $this->_clearBuffers();
1841
+ $this->enchanged = $this->dechanged = true;
1842
+
1843
+ if (!isset($this->enmcrypt)) {
1844
+ static $mcrypt_modes = array(
1845
+ CRYPT_MODE_CTR => 'ctr',
1846
+ CRYPT_MODE_ECB => MCRYPT_MODE_ECB,
1847
+ CRYPT_MODE_CBC => MCRYPT_MODE_CBC,
1848
+ CRYPT_MODE_CFB => 'ncfb',
1849
+ CRYPT_MODE_OFB => MCRYPT_MODE_NOFB,
1850
+ CRYPT_MODE_STREAM => MCRYPT_MODE_STREAM,
1851
+ );
1852
+
1853
+ $this->demcrypt = @mcrypt_module_open($this->cipher_name_mcrypt, '', $mcrypt_modes[$this->mode], '');
1854
+ $this->enmcrypt = @mcrypt_module_open($this->cipher_name_mcrypt, '', $mcrypt_modes[$this->mode], '');
1855
+
1856
+ // we need the $ecb mcrypt resource (only) in MODE_CFB with enableContinuousBuffer()
1857
+ // to workaround mcrypt's broken ncfb implementation in buffered mode
1858
+ // see: {@link http://phpseclib.sourceforge.net/cfb-demo.phps}
1859
+ if ($this->mode == CRYPT_MODE_CFB) {
1860
+ $this->ecb = @mcrypt_module_open($this->cipher_name_mcrypt, '', MCRYPT_MODE_ECB, '');
1861
+ }
1862
+ } // else should mcrypt_generic_deinit be called?
1863
+
1864
+ if ($this->mode == CRYPT_MODE_CFB) {
1865
+ @mcrypt_generic_init($this->ecb, $this->key, str_repeat("\0", $this->block_size));
1866
+ }
1867
+ }
1868
+
1869
+ /**
1870
+ * Pads a string
1871
+ *
1872
+ * Pads a string using the RSA PKCS padding standards so that its length is a multiple of the blocksize.
1873
+ * $this->block_size - (strlen($text) % $this->block_size) bytes are added, each of which is equal to
1874
+ * chr($this->block_size - (strlen($text) % $this->block_size)
1875
+ *
1876
+ * If padding is disabled and $text is not a multiple of the blocksize, the string will be padded regardless
1877
+ * and padding will, hence forth, be enabled.
1878
+ *
1879
+ * @see self::_unpad()
1880
+ * @param string $text
1881
+ * @access private
1882
+ * @return string
1883
+ */
1884
+ function _pad($text)
1885
+ {
1886
+ $length = strlen($text);
1887
+
1888
+ if (!$this->padding) {
1889
+ if ($length % $this->block_size == 0) {
1890
+ return $text;
1891
+ } else {
1892
+ user_error("The plaintext's length ($length) is not a multiple of the block size ({$this->block_size})");
1893
+ $this->padding = true;
1894
+ }
1895
+ }
1896
+
1897
+ $pad = $this->block_size - ($length % $this->block_size);
1898
+
1899
+ return str_pad($text, $length + $pad, chr($pad));
1900
+ }
1901
+
1902
+ /**
1903
+ * Unpads a string.
1904
+ *
1905
+ * If padding is enabled and the reported padding length is invalid the encryption key will be assumed to be wrong
1906
+ * and false will be returned.
1907
+ *
1908
+ * @see self::_pad()
1909
+ * @param string $text
1910
+ * @access private
1911
+ * @return string
1912
+ */
1913
+ function _unpad($text)
1914
+ {
1915
+ if (!$this->padding) {
1916
+ return $text;
1917
+ }
1918
+
1919
+ $length = ord($text[strlen($text) - 1]);
1920
+
1921
+ if (!$length || $length > $this->block_size) {
1922
+ return false;
1923
+ }
1924
+
1925
+ return substr($text, 0, -$length);
1926
+ }
1927
+
1928
+ /**
1929
+ * Clears internal buffers
1930
+ *
1931
+ * Clearing/resetting the internal buffers is done everytime
1932
+ * after disableContinuousBuffer() or on cipher $engine (re)init
1933
+ * ie after setKey() or setIV()
1934
+ *
1935
+ * @access public
1936
+ * @internal Could, but not must, extend by the child Crypt_* class
1937
+ */
1938
+ function _clearBuffers()
1939
+ {
1940
+ $this->enbuffer = $this->debuffer = array('ciphertext' => '', 'xor' => '', 'pos' => 0, 'enmcrypt_init' => true);
1941
+
1942
+ // mcrypt's handling of invalid's $iv:
1943
+ // $this->encryptIV = $this->decryptIV = strlen($this->iv) == $this->block_size ? $this->iv : str_repeat("\0", $this->block_size);
1944
+ $this->encryptIV = $this->decryptIV = str_pad(substr($this->iv, 0, $this->block_size), $this->block_size, "\0");
1945
+
1946
+ if (!$this->skip_key_adjustment) {
1947
+ $this->key = str_pad(substr($this->key, 0, $this->key_length), $this->key_length, "\0");
1948
+ }
1949
+ }
1950
+
1951
+ /**
1952
+ * String Shift
1953
+ *
1954
+ * Inspired by array_shift
1955
+ *
1956
+ * @param string $string
1957
+ * @param int $index
1958
+ * @access private
1959
+ * @return string
1960
+ */
1961
+ function _string_shift(&$string, $index = 1)
1962
+ {
1963
+ $substr = substr($string, 0, $index);
1964
+ $string = substr($string, $index);
1965
+ return $substr;
1966
+ }
1967
+
1968
+ /**
1969
+ * String Pop
1970
+ *
1971
+ * Inspired by array_pop
1972
+ *
1973
+ * @param string $string
1974
+ * @param int $index
1975
+ * @access private
1976
+ * @return string
1977
+ */
1978
+ function _string_pop(&$string, $index = 1)
1979
+ {
1980
+ $substr = substr($string, -$index);
1981
+ $string = substr($string, 0, -$index);
1982
+ return $substr;
1983
+ }
1984
+
1985
+ /**
1986
+ * Increment the current string
1987
+ *
1988
+ * @see self::decrypt()
1989
+ * @see self::encrypt()
1990
+ * @param string $var
1991
+ * @access private
1992
+ */
1993
+ function _increment_str(&$var)
1994
+ {
1995
+ for ($i = 4; $i <= strlen($var); $i+= 4) {
1996
+ $temp = substr($var, -$i, 4);
1997
+ switch ($temp) {
1998
+ case "\xFF\xFF\xFF\xFF":
1999
+ $var = substr_replace($var, "\x00\x00\x00\x00", -$i, 4);
2000
+ break;
2001
+ case "\x7F\xFF\xFF\xFF":
2002
+ $var = substr_replace($var, "\x80\x00\x00\x00", -$i, 4);
2003
+ return;
2004
+ default:
2005
+ $temp = unpack('Nnum', $temp);
2006
+ $var = substr_replace($var, pack('N', $temp['num'] + 1), -$i, 4);
2007
+ return;
2008
+ }
2009
+ }
2010
+
2011
+ $remainder = strlen($var) % 4;
2012
+
2013
+ if ($remainder == 0) {
2014
+ return;
2015
+ }
2016
+
2017
+ $temp = unpack('Nnum', str_pad(substr($var, 0, $remainder), 4, "\0", STR_PAD_LEFT));
2018
+ $temp = substr(pack('N', $temp['num'] + 1), -$remainder);
2019
+ $var = substr_replace($var, $temp, 0, $remainder);
2020
+ }
2021
+
2022
+ /**
2023
+ * Setup the performance-optimized function for de/encrypt()
2024
+ *
2025
+ * Stores the created (or existing) callback function-name
2026
+ * in $this->inline_crypt
2027
+ *
2028
+ * Internally for phpseclib developers:
2029
+ *
2030
+ * _setupInlineCrypt() would be called only if:
2031
+ *
2032
+ * - $engine == CRYPT_ENGINE_INTERNAL and
2033
+ *
2034
+ * - $use_inline_crypt === true
2035
+ *
2036
+ * - each time on _setup(), after(!) _setupKey()
2037
+ *
2038
+ *
2039
+ * This ensures that _setupInlineCrypt() has always a
2040
+ * full ready2go initializated internal cipher $engine state
2041
+ * where, for example, the keys allready expanded,
2042
+ * keys/block_size calculated and such.
2043
+ *
2044
+ * It is, each time if called, the responsibility of _setupInlineCrypt():
2045
+ *
2046
+ * - to set $this->inline_crypt to a valid and fully working callback function
2047
+ * as a (faster) replacement for encrypt() / decrypt()
2048
+ *
2049
+ * - NOT to create unlimited callback functions (for memory reasons!)
2050
+ * no matter how often _setupInlineCrypt() would be called. At some
2051
+ * point of amount they must be generic re-useable.
2052
+ *
2053
+ * - the code of _setupInlineCrypt() it self,
2054
+ * and the generated callback code,
2055
+ * must be, in following order:
2056
+ * - 100% safe
2057
+ * - 100% compatible to encrypt()/decrypt()
2058
+ * - using only php5+ features/lang-constructs/php-extensions if
2059
+ * compatibility (down to php4) or fallback is provided
2060
+ * - readable/maintainable/understandable/commented and... not-cryptic-styled-code :-)
2061
+ * - >= 10% faster than encrypt()/decrypt() [which is, by the way,
2062
+ * the reason for the existence of _setupInlineCrypt() :-)]
2063
+ * - memory-nice
2064
+ * - short (as good as possible)
2065
+ *
2066
+ * Note: - _setupInlineCrypt() is using _createInlineCryptFunction() to create the full callback function code.
2067
+ * - In case of using inline crypting, _setupInlineCrypt() must extend by the child Crypt_* class.
2068
+ * - The following variable names are reserved:
2069
+ * - $_* (all variable names prefixed with an underscore)
2070
+ * - $self (object reference to it self. Do not use $this, but $self instead)
2071
+ * - $in (the content of $in has to en/decrypt by the generated code)
2072
+ * - The callback function should not use the 'return' statement, but en/decrypt'ing the content of $in only
2073
+ *
2074
+ *
2075
+ * @see self::_setup()
2076
+ * @see self::_createInlineCryptFunction()
2077
+ * @see self::encrypt()
2078
+ * @see self::decrypt()
2079
+ * @access private
2080
+ * @internal If a Crypt_* class providing inline crypting it must extend _setupInlineCrypt()
2081
+ */
2082
+ function _setupInlineCrypt()
2083
+ {
2084
+ // If, for any reason, an extending Crypt_Base() Crypt_* class
2085
+ // not using inline crypting then it must be ensured that: $this->use_inline_crypt = false
2086
+ // ie in the class var declaration of $use_inline_crypt in general for the Crypt_* class,
2087
+ // in the constructor at object instance-time
2088
+ // or, if it's runtime-specific, at runtime
2089
+
2090
+ $this->use_inline_crypt = false;
2091
+ }
2092
+
2093
+ /**
2094
+ * Creates the performance-optimized function for en/decrypt()
2095
+ *
2096
+ * Internally for phpseclib developers:
2097
+ *
2098
+ * _createInlineCryptFunction():
2099
+ *
2100
+ * - merge the $cipher_code [setup'ed by _setupInlineCrypt()]
2101
+ * with the current [$this->]mode of operation code
2102
+ *
2103
+ * - create the $inline function, which called by encrypt() / decrypt()
2104
+ * as its replacement to speed up the en/decryption operations.
2105
+ *
2106
+ * - return the name of the created $inline callback function
2107
+ *
2108
+ * - used to speed up en/decryption
2109
+ *
2110
+ *
2111
+ *
2112
+ * The main reason why can speed up things [up to 50%] this way are:
2113
+ *
2114
+ * - using variables more effective then regular.
2115
+ * (ie no use of expensive arrays but integers $k_0, $k_1 ...
2116
+ * or even, for example, the pure $key[] values hardcoded)
2117
+ *
2118
+ * - avoiding 1000's of function calls of ie _encryptBlock()
2119
+ * but inlining the crypt operations.
2120
+ * in the mode of operation for() loop.
2121
+ *
2122
+ * - full loop unroll the (sometimes key-dependent) rounds
2123
+ * avoiding this way ++$i counters and runtime-if's etc...
2124
+ *
2125
+ * The basic code architectur of the generated $inline en/decrypt()
2126
+ * lambda function, in pseudo php, is:
2127
+ *
2128
+ * <code>
2129
+ * +----------------------------------------------------------------------------------------------+
2130
+ * | callback $inline = create_function: |
2131
+ * | lambda_function_0001_crypt_ECB($action, $text) |
2132
+ * | { |
2133
+ * | INSERT PHP CODE OF: |
2134
+ * | $cipher_code['init_crypt']; // general init code. |
2135
+ * | // ie: $sbox'es declarations used for |
2136
+ * | // encrypt and decrypt'ing. |
2137
+ * | |
2138
+ * | switch ($action) { |
2139
+ * | case 'encrypt': |
2140
+ * | INSERT PHP CODE OF: |
2141
+ * | $cipher_code['init_encrypt']; // encrypt sepcific init code. |
2142
+ * | ie: specified $key or $box |
2143
+ * | declarations for encrypt'ing. |
2144
+ * | |
2145
+ * | foreach ($ciphertext) { |
2146
+ * | $in = $block_size of $ciphertext; |
2147
+ * | |
2148
+ * | INSERT PHP CODE OF: |
2149
+ * | $cipher_code['encrypt_block']; // encrypt's (string) $in, which is always: |
2150
+ * | // strlen($in) == $this->block_size |
2151
+ * | // here comes the cipher algorithm in action |
2152
+ * | // for encryption. |
2153
+ * | // $cipher_code['encrypt_block'] has to |
2154
+ * | // encrypt the content of the $in variable |
2155
+ * | |
2156
+ * | $plaintext .= $in; |
2157
+ * | } |
2158
+ * | return $plaintext; |
2159
+ * | |
2160
+ * | case 'decrypt': |
2161
+ * | INSERT PHP CODE OF: |
2162
+ * | $cipher_code['init_decrypt']; // decrypt sepcific init code |
2163
+ * | ie: specified $key or $box |
2164
+ * | declarations for decrypt'ing. |
2165
+ * | foreach ($plaintext) { |
2166
+ * | $in = $block_size of $plaintext; |
2167
+ * | |
2168
+ * | INSERT PHP CODE OF: |
2169
+ * | $cipher_code['decrypt_block']; // decrypt's (string) $in, which is always |
2170
+ * | // strlen($in) == $this->block_size |
2171
+ * | // here comes the cipher algorithm in action |
2172
+ * | // for decryption. |
2173
+ * | // $cipher_code['decrypt_block'] has to |
2174
+ * | // decrypt the content of the $in variable |
2175
+ * | $ciphertext .= $in; |
2176
+ * | } |
2177
+ * | return $ciphertext; |
2178
+ * | } |
2179
+ * | } |
2180
+ * +----------------------------------------------------------------------------------------------+
2181
+ * </code>
2182
+ *
2183
+ * See also the Crypt_*::_setupInlineCrypt()'s for
2184
+ * productive inline $cipher_code's how they works.
2185
+ *
2186
+ * Structure of:
2187
+ * <code>
2188
+ * $cipher_code = array(
2189
+ * 'init_crypt' => (string) '', // optional
2190
+ * 'init_encrypt' => (string) '', // optional
2191
+ * 'init_decrypt' => (string) '', // optional
2192
+ * 'encrypt_block' => (string) '', // required
2193
+ * 'decrypt_block' => (string) '' // required
2194
+ * );
2195
+ * </code>
2196
+ *
2197
+ * @see self::_setupInlineCrypt()
2198
+ * @see self::encrypt()
2199
+ * @see self::decrypt()
2200
+ * @param array $cipher_code
2201
+ * @access private
2202
+ * @return string (the name of the created callback function)
2203
+ */
2204
+ function _createInlineCryptFunction($cipher_code)
2205
+ {
2206
+ $block_size = $this->block_size;
2207
+
2208
+ // optional
2209
+ $init_crypt = isset($cipher_code['init_crypt']) ? $cipher_code['init_crypt'] : '';
2210
+ $init_encrypt = isset($cipher_code['init_encrypt']) ? $cipher_code['init_encrypt'] : '';
2211
+ $init_decrypt = isset($cipher_code['init_decrypt']) ? $cipher_code['init_decrypt'] : '';
2212
+ // required
2213
+ $encrypt_block = $cipher_code['encrypt_block'];
2214
+ $decrypt_block = $cipher_code['decrypt_block'];
2215
+
2216
+ // Generating mode of operation inline code,
2217
+ // merged with the $cipher_code algorithm
2218
+ // for encrypt- and decryption.
2219
+ switch ($this->mode) {
2220
+ case CRYPT_MODE_ECB:
2221
+ $encrypt = $init_encrypt . '
2222
+ $_ciphertext = "";
2223
+ $_plaintext_len = strlen($_text);
2224
+
2225
+ for ($_i = 0; $_i < $_plaintext_len; $_i+= '.$block_size.') {
2226
+ $in = substr($_text, $_i, '.$block_size.');
2227
+ '.$encrypt_block.'
2228
+ $_ciphertext.= $in;
2229
+ }
2230
+
2231
+ return $_ciphertext;
2232
+ ';
2233
+
2234
+ $decrypt = $init_decrypt . '
2235
+ $_plaintext = "";
2236
+ $_text = str_pad($_text, strlen($_text) + ('.$block_size.' - strlen($_text) % '.$block_size.') % '.$block_size.', chr(0));
2237
+ $_ciphertext_len = strlen($_text);
2238
+
2239
+ for ($_i = 0; $_i < $_ciphertext_len; $_i+= '.$block_size.') {
2240
+ $in = substr($_text, $_i, '.$block_size.');
2241
+ '.$decrypt_block.'
2242
+ $_plaintext.= $in;
2243
+ }
2244
+
2245
+ return $self->_unpad($_plaintext);
2246
+ ';
2247
+ break;
2248
+ case CRYPT_MODE_CTR:
2249
+ $encrypt = $init_encrypt . '
2250
+ $_ciphertext = "";
2251
+ $_plaintext_len = strlen($_text);
2252
+ $_xor = $self->encryptIV;
2253
+ $_buffer = &$self->enbuffer;
2254
+ if (strlen($_buffer["ciphertext"])) {
2255
+ for ($_i = 0; $_i < $_plaintext_len; $_i+= '.$block_size.') {
2256
+ $_block = substr($_text, $_i, '.$block_size.');
2257
+ if (strlen($_block) > strlen($_buffer["ciphertext"])) {
2258
+ $in = $_xor;
2259
+ '.$encrypt_block.'
2260
+ $self->_increment_str($_xor);
2261
+ $_buffer["ciphertext"].= $in;
2262
+ }
2263
+ $_key = $self->_string_shift($_buffer["ciphertext"], '.$block_size.');
2264
+ $_ciphertext.= $_block ^ $_key;
2265
+ }
2266
+ } else {
2267
+ for ($_i = 0; $_i < $_plaintext_len; $_i+= '.$block_size.') {
2268
+ $_block = substr($_text, $_i, '.$block_size.');
2269
+ $in = $_xor;
2270
+ '.$encrypt_block.'
2271
+ $self->_increment_str($_xor);
2272
+ $_key = $in;
2273
+ $_ciphertext.= $_block ^ $_key;
2274
+ }
2275
+ }
2276
+ if ($self->continuousBuffer) {
2277
+ $self->encryptIV = $_xor;
2278
+ if ($_start = $_plaintext_len % '.$block_size.') {
2279
+ $_buffer["ciphertext"] = substr($_key, $_start) . $_buffer["ciphertext"];
2280
+ }
2281
+ }
2282
+
2283
+ return $_ciphertext;
2284
+ ';
2285
+
2286
+ $decrypt = $init_encrypt . '
2287
+ $_plaintext = "";
2288
+ $_ciphertext_len = strlen($_text);
2289
+ $_xor = $self->decryptIV;
2290
+ $_buffer = &$self->debuffer;
2291
+
2292
+ if (strlen($_buffer["ciphertext"])) {
2293
+ for ($_i = 0; $_i < $_ciphertext_len; $_i+= '.$block_size.') {
2294
+ $_block = substr($_text, $_i, '.$block_size.');
2295
+ if (strlen($_block) > strlen($_buffer["ciphertext"])) {
2296
+ $in = $_xor;
2297
+ '.$encrypt_block.'
2298
+ $self->_increment_str($_xor);
2299
+ $_buffer["ciphertext"].= $in;
2300
+ }
2301
+ $_key = $self->_string_shift($_buffer["ciphertext"], '.$block_size.');
2302
+ $_plaintext.= $_block ^ $_key;
2303
+ }
2304
+ } else {
2305
+ for ($_i = 0; $_i < $_ciphertext_len; $_i+= '.$block_size.') {
2306
+ $_block = substr($_text, $_i, '.$block_size.');
2307
+ $in = $_xor;
2308
+ '.$encrypt_block.'
2309
+ $self->_increment_str($_xor);
2310
+ $_key = $in;
2311
+ $_plaintext.= $_block ^ $_key;
2312
+ }
2313
+ }
2314
+ if ($self->continuousBuffer) {
2315
+ $self->decryptIV = $_xor;
2316
+ if ($_start = $_ciphertext_len % '.$block_size.') {
2317
+ $_buffer["ciphertext"] = substr($_key, $_start) . $_buffer["ciphertext"];
2318
+ }
2319
+ }
2320
+
2321
+ return $_plaintext;
2322
+ ';
2323
+ break;
2324
+ case CRYPT_MODE_CFB:
2325
+ $encrypt = $init_encrypt . '
2326
+ $_ciphertext = "";
2327
+ $_buffer = &$self->enbuffer;
2328
+
2329
+ if ($self->continuousBuffer) {
2330
+ $_iv = &$self->encryptIV;
2331
+ $_pos = &$_buffer["pos"];
2332
+ } else {
2333
+ $_iv = $self->encryptIV;
2334
+ $_pos = 0;
2335
+ }
2336
+ $_len = strlen($_text);
2337
+ $_i = 0;
2338
+ if ($_pos) {
2339
+ $_orig_pos = $_pos;
2340
+ $_max = '.$block_size.' - $_pos;
2341
+ if ($_len >= $_max) {
2342
+ $_i = $_max;
2343
+ $_len-= $_max;
2344
+ $_pos = 0;
2345
+ } else {
2346
+ $_i = $_len;
2347
+ $_pos+= $_len;
2348
+ $_len = 0;
2349
+ }
2350
+ $_ciphertext = substr($_iv, $_orig_pos) ^ $_text;
2351
+ $_iv = substr_replace($_iv, $_ciphertext, $_orig_pos, $_i);
2352
+ }
2353
+ while ($_len >= '.$block_size.') {
2354
+ $in = $_iv;
2355
+ '.$encrypt_block.';
2356
+ $_iv = $in ^ substr($_text, $_i, '.$block_size.');
2357
+ $_ciphertext.= $_iv;
2358
+ $_len-= '.$block_size.';
2359
+ $_i+= '.$block_size.';
2360
+ }
2361
+ if ($_len) {
2362
+ $in = $_iv;
2363
+ '.$encrypt_block.'
2364
+ $_iv = $in;
2365
+ $_block = $_iv ^ substr($_text, $_i);
2366
+ $_iv = substr_replace($_iv, $_block, 0, $_len);
2367
+ $_ciphertext.= $_block;
2368
+ $_pos = $_len;
2369
+ }
2370
+ return $_ciphertext;
2371
+ ';
2372
+
2373
+ $decrypt = $init_encrypt . '
2374
+ $_plaintext = "";
2375
+ $_buffer = &$self->debuffer;
2376
+
2377
+ if ($self->continuousBuffer) {
2378
+ $_iv = &$self->decryptIV;
2379
+ $_pos = &$_buffer["pos"];
2380
+ } else {
2381
+ $_iv = $self->decryptIV;
2382
+ $_pos = 0;
2383
+ }
2384
+ $_len = strlen($_text);
2385
+ $_i = 0;
2386
+ if ($_pos) {
2387
+ $_orig_pos = $_pos;
2388
+ $_max = '.$block_size.' - $_pos;
2389
+ if ($_len >= $_max) {
2390
+ $_i = $_max;
2391
+ $_len-= $_max;
2392
+ $_pos = 0;
2393
+ } else {
2394
+ $_i = $_len;
2395
+ $_pos+= $_len;
2396
+ $_len = 0;
2397
+ }
2398
+ $_plaintext = substr($_iv, $_orig_pos) ^ $_text;
2399
+ $_iv = substr_replace($_iv, substr($_text, 0, $_i), $_orig_pos, $_i);
2400
+ }
2401
+ while ($_len >= '.$block_size.') {
2402
+ $in = $_iv;
2403
+ '.$encrypt_block.'
2404
+ $_iv = $in;
2405
+ $cb = substr($_text, $_i, '.$block_size.');
2406
+ $_plaintext.= $_iv ^ $cb;
2407
+ $_iv = $cb;
2408
+ $_len-= '.$block_size.';
2409
+ $_i+= '.$block_size.';
2410
+ }
2411
+ if ($_len) {
2412
+ $in = $_iv;
2413
+ '.$encrypt_block.'
2414
+ $_iv = $in;
2415
+ $_plaintext.= $_iv ^ substr($_text, $_i);
2416
+ $_iv = substr_replace($_iv, substr($_text, $_i), 0, $_len);
2417
+ $_pos = $_len;
2418
+ }
2419
+
2420
+ return $_plaintext;
2421
+ ';
2422
+ break;
2423
+ case CRYPT_MODE_OFB:
2424
+ $encrypt = $init_encrypt . '
2425
+ $_ciphertext = "";
2426
+ $_plaintext_len = strlen($_text);
2427
+ $_xor = $self->encryptIV;
2428
+ $_buffer = &$self->enbuffer;
2429
+
2430
+ if (strlen($_buffer["xor"])) {
2431
+ for ($_i = 0; $_i < $_plaintext_len; $_i+= '.$block_size.') {
2432
+ $_block = substr($_text, $_i, '.$block_size.');
2433
+ if (strlen($_block) > strlen($_buffer["xor"])) {
2434
+ $in = $_xor;
2435
+ '.$encrypt_block.'
2436
+ $_xor = $in;
2437
+ $_buffer["xor"].= $_xor;
2438
+ }
2439
+ $_key = $self->_string_shift($_buffer["xor"], '.$block_size.');
2440
+ $_ciphertext.= $_block ^ $_key;
2441
+ }
2442
+ } else {
2443
+ for ($_i = 0; $_i < $_plaintext_len; $_i+= '.$block_size.') {
2444
+ $in = $_xor;
2445
+ '.$encrypt_block.'
2446
+ $_xor = $in;
2447
+ $_ciphertext.= substr($_text, $_i, '.$block_size.') ^ $_xor;
2448
+ }
2449
+ $_key = $_xor;
2450
+ }
2451
+ if ($self->continuousBuffer) {
2452
+ $self->encryptIV = $_xor;
2453
+ if ($_start = $_plaintext_len % '.$block_size.') {
2454
+ $_buffer["xor"] = substr($_key, $_start) . $_buffer["xor"];
2455
+ }
2456
+ }
2457
+ return $_ciphertext;
2458
+ ';
2459
+
2460
+ $decrypt = $init_encrypt . '
2461
+ $_plaintext = "";
2462
+ $_ciphertext_len = strlen($_text);
2463
+ $_xor = $self->decryptIV;
2464
+ $_buffer = &$self->debuffer;
2465
+
2466
+ if (strlen($_buffer["xor"])) {
2467
+ for ($_i = 0; $_i < $_ciphertext_len; $_i+= '.$block_size.') {
2468
+ $_block = substr($_text, $_i, '.$block_size.');
2469
+ if (strlen($_block) > strlen($_buffer["xor"])) {
2470
+ $in = $_xor;
2471
+ '.$encrypt_block.'
2472
+ $_xor = $in;
2473
+ $_buffer["xor"].= $_xor;
2474
+ }
2475
+ $_key = $self->_string_shift($_buffer["xor"], '.$block_size.');
2476
+ $_plaintext.= $_block ^ $_key;
2477
+ }
2478
+ } else {
2479
+ for ($_i = 0; $_i < $_ciphertext_len; $_i+= '.$block_size.') {
2480
+ $in = $_xor;
2481
+ '.$encrypt_block.'
2482
+ $_xor = $in;
2483
+ $_plaintext.= substr($_text, $_i, '.$block_size.') ^ $_xor;
2484
+ }
2485
+ $_key = $_xor;
2486
+ }
2487
+ if ($self->continuousBuffer) {
2488
+ $self->decryptIV = $_xor;
2489
+ if ($_start = $_ciphertext_len % '.$block_size.') {
2490
+ $_buffer["xor"] = substr($_key, $_start) . $_buffer["xor"];
2491
+ }
2492
+ }
2493
+ return $_plaintext;
2494
+ ';
2495
+ break;
2496
+ case CRYPT_MODE_STREAM:
2497
+ $encrypt = $init_encrypt . '
2498
+ $_ciphertext = "";
2499
+ '.$encrypt_block.'
2500
+ return $_ciphertext;
2501
+ ';
2502
+ $decrypt = $init_decrypt . '
2503
+ $_plaintext = "";
2504
+ '.$decrypt_block.'
2505
+ return $_plaintext;
2506
+ ';
2507
+ break;
2508
+ // case CRYPT_MODE_CBC:
2509
+ default:
2510
+ $encrypt = $init_encrypt . '
2511
+ $_ciphertext = "";
2512
+ $_plaintext_len = strlen($_text);
2513
+
2514
+ $in = $self->encryptIV;
2515
+
2516
+ for ($_i = 0; $_i < $_plaintext_len; $_i+= '.$block_size.') {
2517
+ $in = substr($_text, $_i, '.$block_size.') ^ $in;
2518
+ '.$encrypt_block.'
2519
+ $_ciphertext.= $in;
2520
+ }
2521
+
2522
+ if ($self->continuousBuffer) {
2523
+ $self->encryptIV = $in;
2524
+ }
2525
+
2526
+ return $_ciphertext;
2527
+ ';
2528
+
2529
+ $decrypt = $init_decrypt . '
2530
+ $_plaintext = "";
2531
+ $_text = str_pad($_text, strlen($_text) + ('.$block_size.' - strlen($_text) % '.$block_size.') % '.$block_size.', chr(0));
2532
+ $_ciphertext_len = strlen($_text);
2533
+
2534
+ $_iv = $self->decryptIV;
2535
+
2536
+ for ($_i = 0; $_i < $_ciphertext_len; $_i+= '.$block_size.') {
2537
+ $in = $_block = substr($_text, $_i, '.$block_size.');
2538
+ '.$decrypt_block.'
2539
+ $_plaintext.= $in ^ $_iv;
2540
+ $_iv = $_block;
2541
+ }
2542
+
2543
+ if ($self->continuousBuffer) {
2544
+ $self->decryptIV = $_iv;
2545
+ }
2546
+
2547
+ return $self->_unpad($_plaintext);
2548
+ ';
2549
+ break;
2550
+ }
2551
+
2552
+ // Create the $inline function and return its name as string. Ready to run!
2553
+ if (version_compare(PHP_VERSION, '5.3.0') >= 0) {
2554
+ eval('$func = function ($_action, &$self, $_text) { ' . $init_crypt . 'if ($_action == "encrypt") { ' . $encrypt . ' } else { ' . $decrypt . ' } };');
2555
+ return $func;
2556
+ }
2557
+
2558
+ return create_function('$_action, &$self, $_text', $init_crypt . 'if ($_action == "encrypt") { ' . $encrypt . ' } else { ' . $decrypt . ' }');
2559
+ }
2560
+
2561
+ /**
2562
+ * Holds the lambda_functions table (classwide)
2563
+ *
2564
+ * Each name of the lambda function, created from
2565
+ * _setupInlineCrypt() && _createInlineCryptFunction()
2566
+ * is stored, classwide (!), here for reusing.
2567
+ *
2568
+ * The string-based index of $function is a classwide
2569
+ * unique value representing, at least, the $mode of
2570
+ * operation (or more... depends of the optimizing level)
2571
+ * for which $mode the lambda function was created.
2572
+ *
2573
+ * @access private
2574
+ * @return array &$functions
2575
+ */
2576
+ function &_getLambdaFunctions()
2577
+ {
2578
+ static $functions = array();
2579
+ return $functions;
2580
+ }
2581
+
2582
+ /**
2583
+ * Generates a digest from $bytes
2584
+ *
2585
+ * @see self::_setupInlineCrypt()
2586
+ * @access private
2587
+ * @param $bytes
2588
+ * @return string
2589
+ */
2590
+ function _hashInlineCryptFunction($bytes)
2591
+ {
2592
+ if (!defined('CRYPT_BASE_WHIRLPOOL_AVAILABLE')) {
2593
+ define('CRYPT_BASE_WHIRLPOOL_AVAILABLE', (bool)(extension_loaded('hash') && in_array('whirlpool', hash_algos())));
2594
+ }
2595
+
2596
+ $result = '';
2597
+ $hash = $bytes;
2598
+
2599
+ switch (true) {
2600
+ case CRYPT_BASE_WHIRLPOOL_AVAILABLE:
2601
+ foreach (str_split($bytes, 64) as $t) {
2602
+ $hash = hash('whirlpool', $hash, true);
2603
+ $result .= $t ^ $hash;
2604
+ }
2605
+ return $result . hash('whirlpool', $hash, true);
2606
+ default:
2607
+ $len = strlen($bytes);
2608
+ for ($i = 0; $i < $len; $i+=20) {
2609
+ $t = substr($bytes, $i, 20);
2610
+ $hash = pack('H*', sha1($hash));
2611
+ $result .= $t ^ $hash;
2612
+ }
2613
+ return $result . pack('H*', sha1($hash));
2614
+ }
2615
+ }
2616
+
2617
+ /**
2618
+ * Convert float to int
2619
+ *
2620
+ * On 32-bit Linux installs running PHP < 5.3 converting floats to ints doesn't always work
2621
+ *
2622
+ * @access private
2623
+ * @param string $x
2624
+ * @return int
2625
+ */
2626
+ function safe_intval($x)
2627
+ {
2628
+ switch (true) {
2629
+ case is_int($x):
2630
+ // PHP 5.3, per http://php.net/releases/5_3_0.php, introduced "more consistent float rounding"
2631
+ case version_compare(PHP_VERSION, '5.3.0') >= 0 && (php_uname('m') & "\xDF\xDF\xDF") != 'ARM':
2632
+ // PHP_OS & "\xDF\xDF\xDF" == strtoupper(substr(PHP_OS, 0, 3)), but a lot faster
2633
+ case (PHP_OS & "\xDF\xDF\xDF") === 'WIN':
2634
+ return $x;
2635
+ }
2636
+ return (fmod($x, 0x80000000) & 0x7FFFFFFF) |
2637
+ ((fmod(floor($x / 0x80000000), 2) & 1) << 31);
2638
+ }
2639
+
2640
+ /**
2641
+ * eval()'able string for in-line float to int
2642
+ *
2643
+ * @access private
2644
+ * @return string
2645
+ */
2646
+ function safe_intval_inline()
2647
+ {
2648
+ // on 32-bit linux systems with PHP < 5.3 float to integer conversion is bad
2649
+ switch (true) {
2650
+ case defined('PHP_INT_SIZE') && PHP_INT_SIZE == 8:
2651
+ case version_compare(PHP_VERSION, '5.3.0') >= 0 && (php_uname('m') & "\xDF\xDF\xDF") != 'ARM':
2652
+ case (PHP_OS & "\xDF\xDF\xDF") === 'WIN':
2653
+ return '%s';
2654
+ break;
2655
+ default:
2656
+ $safeint = '(is_int($temp = %s) ? $temp : (fmod($temp, 0x80000000) & 0x7FFFFFFF) | ';
2657
+ return $safeint . '((fmod(floor($temp / 0x80000000), 2) & 1) << 31))';
2658
+ }
2659
+ }
2660
+ }
installer/dup-installer/classes/Crypt/Random.php ADDED
@@ -0,0 +1,338 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Random Number Generator
5
+ *
6
+ * The idea behind this function is that it can be easily replaced with your own crypt_random_string()
7
+ * function. eg. maybe you have a better source of entropy for creating the initial states or whatever.
8
+ *
9
+ * PHP versions 4 and 5
10
+ *
11
+ * Here's a short example of how to use this library:
12
+ * <code>
13
+ * <?php
14
+ * include 'Crypt/Random.php';
15
+ *
16
+ * echo bin2hex(crypt_random_string(8));
17
+ * ?>
18
+ * </code>
19
+ *
20
+ * LICENSE: Permission is hereby granted, free of charge, to any person obtaining a copy
21
+ * of this software and associated documentation files (the "Software"), to deal
22
+ * in the Software without restriction, including without limitation the rights
23
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
24
+ * copies of the Software, and to permit persons to whom the Software is
25
+ * furnished to do so, subject to the following conditions:
26
+ *
27
+ * The above copyright notice and this permission notice shall be included in
28
+ * all copies or substantial portions of the Software.
29
+ *
30
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
31
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
32
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
33
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
34
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
35
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
36
+ * THE SOFTWARE.
37
+ *
38
+ * @category Crypt
39
+ * @package Crypt_Random
40
+ * @author Jim Wigginton <terrafrost@php.net>
41
+ * @copyright 2007 Jim Wigginton
42
+ * @license http://www.opensource.org/licenses/mit-license.html MIT License
43
+ * @link http://phpseclib.sourceforge.net
44
+ */
45
+
46
+ // laravel is a PHP framework that utilizes phpseclib. laravel workbenches may, independently,
47
+ // have phpseclib as a requirement as well. if you're developing such a program you may encounter
48
+ // a "Cannot redeclare crypt_random_string()" error.
49
+ if (!function_exists('crypt_random_string')) {
50
+ /**
51
+ * "Is Windows" test
52
+ *
53
+ * @access private
54
+ */
55
+ define('CRYPT_RANDOM_IS_WINDOWS', strtoupper(substr(PHP_OS, 0, 3)) === 'WIN');
56
+
57
+ /**
58
+ * Generate a random string.
59
+ *
60
+ * Although microoptimizations are generally discouraged as they impair readability this function is ripe with
61
+ * microoptimizations because this function has the potential of being called a huge number of times.
62
+ * eg. for RSA key generation.
63
+ *
64
+ * @param int $length
65
+ * @return string
66
+ * @access public
67
+ */
68
+ function crypt_random_string($length)
69
+ {
70
+ if (!$length) {
71
+ return '';
72
+ }
73
+
74
+ if (CRYPT_RANDOM_IS_WINDOWS) {
75
+ // method 1. prior to PHP 5.3, mcrypt_create_iv() would call rand() on windows
76
+ if (extension_loaded('mcrypt') && version_compare(PHP_VERSION, '5.3.0', '>=')) {
77
+ return @mcrypt_create_iv($length);
78
+ }
79
+ // method 2. openssl_random_pseudo_bytes was introduced in PHP 5.3.0 but prior to PHP 5.3.4 there was,
80
+ // to quote <http://php.net/ChangeLog-5.php#5.3.4>, "possible blocking behavior". as of 5.3.4
81
+ // openssl_random_pseudo_bytes and mcrypt_create_iv do the exact same thing on Windows. ie. they both
82
+ // call php_win32_get_random_bytes():
83
+ //
84
+ // https://github.com/php/php-src/blob/7014a0eb6d1611151a286c0ff4f2238f92c120d6/ext/openssl/openssl.c#L5008
85
+ // https://github.com/php/php-src/blob/7014a0eb6d1611151a286c0ff4f2238f92c120d6/ext/mcrypt/mcrypt.c#L1392
86
+ //
87
+ // php_win32_get_random_bytes() is defined thusly:
88
+ //
89
+ // https://github.com/php/php-src/blob/7014a0eb6d1611151a286c0ff4f2238f92c120d6/win32/winutil.c#L80
90
+ //
91
+ // we're calling it, all the same, in the off chance that the mcrypt extension is not available
92
+ if (extension_loaded('openssl') && version_compare(PHP_VERSION, '5.3.4', '>=')) {
93
+ return openssl_random_pseudo_bytes($length);
94
+ }
95
+ } else {
96
+ // method 1. the fastest
97
+ if (extension_loaded('openssl') && version_compare(PHP_VERSION, '5.3.0', '>=')) {
98
+ return openssl_random_pseudo_bytes($length);
99
+ }
100
+ // method 2
101
+ static $fp = true;
102
+ if ($fp === true) {
103
+ // warning's will be output unles the error suppression operator is used. errors such as
104
+ // "open_basedir restriction in effect", "Permission denied", "No such file or directory", etc.
105
+ $fp = @fopen('/dev/urandom', 'rb');
106
+ }
107
+ if ($fp !== true && $fp !== false) { // surprisingly faster than !is_bool() or is_resource()
108
+ return fread($fp, $length);
109
+ }
110
+ // method 3. pretty much does the same thing as method 2 per the following url:
111
+ // https://github.com/php/php-src/blob/7014a0eb6d1611151a286c0ff4f2238f92c120d6/ext/mcrypt/mcrypt.c#L1391
112
+ // surprisingly slower than method 2. maybe that's because mcrypt_create_iv does a bunch of error checking that we're
113
+ // not doing. regardless, this'll only be called if this PHP script couldn't open /dev/urandom due to open_basedir
114
+ // restrictions or some such
115
+ if (extension_loaded('mcrypt')) {
116
+ return @mcrypt_create_iv($length, MCRYPT_DEV_URANDOM);
117
+ }
118
+ }
119
+ // at this point we have no choice but to use a pure-PHP CSPRNG
120
+
121
+ // cascade entropy across multiple PHP instances by fixing the session and collecting all
122
+ // environmental variables, including the previous session data and the current session
123
+ // data.
124
+ //
125
+ // mt_rand seeds itself by looking at the PID and the time, both of which are (relatively)
126
+ // easy to guess at. linux uses mouse clicks, keyboard timings, etc, as entropy sources, but
127
+ // PHP isn't low level to be able to use those as sources and on a web server there's not likely
128
+ // going to be a ton of keyboard or mouse action. web servers do have one thing that we can use
129
+ // however, a ton of people visiting the website. obviously you don't want to base your seeding
130
+ // soley on parameters a potential attacker sends but (1) not everything in $_SERVER is controlled
131
+ // by the user and (2) this isn't just looking at the data sent by the current user - it's based
132
+ // on the data sent by all users. one user requests the page and a hash of their info is saved.
133
+ // another user visits the page and the serialization of their data is utilized along with the
134
+ // server envirnment stuff and a hash of the previous http request data (which itself utilizes
135
+ // a hash of the session data before that). certainly an attacker should be assumed to have
136
+ // full control over his own http requests. he, however, is not going to have control over
137
+ // everyone's http requests.
138
+ static $crypto = false, $v;
139
+ if ($crypto === false) {
140
+ // save old session data
141
+ $old_session_id = session_id();
142
+ $old_use_cookies = ini_get('session.use_cookies');
143
+ $old_session_cache_limiter = session_cache_limiter();
144
+ $_OLD_SESSION = isset($_SESSION) ? $_SESSION : false;
145
+ if ($old_session_id != '') {
146
+ session_write_close();
147
+ }
148
+
149
+ session_id(1);
150
+ ini_set('session.use_cookies', 0);
151
+ session_cache_limiter('');
152
+ session_start();
153
+
154
+ $v = $seed = $_SESSION['seed'] = pack('H*', sha1(
155
+ (isset($_SERVER) ? phpseclib_safe_serialize($_SERVER) : '') .
156
+ (isset($_POST) ? phpseclib_safe_serialize($_POST) : '') .
157
+ (isset($_GET) ? phpseclib_safe_serialize($_GET) : '') .
158
+ (isset($_COOKIE) ? phpseclib_safe_serialize($_COOKIE) : '') .
159
+ phpseclib_safe_serialize($GLOBALS) .
160
+ phpseclib_safe_serialize($_SESSION) .
161
+ phpseclib_safe_serialize($_OLD_SESSION)
162
+ ));
163
+ if (!isset($_SESSION['count'])) {
164
+ $_SESSION['count'] = 0;
165
+ }
166
+ $_SESSION['count']++;
167
+
168
+ session_write_close();
169
+
170
+ // restore old session data
171
+ if ($old_session_id != '') {
172
+ session_id($old_session_id);
173
+ session_start();
174
+ ini_set('session.use_cookies', $old_use_cookies);
175
+ session_cache_limiter($old_session_cache_limiter);
176
+ } else {
177
+ if ($_OLD_SESSION !== false) {
178
+ $_SESSION = $_OLD_SESSION;
179
+ unset($_OLD_SESSION);
180
+ } else {
181
+ unset($_SESSION);
182
+ }
183
+ }
184
+
185
+ // in SSH2 a shared secret and an exchange hash are generated through the key exchange process.
186
+ // the IV client to server is the hash of that "nonce" with the letter A and for the encryption key it's the letter C.
187
+ // if the hash doesn't produce enough a key or an IV that's long enough concat successive hashes of the
188
+ // original hash and the current hash. we'll be emulating that. for more info see the following URL:
189
+ //
190
+ // http://tools.ietf.org/html/rfc4253#section-7.2
191
+ //
192
+ // see the is_string($crypto) part for an example of how to expand the keys
193
+ $key = pack('H*', sha1($seed . 'A'));
194
+ $iv = pack('H*', sha1($seed . 'C'));
195
+
196
+ // ciphers are used as per the nist.gov link below. also, see this link:
197
+ //
198
+ // http://en.wikipedia.org/wiki/Cryptographically_secure_pseudorandom_number_generator#Designs_based_on_cryptographic_primitives
199
+ switch (true) {
200
+ case phpseclib_resolve_include_path('Crypt/AES.php'):
201
+ if (!class_exists('Crypt_AES')) {
202
+ include_once 'AES.php';
203
+ }
204
+ $crypto = new Crypt_AES(CRYPT_AES_MODE_CTR);
205
+ break;
206
+ case phpseclib_resolve_include_path('Crypt/Twofish.php'):
207
+ if (!class_exists('Crypt_Twofish')) {
208
+ include_once 'Twofish.php';
209
+ }
210
+ $crypto = new Crypt_Twofish(CRYPT_TWOFISH_MODE_CTR);
211
+ break;
212
+ case phpseclib_resolve_include_path('Crypt/Blowfish.php'):
213
+ if (!class_exists('Crypt_Blowfish')) {
214
+ include_once 'Blowfish.php';
215
+ }
216
+ $crypto = new Crypt_Blowfish(CRYPT_BLOWFISH_MODE_CTR);
217
+ break;
218
+ case phpseclib_resolve_include_path('Crypt/TripleDES.php'):
219
+ if (!class_exists('Crypt_TripleDES')) {
220
+ include_once 'TripleDES.php';
221
+ }
222
+ $crypto = new Crypt_TripleDES(CRYPT_DES_MODE_CTR);
223
+ break;
224
+ case phpseclib_resolve_include_path('Crypt/DES.php'):
225
+ if (!class_exists('Crypt_DES')) {
226
+ include_once 'DES.php';
227
+ }
228
+ $crypto = new Crypt_DES(CRYPT_DES_MODE_CTR);
229
+ break;
230
+ case phpseclib_resolve_include_path('Crypt/RC4.php'):
231
+ if (!class_exists('Crypt_RC4')) {
232
+ include_once 'RC4.php';
233
+ }
234
+ $crypto = new Crypt_RC4();
235
+ break;
236
+ default:
237
+ user_error('crypt_random_string requires at least one symmetric cipher be loaded');
238
+ return false;
239
+ }
240
+
241
+ $crypto->setKey($key);
242
+ $crypto->setIV($iv);
243
+ $crypto->enableContinuousBuffer();
244
+ }
245
+
246
+ //return $crypto->encrypt(str_repeat("\0", $length));
247
+
248
+ // the following is based off of ANSI X9.31:
249
+ //
250
+ // http://csrc.nist.gov/groups/STM/cavp/documents/rng/931rngext.pdf
251
+ //
252
+ // OpenSSL uses that same standard for it's random numbers:
253
+ //
254
+ // http://www.opensource.apple.com/source/OpenSSL/OpenSSL-38/openssl/fips-1.0/rand/fips_rand.c
255
+ // (do a search for "ANS X9.31 A.2.4")
256
+ $result = '';
257
+ while (strlen($result) < $length) {
258
+ $i = $crypto->encrypt(microtime()); // strlen(microtime()) == 21
259
+ $r = $crypto->encrypt($i ^ $v); // strlen($v) == 20
260
+ $v = $crypto->encrypt($r ^ $i); // strlen($r) == 20
261
+ $result.= $r;
262
+ }
263
+ return substr($result, 0, $length);
264
+ }
265
+ }
266
+
267
+ if (!function_exists('phpseclib_safe_serialize')) {
268
+ /**
269
+ * Safely serialize variables
270
+ *
271
+ * If a class has a private __sleep() method it'll give a fatal error on PHP 5.2 and earlier.
272
+ * PHP 5.3 will emit a warning.
273
+ *
274
+ * @param mixed $arr
275
+ * @access public
276
+ */
277
+ function phpseclib_safe_serialize(&$arr)
278
+ {
279
+ if (is_object($arr)) {
280
+ return '';
281
+ }
282
+ if (!is_array($arr)) {
283
+ return serialize($arr);
284
+ }
285
+ // prevent circular array recursion
286
+ if (isset($arr['__phpseclib_marker'])) {
287
+ return '';
288
+ }
289
+ $safearr = array();
290
+ $arr['__phpseclib_marker'] = true;
291
+ foreach (array_keys($arr) as $key) {
292
+ // do not recurse on the '__phpseclib_marker' key itself, for smaller memory usage
293
+ if ($key !== '__phpseclib_marker') {
294
+ $safearr[$key] = phpseclib_safe_serialize($arr[$key]);
295
+ }
296
+ }
297
+ unset($arr['__phpseclib_marker']);
298
+ return serialize($safearr);
299
+ }
300
+ }
301
+
302
+ if (!function_exists('phpseclib_resolve_include_path')) {
303
+ /**
304
+ * Resolve filename against the include path.
305
+ *
306
+ * Wrapper around stream_resolve_include_path() (which was introduced in
307
+ * PHP 5.3.2) with fallback implementation for earlier PHP versions.
308
+ *
309
+ * @param string $filename
310
+ * @return string|false
311
+ * @access public
312
+ */
313
+ function phpseclib_resolve_include_path($filename)
314
+ {
315
+ if (function_exists('stream_resolve_include_path')) {
316
+ return stream_resolve_include_path($filename);
317
+ }
318
+
319
+ // handle non-relative paths
320
+ if (file_exists($filename)) {
321
+ return realpath($filename);
322
+ }
323
+
324
+ $paths = PATH_SEPARATOR == ':' ?
325
+ preg_split('#(?<!phar):#', get_include_path()) :
326
+ explode(PATH_SEPARATOR, get_include_path());
327
+ foreach ($paths as $prefix) {
328
+ // path's specified in include_path don't always end in /
329
+ $ds = substr($prefix, -1) == DIRECTORY_SEPARATOR ? '' : DIRECTORY_SEPARATOR;
330
+ $file = $prefix . $ds . $filename;
331
+ if (file_exists($file)) {
332
+ return realpath($file);
333
+ }
334
+ }
335
+
336
+ return false;
337
+ }
338
+ }
installer/dup-installer/classes/Crypt/Rijndael.php ADDED
@@ -0,0 +1,1050 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Pure-PHP implementation of Rijndael.
5
+ *
6
+ * Uses mcrypt, if available/possible, and an internal implementation, otherwise.
7
+ *
8
+ * PHP versions 4 and 5
9
+ *
10
+ * If {@link self::setBlockLength() setBlockLength()} isn't called, it'll be assumed to be 128 bits. If
11
+ * {@link self::setKeyLength() setKeyLength()} isn't called, it'll be calculated from
12
+ * {@link self::setKey() setKey()}. ie. if the key is 128-bits, the key length will be 128-bits. If it's
13
+ * 136-bits it'll be null-padded to 192-bits and 192 bits will be the key length until
14
+ * {@link self::setKey() setKey()} is called, again, at which point, it'll be recalculated.
15
+ *
16
+ * Not all Rijndael implementations may support 160-bits or 224-bits as the block length / key length. mcrypt, for example,
17
+ * does not. AES, itself, only supports block lengths of 128 and key lengths of 128, 192, and 256.
18
+ * {@link http://csrc.nist.gov/archive/aes/rijndael/Rijndael-ammended.pdf#page=10 Rijndael-ammended.pdf#page=10} defines the
19
+ * algorithm for block lengths of 192 and 256 but not for block lengths / key lengths of 160 and 224. Indeed, 160 and 224
20
+ * are first defined as valid key / block lengths in
21
+ * {@link http://csrc.nist.gov/archive/aes/rijndael/Rijndael-ammended.pdf#page=44 Rijndael-ammended.pdf#page=44}:
22
+ * Extensions: Other block and Cipher Key lengths.
23
+ * Note: Use of 160/224-bit Keys must be explicitly set by setKeyLength(160) respectively setKeyLength(224).
24
+ *
25
+ * {@internal The variable names are the same as those in
26
+ * {@link http://www.csrc.nist.gov/publications/fips/fips197/fips-197.pdf#page=10 fips-197.pdf#page=10}.}}
27
+ *
28
+ * Here's a short example of how to use this library:
29
+ * <code>
30
+ * <?php
31
+ * include 'Crypt/Rijndael.php';
32
+ *
33
+ * $rijndael = new Crypt_Rijndael();
34
+ *
35
+ * $rijndael->setKey('abcdefghijklmnop');
36
+ *
37
+ * $size = 10 * 1024;
38
+ * $plaintext = '';
39
+ * for ($i = 0; $i < $size; $i++) {
40
+ * $plaintext.= 'a';
41
+ * }
42
+ *
43
+ * echo $rijndael->decrypt($rijndael->encrypt($plaintext));
44
+ * ?>
45
+ * </code>
46
+ *
47
+ * LICENSE: Permission is hereby granted, free of charge, to any person obtaining a copy
48
+ * of this software and associated documentation files (the "Software"), to deal
49
+ * in the Software without restriction, including without limitation the rights
50
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
51
+ * copies of the Software, and to permit persons to whom the Software is
52
+ * furnished to do so, subject to the following conditions:
53
+ *
54
+ * The above copyright notice and this permission notice shall be included in
55
+ * all copies or substantial portions of the Software.
56
+ *
57
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
58
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
59
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
60
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
61
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
62
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
63
+ * THE SOFTWARE.
64
+ *
65
+ * @category Crypt
66
+ * @package Crypt_Rijndael
67
+ * @author Jim Wigginton <terrafrost@php.net>
68
+ * @copyright 2008 Jim Wigginton
69
+ * @license http://www.opensource.org/licenses/mit-license.html MIT License
70
+ * @link http://phpseclib.sourceforge.net
71
+ */
72
+
73
+ /**
74
+ * Include Crypt_Base
75
+ *
76
+ * Base cipher class
77
+ */
78
+ if (!class_exists('Crypt_Base')) {
79
+ include_once 'Base.php';
80
+ }
81
+
82
+ /**#@+
83
+ * @access public
84
+ * @see self::encrypt()
85
+ * @see self::decrypt()
86
+ */
87
+ /**
88
+ * Encrypt / decrypt using the Counter mode.
89
+ *
90
+ * Set to -1 since that's what Crypt/Random.php uses to index the CTR mode.
91
+ *
92
+ * @link http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation#Counter_.28CTR.29
93
+ */
94
+ define('CRYPT_RIJNDAEL_MODE_CTR', CRYPT_MODE_CTR);
95
+ /**
96
+ * Encrypt / decrypt using the Electronic Code Book mode.
97
+ *
98
+ * @link http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation#Electronic_codebook_.28ECB.29
99
+ */
100
+ define('CRYPT_RIJNDAEL_MODE_ECB', CRYPT_MODE_ECB);
101
+ /**
102
+ * Encrypt / decrypt using the Code Book Chaining mode.
103
+ *
104
+ * @link http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation#Cipher-block_chaining_.28CBC.29
105
+ */
106
+ define('CRYPT_RIJNDAEL_MODE_CBC', CRYPT_MODE_CBC);
107
+ /**
108
+ * Encrypt / decrypt using the Cipher Feedback mode.
109
+ *
110
+ * @link http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation#Cipher_feedback_.28CFB.29
111
+ */
112
+ define('CRYPT_RIJNDAEL_MODE_CFB', CRYPT_MODE_CFB);
113
+ /**
114
+ * Encrypt / decrypt using the Cipher Feedback mode.
115
+ *
116
+ * @link http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation#Output_feedback_.28OFB.29
117
+ */
118
+ define('CRYPT_RIJNDAEL_MODE_OFB', CRYPT_MODE_OFB);
119
+ /**#@-*/
120
+
121
+ /**
122
+ * Pure-PHP implementation of Rijndael.
123
+ *
124
+ * @package Crypt_Rijndael
125
+ * @author Jim Wigginton <terrafrost@php.net>
126
+ * @access public
127
+ */
128
+ class Crypt_Rijndael extends Crypt_Base
129
+ {
130
+ /**
131
+ * The namespace used by the cipher for its constants.
132
+ *
133
+ * @see Crypt_Base::const_namespace
134
+ * @var string
135
+ * @access private
136
+ */
137
+ var $const_namespace = 'RIJNDAEL';
138
+
139
+ /**
140
+ * The mcrypt specific name of the cipher
141
+ *
142
+ * Mcrypt is useable for 128/192/256-bit $block_size/$key_length. For 160/224 not.
143
+ * Crypt_Rijndael determines automatically whether mcrypt is useable
144
+ * or not for the current $block_size/$key_length.
145
+ * In case of, $cipher_name_mcrypt will be set dynamically at run time accordingly.
146
+ *
147
+ * @see Crypt_Base::cipher_name_mcrypt
148
+ * @see Crypt_Base::engine
149
+ * @see self::isValidEngine()
150
+ * @var string
151
+ * @access private
152
+ */
153
+ var $cipher_name_mcrypt = 'rijndael-128';
154
+
155
+ /**
156
+ * The default salt used by setPassword()
157
+ *
158
+ * @see Crypt_Base::password_default_salt
159
+ * @see Crypt_Base::setPassword()
160
+ * @var string
161
+ * @access private
162
+ */
163
+ var $password_default_salt = 'phpseclib';
164
+
165
+ /**
166
+ * The Key Schedule
167
+ *
168
+ * @see self::_setup()
169
+ * @var array
170
+ * @access private
171
+ */
172
+ var $w;
173
+
174
+ /**
175
+ * The Inverse Key Schedule
176
+ *
177
+ * @see self::_setup()
178
+ * @var array
179
+ * @access private
180
+ */
181
+ var $dw;
182
+
183
+ /**
184
+ * The Block Length divided by 32
185
+ *
186
+ * @see self::setBlockLength()
187
+ * @var int
188
+ * @access private
189
+ * @internal The max value is 256 / 32 = 8, the min value is 128 / 32 = 4. Exists in conjunction with $block_size
190
+ * because the encryption / decryption / key schedule creation requires this number and not $block_size. We could
191
+ * derive this from $block_size or vice versa, but that'd mean we'd have to do multiple shift operations, so in lieu
192
+ * of that, we'll just precompute it once.
193
+ */
194
+ var $Nb = 4;
195
+
196
+ /**
197
+ * The Key Length (in bytes)
198
+ *
199
+ * @see self::setKeyLength()
200
+ * @var int
201
+ * @access private
202
+ * @internal The max value is 256 / 8 = 32, the min value is 128 / 8 = 16. Exists in conjunction with $Nk
203
+ * because the encryption / decryption / key schedule creation requires this number and not $key_length. We could
204
+ * derive this from $key_length or vice versa, but that'd mean we'd have to do multiple shift operations, so in lieu
205
+ * of that, we'll just precompute it once.
206
+ */
207
+ var $key_length = 16;
208
+
209
+ /**
210
+ * The Key Length divided by 32
211
+ *
212
+ * @see self::setKeyLength()
213
+ * @var int
214
+ * @access private
215
+ * @internal The max value is 256 / 32 = 8, the min value is 128 / 32 = 4
216
+ */
217
+ var $Nk = 4;
218
+
219
+ /**
220
+ * The Number of Rounds
221
+ *
222
+ * @var int
223
+ * @access private
224
+ * @internal The max value is 14, the min value is 10.
225
+ */
226
+ var $Nr;
227
+
228
+ /**
229
+ * Shift offsets
230
+ *
231
+ * @var array
232
+ * @access private
233
+ */
234
+ var $c;
235
+
236
+ /**
237
+ * Holds the last used key- and block_size information
238
+ *
239
+ * @var array
240
+ * @access private
241
+ */
242
+ var $kl;
243
+
244
+ /**
245
+ * Sets the key.
246
+ *
247
+ * Keys can be of any length. Rijndael, itself, requires the use of a key that's between 128-bits and 256-bits long and
248
+ * whose length is a multiple of 32. If the key is less than 256-bits and the key length isn't set, we round the length
249
+ * up to the closest valid key length, padding $key with null bytes. If the key is more than 256-bits, we trim the
250
+ * excess bits.
251
+ *
252
+ * If the key is not explicitly set, it'll be assumed to be all null bytes.
253
+ *
254
+ * Note: 160/224-bit keys must explicitly set by setKeyLength(), otherwise they will be round/pad up to 192/256 bits.
255
+ *
256
+ * @see Crypt_Base:setKey()
257
+ * @see self::setKeyLength()
258
+ * @access public
259
+ * @param string $key
260
+ */
261
+ function setKey($key)
262
+ {
263
+ if (!$this->explicit_key_length) {
264
+ $length = strlen($key);
265
+ switch (true) {
266
+ case $length <= 16:
267
+ $this->key_size = 16;
268
+ break;
269
+ case $length <= 20:
270
+ $this->key_size = 20;
271
+ break;
272
+ case $length <= 24:
273
+ $this->key_size = 24;
274
+ break;
275
+ case $length <= 28:
276
+ $this->key_size = 28;
277
+ break;
278
+ default:
279
+ $this->key_size = 32;
280
+ }
281
+ }
282
+ parent::setKey($key);
283
+ }
284
+
285
+ /**
286
+ * Sets the key length
287
+ *
288
+ * Valid key lengths are 128, 160, 192, 224, and 256. If the length is less than 128, it will be rounded up to
289
+ * 128. If the length is greater than 128 and invalid, it will be rounded down to the closest valid amount.
290
+ *
291
+ * Note: phpseclib extends Rijndael (and AES) for using 160- and 224-bit keys but they are officially not defined
292
+ * and the most (if not all) implementations are not able using 160/224-bit keys but round/pad them up to
293
+ * 192/256 bits as, for example, mcrypt will do.
294
+ *
295
+ * That said, if you want be compatible with other Rijndael and AES implementations,
296
+ * you should not setKeyLength(160) or setKeyLength(224).
297
+ *
298
+ * Additional: In case of 160- and 224-bit keys, phpseclib will/can, for that reason, not use
299
+ * the mcrypt php extension, even if available.
300
+ * This results then in slower encryption.
301
+ *
302
+ * @access public
303
+ * @param int $length
304
+ */
305
+ function setKeyLength($length)
306
+ {
307
+ switch (true) {
308
+ case $length <= 128:
309
+ $this->key_length = 16;
310
+ break;
311
+ case $length <= 160:
312
+ $this->key_length = 20;
313
+ break;
314
+ case $length <= 192:
315
+ $this->key_length = 24;
316
+ break;
317
+ case $length <= 224:
318
+ $this->key_length = 28;
319
+ break;
320
+ default:
321
+ $this->key_length = 32;
322
+ }
323
+
324
+ parent::setKeyLength($length);
325
+ }
326
+
327
+ /**
328
+ * Sets the block length
329
+ *
330
+ * Valid block lengths are 128, 160, 192, 224, and 256. If the length is less than 128, it will be rounded up to
331
+ * 128. If the length is greater than 128 and invalid, it will be rounded down to the closest valid amount.
332
+ *
333
+ * @access public
334
+ * @param int $length
335
+ */
336
+ function setBlockLength($length)
337
+ {
338
+ $length >>= 5;
339
+ if ($length > 8) {
340
+ $length = 8;
341
+ } elseif ($length < 4) {
342
+ $length = 4;
343
+ }
344
+ $this->Nb = $length;
345
+ $this->block_size = $length << 2;
346
+ $this->changed = true;
347
+ $this->_setEngine();
348
+ }
349
+
350
+ /**
351
+ * Test for engine validity
352
+ *
353
+ * This is mainly just a wrapper to set things up for Crypt_Base::isValidEngine()
354
+ *
355
+ * @see Crypt_Base::Crypt_Base()
356
+ * @param int $engine
357
+ * @access public
358
+ * @return bool
359
+ */
360
+ function isValidEngine($engine)
361
+ {
362
+ switch ($engine) {
363
+ case CRYPT_ENGINE_OPENSSL:
364
+ if ($this->block_size != 16) {
365
+ return false;
366
+ }
367
+ $this->cipher_name_openssl_ecb = 'aes-' . ($this->key_length << 3) . '-ecb';
368
+ $this->cipher_name_openssl = 'aes-' . ($this->key_length << 3) . '-' . $this->_openssl_translate_mode();
369
+ break;
370
+ case CRYPT_ENGINE_MCRYPT:
371
+ $this->cipher_name_mcrypt = 'rijndael-' . ($this->block_size << 3);
372
+ if ($this->key_length % 8) { // is it a 160/224-bit key?
373
+ // mcrypt is not usable for them, only for 128/192/256-bit keys
374
+ return false;
375
+ }
376
+ }
377
+
378
+ return parent::isValidEngine($engine);
379
+ }
380
+
381
+ /**
382
+ * Encrypts a block
383
+ *
384
+ * @access private
385
+ * @param string $in
386
+ * @return string
387
+ */
388
+ function _encryptBlock($in)
389
+ {
390
+ static $tables;
391
+ if (empty($tables)) {
392
+ $tables = &$this->_getTables();
393
+ }
394
+ $t0 = $tables[0];
395
+ $t1 = $tables[1];
396
+ $t2 = $tables[2];
397
+ $t3 = $tables[3];
398
+ $sbox = $tables[4];
399
+
400
+ $state = array();
401
+ $words = unpack('N*', $in);
402
+
403
+ $c = $this->c;
404
+ $w = $this->w;
405
+ $Nb = $this->Nb;
406
+ $Nr = $this->Nr;
407
+
408
+ // addRoundKey
409
+ $wc = $Nb - 1;
410
+ foreach ($words as $word) {
411
+ $state[] = $word ^ $w[++$wc];
412
+ }
413
+
414
+ // fips-197.pdf#page=19, "Figure 5. Pseudo Code for the Cipher", states that this loop has four components -
415
+ // subBytes, shiftRows, mixColumns, and addRoundKey. fips-197.pdf#page=30, "Implementation Suggestions Regarding
416
+ // Various Platforms" suggests that performs enhanced implementations are described in Rijndael-ammended.pdf.
417
+ // Rijndael-ammended.pdf#page=20, "Implementation aspects / 32-bit processor", discusses such an optimization.
418
+ // Unfortunately, the description given there is not quite correct. Per aes.spec.v316.pdf#page=19 [1],
419
+ // equation (7.4.7) is supposed to use addition instead of subtraction, so we'll do that here, as well.
420
+
421
+ // [1] http://fp.gladman.plus.com/cryptography_technology/rijndael/aes.spec.v316.pdf
422
+ $temp = array();
423
+ for ($round = 1; $round < $Nr; ++$round) {
424
+ $i = 0; // $c[0] == 0
425
+ $j = $c[1];
426
+ $k = $c[2];
427
+ $l = $c[3];
428
+
429
+ while ($i < $Nb) {
430
+ $temp[$i] = $t0[$state[$i] >> 24 & 0x000000FF] ^
431
+ $t1[$state[$j] >> 16 & 0x000000FF] ^
432
+ $t2[$state[$k] >> 8 & 0x000000FF] ^
433
+ $t3[$state[$l] & 0x000000FF] ^
434
+ $w[++$wc];
435
+ ++$i;
436
+ $j = ($j + 1) % $Nb;
437
+ $k = ($k + 1) % $Nb;
438
+ $l = ($l + 1) % $Nb;
439
+ }
440
+ $state = $temp;
441
+ }
442
+
443
+ // subWord
444
+ for ($i = 0; $i < $Nb; ++$i) {
445
+ $state[$i] = $sbox[$state[$i] & 0x000000FF] |
446
+ ($sbox[$state[$i] >> 8 & 0x000000FF] << 8) |
447
+ ($sbox[$state[$i] >> 16 & 0x000000FF] << 16) |
448
+ ($sbox[$state[$i] >> 24 & 0x000000FF] << 24);
449
+ }
450
+
451
+ // shiftRows + addRoundKey
452
+ $i = 0; // $c[0] == 0
453
+ $j = $c[1];
454
+ $k = $c[2];
455
+ $l = $c[3];
456
+ while ($i < $Nb) {
457
+ $temp[$i] = ($state[$i] & 0xFF000000) ^
458
+ ($state[$j] & 0x00FF0000) ^
459
+ ($state[$k] & 0x0000FF00) ^
460
+ ($state[$l] & 0x000000FF) ^
461
+ $w[$i];
462
+ ++$i;
463
+ $j = ($j + 1) % $Nb;
464
+ $k = ($k + 1) % $Nb;
465
+ $l = ($l + 1) % $Nb;
466
+ }
467
+
468
+ switch ($Nb) {
469
+ case 8:
470
+ return pack('N*', $temp[0], $temp[1], $temp[2], $temp[3], $temp[4], $temp[5], $temp[6], $temp[7]);
471
+ case 7:
472
+ return pack('N*', $temp[0], $temp[1], $temp[2], $temp[3], $temp[4], $temp[5], $temp[6]);
473
+ case 6:
474
+ return pack('N*', $temp[0], $temp[1], $temp[2], $temp[3], $temp[4], $temp[5]);
475
+ case 5:
476
+ return pack('N*', $temp[0], $temp[1], $temp[2], $temp[3], $temp[4]);
477
+ default:
478
+ return pack('N*', $temp[0], $temp[1], $temp[2], $temp[3]);
479
+ }
480
+ }
481
+
482
+ /**
483
+ * Decrypts a block
484
+ *
485
+ * @access private
486
+ * @param string $in
487
+ * @return string
488
+ */
489
+ function _decryptBlock($in)
490
+ {
491
+ static $invtables;
492
+ if (empty($invtables)) {
493
+ $invtables = &$this->_getInvTables();
494
+ }
495
+ $dt0 = $invtables[0];
496
+ $dt1 = $invtables[1];
497
+ $dt2 = $invtables[2];
498
+ $dt3 = $invtables[3];
499
+ $isbox = $invtables[4];
500
+
501
+ $state = array();
502
+ $words = unpack('N*', $in);
503
+
504
+ $c = $this->c;
505
+ $dw = $this->dw;
506
+ $Nb = $this->Nb;
507
+ $Nr = $this->Nr;
508
+
509
+ // addRoundKey
510
+ $wc = $Nb - 1;
511
+ foreach ($words as $word) {
512
+ $state[] = $word ^ $dw[++$wc];
513
+ }
514
+
515
+ $temp = array();
516
+ for ($round = $Nr - 1; $round > 0; --$round) {
517
+ $i = 0; // $c[0] == 0
518
+ $j = $Nb - $c[1];
519
+ $k = $Nb - $c[2];
520
+ $l = $Nb - $c[3];
521
+
522
+ while ($i < $Nb) {
523
+ $temp[$i] = $dt0[$state[$i] >> 24 & 0x000000FF] ^
524
+ $dt1[$state[$j] >> 16 & 0x000000FF] ^
525
+ $dt2[$state[$k] >> 8 & 0x000000FF] ^
526
+ $dt3[$state[$l] & 0x000000FF] ^
527
+ $dw[++$wc];
528
+ ++$i;
529
+ $j = ($j + 1) % $Nb;
530
+ $k = ($k + 1) % $Nb;
531
+ $l = ($l + 1) % $Nb;
532
+ }
533
+ $state = $temp;
534
+ }
535
+
536
+ // invShiftRows + invSubWord + addRoundKey
537
+ $i = 0; // $c[0] == 0
538
+ $j = $Nb - $c[1];
539
+ $k = $Nb - $c[2];
540
+ $l = $Nb - $c[3];
541
+
542
+ while ($i < $Nb) {
543
+ $word = ($state[$i] & 0xFF000000) |
544
+ ($state[$j] & 0x00FF0000) |
545
+ ($state[$k] & 0x0000FF00) |
546
+ ($state[$l] & 0x000000FF);
547
+
548
+ $temp[$i] = $dw[$i] ^ ($isbox[$word & 0x000000FF] |
549
+ ($isbox[$word >> 8 & 0x000000FF] << 8) |
550
+ ($isbox[$word >> 16 & 0x000000FF] << 16) |
551
+ ($isbox[$word >> 24 & 0x000000FF] << 24));
552
+ ++$i;
553
+ $j = ($j + 1) % $Nb;
554
+ $k = ($k + 1) % $Nb;
555
+ $l = ($l + 1) % $Nb;
556
+ }
557
+
558
+ switch ($Nb) {
559
+ case 8:
560
+ return pack('N*', $temp[0], $temp[1], $temp[2], $temp[3], $temp[4], $temp[5], $temp[6], $temp[7]);
561
+ case 7:
562
+ return pack('N*', $temp[0], $temp[1], $temp[2], $temp[3], $temp[4], $temp[5], $temp[6]);
563
+ case 6:
564
+ return pack('N*', $temp[0], $temp[1], $temp[2], $temp[3], $temp[4], $temp[5]);
565
+ case 5:
566
+ return pack('N*', $temp[0], $temp[1], $temp[2], $temp[3], $temp[4]);
567
+ default:
568
+ return pack('N*', $temp[0], $temp[1], $temp[2], $temp[3]);
569
+ }
570
+ }
571
+
572
+ /**
573
+ * Setup the key (expansion)
574
+ *
575
+ * @see Crypt_Base::_setupKey()
576
+ * @access private
577
+ */
578
+ function _setupKey()
579
+ {
580
+ // Each number in $rcon is equal to the previous number multiplied by two in Rijndael's finite field.
581
+ // See http://en.wikipedia.org/wiki/Finite_field_arithmetic#Multiplicative_inverse
582
+ static $rcon = array(0,
583
+ 0x01000000, 0x02000000, 0x04000000, 0x08000000, 0x10000000,
584
+ 0x20000000, 0x40000000, 0x80000000, 0x1B000000, 0x36000000,
585
+ 0x6C000000, 0xD8000000, 0xAB000000, 0x4D000000, 0x9A000000,
586
+ 0x2F000000, 0x5E000000, 0xBC000000, 0x63000000, 0xC6000000,
587
+ 0x97000000, 0x35000000, 0x6A000000, 0xD4000000, 0xB3000000,
588
+ 0x7D000000, 0xFA000000, 0xEF000000, 0xC5000000, 0x91000000
589
+ );
590
+
591
+ if (isset($this->kl['key']) && $this->key === $this->kl['key'] && $this->key_length === $this->kl['key_length'] && $this->block_size === $this->kl['block_size']) {
592
+ // already expanded
593
+ return;
594
+ }
595
+ $this->kl = array('key' => $this->key, 'key_length' => $this->key_length, 'block_size' => $this->block_size);
596
+
597
+ $this->Nk = $this->key_length >> 2;
598
+ // see Rijndael-ammended.pdf#page=44
599
+ $this->Nr = max($this->Nk, $this->Nb) + 6;
600
+
601
+ // shift offsets for Nb = 5, 7 are defined in Rijndael-ammended.pdf#page=44,
602
+ // "Table 8: Shift offsets in Shiftrow for the alternative block lengths"
603
+ // shift offsets for Nb = 4, 6, 8 are defined in Rijndael-ammended.pdf#page=14,
604
+ // "Table 2: Shift offsets for different block lengths"
605
+ switch ($this->Nb) {
606
+ case 4:
607
+ case 5:
608
+ case 6:
609
+ $this->c = array(0, 1, 2, 3);
610
+ break;
611
+ case 7:
612
+ $this->c = array(0, 1, 2, 4);
613
+ break;
614
+ case 8:
615
+ $this->c = array(0, 1, 3, 4);
616
+ }
617
+
618
+ $w = array_values(unpack('N*words', $this->key));
619
+
620
+ $length = $this->Nb * ($this->Nr + 1);
621
+ for ($i = $this->Nk; $i < $length; $i++) {
622
+ $temp = $w[$i - 1];
623
+ if ($i % $this->Nk == 0) {
624
+ // according to <http://php.net/language.types.integer>, "the size of an integer is platform-dependent".
625
+ // on a 32-bit machine, it's 32-bits, and on a 64-bit machine, it's 64-bits. on a 32-bit machine,
626
+ // 0xFFFFFFFF << 8 == 0xFFFFFF00, but on a 64-bit machine, it equals 0xFFFFFFFF00. as such, doing 'and'
627
+ // with 0xFFFFFFFF (or 0xFFFFFF00) on a 32-bit machine is unnecessary, but on a 64-bit machine, it is.
628
+ $temp = (($temp << 8) & 0xFFFFFF00) | (($temp >> 24) & 0x000000FF); // rotWord
629
+ $temp = $this->_subWord($temp) ^ $rcon[$i / $this->Nk];
630
+ } elseif ($this->Nk > 6 && $i % $this->Nk == 4) {
631
+ $temp = $this->_subWord($temp);
632
+ }
633
+ $w[$i] = $w[$i - $this->Nk] ^ $temp;
634
+ }
635
+
636
+ // convert the key schedule from a vector of $Nb * ($Nr + 1) length to a matrix with $Nr + 1 rows and $Nb columns
637
+ // and generate the inverse key schedule. more specifically,
638
+ // according to <http://csrc.nist.gov/archive/aes/rijndael/Rijndael-ammended.pdf#page=23> (section 5.3.3),
639
+ // "The key expansion for the Inverse Cipher is defined as follows:
640
+ // 1. Apply the Key Expansion.
641
+ // 2. Apply InvMixColumn to all Round Keys except the first and the last one."
642
+ // also, see fips-197.pdf#page=27, "5.3.5 Equivalent Inverse Cipher"
643
+ list($dt0, $dt1, $dt2, $dt3) = $this->_getInvTables();
644
+ $temp = $this->w = $this->dw = array();
645
+ for ($i = $row = $col = 0; $i < $length; $i++, $col++) {
646
+ if ($col == $this->Nb) {
647
+ if ($row == 0) {
648
+ $this->dw[0] = $this->w[0];
649
+ } else {
650
+ // subWord + invMixColumn + invSubWord = invMixColumn
651
+ $j = 0;
652
+ while ($j < $this->Nb) {
653
+ $dw = $this->_subWord($this->w[$row][$j]);
654
+ $temp[$j] = $dt0[$dw >> 24 & 0x000000FF] ^
655
+ $dt1[$dw >> 16 & 0x000000FF] ^
656
+ $dt2[$dw >> 8 & 0x000000FF] ^
657
+ $dt3[$dw & 0x000000FF];
658
+ $j++;
659
+ }
660
+ $this->dw[$row] = $temp;
661
+ }
662
+
663
+ $col = 0;
664
+ $row++;
665
+ }
666
+ $this->w[$row][$col] = $w[$i];
667
+ }
668
+
669
+ $this->dw[$row] = $this->w[$row];
670
+
671
+ // Converting to 1-dim key arrays (both ascending)
672
+ $this->dw = array_reverse($this->dw);
673
+ $w = array_pop($this->w);
674
+ $dw = array_pop($this->dw);
675
+ foreach ($this->w as $r => $wr) {
676
+ foreach ($wr as $c => $wc) {
677
+ $w[] = $wc;
678
+ $dw[] = $this->dw[$r][$c];
679
+ }
680
+ }
681
+ $this->w = $w;
682
+ $this->dw = $dw;
683
+ }
684
+
685
+ /**
686
+ * Performs S-Box substitutions
687
+ *
688
+ * @access private
689
+ * @param int $word
690
+ */
691
+ function _subWord($word)
692
+ {
693
+ static $sbox;
694
+ if (empty($sbox)) {
695
+ list(, , , , $sbox) = $this->_getTables();
696
+ }
697
+
698
+ return $sbox[$word & 0x000000FF] |
699
+ ($sbox[$word >> 8 & 0x000000FF] << 8) |
700
+ ($sbox[$word >> 16 & 0x000000FF] << 16) |
701
+ ($sbox[$word >> 24 & 0x000000FF] << 24);
702
+ }
703
+
704
+ /**
705
+ * Provides the mixColumns and sboxes tables
706
+ *
707
+ * @see Crypt_Rijndael:_encryptBlock()
708
+ * @see Crypt_Rijndael:_setupInlineCrypt()
709
+ * @see Crypt_Rijndael:_subWord()
710
+ * @access private
711
+ * @return array &$tables
712
+ */
713
+ function &_getTables()
714
+ {
715
+ static $tables;
716
+ if (empty($tables)) {
717
+ // according to <http://csrc.nist.gov/archive/aes/rijndael/Rijndael-ammended.pdf#page=19> (section 5.2.1),
718
+ // precomputed tables can be used in the mixColumns phase. in that example, they're assigned t0...t3, so
719
+ // those are the names we'll use.
720
+ $t3 = array_map('intval', array(
721
+ // with array_map('intval', ...) we ensure we have only int's and not
722
+ // some slower floats converted by php automatically on high values
723
+ 0x6363A5C6, 0x7C7C84F8, 0x777799EE, 0x7B7B8DF6, 0xF2F20DFF, 0x6B6BBDD6, 0x6F6FB1DE, 0xC5C55491,
724
+ 0x30305060, 0x01010302, 0x6767A9CE, 0x2B2B7D56, 0xFEFE19E7, 0xD7D762B5, 0xABABE64D, 0x76769AEC,
725
+ 0xCACA458F, 0x82829D1F, 0xC9C94089, 0x7D7D87FA, 0xFAFA15EF, 0x5959EBB2, 0x4747C98E, 0xF0F00BFB,
726
+ 0xADADEC41, 0xD4D467B3, 0xA2A2FD5F, 0xAFAFEA45, 0x9C9CBF23, 0xA4A4F753, 0x727296E4, 0xC0C05B9B,
727
+ 0xB7B7C275, 0xFDFD1CE1, 0x9393AE3D, 0x26266A4C, 0x36365A6C, 0x3F3F417E, 0xF7F702F5, 0xCCCC4F83,
728
+ 0x34345C68, 0xA5A5F451, 0xE5E534D1, 0xF1F108F9, 0x717193E2, 0xD8D873AB, 0x31315362, 0x15153F2A,
729
+ 0x04040C08, 0xC7C75295, 0x23236546, 0xC3C35E9D, 0x18182830, 0x9696A137, 0x05050F0A, 0x9A9AB52F,
730
+ 0x0707090E, 0x12123624, 0x80809B1B, 0xE2E23DDF, 0xEBEB26CD, 0x2727694E, 0xB2B2CD7F, 0x75759FEA,
731
+ 0x09091B12, 0x83839E1D, 0x2C2C7458, 0x1A1A2E34, 0x1B1B2D36, 0x6E6EB2DC, 0x5A5AEEB4, 0xA0A0FB5B,
732
+ 0x5252F6A4, 0x3B3B4D76, 0xD6D661B7, 0xB3B3CE7D, 0x29297B52, 0xE3E33EDD, 0x2F2F715E, 0x84849713,
733
+ 0x5353F5A6, 0xD1D168B9, 0x00000000, 0xEDED2CC1, 0x20206040, 0xFCFC1FE3, 0xB1B1C879, 0x5B5BEDB6,
734
+ 0x6A6ABED4, 0xCBCB468D, 0xBEBED967, 0x39394B72, 0x4A4ADE94, 0x4C4CD498, 0x5858E8B0, 0xCFCF4A85,
735
+ 0xD0D06BBB, 0xEFEF2AC5, 0xAAAAE54F, 0xFBFB16ED, 0x4343C586, 0x4D4DD79A, 0x33335566, 0x85859411,
736
+ 0x4545CF8A, 0xF9F910E9, 0x02020604, 0x7F7F81FE, 0x5050F0A0, 0x3C3C4478, 0x9F9FBA25, 0xA8A8E34B,
737
+ 0x5151F3A2, 0xA3A3FE5D, 0x4040C080, 0x8F8F8A05, 0x9292AD3F, 0x9D9DBC21, 0x38384870, 0xF5F504F1,
738
+ 0xBCBCDF63, 0xB6B6C177, 0xDADA75AF, 0x21216342, 0x10103020, 0xFFFF1AE5, 0xF3F30EFD, 0xD2D26DBF,
739
+ 0xCDCD4C81, 0x0C0C1418, 0x13133526, 0xECEC2FC3, 0x5F5FE1BE, 0x9797A235, 0x4444CC88, 0x1717392E,
740
+ 0xC4C45793, 0xA7A7F255, 0x7E7E82FC, 0x3D3D477A, 0x6464ACC8, 0x5D5DE7BA, 0x19192B32, 0x737395E6,
741
+ 0x6060A0C0, 0x81819819, 0x4F4FD19E, 0xDCDC7FA3, 0x22226644, 0x2A2A7E54, 0x9090AB3B, 0x8888830B,
742
+ 0x4646CA8C, 0xEEEE29C7, 0xB8B8D36B, 0x14143C28, 0xDEDE79A7, 0x5E5EE2BC, 0x0B0B1D16, 0xDBDB76AD,
743
+ 0xE0E03BDB, 0x32325664, 0x3A3A4E74, 0x0A0A1E14, 0x4949DB92, 0x06060A0C, 0x24246C48, 0x5C5CE4B8,
744
+ 0xC2C25D9F, 0xD3D36EBD, 0xACACEF43, 0x6262A6C4, 0x9191A839, 0x9595A431, 0xE4E437D3, 0x79798BF2,
745
+ 0xE7E732D5, 0xC8C8438B, 0x3737596E, 0x6D6DB7DA, 0x8D8D8C01, 0xD5D564B1, 0x4E4ED29C, 0xA9A9E049,
746
+ 0x6C6CB4D8, 0x5656FAAC, 0xF4F407F3, 0xEAEA25CF, 0x6565AFCA, 0x7A7A8EF4, 0xAEAEE947, 0x08081810,
747
+ 0xBABAD56F, 0x787888F0, 0x25256F4A, 0x2E2E725C, 0x1C1C2438, 0xA6A6F157, 0xB4B4C773, 0xC6C65197,
748
+ 0xE8E823CB, 0xDDDD7CA1, 0x74749CE8, 0x1F1F213E, 0x4B4BDD96, 0xBDBDDC61, 0x8B8B860D, 0x8A8A850F,
749
+ 0x707090E0, 0x3E3E427C, 0xB5B5C471, 0x6666AACC, 0x4848D890, 0x03030506, 0xF6F601F7, 0x0E0E121C,
750
+ 0x6161A3C2, 0x35355F6A, 0x5757F9AE, 0xB9B9D069, 0x86869117, 0xC1C15899, 0x1D1D273A, 0x9E9EB927,
751
+ 0xE1E138D9, 0xF8F813EB, 0x9898B32B, 0x11113322, 0x6969BBD2, 0xD9D970A9, 0x8E8E8907, 0x9494A733,
752
+ 0x9B9BB62D, 0x1E1E223C, 0x87879215, 0xE9E920C9, 0xCECE4987, 0x5555FFAA, 0x28287850, 0xDFDF7AA5,
753
+ 0x8C8C8F03, 0xA1A1F859, 0x89898009, 0x0D0D171A, 0xBFBFDA65, 0xE6E631D7, 0x4242C684, 0x6868B8D0,
754
+ 0x4141C382, 0x9999B029, 0x2D2D775A, 0x0F0F111E, 0xB0B0CB7B, 0x5454FCA8, 0xBBBBD66D, 0x16163A2C
755
+ ));
756
+
757
+ foreach ($t3 as $t3i) {
758
+ $t0[] = (($t3i << 24) & 0xFF000000) | (($t3i >> 8) & 0x00FFFFFF);
759
+ $t1[] = (($t3i << 16) & 0xFFFF0000) | (($t3i >> 16) & 0x0000FFFF);
760
+ $t2[] = (($t3i << 8) & 0xFFFFFF00) | (($t3i >> 24) & 0x000000FF);
761
+ }
762
+
763
+ $tables = array(
764
+ // The Precomputed mixColumns tables t0 - t3
765
+ $t0,
766
+ $t1,
767
+ $t2,
768
+ $t3,
769
+ // The SubByte S-Box
770
+ array(
771
+ 0x63, 0x7C, 0x77, 0x7B, 0xF2, 0x6B, 0x6F, 0xC5, 0x30, 0x01, 0x67, 0x2B, 0xFE, 0xD7, 0xAB, 0x76,
772
+ 0xCA, 0x82, 0xC9, 0x7D, 0xFA, 0x59, 0x47, 0xF0, 0xAD, 0xD4, 0xA2, 0xAF, 0x9C, 0xA4, 0x72, 0xC0,
773
+ 0xB7, 0xFD, 0x93, 0x26, 0x36, 0x3F, 0xF7, 0xCC, 0x34, 0xA5, 0xE5, 0xF1, 0x71, 0xD8, 0x31, 0x15,
774
+ 0x04, 0xC7, 0x23, 0xC3, 0x18, 0x96, 0x05, 0x9A, 0x07, 0x12, 0x80, 0xE2, 0xEB, 0x27, 0xB2, 0x75,
775
+ 0x09, 0x83, 0x2C, 0x1A, 0x1B, 0x6E, 0x5A, 0xA0, 0x52, 0x3B, 0xD6, 0xB3, 0x29, 0xE3, 0x2F, 0x84,
776
+ 0x53, 0xD1, 0x00, 0xED, 0x20, 0xFC, 0xB1, 0x5B, 0x6A, 0xCB, 0xBE, 0x39, 0x4A, 0x4C, 0x58, 0xCF,
777
+ 0xD0, 0xEF, 0xAA, 0xFB, 0x43, 0x4D, 0x33, 0x85, 0x45, 0xF9, 0x02, 0x7F, 0x50, 0x3C, 0x9F, 0xA8,
778
+ 0x51, 0xA3, 0x40, 0x8F, 0x92, 0x9D, 0x38, 0xF5, 0xBC, 0xB6, 0xDA, 0x21, 0x10, 0xFF, 0xF3, 0xD2,
779
+ 0xCD, 0x0C, 0x13, 0xEC, 0x5F, 0x97, 0x44, 0x17, 0xC4, 0xA7, 0x7E, 0x3D, 0x64, 0x5D, 0x19, 0x73,
780
+ 0x60, 0x81, 0x4F, 0xDC, 0x22, 0x2A, 0x90, 0x88, 0x46, 0xEE, 0xB8, 0x14, 0xDE, 0x5E, 0x0B, 0xDB,
781
+ 0xE0, 0x32, 0x3A, 0x0A, 0x49, 0x06, 0x24, 0x5C, 0xC2, 0xD3, 0xAC, 0x62, 0x91, 0x95, 0xE4, 0x79,
782
+ 0xE7, 0xC8, 0x37, 0x6D, 0x8D, 0xD5, 0x4E, 0xA9, 0x6C, 0x56, 0xF4, 0xEA, 0x65, 0x7A, 0xAE, 0x08,
783
+ 0xBA, 0x78, 0x25, 0x2E, 0x1C, 0xA6, 0xB4, 0xC6, 0xE8, 0xDD, 0x74, 0x1F, 0x4B, 0xBD, 0x8B, 0x8A,
784
+ 0x70, 0x3E, 0xB5, 0x66, 0x48, 0x03, 0xF6, 0x0E, 0x61, 0x35, 0x57, 0xB9, 0x86, 0xC1, 0x1D, 0x9E,
785
+ 0xE1, 0xF8, 0x98, 0x11, 0x69, 0xD9, 0x8E, 0x94, 0x9B, 0x1E, 0x87, 0xE9, 0xCE, 0x55, 0x28, 0xDF,
786
+ 0x8C, 0xA1, 0x89, 0x0D, 0xBF, 0xE6, 0x42, 0x68, 0x41, 0x99, 0x2D, 0x0F, 0xB0, 0x54, 0xBB, 0x16
787
+ )
788
+ );
789
+ }
790
+ return $tables;
791
+ }
792
+
793
+ /**
794
+ * Provides the inverse mixColumns and inverse sboxes tables
795
+ *
796
+ * @see Crypt_Rijndael:_decryptBlock()
797
+ * @see Crypt_Rijndael:_setupInlineCrypt()
798
+ * @see Crypt_Rijndael:_setupKey()
799
+ * @access private
800
+ * @return array &$tables
801
+ */
802
+ function &_getInvTables()
803
+ {
804
+ static $tables;
805
+ if (empty($tables)) {
806
+ $dt3 = array_map('intval', array(
807
+ 0xF4A75051, 0x4165537E, 0x17A4C31A, 0x275E963A, 0xAB6BCB3B, 0x9D45F11F, 0xFA58ABAC, 0xE303934B,
808
+ 0x30FA5520, 0x766DF6AD, 0xCC769188, 0x024C25F5, 0xE5D7FC4F, 0x2ACBD7C5, 0x35448026, 0x62A38FB5,
809
+ 0xB15A49DE, 0xBA1B6725, 0xEA0E9845, 0xFEC0E15D, 0x2F7502C3, 0x4CF01281, 0x4697A38D, 0xD3F9C66B,
810
+ 0x8F5FE703, 0x929C9515, 0x6D7AEBBF, 0x5259DA95, 0xBE832DD4, 0x7421D358, 0xE0692949, 0xC9C8448E,
811
+ 0xC2896A75, 0x8E7978F4, 0x583E6B99, 0xB971DD27, 0xE14FB6BE, 0x88AD17F0, 0x20AC66C9, 0xCE3AB47D,
812
+ 0xDF4A1863, 0x1A3182E5, 0x51336097, 0x537F4562, 0x6477E0B1, 0x6BAE84BB, 0x81A01CFE, 0x082B94F9,
813
+ 0x48685870, 0x45FD198F, 0xDE6C8794, 0x7BF8B752, 0x73D323AB, 0x4B02E272, 0x1F8F57E3, 0x55AB2A66,
814
+ 0xEB2807B2, 0xB5C2032F, 0xC57B9A86, 0x3708A5D3, 0x2887F230, 0xBFA5B223, 0x036ABA02, 0x16825CED,
815
+ 0xCF1C2B8A, 0x79B492A7, 0x07F2F0F3, 0x69E2A14E, 0xDAF4CD65, 0x05BED506, 0x34621FD1, 0xA6FE8AC4,
816
+ 0x2E539D34, 0xF355A0A2, 0x8AE13205, 0xF6EB75A4, 0x83EC390B, 0x60EFAA40, 0x719F065E, 0x6E1051BD,
817
+ 0x218AF93E, 0xDD063D96, 0x3E05AEDD, 0xE6BD464D, 0x548DB591, 0xC45D0571, 0x06D46F04, 0x5015FF60,
818
+ 0x98FB2419, 0xBDE997D6, 0x4043CC89, 0xD99E7767, 0xE842BDB0, 0x898B8807, 0x195B38E7, 0xC8EEDB79,
819
+ 0x7C0A47A1, 0x420FE97C, 0x841EC9F8, 0x00000000, 0x80868309, 0x2BED4832, 0x1170AC1E, 0x5A724E6C,
820
+ 0x0EFFFBFD, 0x8538560F, 0xAED51E3D, 0x2D392736, 0x0FD9640A, 0x5CA62168, 0x5B54D19B, 0x362E3A24,
821
+ 0x0A67B10C, 0x57E70F93, 0xEE96D2B4, 0x9B919E1B, 0xC0C54F80, 0xDC20A261, 0x774B695A, 0x121A161C,
822
+ 0x93BA0AE2, 0xA02AE5C0, 0x22E0433C, 0x1B171D12, 0x090D0B0E, 0x8BC7ADF2, 0xB6A8B92D, 0x1EA9C814,
823
+ 0xF1198557, 0x75074CAF, 0x99DDBBEE, 0x7F60FDA3, 0x01269FF7, 0x72F5BC5C, 0x663BC544, 0xFB7E345B,
824
+ 0x4329768B, 0x23C6DCCB, 0xEDFC68B6, 0xE4F163B8, 0x31DCCAD7, 0x63851042, 0x97224013, 0xC6112084,
825
+ 0x4A247D85, 0xBB3DF8D2, 0xF93211AE, 0x29A16DC7, 0x9E2F4B1D, 0xB230F3DC, 0x8652EC0D, 0xC1E3D077,
826
+ 0xB3166C2B, 0x70B999A9, 0x9448FA11, 0xE9642247, 0xFC8CC4A8, 0xF03F1AA0, 0x7D2CD856, 0x3390EF22,
827
+ 0x494EC787, 0x38D1C1D9, 0xCAA2FE8C, 0xD40B3698, 0xF581CFA6, 0x7ADE28A5, 0xB78E26DA, 0xADBFA43F,
828
+ 0x3A9DE42C, 0x78920D50, 0x5FCC9B6A, 0x7E466254, 0x8D13C2F6, 0xD8B8E890, 0x39F75E2E, 0xC3AFF582,
829
+ 0x5D80BE9F, 0xD0937C69, 0xD52DA96F, 0x2512B3CF, 0xAC993BC8, 0x187DA710, 0x9C636EE8, 0x3BBB7BDB,
830
+ 0x267809CD, 0x5918F46E, 0x9AB701EC, 0x4F9AA883, 0x956E65E6, 0xFFE67EAA, 0xBCCF0821, 0x15E8E6EF,
831
+ 0xE79BD9BA, 0x6F36CE4A, 0x9F09D4EA, 0xB07CD629, 0xA4B2AF31, 0x3F23312A, 0xA59430C6, 0xA266C035,
832
+ 0x4EBC3774, 0x82CAA6FC, 0x90D0B0E0, 0xA7D81533, 0x04984AF1, 0xECDAF741, 0xCD500E7F, 0x91F62F17,
833
+ 0x4DD68D76, 0xEFB04D43, 0xAA4D54CC, 0x9604DFE4, 0xD1B5E39E, 0x6A881B4C, 0x2C1FB8C1, 0x65517F46,
834
+ 0x5EEA049D, 0x8C355D01, 0x877473FA, 0x0B412EFB, 0x671D5AB3, 0xDBD25292, 0x105633E9, 0xD647136D,
835
+ 0xD7618C9A, 0xA10C7A37, 0xF8148E59, 0x133C89EB, 0xA927EECE, 0x61C935B7, 0x1CE5EDE1, 0x47B13C7A,
836
+ 0xD2DF599C, 0xF2733F55, 0x14CE7918, 0xC737BF73, 0xF7CDEA53, 0xFDAA5B5F, 0x3D6F14DF, 0x44DB8678,
837
+ 0xAFF381CA, 0x68C43EB9, 0x24342C38, 0xA3405FC2, 0x1DC37216, 0xE2250CBC, 0x3C498B28, 0x0D9541FF,
838
+ 0xA8017139, 0x0CB3DE08, 0xB4E49CD8, 0x56C19064, 0xCB84617B, 0x32B670D5, 0x6C5C7448, 0xB85742D0
839
+ ));
840
+
841
+ foreach ($dt3 as $dt3i) {
842
+ $dt0[] = (($dt3i << 24) & 0xFF000000) | (($dt3i >> 8) & 0x00FFFFFF);
843
+ $dt1[] = (($dt3i << 16) & 0xFFFF0000) | (($dt3i >> 16) & 0x0000FFFF);
844
+ $dt2[] = (($dt3i << 8) & 0xFFFFFF00) | (($dt3i >> 24) & 0x000000FF);
845
+ };
846
+
847
+ $tables = array(
848
+ // The Precomputed inverse mixColumns tables dt0 - dt3
849
+ $dt0,
850
+ $dt1,
851
+ $dt2,
852
+ $dt3,
853
+ // The inverse SubByte S-Box
854
+ array(
855
+ 0x52, 0x09, 0x6A, 0xD5, 0x30, 0x36, 0xA5, 0x38, 0xBF, 0x40, 0xA3, 0x9E, 0x81, 0xF3, 0xD7, 0xFB,
856
+ 0x7C, 0xE3, 0x39, 0x82, 0x9B, 0x2F, 0xFF, 0x87, 0x34, 0x8E, 0x43, 0x44, 0xC4, 0xDE, 0xE9, 0xCB,
857
+ 0x54, 0x7B, 0x94, 0x32, 0xA6, 0xC2, 0x23, 0x3D, 0xEE, 0x4C, 0x95, 0x0B, 0x42, 0xFA, 0xC3, 0x4E,
858
+ 0x08, 0x2E, 0xA1, 0x66, 0x28, 0xD9, 0x24, 0xB2, 0x76, 0x5B, 0xA2, 0x49, 0x6D, 0x8B, 0xD1, 0x25,
859
+ 0x72, 0xF8, 0xF6, 0x64, 0x86, 0x68, 0x98, 0x16, 0xD4, 0xA4, 0x5C, 0xCC, 0x5D, 0x65, 0xB6, 0x92,
860
+ 0x6C, 0x70, 0x48, 0x50, 0xFD, 0xED, 0xB9, 0xDA, 0x5E, 0x15, 0x46, 0x57, 0xA7, 0x8D, 0x9D, 0x84,
861
+ 0x90, 0xD8, 0xAB, 0x00, 0x8C, 0xBC, 0xD3, 0x0A, 0xF7, 0xE4, 0x58, 0x05, 0xB8, 0xB3, 0x45, 0x06,
862
+ 0xD0, 0x2C, 0x1E, 0x8F, 0xCA, 0x3F, 0x0F, 0x02, 0xC1, 0xAF, 0xBD, 0x03, 0x01, 0x13, 0x8A, 0x6B,
863
+ 0x3A, 0x91, 0x11, 0x41, 0x4F, 0x67, 0xDC, 0xEA, 0x97, 0xF2, 0xCF, 0xCE, 0xF0, 0xB4, 0xE6, 0x73,
864
+ 0x96, 0xAC, 0x74, 0x22, 0xE7, 0xAD, 0x35, 0x85, 0xE2, 0xF9, 0x37, 0xE8, 0x1C, 0x75, 0xDF, 0x6E,
865
+ 0x47, 0xF1, 0x1A, 0x71, 0x1D, 0x29, 0xC5, 0x89, 0x6F, 0xB7, 0x62, 0x0E, 0xAA, 0x18, 0xBE, 0x1B,
866
+ 0xFC, 0x56, 0x3E, 0x4B, 0xC6, 0xD2, 0x79, 0x20, 0x9A, 0xDB, 0xC0, 0xFE, 0x78, 0xCD, 0x5A, 0xF4,
867
+ 0x1F, 0xDD, 0xA8, 0x33, 0x88, 0x07, 0xC7, 0x31, 0xB1, 0x12, 0x10, 0x59, 0x27, 0x80, 0xEC, 0x5F,
868
+ 0x60, 0x51, 0x7F, 0xA9, 0x19, 0xB5, 0x4A, 0x0D, 0x2D, 0xE5, 0x7A, 0x9F, 0x93, 0xC9, 0x9C, 0xEF,
869
+ 0xA0, 0xE0, 0x3B, 0x4D, 0xAE, 0x2A, 0xF5, 0xB0, 0xC8, 0xEB, 0xBB, 0x3C, 0x83, 0x53, 0x99, 0x61,
870
+ 0x17, 0x2B, 0x04, 0x7E, 0xBA, 0x77, 0xD6, 0x26, 0xE1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0C, 0x7D
871
+ )
872
+ );
873
+ }
874
+ return $tables;
875
+ }
876
+
877
+ /**
878
+ * Setup the performance-optimized function for de/encrypt()
879
+ *
880
+ * @see Crypt_Base::_setupInlineCrypt()
881
+ * @access private
882
+ */
883
+ function _setupInlineCrypt()
884
+ {
885
+ // Note: _setupInlineCrypt() will be called only if $this->changed === true
886
+ // So here we are'nt under the same heavy timing-stress as we are in _de/encryptBlock() or de/encrypt().
887
+ // However...the here generated function- $code, stored as php callback in $this->inline_crypt, must work as fast as even possible.
888
+
889
+ $lambda_functions =& Crypt_Rijndael::_getLambdaFunctions();
890
+
891
+ // We create max. 10 hi-optimized code for memory reason. Means: For each $key one ultra fast inline-crypt function.
892
+ // (Currently, for Crypt_Rijndael/AES, one generated $lambda_function cost on php5.5@32bit ~80kb unfreeable mem and ~130kb on php5.5@64bit)
893
+ // After that, we'll still create very fast optimized code but not the hi-ultimative code, for each $mode one.
894
+ $gen_hi_opt_code = (bool)(count($lambda_functions) < 10);
895
+
896
+ // Generation of a uniqe hash for our generated code
897
+ $code_hash = "Crypt_Rijndael, {$this->mode}, {$this->Nr}, {$this->Nb}";
898
+ if ($gen_hi_opt_code) {
899
+ $code_hash = str_pad($code_hash, 32) . $this->_hashInlineCryptFunction($this->key);
900
+ }
901
+
902
+ if (!isset($lambda_functions[$code_hash])) {
903
+ switch (true) {
904
+ case $gen_hi_opt_code:
905
+ // The hi-optimized $lambda_functions will use the key-words hardcoded for better performance.
906
+ $w = $this->w;
907
+ $dw = $this->dw;
908
+ $init_encrypt = '';
909
+ $init_decrypt = '';
910
+ break;
911
+ default:
912
+ for ($i = 0, $cw = count($this->w); $i < $cw; ++$i) {
913
+ $w[] = '$w[' . $i . ']';
914
+ $dw[] = '$dw[' . $i . ']';
915
+ }
916
+ $init_encrypt = '$w = $self->w;';
917
+ $init_decrypt = '$dw = $self->dw;';
918
+ }
919
+
920
+ $Nr = $this->Nr;
921
+ $Nb = $this->Nb;
922
+ $c = $this->c;
923
+
924
+ // Generating encrypt code:
925
+ $init_encrypt.= '
926
+ static $tables;
927
+ if (empty($tables)) {
928
+ $tables = &$self->_getTables();
929
+ }
930
+ $t0 = $tables[0];
931
+ $t1 = $tables[1];
932
+ $t2 = $tables[2];
933
+ $t3 = $tables[3];
934
+ $sbox = $tables[4];
935
+ ';
936
+
937
+ $s = 'e';
938
+ $e = 's';
939
+ $wc = $Nb - 1;
940
+
941
+ // Preround: addRoundKey
942
+ $encrypt_block = '$in = unpack("N*", $in);'."\n";
943
+ for ($i = 0; $i < $Nb; ++$i) {
944
+ $encrypt_block .= '$s'.$i.' = $in['.($i + 1).'] ^ '.$w[++$wc].";\n";
945
+ }
946
+
947
+ // Mainrounds: shiftRows + subWord + mixColumns + addRoundKey
948
+ for ($round = 1; $round < $Nr; ++$round) {
949
+ list($s, $e) = array($e, $s);
950
+ for ($i = 0; $i < $Nb; ++$i) {
951
+ $encrypt_block.=
952
+ '$'.$e.$i.' =
953
+ $t0[($'.$s.$i .' >> 24) & 0xff] ^
954
+ $t1[($'.$s.(($i + $c[1]) % $Nb).' >> 16) & 0xff] ^
955
+ $t2[($'.$s.(($i + $c[2]) % $Nb).' >> 8) & 0xff] ^
956
+ $t3[ $'.$s.(($i + $c[3]) % $Nb).' & 0xff] ^
957
+ '.$w[++$wc].";\n";
958
+ }
959
+ }
960
+
961
+ // Finalround: subWord + shiftRows + addRoundKey
962
+ for ($i = 0; $i < $Nb; ++$i) {
963
+ $encrypt_block.=
964
+ '$'.$e.$i.' =
965
+ $sbox[ $'.$e.$i.' & 0xff] |
966
+ ($sbox[($'.$e.$i.' >> 8) & 0xff] << 8) |
967
+ ($sbox[($'.$e.$i.' >> 16) & 0xff] << 16) |
968
+ ($sbox[($'.$e.$i.' >> 24) & 0xff] << 24);'."\n";
969
+ }
970
+ $encrypt_block .= '$in = pack("N*"'."\n";
971
+ for ($i = 0; $i < $Nb; ++$i) {
972
+ $encrypt_block.= ',
973
+ ($'.$e.$i .' & '.((int)0xFF000000).') ^
974
+ ($'.$e.(($i + $c[1]) % $Nb).' & 0x00FF0000 ) ^
975
+ ($'.$e.(($i + $c[2]) % $Nb).' & 0x0000FF00 ) ^
976
+ ($'.$e.(($i + $c[3]) % $Nb).' & 0x000000FF ) ^
977
+ '.$w[$i]."\n";
978
+ }
979
+ $encrypt_block .= ');';
980
+
981
+ // Generating decrypt code:
982
+ $init_decrypt.= '
983
+ static $invtables;
984
+ if (empty($invtables)) {
985
+ $invtables = &$self->_getInvTables();
986
+ }
987
+ $dt0 = $invtables[0];
988
+ $dt1 = $invtables[1];
989
+ $dt2 = $invtables[2];
990
+ $dt3 = $invtables[3];
991
+ $isbox = $invtables[4];
992
+ ';
993
+
994
+ $s = 'e';
995
+ $e = 's';
996
+ $wc = $Nb - 1;
997
+
998
+ // Preround: addRoundKey
999
+ $decrypt_block = '$in = unpack("N*", $in);'."\n";
1000
+ for ($i = 0; $i < $Nb; ++$i) {
1001
+ $decrypt_block .= '$s'.$i.' = $in['.($i + 1).'] ^ '.$dw[++$wc].';'."\n";
1002
+ }
1003
+
1004
+ // Mainrounds: shiftRows + subWord + mixColumns + addRoundKey
1005
+ for ($round = 1; $round < $Nr; ++$round) {
1006
+ list($s, $e) = array($e, $s);
1007
+ for ($i = 0; $i < $Nb; ++$i) {
1008
+ $decrypt_block.=
1009
+ '$'.$e.$i.' =
1010
+ $dt0[($'.$s.$i .' >> 24) & 0xff] ^
1011
+ $dt1[($'.$s.(($Nb + $i - $c[1]) % $Nb).' >> 16) & 0xff] ^
1012
+ $dt2[($'.$s.(($Nb + $i - $c[2]) % $Nb).' >> 8) & 0xff] ^
1013
+ $dt3[ $'.$s.(($Nb + $i - $c[3]) % $Nb).' & 0xff] ^
1014
+ '.$dw[++$wc].";\n";
1015
+ }
1016
+ }
1017
+
1018
+ // Finalround: subWord + shiftRows + addRoundKey
1019
+ for ($i = 0; $i < $Nb; ++$i) {
1020
+ $decrypt_block.=
1021
+ '$'.$e.$i.' =
1022
+ $isbox[ $'.$e.$i.' & 0xff] |
1023
+ ($isbox[($'.$e.$i.' >> 8) & 0xff] << 8) |
1024
+ ($isbox[($'.$e.$i.' >> 16) & 0xff] << 16) |
1025
+ ($isbox[($'.$e.$i.' >> 24) & 0xff] << 24);'."\n";
1026
+ }
1027
+ $decrypt_block .= '$in = pack("N*"'."\n";
1028
+ for ($i = 0; $i < $Nb; ++$i) {
1029
+ $decrypt_block.= ',
1030
+ ($'.$e.$i. ' & '.((int)0xFF000000).') ^
1031
+ ($'.$e.(($Nb + $i - $c[1]) % $Nb).' & 0x00FF0000 ) ^
1032
+ ($'.$e.(($Nb + $i - $c[2]) % $Nb).' & 0x0000FF00 ) ^
1033
+ ($'.$e.(($Nb + $i - $c[3]) % $Nb).' & 0x000000FF ) ^
1034
+ '.$dw[$i]."\n";
1035
+ }
1036
+ $decrypt_block .= ');';
1037
+
1038
+ $lambda_functions[$code_hash] = $this->_createInlineCryptFunction(
1039
+ array(
1040
+ 'init_crypt' => '',
1041
+ 'init_encrypt' => $init_encrypt,
1042
+ 'init_decrypt' => $init_decrypt,
1043
+ 'encrypt_block' => $encrypt_block,
1044
+ 'decrypt_block' => $decrypt_block
1045
+ )
1046
+ );
1047
+ }
1048
+ $this->inline_crypt = $lambda_functions[$code_hash];
1049
+ }
1050
+ }
installer/dup-installer/classes/class.csrf.php CHANGED
@@ -1,6 +1,7 @@
1
  <?php
2
  defined("ABSPATH") or die("");
3
 
 
4
  class DUPX_CSRF {
5
 
6
  /** Session var name
1
  <?php
2
  defined("ABSPATH") or die("");
3
 
4
+
5
  class DUPX_CSRF {
6
 
7
  /** Session var name
installer/dup-installer/classes/class.engine.php CHANGED
@@ -150,6 +150,8 @@ class DUPX_UpdateEngine
150
  'err_all' => 0
151
  );
152
 
 
 
153
  function set_sql_column_safe(&$str) {
154
  $str = "`$str`";
155
  }
@@ -320,22 +322,46 @@ class DUPX_UpdateEngine
320
  $result = mysqli_query($conn, $sql);
321
  if ($result) {
322
  if ($serial_err > 0) {
323
- $report['errser'][] = "SELECT " . implode(', ',
324
  $upd_col) . " FROM `".mysqli_real_escape_string($conn, $table)."` WHERE " . implode(' AND ',
325
  array_filter($where_sql)) . ';';
 
 
 
 
 
 
 
 
326
  }
327
  $report['updt_rows']++;
328
  } else {
 
329
  $report['errsql'][] = ($GLOBALS['LOGGING'] == 1)
330
- ? 'DB ERROR: ' . mysqli_error($conn)
331
- : 'DB ERROR: ' . mysqli_error($conn) . "\nSQL: [{$sql}]\n";
 
 
 
 
 
 
 
332
  }
333
 
334
  //DEBUG ONLY:
335
  DUPX_Log::info("\t{$sql}\n", 3);
336
 
337
  } elseif ($upd) {
338
- $report['errkey'][] = sprintf("Row [%s] on Table [%s] requires a manual update.", $current_row, $table);
 
 
 
 
 
 
 
 
339
  }
340
  }
341
  //DUPX_U::fcgiFlush();
@@ -351,12 +377,15 @@ class DUPX_UpdateEngine
351
  @mysqli_commit($conn);
352
  @mysqli_autocommit($conn, true);
353
 
 
 
354
  $profile_end = DUPX_U::getMicrotime();
355
  $report['time'] = DUPX_U::elapsedTime($profile_end, $profile_start);
356
  $report['errsql_sum'] = empty($report['errsql']) ? 0 : count($report['errsql']);
357
  $report['errser_sum'] = empty($report['errser']) ? 0 : count($report['errser']);
358
  $report['errkey_sum'] = empty($report['errkey']) ? 0 : count($report['errkey']);
359
  $report['err_all'] = $report['errsql_sum'] + $report['errser_sum'] + $report['errkey_sum'];
 
360
  return $report;
361
  }
362
 
150
  'err_all' => 0
151
  );
152
 
153
+ $nManager = DUPX_NOTICE_MANAGER::getInstance();
154
+
155
  function set_sql_column_safe(&$str) {
156
  $str = "`$str`";
157
  }
322
  $result = mysqli_query($conn, $sql);
323
  if ($result) {
324
  if ($serial_err > 0) {
325
+ $errMsg = "SELECT " . implode(', ',
326
  $upd_col) . " FROM `".mysqli_real_escape_string($conn, $table)."` WHERE " . implode(' AND ',
327
  array_filter($where_sql)) . ';';
328
+ $report['errser'][] = $errMsg;
329
+
330
+ $nManager->addFinalReportNotice(array(
331
+ 'shortMsg' => 'DATA-REPLACE ERROR: Serialization',
332
+ 'level' => DUPX_NOTICE_ITEM::SOFT_WARNING,
333
+ 'longMsg' => $errMsg,
334
+ 'sections' => 'search_replace'
335
+ ));
336
  }
337
  $report['updt_rows']++;
338
  } else {
339
+ $errMsg = mysqli_error($conn);
340
  $report['errsql'][] = ($GLOBALS['LOGGING'] == 1)
341
+ ? 'DB ERROR: ' . $errMsg
342
+ : 'DB ERROR: ' . $errMsg . "\nSQL: [{$sql}]\n";
343
+
344
+ $nManager->addFinalReportNotice(array(
345
+ 'shortMsg' => 'DATA-REPLACE ERRORS: MySQL',
346
+ 'level' => DUPX_NOTICE_ITEM::SOFT_WARNING,
347
+ 'longMsg' => $errMsg,
348
+ 'sections' => 'search_replace'
349
+ ));
350
  }
351
 
352
  //DEBUG ONLY:
353
  DUPX_Log::info("\t{$sql}\n", 3);
354
 
355
  } elseif ($upd) {
356
+ $errMsg = sprintf("Row [%s] on Table [%s] requires a manual update.", $current_row, $table);
357
+ $report['errkey'][] = $errMsg;
358
+
359
+ $nManager->addFinalReportNotice(array(
360
+ 'shortMsg' => 'DATA-REPLACE ERROR: Key',
361
+ 'level' => DUPX_NOTICE_ITEM::SOFT_WARNING,
362
+ 'longMsg' => $errMsg,
363
+ 'sections' => 'search_replace'
364
+ ));
365
  }
366
  }
367
  //DUPX_U::fcgiFlush();
377
  @mysqli_commit($conn);
378
  @mysqli_autocommit($conn, true);
379
 
380
+ $nManager->saveNotices();
381
+
382
  $profile_end = DUPX_U::getMicrotime();
383
  $report['time'] = DUPX_U::elapsedTime($profile_end, $profile_start);
384
  $report['errsql_sum'] = empty($report['errsql']) ? 0 : count($report['errsql']);
385
  $report['errser_sum'] = empty($report['errser']) ? 0 : count($report['errser']);
386
  $report['errkey_sum'] = empty($report['errkey']) ? 0 : count($report['errkey']);
387
  $report['err_all'] = $report['errsql_sum'] + $report['errser_sum'] + $report['errkey_sum'];
388
+
389
  return $report;
390
  }
391
 
installer/dup-installer/classes/class.logging.php CHANGED
@@ -1,7 +1,6 @@
1
  <?php
2
  defined("ABSPATH") or die("");
3
 
4
- define('ERR_CONFIG_FOUND', 'A wp-config.php already exists in this location. This error prevents users from accidentally overwriting a WordPress site or trying to install on top of an existing one. Extracting an archive on an existing site will overwrite existing files and intermix files causing site incompatibility issues.<br/><br/> It is highly recommended to place the installer and archive in an empty directory. If you have already manually extracted the archive file that is associated with this installer then choose option #1 below; other-wise consider the other options: <ol><li>Click &gt; Try Again &gt; Options &gt; choose "Manual Archive Extraction".</li><li>Empty the directory except for the archive.zip/daf and installer.php and try again.</li><li>Advanced users only can remove the existing wp-config.php file and try again.</li></ol>');
5
  define('ERR_ZIPNOTFOUND', 'The packaged zip file was not found or has become unreadable. Be sure the zip package is in the same directory as the installer file. If you are trying to reinstall a package you can copy the package from the "' . DUPLICATOR_SSDIR_NAME . '" directory back up to your root which is the same location as your installer file.');
6
  define('ERR_SHELLEXEC_ZIPOPEN', 'Failed to extract archive using shell_exec unzip');
7
  define('ERR_ZIPOPEN', 'Failed to open zip archive file. Please be sure the archive is completely downloaded before running the installer. Try to extract the archive manually to make sure the file is not corrupted.');
1
  <?php
2
  defined("ABSPATH") or die("");
3
 
 
4
  define('ERR_ZIPNOTFOUND', 'The packaged zip file was not found or has become unreadable. Be sure the zip package is in the same directory as the installer file. If you are trying to reinstall a package you can copy the package from the "' . DUPLICATOR_SSDIR_NAME . '" directory back up to your root which is the same location as your installer file.');
5
  define('ERR_SHELLEXEC_ZIPOPEN', 'Failed to extract archive using shell_exec unzip');
6
  define('ERR_ZIPOPEN', 'Failed to open zip archive file. Please be sure the archive is completely downloaded before running the installer. Try to extract the archive manually to make sure the file is not corrupted.');
installer/dup-installer/classes/config/class.constants.php CHANGED
@@ -72,19 +72,30 @@ class DUPX_Constants
72
  $GLOBALS['LOGGING'] = isset($_POST['logging']) ? $_POST['logging'] : 1;
73
  $GLOBALS['CURRENT_ROOT_PATH'] = str_replace('\\', '/', realpath(dirname(__FILE__) . "/../../../"));
74
  $GLOBALS['LOG_FILE_PATH'] = $GLOBALS['DUPX_INIT'] . '/' . $GLOBALS["LOG_FILE_NAME"];
 
 
75
  $GLOBALS['CHOWN_ROOT_PATH'] = @chmod("{$GLOBALS['CURRENT_ROOT_PATH']}", 0755);
76
  $GLOBALS['CHOWN_LOG_PATH'] = @chmod("{$GLOBALS['LOG_FILE_PATH']}", 0644);
 
77
  $GLOBALS['URL_SSL'] = (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == 'on') ? true : false;
78
  $GLOBALS['URL_PATH'] = ($GLOBALS['URL_SSL']) ? "https://{$_SERVER['SERVER_NAME']}{$_SERVER['REQUEST_URI']}" : "http://{$_SERVER['SERVER_NAME']}{$_SERVER['REQUEST_URI']}";
79
  $GLOBALS['PHP_MEMORY_LIMIT'] = ini_get('memory_limit') === false ? 'n/a' : ini_get('memory_limit');
80
  $GLOBALS['PHP_SUHOSIN_ON'] = extension_loaded('suhosin') ? 'enabled' : 'disabled';
81
 
82
- //Restart log if user starts from step 1
83
- $GLOBALS['LOG_FILE_HANDLE'] = ($GLOBALS["VIEW"] == "step1")
84
- ? @fopen($GLOBALS['LOG_FILE_PATH'], "w+")
85
- : @fopen($GLOBALS['LOG_FILE_PATH'], "a+");
86
 
87
- $GLOBALS['HOST_NAME'] = strlen($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : $_SERVER['HTTP_HOST'];
 
 
 
 
 
 
 
 
88
 
89
  if (!defined('MAX_STRLEN_SERIALIZED_CHECK')) { define('MAX_STRLEN_SERIALIZED_CHECK', 2000000); }
90
  }
72
  $GLOBALS['LOGGING'] = isset($_POST['logging']) ? $_POST['logging'] : 1;
73
  $GLOBALS['CURRENT_ROOT_PATH'] = str_replace('\\', '/', realpath(dirname(__FILE__) . "/../../../"));
74
  $GLOBALS['LOG_FILE_PATH'] = $GLOBALS['DUPX_INIT'] . '/' . $GLOBALS["LOG_FILE_NAME"];
75
+ $GLOBALS["NOTICES_FILE_NAME"] = "dup-installer-notices__{$GLOBALS['PACKAGE_HASH']}.json";
76
+ $GLOBALS["NOTICES_FILE_PATH"] = $GLOBALS['DUPX_INIT'] . '/' . $GLOBALS["NOTICES_FILE_NAME"];
77
  $GLOBALS['CHOWN_ROOT_PATH'] = @chmod("{$GLOBALS['CURRENT_ROOT_PATH']}", 0755);
78
  $GLOBALS['CHOWN_LOG_PATH'] = @chmod("{$GLOBALS['LOG_FILE_PATH']}", 0644);
79
+ $GLOBALS['CHOWN_NOTICES_PATH'] = @chmod("{$GLOBALS['NOTICES_FILE_PATH']}", 0644);
80
  $GLOBALS['URL_SSL'] = (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == 'on') ? true : false;
81
  $GLOBALS['URL_PATH'] = ($GLOBALS['URL_SSL']) ? "https://{$_SERVER['SERVER_NAME']}{$_SERVER['REQUEST_URI']}" : "http://{$_SERVER['SERVER_NAME']}{$_SERVER['REQUEST_URI']}";
82
  $GLOBALS['PHP_MEMORY_LIMIT'] = ini_get('memory_limit') === false ? 'n/a' : ini_get('memory_limit');
83
  $GLOBALS['PHP_SUHOSIN_ON'] = extension_loaded('suhosin') ? 'enabled' : 'disabled';
84
 
85
+ /**
86
+ * Inizialize notices manager and load file
87
+ */
88
+ $noticesManager = DUPX_NOTICE_MANAGER::getInstance();
89
 
90
+ //Restart log if user starts from step 1
91
+ if ($GLOBALS["VIEW"] == "step1") {
92
+ $GLOBALS['LOG_FILE_HANDLE'] = @fopen($GLOBALS['LOG_FILE_PATH'], "w+");
93
+ $noticesManager->resetNotices();
94
+ } else {
95
+ $GLOBALS['LOG_FILE_HANDLE'] = @fopen($GLOBALS['LOG_FILE_PATH'], "a+");
96
+ }
97
+
98
+ $GLOBALS['HOST_NAME'] = strlen($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : $_SERVER['HTTP_HOST'];
99
 
100
  if (!defined('MAX_STRLEN_SERIALIZED_CHECK')) { define('MAX_STRLEN_SERIALIZED_CHECK', 2000000); }
101
  }
installer/dup-installer/classes/config/class.wp.config.tranformer.php CHANGED
@@ -161,9 +161,54 @@ class WPConfigTransformer {
161
  if ( false === strpos( $this->wp_config_src, $anchor ) ) {
162
  $other_anchor_points = array(
163
  '/** Absolute path to the WordPress directory',
 
164
  "if ( !defined('ABSPATH') )",
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
165
  '/** Sets up WordPress vars and included files',
166
  'require_once(ABSPATH',
 
 
 
 
 
 
 
 
 
167
  );
168
  foreach ($other_anchor_points as $anchor_point) {
169
  $anchor_point = (string) $anchor_point;
@@ -318,8 +363,9 @@ class WPConfigTransformer {
318
  }
319
  }
320
 
321
- preg_match_all( '/(?<=^|;|<\?php\s|<\?\s)(\h*define\s*\(\s*[\'"](\w*?)[\'"]\s*)(,\s*([\'"].*?[\'"]|.*?)\s*)((?:,\s*(?:true|false)\s*)?\)\s*;)/ims', $src, $constants );
322
- preg_match_all( '/(?<=^|;|<\?php\s|<\?\s)(\h*\$(\w+)\s*=)(\s*([\'"].*?[\'"]|.*?)\s*;)/ims', $src, $variables );
 
323
 
324
  if ( ! empty( $constants[0] ) && ! empty( $constants[1] ) && ! empty( $constants[2] ) && ! empty( $constants[3] ) && ! empty( $constants[4] ) && ! empty( $constants[5] ) ) {
325
  foreach ( $constants[2] as $index => $name ) {
161
  if ( false === strpos( $this->wp_config_src, $anchor ) ) {
162
  $other_anchor_points = array(
163
  '/** Absolute path to the WordPress directory',
164
+ // ABSPATH defined check with single quote
165
  "if ( !defined('ABSPATH') )",
166
+ "if ( ! defined( 'ABSPATH' ) )",
167
+ "if (!defined('ABSPATH') )",
168
+ "if(!defined('ABSPATH') )",
169
+ "if(!defined('ABSPATH'))",
170
+ "if ( ! defined( 'ABSPATH' ))",
171
+ "if ( ! defined( 'ABSPATH') )",
172
+ "if ( ! defined('ABSPATH' ) )",
173
+ "if (! defined( 'ABSPATH' ))",
174
+ "if (! defined( 'ABSPATH') )",
175
+ "if (! defined('ABSPATH' ) )",
176
+ "if ( !defined( 'ABSPATH' ))",
177
+ "if ( !defined( 'ABSPATH') )",
178
+ "if ( !defined('ABSPATH' ) )",
179
+ "if( !defined( 'ABSPATH' ))",
180
+ "if( !defined( 'ABSPATH') )",
181
+ "if( !defined('ABSPATH' ) )",
182
+ // ABSPATH defined check with double quote
183
+ 'if ( !defined("ABSPATH") )',
184
+ 'if ( ! defined( "ABSPATH" ) )',
185
+ 'if (!defined("ABSPATH") )',
186
+ 'if(!defined("ABSPATH") )',
187
+ 'if(!defined("ABSPATH"))',
188
+ 'if ( ! defined( "ABSPATH" ))',
189
+ 'if ( ! defined( "ABSPATH") )',
190
+ 'if ( ! defined("ABSPATH" ) )',
191
+ 'if (! defined( "ABSPATH" ))',
192
+ 'if (! defined( "ABSPATH") )',
193
+ 'if (! defined("ABSPATH" ) )',
194
+ 'if ( !defined( "ABSPATH" ))',
195
+ 'if ( !defined( "ABSPATH") )',
196
+ 'if ( !defined("ABSPATH" ) )',
197
+ 'if( !defined( "ABSPATH" ))',
198
+ 'if( !defined( "ABSPATH") )',
199
+ 'if( !defined("ABSPATH" ) )',
200
+
201
  '/** Sets up WordPress vars and included files',
202
  'require_once(ABSPATH',
203
+ 'require_once ABSPATH',
204
+ 'require_once( ABSPATH',
205
+ 'require_once',
206
+ "define( 'DB_NAME'",
207
+ 'define( "DB_NAME"',
208
+ "define('DB_NAME'",
209
+ 'define("DB_NAME"',
210
+ 'require',
211
+ 'include_once',
212
  );
213
  foreach ($other_anchor_points as $anchor_point) {
214
  $anchor_point = (string) $anchor_point;
363
  }
364
  }
365
 
366
+ preg_match_all( '/(?<=^|;|<\?php\s|<\?\s)(\h*define\s*\(\s*[\'"](\w*?)[\'"]\s*)(,\s*(\'\'|""|\'.*?[^\\\\]\'|".*?[^\\\\]"|.*?)\s*)((?:,\s*(?:true|false)\s*)?\)\s*;)/ims', $src, $constants );
367
+ preg_match_all( '/(?<=^|;|<\?php\s|<\?\s)(\h*\$(\w+)\s*=)(\s*(\'\'|""|\'.*?[^\\\\]\'|".*?[^\\\\]"|.*?)\s*;)/ims', $src, $variables );
368
+
369
 
370
  if ( ! empty( $constants[0] ) && ! empty( $constants[1] ) && ! empty( $constants[2] ) && ! empty( $constants[3] ) && ! empty( $constants[4] ) && ! empty( $constants[5] ) ) {
371
  foreach ( $constants[2] as $index => $name ) {
installer/dup-installer/classes/utilities/class.u.exceptions.php ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Custom exceptions
4
+ *
5
+ * Standard: PSR-2
6
+ * @link http://www.php-fig.org/psr/psr-2 Full Documentation
7
+ *
8
+ * @package SC\DUPX\U
9
+ *
10
+ */
11
+
12
+ /**
13
+ * Dup installer custom exception
14
+ */
15
+ class DupxException extends Exception
16
+ {
17
+ /**
18
+ *
19
+ * @var string // formatted html string
20
+ */
21
+ protected $longMsg = '';
22
+ protected $faqLink = false;
23
+
24
+ /**
25
+ *
26
+ * @param type $shortMsg
27
+ * @param type $longMsg
28
+ * @param type $faqLinkUrl
29
+ * @param type $faqLinkLabel
30
+ * @param type $code
31
+ * @param Exception $previous
32
+ */
33
+ public function __construct($shortMsg, $longMsg = '', $faqLinkUrl = '', $faqLinkLabel = '', $code = 0, Exception $previous = null)
34
+ {
35
+ parent::__construct($shortMsg, $code, $previous);
36
+ $this->longMsg = (string) $longMsg;
37
+ if (!empty($faqLinkUrl)) {
38
+ $this->faqLink = array(
39
+ 'url' => $faqLinkUrl,
40
+ 'label' => $faqLinkLabel
41
+ );
42
+ }
43
+ }
44
+
45
+ public function getLongMsg()
46
+ {
47
+ return $this->longMsg;
48
+ }
49
+
50
+ public function haveFaqLink()
51
+ {
52
+ return $this->faqLink !== false;
53
+ }
54
+
55
+ public function getFaqLinkUrl()
56
+ {
57
+ if ($this->haveFaqLink()) {
58
+ return $this->faqLink['url'];
59
+ } else {
60
+ return '';
61
+ }
62
+ }
63
+
64
+ public function getFaqLinkLabel()
65
+ {
66
+ if ($this->haveFaqLink()) {
67
+ return $this->faqLink['label'];
68
+ } else {
69
+ return '';
70
+ }
71
+ }
72
+
73
+ // custom string representation of object
74
+ public function __toString()
75
+ {
76
+ $result = __CLASS__.": [{$this->code}]: {$this->message}";
77
+ if ($this->haveFaqLink()) {
78
+ $result .= "\n\tSee FAQ ".$this->faqLink['label'].': '.$this->faqLink['url'];
79
+ }
80
+ if (!empty($this->longMsg)) {
81
+ $result .= "\n\t".strip_tags($this->longMsg);
82
+ }
83
+ $result .= "\n";
84
+ return $result;
85
+ }
86
+ }
installer/dup-installer/classes/utilities/class.u.notices.manager.php ADDED
@@ -0,0 +1,921 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Notice manager
4
+ *
5
+ * Standard: PSR-2
6
+ * @link http://www.php-fig.org/psr/psr-2 Full Documentation
7
+ *
8
+ * @package SC\DUPX\U
9
+ *
10
+ */
11
+
12
+ /**
13
+ * Notice manager
14
+ * singleton class
15
+ */
16
+ final class DUPX_NOTICE_MANAGER
17
+ {
18
+ const ADD_NORMAL = 0; // add notice in list
19
+ const ADD_UNIQUE = 1; // add if unique id don't exists
20
+ const ADD_UNIQUE_UPDATE = 2; // add or update notice unique id
21
+ const DEFAULT_UNIQUE_ID_PREFIX = '__auto_unique_id__';
22
+
23
+ private static $uniqueCountId = 0;
24
+
25
+ /**
26
+ *
27
+ * @var DUPX_NOTICE_ITEM[]
28
+ */
29
+ private $nextStepNotices = array();
30
+
31
+ /**
32
+ *
33
+ * @var DUPX_NOTICE_ITEM[]
34
+ */
35
+ private $finalReporNotices = array();
36
+
37
+ /**
38
+ *
39
+ * @var DUPX_NOTICE_MANAGER
40
+ */
41
+ private static $instance = null;
42
+
43
+ /**
44
+ *
45
+ * @var string
46
+ */
47
+ private $persistanceFile = null;
48
+
49
+ /**
50
+ *
51
+ * @return DUPX_S_R_MANAGER
52
+ */
53
+ public static function getInstance()
54
+ {
55
+ if (is_null(self::$instance)) {
56
+ self::$instance = new self();
57
+ }
58
+
59
+ return self::$instance;
60
+ }
61
+
62
+ private function __construct()
63
+ {
64
+ $this->persistanceFile = $GLOBALS["NOTICES_FILE_PATH"];
65
+ $this->loadNotices();
66
+ }
67
+
68
+ public function saveNotices()
69
+ {
70
+ $notices = array(
71
+ 'globalData' => array(
72
+ 'uniqueCountId' => self::$uniqueCountId
73
+ ),
74
+ 'nextStep' => array(),
75
+ 'finalReport' => array()
76
+ );
77
+
78
+ foreach ($this->nextStepNotices as $uniqueId => $notice) {
79
+ $notices['nextStep'][$uniqueId] = $notice->toArray();
80
+ }
81
+
82
+ foreach ($this->finalReporNotices as $uniqueId => $notice) {
83
+ $notices['finalReport'][$uniqueId] = $notice->toArray();
84
+ }
85
+
86
+ $json = json_encode($notices, JSON_PRETTY_PRINT);
87
+ file_put_contents($this->persistanceFile, $json);
88
+ }
89
+
90
+ private function loadNotices()
91
+ {
92
+ if (file_exists($this->persistanceFile)) {
93
+ $json = file_get_contents($this->persistanceFile);
94
+ $notices = json_decode($json, true);
95
+
96
+ $this->nextStepNotices = array();
97
+ $this->finalReporNotices = array();
98
+
99
+ foreach ($notices['nextStep'] as $uniqueId => $notice) {
100
+ $this->nextStepNotices[$uniqueId] = DUPX_NOTICE_ITEM::getItemFromArray($notice);
101
+ }
102
+
103
+ foreach ($notices['finalReport'] as $uniqueId => $notice) {
104
+ $this->finalReporNotices[$uniqueId] = DUPX_NOTICE_ITEM::getItemFromArray($notice);
105
+ }
106
+
107
+ self::$uniqueCountId = $notices['globalData']['uniqueCountId'];
108
+ } else {
109
+ $this->resetNotices();
110
+ }
111
+ }
112
+
113
+ /**
114
+ *
115
+ */
116
+ public function resetNotices()
117
+ {
118
+ $this->nextStepNotices = array();
119
+ $this->finalReporNotices = array();
120
+ self::$uniqueCountId = 0;
121
+ $this->saveNotices();
122
+ }
123
+
124
+ /**
125
+ *
126
+ * @param array|DUPX_NOTICE_ITEM $item // if string add new notice obj with item message and level param
127
+ * // if array must be [
128
+ * 'shortMsg' => text,
129
+ * 'level' => level,
130
+ * 'longMsg' => html text,
131
+ * 'sections' => sections list,
132
+ * 'faqLink' => [
133
+ * 'url' => external link
134
+ * 'label' => link text if empty get external url link
135
+ * ]
136
+ * ]
137
+ * @param int $mode // ADD_NORMAL | ADD_UNIQUE | ADD_UNIQUE_UPDATE
138
+ * @param string $uniqueId // used for ADD_UNIQUE or ADD_UNIQUE_UPDATE
139
+ *
140
+ * @return string // notice insert id
141
+ *
142
+ * @throws Exception
143
+ */
144
+ public function addNextStepNotice($item, $mode = self::ADD_NORMAL, $uniqueId = null)
145
+ {
146
+ if (!is_array($item) && !($item instanceof DUPX_NOTICE_ITEM)) {
147
+ throw new Exception('Invalid item param');
148
+ }
149
+ return self::addReportNoticeToList($this->nextStepNotices, $item, $mode, $uniqueId);
150
+ }
151
+
152
+ /**
153
+ * addNextStepNotice wrapper to add simple message with error level
154
+ *
155
+ * @param string $message
156
+ * @param int $level // warning level
157
+ * @param int $mode // ADD_NORMAL | ADD_UNIQUE | ADD_UNIQUE_UPDATE
158
+ * @param string $uniqueId // used for ADD_UNIQUE or ADD_UNIQUE_UPDATE
159
+ *
160
+ * @return string // notice insert id
161
+ *
162
+ * @throws Exception
163
+ */
164
+ public function addNextStepNoticeMessage($message, $level = DUPX_NOTICE_ITEM::INFO, $mode = self::ADD_NORMAL, $uniqueId = null)
165
+ {
166
+ return $this->addNextStepNotice(array(
167
+ 'shortMsg' => $message,
168
+ 'level' => $level,
169
+ ), $mode, $uniqueId);
170
+ }
171
+
172
+ /**
173
+ *
174
+ * @param array|DUPX_NOTICE_ITEM $item // if string add new notice obj with item message and level param
175
+ * // if array must be [
176
+ * 'shortMsg' => text,
177
+ * 'level' => level,
178
+ * 'longMsg' => html text,
179
+ * 'sections' => sections list,
180
+ * 'faqLink' => [
181
+ * 'url' => external link
182
+ * 'label' => link text if empty get external url link
183
+ * ]
184
+ * ]
185
+ * @param int $mode // ADD_NORMAL | ADD_UNIQUE | ADD_UNIQUE_UPDATE
186
+ * @param string $uniqueId // used for ADD_UNIQUE or ADD_UNIQUE_UPDATE
187
+ *
188
+ * @return string // notice insert id
189
+ *
190
+ * @throws Exception
191
+ */
192
+ public function addFinalReportNotice($item, $mode = self::ADD_NORMAL, $uniqueId = null)
193
+ {
194
+ if (!is_array($item) && !($item instanceof DUPX_NOTICE_ITEM)) {
195
+ throw new Exception('Invalid item param');
196
+ }
197
+ return self::addReportNoticeToList($this->finalReporNotices, $item, $mode, $uniqueId);
198
+ }
199
+
200
+ /**
201
+ * addFinalReportNotice wrapper to add simple message with error level
202
+ *
203
+ * @param string $message
204
+ * @param string|string[] $sections // message sections on final report
205
+ * @param int $level // warning level
206
+ * @param int $mode // ADD_NORMAL | ADD_UNIQUE | ADD_UNIQUE_UPDATE
207
+ * @param string $uniqueId // used for ADD_UNIQUE or ADD_UNIQUE_UPDATE
208
+ *
209
+ * @return string // notice insert id
210
+ *
211
+ * @throws Exception
212
+ */
213
+ public function addFinalReportNoticeMessage($message, $sections, $level = DUPX_NOTICE_ITEM::INFO, $mode = self::ADD_NORMAL, $uniqueId = null)
214
+ {
215
+ return $this->addFinalReportNotice(array(
216
+ 'shortMsg' => $message,
217
+ 'level' => $level,
218
+ 'sections' => $sections,
219
+ ), $mode, $uniqueId);
220
+ }
221
+
222
+ /**
223
+ *
224
+ * @param array $list
225
+ * @param array|DUPX_NOTICE_ITEM $item // if string add new notice obj with item message and level param
226
+ * // if array must be [
227
+ * 'shortMsg' => text,
228
+ * 'level' => level,
229
+ * 'longMsg' => html text,
230
+ * 'sections' => sections list,
231
+ * 'faqLink' => [
232
+ * 'url' => external link
233
+ * 'label' => link text if empty get external url link
234
+ * ]
235
+ * ]
236
+ * @param int $mode // ADD_NORMAL | ADD_UNIQUE | ADD_UNIQUE_UPDATE
237
+ * @param string $uniqueId // used for ADD_UNIQUE or ADD_UNIQUE_UPDATE
238
+ *
239
+ * @return string // notice insert id
240
+ *
241
+ * @throws Exception
242
+ */
243
+ private static function addReportNoticeToList(&$list, $item, $mode = self::ADD_NORMAL, $uniqueId = null)
244
+ {
245
+ switch ($mode) {
246
+ case self::ADD_UNIQUE:
247
+ if (empty($uniqueId)) {
248
+ throw new Exception('uniqueId can\'t be empty');
249
+ }
250
+ if (isset($list[$uniqueId])) {
251
+ return $uniqueId;
252
+ }
253
+ // no break -> continue on unique update
254
+ case self::ADD_UNIQUE_UPDATE:
255
+ $insertId = $uniqueId;
256
+ break;
257
+ case self::ADD_NORMAL:
258
+ default:
259
+ $insertId = self::getNewAutoUniqueId();
260
+ }
261
+
262
+ $list[$insertId] = self::getObjFromParams($item);
263
+ return $insertId;
264
+ }
265
+
266
+ /**
267
+ *
268
+ * @param string|array|DUPX_NOTICE_ITEM $item // if string add new notice obj with item message and level param
269
+ * // if array must be [
270
+ * 'shortMsg' => text,
271
+ * 'level' => level,
272
+ * 'longMsg' => html text,
273
+ * 'sections' => sections list,
274
+ * 'faqLink' => [
275
+ * 'url' => external link
276
+ * 'label' => link text if empty get external url link
277
+ * ]
278
+ * ]
279
+ * @param int $level message level considered only in the case where $item is a string.
280
+ * @return \DUPX_NOTICE_ITEM
281
+ *
282
+ * @throws Exception
283
+ */
284
+ private static function getObjFromParams($item, $level = DUPX_NOTICE_ITEM::INFO)
285
+ {
286
+ if ($item instanceof DUPX_NOTICE_ITEM) {
287
+ $newObj = $item;
288
+ } else if (is_array($item)) {
289
+ $newObj = DUPX_NOTICE_ITEM::getItemFromArray($item);
290
+ } else if (is_string($item)) {
291
+ $newObj = new DUPX_NOTICE_ITEM($item, $level);
292
+ } else {
293
+ throw new Exception('Notice input not valid');
294
+ }
295
+
296
+ return $newObj;
297
+ }
298
+
299
+ /**
300
+ *
301
+ * @param null|string $section if null is count global
302
+ * @param int $level error level
303
+ * @param string $operator > < >= <= = !=
304
+ *
305
+ * @return int
306
+ */
307
+ public function countFinalReportNotices($section = null, $level = DUPX_NOTICE_ITEM::INFO, $operator = '>=')
308
+ {
309
+ $result = 0;
310
+ foreach ($this->finalReporNotices as $notice) {
311
+ if (is_null($section) || in_array($section, $notice->sections)) {
312
+ switch ($operator) {
313
+ case '>=':
314
+ $result += (int) ($notice->level >= $level);
315
+ break;
316
+ case '>':
317
+ $result += (int) ($notice->level > $level);
318
+ break;
319
+ case '=':
320
+ $result += (int) ($notice->level = $level);
321
+ break;
322
+ case '<=':
323
+ $result += (int) ($notice->level <= $level);
324
+ break;
325
+ case '<':
326
+ $result += (int) ($notice->level < $level);
327
+ break;
328
+ case '!=':
329
+ $result += (int) ($notice->level != $level);
330
+ break;
331
+ }
332
+ }
333
+ }
334
+ return $result;
335
+ }
336
+
337
+ /**
338
+ *
339
+ */
340
+ public function sortFinalReport()
341
+ {
342
+ uasort($this->finalReporNotices, array('DUPX_NOTICE_ITEM', 'sortNoticeForPriorityAndLevel'));
343
+ }
344
+
345
+ public function displayFinalReport($section)
346
+ {
347
+ foreach ($this->finalReporNotices as $id => $notice) {
348
+ if (in_array($section, $notice->sections)) {
349
+ self::finalReportNotice($id, $notice);
350
+ }
351
+ }
352
+ /*
353
+ echo '<pre>';
354
+ print_r($this->finalReporNotices);
355
+ echo '</pre>'; */
356
+ }
357
+
358
+ /**
359
+ *
360
+ * @param string $section
361
+ * @param string $title
362
+ */
363
+ public function displayFinalRepostSectionHtml($section, $title)
364
+ {
365
+ if ($this->haveSection($section)) {
366
+ ?>
367
+ <div id="report-section-<?php echo $section; ?>" class="section" >
368
+ <div class="section-title" ><?php echo $title; ?></div>
369
+ <div class="section-content">
370
+ <?php
371
+ $this->displayFinalReport($section);
372
+ ?>
373
+ </div>
374
+ </div>
375
+ <?php
376
+ }
377
+ }
378
+
379
+ /**
380
+ *
381
+ * @param string $section
382
+ * @return boolean
383
+ */
384
+ public function haveSection($section)
385
+ {
386
+ foreach ($this->finalReporNotices as $notice) {
387
+ if (in_array($section, $notice->sections)) {
388
+ return true;
389
+ }
390
+ }
391
+ return false;
392
+ }
393
+
394
+ /**
395
+ *
396
+ * @param null|string $section if null is a global result
397
+ *
398
+ * @return int // returns the worst level found
399
+ *
400
+ */
401
+ public function getSectionErrLevel($section = null)
402
+ {
403
+ $result = DUPX_NOTICE_ITEM::INFO;
404
+
405
+ foreach ($this->finalReporNotices as $notice) {
406
+ if (is_null($section) || in_array($section, $notice->sections)) {
407
+ $result = max($result, $notice->level);
408
+ }
409
+ }
410
+ return $result;
411
+ }
412
+
413
+ /**
414
+ *
415
+ * @param string $section
416
+ * @param bool $echo
417
+ * @return void|string
418
+ */
419
+ public function getSectionErrLevelHtml($section = null, $echo = true)
420
+ {
421
+ return self::getErrorLevelHtml($this->getSectionErrLevel($section), $echo);
422
+ }
423
+
424
+ public function displayStepMessages($deleteListAfterDisaply = true)
425
+ {
426
+ if (empty($this->nextStepNotices)) {
427
+ return;
428
+ }
429
+ ?>
430
+ <div id="step-messages">
431
+ <?php
432
+ foreach ($this->nextStepNotices as $notice) {
433
+ self::stepMsg($notice);
434
+ }
435
+ ?>
436
+ </div>
437
+ <?php
438
+ if ($deleteListAfterDisaply) {
439
+ $this->nextStepNotices = array();
440
+ $this->saveNotices();
441
+ }
442
+ }
443
+
444
+ /**
445
+ *
446
+ * @param DUPX_NOTICE_ITEM $notice
447
+ */
448
+ private static function stepMsg($notice)
449
+ {
450
+ $classes = array(
451
+ 'notice',
452
+ self::getClassFromLevel($notice->level)
453
+ );
454
+ ?>
455
+ <div class="<?php echo implode(' ', $classes); ?>">
456
+ <p>
457
+ <?php
458
+ echo self::getNextStepLevelPrefixMessage($notice->level).': <b>'.htmlentities($notice->shortMsg).'</b>';
459
+ if (!empty($notice->faqLink)) {
460
+ ?>
461
+ <br>
462
+ See FAQ: <a href="<?php echo $notice->faqLink['url']; ?>" >
463
+ <b><?php echo htmlentities(empty($notice->faqLink['label']) ? $notice->faqLink['url'] : $notice->faqLink['label']); ?></b>
464
+ </a>
465
+ <?php
466
+ }
467
+ if (!empty($notice->longMsg)) {
468
+ echo '<br><br>'.($notice->longMsgHtml ? $notice->longMsg : htmlentities($notice->longMsg));
469
+ }
470
+ ?>
471
+ </p>
472
+ <!--<button type="button" class="notice-dismiss"><span class="screen-reader-text">Nascondi questa notifica.</span></button>-->
473
+ </div>
474
+ <?php
475
+ }
476
+
477
+ /**
478
+ *
479
+ * @param string $id
480
+ * @param DUPX_NOTICE_ITEM $notice
481
+ */
482
+ private static function finalReportNotice($id, $notice)
483
+ {
484
+ $classes = array(
485
+ 'notice-report',
486
+ 'notice',
487
+ self::getClassFromLevel($notice->level)
488
+ );
489
+ $haveContent = !empty($notice->faqLink) || !empty($notice->longMsg);
490
+ $contentId = 'notice-content-'.$id;
491
+ $iconClasses = $haveContent ? 'fa fa-caret-right' : 'fa fa-toggle-empty';
492
+ $toggleLinkData = $haveContent ? 'data-type="toggle" data-target="#'.$contentId.'"' : '';
493
+ ?>
494
+ <div class="<?php echo implode(' ', $classes); ?>">
495
+ <div class="title" <?php echo $toggleLinkData; ?>>
496
+ <i class="<?php echo $iconClasses; ?>"></i> <?php echo htmlentities($notice->shortMsg); ?>
497
+ </div>
498
+ <?php if ($haveContent) { ?>
499
+ <div class="info <?php echo $notice->open ? '' : 'no-display'; ?>" id="<?php echo $contentId; ?>">
500
+ <?php if (!empty($notice->faqLink)) { ?>
501
+ <b>See FAQ</b>: <a href="<?php echo $notice->faqLink['url']; ?>" >
502
+ <?php echo htmlentities(empty($notice->faqLink['label']) ? $notice->faqLink['url'] : $notice->faqLink['label']); ?>
503
+ </a>
504
+ <?php
505
+ }
506
+ if (!empty($notice->faqLink) && !empty($notice->longMsg)) {
507
+ echo '<br><br>';
508
+ }
509
+ if (!empty($notice->longMsg)) {
510
+ echo $notice->longMsgHtml ? $notice->longMsg : htmlentities($notice->longMsg);
511
+ }
512
+ ?>
513
+ </div>
514
+ <?php
515
+ }
516
+ ?>
517
+ </div>
518
+ <?php
519
+ }
520
+
521
+ private static function getClassFromLevel($level)
522
+ {
523
+ switch ($level) {
524
+ case DUPX_NOTICE_ITEM::INFO:
525
+ return 'l-info';
526
+ case DUPX_NOTICE_ITEM::NOTICE:
527
+ return 'l-notice';
528
+ case DUPX_NOTICE_ITEM::SOFT_WARNING:
529
+ return 'l-swarning';
530
+ case DUPX_NOTICE_ITEM::HARD_WARNING:
531
+ return 'l-hwarning';
532
+ case DUPX_NOTICE_ITEM::CRITICAL:
533
+ return 'l-critical';
534
+ case DUPX_NOTICE_ITEM::FATAL:
535
+ return 'l-fatal';
536
+ }
537
+ }
538
+
539
+ public static function getErrorLevelHtml($level, $echo = true)
540
+ {
541
+ switch ($level) {
542
+ case DUPX_NOTICE_ITEM::INFO:
543
+ $label = 'good';
544
+ break;
545
+ case DUPX_NOTICE_ITEM::NOTICE:
546
+ $label = 'good';
547
+ break;
548
+ case DUPX_NOTICE_ITEM::SOFT_WARNING:
549
+ $label = 'warning';
550
+ break;
551
+ case DUPX_NOTICE_ITEM::HARD_WARNING:
552
+ $label = 'warning';
553
+ break;
554
+ case DUPX_NOTICE_ITEM::CRITICAL:
555
+ $label = 'critical error';
556
+ break;
557
+ case DUPX_NOTICE_ITEM::FATAL:
558
+ $label = 'fatal error';
559
+ break;
560
+ default:
561
+ return;
562
+ }
563
+ $classes = self::getClassFromLevel($level);
564
+ ob_start();
565
+ ?>
566
+ <span class="notice-level-status <?php echo $classes; ?>"><?php echo $label; ?></span>
567
+ <?php
568
+ if ($echo) {
569
+ ob_end_flush();
570
+ } else {
571
+ return ob_get_clean();
572
+ }
573
+ }
574
+
575
+ public static function getNextStepLevelPrefixMessage($level, $echo = true)
576
+ {
577
+ switch ($level) {
578
+ case DUPX_NOTICE_ITEM::INFO:
579
+ $label = 'INFO';
580
+ break;
581
+ case DUPX_NOTICE_ITEM::NOTICE:
582
+ $label = 'NOTICE';
583
+ break;
584
+ case DUPX_NOTICE_ITEM::SOFT_WARNING:
585
+ $label = 'WARNING';
586
+ break;
587
+ case DUPX_NOTICE_ITEM::HARD_WARNING:
588
+ $label = 'WARNING';
589
+ break;
590
+ case DUPX_NOTICE_ITEM::CRITICAL:
591
+ $label = 'CRITICAL ERROR';
592
+ break;
593
+ case DUPX_NOTICE_ITEM::FATAL:
594
+ $label = 'FATAL ERROR';
595
+ break;
596
+ default:
597
+ return;
598
+ }
599
+
600
+ if ($echo) {
601
+ echo $label;
602
+ } else {
603
+ return $label;
604
+ }
605
+ }
606
+
607
+ private static function getNewAutoUniqueId()
608
+ {
609
+ self::$uniqueCountId ++;
610
+ return self::DEFAULT_UNIQUE_ID_PREFIX.self::$uniqueCountId;
611
+ }
612
+
613
+ /**
614
+ * function for internal test
615
+ *
616
+ * display all messages levels
617
+ */
618
+ public static function testNextStepMessaesLevels()
619
+ {
620
+ $manager = self::getInstance();
621
+ $manager->addNextStepNoticeMessage('Level info ('.DUPX_NOTICE_ITEM::INFO.')', DUPX_NOTICE_ITEM::INFO);
622
+ $manager->addNextStepNoticeMessage('Level notice ('.DUPX_NOTICE_ITEM::NOTICE.')', DUPX_NOTICE_ITEM::NOTICE);
623
+ $manager->addNextStepNoticeMessage('Level soft warning ('.DUPX_NOTICE_ITEM::SOFT_WARNING.')', DUPX_NOTICE_ITEM::SOFT_WARNING);
624
+ $manager->addNextStepNoticeMessage('Level hard warning ('.DUPX_NOTICE_ITEM::HARD_WARNING.')', DUPX_NOTICE_ITEM::HARD_WARNING);
625
+ $manager->addNextStepNoticeMessage('Level critical error ('.DUPX_NOTICE_ITEM::CRITICAL.')', DUPX_NOTICE_ITEM::CRITICAL);
626
+ $manager->addNextStepNoticeMessage('Level fatal error ('.DUPX_NOTICE_ITEM::FATAL.')', DUPX_NOTICE_ITEM::FATAL);
627
+ $manager->saveNotices();
628
+ }
629
+
630
+ public static function testNextStepFullMessageData()
631
+ {
632
+ $manager = self::getInstance();
633
+ $longMsg = <<<LONGMSG
634
+ <b>Formattend long text</b><br>
635
+ <ul>
636
+ <li>Proin dapibus mi eu erat pulvinar, id congue nisl egestas.</li>
637
+ <li>Nunc venenatis eros et sapien ornare consequat.</li>
638
+ <li>Mauris tincidunt est sit amet turpis placerat, a tristique dui porttitor.</li>
639
+ <li>Etiam volutpat lectus quis risus molestie faucibus.</li>
640
+ <li>Integer gravida eros sit amet sem viverra, a volutpat neque rutrum.</li>
641
+ <li>Aenean varius ipsum vitae lorem tempus rhoncus.</li>
642
+ </ul>
643
+ LONGMSG;
644
+ $manager->addNextStepNotice(array(
645
+ 'shortMsg' => 'Full elements next step message',
646
+ 'level' => DUPX_NOTICE_ITEM::HARD_WARNING,
647
+ 'longMsg' => $longMsg,
648
+ 'longMsgHtml' => true,
649
+ 'faqLink' => array(
650
+ 'url' => 'http://www.google.it',
651
+ 'label' => 'google link'
652
+ )
653
+ ));
654
+ $manager->saveNotices();
655
+ }
656
+
657
+ public static function testFinalReporMessaesLevels()
658
+ {
659
+ $section = 'general';
660
+
661
+ $manager = self::getInstance();
662
+ $manager->addFinalReportNoticeMessage('Level info ('.DUPX_NOTICE_ITEM::INFO.')', $section, DUPX_NOTICE_ITEM::INFO, DUPX_NOTICE_MANAGER::ADD_UNIQUE, 'test_fr_0');
663
+ $manager->addFinalReportNoticeMessage('Level notice ('.DUPX_NOTICE_ITEM::NOTICE.')', $section, DUPX_NOTICE_ITEM::NOTICE, DUPX_NOTICE_MANAGER::ADD_UNIQUE, 'test_fr_1');
664
+ $manager->addFinalReportNoticeMessage('Level soft warning ('.DUPX_NOTICE_ITEM::SOFT_WARNING.')', $section, DUPX_NOTICE_ITEM::SOFT_WARNING, DUPX_NOTICE_MANAGER::ADD_UNIQUE, 'test_fr_2');
665
+ $manager->addFinalReportNoticeMessage('Level hard warning ('.DUPX_NOTICE_ITEM::HARD_WARNING.')', $section, DUPX_NOTICE_ITEM::HARD_WARNING, DUPX_NOTICE_MANAGER::ADD_UNIQUE, 'test_fr_3');
666
+ $manager->addFinalReportNoticeMessage('Level critical error ('.DUPX_NOTICE_ITEM::CRITICAL.')', $section, DUPX_NOTICE_ITEM::CRITICAL, DUPX_NOTICE_MANAGER::ADD_UNIQUE, 'test_fr_4');
667
+ $manager->addFinalReportNoticeMessage('Level fatal error ('.DUPX_NOTICE_ITEM::FATAL.')', $section, DUPX_NOTICE_ITEM::FATAL, DUPX_NOTICE_MANAGER::ADD_UNIQUE, 'test_fr_5');
668
+ $manager->saveNotices();
669
+ }
670
+
671
+ public static function testFinalReportFullMessages()
672
+ {
673
+ $section = 'general';
674
+ $manager = self::getInstance();
675
+
676
+ $longMsg = <<<LONGMSG
677
+ <b>Formattend long text</b><br>
678
+ <ul>
679
+ <li>Proin dapibus mi eu erat pulvinar, id congue nisl egestas.</li>
680
+ <li>Nunc venenatis eros et sapien ornare consequat.</li>
681
+ <li>Mauris tincidunt est sit amet turpis placerat, a tristique dui porttitor.</li>
682
+ <li>Etiam volutpat lectus quis risus molestie faucibus.</li>
683
+ <li>Integer gravida eros sit amet sem viverra, a volutpat neque rutrum.</li>
684
+ <li>Aenean varius ipsum vitae lorem tempus rhoncus.</li>
685
+ </ul>
686
+ LONGMSG;
687
+
688
+ $manager->addFinalReportNotice(array(
689
+ 'shortMsg' => 'Full elements final report message',
690
+ 'level' => DUPX_NOTICE_ITEM::HARD_WARNING,
691
+ 'longMsg' => $longMsg,
692
+ 'longMsgHtml' => true,
693
+ 'sections' => $section,
694
+ 'faqLink' => array(
695
+ 'url' => 'http://www.google.it',
696
+ 'label' => 'google link'
697
+ )
698
+ ), DUPX_NOTICE_MANAGER::ADD_UNIQUE, 'test_fr_full_1');
699
+
700
+ $manager->addFinalReportNotice(array(
701
+ 'shortMsg' => 'Full elements final report message info high priority',
702
+ 'level' => DUPX_NOTICE_ITEM::INFO,
703
+ 'longMsg' => $longMsg,
704
+ 'longMsgHtml' => true,
705
+ 'sections' => $section,
706
+ 'faqLink' => array(
707
+ 'url' => 'http://www.google.it',
708
+ 'label' => 'google link'
709
+ ),
710
+ 'priority' => 5
711
+ ), DUPX_NOTICE_MANAGER::ADD_UNIQUE, 'test_fr_full_2');
712
+ $manager->saveNotices();
713
+ }
714
+
715
+ private function __clone()
716
+ {
717
+
718
+ }
719
+
720
+ private function __wakeup()
721
+ {
722
+
723
+ }
724
+ }
725
+
726
+ class DUPX_NOTICE_ITEM
727
+ {
728
+ const INFO = 0;
729
+ const NOTICE = 1;
730
+ const SOFT_WARNING = 2;
731
+ const HARD_WARNING = 3;
732
+ const CRITICAL = 4;
733
+ const FATAL = 5;
734
+
735
+ /**
736
+ *
737
+ * @var string text
738
+ */
739
+ public $shortMsg = '';
740
+
741
+ /**
742
+ *
743
+ * @var string html text
744
+ */
745
+ public $longMsg = '';
746
+
747
+ /**
748
+ *
749
+ * @var bool if true long msg can be html
750
+ */
751
+ public $longMsgHtml = false;
752
+
753
+ /**
754
+ *
755
+ * @var null|array // null = no faq link
756
+ * array( 'label' => link text , 'url' => faq url)
757
+ */
758
+ public $faqLink = array(
759
+ 'label' => '',
760
+ 'url' => ''
761
+ );
762
+
763
+ /**
764
+ *
765
+ * @var string[] notice sections for final report only
766
+ */
767
+ public $sections = array();
768
+
769
+ /**
770
+ *
771
+ * @var int
772
+ */
773
+ public $level = self::NOTICE;
774
+
775
+ /**
776
+ *
777
+ * @var int
778
+ */
779
+ public $priority = 10;
780
+
781
+ /**
782
+ *
783
+ * @var bool if true notice start open. For final report only
784
+ */
785
+ public $open = false;
786
+
787
+ /**
788
+ *
789
+ * @param string $shortMsg text
790
+ * @param int $level
791
+ * @param string $longMsg html text
792
+ * @param string|string[] $sections
793
+ * @param null|array $faqLink [
794
+ * 'url' => external link
795
+ * 'label' => link text if empty get external url link
796
+ * ]
797
+ * @param int priority
798
+ * @param bool open
799
+ * @param bool longMsgHtml
800
+ */
801
+ public function __construct($shortMsg, $level = self::INFO, $longMsg = '', $sections = array(), $faqLink = null, $priority = 10, $open = false, $longMsgHtml = false)
802
+ {
803
+ $this->shortMsg = (string) $shortMsg;
804
+ $this->level = (int) $level;
805
+ $this->longMsg = (string) $longMsg;
806
+ $this->sections = is_array($sections) ? $sections : array($sections);
807
+ $this->faqLink = $faqLink;
808
+ $this->priority = $priority;
809
+ $this->open = $open;
810
+ $this->longMsgHtml = $longMsgHtml;
811
+ }
812
+
813
+ /**
814
+ *
815
+ * @return array [
816
+ * 'shortMsg' => text,
817
+ * 'level' => level,
818
+ * 'longMsg' => html text,
819
+ * 'sections' => string|string[],
820
+ * 'faqLink' => [
821
+ * 'url' => external link
822
+ * 'label' => link text if empty get external url link
823
+ * ]
824
+ * ]
825
+ */
826
+ public function toArray()
827
+ {
828
+ return array(
829
+ 'shortMsg' => $this->shortMsg,
830
+ 'level' => $this->level,
831
+ 'longMsg' => $this->longMsg,
832
+ 'sections' => $this->sections,
833
+ 'faqLink' => $this->faqLink,
834
+ 'priority' => $this->priority,
835
+ 'open' => $this->open,
836
+ 'longMsgHtml' => $this->longMsgHtml
837
+ );
838
+ }
839
+
840
+ /**
841
+ *
842
+ * @param array $array [
843
+ * 'shortMsg' => text,
844
+ * 'level' => level,
845
+ * 'longMsg' => html text,
846
+ * 'sections' => string|string[],
847
+ * 'faqLink' => [
848
+ * 'url' => external link
849
+ * 'label' => link text if empty get external url link
850
+ * ]
851
+ * ]
852
+ * @return DUPX_NOTICE_ITEM
853
+ */
854
+ public static function getItemFromArray($array)
855
+ {
856
+ if (isset($array['sections']) && !is_array($array['sections'])) {
857
+ if (empty($array['sections'])) {
858
+ $array['sections'] = array();
859
+ } else {
860
+ $array['sections'] = array($array['sections']);
861
+ }
862
+ }
863
+ $params = array_merge(self::getDefaultArrayParams(), $array);
864
+ $result = new self($params['shortMsg'], $params['level'], $params['longMsg'], $params['sections'], $params['faqLink'], $params['priority'], $params['open'], $params['longMsgHtml']);
865
+ return $result;
866
+ }
867
+
868
+ /**
869
+ *
870
+ * @return array [
871
+ * 'shortMsg' => text,
872
+ * 'level' => level,
873
+ * 'longMsg' => html text,
874
+ * 'sections' => string|string[],
875
+ * 'faqLink' => [
876
+ * 'url' => external link
877
+ * 'label' => link text if empty get external url link
878
+ * ],
879
+ * priority
880
+ * open
881
+ * longMsgHtml
882
+ * ]
883
+ */
884
+ public static function getDefaultArrayParams()
885
+ {
886
+ return array(
887
+ 'shortMsg' => '',
888
+ 'level' => self::INFO,
889
+ 'longMsg' => '',
890
+ 'sections' => array(),
891
+ 'faqLink' => null,
892
+ 'priority' => 10,
893
+ 'open' => false,
894
+ 'longMsgHtml' => false
895
+ );
896
+ }
897
+
898
+ /**
899
+ * before lower priority
900
+ * before highest level
901
+ *
902
+ * @param DUPX_NOTICE_ITEM $a
903
+ * @param DUPX_NOTICE_ITEM $b
904
+ */
905
+ public static function sortNoticeForPriorityAndLevel($a, $b)
906
+ {
907
+ if ($a->priority == $b->priority) {
908
+ if ($a->level == $b->level) {
909
+ return 0;
910
+ } else if ($a->level < $b->level) {
911
+ return 1;
912
+ } else {
913
+ return -1;
914
+ }
915
+ } else if ($a->priority < $b->priority) {
916
+ return -1;
917
+ } else {
918
+ return 1;
919
+ }
920
+ }
921
+ }
installer/dup-installer/classes/utilities/class.u.php CHANGED
@@ -163,6 +163,7 @@ class DUPX_U
163
  if (function_exists('get_headers')) {
164
  $url = is_integer($port) ? $url . ':' . $port : $url;
165
  DUPX_Handler::$should_log = false;
 
166
  $headers = @get_headers($url);
167
  DUPX_Handler::$should_log = true;
168
  if (is_array($headers) && strpos($headers[0], '404') === false) {
@@ -170,7 +171,7 @@ class DUPX_U
170
  }
171
  } else {
172
  if (function_exists('fsockopen')) {
173
- @ini_set("default_socket_timeout", 5);
174
  $port = isset($port) && is_integer($port) ? $port : 80;
175
  $host = parse_url($url, PHP_URL_HOST);
176
  $connected = @fsockopen($host, $port, $errno, $errstr, $timeout); //website and port
@@ -246,22 +247,23 @@ class DUPX_U
246
  for ($i = 0; $i < $zipArchive->numFiles; $i++) {
247
  $stat = $zipArchive->statIndex($i);
248
  $safePath = rtrim(self::setSafePath($stat['name']), '/');
249
- if (substr_count($safePath, '/') > 1) {
250
  continue;
251
  }
252
 
253
- if (basename($safePath) === 'dup-installer') {
254
- $result = ($safePath === 'dup-installer') ? '' : dirname($safePath);
 
255
  break;
256
  }
257
  }
258
  if ($zipArchive->close() !== true) {
259
  DUPX_Log::info("Can't close ziparchive:".$archive_filepath);
260
- $result = false;
261
  }
262
  } else {
263
  DUPX_Log::info("Can't open zip archive:".$archive_filepath);
264
- $result = false;
265
  }
266
 
267
  return $result;
163
  if (function_exists('get_headers')) {
164
  $url = is_integer($port) ? $url . ':' . $port : $url;
165
  DUPX_Handler::$should_log = false;
166
+ @ini_set("default_socket_timeout", $timeout);
167
  $headers = @get_headers($url);
168
  DUPX_Handler::$should_log = true;
169
  if (is_array($headers) && strpos($headers[0], '404') === false) {
171
  }
172
  } else {
173
  if (function_exists('fsockopen')) {
174
+ @ini_set("default_socket_timeout", $timeout);
175
  $port = isset($port) && is_integer($port) ? $port : 80;
176
  $host = parse_url($url, PHP_URL_HOST);
177
  $connected = @fsockopen($host, $port, $errno, $errstr, $timeout); //website and port
247
  for ($i = 0; $i < $zipArchive->numFiles; $i++) {
248
  $stat = $zipArchive->statIndex($i);
249
  $safePath = rtrim(self::setSafePath($stat['name']), '/');
250
+ if (substr_count($safePath, '/') > 2) {
251
  continue;
252
  }
253
 
254
+ $exploded = explode('/',$safePath);
255
+ if (($dup_index = array_search('dup-installer' , $exploded)) !== false) {
256
+ $result = implode('/' , array_slice($exploded , 0 , $dup_index));
257
  break;
258
  }
259
  }
260
  if ($zipArchive->close() !== true) {
261
  DUPX_Log::info("Can't close ziparchive:".$archive_filepath);
262
+ return false;
263
  }
264
  } else {
265
  DUPX_Log::info("Can't open zip archive:".$archive_filepath);
266
+ return false;
267
  }
268
 
269
  return $result;
installer/dup-installer/ctrls/ctrl.s1.php CHANGED
@@ -154,9 +154,15 @@ switch ($post_archive_engine) {
154
  DUPX_Log::error(ERR_ZIPARCHIVE);
155
  }
156
 
157
- $dupInstallerFolder = DUPX_U::findDupInstallerFolder($archive_path);
 
 
 
 
158
  if (!empty($dupInstallerFolder)) {
159
  DUPX_Log::info("ARCHIVE dup-installer SUBFOLDER:\"".$dupInstallerFolder."\"");
 
 
160
  }
161
 
162
  $dupInstallerZipPath = $dupInstallerFolder.'/dup-installer';
@@ -164,6 +170,7 @@ switch ($post_archive_engine) {
164
  $zip = new ZipArchive();
165
 
166
  if ($zip->open($archive_path) === TRUE) {
 
167
  for($i = 0; $i < $zip->numFiles; $i++) {
168
  $extract_filename = $zip->getNameIndex($i);
169
 
@@ -174,20 +181,22 @@ switch ($post_archive_engine) {
174
 
175
  // skip no dupInstallerFolder files
176
  if (!empty($dupInstallerFolder) && strpos($extract_filename , $dupInstallerFolder) !== 0) {
 
177
  continue;
178
- }
 
 
179
 
180
- try {
181
- if (!$zip->extractTo($target , $extract_filename)) {
182
- DUPX_Log::info("FILE EXTRACION ERROR: ".$extract_filename);
183
- } else {
184
- DUPX_Log::info("DONE: ".$extract_filename,2);
185
- }
186
-
187
- } catch (Exception $ex) {
188
- DUPX_Log::info("FILE EXTRACION ERROR: {$extract_filename} | MSG:" . $ex->getMessage());
189
- }
190
- }
191
 
192
  if (!empty($dupInstallerFolder)) {
193
  DUPX_U::moveUpfromSubFolder($target.'/'.$dupInstallerFolder , true);
154
  DUPX_Log::error(ERR_ZIPARCHIVE);
155
  }
156
 
157
+ if (($dupInstallerFolder = DUPX_U::findDupInstallerFolder($archive_path)) === false) {
158
+ DUPX_Log::info("findDupInstallerFolder error; set no subfolder");
159
+ // if not found set not subfolder
160
+ $dupInstallerFolder = '';
161
+ }
162
  if (!empty($dupInstallerFolder)) {
163
  DUPX_Log::info("ARCHIVE dup-installer SUBFOLDER:\"".$dupInstallerFolder."\"");
164
+ } else {
165
+ DUPX_Log::info("ARCHIVE dup-installer SUBFOLDER:\"".$dupInstallerFolder."\"", 2);
166
  }
167
 
168
  $dupInstallerZipPath = $dupInstallerFolder.'/dup-installer';
170
  $zip = new ZipArchive();
171
 
172
  if ($zip->open($archive_path) === TRUE) {
173
+ $extract_filenames = array();
174
  for($i = 0; $i < $zip->numFiles; $i++) {
175
  $extract_filename = $zip->getNameIndex($i);
176
 
181
 
182
  // skip no dupInstallerFolder files
183
  if (!empty($dupInstallerFolder) && strpos($extract_filename , $dupInstallerFolder) !== 0) {
184
+ DUPX_Log::info("SKIP NOT DUB FOLDER: \"".$extract_filename."\"", 2);
185
  continue;
186
+ }
187
+ $extract_filenames[] = $extract_filename;
188
+ }
189
 
190
+ try {
191
+ if (!$zip->extractTo($target , $extract_filenames)) {
192
+ DUPX_Log::info("FILE EXTRACION ERROR: ".implode(',', $extract_filenames));
193
+ } else {
194
+ DUPX_Log::info("DONE: ".$extract_filename,2);
195
+ }
196
+
197
+ } catch (Exception $ex) {
198
+ DUPX_Log::info("FILE EXTRACION ERROR: {$extract_filename} | MSG:" . $ex->getMessage());
199
+ }
 
200
 
201
  if (!empty($dupInstallerFolder)) {
202
  DUPX_U::moveUpfromSubFolder($target.'/'.$dupInstallerFolder , true);
installer/dup-installer/ctrls/ctrl.s2.base.php CHANGED
@@ -74,7 +74,7 @@ $dbTestIn->mode = DUPX_U::sanitize_text_field($_POST['view_mode']);
74
  $dbTestIn->dbaction = DUPX_U::sanitize_text_field($_POST['dbaction']);
75
  $dbTestIn->dbhost = DUPX_U::sanitize_text_field($_POST['dbhost']);
76
  $dbTestIn->dbuser = DUPX_U::sanitize_text_field($_POST['dbuser']);
77
- $dbTestIn->dbpass = trim($_POST['dbpass']);
78
  $dbTestIn->dbname = DUPX_U::sanitize_text_field($_POST['dbname']);
79
  $dbTestIn->dbport = DUPX_U::sanitize_text_field($_POST['dbport']);
80
  $dbTestIn->dbcollatefb = DUPX_U::sanitize_text_field($_POST['dbcollatefb']);
@@ -117,7 +117,6 @@ if($not_yet_logged){
117
  $dbinstall = new DUPX_DBInstall($_POST, $ajax2_start);
118
  if ($_POST['dbaction'] != 'manual') {
119
  if(!isset($_POST['continue_chunking'])){
120
- // $dbinstall->prepareSQL();
121
  $dbinstall->prepareDB();
122
  } else if($_POST['first_chunk'] == 1) {
123
  $dbinstall->prepareDB();
@@ -150,14 +149,16 @@ if ($_POST['dbaction'] == 'manual') {
150
  DUPX_Log::info("\n** SQL EXECUTION IS IN MANUAL MODE **");
151
  DUPX_Log::info("- No SQL script has been executed -");
152
  $JSON['pass'] = 1;
153
- } /*elseif(isset($_POST['continue_chunking']) && $_POST['continue_chunking'] === 'true') {
154
- print_r(json_encode($dbinstall->writeInChunks()));
155
- die();
156
- } */ elseif(isset($_POST['continue_chunking']) && ($_POST['continue_chunking'] === 'false' && $_POST['pass'] == 1)) {
157
- $JSON['pass'] = 1;
158
  } elseif(!isset($_POST['continue_chunking'])) {
159
- $dbinstall->writeInDB();
160
- $JSON['pass'] = 1;
 
 
 
 
 
 
 
161
  }
162
 
163
  $dbinstall->profile_end = DUPX_U::getMicrotime();
@@ -170,4 +171,4 @@ DUPX_Log::info("\nINSERT DATA RUNTIME: " . DUPX_U::elapsedTime($dbinstall->profi
170
  DUPX_Log::info('STEP-2 COMPLETE @ '.@date('h:i:s')." - RUNTIME: {$ajax1_sum}");
171
 
172
  error_reporting($ajax2_error_level);
173
- die(json_encode($JSON));
74
  $dbTestIn->dbaction = DUPX_U::sanitize_text_field($_POST['dbaction']);
75
  $dbTestIn->dbhost = DUPX_U::sanitize_text_field($_POST['dbhost']);
76
  $dbTestIn->dbuser = DUPX_U::sanitize_text_field($_POST['dbuser']);
77
+ $dbTestIn->dbpass = trim($_POST['dbpass']);
78
  $dbTestIn->dbname = DUPX_U::sanitize_text_field($_POST['dbname']);
79
  $dbTestIn->dbport = DUPX_U::sanitize_text_field($_POST['dbport']);
80
  $dbTestIn->dbcollatefb = DUPX_U::sanitize_text_field($_POST['dbcollatefb']);
117
  $dbinstall = new DUPX_DBInstall($_POST, $ajax2_start);
118
  if ($_POST['dbaction'] != 'manual') {
119
  if(!isset($_POST['continue_chunking'])){
 
120
  $dbinstall->prepareDB();
121
  } else if($_POST['first_chunk'] == 1) {
122
  $dbinstall->prepareDB();
149
  DUPX_Log::info("\n** SQL EXECUTION IS IN MANUAL MODE **");
150
  DUPX_Log::info("- No SQL script has been executed -");
151
  $JSON['pass'] = 1;
 
 
 
 
 
152
  } elseif(!isset($_POST['continue_chunking'])) {
153
+ $dbinstall->writeInDB();
154
+ $rowCountMisMatchTables = $dbinstall->getRowCountMisMatchTables();
155
+ if (empty($rowCountMisMatchTables)) {
156
+ $JSON['pass'] = 1;
157
+ } else {
158
+ $JSON['error'] = 1;
159
+ $JSON['error_message'] = 'ERROR: Database Table row count verification was failed for table(s):'
160
+ .implode(', ', $rowCountMisMatchTables).'.';
161
+ }
162
  }
163
 
164
  $dbinstall->profile_end = DUPX_U::getMicrotime();
171
  DUPX_Log::info('STEP-2 COMPLETE @ '.@date('h:i:s')." - RUNTIME: {$ajax1_sum}");
172
 
173
  error_reporting($ajax2_error_level);
174
+ die(json_encode($JSON));
installer/dup-installer/ctrls/ctrl.s2.dbinstall.php CHANGED
@@ -78,50 +78,6 @@ class DUPX_DBInstall
78
  $this->dbobj_procs = isset($post['dbobj_procs']) ? DUPX_U::sanitize_text_field($post['dbobj_procs']) : 0;
79
  }
80
 
81
- /*TODO: Remove after 1.3.2 is released */
82
- public function prepareSQL()
83
- {
84
- $faq_url = $GLOBALS['FAQ_URL'];
85
- @chmod($this->sql_file_path , 0777);
86
- $sql_file = file_get_contents($this->sql_file_path, true);
87
-
88
- //ERROR: Reading database.sql file
89
- if ($sql_file === false || strlen($sql_file) < 10) {
90
- $spacer = str_repeat("&nbsp;", 5);
91
- $sql_file_rel_path = "dup-installer/dup-database__{$GLOBALS['DUPX_AC']->package_hash}.sql";
92
- $msg = "<b>Unable to read/find the ".DUPX_U::esc_html($sql_file_rel_path)." file from the archive.</b><br/>
93
- Please check these items: <br/><br/>
94
- 1. Validate permissions and/or group-owner rights on these items: <br/>
95
- {$spacer}- File: dup-database__{$GLOBALS['DUPX_AC']->package_hash}.sql file in dup-installer folder<br/>
96
- {$spacer}- Directory: [".DUPX_U::esc_html($this->root_path)."] <br/>
97
- {$spacer}<small>See: <a href='".DUPX_U::esc_url($faq_url."#faq-trouble-055-q")."' target='_blank'>".DUPX_U::esc_url($faq_url."#faq-trouble-055-q")."</a></small><br/><br/>
98
- 2. Validate the dup-database__".DUPX_U::esc_html($GLOBALS['DUPX_AC']->package_hash).".sql file exists and is in the dup-installer folder of the archive.zip file <br/>
99
- {$spacer}<small>See: <a href='".DUPX_U::esc_url($faq_url.'#faq-installer-020-q')."' target='_blank'>{$faq_url}#faq-installer-020-q</a></small><br/><br/>";
100
- DUPX_Log::error($msg);
101
- }
102
-
103
- //Removes invalid space characters
104
- //Complex Subject See: http://webcollab.sourceforge.net/unicode.html
105
- $sql_file = $this->nbspFix($sql_file);
106
-
107
- //Write new contents to install-data.sql
108
- @chmod($this->sql_result_file_path, 0777);
109
- $sql_file_copy_status = file_put_contents($this->sql_result_file_path, $sql_file);
110
- $this->sql_result_data = explode(";\n", $sql_file);
111
- $this->sql_result_data_length = count($this->sql_result_data);
112
- $sql_file = null;
113
-
114
- //WARNING: Create installer-data.sql failed
115
- if ($sql_file_copy_status === false || filesize($this->sql_result_file_path) == 0 || !is_readable($this->sql_result_file_path)) {
116
- $sql_file_path = "{$GLOBALS['DUPX_INIT']}/dup-database__{$GLOBALS['DUPX_AC']->package_hash}.sql";
117
- $sql_file_size = DUPX_U::readableByteSize(filesize($sql_file_path));
118
- $msg = "\nWARNING: Unable to properly copy dup-installer/dup-database__{$GLOBALS['DUPX_AC']->package_hash}.sql ({$sql_file_size}) to {$GLOBALS['SQL_FILE_NAME']}. Please check these items:\n";
119
- $msg .= "- Validate permissions and/or group-owner rights on dup-database__{$GLOBALS['DUPX_AC']->package_hash}.sql and directory [{$GLOBALS['DUPX_INIT']}/] \n";
120
- $msg .= "- see: {$faq_url}#faq-trouble-055-q \n";
121
- DUPX_Log::info($msg);
122
- }
123
- }
124
-
125
  public function prepareDB()
126
  {
127
  //RUN DATABASE SCRIPT
@@ -211,6 +167,32 @@ Please check these items: <br/><br/>
211
  }
212
  }
213
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
214
  public function writeInDB()
215
  {
216
  //WRITE DATA
@@ -226,6 +208,8 @@ Please check these items: <br/><br/>
226
  return false;
227
  }
228
 
 
 
229
  @mysqli_autocommit($this->dbh, false);
230
 
231
  $query = null;
@@ -240,8 +224,16 @@ Please check these items: <br/><br/>
240
  if (preg_match('/'.$delimiter.'\s*$/S', $query)) {
241
  $query_strlen = strlen(trim($query));
242
  if ($this->dbvar_maxpacks < $query_strlen) {
243
- DUPX_Log::info("**ERROR** Query size limit [length={$this->dbvar_maxpacks}] [sql=".substr($this->sql_result_data[$counter], 0, 75)."...]");
244
  $this->dbquery_errs++;
 
 
 
 
 
 
 
 
245
  } elseif ($query_strlen > 0) {
246
  $query = $this->nbspFix($query);
247
  $query = $this->applyQueryCollationFallback($query);
@@ -279,10 +271,38 @@ Please check these items: <br/><br/>
279
  @mysqli_query($this->dbh, "SET wait_timeout = ".mysqli_real_escape_string($this->dbh, $GLOBALS['DB_MAX_TIME']));
280
  DUPX_DB::setCharset($this->dbh, $this->post['dbcharset'], $this->post['dbcollate']);
281
  }
282
- DUPX_Log::info("**ERROR** database error write '{$err}' - [sql=".substr($query, 0, 75)."...]");
 
283
 
284
  if (DUPX_U::contains($err, 'Unknown collation')) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
285
  DUPX_Log::info('RECOMMENDATION: Try resolutions found at https://snapcreek.com/duplicator/docs/faqs-tech/#faq-installer-110-q');
 
 
 
 
 
 
 
 
286
  }
287
 
288
  $this->dbquery_errs++;
@@ -302,6 +322,8 @@ Please check these items: <br/><br/>
302
  @mysqli_commit($this->dbh);
303
  @mysqli_autocommit($this->dbh, true);
304
 
 
 
305
  //DATA CLEANUP: Perform Transient Cache Cleanup
306
  //Remove all duplicator entries and record this one since this is a new install.
307
  $dbdelete_count1 = 0;
@@ -400,6 +422,9 @@ Please check these items: <br/><br/>
400
 
401
  public function writeLog()
402
  {
 
 
 
403
  DUPX_Log::info("ERRORS FOUND:\t{$this->dbquery_errs}");
404
  DUPX_Log::info("DROPPED TABLES:\t{$this->drop_tbl_log}");
405
  DUPX_Log::info("RENAMED TABLES:\t{$this->rename_tbl_log}");
78
  $this->dbobj_procs = isset($post['dbobj_procs']) ? DUPX_U::sanitize_text_field($post['dbobj_procs']) : 0;
79
  }
80
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
81
  public function prepareDB()
82
  {
83
  //RUN DATABASE SCRIPT
167
  }
168
  }
169
 
170
+ public function getRowCountMisMatchTables()
171
+ {
172
+ $tableWiseRowCounts = $GLOBALS['DUPX_AC']->dbInfo->tableWiseRowCounts;
173
+ $skipTables = array(
174
+ $GLOBALS['DUPX_AC']->wp_tableprefix."duplicator_packages",
175
+ $GLOBALS['DUPX_AC']->wp_tableprefix."options",
176
+ $GLOBALS['DUPX_AC']->wp_tableprefix."duplicator_pro_packages",
177
+ $GLOBALS['DUPX_AC']->wp_tableprefix."duplicator_pro_entities",
178
+ );
179
+ $misMatchTables = array();
180
+ foreach ($tableWiseRowCounts as $table => $rowCount) {
181
+ if (in_array($table, $skipTables)) {
182
+ continue;
183
+ }
184
+ $sql = "SELECT count(*) as cnt FROM `".mysqli_real_escape_string($this->dbh, $table)."`";
185
+ $result = mysqli_query($this->dbh, $sql);
186
+ if (false !== $result) {
187
+ $row = mysqli_fetch_assoc($result);
188
+ if ($rowCount != $row['cnt']) {
189
+ $misMatchTables[] = $table;
190
+ }
191
+ }
192
+ }
193
+ return $misMatchTables;
194
+ }
195
+
196
  public function writeInDB()
197
  {
198
  //WRITE DATA
208
  return false;
209
  }
210
 
211
+ $nManager = DUPX_NOTICE_MANAGER::getInstance();
212
+
213
  @mysqli_autocommit($this->dbh, false);
214
 
215
  $query = null;
224
  if (preg_match('/'.$delimiter.'\s*$/S', $query)) {
225
  $query_strlen = strlen(trim($query));
226
  if ($this->dbvar_maxpacks < $query_strlen) {
227
+ $errorMsg = "**ERROR** Query size limit [length={$this->dbvar_maxpacks}] [sql=".substr($this->sql_result_data[$counter], 0, 75)."...]";
228
  $this->dbquery_errs++;
229
+ $nManager->addNextStepNoticeMessage('QUERY ERROR: size limit' , DUPX_NOTICE_ITEM::SOFT_WARNING , DUPX_NOTICE_MANAGER::ADD_UNIQUE , 'query-size-limit-msg');
230
+ $nManager->addFinalReportNotice(array(
231
+ 'shortMsg' => 'QUERY ERROR: size limit',
232
+ 'level' => DUPX_NOTICE_ITEM::SOFT_WARNING,
233
+ 'longMsg' => $errorMsg,
234
+ 'sections' => 'database'
235
+ ));
236
+ DUPX_Log::info($errorMsg);
237
  } elseif ($query_strlen > 0) {
238
  $query = $this->nbspFix($query);
239
  $query = $this->applyQueryCollationFallback($query);
271
  @mysqli_query($this->dbh, "SET wait_timeout = ".mysqli_real_escape_string($this->dbh, $GLOBALS['DB_MAX_TIME']));
272
  DUPX_DB::setCharset($this->dbh, $this->post['dbcharset'], $this->post['dbcollate']);
273
  }
274
+ $errMsg = "**ERROR** database error write '{$err}' - [sql=".substr($query, 0, 75)."...]";
275
+ DUPX_Log::info($errMsg);
276
 
277
  if (DUPX_U::contains($err, 'Unknown collation')) {
278
+ $nManager->addNextStepNotice(array(
279
+ 'shortMsg' => 'DATABASE ERROR: database error write',
280
+ 'level' => DUPX_NOTICE_ITEM::HARD_WARNING,
281
+ 'longMsg' => 'Unknown collation<br>RECOMMENDATION: Try resolutions found at https://snapcreek.com/duplicator/docs/faqs-tech/#faq-installer-110-q',
282
+ 'faqLink' => array(
283
+ 'url' => 'https://snapcreek.com/duplicator/docs/faqs-tech/#faq-installer-110-q',
284
+ 'label' => 'FAQ Link'
285
+ )
286
+ ), DUPX_NOTICE_MANAGER::ADD_UNIQUE , 'query-collation-write-msg');
287
+ $nManager->addFinalReportNotice(array(
288
+ 'shortMsg' => 'DATABASE ERROR: database error write',
289
+ 'level' => DUPX_NOTICE_ITEM::HARD_WARNING,
290
+ 'longMsg' => 'Unknown collation<br>RECOMMENDATION: Try resolutions found at https://snapcreek.com/duplicator/docs/faqs-tech/#faq-installer-110-q'.'<br>'.$errMsg,
291
+ 'sections' => 'database',
292
+ 'faqLink' => array(
293
+ 'url' => 'https://snapcreek.com/duplicator/docs/faqs-tech/#faq-installer-110-q',
294
+ 'label' => 'FAQ Link'
295
+ )
296
+ ));
297
  DUPX_Log::info('RECOMMENDATION: Try resolutions found at https://snapcreek.com/duplicator/docs/faqs-tech/#faq-installer-110-q');
298
+ } else {
299
+ $nManager->addNextStepNoticeMessage('DATABASE ERROR: database error write' , DUPX_NOTICE_ITEM::SOFT_WARNING , DUPX_NOTICE_MANAGER::ADD_UNIQUE , 'query-write-msg');
300
+ $nManager->addFinalReportNotice(array(
301
+ 'shortMsg' => 'DATABASE ERROR: database error write',
302
+ 'level' => DUPX_NOTICE_ITEM::SOFT_WARNING,
303
+ 'longMsg' => $errMsg,
304
+ 'sections' => 'database'
305
+ ));
306
  }
307
 
308
  $this->dbquery_errs++;
322
  @mysqli_commit($this->dbh);
323
  @mysqli_autocommit($this->dbh, true);
324
 
325
+ $nManager ->saveNotices();
326
+
327
  //DATA CLEANUP: Perform Transient Cache Cleanup
328
  //Remove all duplicator entries and record this one since this is a new install.
329
  $dbdelete_count1 = 0;
422
 
423
  public function writeLog()
424
  {
425
+ $nManager = DUPX_NOTICE_MANAGER::getInstance();
426
+ $nManager->saveNotices();
427
+
428
  DUPX_Log::info("ERRORS FOUND:\t{$this->dbquery_errs}");
429
  DUPX_Log::info("DROPPED TABLES:\t{$this->drop_tbl_log}");
430
  DUPX_Log::info("RENAMED TABLES:\t{$this->rename_tbl_log}");
installer/dup-installer/ctrls/ctrl.s3.php CHANGED
@@ -39,6 +39,8 @@ if (isset($_POST['url_new'])) {
39
  $_POST['ssl_admin'] = isset($_POST['ssl_admin']) ? true : false;
40
  $_POST['exe_safe_mode'] = isset($_POST['exe_safe_mode']) ? $_POST['exe_safe_mode'] : 0;
41
  $_POST['config_mode'] = (isset($_POST['config_mode'])) ? $_POST['config_mode'] : 'NEW';
 
 
42
 
43
  //MYSQL CONNECTION
44
  $dbh = DUPX_DB::connect($_POST['dbhost'], $_POST['dbuser'], $_POST['dbpass'], $_POST['dbname']);
@@ -50,6 +52,8 @@ if (!$dbh) {
50
  DUPX_Log::error($msg);
51
  }
52
 
 
 
53
  $charset_server = @mysqli_character_set_name($dbh);
54
  @mysqli_query($dbh, "SET wait_timeout = ".mysqli_real_escape_string($dbh, $GLOBALS['DB_MAX_TIME']));
55
  DUPX_DB::setCharset($dbh, $_POST['dbcharset'], $_POST['dbcollate']);
@@ -131,16 +135,6 @@ if (isset($_POST['search'])) {
131
  }
132
  }
133
 
134
-
135
- // Replace email address (xyz@oldomain.com to xyz@newdomain.com).
136
- $post_url_new = DUPX_U::sanitize_text_field($_POST['url_new']);
137
- $post_url_old = DUPX_U::sanitize_text_field($_POST['url_old']);
138
- $at_new_domain = '@'.DUPX_U::getDomain($post_url_new);
139
- $at_old_domain = '@'.DUPX_U::getDomain($post_url_old);
140
- if ($at_new_domain !== $at_old_domain) {
141
- DUPX_U::queueReplacementWithEncodings($at_old_domain, $at_new_domain);
142
- }
143
-
144
  // DIRS PATHS
145
  DUPX_U::queueReplacementWithEncodings($_POST['path_old'] , $_POST['path_new'] );
146
  $path_old_unsetSafe = rtrim(DUPX_U::unsetSafePath($_POST['path_old']), '\\');
@@ -181,9 +175,19 @@ try {
181
  DUPX_Log::info($exceptionError->getTraceAsString());
182
  }
183
 
 
 
184
  $old_urls_list = array_unique ($old_urls_list);
185
  foreach ($old_urls_list as $old_url) {
186
  DUPX_U::replacmentUrlOldToNew($old_url, $_POST['url_new']);
 
 
 
 
 
 
 
 
187
  }
188
 
189
  /*=============================================================
@@ -286,11 +290,27 @@ if (strlen($_POST['wp_username']) >= 4 && strlen($_POST['wp_password']) >= 6) {
286
  } else {
287
  $newuser_warnmsg = "- Failed to create the user '{$post_wp_username}' \n ";
288
  $JSON['step3']['warnlist'][] = $newuser_warnmsg;
 
 
 
 
 
 
 
 
289
  DUPX_Log::info($newuser_warnmsg);
290
  }
291
  } else {
292
  $newuser_warnmsg = "\nNEW WP-ADMIN USER:\n - Username '{$post_wp_username}' already exists in the database. Unable to create new account.\n";
293
  $JSON['step3']['warnlist'][] = $newuser_warnmsg;
 
 
 
 
 
 
 
 
294
  DUPX_Log::info($newuser_warnmsg);
295
  }
296
  }
@@ -302,152 +322,192 @@ DUPX_Log::info("\n====================================");
302
  DUPX_Log::info('CONFIGURATION FILE UPDATES:');
303
  DUPX_Log::info("====================================\n");
304
 
305
- if (file_exists($wpconfig_ark_path)) {
 
306
 
307
- if (!is_writable($wpconfig_ark_path)) {
308
- $err_log = "\nWARNING: Unable to update file permissions and write to dup-wp-config-arc__[HASH].txt. ";
309
- $err_log .= "Check that the wp-config.php is in the archive.zip and check with your host or administrator to enable PHP to write to the wp-config.php file. ";
310
- $err_log .= "If performing a 'Manual Extraction' please be sure to select the 'Manual Archive Extraction' option on step 1 under options.";
311
- chmod($wpconfig_ark_path, 0644) ? DUPX_Log::info("File Permission Update: dup-wp-config-arc__[HASH].txt set to 0644") : DUPX_Log::error("{$err_log}");
312
- }
313
 
314
- $config_transformer->update('constant', 'WP_HOME', $_POST['url_new'], array('normalize' => true, 'add' => false));
315
- $config_transformer->update('constant', 'WP_SITEURL', $_POST['url_new'], array('normalize' => true, 'add' => false));
316
 
317
- //SSL CHECKS
318
- if (isset($_POST['ssl_admin']) && $_POST['ssl_admin']) {
319
- $config_transformer->update('constant', 'FORCE_SSL_ADMIN', 'true', array('raw' => true, 'normalize' => true));
320
- } else {
321
- $config_transformer->update('constant', 'FORCE_SSL_ADMIN', 'false', array('raw' => true, 'add' => false, 'normalize' => true));
322
- }
323
 
324
- if (isset($_POST['cache_wp']) && $_POST['cache_wp']) {
325
- $config_transformer->update('constant', 'WP_CACHE', 'true', array('raw' => true, 'normalize' => true));
326
- } else {
327
- $config_transformer->update('constant', 'WP_CACHE', 'false', array('raw' => true, 'add' => false, 'normalize' => true));
328
- }
329
 
330
- // Cache: [ ] Keep Home Path
331
- if (isset($_POST['cache_path']) && $_POST['cache_path']) {
332
- if ($config_transformer->exists('constant', 'WPCACHEHOME')) {
333
- $wpcachehome_const_val = $config_transformer->get_value('constant', 'WPCACHEHOME');
334
- $wpcachehome_const_val = DUPX_U::wp_normalize_path($wpcachehome_const_val);
335
- $wpcachehome_new_const_val = str_replace($_POST['path_old'], $_POST['path_new'], $wpcachehome_const_val, $count);
336
- if ($count > 0) {
337
- $config_transformer->update('constant', 'WPCACHEHOME', $wpcachehome_new_const_val, array('normalize' => true));
 
338
  }
 
 
339
  }
340
- } else {
341
- $config_transformer->remove('constant', 'WPCACHEHOME');
342
- }
343
 
344
- if ($GLOBALS['DUPX_AC']->is_outer_root_wp_content_dir) {
345
- $config_transformer->remove('constant', 'WP_CONTENT_DIR');
346
- } elseif ($config_transformer->exists('constant', 'WP_CONTENT_DIR')) {
347
- $wp_content_dir_const_val = $config_transformer->get_value('constant', 'WP_CONTENT_DIR');
348
- $wp_content_dir_const_val = DUPX_U::wp_normalize_path($wp_content_dir_const_val);
349
- $new_path = str_replace($_POST['path_old'], $_POST['path_new'], $wp_content_dir_const_val, $count);
350
- if ($count > 0) {
351
- $config_transformer->update('constant', 'WP_CONTENT_DIR', $new_path, array('normalize' => true));
 
352
  }
353
- }
354
 
355
- //WP_CONTENT_URL
356
- // '/' added to prevent word boundary with domains that have the same root path
357
- if ($GLOBALS['DUPX_AC']->is_outer_root_wp_content_dir) {
358
- $config_transformer->remove('constant', 'WP_CONTENT_URL');
359
- } elseif ($config_transformer->exists('constant', 'WP_CONTENT_URL')) {
360
- $wp_content_url_const_val = $config_transformer->get_value('constant', 'WP_CONTENT_URL');
361
- $new_path = str_replace($_POST['url_old'] . '/', $_POST['url_new'] . '/', $wp_content_url_const_val, $count);
362
- if ($count > 0) {
363
- $config_transformer->update('constant', 'WP_CONTENT_URL', $new_path, array('normalize' => true));
 
364
  }
365
- }
366
 
367
- //WP_TEMP_DIR
368
- if ($config_transformer->exists('constant', 'WP_TEMP_DIR')) {
369
- $wp_temp_dir_const_val = $config_transformer->get_value('constant', 'WP_TEMP_DIR');
370
- $wp_temp_dir_const_val = DUPX_U::wp_normalize_path($wp_temp_dir_const_val);
371
- $new_path = str_replace($_POST['path_old'], $_POST['path_new'], $wp_temp_dir_const_val, $count);
372
- if ($count > 0) {
373
- $config_transformer->update('constant', 'WP_TEMP_DIR', $new_path, array('normalize' => true));
 
374
  }
375
- }
376
 
377
- // WP_PLUGIN_DIR
378
- if ($config_transformer->exists('constant', 'WP_PLUGIN_DIR')) {
379
- $wp_plugin_dir_const_val = $config_transformer->get_value('constant', 'WP_PLUGIN_DIR');
380
- $wp_plugin_dir_const_val = DUPX_U::wp_normalize_path($wp_plugin_dir_const_val);
381
- $new_path = str_replace($_POST['path_old'], $_POST['path_new'], $wp_plugin_dir_const_val, $count);
382
- if ($count > 0) {
383
- $config_transformer->update('constant', 'WP_PLUGIN_DIR', $new_path, array('normalize' => true));
 
384
  }
385
- }
386
 
387
- // WP_PLUGIN_URL
388
- if ($config_transformer->exists('constant', 'WP_PLUGIN_URL')) {
389
- $wp_plugin_url_const_val = $config_transformer->get_value('constant', 'WP_PLUGIN_URL');
390
- $new_path = str_replace($_POST['url_old'] . '/', $_POST['url_new'] . '/', $wp_plugin_url_const_val, $count);
391
- if ($count > 0) {
392
- $config_transformer->update('constant', 'WP_PLUGIN_URL', $new_path, array('normalize' => true));
 
393
  }
394
- }
395
 
396
- // WPMU_PLUGIN_DIR
397
- if ($config_transformer->exists('constant', 'WPMU_PLUGIN_DIR')) {
398
- $wpmu_plugin_dir_const_val = $config_transformer->get_value('constant', 'WPMU_PLUGIN_DIR');
399
- $wpmu_plugin_dir_const_val = DUPX_U::wp_normalize_path($wpmu_plugin_dir_const_val);
400
- $new_path = str_replace($_POST['path_old'], $_POST['path_new'], $wpmu_plugin_dir_const_val, $count);
401
- if ($count > 0) {
402
- $config_transformer->update('constant', 'WPMU_PLUGIN_DIR', $new_path, array('normalize' => true));
 
403
  }
404
- }
405
 
406
- // WPMU_PLUGIN_URL
407
- if ($config_transformer->exists('constant', 'WPMU_PLUGIN_URL')) {
408
- $wpmu_plugin_url_const_val = $config_transformer->get_value('constant', 'WPMU_PLUGIN_URL');
409
- $new_path = str_replace($_POST['url_old'] . '/', $_POST['url_new'] . '/', $wpmu_plugin_url_const_val, $count);
410
- if ($count > 0) {
411
- $config_transformer->update('constant', 'WPMU_PLUGIN_URL', $new_path, array('normalize' => true));
 
412
  }
413
- }
414
 
415
- // COOKIE_DOMAIN
416
- if ($config_transformer->exists('constant', 'COOKIE_DOMAIN')) {
417
 
418
- $post_url_old = DUPX_U::sanitize_text_field($_POST['url_old']);
419
- $post_url_new = DUPX_U::sanitize_text_field($_POST['url_new']);
420
 
421
- $parsed_post_url_old = parse_url($post_url_old);
422
- $parsed_post_url_new = parse_url($post_url_new);
423
 
424
- $old_cookie_domain = $parsed_post_url_old['host'];
425
- $new_cookie_domain = $parsed_post_url_new['host'];
426
 
427
- $const_val = $config_transformer->get_value('constant', 'COOKIE_DOMAIN'); $old_cookie_domain = $parsed_post_url_old['host'];
428
- $const_new_val= str_replace($old_cookie_domain, $new_cookie_domain, $const_val, $count);
429
 
430
- if ($count > 0) {
431
- $config_transformer->update('constant', 'COOKIE_DOMAIN', $const_new_val, array('normalize' => true));
 
432
  }
433
- }
434
 
435
- $db_host = isset($_POST['dbhost']) ? DUPX_U::sanitize_text_field($_POST['dbhost']) : '';
436
- $db_name = isset($_POST['dbname']) ? DUPX_U::sanitize_text_field($_POST['dbname']) : '';
437
- $db_user = isset($_POST['dbuser']) ? DUPX_U::sanitize_text_field($_POST['dbuser']) : '';
438
- $db_pass = isset($_POST['dbpass']) ? trim($_POST['dbpass']) : '';
 
439
 
440
- $config_transformer->update('constant', 'DB_NAME', $db_name);
441
- $config_transformer->update('constant', 'DB_USER', $db_user);
442
- $config_transformer->update('constant', 'DB_PASSWORD', $db_pass);
443
- $config_transformer->update('constant', 'DB_HOST', $db_host);
444
 
445
- DUPX_Log::info("UPDATED WP-CONFIG ARK FILE:\n - '{$wpconfig_ark_path}'");
446
 
447
- } else {
448
- DUPX_Log::info("AKR FILE NOT FOUND");
449
- DUPX_Log::info("WP-CONFIG ARK FILE:\n - '{$wpconfig_ark_path}'");
450
- DUPX_Log::info("SKIP FILE UPDATES\n");
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
451
  }
452
 
453
  switch ($_POST['config_mode']) {
@@ -516,12 +576,28 @@ if (file_exists($wpconfig_ark_path)) {
516
  $msg .= "See the codex link for more details: https://codex.wordpress.org/Editing_wp-config.php";
517
  $JSON['step3']['warnlist'][] = $msg;
518
  DUPX_Log::info($msg);
 
 
 
 
 
 
 
519
  }
520
  } else {
521
  $msg = "WP-CONFIG NOTICE: <b>wp-config.php not found.</b><br><br>" ;
522
  $msg .= "No action on the wp-config was possible.<br>";
523
  $msg .= "Be sure to insert a properly modified wp-config for correct wordpress operation.";
524
  $JSON['step3']['warnlist'][] = $msg;
 
 
 
 
 
 
 
 
 
525
  DUPX_Log::info($msg);
526
  }
527
 
@@ -534,6 +610,14 @@ if ($result) {
534
  $msg .= "set please validate settings. These settings can be changed in the wp-admin by going to /wp-admin/options.php'";
535
  $JSON['step3']['warnlist'][] = $msg;
536
  DUPX_Log::info($msg);
 
 
 
 
 
 
 
 
537
  break;
538
  }
539
  }
@@ -574,6 +658,8 @@ foreach ($wpconfig_safe_check as $file) {
574
  }
575
  }
576
 
 
 
577
  $ajax3_sum = DUPX_U::elapsedTime(DUPX_U::getMicrotime(), $ajax3_start);
578
  DUPX_Log::info("\nSTEP-3 COMPLETE @ ".@date('h:i:s')." - RUNTIME: {$ajax3_sum} \n\n");
579
 
39
  $_POST['ssl_admin'] = isset($_POST['ssl_admin']) ? true : false;
40
  $_POST['exe_safe_mode'] = isset($_POST['exe_safe_mode']) ? $_POST['exe_safe_mode'] : 0;
41
  $_POST['config_mode'] = (isset($_POST['config_mode'])) ? $_POST['config_mode'] : 'NEW';
42
+ $replace_mail = filter_input(INPUT_POST, 'search_replace_email_domain', FILTER_VALIDATE_BOOLEAN);
43
+
44
 
45
  //MYSQL CONNECTION
46
  $dbh = DUPX_DB::connect($_POST['dbhost'], $_POST['dbuser'], $_POST['dbpass'], $_POST['dbname']);
52
  DUPX_Log::error($msg);
53
  }
54
 
55
+ $nManager = DUPX_NOTICE_MANAGER::getInstance();
56
+
57
  $charset_server = @mysqli_character_set_name($dbh);
58
  @mysqli_query($dbh, "SET wait_timeout = ".mysqli_real_escape_string($dbh, $GLOBALS['DB_MAX_TIME']));
59
  DUPX_DB::setCharset($dbh, $_POST['dbcharset'], $_POST['dbcollate']);
135
  }
136
  }
137
 
 
 
 
 
 
 
 
 
 
 
138
  // DIRS PATHS
139
  DUPX_U::queueReplacementWithEncodings($_POST['path_old'] , $_POST['path_new'] );
140
  $path_old_unsetSafe = rtrim(DUPX_U::unsetSafePath($_POST['path_old']), '\\');
175
  DUPX_Log::info($exceptionError->getTraceAsString());
176
  }
177
 
178
+ $at_new_domain = '@'.DUPX_U::getDomain($_POST['url_new']);
179
+
180
  $old_urls_list = array_unique ($old_urls_list);
181
  foreach ($old_urls_list as $old_url) {
182
  DUPX_U::replacmentUrlOldToNew($old_url, $_POST['url_new']);
183
+
184
+ if ($replace_mail) {
185
+ $at_old_domain = '@'.DUPX_U::getDomain($old_url);
186
+
187
+ if ($at_new_domain !== $at_old_domain) {
188
+ DUPX_U::queueReplacementWithEncodings($at_old_domain, $at_new_domain);
189
+ }
190
+ }
191
  }
192
 
193
  /*=============================================================
290
  } else {
291
  $newuser_warnmsg = "- Failed to create the user '{$post_wp_username}' \n ";
292
  $JSON['step3']['warnlist'][] = $newuser_warnmsg;
293
+
294
+ $nManager->addFinalReportNotice(array(
295
+ 'shortMsg' => 'New admin user create error',
296
+ 'level' => DUPX_NOTICE_ITEM::HARD_WARNING,
297
+ 'longMsg' => $newuser_warnmsg,
298
+ 'sections' => 'general'
299
+ ), DUPX_NOTICE_MANAGER::ADD_UNIQUE_UPDATE , 'new-user-create-error');
300
+
301
  DUPX_Log::info($newuser_warnmsg);
302
  }
303
  } else {
304
  $newuser_warnmsg = "\nNEW WP-ADMIN USER:\n - Username '{$post_wp_username}' already exists in the database. Unable to create new account.\n";
305
  $JSON['step3']['warnlist'][] = $newuser_warnmsg;
306
+
307
+ $nManager->addFinalReportNotice(array(
308
+ 'shortMsg' => 'New admin user create error',
309
+ 'level' => DUPX_NOTICE_ITEM::SOFT_WARNING,
310
+ 'longMsg' => $newuser_warnmsg,
311
+ 'sections' => 'general'
312
+ ), DUPX_NOTICE_MANAGER::ADD_UNIQUE_UPDATE , 'new-user-create-error');
313
+
314
  DUPX_Log::info($newuser_warnmsg);
315
  }
316
  }
322
  DUPX_Log::info('CONFIGURATION FILE UPDATES:');
323
  DUPX_Log::info("====================================\n");
324
 
325
+ try {
326
+ if (file_exists($wpconfig_ark_path)) {
327
 
328
+ if (!is_writable($wpconfig_ark_path)) {
329
+ $err_log = "\nWARNING: Unable to update file permissions and write to dup-wp-config-arc__[HASH].txt. ";
330
+ $err_log .= "Check that the wp-config.php is in the archive.zip and check with your host or administrator to enable PHP to write to the wp-config.php file. ";
331
+ $err_log .= "If performing a 'Manual Extraction' please be sure to select the 'Manual Archive Extraction' option on step 1 under options.";
332
+ chmod($wpconfig_ark_path, 0644) ? DUPX_Log::info("File Permission Update: dup-wp-config-arc__[HASH].txt set to 0644") : DUPX_Log::error("{$err_log}");
333
+ }
334
 
335
+ $config_transformer->update('constant', 'WP_HOME', $_POST['url_new'], array('normalize' => true, 'add' => false));
336
+ $config_transformer->update('constant', 'WP_SITEURL', $_POST['url_new'], array('normalize' => true, 'add' => false));
337
 
338
+ //SSL CHECKS
339
+ if (isset($_POST['ssl_admin']) && $_POST['ssl_admin']) {
340
+ $config_transformer->update('constant', 'FORCE_SSL_ADMIN', 'true', array('raw' => true, 'normalize' => true));
341
+ } else {
342
+ $config_transformer->update('constant', 'FORCE_SSL_ADMIN', 'false', array('raw' => true, 'add' => false, 'normalize' => true));
343
+ }
344
 
345
+ if (isset($_POST['cache_wp']) && $_POST['cache_wp']) {
346
+ $config_transformer->update('constant', 'WP_CACHE', 'true', array('raw' => true, 'normalize' => true));
347
+ } else {
348
+ $config_transformer->update('constant', 'WP_CACHE', 'false', array('raw' => true, 'add' => false, 'normalize' => true));
349
+ }
350
 
351
+ // Cache: [ ] Keep Home Path
352
+ if (isset($_POST['cache_path']) && $_POST['cache_path']) {
353
+ if ($config_transformer->exists('constant', 'WPCACHEHOME')) {
354
+ $wpcachehome_const_val = $config_transformer->get_value('constant', 'WPCACHEHOME');
355
+ $wpcachehome_const_val = DUPX_U::wp_normalize_path($wpcachehome_const_val);
356
+ $wpcachehome_new_const_val = str_replace($_POST['path_old'], $_POST['path_new'], $wpcachehome_const_val, $count);
357
+ if ($count > 0) {
358
+ $config_transformer->update('constant', 'WPCACHEHOME', $wpcachehome_new_const_val, array('normalize' => true));
359
+ }
360
  }
361
+ } else {
362
+ $config_transformer->remove('constant', 'WPCACHEHOME');
363
  }
 
 
 
364
 
365
+ if ($GLOBALS['DUPX_AC']->is_outer_root_wp_content_dir) {
366
+ $config_transformer->remove('constant', 'WP_CONTENT_DIR');
367
+ } elseif ($config_transformer->exists('constant', 'WP_CONTENT_DIR')) {
368
+ $wp_content_dir_const_val = $config_transformer->get_value('constant', 'WP_CONTENT_DIR');
369
+ $wp_content_dir_const_val = DUPX_U::wp_normalize_path($wp_content_dir_const_val);
370
+ $new_path = str_replace($_POST['path_old'], $_POST['path_new'], $wp_content_dir_const_val, $count);
371
+ if ($count > 0) {
372
+ $config_transformer->update('constant', 'WP_CONTENT_DIR', $new_path, array('normalize' => true));
373
+ }
374
  }
 
375
 
376
+ //WP_CONTENT_URL
377
+ // '/' added to prevent word boundary with domains that have the same root path
378
+ if ($GLOBALS['DUPX_AC']->is_outer_root_wp_content_dir) {
379
+ $config_transformer->remove('constant', 'WP_CONTENT_URL');
380
+ } elseif ($config_transformer->exists('constant', 'WP_CONTENT_URL')) {
381
+ $wp_content_url_const_val = $config_transformer->get_value('constant', 'WP_CONTENT_URL');
382
+ $new_path = str_replace($_POST['url_old'] . '/', $_POST['url_new'] . '/', $wp_content_url_const_val, $count);
383
+ if ($count > 0) {
384
+ $config_transformer->update('constant', 'WP_CONTENT_URL', $new_path, array('normalize' => true));
385
+ }
386
  }
 
387
 
388
+ //WP_TEMP_DIR
389
+ if ($config_transformer->exists('constant', 'WP_TEMP_DIR')) {
390
+ $wp_temp_dir_const_val = $config_transformer->get_value('constant', 'WP_TEMP_DIR');
391
+ $wp_temp_dir_const_val = DUPX_U::wp_normalize_path($wp_temp_dir_const_val);
392
+ $new_path = str_replace($_POST['path_old'], $_POST['path_new'], $wp_temp_dir_const_val, $count);
393
+ if ($count > 0) {
394
+ $config_transformer->update('constant', 'WP_TEMP_DIR', $new_path, array('normalize' => true));
395
+ }
396
  }
 
397
 
398
+ // WP_PLUGIN_DIR
399
+ if ($config_transformer->exists('constant', 'WP_PLUGIN_DIR')) {
400
+ $wp_plugin_dir_const_val = $config_transformer->get_value('constant', 'WP_PLUGIN_DIR');
401
+ $wp_plugin_dir_const_val = DUPX_U::wp_normalize_path($wp_plugin_dir_const_val);
402
+ $new_path = str_replace($_POST['path_old'], $_POST['path_new'], $wp_plugin_dir_const_val, $count);
403
+ if ($count > 0) {
404
+ $config_transformer->update('constant', 'WP_PLUGIN_DIR', $new_path, array('normalize' => true));
405
+ }
406
  }
 
407
 
408
+ // WP_PLUGIN_URL
409
+ if ($config_transformer->exists('constant', 'WP_PLUGIN_URL')) {
410
+ $wp_plugin_url_const_val = $config_transformer->get_value('constant', 'WP_PLUGIN_URL');
411
+ $new_path = str_replace($_POST['url_old'] . '/', $_POST['url_new'] . '/', $wp_plugin_url_const_val, $count);
412
+ if ($count > 0) {
413
+ $config_transformer->update('constant', 'WP_PLUGIN_URL', $new_path, array('normalize' => true));
414
+ }
415
  }
 
416
 
417
+ // WPMU_PLUGIN_DIR
418
+ if ($config_transformer->exists('constant', 'WPMU_PLUGIN_DIR')) {
419
+ $wpmu_plugin_dir_const_val = $config_transformer->get_value('constant', 'WPMU_PLUGIN_DIR');
420
+ $wpmu_plugin_dir_const_val = DUPX_U::wp_normalize_path($wpmu_plugin_dir_const_val);
421
+ $new_path = str_replace($_POST['path_old'], $_POST['path_new'], $wpmu_plugin_dir_const_val, $count);
422
+ if ($count > 0) {
423
+ $config_transformer->update('constant', 'WPMU_PLUGIN_DIR', $new_path, array('normalize' => true));
424
+ }
425
  }
 
426
 
427
+ // WPMU_PLUGIN_URL
428
+ if ($config_transformer->exists('constant', 'WPMU_PLUGIN_URL')) {
429
+ $wpmu_plugin_url_const_val = $config_transformer->get_value('constant', 'WPMU_PLUGIN_URL');
430
+ $new_path = str_replace($_POST['url_old'] . '/', $_POST['url_new'] . '/', $wpmu_plugin_url_const_val, $count);
431
+ if ($count > 0) {
432
+ $config_transformer->update('constant', 'WPMU_PLUGIN_URL', $new_path, array('normalize' => true));
433
+ }
434
  }
 
435
 
436
+ // COOKIE_DOMAIN
437
+ if ($config_transformer->exists('constant', 'COOKIE_DOMAIN')) {
438
 
439
+ $post_url_old = DUPX_U::sanitize_text_field($_POST['url_old']);
440
+ $post_url_new = DUPX_U::sanitize_text_field($_POST['url_new']);
441
 
442
+ $parsed_post_url_old = parse_url($post_url_old);
443
+ $parsed_post_url_new = parse_url($post_url_new);
444
 
445
+ $old_cookie_domain = $parsed_post_url_old['host'];
446
+ $new_cookie_domain = $parsed_post_url_new['host'];
447
 
448
+ $const_val = $config_transformer->get_value('constant', 'COOKIE_DOMAIN'); $old_cookie_domain = $parsed_post_url_old['host'];
449
+ $const_new_val= str_replace($old_cookie_domain, $new_cookie_domain, $const_val, $count);
450
 
451
+ if ($count > 0) {
452
+ $config_transformer->update('constant', 'COOKIE_DOMAIN', $const_new_val, array('normalize' => true));
453
+ }
454
  }
 
455
 
456
+ $db_host = isset($_POST['dbhost']) ? DUPX_U::sanitize_text_field($_POST['dbhost']) : '';
457
+ $db_name = isset($_POST['dbname']) ? DUPX_U::sanitize_text_field($_POST['dbname']) : '';
458
+ $db_user = isset($_POST['dbuser']) ? DUPX_U::sanitize_text_field($_POST['dbuser']) : '';
459
+ $db_pass = isset($_POST['dbpass']) ? SnapLibUtil::wp_json_encode(trim($_POST['dbpass'])) : "''";
460
+ $db_pass = str_replace(array('\x00','\/'), array('','/'), $db_pass);
461
 
462
+ $config_transformer->update('constant', 'DB_NAME', $db_name);
463
+ $config_transformer->update('constant', 'DB_USER', $db_user);
464
+ $config_transformer->update('constant', 'DB_PASSWORD', $db_pass, array('raw' => true));
465
+ $config_transformer->update('constant', 'DB_HOST', $db_host);
466
 
467
+ DUPX_Log::info("UPDATED WP-CONFIG ARK FILE:\n - '{$wpconfig_ark_path}'");
468
 
469
+ } else {
470
+ DUPX_Log::info("AKR FILE NOT FOUND");
471
+ DUPX_Log::info("WP-CONFIG ARK FILE:\n - '{$wpconfig_ark_path}'");
472
+ DUPX_Log::info("SKIP FILE UPDATES\n");
473
+
474
+ $shortMsg = 'wp-config.php not found';
475
+ $longMsg = <<<LONGMSG
476
+ Error updating wp-config file.<br>
477
+ The installation is finished but check the wp-config.php file and manually update the incorrect values.
478
+ LONGMSG;
479
+ /* $nManager->addNextStepNotice(array(
480
+ 'shortMsg' => $shortMsg,
481
+ 'level' => DUPX_NOTICE_ITEM::CRITICAL,
482
+
483
+ ), DUPX_NOTICE_MANAGER::ADD_UNIQUE , 'wp-config-transformer-exception');*/
484
+ $nManager->addFinalReportNotice(array(
485
+ 'shortMsg' => $shortMsg,
486
+ 'level' => DUPX_NOTICE_ITEM::HARD_WARNING,
487
+ 'longMsg' => $longMsg,
488
+ 'longMsgHtml' => true,
489
+ 'sections' => 'general'
490
+ ), DUPX_NOTICE_MANAGER::ADD_UNIQUE , 'wp-config-transformer-exception');
491
+
492
+ }
493
+ } catch (Exception $e) {
494
+ $shortMsg = 'wp-config.php transformer:'.$e->getMessage();
495
+ $longMsg = <<<LONGMSG
496
+ Error updating wp-config file.<br>
497
+ The installation is finished but check the wp-config.php file and manually update the incorrect values.
498
+ LONGMSG;
499
+ /* $nManager->addNextStepNotice(array(
500
+ 'shortMsg' => $shortMsg,
501
+ 'level' => DUPX_NOTICE_ITEM::CRITICAL,
502
+
503
+ ), DUPX_NOTICE_MANAGER::ADD_UNIQUE , 'wp-config-transformer-exception');*/
504
+ $nManager->addFinalReportNotice(array(
505
+ 'shortMsg' => $shortMsg,
506
+ 'level' => DUPX_NOTICE_ITEM::CRITICAL,
507
+ 'longMsg' => $longMsg,
508
+ 'longMsgHtml' => true,
509
+ 'sections' => 'general'
510
+ ), DUPX_NOTICE_MANAGER::ADD_UNIQUE , 'wp-config-transformer-exception');
511
  }
512
 
513
  switch ($_POST['config_mode']) {
576
  $msg .= "See the codex link for more details: https://codex.wordpress.org/Editing_wp-config.php";
577
  $JSON['step3']['warnlist'][] = $msg;
578
  DUPX_Log::info($msg);
579
+
580
+ $nManager->addFinalReportNotice(array(
581
+ 'shortMsg' => 'wp-config notice',
582
+ 'level' => DUPX_NOTICE_ITEM::NOTICE,
583
+ 'longMsg' => $msg,
584
+ 'sections' => 'general'
585
+ ));
586
  }
587
  } else {
588
  $msg = "WP-CONFIG NOTICE: <b>wp-config.php not found.</b><br><br>" ;
589
  $msg .= "No action on the wp-config was possible.<br>";
590
  $msg .= "Be sure to insert a properly modified wp-config for correct wordpress operation.";
591
  $JSON['step3']['warnlist'][] = $msg;
592
+
593
+ $nManager->addFinalReportNotice(array(
594
+ 'shortMsg' => 'wp-config not found',
595
+ 'level' => DUPX_NOTICE_ITEM::HARD_WARNING,
596
+ 'longMsg' => $msg,
597
+ 'longMsgHtml' => true,
598
+ 'sections' => 'general'
599
+ ), DUPX_NOTICE_MANAGER::ADD_UNIQUE_UPDATE , 'wp-config-not-found');
600
+
601
  DUPX_Log::info($msg);
602
  }
603
 
610
  $msg .= "set please validate settings. These settings can be changed in the wp-admin by going to /wp-admin/options.php'";
611
  $JSON['step3']['warnlist'][] = $msg;
612
  DUPX_Log::info($msg);
613
+
614
+ $nManager->addFinalReportNotice(array(
615
+ 'shortMsg' => 'Media settings notice',
616
+ 'level' => DUPX_NOTICE_ITEM::SOFT_WARNING,
617
+ 'longMsg' => $msg,
618
+ 'sections' => 'general'
619
+ ), DUPX_NOTICE_MANAGER::ADD_UNIQUE_UPDATE , 'media-settings-notice');
620
+
621
  break;
622
  }
623
  }
658
  }
659
  }
660
 
661
+ $nManager->saveNotices();
662
+
663
  $ajax3_sum = DUPX_U::elapsedTime(DUPX_U::getMicrotime(), $ajax3_start);
664
  DUPX_Log::info("\nSTEP-3 COMPLETE @ ".@date('h:i:s')." - RUNTIME: {$ajax3_sum} \n\n");
665
 
installer/dup-installer/main.installer.php CHANGED
@@ -40,6 +40,7 @@ date_default_timezone_set('UTC'); // Some machines don’t have this set so just
40
  @ini_set('pcre.backtrack_limit', PHP_INT_MAX);
41
  @ini_set('default_socket_timeout', 3600);
42
 
 
43
  ob_start();
44
  try {
45
  $exceptionError = false;
@@ -48,6 +49,18 @@ try {
48
  $GLOBALS['DUPX_ROOT'] = str_replace("\\", '/', (realpath(dirname(__FILE__) . '/..')));
49
  $GLOBALS['DUPX_INIT'] = "{$GLOBALS['DUPX_ROOT']}/dup-installer";
50
  $GLOBALS['DUPX_ENFORCE_PHP_INI'] = false;
 
 
 
 
 
 
 
 
 
 
 
 
51
  require_once($GLOBALS['DUPX_INIT'].'/classes/class.csrf.php');
52
 
53
  // ?view=help
@@ -61,9 +74,39 @@ try {
61
  die("Bootloader parameter not specified");
62
  }
63
  } else if (isset($_GET['is_daws']) && 1 == $_GET['is_daws']) { // For daws action
64
- $post_ctrl_csrf_token = isset($_GET['daws_csrf_token']) ? $_GET['daws_csrf_token'] : '';
 
65
  if (DUPX_CSRF::check($post_ctrl_csrf_token, 'daws')) {
66
- require_once($GLOBALS['DUPX_INIT'].'/lib/dup_archive/daws/daws.php');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
67
  die();
68
  } else {
69
  die("An invalid request was made to 'daws'. In order to protect this request from unauthorized access please "
@@ -94,7 +137,6 @@ try {
94
  require_once($GLOBALS['DUPX_INIT'].'/classes/class.installer.state.php');
95
  require_once($GLOBALS['DUPX_INIT'].'/classes/class.password.php');
96
 
97
- $GLOBALS['DUPX_AC'] = DUPX_ArchiveConfig::getInstance();
98
  if ($GLOBALS['DUPX_AC'] == null) {
99
  die("Can't initialize config globals! Please try to re-run installer.php");
100
  }
@@ -124,8 +166,6 @@ try {
124
  die("Can't initialize installer state! Please try to re-run installer.php");
125
  }
126
 
127
- require_once($GLOBALS['DUPX_INIT'] . '/classes/utilities/class.u.php');
128
-
129
  if (!empty($GLOBALS['view'])) {
130
  $post_view = $GLOBALS['view'];
131
  } elseif (!empty($_POST['view'])) {
@@ -222,6 +262,27 @@ try {
222
  die("");
223
  }
224
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
225
  } catch (Exception $e) {
226
  $exceptionError = $e;
227
  }
@@ -229,7 +290,11 @@ try {
229
  /**
230
  * clean output
231
  */
 
232
  ob_clean();
 
 
 
233
  ?><!DOCTYPE html>
234
  <html>
235
  <head>
@@ -257,8 +322,12 @@ ob_clean();
257
  <td class="wiz-dupx-version">
258
  <a href="javascript:void(0)" onclick="DUPX.openServerDetails()">version:<?php echo DUPX_U::esc_html($GLOBALS['DUPX_AC']->version_dup); ?></a>&nbsp;
259
  <?php
260
- $help_url = "?view=help&archive={$GLOBALS['FW_ENCODED_PACKAGE_PATH']}&bootloader={$GLOBALS['BOOTLOADER_NAME']}&basic";
261
- echo ($GLOBALS['DUPX_AC']->secure_on)
 
 
 
 
262
  ? "<a href='{$help_url}#secure' target='_blank'><i class='fa fa-lock'></i></a>"
263
  : "<a href='{$help_url}#secure' target='_blank'><i class='fa fa-unlock-alt'></i></a>" ;
264
  ?>
@@ -286,6 +355,19 @@ ob_clean();
286
  ?>
287
  </div>
288
 
 
 
 
 
 
 
 
 
 
 
 
 
 
289
  <!-- =========================================
290
  FORM DATA: User-Interface views -->
291
  <div id="content-inner">
40
  @ini_set('pcre.backtrack_limit', PHP_INT_MAX);
41
  @ini_set('default_socket_timeout', 3600);
42
 
43
+ define('ERR_CONFIG_FOUND', 'A wp-config.php already exists in this location. This error prevents users from accidentally overwriting a WordPress site or trying to install on top of an existing one. Extracting an archive on an existing site will overwrite existing files and intermix files causing site incompatibility issues.<br/><br/> It is highly recommended to place the installer and archive in an empty directory. If you have already manually extracted the archive file that is associated with this installer then choose option #1 below; other-wise consider the other options: <ol><li>Click &gt; Try Again &gt; Options &gt; choose "Manual Archive Extraction".</li><li>Empty the directory except for the archive.zip/daf and installer.php and try again.</li><li>Advanced users only can remove the existing wp-config.php file and try again.</li></ol>');
44
  ob_start();
45
  try {
46
  $exceptionError = false;
49
  $GLOBALS['DUPX_ROOT'] = str_replace("\\", '/', (realpath(dirname(__FILE__) . '/..')));
50
  $GLOBALS['DUPX_INIT'] = "{$GLOBALS['DUPX_ROOT']}/dup-installer";
51
  $GLOBALS['DUPX_ENFORCE_PHP_INI'] = false;
52
+
53
+ require_once($GLOBALS['DUPX_INIT'].'/classes/utilities/class.u.exceptions.php');
54
+ require_once($GLOBALS['DUPX_INIT'].'/classes/utilities/class.u.php');
55
+ require_once($GLOBALS['DUPX_INIT'].'/classes/utilities/class.u.notices.manager.php');
56
+ require_once($GLOBALS['DUPX_INIT'].'/classes/config/class.constants.php');
57
+ require_once($GLOBALS['DUPX_INIT'] . '/classes/config/class.archive.config.php');
58
+ $GLOBALS['DUPX_AC'] = DUPX_ArchiveConfig::getInstance();
59
+
60
+ if ($GLOBALS['DUPX_AC']->csrf_crypt) {
61
+ require_once($GLOBALS['DUPX_INIT'].'/classes/Crypt/Rijndael.php');
62
+ require_once($GLOBALS['DUPX_INIT'].'/classes/Crypt/Random.php');
63
+ }
64
  require_once($GLOBALS['DUPX_INIT'].'/classes/class.csrf.php');
65
 
66
  // ?view=help
74
  die("Bootloader parameter not specified");
75
  }
76
  } else if (isset($_GET['is_daws']) && 1 == $_GET['is_daws']) { // For daws action
77
+ require_once($GLOBALS['DUPX_INIT'].'/classes/utilities/class.u.php');
78
+ $post_ctrl_csrf_token = isset($_GET['daws_csrf_token']) ? DUPX_U::sanitize_text_field($_GET['daws_csrf_token']) : '';
79
  if (DUPX_CSRF::check($post_ctrl_csrf_token, 'daws')) {
80
+ $outer_root_path = dirname($GLOBALS['DUPX_ROOT']);
81
+ if (
82
+ (isset($_GET['daws_action']) && 'start_expand' == $_GET['daws_action'])
83
+ &&
84
+ (
85
+ !$GLOBALS['DUPX_AC']->installSiteOverwriteOn
86
+ && (
87
+ file_exists($GLOBALS['DUPX_ROOT'].'/wp-config.php')
88
+ ||
89
+ (
90
+ @file_exists($outer_root_path.'/wp-config.php')
91
+ &&
92
+ !@file_exists($GLOBALS['DUPX_ROOT'].'/wp-settings.php')
93
+ &&
94
+ @file_exists($GLOBALS['DUPX_ROOT'].'/wp-admin')
95
+ &&
96
+ @file_exists($GLOBALS['DUPX_ROOT'].'/wp-includes')
97
+ )
98
+ )
99
+ )
100
+ ) {
101
+ $resp = array(
102
+ 'pass' => 0,
103
+ 'isWPAlreadyExistsError' => 1,
104
+ 'error' => "<b style='color:#B80000;'>INSTALL ERROR!</b><br/>". ERR_CONFIG_FOUND,
105
+ );
106
+ echo json_encode($resp);
107
+ } else {
108
+ require_once($GLOBALS['DUPX_INIT'].'/lib/dup_archive/daws/daws.php');
109
+ }
110
  die();
111
  } else {
112
  die("An invalid request was made to 'daws'. In order to protect this request from unauthorized access please "
137
  require_once($GLOBALS['DUPX_INIT'].'/classes/class.installer.state.php');
138
  require_once($GLOBALS['DUPX_INIT'].'/classes/class.password.php');
139
 
 
140
  if ($GLOBALS['DUPX_AC'] == null) {
141
  die("Can't initialize config globals! Please try to re-run installer.php");
142
  }
166
  die("Can't initialize installer state! Please try to re-run installer.php");
167
  }
168
 
 
 
169
  if (!empty($GLOBALS['view'])) {
170
  $post_view = $GLOBALS['view'];
171
  } elseif (!empty($_POST['view'])) {
262
  die("");
263
  }
264
 
265
+ $helpOpenSection = '';
266
+ switch ($GLOBALS["VIEW"]) {
267
+ case "secure" :
268
+ $helpOpenSection = 'section-security';
269
+ break;
270
+ case "step1" :
271
+ $helpOpenSection = 'section-step-1';
272
+ break;
273
+ case "step2" :
274
+ $helpOpenSection = 'section-step-2';
275
+ break;
276
+ case "step3" :
277
+ $helpOpenSection = 'section-step-3';
278
+ break;
279
+ case "step4" :
280
+ $helpOpenSection = 'section-step-4';
281
+ break;
282
+ case "help" :
283
+ default :
284
+ }
285
+
286
  } catch (Exception $e) {
287
  $exceptionError = $e;
288
  }
290
  /**
291
  * clean output
292
  */
293
+ $unespectOutput = ob_get_contents();
294
  ob_clean();
295
+ if (!empty($unespectOutput)) {
296
+ // @todo something for report unespected output
297
+ }
298
  ?><!DOCTYPE html>
299
  <html>
300
  <head>
322
  <td class="wiz-dupx-version">
323
  <a href="javascript:void(0)" onclick="DUPX.openServerDetails()">version:<?php echo DUPX_U::esc_html($GLOBALS['DUPX_AC']->version_dup); ?></a>&nbsp;
324
  <?php
325
+ $help_url = "?view=help".
326
+ "&archive={$GLOBALS['FW_ENCODED_PACKAGE_PATH']}".
327
+ "&bootloader={$GLOBALS['BOOTLOADER_NAME']}&".
328
+ "basic".
329
+ '&open_section='.$helpOpenSection;
330
+ echo ($GLOBALS['DUPX_AC']->secure_on)
331
  ? "<a href='{$help_url}#secure' target='_blank'><i class='fa fa-lock'></i></a>"
332
  : "<a href='{$help_url}#secure' target='_blank'><i class='fa fa-unlock-alt'></i></a>" ;
333
  ?>
355
  ?>
356
  </div>
357
 
358
+ <?php
359
+
360
+ /****************************/
361
+ /*** NOTICE MANAGER TESTS ***/
362
+ //DUPX_NOTICE_MANAGER::testNextStepFullMessageData();
363
+ //DUPX_NOTICE_MANAGER::testNextStepMessaesLevels();
364
+ //DUPX_NOTICE_MANAGER::testFinalReporMessaesLevels();
365
+ //DUPX_NOTICE_MANAGER::testFinalReportFullMessages();
366
+ /****************************/
367
+
368
+ DUPX_NOTICE_MANAGER::getInstance()->displayStepMessages();
369
+ ?>
370
+
371
  <!-- =========================================
372
  FORM DATA: User-Interface views -->
373
  <div id="content-inner">
installer/dup-installer/views/duplicator.php ADDED
@@ -0,0 +1,1392 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ defined("ABSPATH") or die("");
3
+ /** IDE HELPERS */
4
+ /* @var $GLOBALS['DUPX_AC'] DUPX_ArchiveConfig */
5
+ /* @var $archive_config DUPX_ArchiveConfig */
6
+ /* @var $installer_state DUPX_InstallerState */
7
+
8
+ require_once($GLOBALS['DUPX_INIT'] . '/classes/config/class.archive.config.php');
9
+
10
+ //ARCHIVE FILE
11
+ $arcCheck = (file_exists($GLOBALS['FW_PACKAGE_PATH'])) ? 'Pass' : 'Fail';
12
+ $arcSize = @filesize($GLOBALS['FW_PACKAGE_PATH']);
13
+ $arcSize = is_numeric($arcSize) ? $arcSize : 0;
14
+
15
+ $root_path = $GLOBALS['DUPX_ROOT'];
16
+ $installer_state = DUPX_InstallerState::getInstance();
17
+
18
+ if ($GLOBALS['DUPX_AC']->installSiteOverwriteOn) {
19
+ $is_wpconfarc_present = file_exists("{$root_path}/dup-wp-config-arc__{$GLOBALS['DUPX_AC']->package_hash}.txt");
20
+ } else {
21
+ $outer_root_path = dirname($root_path);
22
+ $is_wpconfarc_present = file_exists("{$root_path}/wp-config.php") || (@file_exists("{$outer_root_path}/wp-config.php") && !@file_exists("{$outer_root_path}/wp-settings.php"));
23
+ }
24
+
25
+ $is_overwrite_mode = ($installer_state->mode === DUPX_InstallerMode::OverwriteInstall);
26
+ $is_wordpress = DUPX_Server::isWordPress();
27
+ $is_dbonly = $GLOBALS['DUPX_AC']->exportOnlyDB;
28
+
29
+ //REQUIRMENTS
30
+ $req = array();
31
+ $req['10'] = DUPX_Server::is_dir_writable($GLOBALS['DUPX_ROOT']) ? 'Pass' : 'Fail';
32
+ $req['20'] = function_exists('mysqli_connect') ? 'Pass' : 'Fail';
33
+ $req['30'] = DUPX_Server::$php_version_safe ? 'Pass' : 'Fail';
34
+ $all_req = in_array('Fail', $req) ? 'Fail' : 'Pass';
35
+
36
+ //NOTICES
37
+ $openbase = ini_get("open_basedir");
38
+ $datetime1 = $GLOBALS['DUPX_AC']->created;
39
+ $datetime2 = date("Y-m-d H:i:s");
40
+ $fulldays = round(abs(strtotime($datetime1) - strtotime($datetime2))/86400);
41
+ $root_path = SnapLibIOU::safePath($GLOBALS['DUPX_ROOT'], true);
42
+ $archive_path = SnapLibIOU::safePath($GLOBALS['FW_PACKAGE_PATH'], true);
43
+ $wpconf_path = "{$root_path}/wp-config.php";
44
+ $max_time_zero = ($GLOBALS['DUPX_ENFORCE_PHP_INI']) ? false : @set_time_limit(0);
45
+ $max_time_size = 314572800; //300MB
46
+ $max_time_ini = ini_get('max_execution_time');
47
+ $max_time_warn = (is_numeric($max_time_ini) && $max_time_ini < 31 && $max_time_ini > 0) && $arcSize > $max_time_size;
48
+
49
+
50
+ $notice = array();
51
+ $notice['10'] = ! $is_overwrite_mode ? 'Good' : 'Warn';
52
+ $notice['20'] = ! $is_wpconfarc_present ? 'Good' : 'Warn';
53
+ if ($is_dbonly) {
54
+ $notice['25'] = $is_wordpress ? 'Good' : 'Warn';
55
+ }
56
+ $notice['30'] = $fulldays <= 180 ? 'Good' : 'Warn';
57
+ $notice['40'] = DUPX_Server::$php_version_53_plus ? 'Good' : 'Warn';
58
+
59
+ $packagePHP = $GLOBALS['DUPX_AC']->version_php;
60
+ $currentPHP = DUPX_Server::$php_version;
61
+ $packagePHPMajor = intval($packagePHP);
62
+ $currentPHPMajor = intval($currentPHP);
63
+ $notice['45'] = ($packagePHPMajor === $currentPHPMajor || $GLOBALS['DUPX_AC']->exportOnlyDB) ? 'Good' : 'Warn';
64
+
65
+ $notice['50'] = empty($openbase) ? 'Good' : 'Warn';
66
+ $notice['60'] = !$max_time_warn ? 'Good' : 'Warn';
67
+ $notice['70'] = $GLOBALS['DUPX_AC']->mu_mode == 0 ? 'Good' : 'Warn';
68
+ $notice['80'] = !$GLOBALS['DUPX_AC']->is_outer_root_wp_config_file ? 'Good' : 'Warn';
69
+ if ($GLOBALS['DUPX_AC']->exportOnlyDB) {
70
+ $notice['90'] = 'Good';
71
+ } else {
72
+ $notice['90'] = (!$GLOBALS['DUPX_AC']->is_outer_root_wp_content_dir)
73
+ ? 'Good'
74
+ : 'Warn';
75
+ }
76
+
77
+ $space_free = @disk_free_space($GLOBALS['DUPX_ROOT']);
78
+ $archive_size = filesize($GLOBALS['FW_PACKAGE_PATH']);
79
+ $notice['100'] = ($space_free && $archive_size > $space_free)
80
+ ? 'Warn'
81
+ : 'Good';
82
+
83
+ $all_notice = in_array('Warn', $notice) ? 'Warn' : 'Good';
84
+
85
+ //SUMMATION
86
+ $req_success = ($all_req == 'Pass');
87
+ $req_notice = ($all_notice == 'Good');
88
+ $all_success = ($req_success && $req_notice);
89
+ $agree_msg = "To enable this button the checkbox above under the 'Terms & Notices' must be checked.";
90
+
91
+ $shell_exec_unzip_path = DUPX_Server::get_unzip_filepath();
92
+ $shell_exec_zip_enabled = ($shell_exec_unzip_path != null);
93
+ $zip_archive_enabled = class_exists('ZipArchive') ? 'Enabled' : 'Not Enabled';
94
+ $archive_config = DUPX_ArchiveConfig::getInstance();
95
+ ?>
96
+
97
+ <form id="s1-input-form" method="post" class="content-form">
98
+ <input type="hidden" name="view" value="step1" />
99
+ <input type="hidden" name="csrf_token" value="<?php echo DUPX_U::esc_attr(DUPX_CSRF::generate('step1')); ?>">
100
+ <input type="hidden" name="ctrl_action" value="ctrl-step1" />
101
+ <input type="hidden" name="ctrl_csrf_token" value="<?php echo DUPX_CSRF::generate('ctrl-step1'); ?>">
102
+ <input type="hidden" name="secure-pass" value="<?php echo DUPX_U::esc_html($_POST['secure-pass']); ?>" />
103
+ <input type="hidden" name="bootloader" value="<?php echo DUPX_U::esc_attr($GLOBALS['BOOTLOADER_NAME']); ?>" />
104
+ <input type="hidden" name="archive" value="<?php echo DUPX_U::esc_attr($GLOBALS['FW_PACKAGE_PATH']); ?>" />
105
+ <input type="hidden" id="s1-input-form-extra-data" name="extra_data" />
106
+
107
+ <div class="hdr-main">
108
+ Step <span class="step">1</span> of 4: Deployment
109
+ </div><br/>
110
+
111
+ <!-- ====================================
112
+ SETUP TYPE: @todo implement
113
+ ==================================== -->
114
+ <div class="hdr-sub1 toggle-hdr" data-type="toggle" data-target="#s1-area-setup-type" style="display:none">
115
+ <a id="s1-area-setup-type-link"><i class="fa fa-plus-square"></i>Setup</a>
116
+ </div>
117
+ <div id="s1-area-setup-type" style="display:none">
118
+
119
+ <!-- STANDARD INSTALL -->
120
+ <input type="radio" id="setup-type-fresh" name="setup_type" value="1" checked="true" onclick="DUPX.toggleSetupType()" />
121
+ <label for="setup-type-fresh"><b>Standard Install</b></label>
122
+ <i class="fa fa-question-circle"
123
+ data-tooltip-title="Standard Install"
124
+ data-tooltip="A standard install is the default way Duplicator has always worked. Setup your package in an empty directory and run the installer."></i>
125
+ <br/>
126
+ <div class="s1-setup-type-sub" id="s1-setup-type-sub-1">
127
+ <input type="checkbox" name="setup-backup-files" id="setup-backup-files-fresh" />
128
+ <label for="setup-backup-files-fresh">Backup Existing Files</label><br/>
129
+ <input type="checkbox" name="setup-remove-files" id="setup-remove-files-fresh" />
130
+ <label for="setup-remove-files-fresh">Remove Existing Files</label><br/>
131
+ </div><br/>
132
+
133
+ <!-- OVERWRITE INSTALL -->
134
+ <input type="radio" id="setup-type-overwrite" name="setup_type" value="2" onclick="DUPX.toggleSetupType()" />
135
+ <label for="setup-type-overwrite"><b>Overwrite Install</b></label>
136
+ <i class="fa fa-question-circle"
137
+ data-tooltip-title="Overwrite Install"
138
+ data-tooltip="An Overwrite Install allows Duplicator to overwrite an existing WordPress Site."></i><br/>
139
+ <div class="s1-setup-type-sub" id="s1-setup-type-sub-2">
140
+ <input type="checkbox" name="setup-backup-files" id="setup-backup-files-overwrite" />
141
+ <label for="setup-backup-files-overwrite">Backup Existing Files</label><br/>
142
+ <input type="checkbox" name="setup-remove-files" id="setup-remove-files-overwrite" />
143
+ <label for="setup-remove-files-overwrite">Remove Existing Files</label><br/>
144
+ <input type="checkbox" name="setup-backup-database" id="setup-backup-database-overwrite" />
145
+ <label for="setup-backup-database-overwrite">Backup Existing Database</label> <br/>
146
+ </div><br/>
147
+
148
+ <!-- DB-ONLY INSTALL -->
149
+ <input type="radio" id="setup-type-db" name="setup_type" value="3" onclick="DUPX.toggleSetupType()" />
150
+ <label for="setup-type-db"><b>Database Only Install</b></label>
151
+ <i class="fa fa-question-circle"
152
+ data-tooltip-title="Database Only"
153
+ data-tooltip="A database only install allows Duplicator to connect to a database and install only the database."></i><br/>
154
+ <div class="s1-setup-type-sub" id="s1-setup-type-sub-3">
155
+ <input type="checkbox" name="setup-backup-database" id="setup-backup-database-db" />
156
+ <label for="setup-backup-database-db">Backup Existing Database</label> <br/>
157
+ </div><br/>
158
+
159
+ </div>
160
+ <!--br/><br/-->
161
+
162
+
163
+ <!-- ====================================
164
+ ARCHIVE
165
+ ==================================== -->
166
+ <div class="hdr-sub1 toggle-hdr" data-type="toggle" data-target="#s1-area-archive-file">
167
+ <a id="s1-area-archive-file-link"><i class="fa fa-plus-square"></i>Archive</a>
168
+ <div class="<?php echo ( $arcCheck == 'Pass') ? 'status-badge-pass' : 'status-badge-fail'; ?>">
169
+ <?php echo ($arcCheck == 'Pass') ? 'Pass' : 'Fail'; ?>
170
+ </div>
171
+ </div>
172
+ <div id="s1-area-archive-file" style="display:none">
173
+ <div id="tabs">
174
+ <ul>
175
+ <li><a href="#tabs-1">Server</a></li>
176
+ <!--li><a href="#tabs-2">Cloud</a></li-->
177
+ </ul>
178
+ <div id="tabs-1">
179
+
180
+ <table class="s1-archive-local">
181
+ <tr>
182
+ <td colspan="2"><div class="hdr-sub3">Site Details</div></td>
183
+ </tr>
184
+ <tr>
185
+ <td>Site:</td>
186
+ <td><?php echo DUPX_U::esc_html($GLOBALS['DUPX_AC']->blogname);?> </td>
187
+ </tr>
188
+ <tr>
189
+ <td>Notes:</td>
190
+ <td><?php echo strlen($GLOBALS['DUPX_AC']->package_notes) ? DUPX_U::esc_html($GLOBALS['DUPX_AC']->package_notes) : " - no notes - "; ?></td>
191
+ </tr>
192
+ <?php if ($GLOBALS['DUPX_AC']->exportOnlyDB) :?>
193
+ <tr>
194
+ <td>Mode:</td>
195
+ <td>Archive only database was enabled during package package creation.</td>
196
+ </tr>
197
+ <?php endif; ?>
198
+ </table>
199
+
200
+ <table class="s1-archive-local">
201
+ <tr>
202
+ <td colspan="2"><div class="hdr-sub3">File Details</div></td>
203
+ </tr>
204
+ <tr>
205
+ <td style="vertical-align:top">Status:</td>
206
+ <td>
207
+ <?php if ($arcCheck != 'Fail') : ?>
208
+ <span class="dupx-pass">Archive file successfully detected.</span>
209
+ <?php else : ?>
210
+ <div class="s1-archive-failed-msg">
211
+ <b class="dupx-fail">Archive File Not Found!</b><br/>
212
+ The installer file and the archive are bound together as a package when the archive is built. They must be downloaded together and used
213
+ together at install time. The archive file name should <u>not</u> be changed when it is downloaded because the file name is strongly bound
214
+ to the installer. When downloading the package files make sure both files are from the same package line in the packages view within the
215
+ Duplicator WordPress admin.
216
+ <br/><br/>
217
+
218
+ The full archive file name must be <u>exactly</u> the same as when it was built (character for character), or the installer will not work properly.
219
+ To find out the exact archive name that is bound to this installer open the dup_installer/dup-archive_[HASH].txt file with a text editor and search for
220
+ the text "package_name":"[HASH]_archive.zip/daf". Check to see what that value is assigned to and that should be the name of the archive file
221
+ placed in the same path as this installer.
222
+ <br/><br/>
223
+
224
+ If the contents of the archive were manually transferred to this location without the archive file then simply create a temp file named the same
225
+ archive bound to this installer and place the file in the same directory as the installer.php file. The temp file will not need to contain any data.
226
+ Afterward, refresh this page and continue with the install process.
227
+ </div>
228
+ <?php endif; ?>
229
+ </td>
230
+ </tr>
231
+ <tr>
232
+ <td>Path:</td>
233
+ <td><?php echo DUPX_U::esc_html($root_path); ?> </td>
234
+ </tr>
235
+ <tr>
236
+ <td>Size:</td>
237
+ <td><?php echo DUPX_U::readableByteSize($arcSize);?> </td>
238
+ </tr>
239
+ </table>
240
+
241
+ </div>
242
+ <!--div id="tabs-2"><p>Content Here</p></div-->
243
+ </div>
244
+ </div><br/><br/>
245
+
246
+ <!-- ====================================
247
+ VALIDATION
248
+ ==================================== -->
249
+ <div class="hdr-sub1 toggle-hdr" data-type="toggle" data-target="#s1-area-sys-setup">
250
+ <a id="s1-area-sys-setup-link"><i class="fa fa-plus-square"></i>Validation</a>
251
+ <div class="<?php echo ( $req_success) ? 'status-badge-pass' : 'status-badge-fail'; ?> ">
252
+ <?php echo ( $req_success) ? 'Pass' : 'Fail'; ?>
253
+ </div>
254
+ </div>
255
+ <div id="s1-area-sys-setup" style="display:none">
256
+ <div class='info-top'>The system validation checks help to make sure the system is ready for install.</div>
257
+
258
+ <!-- REQUIREMENTS -->
259
+ <div class="s1-reqs" id="s1-reqs-all">
260
+ <div class="header">
261
+ <table class="s1-checks-area">
262
+ <tr>
263
+ <td class="title">Requirements <small>(must pass)</small></td>
264
+ <td class="toggle"><a href="javascript:void(0)" onclick="DUPX.toggleAll('#s1-reqs-all')">[toggle]</a></td>
265
+ </tr>
266
+ </table>
267
+ </div>
268
+
269
+ <!-- REQ 10 -->
270
+ <?php
271
+ $status = strtolower($req['10']);
272
+ ?>
273
+ <div class="status <?php echo DUPX_U::esc_attr($status); ?>"><?php echo DUPX_U::esc_html($req['10']); ?></div>
274
+ <div class="title" data-type="toggle" data-target="#s1-reqs10"><i class="fa fa-caret-right"></i> Permissions</div>
275
+ <div class="info" id="s1-reqs10">
276
+ <table>
277
+ <tr>
278
+ <td><b>Deployment Path:</b> </td>
279
+ <td><i><?php echo "{$GLOBALS['DUPX_ROOT']}"; ?></i> </td>
280
+ </tr>
281
+ <tr>
282
+ <td><b>Suhosin Extension:</b> </td>
283
+ <td><?php echo extension_loaded('suhosin') ? "<i class='dupx-fail'>Enabled</i>" : "<i class='dupx-pass'>Disabled</i>"; ?> </td>
284
+ </tr>
285
+ <tr>
286
+ <td><b>PHP Safe Mode:</b> </td>
287
+ <td><?php echo (DUPX_Server::$php_safe_mode_on) ? "<i class='dupx-fail'>Enabled</i>" : "<i class='dupx-pass'>Disabled</i>"; ?> </td>
288
+ </tr>
289
+ </table><br/>
290
+
291
+ The deployment path must be writable by PHP in order to extract the archive file. Incorrect permissions and extension such as
292
+ <a href="https://suhosin.org/stories/index.html" target="_blank">suhosin</a> can sometimes interfere with PHP being able to write/extract files.
293
+ Please see the <a href="https://snapcreek.com/duplicator/docs/faqs-tech/#faq-trouble-055-q" target="_blank">FAQ permission</a> help link for complete details.
294
+ PHP with <a href='http://php.net/manual/en/features.safe-mode.php' target='_blank'>safe mode</a> should be disabled. If Safe Mode is enabled then
295
+ please contact your hosting provider or server administrator to disable PHP safe mode.
296
+ </div>
297
+
298
+ <!-- REQ 20 -->
299
+ <div class="status <?php echo strtolower($req['20']); ?>"><?php echo DUPX_U::esc_html($req['20']); ?></div>
300
+ <div class="title" data-type="toggle" data-target="#s1-reqs20"><i class="fa fa-caret-right"></i> PHP Mysqli</div>
301
+ <div class="info" id="s1-reqs20">
302
+ Support for the PHP <a href='http://us2.php.net/manual/en/mysqli.installation.php' target='_blank'>mysqli extension</a> is required.
303
+ Please contact your hosting provider or server administrator to enable the mysqli extension. <i>The detection for this call uses
304
+ the function_exists('mysqli_connect') call.</i>
305
+ </div>
306
+
307
+ <!-- REQ 30 -->
308
+ <div class="status <?php echo strtolower($req['30']); ?>"><?php echo DUPX_U::esc_html($req['30']); ?></div>
309
+ <div class="title" data-type="toggle" data-target="#s1-reqs30"><i class="fa fa-caret-right"></i> PHP Version</div>
310
+ <div class="info" id="s1-reqs30">
311
+ This server is running PHP: <b><?php echo DUPX_Server::$php_version ?></b>. <i>A minimum of PHP 5.2.17 is required</i>.
312
+ Contact your hosting provider or server administrator and let them know you would like to upgrade your PHP version.
313
+ </div>
314
+ </div><br/>
315
+
316
+
317
+ <!-- ====================================
318
+ NOTICES -->
319
+ <div class="s1-reqs" id="s1-notice-all">
320
+ <div class="header">
321
+ <table class="s1-checks-area">
322
+ <tr>
323
+ <td class="title">Notices <small>(optional)</small></td>
324
+ <td class="toggle"><a href="javascript:void(0)" onclick="DUPX.toggleAll('#s1-notice-all')">[toggle]</a></td>
325
+ </tr>
326
+ </table>
327
+ </div>
328
+
329
+ <!-- NOTICE 10: OVERWRITE INSTALL -->
330
+ <?php if ($is_overwrite_mode && $is_wordpress) :?>
331
+ <div class="status fail">Warn</div>
332
+ <div class="title" data-type="toggle" data-target="#s1-notice10"><i class="fa fa-caret-right"></i> Overwrite Install</div>
333
+ <div class="info" id="s1-notice10">
334
+ <b>Deployment Path:</b> <i><?php echo "{$GLOBALS['DUPX_ROOT']}"; ?></i>
335
+ <br/><br/>
336
+ <?php
337
+ if ($GLOBALS['DUPX_AC']->installSiteOverwriteOn || $is_dbonly) {
338
+ ?>
339
+ Duplicator is in "Overwrite Install" mode because it has detected an existing WordPress site at the deployment path above. This mode allows for the installer
340
+ to be dropped directly into an existing WordPress site and overwrite its contents. Any content inside of the archive file
341
+ will <u>overwrite</u> the contents from the deployment path. To continue choose one of these options:
342
+
343
+ <ol>
344
+ <li>Ignore this notice and continue with the install if you want to overwrite this sites files.</li>
345
+ <li>Move this installer and archive to another empty directory path to keep this sites files.</li>
346
+ </ol>
347
+
348
+ <small style="color:maroon">
349
+ <b>Notice:</b> Existing content such as plugin/themes/images will still show-up after the install is complete if they did not already exist in
350
+ the archive file. For example if you have an SEO plugin in the current site but that same SEO plugin <u>does not exist</u> in the archive file
351
+ then that plugin will display as a disabled plugin after the install is completed. The same concept with themes and images applies. This will
352
+ not impact the sites operation, and the behavior is expected.
353
+ </small>
354
+ <br/><br/>
355
+
356
+ <small style="color:#025d02">
357
+ <b>Recommendation:</b> It is recommended you only overwrite WordPress sites that have a minimal setup (plugins/themes). Typically a fresh install or a
358
+ cPanel 'one click' install is the best baseline to work from when using this mode but is not required.
359
+ </small>
360
+ <?php
361
+ } else {
362
+ ?>
363
+ Duplicator works best by placing the installer and archive files into an empty directory. If a wp-config.php file is found in the extraction
364
+ directory it might indicate that a pre-existing WordPress site exists which can lead to a bad install.
365
+ <br/><br/>
366
+ <b>Options:</b>
367
+ <ul style="margin-bottom: 0">
368
+ <li>If the archive was already manually extracted then <a href="javascript:void(0)" onclick="DUPX.getManaualArchiveOpt()">[Enable Manual Archive Extraction]</a></li>
369
+ <li>Empty the directory of all files, except for the installer.php and archive.zip/daf files.</li>
370
+ <li>Advanced Users: Can attempt to manually remove the wp-config file only if the archive was manually extracted.</li>
371
+ </ul>
372
+ <?php
373
+ }
374
+ ?>
375
+ </div>
376
+
377
+ <!-- NOTICE 20: ARCHIVE EXTRACTED -->
378
+ <?php elseif ($is_wpconfarc_present && file_exists('{$root_path}/dup-installer')) :?>
379
+ <div class="status fail">Warn</div>
380
+ <div class="title" data-type="toggle" data-target="#s1-notice20"><i class="fa fa-caret-right"></i> Archive Extracted</div>
381
+ <div class="info" id="s1-notice20">
382
+ <b>Deployment Path:</b> <i><?php echo "{$GLOBALS['DUPX_ROOT']}"; ?></i>
383
+ <br/><br/>
384
+
385
+ The installer has detected that the archive file has been extracted to the deployment path above. To continue choose one of these options:
386
+
387
+ <ol>
388
+ <li>Skip the extraction process by <a href="javascript:void(0)" onclick="DUPX.getManaualArchiveOpt()">[enabling manual archive extraction]</a> </li>
389
+ <li>Ignore this message and continue with the install process to re-extract the archive file.</li>
390
+ </ol>
391
+
392
+ <small>Note: This test looks for a file named <i>dup-wp-config-arc__[HASH].txt</i> in the dup-installer directory. If the file exists then this notice is shown.
393
+ The <i>dup-wp-config-arc__[HASH].txt</i> file is created with every archive and removed once the install is complete. For more details on this process see the
394
+ <a href="https://snapcreek.com/duplicator/docs/faqs-tech/#faq-installer-015-q" target="_blank">manual extraction FAQ</a>.</small>
395
+ </div>
396
+ <?php endif; ?>
397
+
398
+ <!-- NOTICE 25: DATABASE ONLY -->
399
+ <?php if ($is_dbonly && ! $is_wordpress) :?>
400
+ <div class="status fail">Warn</div>
401
+ <div class="title" data-type="toggle" data-target="#s1-notice25"><i class="fa fa-caret-right"></i> Database Only</div>
402
+ <div class="info" id="s1-notice25">
403
+ <b>Deployment Path:</b> <i><?php echo "{$GLOBALS['DUPX_ROOT']}"; ?></i>
404
+ <br/><br/>
405
+
406
+ The installer has detected that a WordPress site does not exist at the deployment path above. This installer is currently in 'Database Only' mode because that is
407
+ how the archive was created. If core WordPress site files do not exist at the path above then they will need to be placed there in order for a WordPress site
408
+ to properly work. To continue choose one of these options:
409
+
410
+ <ol>
411
+ <li>Place this installer and archive at a path where core WordPress files already exist to hide this message. </li>
412
+ <li>Create a new package that includes both the database and the core WordPress files.</li>
413
+ <li>Ignore this message and install only the database (for advanced users only).</li>
414
+ </ol>
415
+
416
+ <small>Note: This test simply looks for the directories <?php echo DUPX_Server::$wpCoreDirsList; ?> and a wp-config.php file. If they are not found in the
417
+ deployment path above then this notice is shown.</small>
418
+
419
+ </div>
420
+ <?php endif; ?>
421
+
422
+ <!-- NOTICE 30 -->
423
+ <div class="status <?php echo ($notice['30'] == 'Good') ? 'pass' : 'fail' ?>"><?php echo DUPX_U::esc_html($notice['30']); ?></div>
424
+ <div class="title" data-type="toggle" data-target="#s1-notice30"><i class="fa fa-caret-right"></i> Package Age</div>
425
+ <div class="info" id="s1-notice30">
426
+ This package is <?php echo "{$fulldays}"; ?> day(s) old. Packages older than 180 days might be considered stale. It is recommended to build a new
427
+ package unless your aware of the content and its data. This is message is simply a recommendation.
428
+ </div>
429
+
430
+
431
+ <!-- NOTICE 40 -->
432
+ <div class="status <?php echo ($notice['40'] == 'Good') ? 'pass' : 'fail' ?>"><?php echo DUPX_U::esc_html($notice['40']); ?></div>
433
+ <div class="title" data-type="toggle" data-target="#s1-notice40"><i class="fa fa-caret-right"></i> PHP Version 5.2</div>
434
+ <div class="info" id="s1-notice40">
435
+ <?php
436
+ $cssStyle = DUPX_Server::$php_version_53_plus ? 'color:green' : 'color:red';
437
+ echo "<b style='{$cssStyle}'>This server is currently running PHP version [{$currentPHP}]</b>.<br/>"
438
+ . "Duplicator allows PHP 5.2 to be used during install but does not officially support it. If you're using PHP 5.2 we strongly recommend NOT using it and having your "
439
+ . "host upgrade to a newer more stable, secure and widely supported version. The <a href='http://php.net/eol.php' target='_blank'>end of life for PHP 5.2</a> "
440
+ . "was in January of 2011 and is not recommended for use.<br/><br/>";
441
+
442
+ echo "Many plugin and theme authors are no longer supporting PHP 5.2 and trying to use it can result in site wide problems and compatibility warnings and errors. "
443
+ . "Please note if you continue with the install using PHP 5.2 the Duplicator support team will not be able to help with issues or troubleshoot your site. "
444
+ . "If your server is running <b>PHP 5.3+</b> please feel free to reach out for help if you run into issues with your migration/install.";
445
+ ?>
446
+ </div>
447
+
448
+ <!-- NOTICE 45 -->
449
+ <div class="status <?php echo ($notice['45'] == 'Good') ? 'pass' : 'fail' ?>"><?php echo $notice['45']; ?></div>
450
+ <div class="title" data-type="toggle" data-target="#s1-notice45"><i class="fa fa-caret-right"></i> PHP Version Mismatch</div>
451
+ <div class="info" id="s1-notice45">
452
+ <?php
453
+ $cssStyle = $notice['45'] == 'Good' ? 'color:green' : 'color:red';
454
+ echo "<b style='{$cssStyle}'>You are migrating site from the PHP {$packagePHP} to the PHP {$currentPHP}</b>.<br/>"
455
+ ."If this servers PHP version is different to the PHP version of your package was created it might cause problems with proper functioning of your website
456
+ and/or plugins and themes. It is highly recommended to try and use the same version of PHP if you are able to do so. <br/>";
457
+ ?>
458
+ </div>
459
+
460
+ <!-- NOTICE 50 -->
461
+ <div class="status <?php echo ($notice['50'] == 'Good') ? 'pass' : 'fail' ?>"><?php echo DUPX_U::esc_html($notice['50']); ?></div>
462
+ <div class="title" data-type="toggle" data-target="#s1-notice50"><i class="fa fa-caret-right"></i> PHP Open Base</div>
463
+ <div class="info" id="s1-notice50">
464
+ <b>Open BaseDir:</b> <i><?php echo $notice['50'] == 'Good' ? "<i class='dupx-pass'>Disabled</i>" : "<i class='dupx-fail'>Enabled</i>"; ?></i>
465
+ <br/><br/>
466
+
467
+ If <a href="http://php.net/manual/en/ini.core.php#ini.open-basedir" target="_blank">open_basedir</a> is enabled and you're
468
+ having issues getting your site to install properly; please work with your host and follow these steps to prevent issues:
469
+ <ol style="margin:7px; line-height:19px">
470
+ <li>Disable the open_basedir setting in the php.ini file</li>
471
+ <li>If the host will not disable, then add the path below to the open_basedir setting in the php.ini<br/>
472
+ <i style="color:maroon">"<?php echo str_replace('\\', '/', dirname( __FILE__ )); ?>"</i>
473
+ </li>
474
+ <li>Save the settings and restart the web server</li>
475
+ </ol>
476
+ Note: This warning will still show if you choose option #2 and open_basedir is enabled, but should allow the installer to run properly. Please work with your
477
+ hosting provider or server administrator to set this up correctly.
478
+ </div>
479
+
480
+ <!-- NOTICE 60 -->
481
+ <div class="status <?php echo ($notice['60'] == 'Good') ? 'pass' : 'fail' ?>"><?php echo DUPX_U::esc_html($notice['60']); ?></div>
482
+ <div class="title" data-type="toggle" data-target="#s1-notice60"><i class="fa fa-caret-right"></i> PHP Timeout</div>
483
+ <div class="info" id="s1-notice60">
484
+ <b>Archive Size:</b> <?php echo DUPX_U::readableByteSize($arcSize) ?> <small>(detection limit is set at <?php echo DUPX_U::readableByteSize($max_time_size) ?>) </small><br/>
485
+ <b>PHP max_execution_time:</b> <?php echo "{$max_time_ini}"; ?> <small>(zero means not limit)</small> <br/>
486
+ <b>PHP set_time_limit:</b> <?php echo ($max_time_zero) ? '<i style="color:green">Success</i>' : '<i style="color:maroon">Failed</i>' ?>
487
+ <br/><br/>
488
+
489
+ The PHP <a href="http://php.net/manual/en/info.configuration.php#ini.max-execution-time" target="_blank">max_execution_time</a> setting is used to
490
+ determine how long a PHP process is allowed to run. If the setting is too small and the archive file size is too large then PHP may not have enough
491
+ time to finish running before the process is killed causing a timeout.
492
+ <br/><br/>
493
+
494
+ Duplicator attempts to turn off the timeout by using the
495
+ <a href="http://php.net/manual/en/function.set-time-limit.php" target="_blank">set_time_limit</a> setting. If this notice shows as a warning then it is
496
+ still safe to continue with the install. However, if a timeout occurs then you will need to consider working with the max_execution_time setting or extracting the
497
+ archive file using the 'Manual Archive Extraction' method.
498
+ Please see the <a href="https://snapcreek.com/duplicator/docs/faqs-tech/#faq-trouble-100-q" target="_blank">FAQ timeout</a> help link for more details.
499
+ </div>
500
+
501
+
502
+ <!-- NOTICE 8 -->
503
+ <div class="status <?php echo ($notice['70'] == 'Good') ? 'pass' : 'fail' ?>"><?php echo DUPX_U::esc_html($notice['70']); ?></div>
504
+ <div class="title" data-type="toggle" data-target="#s1-notice70"><i class="fa fa-caret-right"></i> WordPress Multisite</div>
505
+ <div class="info" id="s1-notice70">
506
+ <b>Status:</b> <?php echo $notice['70'] <= 0 ? 'This archive is not a multisite' : 'This is an unsupported multisite archive'; ?>
507
+ <br/><br/>
508
+
509
+ Duplicator does not support WordPress multisite migrations. We recommend using Duplicator Pro which currently supports full multisite migrations and subsite to
510
+ standalone site migrations.
511
+ <br/><br/>
512
+ While it is not recommended you can still continue with the build of this package. Please note that after the install the site may not be working correctly.
513
+ Additional manual custom configurations will need to be made to finalize this multisite migration.
514
+
515
+ <i><a href='https://snapcreek.com/duplicator/?utm_source=duplicator_free&utm_medium=wordpress_plugin&utm_content=free_is_mu_warn_exe&utm_campaign=duplicator_pro' target='_blank'>[upgrade to pro]</a></i>
516
+ </div>
517
+
518
+ <!-- NOTICE 80 -->
519
+ <div class="status <?php echo ($notice['80'] == 'Good') ? 'pass' : 'fail' ?>"><?php echo DUPX_U::esc_html($notice['80']); ?></div>
520
+ <div class="title" data-type="toggle" data-target="#s1-notice80"><i class="fa fa-caret-right"></i> WordPress wp-config Location</div>
521
+ <div class="info" id="s1-notice80">
522
+ If the wp-config.php file was moved up one level and out of the WordPress root folder in the package creation site then this test will show a warning.
523
+ <br/><br/>
524
+ This Duplicator installer will place this wp-config.php file in the WordPress setup root folder of this installation site to help stabilize the install process.
525
+ This process will not break anything in your installation site, but the details are here for your information.
526
+ </div>
527
+
528
+ <!-- NOTICE 90 -->
529
+ <div class="status <?php echo ($notice['90'] == 'Good') ? 'pass' : 'fail' ?>"><?php echo DUPX_U::esc_html($notice['90']); ?></div>
530
+ <div class="title" data-type="toggle" data-target="#s1-notice90"><i class="fa fa-caret-right"></i> WordPress wp-content Location</div>
531
+ <div class="info" id="s1-notice90">
532
+ If the wp-content directory was moved and not located at the WordPress root folder in the package creation site then this test will show a warning.
533
+ <br/><br/>
534
+ Duplicator Installer will place this wp-content directory in the WordPress setup root folder of this installation site. It will not break anything in your installation
535
+ site. It is just for your information.
536
+ </div>
537
+
538
+ <!-- NOTICE 100 -->
539
+ <div class="status <?php echo ($notice['100'] == 'Good') ? 'pass' : 'fail' ?>"><?php echo DUPX_U::esc_html($notice['100']); ?></div>
540
+ <div class="title" data-type="toggle" data-target="#s1-notice100"><i class="fa fa-caret-right"></i> Sufficient disk space</div>
541
+ <div class="info" id="s1-notice100">
542
+ <?php
543
+ echo ($notice['100'] == 'Good')
544
+ ? 'You have sufficient disk space in your machine to extract the archive.'
545
+ : 'You don’t have sufficient disk space in your machine to extract the archive. Ask your host to increase disk space.'
546
+ ?>
547
+ </div>
548
+
549
+ </div>
550
+
551
+ </div>
552
+ <br/><br/>
553
+
554
+
555
+ <!-- ====================================
556
+ OPTIONS
557
+ ==================================== -->
558
+ <div class="hdr-sub1 toggle-hdr" data-type="toggle" data-target="#s1-area-adv-opts">
559
+ <a href="javascript:void(0)"><i class="fa fa-plus-square"></i>Options</a>
560
+ </div>
561
+ <div id="s1-area-adv-opts" style="display:none">
562
+ <div class="help-target">
563
+ <a href="<?php echo DUPX_U::esc_html($GLOBALS['_HELP_URL_PATH'].'#help-s1'); ?>" target="_blank"><i class="fa fa-question-circle"></i></a>
564
+ </div><br/>
565
+
566
+ <div class="hdr-sub3">General</div>
567
+ <table class="dupx-opts dupx-advopts">
568
+ <tr>
569
+ <td>Extraction:</td>
570
+ <td>
571
+ <?php $num_selections = ($archive_config->isZipArchive() ? 3 : 2); ?>
572
+ <select id="archive_engine" name="archive_engine" size="<?php echo DUPX_U::esc_attr($num_selections); ?>">
573
+ <option <?php echo ($is_wpconfarc_present ? '' : 'disabled'); ?> value="manual">Manual Archive Extraction <?php echo ($is_wpconfarc_present ? '' : '*'); ?></option>
574
+ <?php
575
+ if($archive_config->isZipArchive()){
576
+
577
+ //ZIP-ARCHIVE
578
+ if (!$zip_archive_enabled){
579
+ echo '<option value="ziparchive" disabled="true">PHP ZipArchive (not detected on server)</option>';
580
+ } elseif ($zip_archive_enabled &&!$shell_exec_zip_enabled) {
581
+ echo '<option value="ziparchive" selected="true">PHP ZipArchive</option>';
582
+ } else {
583
+ echo '<option value="ziparchive">PHP ZipArchive</option>';
584
+ }
585
+
586
+ //SHELL-EXEC UNZIP
587
+ if (!$shell_exec_zip_enabled){
588
+ echo '<option value="shellexec_unzip" disabled="true">Shell Exec Unzip (not detected on server)</option>';
589
+ } else {
590
+ echo '<option value="shellexec_unzip" selected="true">Shell Exec Unzip</option>';
591
+ }
592
+ }
593
+ else {
594
+ echo '<option value="duparchive" selected="true">DupArchive</option>';
595
+ }
596
+ ?>
597
+ </select><br/>
598
+ <?php if(!$is_wpconfarc_present) :?>
599
+ <span class="sub-notes">
600
+ *Option enabled when archive has been pre-extracted
601
+ <a href="https://snapcreek.com/duplicator/docs/faqs-tech/#faq-installer-015-q" target="_blank">[more info]</a>
602
+ </span>
603
+ <?php endif ?>
604
+ </td>
605
+ </tr>
606
+ <tr>
607
+ <td>Permissions:</td>
608
+ <td>
609
+ <input type="checkbox" name="set_file_perms" id="set_file_perms" value="1" onclick="jQuery('#file_perms_value').prop('disabled', !jQuery(this).is(':checked'));"/>
610
+ <label for="set_file_perms">All Files</label><input name="file_perms_value" id="file_perms_value" style="width:30px; margin-left:7px;" value="644" disabled> &nbsp;
611
+ <input type="checkbox" name="set_dir_perms" id="set_dir_perms" value="1" onclick="jQuery('#dir_perms_value').prop('disabled', !jQuery(this).is(':checked'));"/>
612
+ <label for="set_dir_perms">All Directories</label><input name="dir_perms_value" id="dir_perms_value" style="width:30px; margin-left:7px;" value="755" disabled>
613
+ </td>
614
+ </tr>
615
+ </table><br/><br/>
616
+
617
+ <div class="hdr-sub3">Advanced</div>
618
+ <table class="dupx-opts dupx-advopts">
619
+ <tr>
620
+ <td>Safe Mode:</td>
621
+ <td>
622
+ <select name="exe_safe_mode" id="exe_safe_mode" onchange="DUPX.onSafeModeSwitch();" style="width:250px;">
623
+ <option value="0">Off</option>
624
+ <option value="1">Basic</option>
625
+ <option value="2">Advanced</option>
626
+ </select>
627
+ </td>
628
+ </tr>
629
+ <tr>
630
+ <td>Config Files:</td>
631
+ <td>
632
+ <select name="config_mode" id="config_mode" style="width:250px;">
633
+ <option value="NEW">Create New (recommended)</option>
634
+ <optgroup label="Advanced">
635
+ <option value="RESTORE">Restore Original</option>
636
+ <option value="IGNORE">Ignore All</option>
637
+ </optgroup>
638
+ </select> <br/>
639
+ <span class="sub-notes" style="font-weight: normal">
640
+ Controls how .htaccess, .user.ini and web.config are used.<br/>
641
+ These options are not applied until step 3 is ran.
642
+ <a href="<?php echo DUPX_U::esc_url($GLOBALS['_HELP_URL_PATH'] . '#help-s1'); ?>" target="help">[more info]</a>
643
+ </span>
644
+ </td>
645
+ </tr>
646
+ <tr>
647
+ <td>File Times:</td>
648
+ <td>
649
+ <input type="radio" name="zip_filetime" id="zip_filetime_now" value="current" checked="checked" />
650
+ <label class="radio" for="zip_filetime_now" title='Set the files current date time to now'>Current</label> &nbsp;
651
+ <input type="radio" name="zip_filetime" id="zip_filetime_orginal" value="original" />
652
+ <label class="radio" for="zip_filetime_orginal" title="Keep the files date time the same">Original</label>
653
+ </td>
654
+ </tr>
655
+ <tr>
656
+ <td>Logging:</td>
657
+ <td>
658
+ <input type="radio" name="logging" id="logging-light" value="1" checked="true"> <label for="logging-light" class="radio">Light</label> &nbsp;
659
+ <input type="radio" name="logging" id="logging-detailed" value="2"> <label for="logging-detailed" class="radio">Detailed</label> &nbsp;
660
+ <input type="radio" name="logging" id="logging-debug" value="3"> <label for="logging-debug" class="radio">Debug</label>
661
+ </td>
662
+ </tr>
663
+ <?php if(!$archive_config->isZipArchive()): ?>
664
+ <tr>
665
+ <td>Client-Kickoff:</td>
666
+ <td>
667
+ <input type="checkbox" name="clientside_kickoff" id="clientside_kickoff" value="1" checked/>
668
+ <label for="clientside_kickoff" style="font-weight: normal">Browser drives the archive engine.</label>
669
+ </td>
670
+ </tr>
671
+ <?php endif;?>
672
+ <tr>
673
+ <td>Testing:</td>
674
+ <td>
675
+ <a href="javascript:void(0)" target="db-test" onclick="DUPX.openDBValidationWindow(); return false;">[Quick Database Connection Test]</a>
676
+ </td>
677
+ </tr>
678
+ </table>
679
+ </div><br/>
680
+
681
+ <?php include ('view.s1.terms.php') ;?>
682
+
683
+ <div id="s1-warning-check">
684
+ <input id="accept-warnings" name="accpet-warnings" type="checkbox" onclick="DUPX.acceptWarning()" />
685
+ <label for="accept-warnings">I have read and accept all <a href="javascript:void(0)" onclick="DUPX.viewTerms()">terms &amp; notices</a> <small style="font-style:italic">(required to continue)</small></label><br/>
686
+ </div>
687
+ <br/><br/>
688
+ <br/><br/>
689
+
690
+
691
+ <?php if (!$req_success || $arcCheck == 'Fail') : ?>
692
+ <div class="s1-err-msg">
693
+ <i>
694
+ This installation will not be able to proceed until the archive and validation sections both pass. Please adjust your servers settings or contact your
695
+ server administrator, hosting provider or visit the resources below for additional help.
696
+ </i>
697
+ <div style="padding:10px">
698
+ &raquo; <a href="https://snapcreek.com/duplicator/docs/faqs-tech/" target="_blank">Technical FAQs</a> <br/>
699
+ &raquo; <a href="https://snapcreek.com/support/docs/" target="_blank">Online Documentation</a> <br/>
700
+ </div>
701
+ </div>
702
+ <?php else : ?>
703
+ <div class="footer-buttons" >
704
+ <button id="s1-deploy-btn" type="button" title="<?php echo DUPX_U::esc_attr($agree_msg); ?>" onclick="DUPX.processNext()" class="default-btn"> Next <i class="fa fa-caret-right"></i> </button>
705
+ </div>
706
+ <?php endif; ?>
707
+
708
+ </form>
709
+
710
+ <!-- =========================================
711
+ VIEW: STEP 1 - DB QUICK TEST
712
+ ========================================= -->
713
+ <form id="s1-dbtest-form" method="post" target="_blank">
714
+ <input type="hidden" name="dbonlytest" value="1" />
715
+ <input type="hidden" name="view" value="step2" />
716
+ <input type="hidden" name="csrf_token" value="<?php echo DUPX_CSRF::generate('step2'); ?>">
717
+ <input type="hidden" name="secure-pass" value="<?php echo DUPX_U::esc_attr($_POST['secure-pass']); ?>" />
718
+ <input type="hidden" name="bootloader" value="<?php echo DUPX_U::esc_attr($GLOBALS['BOOTLOADER_NAME']); ?>" />
719
+ <input type="hidden" name="archive" value="<?php echo DUPX_U::esc_attr($GLOBALS['FW_PACKAGE_PATH']); ?>" />
720
+ </form>
721
+
722
+
723
+ <!-- =========================================
724
+ VIEW: STEP 1 - AJAX RESULT
725
+ Auto Posts to view.step2.php
726
+ ========================================= -->
727
+ <form id='s1-result-form' method="post" class="content-form" style="display:none">
728
+
729
+ <div class="dupx-logfile-link"><a href="./<?php echo DUPX_U::esc_attr($GLOBALS["LOG_FILE_NAME"]);?>" target="dup-installer">dup-installer-log.txt</a></div>
730
+ <div class="hdr-main">
731
+ Step <span class="step">1</span> of 4: Extraction
732
+ </div>
733
+
734
+ <!-- POST PARAMS -->
735
+ <div class="dupx-debug">
736
+ <i>Step 1 - AJAX Response</i>
737
+ <input type="hidden" name="view" value="step2" />
738
+ <input type="hidden" name="csrf_token" value="<?php echo DUPX_CSRF::generate('step2'); ?>">
739
+ <input type="hidden" name="secure-pass" value="<?php echo DUPX_U::esc_attr($_POST['secure-pass']); ?>" />
740
+ <input type="hidden" name="bootloader" value="<?php echo DUPX_U::esc_attr($GLOBALS['BOOTLOADER_NAME']); ?>" />
741
+ <input type="hidden" name="archive" value="<?php echo DUPX_U::esc_attr($GLOBALS['FW_PACKAGE_PATH']); ?>" />
742
+ <input type="hidden" name="logging" id="ajax-logging" />
743
+ <input type="hidden" name="config_mode" id="ajax-config-mode" />
744
+ <input type="hidden" name="exe_safe_mode" id="exe-safe-mode" value="0" />
745
+ <input type="hidden" name="json" id="ajax-json" />
746
+ <textarea id='ajax-json-debug' name='json_debug_view'></textarea>
747
+ <input type='submit' value='manual submit'>
748
+ </div>
749
+
750
+ <!-- PROGRESS BAR -->
751
+ <div id="progress-area">
752
+ <div style="width:500px; margin:auto">
753
+ <div style="font-size:1.7em; margin-bottom:20px"><i class="fa fa-circle-o-notch fa-spin"></i> Extracting Archive Files<span id="progress-pct"></span></div>
754
+ <div id="progress-bar"></div>
755
+ <h3> Please Wait...</h3><br/><br/>
756
+ <i>Keep this window open during the extraction process.</i><br/>
757
+ <i>This can take several minutes.</i>
758
+ </div>
759
+ </div>
760
+
761
+ <!-- AJAX SYSTEM ERROR -->
762
+ <div id="ajaxerr-area" style="display:none">
763
+ <p>Please try again an issue has occurred.</p>
764
+ <div style="padding: 0px 10px 10px 0px;">
765
+ <div id="ajaxerr-data">An unknown issue has occurred with the file and database setup process. Please see the dup-installer-log.txt file for more details.</div>
766
+ <div style="text-align:center; margin:10px auto 0px auto">
767
+ <!-- <input type="button" class="default-btn" onclick="DUPX.hideErrorResult()" value="&laquo; Try Again" /> -->
768
+ <br/>
769
+ <a href="../<?php echo $GLOBALS['BOOTLOADER_NAME'];?>" class="default-btn">&laquo; Try Again</a>
770
+ <br/><br/>
771
+ <i style='font-size:11px'>See online help for more details at <a href='https://snapcreek.com/ticket' target='_blank'>snapcreek.com</a></i>
772
+ </div>
773
+ </div>
774
+ </div>
775
+ </form>
776
+
777
+ <script>
778
+ DUPX.openDBValidationWindow = function()
779
+ {
780
+ console.log('test');
781
+ $('#s1-dbtest-form').submit();
782
+ }
783
+
784
+ DUPX.toggleSetupType = function ()
785
+ {
786
+ var val = $("input:radio[name='setup_type']:checked").val();
787
+ $('div.s1-setup-type-sub').hide();
788
+ $('#s1-setup-type-sub-' + val).show(200);
789
+ };
790
+
791
+ DUPX.getManaualArchiveOpt = function ()
792
+ {
793
+ $("html, body").animate({scrollTop: $(document).height()}, 1500);
794
+ $("div[data-target='#s1-area-adv-opts']").find('i.fa').removeClass('fa-plus-square').addClass('fa-minus-square');
795
+ $('#s1-area-adv-opts').show(1000);
796
+ $('select#archive_engine').val('manual').focus();
797
+ };
798
+
799
+ DUPX.startExtraction = function()
800
+ {
801
+ var isManualExtraction = ($("#archive_engine").val() == "manual");
802
+ var zipEnabled = <?php echo SnapLibStringU::boolToString($archive_config->isZipArchive()); ?>;
803
+
804
+ $("#operation-text").text("Extracting Archive Files");
805
+
806
+ if (zipEnabled || isManualExtraction) {
807
+ DUPX.runStandardExtraction();
808
+ } else {
809
+ DUPX.kickOffDupArchiveExtract();
810
+ }
811
+ }
812
+
813
+ DUPX.processNext = function ()
814
+ {
815
+ DUPX.startExtraction();
816
+ };
817
+
818
+ DUPX.updateProgressPercent = function (percent)
819
+ {
820
+ var percentString = '';
821
+ if (percent > 0) {
822
+ percentString = ' ' + percent + '%';
823
+ }
824
+ $("#progress-pct").text(percentString);
825
+ };
826
+
827
+ DUPX.clearDupArchiveStatusTimer = function ()
828
+ {
829
+ if (DUPX.dupArchiveStatusIntervalID != -1) {
830
+ clearInterval(DUPX.dupArchiveStatusIntervalID);
831
+ DUPX.dupArchiveStatusIntervalID = -1;
832
+ }
833
+ };
834
+
835
+ DUPX.getCriticalFailureText = function(failures)
836
+ {
837
+ var retVal = null;
838
+
839
+ if((failures !== null) && (typeof failures !== 'undefined')) {
840
+ var len = failures.length;
841
+
842
+ for(var j = 0; j < len; j++) {
843
+ failure = failures[j];
844
+
845
+ if(failure.isCritical) {
846
+ retVal = failure.description;
847
+ break;
848
+ }
849
+ }
850
+ }
851
+
852
+ return retVal;
853
+ };
854
+
855
+ DUPX.DAWSProcessingFailed = function(errorText)
856
+ {
857
+ DUPX.clearDupArchiveStatusTimer();
858
+ $('#ajaxerr-data').html(errorText);
859
+ DUPX.hideProgressBar();
860
+ }
861
+
862
+ DUPX.handleDAWSProcessingProblem = function(errorText, pingDAWS) {
863
+
864
+ DUPX.DAWS.FailureCount++;
865
+
866
+ if(DUPX.DAWS.FailureCount <= DUPX.DAWS.MaxRetries) {
867
+ var callback = DUPX.pingDAWS;
868
+
869
+ if(pingDAWS) {
870
+ console.log('!!!PING FAILURE #' + DUPX.DAWS.FailureCount);
871
+ } else {
872
+ console.log('!!!KICKOFF FAILURE #' + DUPX.DAWS.FailureCount);
873
+ callback = DUPX.kickOffDupArchiveExtract;
874
+ }
875
+
876
+ DUPX.throttleDelay = 9; // Equivalent of 'low' server throttling
877
+ console.log('Relaunching in ' + DUPX.DAWS.RetryDelayInMs);
878
+ setTimeout(callback, DUPX.DAWS.RetryDelayInMs);
879
+ }
880
+ else {
881
+ console.log('Too many failures.');
882
+ DUPX.DAWSProcessingFailed(errorText);
883
+ }
884
+ };
885
+
886
+
887
+ DUPX.handleDAWSCommunicationProblem = function(xHr, pingDAWS, textStatus, page)
888
+ {
889
+ DUPX.DAWS.FailureCount++;
890
+
891
+ if(DUPX.DAWS.FailureCount <= DUPX.DAWS.MaxRetries) {
892
+
893
+ var callback = DUPX.pingDAWS;
894
+
895
+ if(pingDAWS) {
896
+ console.log('!!!PING FAILURE #' + DUPX.DAWS.FailureCount);
897
+ } else {
898
+ console.log('!!!KICKOFF FAILURE #' + DUPX.DAWS.FailureCount);
899
+ callback = DUPX.kickOffDupArchiveExtract;
900
+ }
901
+ console.log(xHr);
902
+ DUPX.throttleDelay = 9; // Equivalent of 'low' server throttling
903
+ console.log('Relaunching in ' + DUPX.DAWS.RetryDelayInMs);
904
+ setTimeout(callback, DUPX.DAWS.RetryDelayInMs);
905
+ }
906
+ else {
907
+ console.log('Too many failures.');
908
+ DUPX.ajaxCommunicationFailed(xHr, textStatus, page);
909
+ }
910
+ };
911
+
912
+ // Will either query for status or push it to continue the extraction
913
+ DUPX.pingDAWS = function ()
914
+ {
915
+ console.log('pingDAWS:start');
916
+ var request = new Object();
917
+ var isClientSideKickoff = DUPX.isClientSideKickoff();
918
+
919
+ if (isClientSideKickoff) {
920
+ console.log('pingDAWS:client side kickoff');
921
+ request.action = "expand";
922
+ request.client_driven = 1;
923
+ request.throttle_delay = DUPX.throttleDelay;
924
+ request.worker_time = DUPX.DAWS.PingWorkerTimeInSec;
925
+ } else {
926
+ console.log('pingDAWS:not client side kickoff');
927
+ request.action = "get_status";
928
+ }
929
+
930
+ console.log("pingDAWS:action=" + request.action);
931
+
932
+ $.ajax({
933
+ type: "POST",
934
+ timeout: DUPX.DAWS.PingWorkerTimeInSec * 2000, // Double worker time and convert to ms
935
+ url: DUPX.DAWS.Url,
936
+ data: JSON.stringify(request),
937
+ success: function (respData, textStatus, xHr) {
938
+ try {
939
+ var data = DUPX.parseJSON(respData);
940
+ } catch(err) {
941
+ console.error(err);
942
+ console.error('JSON parse failed for response data: ' + respData);
943
+ console.log('AJAX error. textStatus=');
944
+ console.log(textStatus);
945
+ DUPX.handleDAWSCommunicationProblem(xHr, true, textStatus, 'ping');
946
+ return false;
947
+ }
948
+
949
+ DUPX.DAWS.FailureCount = 0;
950
+ console.log("pingDAWS:AJAX success. Resetting failure count");
951
+
952
+ // DATA FIELDS
953
+ // archive_offset, archive_size, failures, file_index, is_done, timestamp
954
+
955
+ if (typeof (data) != 'undefined' && data.pass == 1) {
956
+
957
+ console.log("pingDAWS:Passed");
958
+
959
+ var status = data.status;
960
+ var percent = Math.round((status.archive_offset * 100.0) / status.archive_size);
961
+
962
+ console.log("pingDAWS:updating progress percent");
963
+ DUPX.updateProgressPercent(percent);
964
+
965
+ var criticalFailureText = DUPX.getCriticalFailureText(status.failures);
966
+
967
+ if(status.failures.length > 0) {
968
+ console.log("pingDAWS:There are failures present. (" + status.failures.length) + ")";
969
+ }
970
+
971
+ if (criticalFailureText === null) {
972
+ console.log("pingDAWS:No critical failures");
973
+ if (status.is_done) {
974
+
975
+ console.log("pingDAWS:archive has completed");
976
+ if(status.failures.length > 0) {
977
+
978
+ console.log(status.failures);
979
+ var errorMessage = "pingDAWS:Problems during extract. These may be non-critical so continue with install.\n------\n";
980
+ var len = status.failures.length;
981
+
982
+ for(var j = 0; j < len; j++) {
983
+ failure = status.failures[j];
984
+ errorMessage += failure.subject + ":" + failure.description + "\n";
985
+ }
986
+
987
+ alert(errorMessage);
988
+ }
989
+
990
+ DUPX.clearDupArchiveStatusTimer();
991
+ console.log("pingDAWS:calling finalizeDupArchiveExtraction");
992
+ DUPX.finalizeDupArchiveExtraction(status);
993
+ console.log("pingDAWS:after finalizeDupArchiveExtraction");
994
+
995
+ var dataJSON = JSON.stringify(data);
996
+
997
+ // Don't stop for non-critical failures - just display those at the end
998
+
999
+ $("#ajax-logging").val($("input:radio[name=logging]:checked").val());
1000
+ $("#ajax-config-mode").val($("#config_mode").val());
1001
+ $("#ajax-json").val(escape(dataJSON));
1002
+
1003
+ <?php if (!$GLOBALS['DUPX_DEBUG']) : ?>
1004
+ setTimeout(function () {
1005
+ $('#s1-result-form').submit();
1006
+ }, 500);
1007
+ <?php endif; ?>
1008
+ $('#progress-area').fadeOut(1000);
1009
+ //Failures aren't necessarily fatal - just record them for later display
1010
+
1011
+ $("#ajax-json-debug").val(dataJSON);
1012
+ } else if (isClientSideKickoff) {
1013
+ console.log('pingDAWS:Archive not completed so continue ping DAWS in 500');
1014
+ setTimeout(DUPX.pingDAWS, 500);
1015
+ }
1016
+ }
1017
+ else {
1018
+ console.log("pingDAWS:critical failures present");
1019
+ // If we get a critical failure it means it's something we can't recover from so no purpose in retrying, just fail immediately.
1020
+ var errorString = 'Error Processing Step 1<br/>';
1021
+
1022
+ errorString += criticalFailureText;
1023
+
1024
+ DUPX.DAWSProcessingFailed(errorString);
1025
+ }
1026
+ } else {
1027
+ var errorString = 'Error Processing Step 1<br/>';
1028
+ errorString += data.error;
1029
+
1030
+ DUPX.handleDAWSProcessingProblem(errorString, true);
1031
+ }
1032
+ },
1033
+ error: function (xHr, textStatus) {
1034
+ console.log('AJAX error. textStatus=');
1035
+ console.log(textStatus);
1036
+ DUPX.handleDAWSCommunicationProblem(xHr, true, textStatus, 'ping');
1037
+ }
1038
+ });
1039
+ };
1040
+
1041
+
1042
+ DUPX.isClientSideKickoff = function()
1043
+ {
1044
+ return $('#clientside_kickoff').is(':checked');
1045
+ }
1046
+
1047
+ DUPX.areConfigFilesPreserved = function()
1048
+ {
1049
+ return $('#config_mode').is(':checked');
1050
+ }
1051
+
1052
+ DUPX.kickOffDupArchiveExtract = function ()
1053
+ {
1054
+ console.log('kickOffDupArchiveExtract:start');
1055
+ var $form = $('#s1-input-form');
1056
+ var request = new Object();
1057
+ var isClientSideKickoff = DUPX.isClientSideKickoff();
1058
+
1059
+ request.action = "start_expand";
1060
+ request.archive_filepath = '<?php echo DUPX_U::esc_js($archive_path); ?>';
1061
+ request.restore_directory = '<?php echo DUPX_U::esc_js($root_path); ?>';
1062
+ request.worker_time = DUPX.DAWS.KickoffWorkerTimeInSec;
1063
+ request.client_driven = isClientSideKickoff ? 1 : 0;
1064
+ request.throttle_delay = DUPX.throttleDelay;
1065
+ request.filtered_directories = ['dup-installer'];
1066
+
1067
+ if(!DUPX.areConfigFilesPreserved()) {
1068
+ request.file_renames = {".htaccess":"htaccess.orig"};
1069
+ }
1070
+
1071
+ var requestString = JSON.stringify(request);
1072
+
1073
+ if (!isClientSideKickoff) {
1074
+ console.log('kickOffDupArchiveExtract:Setting timer');
1075
+ // If server is driving things we need to poll the status
1076
+ DUPX.dupArchiveStatusIntervalID = setInterval(DUPX.pingDAWS, DUPX.DAWS.StatusPeriodInMS);
1077
+ }
1078
+ else {
1079
+ console.log('kickOffDupArchiveExtract:client side kickoff');
1080
+ }
1081
+
1082
+ console.log("daws url=" + DUPX.DAWS.Url);
1083
+ console.log("requeststring=" + requestString);
1084
+
1085
+ $.ajax({
1086
+ type: "POST",
1087
+ timeout: DUPX.DAWS.KickoffWorkerTimeInSec * 2000, // Double worker time and convert to ms
1088
+ url: DUPX.DAWS.Url + '&daws_action=start_expand',
1089
+ data: requestString,
1090
+ beforeSend: function () {
1091
+ DUPX.showProgressBar();
1092
+ $form.hide();
1093
+ $('#s1-result-form').show();
1094
+ DUPX.updateProgressPercent(0);
1095
+ },
1096
+ success: function (respData, textStatus, xHr) {
1097
+ try {
1098
+ var data = DUPX.parseJSON(respData);
1099
+ } catch(err) {
1100
+ console.error(err);
1101
+ console.error('JSON parse failed for response data: ' + respData);
1102
+ console.log('kickOffDupArchiveExtract:AJAX error. textStatus=', textStatus);
1103
+ DUPX.handleDAWSCommunicationProblem(xHr, false, textStatus);
1104
+ return false;
1105
+ }
1106
+ console.log('kickOffDupArchiveExtract:success');
1107
+ if (typeof (data) != 'undefined' && data.pass == 1) {
1108
+
1109
+ var criticalFailureText = DUPX.getCriticalFailureText(status.failures);
1110
+
1111
+ if (criticalFailureText === null) {
1112
+
1113
+ var dataJSON = JSON.stringify(data);
1114
+
1115
+ //RSR TODO:Need to check only for FATAL errors right now - have similar failure check as in pingdaws
1116
+ DUPX.DAWS.FailureCount = 0;
1117
+ console.log("kickOffDupArchiveExtract:Resetting failure count");
1118
+
1119
+ $("#ajax-json-debug").val(dataJSON);
1120
+ if (typeof (data) != 'undefined' && data.pass == 1) {
1121
+
1122
+ if (isClientSideKickoff) {
1123
+ console.log('kickOffDupArchiveExtract:Initial ping DAWS in 500');
1124
+ setTimeout(DUPX.pingDAWS, 500);
1125
+ }
1126
+
1127
+ } else {
1128
+ $('#ajaxerr-data').html('Error Processing Step 1');
1129
+ DUPX.hideProgressBar();
1130
+ }
1131
+ } else {
1132
+ // If we get a critical failure it means it's something we can't recover from so no purpose in retrying, just fail immediately.
1133
+ var errorString = 'kickOffDupArchiveExtract:Error Processing Step 1<br/>';
1134
+ errorString += criticalFailureText;
1135
+ DUPX.DAWSProcessingFailed(errorString);
1136
+ }
1137
+ } else {
1138
+ if ('undefined' !== typeof data.isWPAlreadyExistsError
1139
+ && data.isWPAlreadyExistsError) {
1140
+ DUPX.DAWSProcessingFailed(data.error);
1141
+ } else {
1142
+ var errorString = 'kickOffDupArchiveExtract:Error Processing Step 1<br/>';
1143
+ errorString += data.error;
1144
+ DUPX.handleDAWSProcessingProblem(errorString, false);
1145
+ }
1146
+ }
1147
+ },
1148
+ error: function (xHr, textStatus) {
1149
+
1150
+ console.log('kickOffDupArchiveExtract:AJAX error. textStatus=', textStatus);
1151
+ DUPX.handleDAWSCommunicationProblem(xHr, false, textStatus);
1152
+ }
1153
+ });
1154
+ };
1155
+
1156
+ DUPX.finalizeDupArchiveExtraction = function(dawsStatus)
1157
+ {
1158
+ console.log("finalizeDupArchiveExtraction:start");
1159
+ var $form = $('#s1-input-form');
1160
+ $("#s1-input-form-extra-data").val(JSON.stringify(dawsStatus));
1161
+ console.log("finalizeDupArchiveExtraction:after stringify dawsstatus");
1162
+ var formData = $form.serialize();
1163
+
1164
+ $.ajax({
1165
+ type: "POST",
1166
+ timeout: 30000,
1167
+ url: window.location.href,
1168
+ data: formData,
1169
+ success: function (respData, textStatus, xHr) {
1170
+ try {
1171
+ var data = DUPX.parseJSON(respData);
1172
+ } catch(err) {
1173
+ console.error(err);
1174
+ console.error('JSON parse failed for response data: ' + respData);
1175
+ console.log("finalizeDupArchiveExtraction:error");
1176
+ console.log(xHr.statusText);
1177
+ console.log(xHr.getAllResponseHeaders());
1178
+ console.log(xHr.responseText);
1179
+ return false;
1180
+ }
1181
+ console.log("finalizeDupArchiveExtraction:success");
1182
+ },
1183
+ error: function (xHr) {
1184
+ console.log("finalizeDupArchiveExtraction:error");
1185
+ console.log(xHr.statusText);
1186
+ console.log(xHr.getAllResponseHeaders());
1187
+ console.log(xHr.responseText);
1188
+ }
1189
+ });
1190
+ };
1191
+
1192
+ /**
1193
+ * Performs Ajax post to either do a zip or manual extract and then create db
1194
+ */
1195
+ DUPX.runStandardExtraction = function ()
1196
+ {
1197
+ var $form = $('#s1-input-form');
1198
+
1199
+ //1800000 = 30 minutes
1200
+ //If the extraction takes longer than 30 minutes then user
1201
+ //will probably want to do a manual extraction or even FTP
1202
+ $.ajax({
1203
+ type: "POST",
1204
+ timeout: 1800000,
1205
+ url: window.location.href,
1206
+ data: $form.serialize(),
1207
+ beforeSend: function () {
1208
+ DUPX.showProgressBar();
1209
+ $form.hide();
1210
+ $('#s1-result-form').show();
1211
+ },
1212
+ success: function (data, textStatus, xHr) {
1213
+ $("#ajax-json-debug").val(data);
1214
+ var dataJSON = data;
1215
+ data = DUPX.parseJSON(data, xHr, textStatus);
1216
+ if (false === data) {
1217
+ return;
1218
+ }
1219
+ $("#ajax-json-debug").val(dataJSON);
1220
+ if (typeof (data) != 'undefined' && data.pass == 1) {
1221
+ $("#ajax-logging").val($("input:radio[name=logging]:checked").val());
1222
+ $("#ajax-config-mode").val($("#config_mode").val());
1223
+ $("#ajax-json").val(escape(dataJSON));
1224
+
1225
+ <?php if (!$GLOBALS['DUPX_DEBUG']) : ?>
1226
+ setTimeout(function () {$('#s1-result-form').submit();}, 500);
1227
+ <?php endif; ?>
1228
+ $('#progress-area').fadeOut(1000);
1229
+ } else {
1230
+ $('#ajaxerr-data').html('Error Processing Step 1');
1231
+ DUPX.hideProgressBar();
1232
+ }
1233
+ },
1234
+ error: function (xHr) {
1235
+ DUPX.ajaxCommunicationFailed(xHr, '', 'extract');
1236
+ }
1237
+ });
1238
+ };
1239
+
1240
+ DUPX.ajaxCommunicationFailed = function (xhr, textStatus, page)
1241
+ {
1242
+ var status = "<b>Server Code:</b> " + xhr.status + "<br/>";
1243
+ status += "<b>Status:</b> " + xhr.statusText + "<br/>";
1244
+ status += "<b>Response:</b> " + xhr.responseText + "<hr/>";
1245
+
1246
+ if(textStatus && textStatus.toLowerCase() == "timeout" || textStatus.toLowerCase() == "service unavailable") {
1247
+
1248
+ var default_timeout_message = "<b>Recommendation:</b><br/>";
1249
+ default_timeout_message += "See <a target='_blank' href='https://snapcreek.com/duplicator/docs/faqs-tech/?180116102141#faq-trouble-100-q'>this FAQ item</a> for possible resolutions.";
1250
+ default_timeout_message += "<hr>";
1251
+ default_timeout_message += "<b>Additional Resources...</b><br/>";
1252
+ default_timeout_message += "With thousands of different permutations it's difficult to try and debug/diagnose a server. If you're running into timeout issues and need help we suggest you follow these steps:<br/><br/>";
1253
+ default_timeout_message += "<ol>";
1254
+ default_timeout_message += "<li><strong>Contact Host:</strong> Tell your host that you're running into PHP/Web Server timeout issues and ask them if they have any recommendations</li>";
1255
+ default_timeout_message += "<li><strong>Dedicated Help:</strong> If you're in a time-crunch we suggest that you contact <a target='_blank' href='https://snapcreek.com/duplicator/docs/faqs-tech/?180116150030#faq-resource-030-q'>professional server administrator</a>. A dedicated resource like this will be able to work with you around the clock to the solve the issue much faster than we can in most cases.</li>";
1256
+ default_timeout_message += "<li><strong>Consider Upgrading:</strong> If you're on a budget host then you may run into constraints. If you're running a larger or more complex site it might be worth upgrading to a <a target='_blank' href='https://snapcreek.com/duplicator/docs/faqs-tech/?180116150030#faq-resource-040-q'>managed VPS server</a>. These systems will pretty much give you full control to use the software without constraints and come with excellent support from the hosting company.</li>";
1257
+ default_timeout_message += "<li><strong>Contact SnapCreek:</strong> We will try our best to help configure and point users in the right direction, however these types of issues can be time-consuming and can take time from our support staff.</li>";
1258
+ default_timeout_message += "</ol>";
1259
+
1260
+ if(page) {
1261
+ switch(page) {
1262
+ default:
1263
+ status += default_timeout_message;
1264
+ break;
1265
+ case 'extract':
1266
+ status += "<b>Recommendation:</b><br/>";
1267
+ status += "See <a target='_blank' href='https://snapcreek.com/duplicator/docs/faqs-tech/#faq-installer-015-q'>this FAQ item</a> for possible resolutions.<br/><br/>";
1268
+ break;
1269
+ case 'ping':
1270
+ status += "<b>Recommendation:</b><br/>";
1271
+ status += "See <a target='_blank' href='https://snapcreek.com/duplicator/docs/faqs-tech/?180116152758#faq-trouble-030-q'>this FAQ item</a> for possible resolutions.<br/><br/>";
1272
+ break;
1273
+ case 'delete-site':
1274
+ status += "<b>Recommendation:</b><br/>";
1275
+ status += "See <a target='_blank' href='https://snapcreek.com/duplicator/docs/faqs-tech/?180116153643#faq-installer-120-q'>this FAQ item</a> for possible resolutions.<br/><br/>";
1276
+ break;
1277
+ }
1278
+ } else {
1279
+ status += default_timeout_message;
1280
+ }
1281
+
1282
+ }
1283
+ else if ((xhr.status == 403) || (xhr.status == 500)) {
1284
+ status += "<b>Recommendation:</b><br/>";
1285
+ status += "See <a target='_blank' href='https://snapcreek.com/duplicator/docs/faqs-tech/#faq-installer-120-q'>this FAQ item</a> for possible resolutions.<br/><br/>"
1286
+ } else if ((xhr.status == 0) || (xhr.status == 200)) {
1287
+ status += "<b>Recommendation:</b><br/>";
1288
+ status += "Possible server timeout! Performing a 'Manual Extraction' can avoid timeouts.";
1289
+ status += "See <a target='_blank' href='https://snapcreek.com/duplicator/docs/faqs-tech/#faq-installer-015-q'>this FAQ item</a> for a complete overview.<br/><br/>"
1290
+ } else {
1291
+ status += "<b>Additional Resources:</b><br/> ";
1292
+ status += "&raquo; <a target='_blank' href='https://snapcreek.com/duplicator/docs/'>Help Resources</a><br/>";
1293
+ status += "&raquo; <a target='_blank' href='https://snapcreek.com/duplicator/docs/faqs-tech/'>Technical FAQ</a>";
1294
+ }
1295
+
1296
+ $('#ajaxerr-data').html(status);
1297
+ DUPX.hideProgressBar();
1298
+ };
1299
+
1300
+ DUPX.parseJSON = function(mixData, xHr, textStatus) {
1301
+ try {
1302
+ var parsed = JSON.parse(mixData);
1303
+ return parsed;
1304
+ } catch (e) {
1305
+ console.log("JSON parse failed - 1");
1306
+ }
1307
+
1308
+ var jsonStartPos = mixData.indexOf('{');
1309
+ var jsonLastPos = mixData.lastIndexOf('}');
1310
+ if (jsonStartPos > -1 && jsonLastPos > -1) {
1311
+ var expectedJsonStr = mixData.slice(jsonStartPos, jsonLastPos + 1);
1312
+ try {
1313
+ var parsed = JSON.parse(expectedJsonStr);
1314
+ return parsed;
1315
+ } catch (e) {
1316
+ console.log("JSON parse failed - 2");
1317
+ DUPX.ajaxCommunicationFailed(xHr, textStatus, 'extract');
1318
+ return false;
1319
+ }
1320
+ }
1321
+ DUPX.ajaxCommunicationFailed(xHr, textStatus, 'extract');
1322
+ return false;
1323
+ }
1324
+
1325
+ /** Go back on AJAX result view */
1326
+ DUPX.hideErrorResult = function ()
1327
+ {
1328
+ $('#s1-result-form').hide();
1329
+ $('#s1-input-form').show(200);
1330
+ }
1331
+
1332
+ /**
1333
+ * Accetps Usage Warning */
1334
+ DUPX.acceptWarning = function ()
1335
+ {
1336
+ if ($("#accept-warnings").is(':checked')) {
1337
+ $("#s1-deploy-btn").removeAttr("disabled");
1338
+ $("#s1-deploy-btn").removeAttr("title");
1339
+ } else {
1340
+ $("#s1-deploy-btn").attr("disabled", "true");
1341
+ $("#s1-deploy-btn").attr("title", "<?php echo DUPX_U::esc_js($agree_msg); ?>");
1342
+ }
1343
+ };
1344
+
1345
+ DUPX.onSafeModeSwitch = function ()
1346
+ {
1347
+ var mode = $('#exe_safe_mode').val();
1348
+ if (mode == 0) {
1349
+ $("#config_mode").removeAttr("disabled");
1350
+ } else if(mode == 1 || mode ==2) {
1351
+ $("#config_mode").val("NEW");
1352
+ $("#config_mode").attr("disabled", true);
1353
+ $('#config_mode option:eq(0)').prop('selected', true)
1354
+ }
1355
+
1356
+ $('#exe-safe-mode').val(mode);
1357
+ };
1358
+
1359
+ //DOCUMENT LOAD
1360
+ $(document).ready(function() {
1361
+ DUPX.DAWS = new Object();
1362
+ DUPX.DAWS.Url = window.location.href + '?is_daws=1&daws_csrf_token=<?php echo urlencode(DUPX_CSRF::generate('daws'));?>';
1363
+ DUPX.DAWS.StatusPeriodInMS = 5000;
1364
+ DUPX.DAWS.PingWorkerTimeInSec = 9;
1365
+ DUPX.DAWS.KickoffWorkerTimeInSec = 6; // Want the initial progress % to come back quicker
1366
+
1367
+ DUPX.DAWS.MaxRetries = 10;
1368
+ DUPX.DAWS.RetryDelayInMs = 8000;
1369
+
1370
+ DUPX.dupArchiveStatusIntervalID = -1;
1371
+ DUPX.DAWS.FailureCount = 0;
1372
+ DUPX.throttleDelay = 0;
1373
+
1374
+ //INIT Routines
1375
+ $("*[data-type='toggle']").click(DUPX.toggleClick);
1376
+ $("#tabs").tabs();
1377
+ DUPX.acceptWarning();
1378
+ <?php
1379
+ $isWindows = DUPX_U::isWindows();
1380
+ if (!$isWindows) {
1381
+ ?>
1382
+ $('#set_file_perms').trigger("click");
1383
+ $('#set_dir_perms').trigger("click");
1384
+ <?php
1385
+ }
1386
+ ?>
1387
+ DUPX.toggleSetupType();
1388
+
1389
+ <?php echo ($arcCheck == 'Fail') ? "$('#s1-area-archive-file-link').trigger('click');" : ""; ?>
1390
+ <?php echo (!$all_success) ? "$('#s1-area-sys-setup-link').trigger('click');" : ""; ?>
1391
+ });
1392
+ </script>
installer/dup-installer/views/view.exception.php CHANGED
@@ -11,6 +11,20 @@
11
  <p>
12
  Message: <b><?php echo DUPX_U::esc_html($exceptionError->getMessage()); ?></b><br>
13
  Please see the <a href="<?php echo $attr_log_link; ?>" target="dup-installer">installer-log.txt</a> file for more details.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
  </p>
15
  <hr>
16
  Trace:
@@ -21,4 +35,4 @@
21
  <div style="text-align:center; margin:10px auto 0px auto">
22
  <!--<input type="button" class="default-btn" onclick="DUPX.hideErrorResult()" value="&laquo; Try Again" /><br/><br/>-->
23
  <i style='font-size:11px'>See online help for more details at <a href='https://snapcreek.com/ticket' target='_blank'>snapcreek.com</a></i>
24
- </div>
11
  <p>
12
  Message: <b><?php echo DUPX_U::esc_html($exceptionError->getMessage()); ?></b><br>
13
  Please see the <a href="<?php echo $attr_log_link; ?>" target="dup-installer">installer-log.txt</a> file for more details.
14
+ <?php
15
+ if ($exceptionError instanceof DupxException) {
16
+ if ($exceptionError->haveFaqLink()) {
17
+ ?>
18
+ <br>
19
+ See FAQ: <a href="<?php echo $exceptionError->getFaqLinkUrl (); ?>" ><?php echo $exceptionError->getFaqLinkLabel(); ?></a>
20
+
21
+ <?php
22
+ }
23
+ if (strlen($longMsg = $exceptionError->getLongMsg())) {
24
+ echo '<br><br>'.$longMsg;
25
+ }
26
+ }
27
+ ?>
28
  </p>
29
  <hr>
30
  Trace:
35
  <div style="text-align:center; margin:10px auto 0px auto">
36
  <!--<input type="button" class="default-btn" onclick="DUPX.hideErrorResult()" value="&laquo; Try Again" /><br/><br/>-->
37
  <i style='font-size:11px'>See online help for more details at <a href='https://snapcreek.com/ticket' target='_blank'>snapcreek.com</a></i>
38
+ </div>
installer/dup-installer/views/view.help.php CHANGED
@@ -1,602 +1,671 @@
1
  <?php
2
- //The help for both pro and lite are shared. Pro is where the master lives. Use the flag below to
3
- //indicate if this help lives in lite or pro
4
- //$pro_version = true;
 
 
 
5
  ?>
6
  <!-- =========================================
7
  HELP FORM -->
8
  <div id="main-help">
9
  <div class="help-online"><br/>
10
- <i class="fa fa-file-text-o"></i> For complete help visit the
11
  <a href="https://snapcreek.com/support/docs/" target="_blank">Online Knowledge-Base</a> <br/>
12
  <small>Features available only in Duplicator Pro are flagged with a <sup>pro</sup> tag.</small>
13
  </div>
14
 
15
- <h2>Installer Security</h2>
16
- <a name="help-s1-init"></a>
17
- <div id="dup-help-installer" class="help-page">
18
- The installer security screen will allow for basic password protection on the installer. The password is set at package creation time. The password
19
- input on this screen must be entered before proceeding with an install. This setting is optional and can be turned on/off via the package creation screens.
20
- <br/><br/>
21
-
22
- If you do not recall the password then login to the site where the package was created and click the details of the package to view the original password.
23
- To validate the password just typed you can toggle the view by clicking on the lock icon. For detail on how to override this setting visit the online FAQ for
24
- <a href="https://snapcreek.com/duplicator/docs/faqs-tech/#faq-installer-030-q" target="_blank">more details</a>.
25
-
26
- <table class="help-opt">
27
- <tr>
28
- <th>Option</th>
29
- <th>Details</th>
30
- </tr>
31
- <tr>
32
- <td>Locked</td>
33
- <td>
34
- "Locked" means a password is protecting each step of the installer. This option is recommended on all installers
35
- that are accessible via a public URL but not required.
36
- </td>
37
- </tr>
38
- <tr>
39
- <td>Unlocked</td>
40
- <td>
41
- "Unlocked" means that if your installer is on a public server that anyone can access it. This is a less secure way to run your installer. If you are running the
42
- installer very quickly then removing all the installer files, then the chances of exposing it is going to be low depending on your sites access history.
43
- <br/><br/>
44
-
45
- While it is not required to have a password set it is recommended. If your URL has little to no traffic or has never been the target of an attack
46
- then running the installer without a password is going to be relatively safe if ran quickly. However, a password is always a good idea. Also, it is
47
- absolutely required and recommended to remove <u>all</u> installer files after installation is completed by logging into the WordPress admin and
48
- following the Duplicator prompts.
49
- </td>
50
- </tr>
51
- </table>
52
- <br/>
53
- Note: Even though the installer has a password protection feature, it should only be used for the short term while the installer is being used. All installer files should and
54
- must be removed after the install is completed. Files should not to be left on the server for any long duration of time to prevent any security related issues.
55
- </div>
 
 
 
 
 
 
 
 
56
 
57
  <!-- ============================================
58
  STEP 1
59
  ============================================== -->
60
- <a class="help-target" name="help-s1"></a>
61
- <h2>Step <span class="step">1</span> of 4: Deployment</h2>
62
- <div id="dup-help-scanner" class="help-page">
63
- There are currently several modes that the installer can be in. The mode will be shown at the top of each screen. Below is an overview of the various modes.
64
-
65
- <table class="help-opt">
66
- <tr>
67
- <th>Option</th>
68
- <th>Details</th>
69
- </tr>
70
- <tr>
71
- <td>Standard Install</td>
72
- <td>
73
- This mode indicates that the installer and archive have been placed into an empty directory and the site is ready for a fresh/new redeployment.
74
- This is the most common mode and the mode that has been around the longest.
75
- </td>
76
- </tr>
77
- <tr>
78
- <td>Standard Install <br/> Database Only</td>
79
- <td>
80
- This mode indicates that the installer and archive were manually moved or transferred to a location and that only the Database will be installed
81
- at this location.
82
- </td>
83
- </tr>
84
- <tr>
85
- <td>Overwrite Install <sup>pro</sup></td>
86
- <td>
87
- This mode indicates that the installer was started in a location that contains an existing site. With this mode <b>the existing site will be overwritten</b> with
88
- the contents of the archive.zip/daf and the database.sql file. This is an advanced option and users should be pre-paired to know that state of their database
89
- and archive site files ahead of time.
90
- </td>
91
- </tr>
92
- <tr>
93
- <td>Overwrite Install <br/> Database Only <sup>pro</sup></td>
94
- <td>
95
- This mode indicates that the installer was started in a location that contains an existing site. With this mode <b>the existing site will be overwritten</b> with
96
- the contents of the database.sql file. This is an advanced option and users should be pre-paired to know that state of their database and site files ahead of time.
97
- </td>
98
- </tr>
99
- </table>
100
- <br/><br/>
101
-
102
-
103
- Step 1 of the installer is separated into four sections for pro and three for lite. Below is an overview of each area:
104
- <br/><br/>
105
-
106
- <h3>Archive</h3>
107
- This is the archive file the installer must use in order to extract the web site files and database. The 'Name' is a unique key that
108
- ties both the archive and installer together. The installer needs the archive file name to match the 'Name' value exactly character for character in order
109
- for this section to get a pass status.
110
- <br/><br/>
111
- If the archive name is ever changed then it should be renamed back to the 'Name' value in order for the installer to properly identify it as part of a
112
- complete package. Additional information such as the archive size and the package notes are mentioned in this section.
113
- <br/><br/>
114
-
115
- <h3>Validation</h3>
116
- This section shows the installers system requirements and notices. All requirements must pass in order to proceed to Step 2. Each requirement will show
117
- a <b class="dupx-pass">Pass</b>/<b class="dupx-fail">Fail</b> status. Notices on the other hand are <u>not</u> required in order to continue with the install.
118
- <br/><br/>
119
-
120
- Notices are simply checks that will help you identify any possible issues that might occur. If this section shows a
121
- <b class="dupx-pass">Good</b>/<b class="dupx-fail">Warn</b> for various checks. Click on the title link and read the overview for how to solve the test.
122
- <br/><br/>
123
-
124
- <h3>Multisite <sup>pro</sup></h3>
125
- The multisite option allows users with a Pro Business or Gold license to perform additional multi-site tasks. All licenses can backup & migrate standalone sites
126
- and full multisite networks. Multisite Plus+ (business and above) adds the ability to install a subsite as a standalone site.
127
- <br/><br/>
128
-
129
- <h3>Options</h3>
130
- The options for step 1 can help better prepare your site should your server need additional settings beyond most general configuration.
131
- <table class="help-opt">
132
- <tr>
133
- <th>Option</th>
134
- <th>Details</th>
135
- </tr>
136
- <tr>
137
- <td colspan="2" class="section">General Options</td>
138
- </tr>
139
- <tr>
140
- <td>Extraction</td>
141
- <td>
142
- <b>Manual Archive Extraction</b><br/>
143
- Set the Extraction value to "Manual Archive Extraction" when the archive file has already been manually extracted on the server. This can be done through your hosts
144
- control panel such as cPanel or by your host directly. This setting can be helpful if you have a large archive files or are having issues with the installer extracting
145
- the file due to timeout issues.
146
- <br/><br/>
147
-
148
- <b>PHP ZipArchive</b><br/>
149
- This extraction method will use the PHP <a href="http://php.net/manual/en/book.zip.php" target="_blank">ZipArchive</a> code to extract the archive zip file.
150
- <br/><br/>
151
-
152
- <b>Shell-Exec Unzip</b><br/>
153
- This extraction method will use the PHP <a href="http://php.net/manual/en/function.shell-exec.php" target="_blank">shell_exec</a> to call the system unzip
154
- command on the server. This is the default mode that is used if its avail on the server.
155
- <br/><br/>
156
-
157
- </td>
158
- </tr>
159
- <tr>
160
- <td>Permissions</td>
161
- <td>
162
- <b>All Files:</b> Check the 'All Files' check-box and enter in the desired <a href="http://php.net/manual/en/function.chmod.php" target="_blank">chmod command</a>
163
- to recursively set the octal value on all the files being extracted. Typically this value is 644 on most servers and hosts.
164
- <br/><br/>
165
-
166
- <b>All Directories:</b> Check the 'All Directories' check-box and enter in the desired <a href="http://php.net/manual/en/function.chmod.php" target="_blank">chmod command</a>
167
- to recursively set octal value on all the directories being extracted. Typically this value is 755 on most servers and hosts.
168
- <br/><br/>
169
- <i>Note: These settings only apply to Linux operating systems</i>
170
- </td>
171
- </tr>
172
- <tr>
173
- <td colspan="2" class="section">Advanced Options</td>
174
- </tr>
175
- <tr>
176
- <td>Safe Mode</td>
177
- <td>
178
- Safe mode is designed to configure the site with specific options at install time to help over come issues that may happen during the install were the site
179
- is having issues. These options should only be used if you run into issues after you have tried to run an install.
180
- <br/><br/>
181
- <b>Basic:</b> This safe mode option will disable all the plugins at install time. When this option is set you will need to re-enable all plugins after the
182
- install has full ran.
183
- <br/><br/>
184
-
185
- <b>Advanced:</b> This option applies all settings used in basic and will also de-activate and reactivate your theme when logging in for the first time. This
186
- options should be used only if the Basic option did not work.
187
- </td>
188
- </tr>
189
- <tr>
190
- <td>Config Files </td>
191
- <td>
192
- When dealing with configuration files (.htaccess, web.config and .user.ini) the installer can apply different modes:
193
- <br/><br/>
194
-
195
- <b>Create New:</b> This is the default recommended option which will create either a new .htaccess or web.config file. The new file is streamlined to help
196
- guarantee no conflicts are created during install. The config files generated with this mode will be simple and basic. The WordFence .user.ini file if
197
- present will be removed.
198
- <br/><br/>
199
-
200
- <b>Restore Original:</b> This option simply renames the htaccess.orig or web.config.orig files to .htaccess or web.config. The *.orig files come from the original
201
- web server where the package was built. Please note this option will cause issues with the install process if the configuration files are not properly setup to
202
- handle the new server environment. This is an advanced option and should only be used if you know how to properly configure your web servers configuration.
203
- <br/><br/>
204
-
205
- <b>Ignore All:</b> This option simply does nothing. No files are backed up, nothing is renamed or created. This advanced option assumes you already have your
206
- config files setup and know how they should behave in the new environment. When the package is build it will always create a htaccess.orig or web.config.orig.
207
- Since these files are already in the archive file they will show up when the archive is extracted.
208
- <br/><br/>
209
-
210
- <b>Additional Notes:</b>
211
- Inside the archive.zip will be a copy of the original .htaccess (Apache) or the web.config (IIS) files that were setup with your packaged site. They are both
212
- renamed to htaccess.orig and web.config.orig. When using either 'Create New' or 'Restore Original' any existing config files will be backed up with a .bak extension.
213
- <i>None of these changes are made until Step 3 is completed, to avoid any issues the .htaccess might cause during the install</i>
214
- <br/><br/>
215
- </td>
216
- </tr>
217
-
218
- <tr>
219
- <td>File Times</td>
220
- <td>When the archive is extracted should it show the current date-time or keep the original time it had when it was built. This setting will be applied to
221
- all files and directories.</td>
222
- </tr>
223
- <tr>
224
- <td>Logging</td>
225
- <td>
226
- The level of detail that will be sent to the log file (installer-log.txt). The recommend setting for most installs should be 'Light'.
227
- Note if you use Debug the amount of data written can be very large. Debug is only recommended for support.
228
- </td>
229
- </tr>
230
-
231
- </table>
232
- <br/><br/>
233
-
234
- <h3>Notices</h3>
235
- To proceed with the install users must check the checkbox labeled " I have read and accept all terms &amp; notices". This means you accept the term of using the software
236
- and are aware of any notices.
237
- <br/><br/>
238
-
239
- </div>
240
- <br/>
241
-
 
 
 
 
242
 
243
  <!-- ============================================
244
  STEP 2
245
  ============================================== -->
246
- <a class="help-target" name="help-s2"></a>
247
- <h2>Step <span class="step">2</span> of 4: Install Database</h2>
248
- <div id="dup-help-step1" class="help-page">
249
-
250
- <h3>Basic/cPanel:</h3>
251
- There are currently two options you can use to perform the database setup. The "Basic" option requires knowledge about the existing server and on most hosts
252
- will require that the database be setup ahead of time. The cPanel option is for hosts that support <a href="http://cpanel.com/" target="_blank">cPanel Software</a>.
253
- This option will automatically show you the existing databases and users on your cPanel server and allow you to create new databases directly
254
- from the installer.
255
- <br/><br/>
256
-
257
- <h3>cPanel Login <sup>pro</sup></h3>
258
- <i>The cPanel connectivity option is only available for Duplicator Pro.</i>
259
- <table class="help-opt">
260
- <tr>
261
- <th>Option</th>
262
- <th>Details</th>
263
- </tr>
264
- <tr>
265
- <td>Host</td>
266
- <td>This should be the primary domain account URL that is associated with your host. Most hosts will require you to register a primary domain name.
267
- This should be the URL that you place in the host field. For example if your primary domain name is "mysite.com" then you would enter in
268
- "https://mysite.com:2083". The port 2038 is the common port number that cPanel works on. If you do not know your primary domain name please contact your
269
- hosting provider or server administrator.</td>
270
- </tr>
271
- <tr>
272
- <td>Username</td>
273
- <td>The cPanel username used to login to your cPanel account. <i>This is <b>not</b> the same thing as your WordPress administrator account</i>.
274
- If your unsure of this name please contact your hosting provider or server administrator.</td>
275
- </tr>
276
- <tr>
277
- <td>Password</td>
278
- <td>The password of the cPanel user</td>
279
- </tr>
280
- <tr>
281
- <td>Troubleshoot</td>
282
- <td>
283
- <b>Common cPanel Connection Issues:</b><br/>
284
- - Your host does not use <a href="http://cpanel.com/" target="_blank">cPanel Software</a> <br/>
285
- - Your host has disabled cPanel API access <br/>
286
- - Your host has configured cPanel to work differently (please contact your host) <br/>
287
- - View a list of valid cPanel <a href='https://snapcreek.com/wordpress-hosting/' target='_blank'>Supported Hosts</a>
288
- </td>
289
- </tr>
290
- </table>
291
- <br/><br/>
292
-
293
- <!-- DATABASE SETUP-->
294
- <h3>Setup</h3>
295
- The database setup options allow you to connect to an existing database or in the case of cPanel connect or create a new database.
296
- <table class="help-opt">
297
- <tr>
298
- <th>Option</th>
299
- <th>Details</th>
300
- </tr>
301
- <tr>
302
- <td>Action</td>
303
- <td>
304
- <b>Create New Database:</b> Will attempt to create a new database if it does not exist. When using the 'Basic' option this option will not work on many
305
- hosting providers as the ability to create new databases is normally locked down. If the database does not exist then you will need to login to your
306
- control panel and create the database. If your host supports 'cPanel' then you can use this option to create a new database after logging in via your
307
- cPanel account.
308
- <br/><br/>
309
-
310
- <b>Connect and Remove All Data:</b> This options will DELETE all tables in the database you are connecting to. Please make sure you have
311
- backups of all your data before using an portion of the installer, as this option WILL remove all data.
312
- <br/><br/>
313
-
314
- <b>Connect and Backup Any Existing Data:</b><sup>pro</sup> This options will RENAME all tables in the database you are connecting to with a prefix of
315
- "<?php echo $GLOBALS['DB_RENAME_PREFIX'] ?>".
316
- <br/><br/>
317
-
318
- <b>Manual SQL Execution:</b><sup>pro</sup> This options requires that you manually run your own SQL import to an existing database before running the installer.
319
- When this action is selected the dup-database__[hash].sql file found inside the dup-installer folder of the archive.zip file will NOT be ran. The database your connecting to should already
320
- be a valid WordPress installed database. This option is viable when you need to run advanced search and replace options on the database.
321
- <br/><br/>
322
-
323
- </td>
324
- </tr>
325
- <tr>
326
- <td>Host</td>
327
- <td>The name of the host server that the database resides on. Many times this will be 'localhost', however each hosting provider will have it's own naming
328
- convention please check with your server administrator or host to valid for sure the name needed. To add a port number just append it to the host i.e.
329
- 'localhost:3306'.</td>
330
- </tr>
331
- <tr>
332
- <td>Database</td>
333
- <td>The name of the database to which this installation will connect and install the new tables and data into. Some hosts will require a prefix while others
334
- do not. Be sure to know exactly how your host requires the database name to be entered.</td>
335
- </tr>
336
- <tr>
337
- <td>User</td>
338
- <td>The name of a MySQL database server user. This is special account that has privileges to access a database and can read from or write to that database.
339
- <i>This is <b>not</b> the same thing as your WordPress administrator account</i>.</td>
340
- </tr>
341
- <tr>
342
- <td>Password</td>
343
- <td>The password of the MySQL database server user.</td>
344
- </tr>
345
-
346
- </table>
347
- <br/><br/>
348
-
349
- <!-- OPTIONS-->
350
- <h3>Options</h3>
351
- <table class="help-opt">
352
- <tr>
353
- <th>Option</th>
354
- <th>Details</th>
355
- </tr>
356
- <tr>
357
- <td>Prefix<sup>pro*</sup></td>
358
- <td>By default, databases are prefixed with the cPanel account's username (for example, myusername_databasename). However you can ignore this option if
359
- your host does not use the default cPanel username prefix schema. Check the 'Ignore cPanel Prefix' and the username prefixes will be ignored.
360
- This will still require you to enter in the cPanels required setup prefix if they require one. The checkbox will be set to read-only if your host has
361
- disabled prefix settings. Please see your host full requirements when using the cPanel options.</td>
362
- </tr>
363
- <tr>
364
- <td>Legacy</td>
365
- <td>When creating a database table, the Mysql version being used may not support the collation type of the Mysql version where the table was created.
366
- In this scenario, the installer will fallback to a legacy collation type to try and create the table. This value should only be checked if you receive an error when
367
- testing the database.
368
- <br/><br/>
369
- For example, if the database was created on MySQL 5.7 and the tables collation type was 'utf8mb4_unicode_520_ci', however your trying to run the installer
370
- on an older MySQL 5.5 engine that does not support that type then an error will be thrown. If this option is checked then the legacy setting will try to
371
- use 'utf8mb4_unicode_520', then 'utf8mb4', then 'utf8' and so on until it runs out of options.
372
- <br/><br/>
373
- For more information about this feature see the online FAQ question titled
374
- <a href="https://snapcreek.com/duplicator/docs/faqs-tech/#faq-installer-110-q" target="_blank">"What is compatibility mode & 'unknown collation' errors"</a>
375
- </td>
376
- </tr>
377
- <tr>
378
- <td>Spacing</td>
379
- <td>The process will remove utf8 characters represented as 'xC2' 'xA0' and replace with a uniform space. Use this option if you find strange question
380
- marks in you posts</td>
381
- </tr>
382
- <tr>
383
- <td>Mode</td>
384
- <td>The MySQL mode option will allow you to set the mode for this session. It is very useful when running into conversion issues. For a full overview please
385
- see the <a href="https://dev.mysql.com/doc/refman/5.7/en/sql-mode.html" target="_blank">MySQL mode documentation</a> specific to your version.</td>
386
- </tr>
387
- <tr>
388
- <td>Charset</td>
389
- <td>When the database is populated from the SQL script it will use this value as part of its connection. Only change this value if you know what your
390
- databases character set should be.</td>
391
- </tr>
392
- <tr>
393
- <td>Collation</td>
394
- <td>When the database is populated from the SQL script it will use this value as part of its connection. Only change this value if you know what your
395
- databases collation set should be.</td>
396
- </tr>
397
- </table>
398
- <sup>*cPanel Only Option</sup>
399
- <br/><br/>
400
-
401
- <h3>Validation</h3>
402
- Testing the database connection is important and can help isolate possible issues that may arise with database version and compatibility issues.
403
-
404
- <table class="help-opt">
405
- <tr>
406
- <th>Option</th>
407
- <th>Details</th>
408
- </tr>
409
- <tr>
410
- <td>Test<br/>Database</td>
411
- <td>
412
- The 'Test Database' button will help validate if the connection parameters are correct for this server and help with details about any issues
413
- that may arise.
414
- </td>
415
- </tr>
416
- <tr>
417
- <td>Troubleshoot</td>
418
- <td>
419
- <b>Common Database Connection Issues:</b><br/>
420
- - Double check case sensitive values 'User', 'Password' &amp; the 'Database Name' <br/>
421
- - Validate the database and database user exist on this server <br/>
422
- - Check if the database user has the correct permission levels to this database <br/>
423
- - The host 'localhost' may not work on all hosting providers <br/>
424
- - Contact your hosting provider for the exact required parameters <br/>
425
- - Visit the online resources 'Common FAQ page' <br/>
426
-
427
- </td>
428
- </tr>
429
- </table>
430
- <br/><br/>
431
- </div><br/>
432
-
 
 
 
 
 
 
433
 
434
  <!-- ============================================
435
  STEP 3
436
  ============================================== -->
437
- <a class="help-target" name="help-s3"></a>
438
- <h2>Step <span class="step">3</span> of 4: Update Data</h2>
439
- <div id="dup-help-step2" class="help-page">
440
-
441
- <!-- SETTINGS-->
442
- <h3>New Settings</h3>
443
- These are the new values (URL, Path and Title) you can update for the new location at which your site will be installed at.
444
- <br/><br/>
445
-
446
- <h3>Replace <sup>pro</sup></h3>
447
- This section will allow you to add as many custom search and replace items that you would like. For example you can search for other URLs to replace. Please use high
448
- caution when using this feature as it can have unintended consequences as it will search the entire database. It is recommended to only use highly unique items such as
449
- full URL or file paths with this option.
450
- <br/><br/>
451
-
452
- <!-- ADVANCED OPTS -->
453
- <h3>Options</h3>
454
- <table class="help-opt">
455
- <tr>
456
- <th>Option</th>
457
- <th>Details</th>
458
- </tr>
459
- <tr>
460
- <td colspan="2" class="section">New Admin Account</td>
461
- </tr>
462
- <tr>
463
- <td>Username</td>
464
- <td>A new WordPress username to create. This will create a new WordPress administrator account. Please note that usernames are not changeable from the within the UI.</td>
465
- </tr>
466
- <tr>
467
- <td>Password</td>
468
- <td>The new password for the new user. Must be at least 6 characters long.</td>
469
- </tr>
470
- <tr>
471
- <td colspan="2" class="section">Scan Options</td>
472
- </tr>
473
- <tr>
474
- <td>Cleanup <sup>pro</sup></td>
475
- <td>The checkbox labeled Remove schedules &amp; storage endpoints will empty the Duplicator schedule and storage settings. This is recommended to keep enabled so that you do not have unwanted schedules and storage options enabled.</td>
476
- </tr>
477
- <tr>
478
- <td>Old URL</td>
479
- <td>The old URL of the original values that the package was created with. These values should not be changed, unless you know the underlying reasons</td>
480
- </tr>
481
- <tr>
482
- <td>Old Path</td>
483
- <td>The old path of the original values that the package was created with. These values should not be changed, unless you know the underlying reasons</td>
484
- </tr>
485
- <tr>
486
- <td>Site URL</td>
487
- <td> For details see WordPress <a href="http://codex.wordpress.org/Changing_The_Site_URL" target="_blank">Site URL</a> &amp; <a href="http://codex.wordpress.org/Giving_WordPress_Its_Own_Directory" target="_blank">Alternate Directory</a>. If you're not sure about this value then leave it the same as the new settings URL.</td>
488
- </tr>
489
- <tr>
490
- <td>Scan Tables</td>
491
- <td>Select the tables to be updated. This process will update all of the 'Old Settings' with the 'New Settings'. Hold down the 'ctrl key' to select/deselect multiple.</td>
492
- </tr>
493
- <tr>
494
- <td>Activate Plugins</td>
495
- <td>These plug-ins are the plug-ins that were activated when the package was created and represent the plug-ins that will be activated after the install.</td>
496
- </tr>
497
- <tr>
498
- <td>Full Search</td>
499
- <td>Full search forces a scan of every single cell in the database. If it is not checked then only text based columns are searched which makes the update process much faster.
500
- Use this option if you have issues with data not updating correctly.</td>
501
- </tr>
502
- <tr>
503
- <td>Post GUID</td>
504
- <td>If your moving a site keep this value checked. For more details see the <a href="http://codex.wordpress.org/Changing_The_Site_URL#Important_GUID_Note" target="_blank">notes on GUIDS</a>. Changing values in the posts table GUID column can change RSS readers to evaluate that the posts are new and may show them in feeds again.</td>
505
- </tr>
506
- <tr>
507
- <td colspan="2" class="section">WP-Config File</td>
508
- </tr>
509
- <tr>
510
- <td>Config SSL</td>
511
- <td>Turn off SSL support for WordPress. This sets FORCE_SSL_ADMIN in your wp-config file to false if true, otherwise it will create the setting if not set. The "Enforce on Login"
512
- will turn off SSL support for WordPress Logins.</td>
513
- </tr>
514
- <tr>
515
- <td>Config Cache</td>
516
- <td>Turn off Cache support for WordPress. This sets WP_CACHE in your wp-config file to false if true, otherwise it will create the setting if not set. The "Keep Home Path"
517
- sets WPCACHEHOME in your wp-config file to nothing if true, otherwise nothing is changed.</td>
518
- </tr>
519
- </table>
520
- <br/><br/>
521
- </div><br/>
522
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
523
 
524
  <!-- ============================================
525
  STEP 4
526
  ============================================== -->
527
- <a class="help-target" name="help-s4"></a>
528
- <h2>Step <span class="step">4</span> of 4: Test Site</h2>
529
- <div id="dup-help-step3" class="help-page">
530
- <h3>Final Steps</h3>
531
-
532
- <b>Review Install Report</b><br/>
533
- The install report is designed to give you a synopsis of the possible errors and warnings that may exist after the installation is completed.
534
- <br/><br/>
535
-
536
- <b>Test Site</b><br/>
537
- After the install is complete run through your entire site and test all pages and posts.
538
- <br/><br/>
539
-
540
- <b>Final Security Cleanup</b><br/>
541
- When completed with the installation please delete all installation files. <b>Leaving these files on your server can be a security risk!</b> You can remove
542
- all these files by logging into your WordPress admin and following the remove notification links or by deleting these file manually. Be sure these files/directories are removed. Optionally
543
- it is also recommended to remove the archive.zip/daf file.
544
- <ul>
545
- <li>dup-installer</li>
546
- <li>installer.php</li>
547
- <li>installer-backup.php</li>
548
- <li>dup-installer-bootlog__[HASH].txt</li>
549
- <li>archive.zip/daf</li>
550
- </ul>
551
- <br/><br/>
552
-
553
- </div>
554
-
555
-
556
- <a class="help-target" name="help-s5"></a>
557
- <h2>Troubleshooting Tips</h2>
558
- <div id="troubleshoot" class="help-page">
559
-
560
- <div style="padding: 0px 10px 10px 10px;">
561
- <b>Common Quick Fix Issues:</b>
562
- <ul>
563
- <li>Use an <a href='https://snapcreek.com/wordpress-hosting/' target='_blank'>approved hosting provider</a></li>
564
- <li>Validate directory and file permissions (see below)</li>
565
- <li>Validate web server configuration file (see below)</li>
566
- <li>Clear your browsers cache</li>
567
- <li>Deactivate and reactivate all plugins</li>
568
- <li>Resave a plugins settings if it reports errors</li>
569
- <li>Make sure your root directory is empty</li>
570
- </ul>
571
-
572
- <b>Permissions:</b><br/>
573
- Not all operating systems are alike. Therefore, when you move a package (zip file) from one location to another the file and directory permissions may not always stick. If this is the case then check your WordPress directories and make sure it's permissions are set to 755. For files make sure the permissions are set to 644 (this does not apply to windows servers). Also pay attention to the owner/group attributes. For a full overview of the correct file changes see the <a href='http://codex.wordpress.org/Hardening_WordPress#File_permissions' target='_blank'>WordPress permissions codex</a>
574
- <br/><br/>
575
-
576
- <b>Web server configuration files:</b><br/>
577
- For Apache web server the root .htaccess file was copied to htaccess.orig. A new stripped down .htaccess file was created to help simplify access issues. For IIS web server the web.config file was copied to web.config.orig, however no new web.config file was created. If you have not altered this file manually then resaving your permalinks and resaving your plugins should resolve most all changes that were made to the root web configuration file. If your still experiencing issues then open the .orig file and do a compare to see what changes need to be made. <br/><br/><b>Plugin Notes:</b><br/> It's impossible to know how all 3rd party plugins function. The Duplicator attempts to fix the new install URL for settings stored in the WordPress options table. Please validate that all plugins retained there settings after installing. If you experience issues try to bulk deactivate all plugins then bulk reactivate them on your new duplicated site. If you run into issues were a plugin does not retain its data then try to resave the plugins settings.
578
- <br/><br/>
579
-
580
- <b>Cache Systems:</b><br/>
581
- Any type of cache system such as Super Cache, W3 Cache, etc. should be emptied before you create a package. Another alternative is to include the cache directory in the directory exclusion path list found in the options dialog. Including a directory such as \pathtowordpress\wp-content\w3tc\ (the w3 Total Cache directory) will exclude this directory from being packaged. In is highly recommended to always perform a cache empty when you first fire up your new site even if you excluded your cache directory.
582
- <br/><br/>
583
-
584
- <b>Trying Again:</b><br/>
585
- If you need to retry and reinstall this package you can easily run the process again by deleting all files except the installer and package file and then browse to the installer again.
586
- <br/><br/>
587
 
588
- <b>Additional Notes:</b><br/>
589
- If you have made changes to your PHP files directly this might have an impact on your duplicated site. Be sure all changes made will correspond to the sites new location.
590
- Only the package (zip file) and the installer (php file) should be in the directory where you are installing the site. Please read through our knowledge base before submitting any issues.
591
- If you have a large log file that needs evaluated please email the file, or attach it to a help ticket.
592
- <br/><br/>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
593
 
594
- </div>
595
 
596
  </div>
597
 
598
- <div style="text-align:center">For additional help please visit the <a href="https://snapcreek.com/support/docs/" target="_blank">online resources</a></div>
599
-
600
- <br/><br/>
601
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
602
  <!-- END OF VIEW HELP -->
1
  <?php
2
+ //The help for both pro and lite are shared. Pro is where the master lives. Use the flag below to
3
+ //indicate if this help lives in lite or pro
4
+ //$pro_version = true;
5
+
6
+ $open_section = filter_input(INPUT_GET, 'open_section', FILTER_SANITIZE_STRING, array('options' => array('default' => '')));
7
+
8
  ?>
9
  <!-- =========================================
10
  HELP FORM -->
11
  <div id="main-help">
12
  <div class="help-online"><br/>
13
+ <i class="far fa-file-alt fa-sm"></i> For complete help visit the
14
  <a href="https://snapcreek.com/support/docs/" target="_blank">Online Knowledge-Base</a> <br/>
15
  <small>Features available only in Duplicator Pro are flagged with a <sup>pro</sup> tag.</small>
16
  </div>
17
 
18
+ <?php
19
+ $sectionId = 'section-security';
20
+ $expandClass = $sectionId == $open_section ? 'open' : 'close';
21
+ ?>
22
+ <section id="<?php echo $sectionId; ?>" class="expandable <?php echo $expandClass; ?>" >
23
+ <h2 class="header expand-header">Installer Security</h2>
24
+ <div class="content" >
25
+ <a name="help-s1-init"></a>
26
+ <div id="dup-help-installer" class="help-page">
27
+ The installer security screen will allow for basic password protection on the installer. The password is set at package creation time. The password
28
+ input on this screen must be entered before proceeding with an install. This setting is optional and can be turned on/off via the package creation screens.
29
+ <br/><br/>
30
+
31
+ If you do not recall the password then login to the site where the package was created and click the details of the package to view the original password.
32
+ To validate the password just typed you can toggle the view by clicking on the lock icon. For detail on how to override this setting visit the online FAQ for
33
+ <a href="https://snapcreek.com/duplicator/docs/faqs-tech/#faq-installer-030-q" target="_blankopen_section">more details</a>.
34
+
35
+ <table class="help-opt">
36
+ <tr>
37
+ <th>Option</th>
38
+ <th>Details</th>
39
+ </tr>
40
+ <tr>
41
+ <td>Locked</td>
42
+ <td>
43
+ "Locked" means a password is protecting each step of the installer. This option is recommended on all installers
44
+ that are accessible via a public URL but not required.
45
+ </td>
46
+ </tr>
47
+ <tr>
48
+ <td>Unlocked</td>
49
+ <td>
50
+ "Unlocked" means that if your installer is on a public server that anyone can access it. This is a less secure way to run your installer. If you are running the
51
+ installer very quickly then removing all the installer files, then the chances of exposing it is going to be low depending on your sites access history.
52
+ <br/><br/>
53
+
54
+ While it is not required to have a password set it is recommended. If your URL has little to no traffic or has never been the target of an attack
55
+ then running the installer without a password is going to be relatively safe if ran quickly. However, a password is always a good idea. Also, it is
56
+ absolutely required and recommended to remove <u>all</u> installer files after installation is completed by logging into the WordPress admin and
57
+ following the Duplicator prompts.
58
+ </td>
59
+ </tr>
60
+ </table>
61
+ <br/>
62
+ Note: Even though the installer has a password protection feature, it should only be used for the short term while the installer is being used. All installer files should and
63
+ must be removed after the install is completed. Files should not to be left on the server for any long duration of time to prevent any security related issues.
64
+ </div>
65
+ </div>
66
+ </section>
67
 
68
  <!-- ============================================
69
  STEP 1
70
  ============================================== -->
71
+ <?php
72
+ $sectionId = 'section-step-1';
73
+ $expandClass = $sectionId == $open_section ? 'open' : 'close';
74
+ ?>
75
+ <section id="<?php echo $sectionId; ?>" class="expandable <?php echo $expandClass; ?>" >
76
+ <h2 class="header expand-header">Step <span class="step">1</span> of 4: Deployment</h2>
77
+ <div class="content" >
78
+ <a class="help-target" name="help-s1"></a>
79
+ <div id="dup-help-scanner" class="help-page">
80
+ There are currently several modes that the installer can be in. The mode will be shown at the top of each screen. Below is an overview of the various modes.
81
+
82
+ <table class="help-opt">
83
+ <tr>
84
+ <th>Option</th>
85
+ <th>Details</th>
86
+ </tr>
87
+ <tr>
88
+ <td>Standard Install</td>
89
+ <td>
90
+ This mode indicates that the installer and archive have been placed into an empty directory and the site is ready for a fresh/new redeployment.
91
+ This is the most common mode and the mode that has been around the longest.
92
+ </td>
93
+ </tr>
94
+ <tr>
95
+ <td>Standard Install <br/> Database Only</td>
96
+ <td>
97
+ This mode indicates that the installer and archive were manually moved or transferred to a location and that only the Database will be installed
98
+ at this location.
99
+ </td>
100
+ </tr>
101
+ <tr>
102
+ <td>Overwrite Install <sup>pro</sup></td>
103
+ <td>
104
+ This mode indicates that the installer was started in a location that contains an existing site. With this mode <b>the existing site will be overwritten</b> with
105
+ the contents of the archive.zip/daf and the database.sql file. This is an advanced option and users should be pre-paired to know that state of their database
106
+ and archive site files ahead of time.
107
+ </td>
108
+ </tr>
109
+ <tr>
110
+ <td>Overwrite Install <br/> Database Only <sup>pro</sup></td>
111
+ <td>
112
+ This mode indicates that the installer was started in a location that contains an existing site. With this mode <b>the existing site will be overwritten</b> with
113
+ the contents of the database.sql file. This is an advanced option and users should be pre-paired to know that state of their database and site files ahead of time.
114
+ </td>
115
+ </tr>
116
+ </table>
117
+ <br/><br/>
118
+
119
+
120
+ Step 1 of the installer is separated into four sections for pro and three for lite. Below is an overview of each area:
121
+ <br/><br/>
122
+
123
+ <h3>Archive</h3>
124
+ This is the archive file the installer must use in order to extract the web site files and database. The 'Name' is a unique key that
125
+ ties both the archive and installer together. The installer needs the archive file name to match the 'Name' value exactly character for character in order
126
+ for this section to get a pass status.
127
+ <br/><br/>
128
+ If the archive name is ever changed then it should be renamed back to the 'Name' value in order for the installer to properly identify it as part of a
129
+ complete package. Additional information such as the archive size and the package notes are mentioned in this section.
130
+ <br/><br/>
131
+
132
+ <h3>Validation</h3>
133
+ This section shows the installers system requirements and notices. All requirements must pass in order to proceed to Step 2. Each requirement will show
134
+ a <b class="dupx-pass">Pass</b>/<b class="dupx-fail">Fail</b> status. Notices on the other hand are <u>not</u> required in order to continue with the install.
135
+ <br/><br/>
136
+
137
+ Notices are simply checks that will help you identify any possible issues that might occur. If this section shows a
138
+ <b class="dupx-pass">Good</b>/<b class="dupx-fail">Warn</b> for various checks. Click on the title link and read the overview for how to solve the test.
139
+ <br/><br/>
140
+
141
+ <h3>Multisite <sup>pro</sup></h3>
142
+ The multisite option allows users with a Pro Business or Gold license to perform additional multi-site tasks. All licenses can backup & migrate standalone sites
143
+ and full multisite networks. Multisite Plus+ (business and above) adds the ability to install a subsite as a standalone site.
144
+ <br/><br/>
145
+
146
+ <h3>Options</h3>
147
+ The options for step 1 can help better prepare your site should your server need additional settings beyond most general configuration.
148
+ <table class="help-opt">
149
+ <tr>
150
+ <th>Option</th>
151
+ <th>Details</th>
152
+ </tr>
153
+ <tr>
154
+ <td colspan="2" class="section">General Options</td>
155
+ </tr>
156
+ <tr>
157
+ <td>Extraction</td>
158
+ <td>
159
+ <b>Manual Archive Extraction</b><br/>
160
+ Set the Extraction value to "Manual Archive Extraction" when the archive file has already been manually extracted on the server. This can be done through your hosts
161
+ control panel such as cPanel or by your host directly. This setting can be helpful if you have a large archive files or are having issues with the installer extracting
162
+ the file due to timeout issues.
163
+ <br/><br/>
164
+
165
+ <b>PHP ZipArchive</b><br/>
166
+ This extraction method will use the PHP <a href="http://php.net/manual/en/book.zip.php" target="_blank">ZipArchive</a> code to extract the archive zip file.
167
+ <br/><br/>
168
+
169
+ <b>Shell-Exec Unzip</b><br/>
170
+ This extraction method will use the PHP <a href="http://php.net/manual/en/function.shell-exec.php" target="_blank">shell_exec</a> to call the system unzip
171
+ command on the server. This is the default mode that is used if its avail on the server.
172
+ <br/><br/>
173
+
174
+ </td>
175
+ </tr>
176
+ <tr>
177
+ <td>Permissions</td>
178
+ <td>
179
+ <b>All Files:</b> Check the 'All Files' check-box and enter in the desired <a href="http://php.net/manual/en/function.chmod.php" target="_blank">chmod command</a>
180
+ to recursively set the octal value on all the files being extracted. Typically this value is 644 on most servers and hosts.
181
+ <br/><br/>
182
+
183
+ <b>All Directories:</b> Check the 'All Directories' check-box and enter in the desired <a href="http://php.net/manual/en/function.chmod.php" target="_blank">chmod command</a>
184
+ to recursively set octal value on all the directories being extracted. Typically this value is 755 on most servers and hosts.
185
+ <br/><br/>
186
+ <i>Note: These settings only apply to Linux operating systems</i>
187
+ </td>
188
+ </tr>
189
+ <tr>
190
+ <td colspan="2" class="section">Advanced Options</td>
191
+ </tr>
192
+ <tr>
193
+ <td>Safe Mode</td>
194
+ <td>
195
+ Safe mode is designed to configure the site with specific options at install time to help over come issues that may happen during the install were the site
196
+ is having issues. These options should only be used if you run into issues after you have tried to run an install.
197
+ <br/><br/>
198
+ <b>Basic:</b> This safe mode option will disable all the plugins at install time. When this option is set you will need to re-enable all plugins after the
199
+ install has full ran.
200
+ <br/><br/>
201
+
202
+ <b>Advanced:</b> This option applies all settings used in basic and will also de-activate and reactivate your theme when logging in for the first time. This
203
+ options should be used only if the Basic option did not work.
204
+ </td>
205
+ </tr>
206
+ <tr>
207
+ <td>Config Files </td>
208
+ <td>
209
+ When dealing with configuration files (.htaccess, web.config and .user.ini) the installer can apply different modes:
210
+ <br/><br/>
211
+
212
+ <b>Create New:</b> This is the default recommended option which will create either a new .htaccess or web.config file. The new file is streamlined to help
213
+ guarantee no conflicts are created during install. The config files generated with this mode will be simple and basic. The WordFence .user.ini file if
214
+ present will be removed.
215
+ <br/><br/>
216
+
217
+ <b>Restore Original:</b> This option simply renames the htaccess.orig or web.config.orig files to .htaccess or web.config. The *.orig files come from the original
218
+ web server where the package was built. Please note this option will cause issues with the install process if the configuration files are not properly setup to
219
+ handle the new server environment. This is an advanced option and should only be used if you know how to properly configure your web servers configuration.
220
+ <br/><br/>
221
+
222
+ <b>Ignore All:</b> This option simply does nothing. No files are backed up, nothing is renamed or created. This advanced option assumes you already have your
223
+ config files setup and know how they should behave in the new environment. When the package is build it will always create a htaccess.orig or web.config.orig.
224
+ Since these files are already in the archive file they will show up when the archive is extracted.
225
+ <br/><br/>
226
+
227
+ <b>Additional Notes:</b>
228
+ Inside the archive.zip will be a copy of the original .htaccess (Apache) or the web.config (IIS) files that were setup with your packaged site. They are both
229
+ renamed to htaccess.orig and web.config.orig. When using either 'Create New' or 'Restore Original' any existing config files will be backed up with a .bak extension.
230
+ <i>None of these changes are made until Step 3 is completed, to avoid any issues the .htaccess might cause during the install</i>
231
+ <br/><br/>
232
+ </td>
233
+ </tr>
234
+
235
+ <tr>
236
+ <td>File Times</td>
237
+ <td>When the archive is extracted should it show the current date-time or keep the original time it had when it was built. This setting will be applied to
238
+ all files and directories.</td>
239
+ </tr>
240
+ <tr>
241
+ <td>Logging</td>
242
+ <td>
243
+ The level of detail that will be sent to the log file (installer-log.txt). The recommend setting for most installs should be 'Light'.
244
+ Note if you use Debug the amount of data written can be very large. Debug is only recommended for support.
245
+ </td>
246
+ </tr>
247
+
248
+ </table>
249
+ <br/><br/>
250
+
251
+ <h3>Notices</h3>
252
+ To proceed with the install users must check the checkbox labeled " I have read and accept all terms &amp; notices". This means you accept the term of using the software
253
+ and are aware of any notices.
254
+ </div>
255
+ </div>
256
+ </section>
257
 
258
  <!-- ============================================
259
  STEP 2
260
  ============================================== -->
261
+ <?php
262
+ $sectionId = 'section-step-2';
263
+ $expandClass = $sectionId == $open_section ? 'open' : 'close';
264
+ ?>
265
+ <section id="<?php echo $sectionId; ?>" class="expandable <?php echo $expandClass; ?>" >
266
+ <h2 class="header expand-header">Step <span class="step">2</span> of 4: Install Database</h2>
267
+ <div class="content" >
268
+ <a class="help-target" name="help-s2"></a>
269
+ <div id="dup-help-step1" class="help-page">
270
+
271
+ <h3>Basic/cPanel:</h3>
272
+ There are currently two options you can use to perform the database setup. The "Basic" option requires knowledge about the existing server and on most hosts
273
+ will require that the database be setup ahead of time. The cPanel option is for hosts that support <a href="http://cpanel.com/" target="_blank">cPanel Software</a>.
274
+ This option will automatically show you the existing databases and users on your cPanel server and allow you to create new databases directly
275
+ from the installer.
276
+ <br/><br/>
277
+
278
+ <h3>cPanel Login <sup>pro</sup></h3>
279
+ <i>The cPanel connectivity option is only available for Duplicator Pro.</i>
280
+ <table class="help-opt">
281
+ <tr>
282
+ <th>Option</th>
283
+ <th>Details</th>
284
+ </tr>
285
+ <tr>
286
+ <td>Host</td>
287
+ <td>This should be the primary domain account URL that is associated with your host. Most hosts will require you to register a primary domain name.
288
+ This should be the URL that you place in the host field. For example if your primary domain name is "mysite.com" then you would enter in
289
+ "https://mysite.com:2083". The port 2038 is the common port number that cPanel works on. If you do not know your primary domain name please contact your
290
+ hosting provider or server administrator.</td>
291
+ </tr>
292
+ <tr>
293
+ <td>Username</td>
294
+ <td>The cPanel username used to login to your cPanel account. <i>This is <b>not</b> the same thing as your WordPress administrator account</i>.
295
+ If your unsure of this name please contact your hosting provider or server administrator.</td>
296
+ </tr>
297
+ <tr>
298
+ <td>Password</td>
299
+ <td>The password of the cPanel user</td>
300
+ </tr>
301
+ <tr>
302
+ <td>Troubleshoot</td>
303
+ <td>
304
+ <b>Common cPanel Connection Issues:</b><br/>
305
+ - Your host does not use <a href="http://cpanel.com/" target="_blank">cPanel Software</a> <br/>
306
+ - Your host has disabled cPanel API access <br/>
307
+ - Your host has configured cPanel to work differently (please contact your host) <br/>
308
+ - View a list of valid cPanel <a href='https://snapcreek.com/wordpress-hosting/' target='_blank'>Supported Hosts</a>
309
+ </td>
310
+ </tr>
311
+ </table>
312
+ <br/><br/>
313
+
314
+ <!-- DATABASE SETUP-->
315
+ <h3>Setup</h3>
316
+ The database setup options allow you to connect to an existing database or in the case of cPanel connect or create a new database.
317
+ <table class="help-opt">
318
+ <tr>
319
+ <th>Option</th>
320
+ <th>Details</th>
321
+ </tr>
322
+ <tr>
323
+ <td>Action</td>
324
+ <td>
325
+ <b>Create New Database:</b> Will attempt to create a new database if it does not exist. When using the 'Basic' option this option will not work on many
326
+ hosting providers as the ability to create new databases is normally locked down. If the database does not exist then you will need to login to your
327
+ control panel and create the database. If your host supports 'cPanel' then you can use this option to create a new database after logging in via your
328
+ cPanel account.
329
+ <br/><br/>
330
+
331
+ <b>Connect and Remove All Data:</b> This options will DELETE all tables in the database you are connecting to. Please make sure you have
332
+ backups of all your data before using an portion of the installer, as this option WILL remove all data.
333
+ <br/><br/>
334
+
335
+ <b>Connect and Backup Any Existing Data:</b><sup>pro</sup> This options will RENAME all tables in the database you are connecting to with a prefix of
336
+ "<?php echo $GLOBALS['DB_RENAME_PREFIX'] ?>".
337
+ <br/><br/>
338
+
339
+ <b>Manual SQL Execution:</b><sup>pro</sup> This options requires that you manually run your own SQL import to an existing database before running the installer.
340
+ When this action is selected the dup-database__[hash].sql file found inside the dup-installer folder of the archive.zip file will NOT be ran. The database your connecting to should already
341
+ be a valid WordPress installed database. This option is viable when you need to run advanced search and replace options on the database.
342
+ <br/><br/>
343
+
344
+ </td>
345
+ </tr>
346
+ <tr>
347
+ <td>Host</td>
348
+ <td>The name of the host server that the database resides on. Many times this will be 'localhost', however each hosting provider will have it's own naming
349
+ convention please check with your server administrator or host to valid for sure the name needed. To add a port number just append it to the host i.e.
350
+ 'localhost:3306'.</td>
351
+ </tr>
352
+ <tr>
353
+ <td>Database</td>
354
+ <td>The name of the database to which this installation will connect and install the new tables and data into. Some hosts will require a prefix while others
355
+ do not. Be sure to know exactly how your host requires the database name to be entered.</td>
356
+ </tr>
357
+ <tr>
358
+ <td>User</td>
359
+ <td>The name of a MySQL database server user. This is special account that has privileges to access a database and can read from or write to that database.
360
+ <i>This is <b>not</b> the same thing as your WordPress administrator account</i>.</td>
361
+ </tr>
362
+ <tr>
363
+ <td>Password</td>
364
+ <td>The password of the MySQL database server user.</td>
365
+ </tr>
366
+
367
+ </table>
368
+ <br/><br/>
369
+
370
+ <!-- OPTIONS-->
371
+ <h3>Options</h3>
372
+ <table class="help-opt">
373
+ <tr>
374
+ <th>Option</th>
375
+ <th>Details</th>
376
+ </tr>
377
+ <tr>
378
+ <td>Prefix<sup>pro*</sup></td>
379
+ <td>By default, databases are prefixed with the cPanel account's username (for example, myusername_databasename). However you can ignore this option if
380
+ your host does not use the default cPanel username prefix schema. Check the 'Ignore cPanel Prefix' and the username prefixes will be ignored.
381
+ This will still require you to enter in the cPanels required setup prefix if they require one. The checkbox will be set to read-only if your host has
382
+ disabled prefix settings. Please see your host full requirements when using the cPanel options.</td>
383
+ </tr>
384
+ <tr>
385
+ <td>Legacy</td>
386
+ <td>When creating a database table, the Mysql version being used may not support the collation type of the Mysql version where the table was created.
387
+ In this scenario, the installer will fallback to a legacy collation type to try and create the table. This value should only be checked if you receive an error when
388
+ testing the database.
389
+ <br/><br/>
390
+ For example, if the database was created on MySQL 5.7 and the tables collation type was 'utf8mb4_unicode_520_ci', however your trying to run the installer
391
+ on an older MySQL 5.5 engine that does not support that type then an error will be thrown. If this option is checked then the legacy setting will try to
392
+ use 'utf8mb4_unicode_520', then 'utf8mb4', then 'utf8' and so on until it runs out of options.
393
+ <br/><br/>
394
+ For more information about this feature see the online FAQ question titled
395
+ <a href="https://snapcreek.com/duplicator/docs/faqs-tech/#faq-installer-110-q" target="_blank">"What is compatibility mode & 'unknown collation' errors"</a>
396
+ </td>
397
+ </tr>
398
+ <tr>
399
+ <td>Spacing</td>
400
+ <td>The process will remove utf8 characters represented as 'xC2' 'xA0' and replace with a uniform space. Use this option if you find strange question
401
+ marks in you posts</td>
402
+ </tr>
403
+ <tr>
404
+ <td>Mode</td>
405
+ <td>The MySQL mode option will allow you to set the mode for this session. It is very useful when running into conversion issues. For a full overview please
406
+ see the <a href="https://dev.mysql.com/doc/refman/5.7/en/sql-mode.html" target="_blank">MySQL mode documentation</a> specific to your version.</td>
407
+ </tr>
408
+ <tr>
409
+ <td>Charset</td>
410
+ <td>When the database is populated from the SQL script it will use this value as part of its connection. Only change this value if you know what your
411
+ databases character set should be.</td>
412
+ </tr>
413
+ <tr>
414
+ <td>Collation</td>
415
+ <td>When the database is populated from the SQL script it will use this value as part of its connection. Only change this value if you know what your
416
+ databases collation set should be.</td>
417
+ </tr>
418
+ </table>
419
+ <sup>*cPanel Only Option</sup>
420
+ <br/><br/>
421
+
422
+ <h3>Validation</h3>
423
+ Testing the database connection is important and can help isolate possible issues that may arise with database version and compatibility issues.
424
+
425
+ <table class="help-opt">
426
+ <tr>
427
+ <th>Option</th>
428
+ <th>Details</th>
429
+ </tr>
430
+ <tr>
431
+ <td>Test<br/>Database</td>
432
+ <td>
433
+ The 'Test Database' button will help validate if the connection parameters are correct for this server and help with details about any issues
434
+ that may arise.
435
+ </td>
436
+ </tr>
437
+ <tr>
438
+ <td>Troubleshoot</td>
439
+ <td>
440
+ <b>Common Database Connection Issues:</b><br/>
441
+ - Double check case sensitive values 'User', 'Password' &amp; the 'Database Name' <br/>
442
+ - Validate the database and database user exist on this server <br/>
443
+ - Check if the database user has the correct permission levels to this database <br/>
444
+ - The host 'localhost' may not work on all hosting providers <br/>
445
+ - Contact your hosting provider for the exact required parameters <br/>
446
+ - Visit the online resources 'Common FAQ page' <br/>
447
+
448
+ </td>
449
+ </tr>
450
+ </table>
451
+ </div>
452
+ </div>
453
+ </section>
454
 
455
  <!-- ============================================
456
  STEP 3
457
  ============================================== -->
458
+ <?php
459
+ $sectionId = 'section-step-3';
460
+ $expandClass = $sectionId == $open_section ? 'open' : 'close';
461
+ ?>
462
+ <section id="<?php echo $sectionId; ?>" class="expandable <?php echo $expandClass; ?>" >
463
+ <h2 class="header expand-header">Step <span class="step">3</span> of 4: Update Data</h2>
464
+ <div class="content" >
465
+ <a class="help-target" name="help-s3"></a>
466
+ <div id="dup-help-step2" class="help-page">
467
+
468
+ <!-- SETTINGS-->
469
+ <h3>New Settings</h3>
470
+ These are the new values (URL, Path and Title) you can update for the new location at which your site will be installed at.
471
+ <br/><br/>
472
+
473
+ <h3>Replace <sup>pro</sup></h3>
474
+ This section will allow you to add as many custom search and replace items that you would like. For example you can search for other URLs to replace. Please use high
475
+ caution when using this feature as it can have unintended consequences as it will search the entire database. It is recommended to only use highly unique items such as
476
+ full URL or file paths with this option.
477
+ <br/><br/>
478
+
479
+ <!-- ADVANCED OPTS -->
480
+ <h3>Options</h3>
481
+ <table class="help-opt">
482
+ <tr>
483
+ <th>Option</th>
484
+ <th>Details</th>
485
+ </tr>
486
+ <tr>
487
+ <td colspan="2" class="section">New Admin Account</td>
488
+ </tr>
489
+ <tr>
490
+ <td>Username</td>
491
+ <td>A new WordPress username to create. This will create a new WordPress administrator account. Please note that usernames are not changeable from the within the UI.</td>
492
+ </tr>
493
+ <tr>
494
+ <td>Password</td>
495
+ <td>The new password for the new user. Must be at least 6 characters long.</td>
496
+ </tr>
497
+ <tr>
498
+ <td colspan="2" class="section">Scan Options</td>
499
+ </tr>
500
+ <tr>
501
+ <td>Cleanup <sup>pro</sup></td>
502
+ <td>The checkbox labeled Remove schedules &amp; storage endpoints will empty the Duplicator schedule and storage settings. This is recommended to keep enabled so that you do not have unwanted schedules and storage options enabled.</td>
503
+ </tr>
504
+ <tr>
505
+ <td>Old URL</td>
506
+ <td>The old URL of the original values that the package was created with. These values should not be changed, unless you know the underlying reasons</td>
507
+ </tr>
508
+ <tr>
509
+ <td>Old Path</td>
510
+ <td>The old path of the original values that the package was created with. These values should not be changed, unless you know the underlying reasons</td>
511
+ </tr>
512
+ <tr>
513
+ <td>Site URL</td>
514
+ <td> For details see WordPress <a href="http://codex.wordpress.org/Changing_The_Site_URL" target="_blank">Site URL</a> &amp; <a href="http://codex.wordpress.org/Giving_WordPress_Its_Own_Directory" target="_blank">Alternate Directory</a>. If you're not sure about this value then leave it the same as the new settings URL.</td>
515
+ </tr>
516
+ <tr>
517
+ <td>Scan Tables</td>
518
+ <td>Select the tables to be updated. This process will update all of the 'Old Settings' with the 'New Settings'. Hold down the 'ctrl key' to select/deselect multiple.</td>
519
+ </tr>
520
+ <tr>
521
+ <td>Activate Plugins</td>
522
+ <td>These plug-ins are the plug-ins that were activated when the package was created and represent the plug-ins that will be activated after the install.</td>
523
+ </tr>
524
+ <tr>
525
+ <td>Update email domains</td>
526
+ <td>The domain portion of all email addresses will be updated if this option is enabled.</td>
527
+ </tr>
528
+ <tr>
529
+ <td>Full Search</td>
530
+ <td>Full search forces a scan of every single cell in the database. If it is not checked then only text based columns are searched which makes the update process much faster.
531
+ Use this option if you have issues with data not updating correctly.</td>
532
+ </tr>
533
+ <tr>
534
+ <td>Post GUID</td>
535
+ <td>If your moving a site keep this value checked. For more details see the <a href="http://codex.wordpress.org/Changing_The_Site_URL#Important_GUID_Note" target="_blank">notes on GUIDS</a>. Changing values in the posts table GUID column can change RSS readers to evaluate that the posts are new and may show them in feeds again.</td>
536
+ </tr>
537
+ <tr>
538
+ <td>Cross search <sup>pro</sup></td>
539
+ <td>
540
+ This option enables the searching and replacing of subsite domains and paths that link to each other. <br>
541
+ Check this option if hyperlinks of at least one subsite point to another subsite.<br>
542
+ Uncheck this option there if there are at least <?php echo MAX_SITES_TO_DEFAULT_ENABLE_CORSS_SEARCH ?> subsites and no subsites hyperlinking to each other (Checking this option in this scenario would unnecessarily load your server).<br><br>
543
+ Check this option If you unsure if you need this option.<br></td>
544
+ </tr>
545
+ <tr>
546
+ <td colspan="2" class="section">WP-Config File</td>
547
+ </tr>
548
+ <tr>
549
+ <td>Config SSL</td>
550
+ <td>Turn off SSL support for WordPress. This sets FORCE_SSL_ADMIN in your wp-config file to false if true, otherwise it will create the setting if not set. The "Enforce on Login"
551
+ will turn off SSL support for WordPress Logins.</td>
552
+ </tr>
553
+ <tr>
554
+ <td>Config Cache</td>
555
+ <td>Turn off Cache support for WordPress. This sets WP_CACHE in your wp-config file to false if true, otherwise it will create the setting if not set. The "Keep Home Path"
556
+ sets WPCACHEHOME in your wp-config file to nothing if true, otherwise nothing is changed.</td>
557
+ </tr>
558
+ </table>
559
+ </div>
560
+ </div>
561
+ </section>
562
 
563
  <!-- ============================================
564
  STEP 4
565
  ============================================== -->
566
+ <?php
567
+ $sectionId = 'section-step-4';
568
+ $expandClass = $sectionId == $open_section ? 'open' : 'close';
569
+ ?>
570
+ <section id="<?php echo $sectionId; ?>" class="expandable <?php echo $expandClass; ?>" >
571
+ <h2 class="header expand-header">Step <span class="step">4</span> of 4: Test Site</h2>
572
+ <div class="content" >
573
+ <a class="help-target" name="help-s4"></a>
574
+ <div id="dup-help-step3" class="help-page">
575
+ <h3>Final Steps</h3>
576
+
577
+ <b>Review Install Report</b><br/>
578
+ The install report is designed to give you a synopsis of the possible errors and warnings that may exist after the installation is completed.
579
+ <br/><br/>
580
+
581
+ <b>Test Site</b><br/>
582
+ After the install is complete run through your entire site and test all pages and posts.
583
+ <br/><br/>
584
+
585
+ <b>Final Security Cleanup</b><br/>
586
+ When completed with the installation please delete all installation files. <b>Leaving these files on your server can be a security risk!</b> You can remove
587
+ all these files by logging into your WordPress admin and following the remove notification links or by deleting these file manually. Be sure these files/directories are removed. Optionally
588
+ it is also recommended to remove the archive.zip/daf file.
589
+ <ul>
590
+ <li>dup-installer</li>
591
+ <li>installer.php</li>
592
+ <li>installer-backup.php</li>
593
+ <li>dup-installer-bootlog__[HASH].txt</li>
594
+ <li>archive.zip/daf</li>
595
+ </ul>
596
+ </div>
597
+ </div>
598
+ </section>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
599
 
600
+ <?php
601
+ $sectionId = 'section-troubleshoot';
602
+ $expandClass = $sectionId == $open_section ? 'open' : 'close';
603
+ ?>
604
+ <section id="<?php echo $sectionId; ?>" class="expandable <?php echo $expandClass; ?>" >
605
+ <h2 class="header expand-header">Troubleshooting Tips</h2>
606
+ <div class="content" >
607
+ <a class="help-target" name="help-s5"></a>
608
+ <div id="troubleshoot" class="help-page">
609
+
610
+ <div style="padding: 0px 10px 10px 10px;">
611
+ <b>Common Quick Fix Issues:</b>
612
+ <ul>
613
+ <li>Use an <a href='https://snapcreek.com/wordpress-hosting/' target='_blank'>approved hosting provider</a></li>
614
+ <li>Validate directory and file permissions (see below)</li>
615
+ <li>Validate web server configuration file (see below)</li>
616
+ <li>Clear your browsers cache</li>
617
+ <li>Deactivate and reactivate all plugins</li>
618
+ <li>Resave a plugins settings if it reports errors</li>
619
+ <li>Make sure your root directory is empty</li>
620
+ </ul>
621
+
622
+ <b>Permissions:</b><br/>
623
+ Not all operating systems are alike. Therefore, when you move a package (zip file) from one location to another the file and directory permissions may not always stick. If this is the case then check your WordPress directories and make sure it's permissions are set to 755. For files make sure the permissions are set to 644 (this does not apply to windows servers). Also pay attention to the owner/group attributes. For a full overview of the correct file changes see the <a href='http://codex.wordpress.org/Hardening_WordPress#File_permissions' target='_blank'>WordPress permissions codex</a>
624
+ <br/><br/>
625
+
626
+ <b>Web server configuration files:</b><br/>
627
+ For Apache web server the root .htaccess file was copied to htaccess.orig. A new stripped down .htaccess file was created to help simplify access issues. For IIS web server the web.config file was copied to web.config.orig, however no new web.config file was created. If you have not altered this file manually then resaving your permalinks and resaving your plugins should resolve most all changes that were made to the root web configuration file. If your still experiencing issues then open the .orig file and do a compare to see what changes need to be made. <br/><br/><b>Plugin Notes:</b><br/> It's impossible to know how all 3rd party plugins function. The Duplicator attempts to fix the new install URL for settings stored in the WordPress options table. Please validate that all plugins retained there settings after installing. If you experience issues try to bulk deactivate all plugins then bulk reactivate them on your new duplicated site. If you run into issues were a plugin does not retain its data then try to resave the plugins settings.
628
+ <br/><br/>
629
+
630
+ <b>Cache Systems:</b><br/>
631
+ Any type of cache system such as Super Cache, W3 Cache, etc. should be emptied before you create a package. Another alternative is to include the cache directory in the directory exclusion path list found in the options dialog. Including a directory such as \pathtowordpress\wp-content\w3tc\ (the w3 Total Cache directory) will exclude this directory from being packaged. In is highly recommended to always perform a cache empty when you first fire up your new site even if you excluded your cache directory.
632
+ <br/><br/>
633
+
634
+ <b>Trying Again:</b><br/>
635
+ If you need to retry and reinstall this package you can easily run the process again by deleting all files except the installer and package file and then browse to the installer again.
636
+ <br/><br/>
637
+
638
+ <b>Additional Notes:</b><br/>
639
+ If you have made changes to your PHP files directly this might have an impact on your duplicated site. Be sure all changes made will correspond to the sites new location.
640
+ Only the package (zip file) and the installer (php file) should be in the directory where you are installing the site. Please read through our knowledge base before submitting any issues.
641
+ If you have a large log file that needs evaluated please email the file, or attach it to a help ticket.
642
+ </div>
643
+ </div>
644
+ </div>
645
+ </section>
646
+
647
+ <div style="text-align:center; margin-top: 28px;">For additional help please visit the <a href="https://snapcreek.com/support/docs/" target="_blank">online resources</a></div>
648
 
 
649
 
650
  </div>
651
 
652
+ <script>
653
+ $(document).ready(function ()
654
+ {
655
+ //Disable href for toggle types
656
+ $("section.expandable .expand-header").click(function() {
657
+ var section = $(this).parent();
658
+ if(section.hasClass('open')) {
659
+ section.removeClass('open').addClass('close');
660
+ } else {
661
+ section.removeClass('close').addClass('open');
662
+ }
663
+ });
664
+
665
+ <?php if (!empty($open_section)) { ?>
666
+ $("html, body").animate({ scrollTop: $('#<?php echo $open_section; ?>').offset().top }, 1000);
667
+ <?php } ?>
668
+
669
+ });
670
+ </script>
671
  <!-- END OF VIEW HELP -->
installer/dup-installer/views/view.s1.base.php CHANGED
@@ -73,6 +73,13 @@ if ($GLOBALS['DUPX_AC']->exportOnlyDB) {
73
  ? 'Good'
74
  : 'Warn';
75
  }
 
 
 
 
 
 
 
76
  $all_notice = in_array('Warn', $notice) ? 'Warn' : 'Good';
77
 
78
  //SUMMATION
@@ -91,7 +98,7 @@ $archive_config = DUPX_ArchiveConfig::getInstance();
91
  <input type="hidden" name="view" value="step1" />
92
  <input type="hidden" name="csrf_token" value="<?php echo DUPX_CSRF::generate('step1'); ?>">
93
  <input type="hidden" name="ctrl_action" value="ctrl-step1" />
94
- <input type="hidden" name="ctrl_csrf_token" value="<?php echo DUPX_CSRF::generate('ctrl-step1'); ?>">
95
  <input type="hidden" name="secure-pass" value="<?php echo DUPX_U::esc_html($_POST['secure-pass']); ?>" />
96
  <input type="hidden" name="bootloader" value="<?php echo DUPX_U::esc_attr($GLOBALS['BOOTLOADER_NAME']); ?>" />
97
  <input type="hidden" name="archive" value="<?php echo DUPX_U::esc_attr($GLOBALS['FW_PACKAGE_PATH']); ?>" />
@@ -527,6 +534,18 @@ VALIDATION
527
  Duplicator Installer will place this wp-content directory in the WordPress setup root folder of this installation site. It will not break anything in your installation
528
  site. It is just for your information.
529
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
530
  </div>
531
 
532
  </div>
@@ -1037,21 +1056,6 @@ DUPX.kickOffDupArchiveExtract = function ()
1037
  var request = new Object();
1038
  var isClientSideKickoff = DUPX.isClientSideKickoff();
1039
 
1040
- <?php
1041
- $outer_root_path = dirname($root_path);
1042
- if (!$GLOBALS['DUPX_AC']->installSiteOverwriteOn && (file_exists($root_path.'/wp-config.php') || (@file_exists($outer_root_path.'/wp-config.php') && !@file_exists("{$outer_root_path}/wp-settings.php")))) {
1043
- ?>
1044
- $('#s1-input-form').hide();
1045
- $('#s1-result-form').show();
1046
- var errorString = "<div class='dupx-ui-error'><b style='color:#B80000;'>INSTALL ERROR!</b><br/>"+'<?php echo ERR_CONFIG_FOUND;?>'+"</div>";
1047
- $('#ajaxerr-data').html(errorString);
1048
- DUPX.hideProgressBar();
1049
- return false;
1050
- <?php
1051
- }
1052
- ?>
1053
-
1054
-
1055
  request.action = "start_expand";
1056
  request.archive_filepath = '<?php echo DUPX_U::esc_js($archive_path); ?>';
1057
  request.restore_directory = '<?php echo DUPX_U::esc_js($root_path); ?>';
@@ -1081,7 +1085,7 @@ DUPX.kickOffDupArchiveExtract = function ()
1081
  $.ajax({
1082
  type: "POST",
1083
  timeout: DUPX.DAWS.KickoffWorkerTimeInSec * 2000, // Double worker time and convert to ms
1084
- url: DUPX.DAWS.Url,
1085
  data: requestString,
1086
  beforeSend: function () {
1087
  DUPX.showProgressBar();
@@ -1131,9 +1135,14 @@ DUPX.kickOffDupArchiveExtract = function ()
1131
  DUPX.DAWSProcessingFailed(errorString);
1132
  }
1133
  } else {
1134
- var errorString = 'kickOffDupArchiveExtract:Error Processing Step 1<br/>';
1135
- errorString += data.error;
1136
- DUPX.handleDAWSProcessingProblem(errorString, false);
 
 
 
 
 
1137
  }
1138
  },
1139
  error: function (xHr, textStatus) {
@@ -1350,7 +1359,7 @@ DUPX.onSafeModeSwitch = function ()
1350
  //DOCUMENT LOAD
1351
  $(document).ready(function() {
1352
  DUPX.DAWS = new Object();
1353
- DUPX.DAWS.Url = window.location.href + '?is_daws=1&daws_csrf_token=<?php echo DUPX_CSRF::generate('daws');?>';
1354
  DUPX.DAWS.StatusPeriodInMS = 5000;
1355
  DUPX.DAWS.PingWorkerTimeInSec = 9;
1356
  DUPX.DAWS.KickoffWorkerTimeInSec = 6; // Want the initial progress % to come back quicker
73
  ? 'Good'
74
  : 'Warn';
75
  }
76
+
77
+ $space_free = @disk_free_space($GLOBALS['DUPX_ROOT']);
78
+ $archive_size = filesize($GLOBALS['FW_PACKAGE_PATH']);
79
+ $notice['100'] = ($space_free && $archive_size > $space_free)
80
+ ? 'Warn'
81
+ : 'Good';
82
+
83
  $all_notice = in_array('Warn', $notice) ? 'Warn' : 'Good';
84
 
85
  //SUMMATION
98
  <input type="hidden" name="view" value="step1" />
99
  <input type="hidden" name="csrf_token" value="<?php echo DUPX_CSRF::generate('step1'); ?>">
100
  <input type="hidden" name="ctrl_action" value="ctrl-step1" />
101
+ <input type="hidden" name="ctrl_csrf_token" value="<?php echo DUPX_U::esc_attr(DUPX_CSRF::generate('ctrl-step1')); ?>">
102
  <input type="hidden" name="secure-pass" value="<?php echo DUPX_U::esc_html($_POST['secure-pass']); ?>" />
103
  <input type="hidden" name="bootloader" value="<?php echo DUPX_U::esc_attr($GLOBALS['BOOTLOADER_NAME']); ?>" />
104
  <input type="hidden" name="archive" value="<?php echo DUPX_U::esc_attr($GLOBALS['FW_PACKAGE_PATH']); ?>" />
534
  Duplicator Installer will place this wp-content directory in the WordPress setup root folder of this installation site. It will not break anything in your installation
535
  site. It is just for your information.
536
  </div>
537
+
538
+ <!-- NOTICE 100 -->
539
+ <div class="status <?php echo ($notice['100'] == 'Good') ? 'pass' : 'fail' ?>"><?php echo DUPX_U::esc_html($notice['100']); ?></div>
540
+ <div class="title" data-type="toggle" data-target="#s1-notice100"><i class="fa fa-caret-right"></i> Sufficient disk space</div>
541
+ <div class="info" id="s1-notice100">
542
+ <?php
543
+ echo ($notice['100'] == 'Good')
544
+ ? 'You have sufficient disk space in your machine to extract the archive.'
545
+ : 'You don’t have sufficient disk space in your machine to extract the archive. Ask your host to increase disk space.'
546
+ ?>
547
+ </div>
548
+
549
  </div>
550
 
551
  </div>
1056
  var request = new Object();
1057
  var isClientSideKickoff = DUPX.isClientSideKickoff();
1058
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1059
  request.action = "start_expand";
1060
  request.archive_filepath = '<?php echo DUPX_U::esc_js($archive_path); ?>';
1061
  request.restore_directory = '<?php echo DUPX_U::esc_js($root_path); ?>';
1085
  $.ajax({
1086
  type: "POST",
1087
  timeout: DUPX.DAWS.KickoffWorkerTimeInSec * 2000, // Double worker time and convert to ms
1088
+ url: DUPX.DAWS.Url + '&daws_action=start_expand',
1089
  data: requestString,
1090
  beforeSend: function () {
1091
  DUPX.showProgressBar();
1135
  DUPX.DAWSProcessingFailed(errorString);
1136
  }
1137
  } else {
1138
+ if ('undefined' !== typeof data.isWPAlreadyExistsError
1139
+ && data.isWPAlreadyExistsError) {
1140
+ DUPX.DAWSProcessingFailed(data.error);
1141
+ } else {
1142
+ var errorString = 'kickOffDupArchiveExtract:Error Processing Step 1<br/>';
1143
+ errorString += data.error;
1144
+ DUPX.handleDAWSProcessingProblem(errorString, false);
1145
+ }
1146
  }
1147
  },
1148
  error: function (xHr, textStatus) {
1359
  //DOCUMENT LOAD
1360
  $(document).ready(function() {
1361
  DUPX.DAWS = new Object();
1362
+ DUPX.DAWS.Url = window.location.href + '?is_daws=1&daws_csrf_token=<?php echo urlencode(DUPX_CSRF::generate('daws'));?>';
1363
  DUPX.DAWS.StatusPeriodInMS = 5000;
1364
  DUPX.DAWS.PingWorkerTimeInSec = 9;
1365
  DUPX.DAWS.KickoffWorkerTimeInSec = 6; // Want the initial progress % to come back quicker
installer/dup-installer/views/view.s2.base.php CHANGED
@@ -254,7 +254,7 @@ Auto Posts to view.step3.php -->
254
  $formInput.hide();
255
  $formResult.show();
256
  },
257
- success: function (respData, textStatus, xHr) {
258
  try {
259
  var data = DUPX.parseJSON(respData);
260
  } catch(err) {
@@ -310,6 +310,9 @@ Auto Posts to view.step3.php -->
310
  <?php endif; ?>
311
  $('#progress-area').fadeOut(700);
312
  } else {
 
 
 
313
  DUPX.hideProgressBar();
314
  }
315
  },
254
  $formInput.hide();
255
  $formResult.show();
256
  },
257
+ success: function (respData, textStatus, xhr) {
258
  try {
259
  var data = DUPX.parseJSON(respData);
260
  } catch(err) {
310
  <?php endif; ?>
311
  $('#progress-area').fadeOut(700);
312
  } else {
313
+ if (data.error_message) {
314
+ $('#ajaxerr-data').html(data.error_message);
315
+ }
316
  DUPX.hideProgressBar();
317
  }
318
  },
installer/dup-installer/views/view.s3.php CHANGED
@@ -28,7 +28,7 @@ defined("ABSPATH") or die("");
28
  }
29
 
30
  if (isset($_POST['dbpass'])) {
31
- $_POST['dbpass'] = trim($_POST['dbpass']);
32
  } else {
33
  $_POST['dbpass'] = null;
34
  }
@@ -271,6 +271,7 @@ VIEW: STEP 3- INPUT -->
271
  </tr>
272
  </table>
273
  <br/>
 
274
  <input type="checkbox" name="fullsearch" id="fullsearch" value="1" /> <label for="fullsearch">Use Database Full Search Mode</label><br/>
275
  <input type="checkbox" name="postguid" id="postguid" value="1" /> <label for="postguid">Keep Post GUID Unchanged</label><br/>
276
  <br/><br/>
28
  }
29
 
30
  if (isset($_POST['dbpass'])) {
31
+ $_POST['dbpass'] = $_POST['dbpass'];
32
  } else {
33
  $_POST['dbpass'] = null;
34
  }
271
  </tr>
272
  </table>
273
  <br/>
274
+ <input type="checkbox" name="search_replace_email_domain" id="search_replace_email_domain" value="1" /> <label for="search_replace_email_domain">Update email domains</label><br/>
275
  <input type="checkbox" name="fullsearch" id="fullsearch" value="1" /> <label for="fullsearch">Use Database Full Search Mode</label><br/>
276
  <input type="checkbox" name="postguid" id="postguid" value="1" /> <label for="postguid">Keep Post GUID Unchanged</label><br/>
277
  <br/><br/>
installer/dup-installer/views/view.s4.php CHANGED
@@ -14,6 +14,17 @@ $admin_redirect = "{$admin_redirect}&package={$GLOBALS['DUPX_AC']->package_name}
14
  $admin_redirect = urlencode($admin_redirect);
15
  $admin_url_qry = (strpos($admin_base, '?') === false) ? '?' : '&';
16
  $admin_login = "{$url_new_rtrim}/{$admin_base}{$admin_url_qry}redirect_to={$admin_redirect}";
 
 
 
 
 
 
 
 
 
 
 
17
  ?>
18
 
19
  <script>
@@ -73,18 +84,195 @@ VIEW: STEP 4- INPUT -->
73
  </i>
74
  <br/><br/><br/>
75
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
76
 
77
  <div class="s4-go-back">
78
- Additional Notes:
79
  <ul style="margin-top: 1px">
80
  <li>
81
- <a href="javascript:void(0)" onclick="$('#s4-install-report').toggle(400)">Review Migration Report</a><br/>
82
- &nbsp; &nbsp;
83
- <i id="s4-install-report-count">
84
- <span data-bind="with: status.step1">Install Notices:(<span data-bind="text: query_errs"></span>)</span> &nbsp;
85
- <span data-bind="with: status.step3">Replace Notices:(<span data-bind="text: err_all"></span>)</span> &nbsp; &nbsp;
86
- <span data-bind="with: status.step3" style="color:#888"><b>General Notices:</b>(<span data-bind="text: warn_all"></span>)</span>
87
- </i>
 
 
 
 
 
 
 
 
 
 
 
 
 
88
  </li>
89
  <li>
90
  Review this sites <a href="<?php echo DUPX_U::esc_attr($url_new_rtrim); ?>" target="_blank">front-end</a> or
@@ -99,7 +287,7 @@ VIEW: STEP 4- INPUT -->
99
  INSTALL REPORT -->
100
  <div id="s4-install-report" style='display:none'>
101
  <table class='s4-report-results' style="width:100%">
102
- <tr><th colspan="4">Database Report</th></tr>
103
  <tr style="font-weight:bold">
104
  <td style="width:150px"></td>
105
  <td>Tables</td>
@@ -127,110 +315,13 @@ VIEW: STEP 4- INPUT -->
127
  </table>
128
  <br/>
129
 
130
- <table class='s4-report-errs' style="width:100%; border-top:none">
131
- <tr><th colspan="4">Report Notices</th></tr>
132
- <tr>
133
- <td data-bind="with: status.step1">
134
- <a href="javascript:void(0);" onclick="$('#s4-errs-create').toggle(400)">Step 2: Install Notices (<span data-bind="text: query_errs"></span>)</a><br/>
135
- </td>
136
- <td data-bind="with: status.step3">
137
- <a href="javascript:void(0);" onclick="$('#s4-errs-upd').toggle(400)">Step 3: Replace Notices (<span data-bind="text: err_all"></span>)</a>
138
- </td>
139
- <td data-bind="with: status.step3">
140
- <a href="#s3-errs-warn-anchor" onclick="$('#s4-warnlist').toggle(400)">General Notices (<span data-bind="text: warn_all"></span>)</a>
141
- </td>
142
- </tr>
143
- <tr><td colspan="4"></td></tr>
144
- </table>
145
-
146
-
147
- <div id="s4-errs-create" class="s4-err-msg">
148
- <div class="s4-err-title">STEP 2 - INSTALL NOTICES:</div>
149
- <b data-bind="with: status.step1">ERRORS (<span data-bind="text: query_errs"></span>)</b><br/>
150
- <div class="info-error">
151
- Queries that error during the deploy step are logged to the <a href="./<?php echo DUPX_U::esc_attr($GLOBALS["LOG_FILE_NAME"]);?>" target="dup-installer">install-log.txt</a> file and
152
- and marked with an **ERROR** status. If you experience a few errors (under 5), in many cases they can be ignored as long as your site is working correctly.
153
- However if you see a large amount of errors or you experience an issue with your site then the error messages in the log file will need to be investigated.
154
- <br/><br/>
155
-
156
- <b>COMMON FIXES:</b>
157
- <ul>
158
- <li>
159
- <b>Unknown collation:</b> See Online FAQ:
160
- <a href="https://snapcreek.com/duplicator/docs/faqs-tech/#faq-trouble-090-q" target="_blank">What is Compatibility mode & 'Unknown collation' errors?</a>
161
- </li>
162
- <li>
163
- <b>Query Limits:</b> Update MySQL server with the <a href="https://dev.mysql.com/doc/refman/5.5/en/packet-too-large.html" target="_blank">max_allowed_packet</a>
164
- setting for larger payloads.
165
- </li>
166
- </ul>
167
- </div>
168
- </div>
169
-
170
-
171
- <div id="s4-errs-upd" class="s4-err-msg">
172
- <div class="s4-err-title">STEP 3 - UPDATE NOTICES:</div>
173
- <!-- MYSQL QUERY ERRORS -->
174
- <b data-bind="with: status.step3">ERRORS (<span data-bind="text: errsql_sum"></span>) </b><br/>
175
- <div class="info-error">
176
- Update errors that show here are queries that could not be performed because the database server being used has issues running it. Please validate the query, if
177
- it looks to be of concern please try to run the query manually. In many cases if your site performs well without any issues you can ignore the error.
178
- </div>
179
- <div class="content">
180
- <div data-bind="foreach: status.step3.errsql"><div data-bind="text: $data"></div></div>
181
- <div data-bind="visible: status.step3.errsql.length == 0">No MySQL query errors found</div>
182
- </div>
183
- <br/>
184
-
185
- <!-- TABLE KEY ERRORS -->
186
- <b data-bind="with: status.step3">TABLE KEY NOTICES (<span data-bind="text: errkey_sum"></span>)</b><br/>
187
- <div class="info-notice">
188
- Notices should be ignored unless issues are found after you have tested an installed site. This notice indicates that a primary key is required to run the
189
- update engine. Below is a list of tables and the rows that were not updated. On some databases you can remove these notices by checking the box 'Enable Full Search'
190
- under options in step3 of the installer.
191
- <br/><br/>
192
- <small>
193
- <b>Advanced Searching:</b><br/>
194
- Use the following query to locate the table that was not updated: <br/>
195
- <i>SELECT @row := @row + 1 as row, t.* FROM some_table t, (SELECT @row := 0) r</i>
196
- </small>
197
- </div>
198
- <div class="content">
199
- <div data-bind="foreach: status.step3.errkey"><div data-bind="text: $data"></div></div>
200
- <div data-bind="visible: status.step3.errkey.length == 0">No missing primary key errors</div>
201
- </div>
202
- <br/>
203
-
204
- <!-- SERIALIZE NOTICES -->
205
- <b data-bind="with: status.step3">SERIALIZATION NOTICES (<span data-bind="text: errser_sum"></span>)</b><br/>
206
- <div class="info-notice">
207
- Notices should be ignored unless issues are found after you have tested an installed site. The SQL below will show data that may have not been
208
- updated during the serialization process. Best practices for serialization notices is to just re-save the plugin/post/page in question.
209
- </div>
210
- <div class="content">
211
- <div data-bind="foreach: status.step3.errser"><div data-bind="text: $data"></div></div>
212
- <div data-bind="visible: status.step3.errser.length == 0">No serialization notices found</div>
213
- </div>
214
- </div>
215
-
216
-
217
- <!-- WARNINGS-->
218
- <div id="s4-warnlist" class="s4-err-msg">
219
- <a href="#" id="s3-errs-warn-anchor"></a>
220
- <b>GENERAL NOTICES</b><br/>
221
- <div class="info">
222
- The following is a list of notices that may need to be fixed in order to finalize your setup. These values should only be investigated if your running into
223
- issues with your site. For more details see the <a href="https://codex.wordpress.org/Editing_wp-config.php" target="_blank">WordPress Codex</a>.
224
- </div>
225
- <div class="content">
226
- <div data-bind="foreach: status.step3.warnlist">
227
- <div data-bind="html: $data"></div>
228
- </div>
229
- <div data-bind="visible: status.step3.warnlist.length == 0">
230
- No notices found
231
- </div>
232
- </div>
233
- </div><br/>
234
 
235
  </div><br/><br/>
236
 
@@ -264,18 +355,6 @@ VIEW: STEP 4- INPUT -->
264
  <br/><br/><br/>
265
  </form>
266
 
267
- <?php
268
- //Sanitize
269
- $json_result = true;
270
- $_POST['json'] = isset($_POST['json']) ? DUPX_U::esc_attr($_POST['json']) : 'json data not set';
271
- $json_data = utf8_decode(urldecode($_POST['json']));
272
- $json_decode = json_decode($json_data);
273
- if ($json_decode == NULL || $json_decode == FALSE) {
274
- $json_data = "{'json reset invalid form value sent. Possible site script attempt'}";
275
- $json_result = false;
276
- }
277
- ?>
278
-
279
  <script>
280
  <?php if ($json_result) : ?>
281
  MyViewModel = function() {
@@ -289,6 +368,15 @@ VIEW: STEP 4- INPUT -->
289
  <?php else: ?>
290
  console.log("Cross site script attempt detected, unable to create final report!");
291
  <?php endif; ?>
 
 
 
 
 
 
 
 
 
292
  </script>
293
 
294
 
14
  $admin_redirect = urlencode($admin_redirect);
15
  $admin_url_qry = (strpos($admin_base, '?') === false) ? '?' : '&';
16
  $admin_login = "{$url_new_rtrim}/{$admin_base}{$admin_url_qry}redirect_to={$admin_redirect}";
17
+
18
+ //Sanitize
19
+ $json_result = true;
20
+ $_POST['json'] = isset($_POST['json']) ? DUPX_U::esc_attr($_POST['json']) : 'json data not set';
21
+ $json_data = utf8_decode(urldecode($_POST['json']));
22
+ $json_decode = json_decode($json_data);
23
+ if ($json_decode == NULL || $json_decode == FALSE) {
24
+ $json_data = "{'json reset invalid form value sent. Possible site script attempt'}";
25
+ $json_result = false;
26
+ }
27
+
28
  ?>
29
 
30
  <script>
84
  </i>
85
  <br/><br/><br/>
86
 
87
+ <?php
88
+ $nManager = DUPX_NOTICE_MANAGER::getInstance();
89
+ if ($json_decode->step1->query_errs > 0) {
90
+ $linkAttr = './'.DUPX_U::esc_attr($GLOBALS["LOG_FILE_NAME"]);
91
+ $longMsg = <<<LONGMSG
92
+ Queries that error during the deploy step are logged to the <a href="{$linkAttr}" target="dup-installer">install-log.txt</a> file and
93
+ and marked with an **ERROR** status. If you experience a few errors (under 5), in many cases they can be ignored as long as your site is working correctly.
94
+ However if you see a large amount of errors or you experience an issue with your site then the error messages in the log file will need to be investigated.
95
+ <br/><br/>
96
+
97
+ <b>COMMON FIXES:</b>
98
+ <ul>
99
+ <li>
100
+ <b>Unknown collation:</b> See Online FAQ:
101
+ <a href="https://snapcreek.com/duplicator/docs/faqs-tech/#faq-trouble-090-q" target="_blank">What is Compatibility mode & 'Unknown collation' errors?</a>
102
+ </li>
103
+ <li>
104
+ <b>Query Limits:</b> Update MySQL server with the <a href="https://dev.mysql.com/doc/refman/5.5/en/packet-too-large.html" target="_blank">max_allowed_packet</a>
105
+ setting for larger payloads.
106
+ </li>
107
+ </ul>
108
+ LONGMSG;
109
+
110
+ $nManager->addFinalReportNotice(array(
111
+ 'shortMsg' => 'STEP 2 - INSTALL NOTICES ('.$json_decode->step1->query_errs.')',
112
+ 'level' => DUPX_NOTICE_ITEM::HARD_WARNING,
113
+ 'longMsg' => $longMsg,
114
+ 'longMsgHtml' => true,
115
+ 'sections' => array('database'),
116
+ 'priority' => 5,
117
+ 'open' => true
118
+ ));
119
+ }
120
+
121
+ if ($json_decode->step3->errsql_sum > 0) {
122
+ $longMsg = <<<LONGMSG
123
+ Update errors that show here are queries that could not be performed because the database server being used has issues running it. Please validate the query, if
124
+ it looks to be of concern please try to run the query manually. In many cases if your site performs well without any issues you can ignore the error.
125
+ LONGMSG;
126
+
127
+ $nManager->addFinalReportNotice(array(
128
+ 'shortMsg' => 'STEP 3 - UPDATE NOTICES ('.$json_decode->step3->errsql_sum.')',
129
+ 'level' => DUPX_NOTICE_ITEM::HARD_WARNING,
130
+ 'longMsg' => $longMsg,
131
+ 'sections' => array('database'),
132
+ 'priority' => 5,
133
+ 'open' => true
134
+ ));
135
+ }
136
+
137
+ if ($json_decode->step3->errkey_sum > 0) {
138
+ $longMsg = <<<LONGMSG
139
+ Notices should be ignored unless issues are found after you have tested an installed site. This notice indicates that a primary key is required to run the
140
+ update engine. Below is a list of tables and the rows that were not updated. On some databases you can remove these notices by checking the box 'Enable Full Search'
141
+ under options in step3 of the installer.
142
+ <br/><br/>
143
+ <small>
144
+ <b>Advanced Searching:</b><br/>
145
+ Use the following query to locate the table that was not updated: <br/>
146
+ <i>SELECT @row := @row + 1 as row, t.* FROM some_table t, (SELECT @row := 0) r</i>
147
+ </small>
148
+ LONGMSG;
149
+
150
+ $nManager->addFinalReportNotice(array(
151
+ 'shortMsg' => 'TABLE KEY NOTICES ('.$json_decode->step3->errkey_sum.')',
152
+ 'level' => DUPX_NOTICE_ITEM::SOFT_WARNING,
153
+ 'longMsg' => $longMsg,
154
+ 'longMsgHtml' => true,
155
+ 'sections' => array('database'),
156
+ 'priority' => 5,
157
+ 'open' => true
158
+ ));
159
+ }
160
+
161
+ if ($json_decode->step3->errser_sum > 0) {
162
+ $longMsg = <<<LONGMSG
163
+ Notices should be ignored unless issues are found after you have tested an installed site. The SQL below will show data that may have not been
164
+ updated during the serialization process. Best practices for serialization notices is to just re-save the plugin/post/page in question.
165
+ LONGMSG;
166
+
167
+ $nManager->addFinalReportNotice(array(
168
+ 'shortMsg' => 'SERIALIZATION NOTICES ('.$json_decode->step3->errser_sum.')',
169
+ 'level' => DUPX_NOTICE_ITEM::SOFT_WARNING,
170
+ 'longMsg' => $longMsg,
171
+ 'sections' => array('search_replace'),
172
+ 'priority' => 5,
173
+ 'open' => true
174
+ ));
175
+ }
176
+
177
+ $numGeneralNotices = $nManager->countFinalReportNotices('general', DUPX_NOTICE_ITEM::NOTICE, '>=');
178
+ if ($numGeneralNotices == 0) {
179
+ $nManager->addFinalReportNotice(array(
180
+ 'shortMsg' => 'No general notices',
181
+ 'level' => DUPX_NOTICE_ITEM::INFO,
182
+ 'sections' => array('general'),
183
+ 'priority' => 5
184
+ ));
185
+ } else {
186
+ $longMsg = <<<LONGMSG
187
+ The following is a list of notices that may need to be fixed in order to finalize your setup. These values should only be investigated if your running into
188
+ issues with your site. For more details see the <a href="https://codex.wordpress.org/Editing_wp-config.php" target="_blank">WordPress Codex</a>.
189
+ LONGMSG;
190
+
191
+ $nManager->addFinalReportNotice(array(
192
+ 'shortMsg' => 'Info',
193
+ 'level' => DUPX_NOTICE_ITEM::INFO,
194
+ 'longMsg' => $longMsg,
195
+ 'longMsgHtml' => true,
196
+ 'sections' => array('general'),
197
+ 'priority' => 5,
198
+ 'open' => true
199
+ ));
200
+ }
201
+
202
+ $numDbNotices = $nManager->countFinalReportNotices('database', DUPX_NOTICE_ITEM::NOTICE, '>=');
203
+ if ($numDbNotices == 0) {
204
+ $nManager->addFinalReportNotice(array(
205
+ 'shortMsg' => 'No errors in database',
206
+ 'level' => DUPX_NOTICE_ITEM::INFO,
207
+ 'longMsg' => '',
208
+ 'sections' => 'database',
209
+ 'priority' => 5
210
+ ), DUPX_NOTICE_MANAGER::ADD_UNIQUE_UPDATE, 'query_err_counts');
211
+ } else if ($numDbNotices <= 10) {
212
+ $nManager->addFinalReportNotice(array(
213
+ 'shortMsg' => 'Some errors in the database ('.$numDbNotices.')',
214
+ 'level' => DUPX_NOTICE_ITEM::SOFT_WARNING,
215
+ 'longMsg' => '',
216
+ 'sections' => 'database',
217
+ 'priority' => 5
218
+ ), DUPX_NOTICE_MANAGER::ADD_UNIQUE_UPDATE, 'query_err_counts');
219
+ } else if ($numDbNotices <= 100) {
220
+ $nManager->addFinalReportNotice(array(
221
+ 'shortMsg' => 'Errors in the database ('.$numDbNotices.')',
222
+ 'level' => DUPX_NOTICE_ITEM::HARD_WARNING,
223
+ 'longMsg' => '',
224
+ 'sections' => 'database',
225
+ 'priority' => 5
226
+ ), DUPX_NOTICE_MANAGER::ADD_UNIQUE_UPDATE, 'query_err_counts');
227
+ } else {
228
+ $nManager->addFinalReportNotice(array(
229
+ 'shortMsg' => 'Many errors in the database ('.$numDbNotices.')',
230
+ 'level' => DUPX_NOTICE_ITEM::CRITICAL,
231
+ 'longMsg' => '',
232
+ 'sections' => 'database',
233
+ 'priority' => 5
234
+ ), DUPX_NOTICE_MANAGER::ADD_UNIQUE_UPDATE, 'query_err_counts');
235
+ }
236
+
237
+
238
+ $numSerNotices = $nManager->countFinalReportNotices('search_replace', DUPX_NOTICE_ITEM::NOTICE, '>=');
239
+ if ($numSerNotices == 0) {
240
+ $nManager->addFinalReportNotice(array(
241
+ 'shortMsg' => 'No search and replace data errors',
242
+ 'level' => DUPX_NOTICE_ITEM::INFO,
243
+ 'longMsg' => '',
244
+ 'sections' => 'search_replace',
245
+ 'priority' => 5
246
+ ));
247
+ }
248
+
249
+ $nManager->sortFinalReport();
250
+ ?>
251
 
252
  <div class="s4-go-back">
253
+ Additional Details:
254
  <ul style="margin-top: 1px">
255
  <li>
256
+ <a href="javascript:void(0)" onclick="$('#s4-install-report').toggle(400)">Review Migration Report</a><br/><br>
257
+ <table class='s4-report-results' style="width:100%">
258
+ <tbody>
259
+ <tr>
260
+ <td>Database Notices</td>
261
+ <td>(<?php echo $numDbNotices; ?>)</td>
262
+ <td><?php $nManager->getSectionErrLevelHtml('database'); ?></td>
263
+ </tr>
264
+ <tr>
265
+ <td>Search &amp; Replace Notices</td>
266
+ <td>(<?php echo $numSerNotices; ?>)</td>
267
+ <td> <?php $nManager->getSectionErrLevelHtml('search_replace'); ?></td>
268
+ </tr>
269
+ <tr>
270
+ <td>General Notices</td>
271
+ <td>(<?php echo $numGeneralNotices; ?>)</td>
272
+ <td><?php $nManager->getSectionErrLevelHtml('general'); ?></td>
273
+ </tr>
274
+ </tbody>
275
+ </table><br>
276
  </li>
277
  <li>
278
  Review this sites <a href="<?php echo DUPX_U::esc_attr($url_new_rtrim); ?>" target="_blank">front-end</a> or
287
  INSTALL REPORT -->
288
  <div id="s4-install-report" style='display:none'>
289
  <table class='s4-report-results' style="width:100%">
290
+ <tr><th colspan="4"><i class="fa fa-database"></i> Database Report</th></tr>
291
  <tr style="font-weight:bold">
292
  <td style="width:150px"></td>
293
  <td>Tables</td>
315
  </table>
316
  <br/>
317
 
318
+ <div id="s4-notice-reports" class="report-sections-list">
319
+ <?php
320
+ $nManager->displayFinalRepostSectionHtml('database' , 'Database Notices');
321
+ $nManager->displayFinalRepostSectionHtml('search_replace' , 'Search &amp; Replace Notices');
322
+ $nManager->displayFinalRepostSectionHtml('general' , 'General Notices');
323
+ ?>
324
+ </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
325
 
326
  </div><br/><br/>
327
 
355
  <br/><br/><br/>
356
  </form>
357
 
 
 
 
 
 
 
 
 
 
 
 
 
358
  <script>
359
  <?php if ($json_result) : ?>
360
  MyViewModel = function() {
368
  <?php else: ?>
369
  console.log("Cross site script attempt detected, unable to create final report!");
370
  <?php endif; ?>
371
+
372
+ //DOCUMENT LOAD
373
+ $(document).ready(function () {
374
+
375
+ //INIT Routines
376
+ $("*[data-type='toggle']").click(DUPX.toggleClick);
377
+ $("#tabs").tabs();
378
+
379
+ });
380
  </script>
381
 
382
 
installer/installer.tpl CHANGED
@@ -13,6 +13,4061 @@ date_default_timezone_set('UTC'); // Some machines don’t have this set so just
13
  @ini_set('pcre.backtrack_limit', PHP_INT_MAX);
14
  @ini_set('default_socket_timeout', 3600);
15
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  class DUPX_CSRF {
17
 
18
  /** Session var name
@@ -45,7 +4100,8 @@ class DUPX_CSRF {
45
  return true;
46
  }
47
  if (isset($_COOKIE[DUPX_CSRF::$prefix . '_' . $form]) && $_COOKIE[DUPX_CSRF::$prefix . '_' . $form] == $token) { // token OK
48
- return (substr($token, -32) == DUPX_CSRF::fingerprint()); // fingerprint OK?
 
49
  }
50
  return FALSE;
51
  }
@@ -70,8 +4126,14 @@ class DUPX_CSRF {
70
 
71
  public static function setCookie($cookieName, $cookieVal) {
72
  $_COOKIE[$cookieName] = $cookieVal;
 
73
  return setcookie($cookieName, $cookieVal, time() + 10800, '/');
74
  }
 
 
 
 
 
75
 
76
  /**
77
  * @return bool
@@ -84,6 +4146,7 @@ class DUPX_CSRF {
84
  foreach ($_COOKIE as $cookieName => $cookieVal) {
85
  $step1Key = DUPX_CSRF::$prefix . '_step1';
86
  if ($step1Key != $cookieName && (0 === strpos($cookieName, DUPX_CSRF::$prefix) || 'archive' == $cookieName || 'bootloader' == $cookieName)) {
 
87
  setcookie($cookieName, '', time() - 86400, '/');
88
  unset($_COOKIE[$cookieName]);
89
  }
@@ -126,6 +4189,7 @@ class DUPX_Bootstrap
126
  const ARCHIVE_SIZE = '@@ARCHIVE_SIZE@@';
127
  const INSTALLER_DIR_NAME = 'dup-installer';
128
  const PACKAGE_HASH = '@@PACKAGE_HASH@@';
 
129
  const VERSION = '@@VERSION@@';
130
 
131
  public $hasZipArchive = false;
@@ -417,7 +4481,7 @@ class DUPX_Bootstrap
417
  self::log('Server: Nginx');
418
  }
419
 
420
- if ($is_apache || $is_nginx) {
421
  $htaccess_data = array();
422
  foreach ($php_ini_data as $php_ini_key=>$php_ini_val) {
423
  if ($is_apache) {
13
  @ini_set('pcre.backtrack_limit', PHP_INT_MAX);
14
  @ini_set('default_socket_timeout', 3600);
15
 
16
+ // phpseclib 1.0.14 for the Rijndael Symmetric key encryption
17
+ /**
18
+ * Base Class for all Crypt_* cipher classes
19
+ *
20
+ * PHP versions 4 and 5
21
+ *
22
+ * Internally for phpseclib developers:
23
+ * If you plan to add a new cipher class, please note following rules:
24
+ *
25
+ * - The new Crypt_* cipher class should extend Crypt_Base
26
+ *
27
+ * - Following methods are then required to be overridden/overloaded:
28
+ *
29
+ * - _encryptBlock()
30
+ *
31
+ * - _decryptBlock()
32
+ *
33
+ * - _setupKey()
34
+ *
35
+ * - All other methods are optional to be overridden/overloaded
36
+ *
37
+ * - Look at the source code of the current ciphers how they extend Crypt_Base
38
+ * and take one of them as a start up for the new cipher class.
39
+ *
40
+ * - Please read all the other comments/notes/hints here also for each class var/method
41
+ *
42
+ * LICENSE: Permission is hereby granted, free of charge, to any person obtaining a copy
43
+ * of this software and associated documentation files (the "Software"), to deal
44
+ * in the Software without restriction, including without limitation the rights
45
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
46
+ * copies of the Software, and to permit persons to whom the Software is
47
+ * furnished to do so, subject to the following conditions:
48
+ *
49
+ * The above copyright notice and this permission notice shall be included in
50
+ * all copies or substantial portions of the Software.
51
+ *
52
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
53
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
54
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
55
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
56
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
57
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
58
+ * THE SOFTWARE.
59
+ *
60
+ * @category Crypt
61
+ * @package Crypt_Base
62
+ * @author Jim Wigginton <terrafrost@php.net>
63
+ * @author Hans-Juergen Petrich <petrich@tronic-media.com>
64
+ * @copyright 2007 Jim Wigginton
65
+ * @license http://www.opensource.org/licenses/mit-license.html MIT License
66
+ * @link http://phpseclib.sourceforge.net
67
+ */
68
+
69
+ /**#@+
70
+ * @access public
71
+ * @see self::encrypt()
72
+ * @see self::decrypt()
73
+ */
74
+ /**
75
+ * Encrypt / decrypt using the Counter mode.
76
+ *
77
+ * Set to -1 since that's what Crypt/Random.php uses to index the CTR mode.
78
+ *
79
+ * @link http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation#Counter_.28CTR.29
80
+ */
81
+ define('CRYPT_MODE_CTR', -1);
82
+ /**
83
+ * Encrypt / decrypt using the Electronic Code Book mode.
84
+ *
85
+ * @link http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation#Electronic_codebook_.28ECB.29
86
+ */
87
+ define('CRYPT_MODE_ECB', 1);
88
+ /**
89
+ * Encrypt / decrypt using the Code Book Chaining mode.
90
+ *
91
+ * @link http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation#Cipher-block_chaining_.28CBC.29
92
+ */
93
+ define('CRYPT_MODE_CBC', 2);
94
+ /**
95
+ * Encrypt / decrypt using the Cipher Feedback mode.
96
+ *
97
+ * @link http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation#Cipher_feedback_.28CFB.29
98
+ */
99
+ define('CRYPT_MODE_CFB', 3);
100
+ /**
101
+ * Encrypt / decrypt using the Output Feedback mode.
102
+ *
103
+ * @link http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation#Output_feedback_.28OFB.29
104
+ */
105
+ define('CRYPT_MODE_OFB', 4);
106
+ /**
107
+ * Encrypt / decrypt using streaming mode.
108
+ */
109
+ define('CRYPT_MODE_STREAM', 5);
110
+ /**#@-*/
111
+
112
+ /**#@+
113
+ * @access private
114
+ * @see self::Crypt_Base()
115
+ * @internal These constants are for internal use only
116
+ */
117
+ /**
118
+ * Base value for the internal implementation $engine switch
119
+ */
120
+ define('CRYPT_ENGINE_INTERNAL', 1);
121
+ /**
122
+ * Base value for the mcrypt implementation $engine switch
123
+ */
124
+ define('CRYPT_ENGINE_MCRYPT', 2);
125
+ /**
126
+ * Base value for the OpenSSL implementation $engine switch
127
+ */
128
+ define('CRYPT_ENGINE_OPENSSL', 3);
129
+ /**#@-*/
130
+
131
+ /**
132
+ * Base Class for all Crypt_* cipher classes
133
+ *
134
+ * @package Crypt_Base
135
+ * @author Jim Wigginton <terrafrost@php.net>
136
+ * @author Hans-Juergen Petrich <petrich@tronic-media.com>
137
+ * @access public
138
+ */
139
+ class Crypt_Base
140
+ {
141
+ /**
142
+ * The Encryption Mode
143
+ *
144
+ * @see self::Crypt_Base()
145
+ * @var int
146
+ * @access private
147
+ */
148
+ var $mode;
149
+
150
+ /**
151
+ * The Block Length of the block cipher
152
+ *
153
+ * @var int
154
+ * @access private
155
+ */
156
+ var $block_size = 16;
157
+
158
+ /**
159
+ * The Key
160
+ *
161
+ * @see self::setKey()
162
+ * @var string
163
+ * @access private
164
+ */
165
+ var $key = "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0";
166
+
167
+ /**
168
+ * The Initialization Vector
169
+ *
170
+ * @see self::setIV()
171
+ * @var string
172
+ * @access private
173
+ */
174
+ var $iv;
175
+
176
+ /**
177
+ * A "sliding" Initialization Vector
178
+ *
179
+ * @see self::enableContinuousBuffer()
180
+ * @see self::_clearBuffers()
181
+ * @var string
182
+ * @access private
183
+ */
184
+ var $encryptIV;
185
+
186
+ /**
187
+ * A "sliding" Initialization Vector
188
+ *
189
+ * @see self::enableContinuousBuffer()
190
+ * @see self::_clearBuffers()
191
+ * @var string
192
+ * @access private
193
+ */
194
+ var $decryptIV;
195
+
196
+ /**
197
+ * Continuous Buffer status
198
+ *
199
+ * @see self::enableContinuousBuffer()
200
+ * @var bool
201
+ * @access private
202
+ */
203
+ var $continuousBuffer = false;
204
+
205
+ /**
206
+ * Encryption buffer for CTR, OFB and CFB modes
207
+ *
208
+ * @see self::encrypt()
209
+ * @see self::_clearBuffers()
210
+ * @var array
211
+ * @access private
212
+ */
213
+ var $enbuffer;
214
+
215
+ /**
216
+ * Decryption buffer for CTR, OFB and CFB modes
217
+ *
218
+ * @see self::decrypt()
219
+ * @see self::_clearBuffers()
220
+ * @var array
221
+ * @access private
222
+ */
223
+ var $debuffer;
224
+
225
+ /**
226
+ * mcrypt resource for encryption
227
+ *
228
+ * The mcrypt resource can be recreated every time something needs to be created or it can be created just once.
229
+ * Since mcrypt operates in continuous mode, by default, it'll need to be recreated when in non-continuous mode.
230
+ *
231
+ * @see self::encrypt()
232
+ * @var resource
233
+ * @access private
234
+ */
235
+ var $enmcrypt;
236
+
237
+ /**
238
+ * mcrypt resource for decryption
239
+ *
240
+ * The mcrypt resource can be recreated every time something needs to be created or it can be created just once.
241
+ * Since mcrypt operates in continuous mode, by default, it'll need to be recreated when in non-continuous mode.
242
+ *
243
+ * @see self::decrypt()
244
+ * @var resource
245
+ * @access private
246
+ */
247
+ var $demcrypt;
248
+
249
+ /**
250
+ * Does the enmcrypt resource need to be (re)initialized?
251
+ *
252
+ * @see Crypt_Twofish::setKey()
253
+ * @see Crypt_Twofish::setIV()
254
+ * @var bool
255
+ * @access private
256
+ */
257
+ var $enchanged = true;
258
+
259
+ /**
260
+ * Does the demcrypt resource need to be (re)initialized?
261
+ *
262
+ * @see Crypt_Twofish::setKey()
263
+ * @see Crypt_Twofish::setIV()
264
+ * @var bool
265
+ * @access private
266
+ */
267
+ var $dechanged = true;
268
+
269
+ /**
270
+ * mcrypt resource for CFB mode
271
+ *
272
+ * mcrypt's CFB mode, in (and only in) buffered context,
273
+ * is broken, so phpseclib implements the CFB mode by it self,
274
+ * even when the mcrypt php extension is available.
275
+ *
276
+ * In order to do the CFB-mode work (fast) phpseclib
277
+ * use a separate ECB-mode mcrypt resource.
278
+ *
279
+ * @link http://phpseclib.sourceforge.net/cfb-demo.phps
280
+ * @see self::encrypt()
281
+ * @see self::decrypt()
282
+ * @see self::_setupMcrypt()
283
+ * @var resource
284
+ * @access private
285
+ */
286
+ var $ecb;
287
+
288
+ /**
289
+ * Optimizing value while CFB-encrypting
290
+ *
291
+ * Only relevant if $continuousBuffer enabled
292
+ * and $engine == CRYPT_ENGINE_MCRYPT
293
+ *
294
+ * It's faster to re-init $enmcrypt if
295
+ * $buffer bytes > $cfb_init_len than
296
+ * using the $ecb resource furthermore.
297
+ *
298
+ * This value depends of the chosen cipher
299
+ * and the time it would be needed for it's
300
+ * initialization [by mcrypt_generic_init()]
301
+ * which, typically, depends on the complexity
302
+ * on its internaly Key-expanding algorithm.
303
+ *
304
+ * @see self::encrypt()
305
+ * @var int
306
+ * @access private
307
+ */
308
+ var $cfb_init_len = 600;
309
+
310
+ /**
311
+ * Does internal cipher state need to be (re)initialized?
312
+ *
313
+ * @see self::setKey()
314
+ * @see self::setIV()
315
+ * @see self::disableContinuousBuffer()
316
+ * @var bool
317
+ * @access private
318
+ */
319
+ var $changed = true;
320
+
321
+ /**
322
+ * Padding status
323
+ *
324
+ * @see self::enablePadding()
325
+ * @var bool
326
+ * @access private
327
+ */
328
+ var $padding = true;
329
+
330
+ /**
331
+ * Is the mode one that is paddable?
332
+ *
333
+ * @see self::Crypt_Base()
334
+ * @var bool
335
+ * @access private
336
+ */
337
+ var $paddable = false;
338
+
339
+ /**
340
+ * Holds which crypt engine internaly should be use,
341
+ * which will be determined automatically on __construct()
342
+ *
343
+ * Currently available $engines are:
344
+ * - CRYPT_ENGINE_OPENSSL (very fast, php-extension: openssl, extension_loaded('openssl') required)
345
+ * - CRYPT_ENGINE_MCRYPT (fast, php-extension: mcrypt, extension_loaded('mcrypt') required)
346
+ * - CRYPT_ENGINE_INTERNAL (slower, pure php-engine, no php-extension required)
347
+ *
348
+ * @see self::_setEngine()
349
+ * @see self::encrypt()
350
+ * @see self::decrypt()
351
+ * @var int
352
+ * @access private
353
+ */
354
+ var $engine;
355
+
356
+ /**
357
+ * Holds the preferred crypt engine
358
+ *
359
+ * @see self::_setEngine()
360
+ * @see self::setPreferredEngine()
361
+ * @var int
362
+ * @access private
363
+ */
364
+ var $preferredEngine;
365
+
366
+ /**
367
+ * The mcrypt specific name of the cipher
368
+ *
369
+ * Only used if $engine == CRYPT_ENGINE_MCRYPT
370
+ *
371
+ * @link http://www.php.net/mcrypt_module_open
372
+ * @link http://www.php.net/mcrypt_list_algorithms
373
+ * @see self::_setupMcrypt()
374
+ * @var string
375
+ * @access private
376
+ */
377
+ var $cipher_name_mcrypt;
378
+
379
+ /**
380
+ * The openssl specific name of the cipher
381
+ *
382
+ * Only used if $engine == CRYPT_ENGINE_OPENSSL
383
+ *
384
+ * @link http://www.php.net/openssl-get-cipher-methods
385
+ * @var string
386
+ * @access private
387
+ */
388
+ var $cipher_name_openssl;
389
+
390
+ /**
391
+ * The openssl specific name of the cipher in ECB mode
392
+ *
393
+ * If OpenSSL does not support the mode we're trying to use (CTR)
394
+ * it can still be emulated with ECB mode.
395
+ *
396
+ * @link http://www.php.net/openssl-get-cipher-methods
397
+ * @var string
398
+ * @access private
399
+ */
400
+ var $cipher_name_openssl_ecb;
401
+
402
+ /**
403
+ * The default salt used by setPassword()
404
+ *
405
+ * @see self::setPassword()
406
+ * @var string
407
+ * @access private
408
+ */
409
+ var $password_default_salt = 'phpseclib/salt';
410
+
411
+ /**
412
+ * The namespace used by the cipher for its constants.
413
+ *
414
+ * ie: AES.php is using CRYPT_AES_MODE_* for its constants
415
+ * so $const_namespace is AES
416
+ *
417
+ * DES.php is using CRYPT_DES_MODE_* for its constants
418
+ * so $const_namespace is DES... and so on
419
+ *
420
+ * All CRYPT_<$const_namespace>_MODE_* are aliases of
421
+ * the generic CRYPT_MODE_* constants, so both could be used
422
+ * for each cipher.
423
+ *
424
+ * Example:
425
+ * $aes = new Crypt_AES(CRYPT_AES_MODE_CFB); // $aes will operate in cfb mode
426
+ * $aes = new Crypt_AES(CRYPT_MODE_CFB); // identical
427
+ *
428
+ * @see self::Crypt_Base()
429
+ * @var string
430
+ * @access private
431
+ */
432
+ var $const_namespace;
433
+
434
+ /**
435
+ * The name of the performance-optimized callback function
436
+ *
437
+ * Used by encrypt() / decrypt()
438
+ * only if $engine == CRYPT_ENGINE_INTERNAL
439
+ *
440
+ * @see self::encrypt()
441
+ * @see self::decrypt()
442
+ * @see self::_setupInlineCrypt()
443
+ * @see self::$use_inline_crypt
444
+ * @var Callback
445
+ * @access private
446
+ */
447
+ var $inline_crypt;
448
+
449
+ /**
450
+ * Holds whether performance-optimized $inline_crypt() can/should be used.
451
+ *
452
+ * @see self::encrypt()
453
+ * @see self::decrypt()
454
+ * @see self::inline_crypt
455
+ * @var mixed
456
+ * @access private
457
+ */
458
+ var $use_inline_crypt;
459
+
460
+ /**
461
+ * If OpenSSL can be used in ECB but not in CTR we can emulate CTR
462
+ *
463
+ * @see self::_openssl_ctr_process()
464
+ * @var bool
465
+ * @access private
466
+ */
467
+ var $openssl_emulate_ctr = false;
468
+
469
+ /**
470
+ * Determines what options are passed to openssl_encrypt/decrypt
471
+ *
472
+ * @see self::isValidEngine()
473
+ * @var mixed
474
+ * @access private
475
+ */
476
+ var $openssl_options;
477
+
478
+ /**
479
+ * Has the key length explicitly been set or should it be derived from the key, itself?
480
+ *
481
+ * @see self::setKeyLength()
482
+ * @var bool
483
+ * @access private
484
+ */
485
+ var $explicit_key_length = false;
486
+
487
+ /**
488
+ * Don't truncate / null pad key
489
+ *
490
+ * @see self::_clearBuffers()
491
+ * @var bool
492
+ * @access private
493
+ */
494
+ var $skip_key_adjustment = false;
495
+
496
+ /**
497
+ * Default Constructor.
498
+ *
499
+ * Determines whether or not the mcrypt extension should be used.
500
+ *
501
+ * $mode could be:
502
+ *
503
+ * - CRYPT_MODE_ECB
504
+ *
505
+ * - CRYPT_MODE_CBC
506
+ *
507
+ * - CRYPT_MODE_CTR
508
+ *
509
+ * - CRYPT_MODE_CFB
510
+ *
511
+ * - CRYPT_MODE_OFB
512
+ *
513
+ * (or the alias constants of the chosen cipher, for example for AES: CRYPT_AES_MODE_ECB or CRYPT_AES_MODE_CBC ...)
514
+ *
515
+ * If not explicitly set, CRYPT_MODE_CBC will be used.
516
+ *
517
+ * @param int $mode
518
+ * @access public
519
+ */
520
+ function __construct($mode = CRYPT_MODE_CBC)
521
+ {
522
+ // $mode dependent settings
523
+ switch ($mode) {
524
+ case CRYPT_MODE_ECB:
525
+ $this->paddable = true;
526
+ $this->mode = CRYPT_MODE_ECB;
527
+ break;
528
+ case CRYPT_MODE_CTR:
529
+ case CRYPT_MODE_CFB:
530
+ case CRYPT_MODE_OFB:
531
+ case CRYPT_MODE_STREAM:
532
+ $this->mode = $mode;
533
+ break;
534
+ case CRYPT_MODE_CBC:
535
+ default:
536
+ $this->paddable = true;
537
+ $this->mode = CRYPT_MODE_CBC;
538
+ }
539
+
540
+ $this->_setEngine();
541
+
542
+ // Determining whether inline crypting can be used by the cipher
543
+ if ($this->use_inline_crypt !== false) {
544
+ $this->use_inline_crypt = version_compare(PHP_VERSION, '5.3.0') >= 0 || function_exists('create_function');
545
+ }
546
+ }
547
+
548
+ /**
549
+ * PHP4 compatible Default Constructor.
550
+ *
551
+ * @see self::__construct()
552
+ * @param int $mode
553
+ * @access public
554
+ */
555
+ function Crypt_Base($mode = CRYPT_MODE_CBC)
556
+ {
557
+ $this->__construct($mode);
558
+ }
559
+
560
+ /**
561
+ * Sets the initialization vector. (optional)
562
+ *
563
+ * SetIV is not required when CRYPT_MODE_ECB (or ie for AES: CRYPT_AES_MODE_ECB) is being used. If not explicitly set, it'll be assumed
564
+ * to be all zero's.
565
+ *
566
+ * @access public
567
+ * @param string $iv
568
+ * @internal Can be overwritten by a sub class, but does not have to be
569
+ */
570
+ function setIV($iv)
571
+ {
572
+ if ($this->mode == CRYPT_MODE_ECB) {
573
+ return;
574
+ }
575
+
576
+ $this->iv = $iv;
577
+ $this->changed = true;
578
+ }
579
+
580
+ /**
581
+ * Sets the key length.
582
+ *
583
+ * Keys with explicitly set lengths need to be treated accordingly
584
+ *
585
+ * @access public
586
+ * @param int $length
587
+ */
588
+ function setKeyLength($length)
589
+ {
590
+ $this->explicit_key_length = true;
591
+ $this->changed = true;
592
+ $this->_setEngine();
593
+ }
594
+
595
+ /**
596
+ * Returns the current key length in bits
597
+ *
598
+ * @access public
599
+ * @return int
600
+ */
601
+ function getKeyLength()
602
+ {
603
+ return $this->key_length << 3;
604
+ }
605
+
606
+ /**
607
+ * Returns the current block length in bits
608
+ *
609
+ * @access public
610
+ * @return int
611
+ */
612
+ function getBlockLength()
613
+ {
614
+ return $this->block_size << 3;
615
+ }
616
+
617
+ /**
618
+ * Sets the key.
619
+ *
620
+ * The min/max length(s) of the key depends on the cipher which is used.
621
+ * If the key not fits the length(s) of the cipher it will paded with null bytes
622
+ * up to the closest valid key length. If the key is more than max length,
623
+ * we trim the excess bits.
624
+ *
625
+ * If the key is not explicitly set, it'll be assumed to be all null bytes.
626
+ *
627
+ * @access public
628
+ * @param string $key
629
+ * @internal Could, but not must, extend by the child Crypt_* class
630
+ */
631
+ function setKey($key)
632
+ {
633
+ if (!$this->explicit_key_length) {
634
+ $this->setKeyLength(strlen($key) << 3);
635
+ $this->explicit_key_length = false;
636
+ }
637
+
638
+ $this->key = $key;
639
+ $this->changed = true;
640
+ $this->_setEngine();
641
+ }
642
+
643
+ /**
644
+ * Sets the password.
645
+ *
646
+ * Depending on what $method is set to, setPassword()'s (optional) parameters are as follows:
647
+ * {@link http://en.wikipedia.org/wiki/PBKDF2 pbkdf2} or pbkdf1:
648
+ * $hash, $salt, $count, $dkLen
649
+ *
650
+ * Where $hash (default = sha1) currently supports the following hashes: see: Crypt/Hash.php
651
+ *
652
+ * @see Crypt/Hash.php
653
+ * @param string $password
654
+ * @param string $method
655
+ * @return bool
656
+ * @access public
657
+ * @internal Could, but not must, extend by the child Crypt_* class
658
+ */
659
+ function setPassword($password, $method = 'pbkdf2')
660
+ {
661
+ $key = '';
662
+
663
+ switch ($method) {
664
+ default: // 'pbkdf2' or 'pbkdf1'
665
+ $func_args = func_get_args();
666
+
667
+ // Hash function
668
+ $hash = isset($func_args[2]) ? $func_args[2] : 'sha1';
669
+
670
+ // WPA and WPA2 use the SSID as the salt
671
+ $salt = isset($func_args[3]) ? $func_args[3] : $this->password_default_salt;
672
+
673
+ // RFC2898#section-4.2 uses 1,000 iterations by default
674
+ // WPA and WPA2 use 4,096.
675
+ $count = isset($func_args[4]) ? $func_args[4] : 1000;
676
+
677
+ // Keylength
678
+ if (isset($func_args[5]) && $func_args[5] > 0) {
679
+ $dkLen = $func_args[5];
680
+ } else {
681
+ $dkLen = $method == 'pbkdf1' ? 2 * $this->key_length : $this->key_length;
682
+ }
683
+
684
+ switch (true) {
685
+ case $method == 'pbkdf1':
686
+ /*
687
+ if (!class_exists('Crypt_Hash')) {
688
+ include_once 'Crypt/Hash.php';
689
+ }
690
+ */
691
+ $hashObj = new Crypt_Hash();
692
+ $hashObj->setHash($hash);
693
+ if ($dkLen > $hashObj->getLength()) {
694
+ user_error('Derived key too long');
695
+ return false;
696
+ }
697
+ $t = $password . $salt;
698
+ for ($i = 0; $i < $count; ++$i) {
699
+ $t = $hashObj->hash($t);
700
+ }
701
+ $key = substr($t, 0, $dkLen);
702
+
703
+ $this->setKey(substr($key, 0, $dkLen >> 1));
704
+ $this->setIV(substr($key, $dkLen >> 1));
705
+
706
+ return true;
707
+ // Determining if php[>=5.5.0]'s hash_pbkdf2() function avail- and useable
708
+ case !function_exists('hash_pbkdf2'):
709
+ case !function_exists('hash_algos'):
710
+ case !in_array($hash, hash_algos()):
711
+ /*
712
+ if (!class_exists('Crypt_Hash')) {
713
+ include_once 'Crypt/Hash.php';
714
+ }
715
+ */
716
+ $i = 1;
717
+ $hmac = new Crypt_Hash();
718
+ $hmac->setHash($hash);
719
+ $hmac->setKey($password);
720
+ while (strlen($key) < $dkLen) {
721
+ $f = $u = $hmac->hash($salt . pack('N', $i++));
722
+ for ($j = 2; $j <= $count; ++$j) {
723
+ $u = $hmac->hash($u);
724
+ $f^= $u;
725
+ }
726
+ $key.= $f;
727
+ }
728
+ $key = substr($key, 0, $dkLen);
729
+ break;
730
+ default:
731
+ $key = hash_pbkdf2($hash, $password, $salt, $count, $dkLen, true);
732
+ }
733
+ }
734
+
735
+ $this->setKey($key);
736
+
737
+ return true;
738
+ }
739
+
740
+ /**
741
+ * Encrypts a message.
742
+ *
743
+ * $plaintext will be padded with additional bytes such that it's length is a multiple of the block size. Other cipher
744
+ * implementations may or may not pad in the same manner. Other common approaches to padding and the reasons why it's
745
+ * necessary are discussed in the following
746
+ * URL:
747
+ *
748
+ * {@link http://www.di-mgt.com.au/cryptopad.html http://www.di-mgt.com.au/cryptopad.html}
749
+ *
750
+ * An alternative to padding is to, separately, send the length of the file. This is what SSH, in fact, does.
751
+ * strlen($plaintext) will still need to be a multiple of the block size, however, arbitrary values can be added to make it that
752
+ * length.
753
+ *
754
+ * @see self::decrypt()
755
+ * @access public
756
+ * @param string $plaintext
757
+ * @return string $ciphertext
758
+ * @internal Could, but not must, extend by the child Crypt_* class
759
+ */
760
+ function encrypt($plaintext)
761
+ {
762
+ if ($this->paddable) {
763
+ $plaintext = $this->_pad($plaintext);
764
+ }
765
+
766
+ if ($this->engine === CRYPT_ENGINE_OPENSSL) {
767
+ if ($this->changed) {
768
+ $this->_clearBuffers();
769
+ $this->changed = false;
770
+ }
771
+ switch ($this->mode) {
772
+ case CRYPT_MODE_STREAM:
773
+ return openssl_encrypt($plaintext, $this->cipher_name_openssl, $this->key, $this->openssl_options);
774
+ case CRYPT_MODE_ECB:
775
+ $result = openssl_encrypt($plaintext, $this->cipher_name_openssl, $this->key, $this->openssl_options);
776
+ return !defined('OPENSSL_RAW_DATA') ? substr($result, 0, -$this->block_size) : $result;
777
+ case CRYPT_MODE_CBC:
778
+ $result = openssl_encrypt($plaintext, $this->cipher_name_openssl, $this->key, $this->openssl_options, $this->encryptIV);
779
+ if (!defined('OPENSSL_RAW_DATA')) {
780
+ $result = substr($result, 0, -$this->block_size);
781
+ }
782
+ if ($this->continuousBuffer) {
783
+ $this->encryptIV = substr($result, -$this->block_size);
784
+ }
785
+ return $result;
786
+ case CRYPT_MODE_CTR:
787
+ return $this->_openssl_ctr_process($plaintext, $this->encryptIV, $this->enbuffer);
788
+ case CRYPT_MODE_CFB:
789
+ // cfb loosely routines inspired by openssl's:
790
+ // {@link http://cvs.openssl.org/fileview?f=openssl/crypto/modes/cfb128.c&v=1.3.2.2.2.1}
791
+ $ciphertext = '';
792
+ if ($this->continuousBuffer) {
793
+ $iv = &$this->encryptIV;
794
+ $pos = &$this->enbuffer['pos'];
795
+ } else {
796
+ $iv = $this->encryptIV;
797
+ $pos = 0;
798
+ }
799
+ $len = strlen($plaintext);
800
+ $i = 0;
801
+ if ($pos) {
802
+ $orig_pos = $pos;
803
+ $max = $this->block_size - $pos;
804
+ if ($len >= $max) {
805
+ $i = $max;
806
+ $len-= $max;
807
+ $pos = 0;
808
+ } else {
809
+ $i = $len;
810
+ $pos+= $len;
811
+ $len = 0;
812
+ }
813
+ // ie. $i = min($max, $len), $len-= $i, $pos+= $i, $pos%= $blocksize
814
+ $ciphertext = substr($iv, $orig_pos) ^ $plaintext;
815
+ $iv = substr_replace($iv, $ciphertext, $orig_pos, $i);
816
+ $plaintext = substr($plaintext, $i);
817
+ }
818
+
819
+ $overflow = $len % $this->block_size;
820
+
821
+ if ($overflow) {
822
+ $ciphertext.= openssl_encrypt(substr($plaintext, 0, -$overflow) . str_repeat("\0", $this->block_size), $this->cipher_name_openssl, $this->key, $this->openssl_options, $iv);
823
+ $iv = $this->_string_pop($ciphertext, $this->block_size);
824
+
825
+ $size = $len - $overflow;
826
+ $block = $iv ^ substr($plaintext, -$overflow);
827
+ $iv = substr_replace($iv, $block, 0, $overflow);
828
+ $ciphertext.= $block;
829
+ $pos = $overflow;
830
+ } elseif ($len) {
831
+ $ciphertext = openssl_encrypt($plaintext, $this->cipher_name_openssl, $this->key, $this->openssl_options, $iv);
832
+ $iv = substr($ciphertext, -$this->block_size);
833
+ }
834
+
835
+ return $ciphertext;
836
+ case CRYPT_MODE_OFB:
837
+ return $this->_openssl_ofb_process($plaintext, $this->encryptIV, $this->enbuffer);
838
+ }
839
+ }
840
+
841
+ if ($this->engine === CRYPT_ENGINE_MCRYPT) {
842
+ if ($this->changed) {
843
+ $this->_setupMcrypt();
844
+ $this->changed = false;
845
+ }
846
+ if ($this->enchanged) {
847
+ @mcrypt_generic_init($this->enmcrypt, $this->key, $this->encryptIV);
848
+ $this->enchanged = false;
849
+ }
850
+
851
+ // re: {@link http://phpseclib.sourceforge.net/cfb-demo.phps}
852
+ // using mcrypt's default handing of CFB the above would output two different things. using phpseclib's
853
+ // rewritten CFB implementation the above outputs the same thing twice.
854
+ if ($this->mode == CRYPT_MODE_CFB && $this->continuousBuffer) {
855
+ $block_size = $this->block_size;
856
+ $iv = &$this->encryptIV;
857
+ $pos = &$this->enbuffer['pos'];
858
+ $len = strlen($plaintext);
859
+ $ciphertext = '';
860
+ $i = 0;
861
+ if ($pos) {
862
+ $orig_pos = $pos;
863
+ $max = $block_size - $pos;
864
+ if ($len >= $max) {
865
+ $i = $max;
866
+ $len-= $max;
867
+ $pos = 0;
868
+ } else {
869
+ $i = $len;
870
+ $pos+= $len;
871
+ $len = 0;
872
+ }
873
+ $ciphertext = substr($iv, $orig_pos) ^ $plaintext;
874
+ $iv = substr_replace($iv, $ciphertext, $orig_pos, $i);
875
+ $this->enbuffer['enmcrypt_init'] = true;
876
+ }
877
+ if ($len >= $block_size) {
878
+ if ($this->enbuffer['enmcrypt_init'] === false || $len > $this->cfb_init_len) {
879
+ if ($this->enbuffer['enmcrypt_init'] === true) {
880
+ @mcrypt_generic_init($this->enmcrypt, $this->key, $iv);
881
+ $this->enbuffer['enmcrypt_init'] = false;
882
+ }
883
+ $ciphertext.= @mcrypt_generic($this->enmcrypt, substr($plaintext, $i, $len - $len % $block_size));
884
+ $iv = substr($ciphertext, -$block_size);
885
+ $len%= $block_size;
886
+ } else {
887
+ while ($len >= $block_size) {
888
+ $iv = @mcrypt_generic($this->ecb, $iv) ^ substr($plaintext, $i, $block_size);
889
+ $ciphertext.= $iv;
890
+ $len-= $block_size;
891
+ $i+= $block_size;
892
+ }
893
+ }
894
+ }
895
+
896
+ if ($len) {
897
+ $iv = @mcrypt_generic($this->ecb, $iv);
898
+ $block = $iv ^ substr($plaintext, -$len);
899
+ $iv = substr_replace($iv, $block, 0, $len);
900
+ $ciphertext.= $block;
901
+ $pos = $len;
902
+ }
903
+
904
+ return $ciphertext;
905
+ }
906
+
907
+ $ciphertext = @mcrypt_generic($this->enmcrypt, $plaintext);
908
+
909
+ if (!$this->continuousBuffer) {
910
+ @mcrypt_generic_init($this->enmcrypt, $this->key, $this->encryptIV);
911
+ }
912
+
913
+ return $ciphertext;
914
+ }
915
+
916
+ if ($this->changed) {
917
+ $this->_setup();
918
+ $this->changed = false;
919
+ }
920
+ if ($this->use_inline_crypt) {
921
+ $inline = $this->inline_crypt;
922
+ return $inline('encrypt', $this, $plaintext);
923
+ }
924
+
925
+ $buffer = &$this->enbuffer;
926
+ $block_size = $this->block_size;
927
+ $ciphertext = '';
928
+ switch ($this->mode) {
929
+ case CRYPT_MODE_ECB:
930
+ for ($i = 0; $i < strlen($plaintext); $i+=$block_size) {
931
+ $ciphertext.= $this->_encryptBlock(substr($plaintext, $i, $block_size));
932
+ }
933
+ break;
934
+ case CRYPT_MODE_CBC:
935
+ $xor = $this->encryptIV;
936
+ for ($i = 0; $i < strlen($plaintext); $i+=$block_size) {
937
+ $block = substr($plaintext, $i, $block_size);
938
+ $block = $this->_encryptBlock($block ^ $xor);
939
+ $xor = $block;
940
+ $ciphertext.= $block;
941
+ }
942
+ if ($this->continuousBuffer) {
943
+ $this->encryptIV = $xor;
944
+ }
945
+ break;
946
+ case CRYPT_MODE_CTR:
947
+ $xor = $this->encryptIV;
948
+ if (strlen($buffer['ciphertext'])) {
949
+ for ($i = 0; $i < strlen($plaintext); $i+=$block_size) {
950
+ $block = substr($plaintext, $i, $block_size);
951
+ if (strlen($block) > strlen($buffer['ciphertext'])) {
952
+ $buffer['ciphertext'].= $this->_encryptBlock($xor);
953
+ }
954
+ $this->_increment_str($xor);
955
+ $key = $this->_string_shift($buffer['ciphertext'], $block_size);
956
+ $ciphertext.= $block ^ $key;
957
+ }
958
+ } else {
959
+ for ($i = 0; $i < strlen($plaintext); $i+=$block_size) {
960
+ $block = substr($plaintext, $i, $block_size);
961
+ $key = $this->_encryptBlock($xor);
962
+ $this->_increment_str($xor);
963
+ $ciphertext.= $block ^ $key;
964
+ }
965
+ }
966
+ if ($this->continuousBuffer) {
967
+ $this->encryptIV = $xor;
968
+ if ($start = strlen($plaintext) % $block_size) {
969
+ $buffer['ciphertext'] = substr($key, $start) . $buffer['ciphertext'];
970
+ }
971
+ }
972
+ break;
973
+ case CRYPT_MODE_CFB:
974
+ // cfb loosely routines inspired by openssl's:
975
+ // {@link http://cvs.openssl.org/fileview?f=openssl/crypto/modes/cfb128.c&v=1.3.2.2.2.1}
976
+ if ($this->continuousBuffer) {
977
+ $iv = &$this->encryptIV;
978
+ $pos = &$buffer['pos'];
979
+ } else {
980
+ $iv = $this->encryptIV;
981
+ $pos = 0;
982
+ }
983
+ $len = strlen($plaintext);
984
+ $i = 0;
985
+ if ($pos) {
986
+ $orig_pos = $pos;
987
+ $max = $block_size - $pos;
988
+ if ($len >= $max) {
989
+ $i = $max;
990
+ $len-= $max;
991
+ $pos = 0;
992
+ } else {
993
+ $i = $len;
994
+ $pos+= $len;
995
+ $len = 0;
996
+ }
997
+ // ie. $i = min($max, $len), $len-= $i, $pos+= $i, $pos%= $blocksize
998
+ $ciphertext = substr($iv, $orig_pos) ^ $plaintext;
999
+ $iv = substr_replace($iv, $ciphertext, $orig_pos, $i);
1000
+ }
1001
+ while ($len >= $block_size) {
1002
+ $iv = $this->_encryptBlock($iv) ^ substr($plaintext, $i, $block_size);
1003
+ $ciphertext.= $iv;
1004
+ $len-= $block_size;
1005
+ $i+= $block_size;
1006
+ }
1007
+ if ($len) {
1008
+ $iv = $this->_encryptBlock($iv);
1009
+ $block = $iv ^ substr($plaintext, $i);
1010
+ $iv = substr_replace($iv, $block, 0, $len);
1011
+ $ciphertext.= $block;
1012
+ $pos = $len;
1013
+ }
1014
+ break;
1015
+ case CRYPT_MODE_OFB:
1016
+ $xor = $this->encryptIV;
1017
+ if (strlen($buffer['xor'])) {
1018
+ for ($i = 0; $i < strlen($plaintext); $i+=$block_size) {
1019
+ $block = substr($plaintext, $i, $block_size);
1020
+ if (strlen($block) > strlen($buffer['xor'])) {
1021
+ $xor = $this->_encryptBlock($xor);
1022
+ $buffer['xor'].= $xor;
1023
+ }
1024
+ $key = $this->_string_shift($buffer['xor'], $block_size);
1025
+ $ciphertext.= $block ^ $key;
1026
+ }
1027
+ } else {
1028
+ for ($i = 0; $i < strlen($plaintext); $i+=$block_size) {
1029
+ $xor = $this->_encryptBlock($xor);
1030
+ $ciphertext.= substr($plaintext, $i, $block_size) ^ $xor;
1031
+ }
1032
+ $key = $xor;
1033
+ }
1034
+ if ($this->continuousBuffer) {
1035
+ $this->encryptIV = $xor;
1036
+ if ($start = strlen($plaintext) % $block_size) {
1037
+ $buffer['xor'] = substr($key, $start) . $buffer['xor'];
1038
+ }
1039
+ }
1040
+ break;
1041
+ case CRYPT_MODE_STREAM:
1042
+ $ciphertext = $this->_encryptBlock($plaintext);
1043
+ break;
1044
+ }
1045
+
1046
+ return $ciphertext;
1047
+ }
1048
+
1049
+ /**
1050
+ * Decrypts a message.
1051
+ *
1052
+ * If strlen($ciphertext) is not a multiple of the block size, null bytes will be added to the end of the string until
1053
+ * it is.
1054
+ *
1055
+ * @see self::encrypt()
1056
+ * @access public
1057
+ * @param string $ciphertext
1058
+ * @return string $plaintext
1059
+ * @internal Could, but not must, extend by the child Crypt_* class
1060
+ */
1061
+ function decrypt($ciphertext)
1062
+ {
1063
+ if ($this->paddable) {
1064
+ // we pad with chr(0) since that's what mcrypt_generic does. to quote from {@link http://www.php.net/function.mcrypt-generic}:
1065
+ // "The data is padded with "\0" to make sure the length of the data is n * blocksize."
1066
+ $ciphertext = str_pad($ciphertext, strlen($ciphertext) + ($this->block_size - strlen($ciphertext) % $this->block_size) % $this->block_size, chr(0));
1067
+ }
1068
+
1069
+ if ($this->engine === CRYPT_ENGINE_OPENSSL) {
1070
+ if ($this->changed) {
1071
+ $this->_clearBuffers();
1072
+ $this->changed = false;
1073
+ }
1074
+ switch ($this->mode) {
1075
+ case CRYPT_MODE_STREAM:
1076
+ $plaintext = openssl_decrypt($ciphertext, $this->cipher_name_openssl, $this->key, $this->openssl_options);
1077
+ break;
1078
+ case CRYPT_MODE_ECB:
1079
+ if (!defined('OPENSSL_RAW_DATA')) {
1080
+ $ciphertext.= openssl_encrypt('', $this->cipher_name_openssl_ecb, $this->key, true);
1081
+ }
1082
+ $plaintext = openssl_decrypt($ciphertext, $this->cipher_name_openssl, $this->key, $this->openssl_options);
1083
+ break;
1084
+ case CRYPT_MODE_CBC:
1085
+ if (!defined('OPENSSL_RAW_DATA')) {
1086
+ $padding = str_repeat(chr($this->block_size), $this->block_size) ^ substr($ciphertext, -$this->block_size);
1087
+ $ciphertext.= substr(openssl_encrypt($padding, $this->cipher_name_openssl_ecb, $this->key, true), 0, $this->block_size);
1088
+ $offset = 2 * $this->block_size;
1089
+ } else {
1090
+ $offset = $this->block_size;
1091
+ }
1092
+ $plaintext = openssl_decrypt($ciphertext, $this->cipher_name_openssl, $this->key, $this->openssl_options, $this->decryptIV);
1093
+ if ($this->continuousBuffer) {
1094
+ $this->decryptIV = substr($ciphertext, -$offset, $this->block_size);
1095
+ }
1096
+ break;
1097
+ case CRYPT_MODE_CTR:
1098
+ $plaintext = $this->_openssl_ctr_process($ciphertext, $this->decryptIV, $this->debuffer);
1099
+ break;
1100
+ case CRYPT_MODE_CFB:
1101
+ // cfb loosely routines inspired by openssl's:
1102
+ // {@link http://cvs.openssl.org/fileview?f=openssl/crypto/modes/cfb128.c&v=1.3.2.2.2.1}
1103
+ $plaintext = '';
1104
+ if ($this->continuousBuffer) {
1105
+ $iv = &$this->decryptIV;
1106
+ $pos = &$this->buffer['pos'];
1107
+ } else {
1108
+ $iv = $this->decryptIV;
1109
+ $pos = 0;
1110
+ }
1111
+ $len = strlen($ciphertext);
1112
+ $i = 0;
1113
+ if ($pos) {
1114
+ $orig_pos = $pos;
1115
+ $max = $this->block_size - $pos;
1116
+ if ($len >= $max) {
1117
+ $i = $max;
1118
+ $len-= $max;
1119
+ $pos = 0;
1120
+ } else {
1121
+ $i = $len;
1122
+ $pos+= $len;
1123
+ $len = 0;
1124
+ }
1125
+ // ie. $i = min($max, $len), $len-= $i, $pos+= $i, $pos%= $this->blocksize
1126
+ $plaintext = substr($iv, $orig_pos) ^ $ciphertext;
1127
+ $iv = substr_replace($iv, substr($ciphertext, 0, $i), $orig_pos, $i);
1128
+ $ciphertext = substr($ciphertext, $i);
1129
+ }
1130
+ $overflow = $len % $this->block_size;
1131
+ if ($overflow) {
1132
+ $plaintext.= openssl_decrypt(substr($ciphertext, 0, -$overflow), $this->cipher_name_openssl, $this->key, $this->openssl_options, $iv);
1133
+ if ($len - $overflow) {
1134
+ $iv = substr($ciphertext, -$overflow - $this->block_size, -$overflow);
1135
+ }
1136
+ $iv = openssl_encrypt(str_repeat("\0", $this->block_size), $this->cipher_name_openssl, $this->key, $this->openssl_options, $iv);
1137
+ $plaintext.= $iv ^ substr($ciphertext, -$overflow);
1138
+ $iv = substr_replace($iv, substr($ciphertext, -$overflow), 0, $overflow);
1139
+ $pos = $overflow;
1140
+ } elseif ($len) {
1141
+ $plaintext.= openssl_decrypt($ciphertext, $this->cipher_name_openssl, $this->key, $this->openssl_options, $iv);
1142
+ $iv = substr($ciphertext, -$this->block_size);
1143
+ }
1144
+ break;
1145
+ case CRYPT_MODE_OFB:
1146
+ $plaintext = $this->_openssl_ofb_process($ciphertext, $this->decryptIV, $this->debuffer);
1147
+ }
1148
+
1149
+ return $this->paddable ? $this->_unpad($plaintext) : $plaintext;
1150
+ }
1151
+
1152
+ if ($this->engine === CRYPT_ENGINE_MCRYPT) {
1153
+ $block_size = $this->block_size;
1154
+ if ($this->changed) {
1155
+ $this->_setupMcrypt();
1156
+ $this->changed = false;
1157
+ }
1158
+ if ($this->dechanged) {
1159
+ @mcrypt_generic_init($this->demcrypt, $this->key, $this->decryptIV);
1160
+ $this->dechanged = false;
1161
+ }
1162
+
1163
+ if ($this->mode == CRYPT_MODE_CFB && $this->continuousBuffer) {
1164
+ $iv = &$this->decryptIV;
1165
+ $pos = &$this->debuffer['pos'];
1166
+ $len = strlen($ciphertext);
1167
+ $plaintext = '';
1168
+ $i = 0;
1169
+ if ($pos) {
1170
+ $orig_pos = $pos;
1171
+ $max = $block_size - $pos;
1172
+ if ($len >= $max) {
1173
+ $i = $max;
1174
+ $len-= $max;
1175
+ $pos = 0;
1176
+ } else {
1177
+ $i = $len;
1178
+ $pos+= $len;
1179
+ $len = 0;
1180
+ }
1181
+ // ie. $i = min($max, $len), $len-= $i, $pos+= $i, $pos%= $blocksize
1182
+ $plaintext = substr($iv, $orig_pos) ^ $ciphertext;
1183
+ $iv = substr_replace($iv, substr($ciphertext, 0, $i), $orig_pos, $i);
1184
+ }
1185
+ if ($len >= $block_size) {
1186
+ $cb = substr($ciphertext, $i, $len - $len % $block_size);
1187
+ $plaintext.= @mcrypt_generic($this->ecb, $iv . $cb) ^ $cb;
1188
+ $iv = substr($cb, -$block_size);
1189
+ $len%= $block_size;
1190
+ }
1191
+ if ($len) {
1192
+ $iv = @mcrypt_generic($this->ecb, $iv);
1193
+ $plaintext.= $iv ^ substr($ciphertext, -$len);
1194
+ $iv = substr_replace($iv, substr($ciphertext, -$len), 0, $len);
1195
+ $pos = $len;
1196
+ }
1197
+
1198
+ return $plaintext;
1199
+ }
1200
+
1201
+ $plaintext = @mdecrypt_generic($this->demcrypt, $ciphertext);
1202
+
1203
+ if (!$this->continuousBuffer) {
1204
+ @mcrypt_generic_init($this->demcrypt, $this->key, $this->decryptIV);
1205
+ }
1206
+
1207
+ return $this->paddable ? $this->_unpad($plaintext) : $plaintext;
1208
+ }
1209
+
1210
+ if ($this->changed) {
1211
+ $this->_setup();
1212
+ $this->changed = false;
1213
+ }
1214
+ if ($this->use_inline_crypt) {
1215
+ $inline = $this->inline_crypt;
1216
+ return $inline('decrypt', $this, $ciphertext);
1217
+ }
1218
+
1219
+ $block_size = $this->block_size;
1220
+
1221
+ $buffer = &$this->debuffer;
1222
+ $plaintext = '';
1223
+ switch ($this->mode) {
1224
+ case CRYPT_MODE_ECB:
1225
+ for ($i = 0; $i < strlen($ciphertext); $i+=$block_size) {
1226
+ $plaintext.= $this->_decryptBlock(substr($ciphertext, $i, $block_size));
1227
+ }
1228
+ break;
1229
+ case CRYPT_MODE_CBC:
1230
+ $xor = $this->decryptIV;
1231
+ for ($i = 0; $i < strlen($ciphertext); $i+=$block_size) {
1232
+ $block = substr($ciphertext, $i, $block_size);
1233
+ $plaintext.= $this->_decryptBlock($block) ^ $xor;
1234
+ $xor = $block;
1235
+ }
1236
+ if ($this->continuousBuffer) {
1237
+ $this->decryptIV = $xor;
1238
+ }
1239
+ break;
1240
+ case CRYPT_MODE_CTR:
1241
+ $xor = $this->decryptIV;
1242
+ if (strlen($buffer['ciphertext'])) {
1243
+ for ($i = 0; $i < strlen($ciphertext); $i+=$block_size) {
1244
+ $block = substr($ciphertext, $i, $block_size);
1245
+ if (strlen($block) > strlen($buffer['ciphertext'])) {
1246
+ $buffer['ciphertext'].= $this->_encryptBlock($xor);
1247
+ $this->_increment_str($xor);
1248
+ }
1249
+ $key = $this->_string_shift($buffer['ciphertext'], $block_size);
1250
+ $plaintext.= $block ^ $key;
1251
+ }
1252
+ } else {
1253
+ for ($i = 0; $i < strlen($ciphertext); $i+=$block_size) {
1254
+ $block = substr($ciphertext, $i, $block_size);
1255
+ $key = $this->_encryptBlock($xor);
1256
+ $this->_increment_str($xor);
1257
+ $plaintext.= $block ^ $key;
1258
+ }
1259
+ }
1260
+ if ($this->continuousBuffer) {
1261
+ $this->decryptIV = $xor;
1262
+ if ($start = strlen($ciphertext) % $block_size) {
1263
+ $buffer['ciphertext'] = substr($key, $start) . $buffer['ciphertext'];
1264
+ }
1265
+ }
1266
+ break;
1267
+ case CRYPT_MODE_CFB:
1268
+ if ($this->continuousBuffer) {
1269
+ $iv = &$this->decryptIV;
1270
+ $pos = &$buffer['pos'];
1271
+ } else {
1272
+ $iv = $this->decryptIV;
1273
+ $pos = 0;
1274
+ }
1275
+ $len = strlen($ciphertext);
1276
+ $i = 0;
1277
+ if ($pos) {
1278
+ $orig_pos = $pos;
1279
+ $max = $block_size - $pos;
1280
+ if ($len >= $max) {
1281
+ $i = $max;
1282
+ $len-= $max;
1283
+ $pos = 0;
1284
+ } else {
1285
+ $i = $len;
1286
+ $pos+= $len;
1287
+ $len = 0;
1288
+ }
1289
+ // ie. $i = min($max, $len), $len-= $i, $pos+= $i, $pos%= $blocksize
1290
+ $plaintext = substr($iv, $orig_pos) ^ $ciphertext;
1291
+ $iv = substr_replace($iv, substr($ciphertext, 0, $i), $orig_pos, $i);
1292
+ }
1293
+ while ($len >= $block_size) {
1294
+ $iv = $this->_encryptBlock($iv);
1295
+ $cb = substr($ciphertext, $i, $block_size);
1296
+ $plaintext.= $iv ^ $cb;
1297
+ $iv = $cb;
1298
+ $len-= $block_size;
1299
+ $i+= $block_size;
1300
+ }
1301
+ if ($len) {
1302
+ $iv = $this->_encryptBlock($iv);
1303
+ $plaintext.= $iv ^ substr($ciphertext, $i);
1304
+ $iv = substr_replace($iv, substr($ciphertext, $i), 0, $len);
1305
+ $pos = $len;
1306
+ }
1307
+ break;
1308
+ case CRYPT_MODE_OFB:
1309
+ $xor = $this->decryptIV;
1310
+ if (strlen($buffer['xor'])) {
1311
+ for ($i = 0; $i < strlen($ciphertext); $i+=$block_size) {
1312
+ $block = substr($ciphertext, $i, $block_size);
1313
+ if (strlen($block) > strlen($buffer['xor'])) {
1314
+ $xor = $this->_encryptBlock($xor);
1315
+ $buffer['xor'].= $xor;
1316
+ }
1317
+ $key = $this->_string_shift($buffer['xor'], $block_size);
1318
+ $plaintext.= $block ^ $key;
1319
+ }
1320
+ } else {
1321
+ for ($i = 0; $i < strlen($ciphertext); $i+=$block_size) {
1322
+ $xor = $this->_encryptBlock($xor);
1323
+ $plaintext.= substr($ciphertext, $i, $block_size) ^ $xor;
1324
+ }
1325
+ $key = $xor;
1326
+ }
1327
+ if ($this->continuousBuffer) {
1328
+ $this->decryptIV = $xor;
1329
+ if ($start = strlen($ciphertext) % $block_size) {
1330
+ $buffer['xor'] = substr($key, $start) . $buffer['xor'];
1331
+ }
1332
+ }
1333
+ break;
1334
+ case CRYPT_MODE_STREAM:
1335
+ $plaintext = $this->_decryptBlock($ciphertext);
1336
+ break;
1337
+ }
1338
+ return $this->paddable ? $this->_unpad($plaintext) : $plaintext;
1339
+ }
1340
+
1341
+ /**
1342
+ * OpenSSL CTR Processor
1343
+ *
1344
+ * PHP's OpenSSL bindings do not operate in continuous mode so we'll wrap around it. Since the keystream
1345
+ * for CTR is the same for both encrypting and decrypting this function is re-used by both Crypt_Base::encrypt()
1346
+ * and Crypt_Base::decrypt(). Also, OpenSSL doesn't implement CTR for all of it's symmetric ciphers so this
1347
+ * function will emulate CTR with ECB when necessary.
1348
+ *
1349
+ * @see self::encrypt()
1350
+ * @see self::decrypt()
1351
+ * @param string $plaintext
1352
+ * @param string $encryptIV
1353
+ * @param array $buffer
1354
+ * @return string
1355
+ * @access private
1356
+ */
1357
+ function _openssl_ctr_process($plaintext, &$encryptIV, &$buffer)
1358
+ {
1359
+ $ciphertext = '';
1360
+
1361
+ $block_size = $this->block_size;
1362
+ $key = $this->key;
1363
+
1364
+ if ($this->openssl_emulate_ctr) {
1365
+ $xor = $encryptIV;
1366
+ if (strlen($buffer['ciphertext'])) {
1367
+ for ($i = 0; $i < strlen($plaintext); $i+=$block_size) {
1368
+ $block = substr($plaintext, $i, $block_size);
1369
+ if (strlen($block) > strlen($buffer['ciphertext'])) {
1370
+ $result = openssl_encrypt($xor, $this->cipher_name_openssl_ecb, $key, $this->openssl_options);
1371
+ $result = !defined('OPENSSL_RAW_DATA') ? substr($result, 0, -$this->block_size) : $result;
1372
+ $buffer['ciphertext'].= $result;
1373
+ }
1374
+ $this->_increment_str($xor);
1375
+ $otp = $this->_string_shift($buffer['ciphertext'], $block_size);
1376
+ $ciphertext.= $block ^ $otp;
1377
+ }
1378
+ } else {
1379
+ for ($i = 0; $i < strlen($plaintext); $i+=$block_size) {
1380
+ $block = substr($plaintext, $i, $block_size);
1381
+ $otp = openssl_encrypt($xor, $this->cipher_name_openssl_ecb, $key, $this->openssl_options);
1382
+ $otp = !defined('OPENSSL_RAW_DATA') ? substr($otp, 0, -$this->block_size) : $otp;
1383
+ $this->_increment_str($xor);
1384
+ $ciphertext.= $block ^ $otp;
1385
+ }
1386
+ }
1387
+ if ($this->continuousBuffer) {
1388
+ $encryptIV = $xor;
1389
+ if ($start = strlen($plaintext) % $block_size) {
1390
+ $buffer['ciphertext'] = substr($key, $start) . $buffer['ciphertext'];
1391
+ }
1392
+ }
1393
+
1394
+ return $ciphertext;
1395
+ }
1396
+
1397
+ if (strlen($buffer['ciphertext'])) {
1398
+ $ciphertext = $plaintext ^ $this->_string_shift($buffer['ciphertext'], strlen($plaintext));
1399
+ $plaintext = substr($plaintext, strlen($ciphertext));
1400
+
1401
+ if (!strlen($plaintext)) {
1402
+ return $ciphertext;
1403
+ }
1404
+ }
1405
+
1406
+ $overflow = strlen($plaintext) % $block_size;
1407
+ if ($overflow) {
1408
+ $plaintext2 = $this->_string_pop($plaintext, $overflow); // ie. trim $plaintext to a multiple of $block_size and put rest of $plaintext in $plaintext2
1409
+ $encrypted = openssl_encrypt($plaintext . str_repeat("\0", $block_size), $this->cipher_name_openssl, $key, $this->openssl_options, $encryptIV);
1410
+ $temp = $this->_string_pop($encrypted, $block_size);
1411
+ $ciphertext.= $encrypted . ($plaintext2 ^ $temp);
1412
+ if ($this->continuousBuffer) {
1413
+ $buffer['ciphertext'] = substr($temp, $overflow);
1414
+ $encryptIV = $temp;
1415
+ }
1416
+ } elseif (!strlen($buffer['ciphertext'])) {
1417
+ $ciphertext.= openssl_encrypt($plaintext . str_repeat("\0", $block_size), $this->cipher_name_openssl, $key, $this->openssl_options, $encryptIV);
1418
+ $temp = $this->_string_pop($ciphertext, $block_size);
1419
+ if ($this->continuousBuffer) {
1420
+ $encryptIV = $temp;
1421
+ }
1422
+ }
1423
+ if ($this->continuousBuffer) {
1424
+ if (!defined('OPENSSL_RAW_DATA')) {
1425
+ $encryptIV.= openssl_encrypt('', $this->cipher_name_openssl_ecb, $key, $this->openssl_options);
1426
+ }
1427
+ $encryptIV = openssl_decrypt($encryptIV, $this->cipher_name_openssl_ecb, $key, $this->openssl_options);
1428
+ if ($overflow) {
1429
+ $this->_increment_str($encryptIV);
1430
+ }
1431
+ }
1432
+
1433
+ return $ciphertext;
1434
+ }
1435
+
1436
+ /**
1437
+ * OpenSSL OFB Processor
1438
+ *
1439
+ * PHP's OpenSSL bindings do not operate in continuous mode so we'll wrap around it. Since the keystream
1440
+ * for OFB is the same for both encrypting and decrypting this function is re-used by both Crypt_Base::encrypt()
1441
+ * and Crypt_Base::decrypt().
1442
+ *
1443
+ * @see self::encrypt()
1444
+ * @see self::decrypt()
1445
+ * @param string $plaintext
1446
+ * @param string $encryptIV
1447
+ * @param array $buffer
1448
+ * @return string
1449
+ * @access private
1450
+ */
1451
+ function _openssl_ofb_process($plaintext, &$encryptIV, &$buffer)
1452
+ {
1453
+ if (strlen($buffer['xor'])) {
1454
+ $ciphertext = $plaintext ^ $buffer['xor'];
1455
+ $buffer['xor'] = substr($buffer['xor'], strlen($ciphertext));
1456
+ $plaintext = substr($plaintext, strlen($ciphertext));
1457
+ } else {
1458
+ $ciphertext = '';
1459
+ }
1460
+
1461
+ $block_size = $this->block_size;
1462
+
1463
+ $len = strlen($plaintext);
1464
+ $key = $this->key;
1465
+ $overflow = $len % $block_size;
1466
+
1467
+ if (strlen($plaintext)) {
1468
+ if ($overflow) {
1469
+ $ciphertext.= openssl_encrypt(substr($plaintext, 0, -$overflow) . str_repeat("\0", $block_size), $this->cipher_name_openssl, $key, $this->openssl_options, $encryptIV);
1470
+ $xor = $this->_string_pop($ciphertext, $block_size);
1471
+ if ($this->continuousBuffer) {
1472
+ $encryptIV = $xor;
1473
+ }
1474
+ $ciphertext.= $this->_string_shift($xor, $overflow) ^ substr($plaintext, -$overflow);
1475
+ if ($this->continuousBuffer) {
1476
+ $buffer['xor'] = $xor;
1477
+ }
1478
+ } else {
1479
+ $ciphertext = openssl_encrypt($plaintext, $this->cipher_name_openssl, $key, $this->openssl_options, $encryptIV);
1480
+ if ($this->continuousBuffer) {
1481
+ $encryptIV = substr($ciphertext, -$block_size) ^ substr($plaintext, -$block_size);
1482
+ }
1483
+ }
1484
+ }
1485
+
1486
+ return $ciphertext;
1487
+ }
1488
+
1489
+ /**
1490
+ * phpseclib <-> OpenSSL Mode Mapper
1491
+ *
1492
+ * May need to be overwritten by classes extending this one in some cases
1493
+ *
1494
+ * @return int
1495
+ * @access private
1496
+ */
1497
+ function _openssl_translate_mode()
1498
+ {
1499
+ switch ($this->mode) {
1500
+ case CRYPT_MODE_ECB:
1501
+ return 'ecb';
1502
+ case CRYPT_MODE_CBC:
1503
+ return 'cbc';
1504
+ case CRYPT_MODE_CTR:
1505
+ return 'ctr';
1506
+ case CRYPT_MODE_CFB:
1507
+ return 'cfb';
1508
+ case CRYPT_MODE_OFB:
1509
+ return 'ofb';
1510
+ }
1511
+ }
1512
+
1513
+ /**
1514
+ * Pad "packets".
1515
+ *
1516
+ * Block ciphers working by encrypting between their specified [$this->]block_size at a time
1517
+ * If you ever need to encrypt or decrypt something that isn't of the proper length, it becomes necessary to
1518
+ * pad the input so that it is of the proper length.
1519
+ *
1520
+ * Padding is enabled by default. Sometimes, however, it is undesirable to pad strings. Such is the case in SSH,
1521
+ * where "packets" are padded with random bytes before being encrypted. Unpad these packets and you risk stripping
1522
+ * away characters that shouldn't be stripped away. (SSH knows how many bytes are added because the length is
1523
+ * transmitted separately)
1524
+ *
1525
+ * @see self::disablePadding()
1526
+ * @access public
1527
+ */
1528
+ function enablePadding()
1529
+ {
1530
+ $this->padding = true;
1531
+ }
1532
+
1533
+ /**
1534
+ * Do not pad packets.
1535
+ *
1536
+ * @see self::enablePadding()
1537
+ * @access public
1538
+ */
1539
+ function disablePadding()
1540
+ {
1541
+ $this->padding = false;
1542
+ }
1543
+
1544
+ /**
1545
+ * Treat consecutive "packets" as if they are a continuous buffer.
1546
+ *
1547
+ * Say you have a 32-byte plaintext $plaintext. Using the default behavior, the two following code snippets
1548
+ * will yield different outputs:
1549
+ *
1550
+ * <code>
1551
+ * echo $rijndael->encrypt(substr($plaintext, 0, 16));
1552
+ * echo $rijndael->encrypt(substr($plaintext, 16, 16));
1553
+ * </code>
1554
+ * <code>
1555
+ * echo $rijndael->encrypt($plaintext);
1556
+ * </code>
1557
+ *
1558
+ * The solution is to enable the continuous buffer. Although this will resolve the above discrepancy, it creates
1559
+ * another, as demonstrated with the following:
1560
+ *
1561
+ * <code>
1562
+ * $rijndael->encrypt(substr($plaintext, 0, 16));
1563
+ * echo $rijndael->decrypt($rijndael->encrypt(substr($plaintext, 16, 16)));
1564
+ * </code>
1565
+ * <code>
1566
+ * echo $rijndael->decrypt($rijndael->encrypt(substr($plaintext, 16, 16)));
1567
+ * </code>
1568
+ *
1569
+ * With the continuous buffer disabled, these would yield the same output. With it enabled, they yield different
1570
+ * outputs. The reason is due to the fact that the initialization vector's change after every encryption /
1571
+ * decryption round when the continuous buffer is enabled. When it's disabled, they remain constant.
1572
+ *
1573
+ * Put another way, when the continuous buffer is enabled, the state of the Crypt_*() object changes after each
1574
+ * encryption / decryption round, whereas otherwise, it'd remain constant. For this reason, it's recommended that
1575
+ * continuous buffers not be used. They do offer better security and are, in fact, sometimes required (SSH uses them),
1576
+ * however, they are also less intuitive and more likely to cause you problems.
1577
+ *
1578
+ * @see self::disableContinuousBuffer()
1579
+ * @access public
1580
+ * @internal Could, but not must, extend by the child Crypt_* class
1581
+ */
1582
+ function enableContinuousBuffer()
1583
+ {
1584
+ if ($this->mode == CRYPT_MODE_ECB) {
1585
+ return;
1586
+ }
1587
+
1588
+ $this->continuousBuffer = true;
1589
+
1590
+ $this->_setEngine();
1591
+ }
1592
+
1593
+ /**
1594
+ * Treat consecutive packets as if they are a discontinuous buffer.
1595
+ *
1596
+ * The default behavior.
1597
+ *
1598
+ * @see self::enableContinuousBuffer()
1599
+ * @access public
1600
+ * @internal Could, but not must, extend by the child Crypt_* class
1601
+ */
1602
+ function disableContinuousBuffer()
1603
+ {
1604
+ if ($this->mode == CRYPT_MODE_ECB) {
1605
+ return;
1606
+ }
1607
+ if (!$this->continuousBuffer) {
1608
+ return;
1609
+ }
1610
+
1611
+ $this->continuousBuffer = false;
1612
+ $this->changed = true;
1613
+
1614
+ $this->_setEngine();
1615
+ }
1616
+
1617
+ /**
1618
+ * Test for engine validity
1619
+ *
1620
+ * @see self::Crypt_Base()
1621
+ * @param int $engine
1622
+ * @access public
1623
+ * @return bool
1624
+ */
1625
+ function isValidEngine($engine)
1626
+ {
1627
+ switch ($engine) {
1628
+ case CRYPT_ENGINE_OPENSSL:
1629
+ if ($this->mode == CRYPT_MODE_STREAM && $this->continuousBuffer) {
1630
+ return false;
1631
+ }
1632
+ $this->openssl_emulate_ctr = false;
1633
+ $result = $this->cipher_name_openssl &&
1634
+ extension_loaded('openssl') &&
1635
+ // PHP 5.3.0 - 5.3.2 did not let you set IV's
1636
+ version_compare(PHP_VERSION, '5.3.3', '>=');
1637
+ if (!$result) {
1638
+ return false;
1639
+ }
1640
+
1641
+ // prior to PHP 5.4.0 OPENSSL_RAW_DATA and OPENSSL_ZERO_PADDING were not defined. instead of expecting an integer
1642
+ // $options openssl_encrypt expected a boolean $raw_data.
1643
+ if (!defined('OPENSSL_RAW_DATA')) {
1644
+ $this->openssl_options = true;
1645
+ } else {
1646
+ $this->openssl_options = OPENSSL_RAW_DATA | OPENSSL_ZERO_PADDING;
1647
+ }
1648
+
1649
+ $methods = openssl_get_cipher_methods();
1650
+ if (in_array($this->cipher_name_openssl, $methods)) {
1651
+ return true;
1652
+ }
1653
+ // not all of openssl's symmetric cipher's support ctr. for those
1654
+ // that don't we'll emulate it
1655
+ switch ($this->mode) {
1656
+ case CRYPT_MODE_CTR:
1657
+ if (in_array($this->cipher_name_openssl_ecb, $methods)) {
1658
+ $this->openssl_emulate_ctr = true;
1659
+ return true;
1660
+ }
1661
+ }
1662
+ return false;
1663
+ case CRYPT_ENGINE_MCRYPT:
1664
+ return $this->cipher_name_mcrypt &&
1665
+ extension_loaded('mcrypt') &&
1666
+ in_array($this->cipher_name_mcrypt, @mcrypt_list_algorithms());
1667
+ case CRYPT_ENGINE_INTERNAL:
1668
+ return true;
1669
+ }
1670
+
1671
+ return false;
1672
+ }
1673
+
1674
+ /**
1675
+ * Sets the preferred crypt engine
1676
+ *
1677
+ * Currently, $engine could be:
1678
+ *
1679
+ * - CRYPT_ENGINE_OPENSSL [very fast]
1680
+ *
1681
+ * - CRYPT_ENGINE_MCRYPT [fast]
1682
+ *
1683
+ * - CRYPT_ENGINE_INTERNAL [slow]
1684
+ *
1685
+ * If the preferred crypt engine is not available the fastest available one will be used
1686
+ *
1687
+ * @see self::Crypt_Base()
1688
+ * @param int $engine
1689
+ * @access public
1690
+ */
1691
+ function setPreferredEngine($engine)
1692
+ {
1693
+ switch ($engine) {
1694
+ //case CRYPT_ENGINE_OPENSSL:
1695
+ case CRYPT_ENGINE_MCRYPT:
1696
+ case CRYPT_ENGINE_INTERNAL:
1697
+ $this->preferredEngine = $engine;
1698
+ break;
1699
+ default:
1700
+ $this->preferredEngine = CRYPT_ENGINE_OPENSSL;
1701
+ }
1702
+
1703
+ $this->_setEngine();
1704
+ }
1705
+
1706
+ /**
1707
+ * Returns the engine currently being utilized
1708
+ *
1709
+ * @see self::_setEngine()
1710
+ * @access public
1711
+ */
1712
+ function getEngine()
1713
+ {
1714
+ return $this->engine;
1715
+ }
1716
+
1717
+ /**
1718
+ * Sets the engine as appropriate
1719
+ *
1720
+ * @see self::Crypt_Base()
1721
+ * @access private
1722
+ */
1723
+ function _setEngine()
1724
+ {
1725
+ $this->engine = null;
1726
+
1727
+ $candidateEngines = array(
1728
+ $this->preferredEngine,
1729
+ CRYPT_ENGINE_OPENSSL,
1730
+ CRYPT_ENGINE_MCRYPT
1731
+ );
1732
+ foreach ($candidateEngines as $engine) {
1733
+ if ($this->isValidEngine($engine)) {
1734
+ $this->engine = $engine;
1735
+ break;
1736
+ }
1737
+ }
1738
+ if (!$this->engine) {
1739
+ $this->engine = CRYPT_ENGINE_INTERNAL;
1740
+ }
1741
+
1742
+ if ($this->engine != CRYPT_ENGINE_MCRYPT && $this->enmcrypt) {
1743
+ // Closing the current mcrypt resource(s). _mcryptSetup() will, if needed,
1744
+ // (re)open them with the module named in $this->cipher_name_mcrypt
1745
+ @mcrypt_module_close($this->enmcrypt);
1746
+ @mcrypt_module_close($this->demcrypt);
1747
+ $this->enmcrypt = null;
1748
+ $this->demcrypt = null;
1749
+
1750
+ if ($this->ecb) {
1751
+ @mcrypt_module_close($this->ecb);
1752
+ $this->ecb = null;
1753
+ }
1754
+ }
1755
+
1756
+ $this->changed = true;
1757
+ }
1758
+
1759
+ /**
1760
+ * Encrypts a block
1761
+ *
1762
+ * @access private
1763
+ * @param string $in
1764
+ * @return string
1765
+ * @internal Must be extended by the child Crypt_* class
1766
+ */
1767
+ function _encryptBlock($in)
1768
+ {
1769
+ user_error((version_compare(PHP_VERSION, '5.0.0', '>=') ? __METHOD__ : __FUNCTION__) . '() must extend by class ' . get_class($this), E_USER_ERROR);
1770
+ }
1771
+
1772
+ /**
1773
+ * Decrypts a block
1774
+ *
1775
+ * @access private
1776
+ * @param string $in
1777
+ * @return string
1778
+ * @internal Must be extended by the child Crypt_* class
1779
+ */
1780
+ function _decryptBlock($in)
1781
+ {
1782
+ user_error((version_compare(PHP_VERSION, '5.0.0', '>=') ? __METHOD__ : __FUNCTION__) . '() must extend by class ' . get_class($this), E_USER_ERROR);
1783
+ }
1784
+
1785
+ /**
1786
+ * Setup the key (expansion)
1787
+ *
1788
+ * Only used if $engine == CRYPT_ENGINE_INTERNAL
1789
+ *
1790
+ * @see self::_setup()
1791
+ * @access private
1792
+ * @internal Must be extended by the child Crypt_* class
1793
+ */
1794
+ function _setupKey()
1795
+ {
1796
+ user_error((version_compare(PHP_VERSION, '5.0.0', '>=') ? __METHOD__ : __FUNCTION__) . '() must extend by class ' . get_class($this), E_USER_ERROR);
1797
+ }
1798
+
1799
+ /**
1800
+ * Setup the CRYPT_ENGINE_INTERNAL $engine
1801
+ *
1802
+ * (re)init, if necessary, the internal cipher $engine and flush all $buffers
1803
+ * Used (only) if $engine == CRYPT_ENGINE_INTERNAL
1804
+ *
1805
+ * _setup() will be called each time if $changed === true
1806
+ * typically this happens when using one or more of following public methods:
1807
+ *
1808
+ * - setKey()
1809
+ *
1810
+ * - setIV()
1811
+ *
1812
+ * - disableContinuousBuffer()
1813
+ *
1814
+ * - First run of encrypt() / decrypt() with no init-settings
1815
+ *
1816
+ * @see self::setKey()
1817
+ * @see self::setIV()
1818
+ * @see self::disableContinuousBuffer()
1819
+ * @access private
1820
+ * @internal _setup() is always called before en/decryption.
1821
+ * @internal Could, but not must, extend by the child Crypt_* class
1822
+ */
1823
+ function _setup()
1824
+ {
1825
+ $this->_clearBuffers();
1826
+ $this->_setupKey();
1827
+
1828
+ if ($this->use_inline_crypt) {
1829
+ $this->_setupInlineCrypt();
1830
+ }
1831
+ }
1832
+
1833
+ /**
1834
+ * Setup the CRYPT_ENGINE_MCRYPT $engine
1835
+ *
1836
+ * (re)init, if necessary, the (ext)mcrypt resources and flush all $buffers
1837
+ * Used (only) if $engine = CRYPT_ENGINE_MCRYPT
1838
+ *
1839
+ * _setupMcrypt() will be called each time if $changed === true
1840
+ * typically this happens when using one or more of following public methods:
1841
+ *
1842
+ * - setKey()
1843
+ *
1844
+ * - setIV()
1845
+ *
1846
+ * - disableContinuousBuffer()
1847
+ *
1848
+ * - First run of encrypt() / decrypt()
1849
+ *
1850
+ * @see self::setKey()
1851
+ * @see self::setIV()
1852
+ * @see self::disableContinuousBuffer()
1853
+ * @access private
1854
+ * @internal Could, but not must, extend by the child Crypt_* class
1855
+ */
1856
+ function _setupMcrypt()
1857
+ {
1858
+ $this->_clearBuffers();
1859
+ $this->enchanged = $this->dechanged = true;
1860
+
1861
+ if (!isset($this->enmcrypt)) {
1862
+ static $mcrypt_modes = array(
1863
+ CRYPT_MODE_CTR => 'ctr',
1864
+ CRYPT_MODE_ECB => MCRYPT_MODE_ECB,
1865
+ CRYPT_MODE_CBC => MCRYPT_MODE_CBC,
1866
+ CRYPT_MODE_CFB => 'ncfb',
1867
+ CRYPT_MODE_OFB => MCRYPT_MODE_NOFB,
1868
+ CRYPT_MODE_STREAM => MCRYPT_MODE_STREAM,
1869
+ );
1870
+
1871
+ $this->demcrypt = @mcrypt_module_open($this->cipher_name_mcrypt, '', $mcrypt_modes[$this->mode], '');
1872
+ $this->enmcrypt = @mcrypt_module_open($this->cipher_name_mcrypt, '', $mcrypt_modes[$this->mode], '');
1873
+
1874
+ // we need the $ecb mcrypt resource (only) in MODE_CFB with enableContinuousBuffer()
1875
+ // to workaround mcrypt's broken ncfb implementation in buffered mode
1876
+ // see: {@link http://phpseclib.sourceforge.net/cfb-demo.phps}
1877
+ if ($this->mode == CRYPT_MODE_CFB) {
1878
+ $this->ecb = @mcrypt_module_open($this->cipher_name_mcrypt, '', MCRYPT_MODE_ECB, '');
1879
+ }
1880
+ } // else should mcrypt_generic_deinit be called?
1881
+
1882
+ if ($this->mode == CRYPT_MODE_CFB) {
1883
+ @mcrypt_generic_init($this->ecb, $this->key, str_repeat("\0", $this->block_size));
1884
+ }
1885
+ }
1886
+
1887
+ /**
1888
+ * Pads a string
1889
+ *
1890
+ * Pads a string using the RSA PKCS padding standards so that its length is a multiple of the blocksize.
1891
+ * $this->block_size - (strlen($text) % $this->block_size) bytes are added, each of which is equal to
1892
+ * chr($this->block_size - (strlen($text) % $this->block_size)
1893
+ *
1894
+ * If padding is disabled and $text is not a multiple of the blocksize, the string will be padded regardless
1895
+ * and padding will, hence forth, be enabled.
1896
+ *
1897
+ * @see self::_unpad()
1898
+ * @param string $text
1899
+ * @access private
1900
+ * @return string
1901
+ */
1902
+ function _pad($text)
1903
+ {
1904
+ $length = strlen($text);
1905
+
1906
+ if (!$this->padding) {
1907
+ if ($length % $this->block_size == 0) {
1908
+ return $text;
1909
+ } else {
1910
+ user_error("The plaintext's length ($length) is not a multiple of the block size ({$this->block_size})");
1911
+ $this->padding = true;
1912
+ }
1913
+ }
1914
+
1915
+ $pad = $this->block_size - ($length % $this->block_size);
1916
+
1917
+ return str_pad($text, $length + $pad, chr($pad));
1918
+ }
1919
+
1920
+ /**
1921
+ * Unpads a string.
1922
+ *
1923
+ * If padding is enabled and the reported padding length is invalid the encryption key will be assumed to be wrong
1924
+ * and false will be returned.
1925
+ *
1926
+ * @see self::_pad()
1927
+ * @param string $text
1928
+ * @access private
1929
+ * @return string
1930
+ */
1931
+ function _unpad($text)
1932
+ {
1933
+ if (!$this->padding) {
1934
+ return $text;
1935
+ }
1936
+
1937
+ $length = ord($text[strlen($text) - 1]);
1938
+
1939
+ if (!$length || $length > $this->block_size) {
1940
+ return false;
1941
+ }
1942
+
1943
+ return substr($text, 0, -$length);
1944
+ }
1945
+
1946
+ /**
1947
+ * Clears internal buffers
1948
+ *
1949
+ * Clearing/resetting the internal buffers is done everytime
1950
+ * after disableContinuousBuffer() or on cipher $engine (re)init
1951
+ * ie after setKey() or setIV()
1952
+ *
1953
+ * @access public
1954
+ * @internal Could, but not must, extend by the child Crypt_* class
1955
+ */
1956
+ function _clearBuffers()
1957
+ {
1958
+ $this->enbuffer = $this->debuffer = array('ciphertext' => '', 'xor' => '', 'pos' => 0, 'enmcrypt_init' => true);
1959
+
1960
+ // mcrypt's handling of invalid's $iv:
1961
+ // $this->encryptIV = $this->decryptIV = strlen($this->iv) == $this->block_size ? $this->iv : str_repeat("\0", $this->block_size);
1962
+ $this->encryptIV = $this->decryptIV = str_pad(substr($this->iv, 0, $this->block_size), $this->block_size, "\0");
1963
+
1964
+ if (!$this->skip_key_adjustment) {
1965
+ $this->key = str_pad(substr($this->key, 0, $this->key_length), $this->key_length, "\0");
1966
+ }
1967
+ }
1968
+
1969
+ /**
1970
+ * String Shift
1971
+ *
1972
+ * Inspired by array_shift
1973
+ *
1974
+ * @param string $string
1975
+ * @param int $index
1976
+ * @access private
1977
+ * @return string
1978
+ */
1979
+ function _string_shift(&$string, $index = 1)
1980
+ {
1981
+ $substr = substr($string, 0, $index);
1982
+ $string = substr($string, $index);
1983
+ return $substr;
1984
+ }
1985
+
1986
+ /**
1987
+ * String Pop
1988
+ *
1989
+ * Inspired by array_pop
1990
+ *
1991
+ * @param string $string
1992
+ * @param int $index
1993
+ * @access private
1994
+ * @return string
1995
+ */
1996
+ function _string_pop(&$string, $index = 1)
1997
+ {
1998
+ $substr = substr($string, -$index);
1999
+ $string = substr($string, 0, -$index);
2000
+ return $substr;
2001
+ }
2002
+
2003
+ /**
2004
+ * Increment the current string
2005
+ *
2006
+ * @see self::decrypt()
2007
+ * @see self::encrypt()
2008
+ * @param string $var
2009
+ * @access private
2010
+ */
2011
+ function _increment_str(&$var)
2012
+ {
2013
+ for ($i = 4; $i <= strlen($var); $i+= 4) {
2014
+ $temp = substr($var, -$i, 4);
2015
+ switch ($temp) {
2016
+ case "\xFF\xFF\xFF\xFF":
2017
+ $var = substr_replace($var, "\x00\x00\x00\x00", -$i, 4);
2018
+ break;
2019
+ case "\x7F\xFF\xFF\xFF":
2020
+ $var = substr_replace($var, "\x80\x00\x00\x00", -$i, 4);
2021
+ return;
2022
+ default:
2023
+ $temp = unpack('Nnum', $temp);
2024
+ $var = substr_replace($var, pack('N', $temp['num'] + 1), -$i, 4);
2025
+ return;
2026
+ }
2027
+ }
2028
+
2029
+ $remainder = strlen($var) % 4;
2030
+
2031
+ if ($remainder == 0) {
2032
+ return;
2033
+ }
2034
+
2035
+ $temp = unpack('Nnum', str_pad(substr($var, 0, $remainder), 4, "\0", STR_PAD_LEFT));
2036
+ $temp = substr(pack('N', $temp['num'] + 1), -$remainder);
2037
+ $var = substr_replace($var, $temp, 0, $remainder);
2038
+ }
2039
+
2040
+ /**
2041
+ * Setup the performance-optimized function for de/encrypt()
2042
+ *
2043
+ * Stores the created (or existing) callback function-name
2044
+ * in $this->inline_crypt
2045
+ *
2046
+ * Internally for phpseclib developers:
2047
+ *
2048
+ * _setupInlineCrypt() would be called only if:
2049
+ *
2050
+ * - $engine == CRYPT_ENGINE_INTERNAL and
2051
+ *
2052
+ * - $use_inline_crypt === true
2053
+ *
2054
+ * - each time on _setup(), after(!) _setupKey()
2055
+ *
2056
+ *
2057
+ * This ensures that _setupInlineCrypt() has always a
2058
+ * full ready2go initializated internal cipher $engine state
2059
+ * where, for example, the keys allready expanded,
2060
+ * keys/block_size calculated and such.
2061
+ *
2062
+ * It is, each time if called, the responsibility of _setupInlineCrypt():
2063
+ *
2064
+ * - to set $this->inline_crypt to a valid and fully working callback function
2065
+ * as a (faster) replacement for encrypt() / decrypt()
2066
+ *
2067
+ * - NOT to create unlimited callback functions (for memory reasons!)
2068
+ * no matter how often _setupInlineCrypt() would be called. At some
2069
+ * point of amount they must be generic re-useable.
2070
+ *
2071
+ * - the code of _setupInlineCrypt() it self,
2072
+ * and the generated callback code,
2073
+ * must be, in following order:
2074
+ * - 100% safe
2075
+ * - 100% compatible to encrypt()/decrypt()
2076
+ * - using only php5+ features/lang-constructs/php-extensions if
2077
+ * compatibility (down to php4) or fallback is provided
2078
+ * - readable/maintainable/understandable/commented and... not-cryptic-styled-code :-)
2079
+ * - >= 10% faster than encrypt()/decrypt() [which is, by the way,
2080
+ * the reason for the existence of _setupInlineCrypt() :-)]
2081
+ * - memory-nice
2082
+ * - short (as good as possible)
2083
+ *
2084
+ * Note: - _setupInlineCrypt() is using _createInlineCryptFunction() to create the full callback function code.
2085
+ * - In case of using inline crypting, _setupInlineCrypt() must extend by the child Crypt_* class.
2086
+ * - The following variable names are reserved:
2087
+ * - $_* (all variable names prefixed with an underscore)
2088
+ * - $self (object reference to it self. Do not use $this, but $self instead)
2089
+ * - $in (the content of $in has to en/decrypt by the generated code)
2090
+ * - The callback function should not use the 'return' statement, but en/decrypt'ing the content of $in only
2091
+ *
2092
+ *
2093
+ * @see self::_setup()
2094
+ * @see self::_createInlineCryptFunction()
2095
+ * @see self::encrypt()
2096
+ * @see self::decrypt()
2097
+ * @access private
2098
+ * @internal If a Crypt_* class providing inline crypting it must extend _setupInlineCrypt()
2099
+ */
2100
+ function _setupInlineCrypt()
2101
+ {
2102
+ // If, for any reason, an extending Crypt_Base() Crypt_* class
2103
+ // not using inline crypting then it must be ensured that: $this->use_inline_crypt = false
2104
+ // ie in the class var declaration of $use_inline_crypt in general for the Crypt_* class,
2105
+ // in the constructor at object instance-time
2106
+ // or, if it's runtime-specific, at runtime
2107
+
2108
+ $this->use_inline_crypt = false;
2109
+ }
2110
+
2111
+ /**
2112
+ * Creates the performance-optimized function for en/decrypt()
2113
+ *
2114
+ * Internally for phpseclib developers:
2115
+ *
2116
+ * _createInlineCryptFunction():
2117
+ *
2118
+ * - merge the $cipher_code [setup'ed by _setupInlineCrypt()]
2119
+ * with the current [$this->]mode of operation code
2120
+ *
2121
+ * - create the $inline function, which called by encrypt() / decrypt()
2122
+ * as its replacement to speed up the en/decryption operations.
2123
+ *
2124
+ * - return the name of the created $inline callback function
2125
+ *
2126
+ * - used to speed up en/decryption
2127
+ *
2128
+ *
2129
+ *
2130
+ * The main reason why can speed up things [up to 50%] this way are:
2131
+ *
2132
+ * - using variables more effective then regular.
2133
+ * (ie no use of expensive arrays but integers $k_0, $k_1 ...
2134
+ * or even, for example, the pure $key[] values hardcoded)
2135
+ *
2136
+ * - avoiding 1000's of function calls of ie _encryptBlock()
2137
+ * but inlining the crypt operations.
2138
+ * in the mode of operation for() loop.
2139
+ *
2140
+ * - full loop unroll the (sometimes key-dependent) rounds
2141
+ * avoiding this way ++$i counters and runtime-if's etc...
2142
+ *
2143
+ * The basic code architectur of the generated $inline en/decrypt()
2144
+ * lambda function, in pseudo php, is:
2145
+ *
2146
+ * <code>
2147
+ * +----------------------------------------------------------------------------------------------+
2148
+ * | callback $inline = create_function: |
2149
+ * | lambda_function_0001_crypt_ECB($action, $text) |
2150
+ * | { |
2151
+ * | INSERT PHP CODE OF: |
2152
+ * | $cipher_code['init_crypt']; // general init code. |
2153
+ * | // ie: $sbox'es declarations used for |
2154
+ * | // encrypt and decrypt'ing. |
2155
+ * | |
2156
+ * | switch ($action) { |
2157
+ * | case 'encrypt': |
2158
+ * | INSERT PHP CODE OF: |
2159
+ * | $cipher_code['init_encrypt']; // encrypt sepcific init code. |
2160
+ * | ie: specified $key or $box |
2161
+ * | declarations for encrypt'ing. |
2162
+ * | |
2163
+ * | foreach ($ciphertext) { |
2164
+ * | $in = $block_size of $ciphertext; |
2165
+ * | |
2166
+ * | INSERT PHP CODE OF: |
2167
+ * | $cipher_code['encrypt_block']; // encrypt's (string) $in, which is always: |
2168
+ * | // strlen($in) == $this->block_size |
2169
+ * | // here comes the cipher algorithm in action |
2170
+ * | // for encryption. |
2171
+ * | // $cipher_code['encrypt_block'] has to |
2172
+ * | // encrypt the content of the $in variable |
2173
+ * | |
2174
+ * | $plaintext .= $in; |
2175
+ * | } |
2176
+ * | return $plaintext; |
2177
+ * | |
2178
+ * | case 'decrypt': |
2179
+ * | INSERT PHP CODE OF: |
2180
+ * | $cipher_code['init_decrypt']; // decrypt sepcific init code |
2181
+ * | ie: specified $key or $box |
2182
+ * | declarations for decrypt'ing. |
2183
+ * | foreach ($plaintext) { |
2184
+ * | $in = $block_size of $plaintext; |
2185
+ * | |
2186
+ * | INSERT PHP CODE OF: |
2187
+ * | $cipher_code['decrypt_block']; // decrypt's (string) $in, which is always |
2188
+ * | // strlen($in) == $this->block_size |
2189
+ * | // here comes the cipher algorithm in action |
2190
+ * | // for decryption. |
2191
+ * | // $cipher_code['decrypt_block'] has to |
2192
+ * | // decrypt the content of the $in variable |
2193
+ * | $ciphertext .= $in; |
2194
+ * | } |
2195
+ * | return $ciphertext; |
2196
+ * | } |
2197
+ * | } |
2198
+ * +----------------------------------------------------------------------------------------------+
2199
+ * </code>
2200
+ *
2201
+ * See also the Crypt_*::_setupInlineCrypt()'s for
2202
+ * productive inline $cipher_code's how they works.
2203
+ *
2204
+ * Structure of:
2205
+ * <code>
2206
+ * $cipher_code = array(
2207
+ * 'init_crypt' => (string) '', // optional
2208
+ * 'init_encrypt' => (string) '', // optional
2209
+ * 'init_decrypt' => (string) '', // optional
2210
+ * 'encrypt_block' => (string) '', // required
2211
+ * 'decrypt_block' => (string) '' // required
2212
+ * );
2213
+ * </code>
2214
+ *
2215
+ * @see self::_setupInlineCrypt()
2216
+ * @see self::encrypt()
2217
+ * @see self::decrypt()
2218
+ * @param array $cipher_code
2219
+ * @access private
2220
+ * @return string (the name of the created callback function)
2221
+ */
2222
+ function _createInlineCryptFunction($cipher_code)
2223
+ {
2224
+ $block_size = $this->block_size;
2225
+
2226
+ // optional
2227
+ $init_crypt = isset($cipher_code['init_crypt']) ? $cipher_code['init_crypt'] : '';
2228
+ $init_encrypt = isset($cipher_code['init_encrypt']) ? $cipher_code['init_encrypt'] : '';
2229
+ $init_decrypt = isset($cipher_code['init_decrypt']) ? $cipher_code['init_decrypt'] : '';
2230
+ // required
2231
+ $encrypt_block = $cipher_code['encrypt_block'];
2232
+ $decrypt_block = $cipher_code['decrypt_block'];
2233
+
2234
+ // Generating mode of operation inline code,
2235
+ // merged with the $cipher_code algorithm
2236
+ // for encrypt- and decryption.
2237
+ switch ($this->mode) {
2238
+ case CRYPT_MODE_ECB:
2239
+ $encrypt = $init_encrypt . '
2240
+ $_ciphertext = "";
2241
+ $_plaintext_len = strlen($_text);
2242
+
2243
+ for ($_i = 0; $_i < $_plaintext_len; $_i+= '.$block_size.') {
2244
+ $in = substr($_text, $_i, '.$block_size.');
2245
+ '.$encrypt_block.'
2246
+ $_ciphertext.= $in;
2247
+ }
2248
+
2249
+ return $_ciphertext;
2250
+ ';
2251
+
2252
+ $decrypt = $init_decrypt . '
2253
+ $_plaintext = "";
2254
+ $_text = str_pad($_text, strlen($_text) + ('.$block_size.' - strlen($_text) % '.$block_size.') % '.$block_size.', chr(0));
2255
+ $_ciphertext_len = strlen($_text);
2256
+
2257
+ for ($_i = 0; $_i < $_ciphertext_len; $_i+= '.$block_size.') {
2258
+ $in = substr($_text, $_i, '.$block_size.');
2259
+ '.$decrypt_block.'
2260
+ $_plaintext.= $in;
2261
+ }
2262
+
2263
+ return $self->_unpad($_plaintext);
2264
+ ';
2265
+ break;
2266
+ case CRYPT_MODE_CTR:
2267
+ $encrypt = $init_encrypt . '
2268
+ $_ciphertext = "";
2269
+ $_plaintext_len = strlen($_text);
2270
+ $_xor = $self->encryptIV;
2271
+ $_buffer = &$self->enbuffer;
2272
+ if (strlen($_buffer["ciphertext"])) {
2273
+ for ($_i = 0; $_i < $_plaintext_len; $_i+= '.$block_size.') {
2274
+ $_block = substr($_text, $_i, '.$block_size.');
2275
+ if (strlen($_block) > strlen($_buffer["ciphertext"])) {
2276
+ $in = $_xor;
2277
+ '.$encrypt_block.'
2278
+ $self->_increment_str($_xor);
2279
+ $_buffer["ciphertext"].= $in;
2280
+ }
2281
+ $_key = $self->_string_shift($_buffer["ciphertext"], '.$block_size.');
2282
+ $_ciphertext.= $_block ^ $_key;
2283
+ }
2284
+ } else {
2285
+ for ($_i = 0; $_i < $_plaintext_len; $_i+= '.$block_size.') {
2286
+ $_block = substr($_text, $_i, '.$block_size.');
2287
+ $in = $_xor;
2288
+ '.$encrypt_block.'
2289
+ $self->_increment_str($_xor);
2290
+ $_key = $in;
2291
+ $_ciphertext.= $_block ^ $_key;
2292
+ }
2293
+ }
2294
+ if ($self->continuousBuffer) {
2295
+ $self->encryptIV = $_xor;
2296
+ if ($_start = $_plaintext_len % '.$block_size.') {
2297
+ $_buffer["ciphertext"] = substr($_key, $_start) . $_buffer["ciphertext"];
2298
+ }
2299
+ }
2300
+
2301
+ return $_ciphertext;
2302
+ ';
2303
+
2304
+ $decrypt = $init_encrypt . '
2305
+ $_plaintext = "";
2306
+ $_ciphertext_len = strlen($_text);
2307
+ $_xor = $self->decryptIV;
2308
+ $_buffer = &$self->debuffer;
2309
+
2310
+ if (strlen($_buffer["ciphertext"])) {
2311
+ for ($_i = 0; $_i < $_ciphertext_len; $_i+= '.$block_size.') {
2312
+ $_block = substr($_text, $_i, '.$block_size.');
2313
+ if (strlen($_block) > strlen($_buffer["ciphertext"])) {
2314
+ $in = $_xor;
2315
+ '.$encrypt_block.'
2316
+ $self->_increment_str($_xor);
2317
+ $_buffer["ciphertext"].= $in;
2318
+ }
2319
+ $_key = $self->_string_shift($_buffer["ciphertext"], '.$block_size.');
2320
+ $_plaintext.= $_block ^ $_key;
2321
+ }
2322
+ } else {
2323
+ for ($_i = 0; $_i < $_ciphertext_len; $_i+= '.$block_size.') {
2324
+ $_block = substr($_text, $_i, '.$block_size.');
2325
+ $in = $_xor;
2326
+ '.$encrypt_block.'
2327
+ $self->_increment_str($_xor);
2328
+ $_key = $in;
2329
+ $_plaintext.= $_block ^ $_key;
2330
+ }
2331
+ }
2332
+ if ($self->continuousBuffer) {
2333
+ $self->decryptIV = $_xor;
2334
+ if ($_start = $_ciphertext_len % '.$block_size.') {
2335
+ $_buffer["ciphertext"] = substr($_key, $_start) . $_buffer["ciphertext"];
2336
+ }
2337
+ }
2338
+
2339
+ return $_plaintext;
2340
+ ';
2341
+ break;
2342
+ case CRYPT_MODE_CFB:
2343
+ $encrypt = $init_encrypt . '
2344
+ $_ciphertext = "";
2345
+ $_buffer = &$self->enbuffer;
2346
+
2347
+ if ($self->continuousBuffer) {
2348
+ $_iv = &$self->encryptIV;
2349
+ $_pos = &$_buffer["pos"];
2350
+ } else {
2351
+ $_iv = $self->encryptIV;
2352
+ $_pos = 0;
2353
+ }
2354
+ $_len = strlen($_text);
2355
+ $_i = 0;
2356
+ if ($_pos) {
2357
+ $_orig_pos = $_pos;
2358
+ $_max = '.$block_size.' - $_pos;
2359
+ if ($_len >= $_max) {
2360
+ $_i = $_max;
2361
+ $_len-= $_max;
2362
+ $_pos = 0;
2363
+ } else {
2364
+ $_i = $_len;
2365
+ $_pos+= $_len;
2366
+ $_len = 0;
2367
+ }
2368
+ $_ciphertext = substr($_iv, $_orig_pos) ^ $_text;
2369
+ $_iv = substr_replace($_iv, $_ciphertext, $_orig_pos, $_i);
2370
+ }
2371
+ while ($_len >= '.$block_size.') {
2372
+ $in = $_iv;
2373
+ '.$encrypt_block.';
2374
+ $_iv = $in ^ substr($_text, $_i, '.$block_size.');
2375
+ $_ciphertext.= $_iv;
2376
+ $_len-= '.$block_size.';
2377
+ $_i+= '.$block_size.';
2378
+ }
2379
+ if ($_len) {
2380
+ $in = $_iv;
2381
+ '.$encrypt_block.'
2382
+ $_iv = $in;
2383
+ $_block = $_iv ^ substr($_text, $_i);
2384
+ $_iv = substr_replace($_iv, $_block, 0, $_len);
2385
+ $_ciphertext.= $_block;
2386
+ $_pos = $_len;
2387
+ }
2388
+ return $_ciphertext;
2389
+ ';
2390
+
2391
+ $decrypt = $init_encrypt . '
2392
+ $_plaintext = "";
2393
+ $_buffer = &$self->debuffer;
2394
+
2395
+ if ($self->continuousBuffer) {
2396
+ $_iv = &$self->decryptIV;
2397
+ $_pos = &$_buffer["pos"];
2398
+ } else {
2399
+ $_iv = $self->decryptIV;
2400
+ $_pos = 0;
2401
+ }
2402
+ $_len = strlen($_text);
2403
+ $_i = 0;
2404
+ if ($_pos) {
2405
+ $_orig_pos = $_pos;
2406
+ $_max = '.$block_size.' - $_pos;
2407
+ if ($_len >= $_max) {
2408
+ $_i = $_max;
2409
+ $_len-= $_max;
2410
+ $_pos = 0;
2411
+ } else {
2412
+ $_i = $_len;
2413
+ $_pos+= $_len;
2414
+ $_len = 0;
2415
+ }
2416
+ $_plaintext = substr($_iv, $_orig_pos) ^ $_text;
2417
+ $_iv = substr_replace($_iv, substr($_text, 0, $_i), $_orig_pos, $_i);
2418
+ }
2419
+ while ($_len >= '.$block_size.') {
2420
+ $in = $_iv;
2421
+ '.$encrypt_block.'
2422
+ $_iv = $in;
2423
+ $cb = substr($_text, $_i, '.$block_size.');
2424
+ $_plaintext.= $_iv ^ $cb;
2425
+ $_iv = $cb;
2426
+ $_len-= '.$block_size.';
2427
+ $_i+= '.$block_size.';
2428
+ }
2429
+ if ($_len) {
2430
+ $in = $_iv;
2431
+ '.$encrypt_block.'
2432
+ $_iv = $in;
2433
+ $_plaintext.= $_iv ^ substr($_text, $_i);
2434
+ $_iv = substr_replace($_iv, substr($_text, $_i), 0, $_len);
2435
+ $_pos = $_len;
2436
+ }
2437
+
2438
+ return $_plaintext;
2439
+ ';
2440
+ break;
2441
+ case CRYPT_MODE_OFB:
2442
+ $encrypt = $init_encrypt . '
2443
+ $_ciphertext = "";
2444
+ $_plaintext_len = strlen($_text);
2445
+ $_xor = $self->encryptIV;
2446
+ $_buffer = &$self->enbuffer;
2447
+
2448
+ if (strlen($_buffer["xor"])) {
2449
+ for ($_i = 0; $_i < $_plaintext_len; $_i+= '.$block_size.') {
2450
+ $_block = substr($_text, $_i, '.$block_size.');
2451
+ if (strlen($_block) > strlen($_buffer["xor"])) {
2452
+ $in = $_xor;
2453
+ '.$encrypt_block.'
2454
+ $_xor = $in;
2455
+ $_buffer["xor"].= $_xor;
2456
+ }
2457
+ $_key = $self->_string_shift($_buffer["xor"], '.$block_size.');
2458
+ $_ciphertext.= $_block ^ $_key;
2459
+ }
2460
+ } else {
2461
+ for ($_i = 0; $_i < $_plaintext_len; $_i+= '.$block_size.') {
2462
+ $in = $_xor;
2463
+ '.$encrypt_block.'
2464
+ $_xor = $in;
2465
+ $_ciphertext.= substr($_text, $_i, '.$block_size.') ^ $_xor;
2466
+ }
2467
+ $_key = $_xor;
2468
+ }
2469
+ if ($self->continuousBuffer) {
2470
+ $self->encryptIV = $_xor;
2471
+ if ($_start = $_plaintext_len % '.$block_size.') {
2472
+ $_buffer["xor"] = substr($_key, $_start) . $_buffer["xor"];
2473
+ }
2474
+ }
2475
+ return $_ciphertext;
2476
+ ';
2477
+
2478
+ $decrypt = $init_encrypt . '
2479
+ $_plaintext = "";
2480
+ $_ciphertext_len = strlen($_text);
2481
+ $_xor = $self->decryptIV;
2482
+ $_buffer = &$self->debuffer;
2483
+
2484
+ if (strlen($_buffer["xor"])) {
2485
+ for ($_i = 0; $_i < $_ciphertext_len; $_i+= '.$block_size.') {
2486
+ $_block = substr($_text, $_i, '.$block_size.');
2487
+ if (strlen($_block) > strlen($_buffer["xor"])) {
2488
+ $in = $_xor;
2489
+ '.$encrypt_block.'
2490
+ $_xor = $in;
2491
+ $_buffer["xor"].= $_xor;
2492
+ }
2493
+ $_key = $self->_string_shift($_buffer["xor"], '.$block_size.');
2494
+ $_plaintext.= $_block ^ $_key;
2495
+ }
2496
+ } else {
2497
+ for ($_i = 0; $_i < $_ciphertext_len; $_i+= '.$block_size.') {
2498
+ $in = $_xor;
2499
+ '.$encrypt_block.'
2500
+ $_xor = $in;
2501
+ $_plaintext.= substr($_text, $_i, '.$block_size.') ^ $_xor;
2502
+ }
2503
+ $_key = $_xor;
2504
+ }
2505
+ if ($self->continuousBuffer) {
2506
+ $self->decryptIV = $_xor;
2507
+ if ($_start = $_ciphertext_len % '.$block_size.') {
2508
+ $_buffer["xor"] = substr($_key, $_start) . $_buffer["xor"];
2509
+ }
2510
+ }
2511
+ return $_plaintext;
2512
+ ';
2513
+ break;
2514
+ case CRYPT_MODE_STREAM:
2515
+ $encrypt = $init_encrypt . '
2516
+ $_ciphertext = "";
2517
+ '.$encrypt_block.'
2518
+ return $_ciphertext;
2519
+ ';
2520
+ $decrypt = $init_decrypt . '
2521
+ $_plaintext = "";
2522
+ '.$decrypt_block.'
2523
+ return $_plaintext;
2524
+ ';
2525
+ break;
2526
+ // case CRYPT_MODE_CBC:
2527
+ default:
2528
+ $encrypt = $init_encrypt . '
2529
+ $_ciphertext = "";
2530
+ $_plaintext_len = strlen($_text);
2531
+
2532
+ $in = $self->encryptIV;
2533
+
2534
+ for ($_i = 0; $_i < $_plaintext_len; $_i+= '.$block_size.') {
2535
+ $in = substr($_text, $_i, '.$block_size.') ^ $in;
2536
+ '.$encrypt_block.'
2537
+ $_ciphertext.= $in;
2538
+ }
2539
+
2540
+ if ($self->continuousBuffer) {
2541
+ $self->encryptIV = $in;
2542
+ }
2543
+
2544
+ return $_ciphertext;
2545
+ ';
2546
+
2547
+ $decrypt = $init_decrypt . '
2548
+ $_plaintext = "";
2549
+ $_text = str_pad($_text, strlen($_text) + ('.$block_size.' - strlen($_text) % '.$block_size.') % '.$block_size.', chr(0));
2550
+ $_ciphertext_len = strlen($_text);
2551
+
2552
+ $_iv = $self->decryptIV;
2553
+
2554
+ for ($_i = 0; $_i < $_ciphertext_len; $_i+= '.$block_size.') {
2555
+ $in = $_block = substr($_text, $_i, '.$block_size.');
2556
+ '.$decrypt_block.'
2557
+ $_plaintext.= $in ^ $_iv;
2558
+ $_iv = $_block;
2559
+ }
2560
+
2561
+ if ($self->continuousBuffer) {
2562
+ $self->decryptIV = $_iv;
2563
+ }
2564
+
2565
+ return $self->_unpad($_plaintext);
2566
+ ';
2567
+ break;
2568
+ }
2569
+
2570
+ // Create the $inline function and return its name as string. Ready to run!
2571
+ if (version_compare(PHP_VERSION, '5.3.0') >= 0) {
2572
+ eval('$func = function ($_action, &$self, $_text) { ' . $init_crypt . 'if ($_action == "encrypt") { ' . $encrypt . ' } else { ' . $decrypt . ' } };');
2573
+ return $func;
2574
+ }
2575
+
2576
+ return create_function('$_action, &$self, $_text', $init_crypt . 'if ($_action == "encrypt") { ' . $encrypt . ' } else { ' . $decrypt . ' }');
2577
+ }
2578
+
2579
+ /**
2580
+ * Holds the lambda_functions table (classwide)
2581
+ *
2582
+ * Each name of the lambda function, created from
2583
+ * _setupInlineCrypt() && _createInlineCryptFunction()
2584
+ * is stored, classwide (!), here for reusing.
2585
+ *
2586
+ * The string-based index of $function is a classwide
2587
+ * unique value representing, at least, the $mode of
2588
+ * operation (or more... depends of the optimizing level)
2589
+ * for which $mode the lambda function was created.
2590
+ *
2591
+ * @access private
2592
+ * @return array &$functions
2593
+ */
2594
+ function &_getLambdaFunctions()
2595
+ {
2596
+ static $functions = array();
2597
+ return $functions;
2598
+ }
2599
+
2600
+ /**
2601
+ * Generates a digest from $bytes
2602
+ *
2603
+ * @see self::_setupInlineCrypt()
2604
+ * @access private
2605
+ * @param $bytes
2606
+ * @return string
2607
+ */
2608
+ function _hashInlineCryptFunction($bytes)
2609
+ {
2610
+ if (!defined('CRYPT_BASE_WHIRLPOOL_AVAILABLE')) {
2611
+ define('CRYPT_BASE_WHIRLPOOL_AVAILABLE', (bool)(extension_loaded('hash') && in_array('whirlpool', hash_algos())));
2612
+ }
2613
+
2614
+ $result = '';
2615
+ $hash = $bytes;
2616
+
2617
+ switch (true) {
2618
+ case CRYPT_BASE_WHIRLPOOL_AVAILABLE:
2619
+ foreach (str_split($bytes, 64) as $t) {
2620
+ $hash = hash('whirlpool', $hash, true);
2621
+ $result .= $t ^ $hash;
2622
+ }
2623
+ return $result . hash('whirlpool', $hash, true);
2624
+ default:
2625
+ $len = strlen($bytes);
2626
+ for ($i = 0; $i < $len; $i+=20) {
2627
+ $t = substr($bytes, $i, 20);
2628
+ $hash = pack('H*', sha1($hash));
2629
+ $result .= $t ^ $hash;
2630
+ }
2631
+ return $result . pack('H*', sha1($hash));
2632
+ }
2633
+ }
2634
+
2635
+ /**
2636
+ * Convert float to int
2637
+ *
2638
+ * On 32-bit Linux installs running PHP < 5.3 converting floats to ints doesn't always work
2639
+ *
2640
+ * @access private
2641
+ * @param string $x
2642
+ * @return int
2643
+ */
2644
+ function safe_intval($x)
2645
+ {
2646
+ switch (true) {
2647
+ case is_int($x):
2648
+ // PHP 5.3, per http://php.net/releases/5_3_0.php, introduced "more consistent float rounding"
2649
+ case version_compare(PHP_VERSION, '5.3.0') >= 0 && (php_uname('m') & "\xDF\xDF\xDF") != 'ARM':
2650
+ // PHP_OS & "\xDF\xDF\xDF" == strtoupper(substr(PHP_OS, 0, 3)), but a lot faster
2651
+ case (PHP_OS & "\xDF\xDF\xDF") === 'WIN':
2652
+ return $x;
2653
+ }
2654
+ return (fmod($x, 0x80000000) & 0x7FFFFFFF) |
2655
+ ((fmod(floor($x / 0x80000000), 2) & 1) << 31);
2656
+ }
2657
+
2658
+ /**
2659
+ * eval()'able string for in-line float to int
2660
+ *
2661
+ * @access private
2662
+ * @return string
2663
+ */
2664
+ function safe_intval_inline()
2665
+ {
2666
+ // on 32-bit linux systems with PHP < 5.3 float to integer conversion is bad
2667
+ switch (true) {
2668
+ case defined('PHP_INT_SIZE') && PHP_INT_SIZE == 8:
2669
+ case version_compare(PHP_VERSION, '5.3.0') >= 0 && (php_uname('m') & "\xDF\xDF\xDF") != 'ARM':
2670
+ case (PHP_OS & "\xDF\xDF\xDF") === 'WIN':
2671
+ return '%s';
2672
+ break;
2673
+ default:
2674
+ $safeint = '(is_int($temp = %s) ? $temp : (fmod($temp, 0x80000000) & 0x7FFFFFFF) | ';
2675
+ return $safeint . '((fmod(floor($temp / 0x80000000), 2) & 1) << 31))';
2676
+ }
2677
+ }
2678
+ }
2679
+
2680
+ /**
2681
+ * Random Number Generator
2682
+ *
2683
+ * The idea behind this function is that it can be easily replaced with your own crypt_random_string()
2684
+ * function. eg. maybe you have a better source of entropy for creating the initial states or whatever.
2685
+ *
2686
+ * PHP versions 4 and 5
2687
+ *
2688
+ * Here's a short example of how to use this library:
2689
+ * <code>
2690
+ * <?php
2691
+ * include 'Crypt/Random.php';
2692
+ *
2693
+ * echo bin2hex(crypt_random_string(8));
2694
+ * ?>
2695
+ * </code>
2696
+ *
2697
+ * LICENSE: Permission is hereby granted, free of charge, to any person obtaining a copy
2698
+ * of this software and associated documentation files (the "Software"), to deal
2699
+ * in the Software without restriction, including without limitation the rights
2700
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
2701
+ * copies of the Software, and to permit persons to whom the Software is
2702
+ * furnished to do so, subject to the following conditions:
2703
+ *
2704
+ * The above copyright notice and this permission notice shall be included in
2705
+ * all copies or substantial portions of the Software.
2706
+ *
2707
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
2708
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
2709
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
2710
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
2711
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2712
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2713
+ * THE SOFTWARE.
2714
+ *
2715
+ * @category Crypt
2716
+ * @package Crypt_Random
2717
+ * @author Jim Wigginton <terrafrost@php.net>
2718
+ * @copyright 2007 Jim Wigginton
2719
+ * @license http://www.opensource.org/licenses/mit-license.html MIT License
2720
+ * @link http://phpseclib.sourceforge.net
2721
+ */
2722
+
2723
+ // laravel is a PHP framework that utilizes phpseclib. laravel workbenches may, independently,
2724
+ // have phpseclib as a requirement as well. if you're developing such a program you may encounter
2725
+ // a "Cannot redeclare crypt_random_string()" error.
2726
+ if (!function_exists('crypt_random_string')) {
2727
+ /**
2728
+ * "Is Windows" test
2729
+ *
2730
+ * @access private
2731
+ */
2732
+ define('CRYPT_RANDOM_IS_WINDOWS', strtoupper(substr(PHP_OS, 0, 3)) === 'WIN');
2733
+
2734
+ /**
2735
+ * Generate a random string.
2736
+ *
2737
+ * Although microoptimizations are generally discouraged as they impair readability this function is ripe with
2738
+ * microoptimizations because this function has the potential of being called a huge number of times.
2739
+ * eg. for RSA key generation.
2740
+ *
2741
+ * @param int $length
2742
+ * @return string
2743
+ * @access public
2744
+ */
2745
+ function crypt_random_string($length)
2746
+ {
2747
+ if (!$length) {
2748
+ return '';
2749
+ }
2750
+
2751
+ if (CRYPT_RANDOM_IS_WINDOWS) {
2752
+ // method 1. prior to PHP 5.3, mcrypt_create_iv() would call rand() on windows
2753
+ if (extension_loaded('mcrypt') && version_compare(PHP_VERSION, '5.3.0', '>=')) {
2754
+ return @mcrypt_create_iv($length);
2755
+ }
2756
+ // method 2. openssl_random_pseudo_bytes was introduced in PHP 5.3.0 but prior to PHP 5.3.4 there was,
2757
+ // to quote <http://php.net/ChangeLog-5.php#5.3.4>, "possible blocking behavior". as of 5.3.4
2758
+ // openssl_random_pseudo_bytes and mcrypt_create_iv do the exact same thing on Windows. ie. they both
2759
+ // call php_win32_get_random_bytes():
2760
+ //
2761
+ // https://github.com/php/php-src/blob/7014a0eb6d1611151a286c0ff4f2238f92c120d6/ext/openssl/openssl.c#L5008
2762
+ // https://github.com/php/php-src/blob/7014a0eb6d1611151a286c0ff4f2238f92c120d6/ext/mcrypt/mcrypt.c#L1392
2763
+ //
2764
+ // php_win32_get_random_bytes() is defined thusly:
2765
+ //
2766
+ // https://github.com/php/php-src/blob/7014a0eb6d1611151a286c0ff4f2238f92c120d6/win32/winutil.c#L80
2767
+ //
2768
+ // we're calling it, all the same, in the off chance that the mcrypt extension is not available
2769
+ if (extension_loaded('openssl') && version_compare(PHP_VERSION, '5.3.4', '>=')) {
2770
+ return openssl_random_pseudo_bytes($length);
2771
+ }
2772
+ } else {
2773
+ // method 1. the fastest
2774
+ if (extension_loaded('openssl') && version_compare(PHP_VERSION, '5.3.0', '>=')) {
2775
+ return openssl_random_pseudo_bytes($length);
2776
+ }
2777
+ // method 2
2778
+ static $fp = true;
2779
+ if ($fp === true) {
2780
+ // warning's will be output unles the error suppression operator is used. errors such as
2781
+ // "open_basedir restriction in effect", "Permission denied", "No such file or directory", etc.
2782
+ $fp = @fopen('/dev/urandom', 'rb');
2783
+ }
2784
+ if ($fp !== true && $fp !== false) { // surprisingly faster than !is_bool() or is_resource()
2785
+ return fread($fp, $length);
2786
+ }
2787
+ // method 3. pretty much does the same thing as method 2 per the following url:
2788
+ // https://github.com/php/php-src/blob/7014a0eb6d1611151a286c0ff4f2238f92c120d6/ext/mcrypt/mcrypt.c#L1391
2789
+ // surprisingly slower than method 2. maybe that's because mcrypt_create_iv does a bunch of error checking that we're
2790
+ // not doing. regardless, this'll only be called if this PHP script couldn't open /dev/urandom due to open_basedir
2791
+ // restrictions or some such
2792
+ if (extension_loaded('mcrypt')) {
2793
+ return @mcrypt_create_iv($length, MCRYPT_DEV_URANDOM);
2794
+ }
2795
+ }
2796
+ // at this point we have no choice but to use a pure-PHP CSPRNG
2797
+
2798
+ // cascade entropy across multiple PHP instances by fixing the session and collecting all
2799
+ // environmental variables, including the previous session data and the current session
2800
+ // data.
2801
+ //
2802
+ // mt_rand seeds itself by looking at the PID and the time, both of which are (relatively)
2803
+ // easy to guess at. linux uses mouse clicks, keyboard timings, etc, as entropy sources, but
2804
+ // PHP isn't low level to be able to use those as sources and on a web server there's not likely
2805
+ // going to be a ton of keyboard or mouse action. web servers do have one thing that we can use
2806
+ // however, a ton of people visiting the website. obviously you don't want to base your seeding
2807
+ // soley on parameters a potential attacker sends but (1) not everything in $_SERVER is controlled
2808
+ // by the user and (2) this isn't just looking at the data sent by the current user - it's based
2809
+ // on the data sent by all users. one user requests the page and a hash of their info is saved.
2810
+ // another user visits the page and the serialization of their data is utilized along with the
2811
+ // server envirnment stuff and a hash of the previous http request data (which itself utilizes
2812
+ // a hash of the session data before that). certainly an attacker should be assumed to have
2813
+ // full control over his own http requests. he, however, is not going to have control over
2814
+ // everyone's http requests.
2815
+ static $crypto = false, $v;
2816
+ if ($crypto === false) {
2817
+ // save old session data
2818
+ $old_session_id = session_id();
2819
+ $old_use_cookies = ini_get('session.use_cookies');
2820
+ $old_session_cache_limiter = session_cache_limiter();
2821
+ $_OLD_SESSION = isset($_SESSION) ? $_SESSION : false;
2822
+ if ($old_session_id != '') {
2823
+ session_write_close();
2824
+ }
2825
+
2826
+ session_id(1);
2827
+ ini_set('session.use_cookies', 0);
2828
+ session_cache_limiter('');
2829
+ session_start();
2830
+
2831
+ $v = $seed = $_SESSION['seed'] = pack('H*', sha1(
2832
+ (isset($_SERVER) ? phpseclib_safe_serialize($_SERVER) : '') .
2833
+ (isset($_POST) ? phpseclib_safe_serialize($_POST) : '') .
2834
+ (isset($_GET) ? phpseclib_safe_serialize($_GET) : '') .
2835
+ (isset($_COOKIE) ? phpseclib_safe_serialize($_COOKIE) : '') .
2836
+ phpseclib_safe_serialize($GLOBALS) .
2837
+ phpseclib_safe_serialize($_SESSION) .
2838
+ phpseclib_safe_serialize($_OLD_SESSION)
2839
+ ));
2840
+ if (!isset($_SESSION['count'])) {
2841
+ $_SESSION['count'] = 0;
2842
+ }
2843
+ $_SESSION['count']++;
2844
+
2845
+ session_write_close();
2846
+
2847
+ // restore old session data
2848
+ if ($old_session_id != '') {
2849
+ session_id($old_session_id);
2850
+ session_start();
2851
+ ini_set('session.use_cookies', $old_use_cookies);
2852
+ session_cache_limiter($old_session_cache_limiter);
2853
+ } else {
2854
+ if ($_OLD_SESSION !== false) {
2855
+ $_SESSION = $_OLD_SESSION;
2856
+ unset($_OLD_SESSION);
2857
+ } else {
2858
+ unset($_SESSION);
2859
+ }
2860
+ }
2861
+
2862
+ // in SSH2 a shared secret and an exchange hash are generated through the key exchange process.
2863
+ // the IV client to server is the hash of that "nonce" with the letter A and for the encryption key it's the letter C.
2864
+ // if the hash doesn't produce enough a key or an IV that's long enough concat successive hashes of the
2865
+ // original hash and the current hash. we'll be emulating that. for more info see the following URL:
2866
+ //
2867
+ // http://tools.ietf.org/html/rfc4253#section-7.2
2868
+ //
2869
+ // see the is_string($crypto) part for an example of how to expand the keys
2870
+ $key = pack('H*', sha1($seed . 'A'));
2871
+ $iv = pack('H*', sha1($seed . 'C'));
2872
+
2873
+ // ciphers are used as per the nist.gov link below. also, see this link:
2874
+ //
2875
+ // http://en.wikipedia.org/wiki/Cryptographically_secure_pseudorandom_number_generator#Designs_based_on_cryptographic_primitives
2876
+ switch (true) {
2877
+ case phpseclib_resolve_include_path('Crypt/AES.php'):
2878
+ /*
2879
+ if (!class_exists('Crypt_AES')) {
2880
+ include_once 'AES.php';
2881
+ }
2882
+ */
2883
+ $crypto = new Crypt_AES(CRYPT_AES_MODE_CTR);
2884
+ break;
2885
+ case phpseclib_resolve_include_path('Crypt/Twofish.php'):
2886
+ /*
2887
+ if (!class_exists('Crypt_Twofish')) {
2888
+ include_once 'Twofish.php';
2889
+ }
2890
+ */
2891
+ $crypto = new Crypt_Twofish(CRYPT_TWOFISH_MODE_CTR);
2892
+ break;
2893
+ case phpseclib_resolve_include_path('Crypt/Blowfish.php'):
2894
+ /*
2895
+ if (!class_exists('Crypt_Blowfish')) {
2896
+ include_once 'Blowfish.php';
2897
+ }
2898
+ */
2899
+ $crypto = new Crypt_Blowfish(CRYPT_BLOWFISH_MODE_CTR);
2900
+ break;
2901
+ case phpseclib_resolve_include_path('Crypt/TripleDES.php'):
2902
+ /*
2903
+ if (!class_exists('Crypt_TripleDES')) {
2904
+ include_once 'TripleDES.php';
2905
+ }
2906
+ */
2907
+ $crypto = new Crypt_TripleDES(CRYPT_DES_MODE_CTR);
2908
+ break;
2909
+ case phpseclib_resolve_include_path('Crypt/DES.php'):
2910
+ /*
2911
+ if (!class_exists('Crypt_DES')) {
2912
+ include_once 'DES.php';
2913
+ }
2914
+ */
2915
+ $crypto = new Crypt_DES(CRYPT_DES_MODE_CTR);
2916
+ break;
2917
+ case phpseclib_resolve_include_path('Crypt/RC4.php'):
2918
+ /*
2919
+ if (!class_exists('Crypt_RC4')) {
2920
+ include_once 'RC4.php';
2921
+ }
2922
+ */
2923
+ $crypto = new Crypt_RC4();
2924
+ break;
2925
+ default:
2926
+ user_error('crypt_random_string requires at least one symmetric cipher be loaded');
2927
+ return false;
2928
+ }
2929
+
2930
+ $crypto->setKey($key);
2931
+ $crypto->setIV($iv);
2932
+ $crypto->enableContinuousBuffer();
2933
+ }
2934
+
2935
+ //return $crypto->encrypt(str_repeat("\0", $length));
2936
+
2937
+ // the following is based off of ANSI X9.31:
2938
+ //
2939
+ // http://csrc.nist.gov/groups/STM/cavp/documents/rng/931rngext.pdf
2940
+ //
2941
+ // OpenSSL uses that same standard for it's random numbers:
2942
+ //
2943
+ // http://www.opensource.apple.com/source/OpenSSL/OpenSSL-38/openssl/fips-1.0/rand/fips_rand.c
2944
+ // (do a search for "ANS X9.31 A.2.4")
2945
+ $result = '';
2946
+ while (strlen($result) < $length) {
2947
+ $i = $crypto->encrypt(microtime()); // strlen(microtime()) == 21
2948
+ $r = $crypto->encrypt($i ^ $v); // strlen($v) == 20
2949
+ $v = $crypto->encrypt($r ^ $i); // strlen($r) == 20
2950
+ $result.= $r;
2951
+ }
2952
+ return substr($result, 0, $length);
2953
+ }
2954
+ }
2955
+
2956
+ if (!function_exists('phpseclib_safe_serialize')) {
2957
+ /**
2958
+ * Safely serialize variables
2959
+ *
2960
+ * If a class has a private __sleep() method it'll give a fatal error on PHP 5.2 and earlier.
2961
+ * PHP 5.3 will emit a warning.
2962
+ *
2963
+ * @param mixed $arr
2964
+ * @access public
2965
+ */
2966
+ function phpseclib_safe_serialize(&$arr)
2967
+ {
2968
+ if (is_object($arr)) {
2969
+ return '';
2970
+ }
2971
+ if (!is_array($arr)) {
2972
+ return serialize($arr);
2973
+ }
2974
+ // prevent circular array recursion
2975
+ if (isset($arr['__phpseclib_marker'])) {
2976
+ return '';
2977
+ }
2978
+ $safearr = array();
2979
+ $arr['__phpseclib_marker'] = true;
2980
+ foreach (array_keys($arr) as $key) {
2981
+ // do not recurse on the '__phpseclib_marker' key itself, for smaller memory usage
2982
+ if ($key !== '__phpseclib_marker') {
2983
+ $safearr[$key] = phpseclib_safe_serialize($arr[$key]);
2984
+ }
2985
+ }
2986
+ unset($arr['__phpseclib_marker']);
2987
+ return serialize($safearr);
2988
+ }
2989
+ }
2990
+
2991
+ if (!function_exists('phpseclib_resolve_include_path')) {
2992
+ /**
2993
+ * Resolve filename against the include path.
2994
+ *
2995
+ * Wrapper around stream_resolve_include_path() (which was introduced in
2996
+ * PHP 5.3.2) with fallback implementation for earlier PHP versions.
2997
+ *
2998
+ * @param string $filename
2999
+ * @return string|false
3000
+ * @access public
3001
+ */
3002
+ function phpseclib_resolve_include_path($filename)
3003
+ {
3004
+ if (function_exists('stream_resolve_include_path')) {
3005
+ return stream_resolve_include_path($filename);
3006
+ }
3007
+
3008
+ // handle non-relative paths
3009
+ if (file_exists($filename)) {
3010
+ return realpath($filename);
3011
+ }
3012
+
3013
+ $paths = PATH_SEPARATOR == ':' ?
3014
+ preg_split('#(?<!phar):#', get_include_path()) :
3015
+ explode(PATH_SEPARATOR, get_include_path());
3016
+ foreach ($paths as $prefix) {
3017
+ // path's specified in include_path don't always end in /
3018
+ $ds = substr($prefix, -1) == DIRECTORY_SEPARATOR ? '' : DIRECTORY_SEPARATOR;
3019
+ $file = $prefix . $ds . $filename;
3020
+ if (file_exists($file)) {
3021
+ return realpath($file);
3022
+ }
3023
+ }
3024
+
3025
+ return false;
3026
+ }
3027
+ }
3028
+
3029
+ /**
3030
+ * Pure-PHP implementation of Rijndael.
3031
+ *
3032
+ * Uses mcrypt, if available/possible, and an internal implementation, otherwise.
3033
+ *
3034
+ * PHP versions 4 and 5
3035
+ *
3036
+ * If {@link self::setBlockLength() setBlockLength()} isn't called, it'll be assumed to be 128 bits. If
3037
+ * {@link self::setKeyLength() setKeyLength()} isn't called, it'll be calculated from
3038
+ * {@link self::setKey() setKey()}. ie. if the key is 128-bits, the key length will be 128-bits. If it's
3039
+ * 136-bits it'll be null-padded to 192-bits and 192 bits will be the key length until
3040
+ * {@link self::setKey() setKey()} is called, again, at which point, it'll be recalculated.
3041
+ *
3042
+ * Not all Rijndael implementations may support 160-bits or 224-bits as the block length / key length. mcrypt, for example,
3043
+ * does not. AES, itself, only supports block lengths of 128 and key lengths of 128, 192, and 256.
3044
+ * {@link http://csrc.nist.gov/archive/aes/rijndael/Rijndael-ammended.pdf#page=10 Rijndael-ammended.pdf#page=10} defines the
3045
+ * algorithm for block lengths of 192 and 256 but not for block lengths / key lengths of 160 and 224. Indeed, 160 and 224
3046
+ * are first defined as valid key / block lengths in
3047
+ * {@link http://csrc.nist.gov/archive/aes/rijndael/Rijndael-ammended.pdf#page=44 Rijndael-ammended.pdf#page=44}:
3048
+ * Extensions: Other block and Cipher Key lengths.
3049
+ * Note: Use of 160/224-bit Keys must be explicitly set by setKeyLength(160) respectively setKeyLength(224).
3050
+ *
3051
+ * {@internal The variable names are the same as those in
3052
+ * {@link http://www.csrc.nist.gov/publications/fips/fips197/fips-197.pdf#page=10 fips-197.pdf#page=10}.}}
3053
+ *
3054
+ * Here's a short example of how to use this library:
3055
+ * <code>
3056
+ * <?php
3057
+ * include 'Crypt/Rijndael.php';
3058
+ *
3059
+ * $rijndael = new Crypt_Rijndael();
3060
+ *
3061
+ * $rijndael->setKey('abcdefghijklmnop');
3062
+ *
3063
+ * $size = 10 * 1024;
3064
+ * $plaintext = '';
3065
+ * for ($i = 0; $i < $size; $i++) {
3066
+ * $plaintext.= 'a';
3067
+ * }
3068
+ *
3069
+ * echo $rijndael->decrypt($rijndael->encrypt($plaintext));
3070
+ * ?>
3071
+ * </code>
3072
+ *
3073
+ * LICENSE: Permission is hereby granted, free of charge, to any person obtaining a copy
3074
+ * of this software and associated documentation files (the "Software"), to deal
3075
+ * in the Software without restriction, including without limitation the rights
3076
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
3077
+ * copies of the Software, and to permit persons to whom the Software is
3078
+ * furnished to do so, subject to the following conditions:
3079
+ *
3080
+ * The above copyright notice and this permission notice shall be included in
3081
+ * all copies or substantial portions of the Software.
3082
+ *
3083
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
3084
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
3085
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
3086
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
3087
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
3088
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
3089
+ * THE SOFTWARE.
3090
+ *
3091
+ * @category Crypt
3092
+ * @package Crypt_Rijndael
3093
+ * @author Jim Wigginton <terrafrost@php.net>
3094
+ * @copyright 2008 Jim Wigginton
3095
+ * @license http://www.opensource.org/licenses/mit-license.html MIT License
3096
+ * @link http://phpseclib.sourceforge.net
3097
+ */
3098
+
3099
+
3100
+ /**#@+
3101
+ * @access public
3102
+ * @see self::encrypt()
3103
+ * @see self::decrypt()
3104
+ */
3105
+ /**
3106
+ * Encrypt / decrypt using the Counter mode.
3107
+ *
3108
+ * Set to -1 since that's what Crypt/Random.php uses to index the CTR mode.
3109
+ *
3110
+ * @link http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation#Counter_.28CTR.29
3111
+ */
3112
+ define('CRYPT_RIJNDAEL_MODE_CTR', CRYPT_MODE_CTR);
3113
+ /**
3114
+ * Encrypt / decrypt using the Electronic Code Book mode.
3115
+ *
3116
+ * @link http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation#Electronic_codebook_.28ECB.29
3117
+ */
3118
+ define('CRYPT_RIJNDAEL_MODE_ECB', CRYPT_MODE_ECB);
3119
+ /**
3120
+ * Encrypt / decrypt using the Code Book Chaining mode.
3121
+ *
3122
+ * @link http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation#Cipher-block_chaining_.28CBC.29
3123
+ */
3124
+ define('CRYPT_RIJNDAEL_MODE_CBC', CRYPT_MODE_CBC);
3125
+ /**
3126
+ * Encrypt / decrypt using the Cipher Feedback mode.
3127
+ *
3128
+ * @link http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation#Cipher_feedback_.28CFB.29
3129
+ */
3130
+ define('CRYPT_RIJNDAEL_MODE_CFB', CRYPT_MODE_CFB);
3131
+ /**
3132
+ * Encrypt / decrypt using the Cipher Feedback mode.
3133
+ *
3134
+ * @link http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation#Output_feedback_.28OFB.29
3135
+ */
3136
+ define('CRYPT_RIJNDAEL_MODE_OFB', CRYPT_MODE_OFB);
3137
+ /**#@-*/
3138
+
3139
+ /**
3140
+ * Pure-PHP implementation of Rijndael.
3141
+ *
3142
+ * @package Crypt_Rijndael
3143
+ * @author Jim Wigginton <terrafrost@php.net>
3144
+ * @access public
3145
+ */
3146
+ class Crypt_Rijndael extends Crypt_Base
3147
+ {
3148
+ /**
3149
+ * The namespace used by the cipher for its constants.
3150
+ *
3151
+ * @see Crypt_Base::const_namespace
3152
+ * @var string
3153
+ * @access private
3154
+ */
3155
+ var $const_namespace = 'RIJNDAEL';
3156
+
3157
+ /**
3158
+ * The mcrypt specific name of the cipher
3159
+ *
3160
+ * Mcrypt is useable for 128/192/256-bit $block_size/$key_length. For 160/224 not.
3161
+ * Crypt_Rijndael determines automatically whether mcrypt is useable
3162
+ * or not for the current $block_size/$key_length.
3163
+ * In case of, $cipher_name_mcrypt will be set dynamically at run time accordingly.
3164
+ *
3165
+ * @see Crypt_Base::cipher_name_mcrypt
3166
+ * @see Crypt_Base::engine
3167
+ * @see self::isValidEngine()
3168
+ * @var string
3169
+ * @access private
3170
+ */
3171
+ var $cipher_name_mcrypt = 'rijndael-128';
3172
+
3173
+ /**
3174
+ * The default salt used by setPassword()
3175
+ *
3176
+ * @see Crypt_Base::password_default_salt
3177
+ * @see Crypt_Base::setPassword()
3178
+ * @var string
3179
+ * @access private
3180
+ */
3181
+ var $password_default_salt = 'phpseclib';
3182
+
3183
+ /**
3184
+ * The Key Schedule
3185
+ *
3186
+ * @see self::_setup()
3187
+ * @var array
3188
+ * @access private
3189
+ */
3190
+ var $w;
3191
+
3192
+ /**
3193
+ * The Inverse Key Schedule
3194
+ *
3195
+ * @see self::_setup()
3196
+ * @var array
3197
+ * @access private
3198
+ */
3199
+ var $dw;
3200
+
3201
+ /**
3202
+ * The Block Length divided by 32
3203
+ *
3204
+ * @see self::setBlockLength()
3205
+ * @var int
3206
+ * @access private
3207
+ * @internal The max value is 256 / 32 = 8, the min value is 128 / 32 = 4. Exists in conjunction with $block_size
3208
+ * because the encryption / decryption / key schedule creation requires this number and not $block_size. We could
3209
+ * derive this from $block_size or vice versa, but that'd mean we'd have to do multiple shift operations, so in lieu
3210
+ * of that, we'll just precompute it once.
3211
+ */
3212
+ var $Nb = 4;
3213
+
3214
+ /**
3215
+ * The Key Length (in bytes)
3216
+ *
3217
+ * @see self::setKeyLength()
3218
+ * @var int
3219
+ * @access private
3220
+ * @internal The max value is 256 / 8 = 32, the min value is 128 / 8 = 16. Exists in conjunction with $Nk
3221
+ * because the encryption / decryption / key schedule creation requires this number and not $key_length. We could
3222
+ * derive this from $key_length or vice versa, but that'd mean we'd have to do multiple shift operations, so in lieu
3223
+ * of that, we'll just precompute it once.
3224
+ */
3225
+ var $key_length = 16;
3226
+
3227
+ /**
3228
+ * The Key Length divided by 32
3229
+ *
3230
+ * @see self::setKeyLength()
3231
+ * @var int
3232
+ * @access private
3233
+ * @internal The max value is 256 / 32 = 8, the min value is 128 / 32 = 4
3234
+ */
3235
+ var $Nk = 4;
3236
+
3237
+ /**
3238
+ * The Number of Rounds
3239
+ *
3240
+ * @var int
3241
+ * @access private
3242
+ * @internal The max value is 14, the min value is 10.
3243
+ */
3244
+ var $Nr;
3245
+
3246
+ /**
3247
+ * Shift offsets
3248
+ *
3249
+ * @var array
3250
+ * @access private
3251
+ */
3252
+ var $c;
3253
+
3254
+ /**
3255
+ * Holds the last used key- and block_size information
3256
+ *
3257
+ * @var array
3258
+ * @access private
3259
+ */
3260
+ var $kl;
3261
+
3262
+ /**
3263
+ * Sets the key.
3264
+ *
3265
+ * Keys can be of any length. Rijndael, itself, requires the use of a key that's between 128-bits and 256-bits long and
3266
+ * whose length is a multiple of 32. If the key is less than 256-bits and the key length isn't set, we round the length
3267
+ * up to the closest valid key length, padding $key with null bytes. If the key is more than 256-bits, we trim the
3268
+ * excess bits.
3269
+ *
3270
+ * If the key is not explicitly set, it'll be assumed to be all null bytes.
3271
+ *
3272
+ * Note: 160/224-bit keys must explicitly set by setKeyLength(), otherwise they will be round/pad up to 192/256 bits.
3273
+ *
3274
+ * @see Crypt_Base:setKey()
3275
+ * @see self::setKeyLength()
3276
+ * @access public
3277
+ * @param string $key
3278
+ */
3279
+ function setKey($key)
3280
+ {
3281
+ if (!$this->explicit_key_length) {
3282
+ $length = strlen($key);
3283
+ switch (true) {
3284
+ case $length <= 16:
3285
+ $this->key_size = 16;
3286
+ break;
3287
+ case $length <= 20:
3288
+ $this->key_size = 20;
3289
+ break;
3290
+ case $length <= 24:
3291
+ $this->key_size = 24;
3292
+ break;
3293
+ case $length <= 28:
3294
+ $this->key_size = 28;
3295
+ break;
3296
+ default:
3297
+ $this->key_size = 32;
3298
+ }
3299
+ }
3300
+ parent::setKey($key);
3301
+ }
3302
+
3303
+ /**
3304
+ * Sets the key length
3305
+ *
3306
+ * Valid key lengths are 128, 160, 192, 224, and 256. If the length is less than 128, it will be rounded up to
3307
+ * 128. If the length is greater than 128 and invalid, it will be rounded down to the closest valid amount.
3308
+ *
3309
+ * Note: phpseclib extends Rijndael (and AES) for using 160- and 224-bit keys but they are officially not defined
3310
+ * and the most (if not all) implementations are not able using 160/224-bit keys but round/pad them up to
3311
+ * 192/256 bits as, for example, mcrypt will do.
3312
+ *
3313
+ * That said, if you want be compatible with other Rijndael and AES implementations,
3314
+ * you should not setKeyLength(160) or setKeyLength(224).
3315
+ *
3316
+ * Additional: In case of 160- and 224-bit keys, phpseclib will/can, for that reason, not use
3317
+ * the mcrypt php extension, even if available.
3318
+ * This results then in slower encryption.
3319
+ *
3320
+ * @access public
3321
+ * @param int $length
3322
+ */
3323
+ function setKeyLength($length)
3324
+ {
3325
+ switch (true) {
3326
+ case $length <= 128:
3327
+ $this->key_length = 16;
3328
+ break;
3329
+ case $length <= 160:
3330
+ $this->key_length = 20;
3331
+ break;
3332
+ case $length <= 192:
3333
+ $this->key_length = 24;
3334
+ break;
3335
+ case $length <= 224:
3336
+ $this->key_length = 28;
3337
+ break;
3338
+ default:
3339
+ $this->key_length = 32;
3340
+ }
3341
+
3342
+ parent::setKeyLength($length);
3343
+ }
3344
+
3345
+ /**
3346
+ * Sets the block length
3347
+ *
3348
+ * Valid block lengths are 128, 160, 192, 224, and 256. If the length is less than 128, it will be rounded up to
3349
+ * 128. If the length is greater than 128 and invalid, it will be rounded down to the closest valid amount.
3350
+ *
3351
+ * @access public
3352
+ * @param int $length
3353
+ */
3354
+ function setBlockLength($length)
3355
+ {
3356
+ $length >>= 5;
3357
+ if ($length > 8) {
3358
+ $length = 8;
3359
+ } elseif ($length < 4) {
3360
+ $length = 4;
3361
+ }
3362
+ $this->Nb = $length;
3363
+ $this->block_size = $length << 2;
3364
+ $this->changed = true;
3365
+ $this->_setEngine();
3366
+ }
3367
+
3368
+ /**
3369
+ * Test for engine validity
3370
+ *
3371
+ * This is mainly just a wrapper to set things up for Crypt_Base::isValidEngine()
3372
+ *
3373
+ * @see Crypt_Base::Crypt_Base()
3374
+ * @param int $engine
3375
+ * @access public
3376
+ * @return bool
3377
+ */
3378
+ function isValidEngine($engine)
3379
+ {
3380
+ switch ($engine) {
3381
+ case CRYPT_ENGINE_OPENSSL:
3382
+ if ($this->block_size != 16) {
3383
+ return false;
3384
+ }
3385
+ $this->cipher_name_openssl_ecb = 'aes-' . ($this->key_length << 3) . '-ecb';
3386
+ $this->cipher_name_openssl = 'aes-' . ($this->key_length << 3) . '-' . $this->_openssl_translate_mode();
3387
+ break;
3388
+ case CRYPT_ENGINE_MCRYPT:
3389
+ $this->cipher_name_mcrypt = 'rijndael-' . ($this->block_size << 3);
3390
+ if ($this->key_length % 8) { // is it a 160/224-bit key?
3391
+ // mcrypt is not usable for them, only for 128/192/256-bit keys
3392
+ return false;
3393
+ }
3394
+ }
3395
+
3396
+ return parent::isValidEngine($engine);
3397
+ }
3398
+
3399
+ /**
3400
+ * Encrypts a block
3401
+ *
3402
+ * @access private
3403
+ * @param string $in
3404
+ * @return string
3405
+ */
3406
+ function _encryptBlock($in)
3407
+ {
3408
+ static $tables;
3409
+ if (empty($tables)) {
3410
+ $tables = &$this->_getTables();
3411
+ }
3412
+ $t0 = $tables[0];
3413
+ $t1 = $tables[1];
3414
+ $t2 = $tables[2];
3415
+ $t3 = $tables[3];
3416
+ $sbox = $tables[4];
3417
+
3418
+ $state = array();
3419
+ $words = unpack('N*', $in);
3420
+
3421
+ $c = $this->c;
3422
+ $w = $this->w;
3423
+ $Nb = $this->Nb;
3424
+ $Nr = $this->Nr;
3425
+
3426
+ // addRoundKey
3427
+ $wc = $Nb - 1;
3428
+ foreach ($words as $word) {
3429
+ $state[] = $word ^ $w[++$wc];
3430
+ }
3431
+
3432
+ // fips-197.pdf#page=19, "Figure 5. Pseudo Code for the Cipher", states that this loop has four components -
3433
+ // subBytes, shiftRows, mixColumns, and addRoundKey. fips-197.pdf#page=30, "Implementation Suggestions Regarding
3434
+ // Various Platforms" suggests that performs enhanced implementations are described in Rijndael-ammended.pdf.
3435
+ // Rijndael-ammended.pdf#page=20, "Implementation aspects / 32-bit processor", discusses such an optimization.
3436
+ // Unfortunately, the description given there is not quite correct. Per aes.spec.v316.pdf#page=19 [1],
3437
+ // equation (7.4.7) is supposed to use addition instead of subtraction, so we'll do that here, as well.
3438
+
3439
+ // [1] http://fp.gladman.plus.com/cryptography_technology/rijndael/aes.spec.v316.pdf
3440
+ $temp = array();
3441
+ for ($round = 1; $round < $Nr; ++$round) {
3442
+ $i = 0; // $c[0] == 0
3443
+ $j = $c[1];
3444
+ $k = $c[2];
3445
+ $l = $c[3];
3446
+
3447
+ while ($i < $Nb) {
3448
+ $temp[$i] = $t0[$state[$i] >> 24 & 0x000000FF] ^
3449
+ $t1[$state[$j] >> 16 & 0x000000FF] ^
3450
+ $t2[$state[$k] >> 8 & 0x000000FF] ^
3451
+ $t3[$state[$l] & 0x000000FF] ^
3452
+ $w[++$wc];
3453
+ ++$i;
3454
+ $j = ($j + 1) % $Nb;
3455
+ $k = ($k + 1) % $Nb;
3456
+ $l = ($l + 1) % $Nb;
3457
+ }
3458
+ $state = $temp;
3459
+ }
3460
+
3461
+ // subWord
3462
+ for ($i = 0; $i < $Nb; ++$i) {
3463
+ $state[$i] = $sbox[$state[$i] & 0x000000FF] |
3464
+ ($sbox[$state[$i] >> 8 & 0x000000FF] << 8) |
3465
+ ($sbox[$state[$i] >> 16 & 0x000000FF] << 16) |
3466
+ ($sbox[$state[$i] >> 24 & 0x000000FF] << 24);
3467
+ }
3468
+
3469
+ // shiftRows + addRoundKey
3470
+ $i = 0; // $c[0] == 0
3471
+ $j = $c[1];
3472
+ $k = $c[2];
3473
+ $l = $c[3];
3474
+ while ($i < $Nb) {
3475
+ $temp[$i] = ($state[$i] & 0xFF000000) ^
3476
+ ($state[$j] & 0x00FF0000) ^
3477
+ ($state[$k] & 0x0000FF00) ^
3478
+ ($state[$l] & 0x000000FF) ^
3479
+ $w[$i];
3480
+ ++$i;
3481
+ $j = ($j + 1) % $Nb;
3482
+ $k = ($k + 1) % $Nb;
3483
+ $l = ($l + 1) % $Nb;
3484
+ }
3485
+
3486
+ switch ($Nb) {
3487
+ case 8:
3488
+ return pack('N*', $temp[0], $temp[1], $temp[2], $temp[3], $temp[4], $temp[5], $temp[6], $temp[7]);
3489
+ case 7:
3490
+ return pack('N*', $temp[0], $temp[1], $temp[2], $temp[3], $temp[4], $temp[5], $temp[6]);
3491
+ case 6:
3492
+ return pack('N*', $temp[0], $temp[1], $temp[2], $temp[3], $temp[4], $temp[5]);
3493
+ case 5:
3494
+ return pack('N*', $temp[0], $temp[1], $temp[2], $temp[3], $temp[4]);
3495
+ default:
3496
+ return pack('N*', $temp[0], $temp[1], $temp[2], $temp[3]);
3497
+ }
3498
+ }
3499
+
3500
+ /**
3501
+ * Decrypts a block
3502
+ *
3503
+ * @access private
3504
+ * @param string $in
3505
+ * @return string
3506
+ */
3507
+ function _decryptBlock($in)
3508
+ {
3509
+ static $invtables;
3510
+ if (empty($invtables)) {
3511
+ $invtables = &$this->_getInvTables();
3512
+ }
3513
+ $dt0 = $invtables[0];
3514
+ $dt1 = $invtables[1];
3515
+ $dt2 = $invtables[2];
3516
+ $dt3 = $invtables[3];
3517
+ $isbox = $invtables[4];
3518
+
3519
+ $state = array();
3520
+ $words = unpack('N*', $in);
3521
+
3522
+ $c = $this->c;
3523
+ $dw = $this->dw;
3524
+ $Nb = $this->Nb;
3525
+ $Nr = $this->Nr;
3526
+
3527
+ // addRoundKey
3528
+ $wc = $Nb - 1;
3529
+ foreach ($words as $word) {
3530
+ $state[] = $word ^ $dw[++$wc];
3531
+ }
3532
+
3533
+ $temp = array();
3534
+ for ($round = $Nr - 1; $round > 0; --$round) {
3535
+ $i = 0; // $c[0] == 0
3536
+ $j = $Nb - $c[1];
3537
+ $k = $Nb - $c[2];
3538
+ $l = $Nb - $c[3];
3539
+
3540
+ while ($i < $Nb) {
3541
+ $temp[$i] = $dt0[$state[$i] >> 24 & 0x000000FF] ^
3542
+ $dt1[$state[$j] >> 16 & 0x000000FF] ^
3543
+ $dt2[$state[$k] >> 8 & 0x000000FF] ^
3544
+ $dt3[$state[$l] & 0x000000FF] ^
3545
+ $dw[++$wc];
3546
+ ++$i;
3547
+ $j = ($j + 1) % $Nb;
3548
+ $k = ($k + 1) % $Nb;
3549
+ $l = ($l + 1) % $Nb;
3550
+ }
3551
+ $state = $temp;
3552
+ }
3553
+
3554
+ // invShiftRows + invSubWord + addRoundKey
3555
+ $i = 0; // $c[0] == 0
3556
+ $j = $Nb - $c[1];
3557
+ $k = $Nb - $c[2];
3558
+ $l = $Nb - $c[3];
3559
+
3560
+ while ($i < $Nb) {
3561
+ $word = ($state[$i] & 0xFF000000) |
3562
+ ($state[$j] & 0x00FF0000) |
3563
+ ($state[$k] & 0x0000FF00) |
3564
+ ($state[$l] & 0x000000FF);
3565
+
3566
+ $temp[$i] = $dw[$i] ^ ($isbox[$word & 0x000000FF] |
3567
+ ($isbox[$word >> 8 & 0x000000FF] << 8) |
3568
+ ($isbox[$word >> 16 & 0x000000FF] << 16) |
3569
+ ($isbox[$word >> 24 & 0x000000FF] << 24));
3570
+ ++$i;
3571
+ $j = ($j + 1) % $Nb;
3572
+ $k = ($k + 1) % $Nb;
3573
+ $l = ($l + 1) % $Nb;
3574
+ }
3575
+
3576
+ switch ($Nb) {
3577
+ case 8:
3578
+ return pack('N*', $temp[0], $temp[1], $temp[2], $temp[3], $temp[4], $temp[5], $temp[6], $temp[7]);
3579
+ case 7:
3580
+ return pack('N*', $temp[0], $temp[1], $temp[2], $temp[3], $temp[4], $temp[5], $temp[6]);
3581
+ case 6:
3582
+ return pack('N*', $temp[0], $temp[1], $temp[2], $temp[3], $temp[4], $temp[5]);
3583
+ case 5:
3584
+ return pack('N*', $temp[0], $temp[1], $temp[2], $temp[3], $temp[4]);
3585
+ default:
3586
+ return pack('N*', $temp[0], $temp[1], $temp[2], $temp[3]);
3587
+ }
3588
+ }
3589
+
3590
+ /**
3591
+ * Setup the key (expansion)
3592
+ *
3593
+ * @see Crypt_Base::_setupKey()
3594
+ * @access private
3595
+ */
3596
+ function _setupKey()
3597
+ {
3598
+ // Each number in $rcon is equal to the previous number multiplied by two in Rijndael's finite field.
3599
+ // See http://en.wikipedia.org/wiki/Finite_field_arithmetic#Multiplicative_inverse
3600
+ static $rcon = array(0,
3601
+ 0x01000000, 0x02000000, 0x04000000, 0x08000000, 0x10000000,
3602
+ 0x20000000, 0x40000000, 0x80000000, 0x1B000000, 0x36000000,
3603
+ 0x6C000000, 0xD8000000, 0xAB000000, 0x4D000000, 0x9A000000,
3604
+ 0x2F000000, 0x5E000000, 0xBC000000, 0x63000000, 0xC6000000,
3605
+ 0x97000000, 0x35000000, 0x6A000000, 0xD4000000, 0xB3000000,
3606
+ 0x7D000000, 0xFA000000, 0xEF000000, 0xC5000000, 0x91000000
3607
+ );
3608
+
3609
+ if (isset($this->kl['key']) && $this->key === $this->kl['key'] && $this->key_length === $this->kl['key_length'] && $this->block_size === $this->kl['block_size']) {
3610
+ // already expanded
3611
+ return;
3612
+ }
3613
+ $this->kl = array('key' => $this->key, 'key_length' => $this->key_length, 'block_size' => $this->block_size);
3614
+
3615
+ $this->Nk = $this->key_length >> 2;
3616
+ // see Rijndael-ammended.pdf#page=44
3617
+ $this->Nr = max($this->Nk, $this->Nb) + 6;
3618
+
3619
+ // shift offsets for Nb = 5, 7 are defined in Rijndael-ammended.pdf#page=44,
3620
+ // "Table 8: Shift offsets in Shiftrow for the alternative block lengths"
3621
+ // shift offsets for Nb = 4, 6, 8 are defined in Rijndael-ammended.pdf#page=14,
3622
+ // "Table 2: Shift offsets for different block lengths"
3623
+ switch ($this->Nb) {
3624
+ case 4:
3625
+ case 5:
3626
+ case 6:
3627
+ $this->c = array(0, 1, 2, 3);
3628
+ break;
3629
+ case 7:
3630
+ $this->c = array(0, 1, 2, 4);
3631
+ break;
3632
+ case 8:
3633
+ $this->c = array(0, 1, 3, 4);
3634
+ }
3635
+
3636
+ $w = array_values(unpack('N*words', $this->key));
3637
+
3638
+ $length = $this->Nb * ($this->Nr + 1);
3639
+ for ($i = $this->Nk; $i < $length; $i++) {
3640
+ $temp = $w[$i - 1];
3641
+ if ($i % $this->Nk == 0) {
3642
+ // according to <http://php.net/language.types.integer>, "the size of an integer is platform-dependent".
3643
+ // on a 32-bit machine, it's 32-bits, and on a 64-bit machine, it's 64-bits. on a 32-bit machine,
3644
+ // 0xFFFFFFFF << 8 == 0xFFFFFF00, but on a 64-bit machine, it equals 0xFFFFFFFF00. as such, doing 'and'
3645
+ // with 0xFFFFFFFF (or 0xFFFFFF00) on a 32-bit machine is unnecessary, but on a 64-bit machine, it is.
3646
+ $temp = (($temp << 8) & 0xFFFFFF00) | (($temp >> 24) & 0x000000FF); // rotWord
3647
+ $temp = $this->_subWord($temp) ^ $rcon[$i / $this->Nk];
3648
+ } elseif ($this->Nk > 6 && $i % $this->Nk == 4) {
3649
+ $temp = $this->_subWord($temp);
3650
+ }
3651
+ $w[$i] = $w[$i - $this->Nk] ^ $temp;
3652
+ }
3653
+
3654
+ // convert the key schedule from a vector of $Nb * ($Nr + 1) length to a matrix with $Nr + 1 rows and $Nb columns
3655
+ // and generate the inverse key schedule. more specifically,
3656
+ // according to <http://csrc.nist.gov/archive/aes/rijndael/Rijndael-ammended.pdf#page=23> (section 5.3.3),
3657
+ // "The key expansion for the Inverse Cipher is defined as follows:
3658
+ // 1. Apply the Key Expansion.
3659
+ // 2. Apply InvMixColumn to all Round Keys except the first and the last one."
3660
+ // also, see fips-197.pdf#page=27, "5.3.5 Equivalent Inverse Cipher"
3661
+ list($dt0, $dt1, $dt2, $dt3) = $this->_getInvTables();
3662
+ $temp = $this->w = $this->dw = array();
3663
+ for ($i = $row = $col = 0; $i < $length; $i++, $col++) {
3664
+ if ($col == $this->Nb) {
3665
+ if ($row == 0) {
3666
+ $this->dw[0] = $this->w[0];
3667
+ } else {
3668
+ // subWord + invMixColumn + invSubWord = invMixColumn
3669
+ $j = 0;
3670
+ while ($j < $this->Nb) {
3671
+ $dw = $this->_subWord($this->w[$row][$j]);
3672
+ $temp[$j] = $dt0[$dw >> 24 & 0x000000FF] ^
3673
+ $dt1[$dw >> 16 & 0x000000FF] ^
3674
+ $dt2[$dw >> 8 & 0x000000FF] ^
3675
+ $dt3[$dw & 0x000000FF];
3676
+ $j++;
3677
+ }
3678
+ $this->dw[$row] = $temp;
3679
+ }
3680
+
3681
+ $col = 0;
3682
+ $row++;
3683
+ }
3684
+ $this->w[$row][$col] = $w[$i];
3685
+ }
3686
+
3687
+ $this->dw[$row] = $this->w[$row];
3688
+
3689
+ // Converting to 1-dim key arrays (both ascending)
3690
+ $this->dw = array_reverse($this->dw);
3691
+ $w = array_pop($this->w);
3692
+ $dw = array_pop($this->dw);
3693
+ foreach ($this->w as $r => $wr) {
3694
+ foreach ($wr as $c => $wc) {
3695
+ $w[] = $wc;
3696
+ $dw[] = $this->dw[$r][$c];
3697
+ }
3698
+ }
3699
+ $this->w = $w;
3700
+ $this->dw = $dw;
3701
+ }
3702
+
3703
+ /**
3704
+ * Performs S-Box substitutions
3705
+ *
3706
+ * @access private
3707
+ * @param int $word
3708
+ */
3709
+ function _subWord($word)
3710
+ {
3711
+ static $sbox;
3712
+ if (empty($sbox)) {
3713
+ list(, , , , $sbox) = $this->_getTables();
3714
+ }
3715
+
3716
+ return $sbox[$word & 0x000000FF] |
3717
+ ($sbox[$word >> 8 & 0x000000FF] << 8) |
3718
+ ($sbox[$word >> 16 & 0x000000FF] << 16) |
3719
+ ($sbox[$word >> 24 & 0x000000FF] << 24);
3720
+ }
3721
+
3722
+ /**
3723
+ * Provides the mixColumns and sboxes tables
3724
+ *
3725
+ * @see Crypt_Rijndael:_encryptBlock()
3726
+ * @see Crypt_Rijndael:_setupInlineCrypt()
3727
+ * @see Crypt_Rijndael:_subWord()
3728
+ * @access private
3729
+ * @return array &$tables
3730
+ */
3731
+ function &_getTables()
3732
+ {
3733
+ static $tables;
3734
+ if (empty($tables)) {
3735
+ // according to <http://csrc.nist.gov/archive/aes/rijndael/Rijndael-ammended.pdf#page=19> (section 5.2.1),
3736
+ // precomputed tables can be used in the mixColumns phase. in that example, they're assigned t0...t3, so
3737
+ // those are the names we'll use.
3738
+ $t3 = array_map('intval', array(
3739
+ // with array_map('intval', ...) we ensure we have only int's and not
3740
+ // some slower floats converted by php automatically on high values
3741
+ 0x6363A5C6, 0x7C7C84F8, 0x777799EE, 0x7B7B8DF6, 0xF2F20DFF, 0x6B6BBDD6, 0x6F6FB1DE, 0xC5C55491,
3742
+ 0x30305060, 0x01010302, 0x6767A9CE, 0x2B2B7D56, 0xFEFE19E7, 0xD7D762B5, 0xABABE64D, 0x76769AEC,
3743
+ 0xCACA458F, 0x82829D1F, 0xC9C94089, 0x7D7D87FA, 0xFAFA15EF, 0x5959EBB2, 0x4747C98E, 0xF0F00BFB,
3744
+ 0xADADEC41, 0xD4D467B3, 0xA2A2FD5F, 0xAFAFEA45, 0x9C9CBF23, 0xA4A4F753, 0x727296E4, 0xC0C05B9B,
3745
+ 0xB7B7C275, 0xFDFD1CE1, 0x9393AE3D, 0x26266A4C, 0x36365A6C, 0x3F3F417E, 0xF7F702F5, 0xCCCC4F83,
3746
+ 0x34345C68, 0xA5A5F451, 0xE5E534D1, 0xF1F108F9, 0x717193E2, 0xD8D873AB, 0x31315362, 0x15153F2A,
3747
+ 0x04040C08, 0xC7C75295, 0x23236546, 0xC3C35E9D, 0x18182830, 0x9696A137, 0x05050F0A, 0x9A9AB52F,
3748
+ 0x0707090E, 0x12123624, 0x80809B1B, 0xE2E23DDF, 0xEBEB26CD, 0x2727694E, 0xB2B2CD7F, 0x75759FEA,
3749
+ 0x09091B12, 0x83839E1D, 0x2C2C7458, 0x1A1A2E34, 0x1B1B2D36, 0x6E6EB2DC, 0x5A5AEEB4, 0xA0A0FB5B,
3750
+ 0x5252F6A4, 0x3B3B4D76, 0xD6D661B7, 0xB3B3CE7D, 0x29297B52, 0xE3E33EDD, 0x2F2F715E, 0x84849713,
3751
+ 0x5353F5A6, 0xD1D168B9, 0x00000000, 0xEDED2CC1, 0x20206040, 0xFCFC1FE3, 0xB1B1C879, 0x5B5BEDB6,
3752
+ 0x6A6ABED4, 0xCBCB468D, 0xBEBED967, 0x39394B72, 0x4A4ADE94, 0x4C4CD498, 0x5858E8B0, 0xCFCF4A85,
3753
+ 0xD0D06BBB, 0xEFEF2AC5, 0xAAAAE54F, 0xFBFB16ED, 0x4343C586, 0x4D4DD79A, 0x33335566, 0x85859411,
3754
+ 0x4545CF8A, 0xF9F910E9, 0x02020604, 0x7F7F81FE, 0x5050F0A0, 0x3C3C4478, 0x9F9FBA25, 0xA8A8E34B,
3755
+ 0x5151F3A2, 0xA3A3FE5D, 0x4040C080, 0x8F8F8A05, 0x9292AD3F, 0x9D9DBC21, 0x38384870, 0xF5F504F1,
3756
+ 0xBCBCDF63, 0xB6B6C177, 0xDADA75AF, 0x21216342, 0x10103020, 0xFFFF1AE5, 0xF3F30EFD, 0xD2D26DBF,
3757
+ 0xCDCD4C81, 0x0C0C1418, 0x13133526, 0xECEC2FC3, 0x5F5FE1BE, 0x9797A235, 0x4444CC88, 0x1717392E,
3758
+ 0xC4C45793, 0xA7A7F255, 0x7E7E82FC, 0x3D3D477A, 0x6464ACC8, 0x5D5DE7BA, 0x19192B32, 0x737395E6,
3759
+ 0x6060A0C0, 0x81819819, 0x4F4FD19E, 0xDCDC7FA3, 0x22226644, 0x2A2A7E54, 0x9090AB3B, 0x8888830B,
3760
+ 0x4646CA8C, 0xEEEE29C7, 0xB8B8D36B, 0x14143C28, 0xDEDE79A7, 0x5E5EE2BC, 0x0B0B1D16, 0xDBDB76AD,
3761
+ 0xE0E03BDB, 0x32325664, 0x3A3A4E74, 0x0A0A1E14, 0x4949DB92, 0x06060A0C, 0x24246C48, 0x5C5CE4B8,
3762
+ 0xC2C25D9F, 0xD3D36EBD, 0xACACEF43, 0x6262A6C4, 0x9191A839, 0x9595A431, 0xE4E437D3, 0x79798BF2,
3763
+ 0xE7E732D5, 0xC8C8438B, 0x3737596E, 0x6D6DB7DA, 0x8D8D8C01, 0xD5D564B1, 0x4E4ED29C, 0xA9A9E049,
3764
+ 0x6C6CB4D8, 0x5656FAAC, 0xF4F407F3, 0xEAEA25CF, 0x6565AFCA, 0x7A7A8EF4, 0xAEAEE947, 0x08081810,
3765
+ 0xBABAD56F, 0x787888F0, 0x25256F4A, 0x2E2E725C, 0x1C1C2438, 0xA6A6F157, 0xB4B4C773, 0xC6C65197,
3766
+ 0xE8E823CB, 0xDDDD7CA1, 0x74749CE8, 0x1F1F213E, 0x4B4BDD96, 0xBDBDDC61, 0x8B8B860D, 0x8A8A850F,
3767
+ 0x707090E0, 0x3E3E427C, 0xB5B5C471, 0x6666AACC, 0x4848D890, 0x03030506, 0xF6F601F7, 0x0E0E121C,
3768
+ 0x6161A3C2, 0x35355F6A, 0x5757F9AE, 0xB9B9D069, 0x86869117, 0xC1C15899, 0x1D1D273A, 0x9E9EB927,
3769
+ 0xE1E138D9, 0xF8F813EB, 0x9898B32B, 0x11113322, 0x6969BBD2, 0xD9D970A9, 0x8E8E8907, 0x9494A733,
3770
+ 0x9B9BB62D, 0x1E1E223C, 0x87879215, 0xE9E920C9, 0xCECE4987, 0x5555FFAA, 0x28287850, 0xDFDF7AA5,
3771
+ 0x8C8C8F03, 0xA1A1F859, 0x89898009, 0x0D0D171A, 0xBFBFDA65, 0xE6E631D7, 0x4242C684, 0x6868B8D0,
3772
+ 0x4141C382, 0x9999B029, 0x2D2D775A, 0x0F0F111E, 0xB0B0CB7B, 0x5454FCA8, 0xBBBBD66D, 0x16163A2C
3773
+ ));
3774
+
3775
+ foreach ($t3 as $t3i) {
3776
+ $t0[] = (($t3i << 24) & 0xFF000000) | (($t3i >> 8) & 0x00FFFFFF);
3777
+ $t1[] = (($t3i << 16) & 0xFFFF0000) | (($t3i >> 16) & 0x0000FFFF);
3778
+ $t2[] = (($t3i << 8) & 0xFFFFFF00) | (($t3i >> 24) & 0x000000FF);
3779
+ }
3780
+
3781
+ $tables = array(
3782
+ // The Precomputed mixColumns tables t0 - t3
3783
+ $t0,
3784
+ $t1,
3785
+ $t2,
3786
+ $t3,
3787
+ // The SubByte S-Box
3788
+ array(
3789
+ 0x63, 0x7C, 0x77, 0x7B, 0xF2, 0x6B, 0x6F, 0xC5, 0x30, 0x01, 0x67, 0x2B, 0xFE, 0xD7, 0xAB, 0x76,
3790
+ 0xCA, 0x82, 0xC9, 0x7D, 0xFA, 0x59, 0x47, 0xF0, 0xAD, 0xD4, 0xA2, 0xAF, 0x9C, 0xA4, 0x72, 0xC0,
3791
+ 0xB7, 0xFD, 0x93, 0x26, 0x36, 0x3F, 0xF7, 0xCC, 0x34, 0xA5, 0xE5, 0xF1, 0x71, 0xD8, 0x31, 0x15,
3792
+ 0x04, 0xC7, 0x23, 0xC3, 0x18, 0x96, 0x05, 0x9A, 0x07, 0x12, 0x80, 0xE2, 0xEB, 0x27, 0xB2, 0x75,
3793
+ 0x09, 0x83, 0x2C, 0x1A, 0x1B, 0x6E, 0x5A, 0xA0, 0x52, 0x3B, 0xD6, 0xB3, 0x29, 0xE3, 0x2F, 0x84,
3794
+ 0x53, 0xD1, 0x00, 0xED, 0x20, 0xFC, 0xB1, 0x5B, 0x6A, 0xCB, 0xBE, 0x39, 0x4A, 0x4C, 0x58, 0xCF,
3795
+ 0xD0, 0xEF, 0xAA, 0xFB, 0x43, 0x4D, 0x33, 0x85, 0x45, 0xF9, 0x02, 0x7F, 0x50, 0x3C, 0x9F, 0xA8,
3796
+ 0x51, 0xA3, 0x40, 0x8F, 0x92, 0x9D, 0x38, 0xF5, 0xBC, 0xB6, 0xDA, 0x21, 0x10, 0xFF, 0xF3, 0xD2,
3797
+ 0xCD, 0x0C, 0x13, 0xEC, 0x5F, 0x97, 0x44, 0x17, 0xC4, 0xA7, 0x7E, 0x3D, 0x64, 0x5D, 0x19, 0x73,
3798
+ 0x60, 0x81, 0x4F, 0xDC, 0x22, 0x2A, 0x90, 0x88, 0x46, 0xEE, 0xB8, 0x14, 0xDE, 0x5E, 0x0B, 0xDB,
3799
+ 0xE0, 0x32, 0x3A, 0x0A, 0x49, 0x06, 0x24, 0x5C, 0xC2, 0xD3, 0xAC, 0x62, 0x91, 0x95, 0xE4, 0x79,
3800
+ 0xE7, 0xC8, 0x37, 0x6D, 0x8D, 0xD5, 0x4E, 0xA9, 0x6C, 0x56, 0xF4, 0xEA, 0x65, 0x7A, 0xAE, 0x08,
3801
+ 0xBA, 0x78, 0x25, 0x2E, 0x1C, 0xA6, 0xB4, 0xC6, 0xE8, 0xDD, 0x74, 0x1F, 0x4B, 0xBD, 0x8B, 0x8A,
3802
+ 0x70, 0x3E, 0xB5, 0x66, 0x48, 0x03, 0xF6, 0x0E, 0x61, 0x35, 0x57, 0xB9, 0x86, 0xC1, 0x1D, 0x9E,
3803
+ 0xE1, 0xF8, 0x98, 0x11, 0x69, 0xD9, 0x8E, 0x94, 0x9B, 0x1E, 0x87, 0xE9, 0xCE, 0x55, 0x28, 0xDF,
3804
+ 0x8C, 0xA1, 0x89, 0x0D, 0xBF, 0xE6, 0x42, 0x68, 0x41, 0x99, 0x2D, 0x0F, 0xB0, 0x54, 0xBB, 0x16
3805
+ )
3806
+ );
3807
+ }
3808
+ return $tables;
3809
+ }
3810
+
3811
+ /**
3812
+ * Provides the inverse mixColumns and inverse sboxes tables
3813
+ *
3814
+ * @see Crypt_Rijndael:_decryptBlock()
3815
+ * @see Crypt_Rijndael:_setupInlineCrypt()
3816
+ * @see Crypt_Rijndael:_setupKey()
3817
+ * @access private
3818
+ * @return array &$tables
3819
+ */
3820
+ function &_getInvTables()
3821
+ {
3822
+ static $tables;
3823
+ if (empty($tables)) {
3824
+ $dt3 = array_map('intval', array(
3825
+ 0xF4A75051, 0x4165537E, 0x17A4C31A, 0x275E963A, 0xAB6BCB3B, 0x9D45F11F, 0xFA58ABAC, 0xE303934B,
3826
+ 0x30FA5520, 0x766DF6AD, 0xCC769188, 0x024C25F5, 0xE5D7FC4F, 0x2ACBD7C5, 0x35448026, 0x62A38FB5,
3827
+ 0xB15A49DE, 0xBA1B6725, 0xEA0E9845, 0xFEC0E15D, 0x2F7502C3, 0x4CF01281, 0x4697A38D, 0xD3F9C66B,
3828
+ 0x8F5FE703, 0x929C9515, 0x6D7AEBBF, 0x5259DA95, 0xBE832DD4, 0x7421D358, 0xE0692949, 0xC9C8448E,
3829
+ 0xC2896A75, 0x8E7978F4, 0x583E6B99, 0xB971DD27, 0xE14FB6BE, 0x88AD17F0, 0x20AC66C9, 0xCE3AB47D,
3830
+ 0xDF4A1863, 0x1A3182E5, 0x51336097, 0x537F4562, 0x6477E0B1, 0x6BAE84BB, 0x81A01CFE, 0x082B94F9,
3831
+ 0x48685870, 0x45FD198F, 0xDE6C8794, 0x7BF8B752, 0x73D323AB, 0x4B02E272, 0x1F8F57E3, 0x55AB2A66,
3832
+ 0xEB2807B2, 0xB5C2032F, 0xC57B9A86, 0x3708A5D3, 0x2887F230, 0xBFA5B223, 0x036ABA02, 0x16825CED,
3833
+ 0xCF1C2B8A, 0x79B492A7, 0x07F2F0F3, 0x69E2A14E, 0xDAF4CD65, 0x05BED506, 0x34621FD1, 0xA6FE8AC4,
3834
+ 0x2E539D34, 0xF355A0A2, 0x8AE13205, 0xF6EB75A4, 0x83EC390B, 0x60EFAA40, 0x719F065E, 0x6E1051BD,
3835
+ 0x218AF93E, 0xDD063D96, 0x3E05AEDD, 0xE6BD464D, 0x548DB591, 0xC45D0571, 0x06D46F04, 0x5015FF60,
3836
+ 0x98FB2419, 0xBDE997D6, 0x4043CC89, 0xD99E7767, 0xE842BDB0, 0x898B8807, 0x195B38E7, 0xC8EEDB79,
3837
+ 0x7C0A47A1, 0x420FE97C, 0x841EC9F8, 0x00000000, 0x80868309, 0x2BED4832, 0x1170AC1E, 0x5A724E6C,
3838
+ 0x0EFFFBFD, 0x8538560F, 0xAED51E3D, 0x2D392736, 0x0FD9640A, 0x5CA62168, 0x5B54D19B, 0x362E3A24,
3839
+ 0x0A67B10C, 0x57E70F93, 0xEE96D2B4, 0x9B919E1B, 0xC0C54F80, 0xDC20A261, 0x774B695A, 0x121A161C,
3840
+ 0x93BA0AE2, 0xA02AE5C0, 0x22E0433C, 0x1B171D12, 0x090D0B0E, 0x8BC7ADF2, 0xB6A8B92D, 0x1EA9C814,
3841
+ 0xF1198557, 0x75074CAF, 0x99DDBBEE, 0x7F60FDA3, 0x01269FF7, 0x72F5BC5C, 0x663BC544, 0xFB7E345B,
3842
+ 0x4329768B, 0x23C6DCCB, 0xEDFC68B6, 0xE4F163B8, 0x31DCCAD7, 0x63851042, 0x97224013, 0xC6112084,
3843
+ 0x4A247D85, 0xBB3DF8D2, 0xF93211AE, 0x29A16DC7, 0x9E2F4B1D, 0xB230F3DC, 0x8652EC0D, 0xC1E3D077,
3844
+ 0xB3166C2B, 0x70B999A9, 0x9448FA11, 0xE9642247, 0xFC8CC4A8, 0xF03F1AA0, 0x7D2CD856, 0x3390EF22,
3845
+ 0x494EC787, 0x38D1C1D9, 0xCAA2FE8C, 0xD40B3698, 0xF581CFA6, 0x7ADE28A5, 0xB78E26DA, 0xADBFA43F,
3846
+ 0x3A9DE42C, 0x78920D50, 0x5FCC9B6A, 0x7E466254, 0x8D13C2F6, 0xD8B8E890, 0x39F75E2E, 0xC3AFF582,
3847
+ 0x5D80BE9F, 0xD0937C69, 0xD52DA96F, 0x2512B3CF, 0xAC993BC8, 0x187DA710, 0x9C636EE8, 0x3BBB7BDB,
3848
+ 0x267809CD, 0x5918F46E, 0x9AB701EC, 0x4F9AA883, 0x956E65E6, 0xFFE67EAA, 0xBCCF0821, 0x15E8E6EF,
3849
+ 0xE79BD9BA, 0x6F36CE4A, 0x9F09D4EA, 0xB07CD629, 0xA4B2AF31, 0x3F23312A, 0xA59430C6, 0xA266C035,
3850
+ 0x4EBC3774, 0x82CAA6FC, 0x90D0B0E0, 0xA7D81533, 0x04984AF1, 0xECDAF741, 0xCD500E7F, 0x91F62F17,
3851
+ 0x4DD68D76, 0xEFB04D43, 0xAA4D54CC, 0x9604DFE4, 0xD1B5E39E, 0x6A881B4C, 0x2C1FB8C1, 0x65517F46,
3852
+ 0x5EEA049D, 0x8C355D01, 0x877473FA, 0x0B412EFB, 0x671D5AB3, 0xDBD25292, 0x105633E9, 0xD647136D,
3853
+ 0xD7618C9A, 0xA10C7A37, 0xF8148E59, 0x133C89EB, 0xA927EECE, 0x61C935B7, 0x1CE5EDE1, 0x47B13C7A,
3854
+ 0xD2DF599C, 0xF2733F55, 0x14CE7918, 0xC737BF73, 0xF7CDEA53, 0xFDAA5B5F, 0x3D6F14DF, 0x44DB8678,
3855
+ 0xAFF381CA, 0x68C43EB9, 0x24342C38, 0xA3405FC2, 0x1DC37216, 0xE2250CBC, 0x3C498B28, 0x0D9541FF,
3856
+ 0xA8017139, 0x0CB3DE08, 0xB4E49CD8, 0x56C19064, 0xCB84617B, 0x32B670D5, 0x6C5C7448, 0xB85742D0
3857
+ ));
3858
+
3859
+ foreach ($dt3 as $dt3i) {
3860
+ $dt0[] = (($dt3i << 24) & 0xFF000000) | (($dt3i >> 8) & 0x00FFFFFF);
3861
+ $dt1[] = (($dt3i << 16) & 0xFFFF0000) | (($dt3i >> 16) & 0x0000FFFF);
3862
+ $dt2[] = (($dt3i << 8) & 0xFFFFFF00) | (($dt3i >> 24) & 0x000000FF);
3863
+ };
3864
+
3865
+ $tables = array(
3866
+ // The Precomputed inverse mixColumns tables dt0 - dt3
3867
+ $dt0,
3868
+ $dt1,
3869
+ $dt2,
3870
+ $dt3,
3871
+ // The inverse SubByte S-Box
3872
+ array(
3873
+ 0x52, 0x09, 0x6A, 0xD5, 0x30, 0x36, 0xA5, 0x38, 0xBF, 0x40, 0xA3, 0x9E, 0x81, 0xF3, 0xD7, 0xFB,
3874
+ 0x7C, 0xE3, 0x39, 0x82, 0x9B, 0x2F, 0xFF, 0x87, 0x34, 0x8E, 0x43, 0x44, 0xC4, 0xDE, 0xE9, 0xCB,
3875
+ 0x54, 0x7B, 0x94, 0x32, 0xA6, 0xC2, 0x23, 0x3D, 0xEE, 0x4C, 0x95, 0x0B, 0x42, 0xFA, 0xC3, 0x4E,
3876
+ 0x08, 0x2E, 0xA1, 0x66, 0x28, 0xD9, 0x24, 0xB2, 0x76, 0x5B, 0xA2, 0x49, 0x6D, 0x8B, 0xD1, 0x25,
3877
+ 0x72, 0xF8, 0xF6, 0x64, 0x86, 0x68, 0x98, 0x16, 0xD4, 0xA4, 0x5C, 0xCC, 0x5D, 0x65, 0xB6, 0x92,
3878
+ 0x6C, 0x70, 0x48, 0x50, 0xFD, 0xED, 0xB9, 0xDA, 0x5E, 0x15, 0x46, 0x57, 0xA7, 0x8D, 0x9D, 0x84,
3879
+ 0x90, 0xD8, 0xAB, 0x00, 0x8C, 0xBC, 0xD3, 0x0A, 0xF7, 0xE4, 0x58, 0x05, 0xB8, 0xB3, 0x45, 0x06,
3880
+ 0xD0, 0x2C, 0x1E, 0x8F, 0xCA, 0x3F, 0x0F, 0x02, 0xC1, 0xAF, 0xBD, 0x03, 0x01, 0x13, 0x8A, 0x6B,
3881
+ 0x3A, 0x91, 0x11, 0x41, 0x4F, 0x67, 0xDC, 0xEA, 0x97, 0xF2, 0xCF, 0xCE, 0xF0, 0xB4, 0xE6, 0x73,
3882
+ 0x96, 0xAC, 0x74, 0x22, 0xE7, 0xAD, 0x35, 0x85, 0xE2, 0xF9, 0x37, 0xE8, 0x1C, 0x75, 0xDF, 0x6E,
3883
+ 0x47, 0xF1, 0x1A, 0x71, 0x1D, 0x29, 0xC5, 0x89, 0x6F, 0xB7, 0x62, 0x0E, 0xAA, 0x18, 0xBE, 0x1B,
3884
+ 0xFC, 0x56, 0x3E, 0x4B, 0xC6, 0xD2, 0x79, 0x20, 0x9A, 0xDB, 0xC0, 0xFE, 0x78, 0xCD, 0x5A, 0xF4,
3885
+ 0x1F, 0xDD, 0xA8, 0x33, 0x88, 0x07, 0xC7, 0x31, 0xB1, 0x12, 0x10, 0x59, 0x27, 0x80, 0xEC, 0x5F,
3886
+ 0x60, 0x51, 0x7F, 0xA9, 0x19, 0xB5, 0x4A, 0x0D, 0x2D, 0xE5, 0x7A, 0x9F, 0x93, 0xC9, 0x9C, 0xEF,
3887
+ 0xA0, 0xE0, 0x3B, 0x4D, 0xAE, 0x2A, 0xF5, 0xB0, 0xC8, 0xEB, 0xBB, 0x3C, 0x83, 0x53, 0x99, 0x61,
3888
+ 0x17, 0x2B, 0x04, 0x7E, 0xBA, 0x77, 0xD6, 0x26, 0xE1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0C, 0x7D
3889
+ )
3890
+ );
3891
+ }
3892
+ return $tables;
3893
+ }
3894
+
3895
+ /**
3896
+ * Setup the performance-optimized function for de/encrypt()
3897
+ *
3898
+ * @see Crypt_Base::_setupInlineCrypt()
3899
+ * @access private
3900
+ */
3901
+ function _setupInlineCrypt()
3902
+ {
3903
+ // Note: _setupInlineCrypt() will be called only if $this->changed === true
3904
+ // So here we are'nt under the same heavy timing-stress as we are in _de/encryptBlock() or de/encrypt().
3905
+ // However...the here generated function- $code, stored as php callback in $this->inline_crypt, must work as fast as even possible.
3906
+
3907
+ $lambda_functions =& Crypt_Rijndael::_getLambdaFunctions();
3908
+
3909
+ // We create max. 10 hi-optimized code for memory reason. Means: For each $key one ultra fast inline-crypt function.
3910
+ // (Currently, for Crypt_Rijndael/AES, one generated $lambda_function cost on php5.5@32bit ~80kb unfreeable mem and ~130kb on php5.5@64bit)
3911
+ // After that, we'll still create very fast optimized code but not the hi-ultimative code, for each $mode one.
3912
+ $gen_hi_opt_code = (bool)(count($lambda_functions) < 10);
3913
+
3914
+ // Generation of a uniqe hash for our generated code
3915
+ $code_hash = "Crypt_Rijndael, {$this->mode}, {$this->Nr}, {$this->Nb}";
3916
+ if ($gen_hi_opt_code) {
3917
+ $code_hash = str_pad($code_hash, 32) . $this->_hashInlineCryptFunction($this->key);
3918
+ }
3919
+
3920
+ if (!isset($lambda_functions[$code_hash])) {
3921
+ switch (true) {
3922
+ case $gen_hi_opt_code:
3923
+ // The hi-optimized $lambda_functions will use the key-words hardcoded for better performance.
3924
+ $w = $this->w;
3925
+ $dw = $this->dw;
3926
+ $init_encrypt = '';
3927
+ $init_decrypt = '';
3928
+ break;
3929
+ default:
3930
+ for ($i = 0, $cw = count($this->w); $i < $cw; ++$i) {
3931
+ $w[] = '$w[' . $i . ']';
3932
+ $dw[] = '$dw[' . $i . ']';
3933
+ }
3934
+ $init_encrypt = '$w = $self->w;';
3935
+ $init_decrypt = '$dw = $self->dw;';
3936
+ }
3937
+
3938
+ $Nr = $this->Nr;
3939
+ $Nb = $this->Nb;
3940
+ $c = $this->c;
3941
+
3942
+ // Generating encrypt code:
3943
+ $init_encrypt.= '
3944
+ static $tables;
3945
+ if (empty($tables)) {
3946
+ $tables = &$self->_getTables();
3947
+ }
3948
+ $t0 = $tables[0];
3949
+ $t1 = $tables[1];
3950
+ $t2 = $tables[2];
3951
+ $t3 = $tables[3];
3952
+ $sbox = $tables[4];
3953
+ ';
3954
+
3955
+ $s = 'e';
3956
+ $e = 's';
3957
+ $wc = $Nb - 1;
3958
+
3959
+ // Preround: addRoundKey
3960
+ $encrypt_block = '$in = unpack("N*", $in);'."\n";
3961
+ for ($i = 0; $i < $Nb; ++$i) {
3962
+ $encrypt_block .= '$s'.$i.' = $in['.($i + 1).'] ^ '.$w[++$wc].";\n";
3963
+ }
3964
+
3965
+ // Mainrounds: shiftRows + subWord + mixColumns + addRoundKey
3966
+ for ($round = 1; $round < $Nr; ++$round) {
3967
+ list($s, $e) = array($e, $s);
3968
+ for ($i = 0; $i < $Nb; ++$i) {
3969
+ $encrypt_block.=
3970
+ '$'.$e.$i.' =
3971
+ $t0[($'.$s.$i .' >> 24) & 0xff] ^
3972
+ $t1[($'.$s.(($i + $c[1]) % $Nb).' >> 16) & 0xff] ^
3973
+ $t2[($'.$s.(($i + $c[2]) % $Nb).' >> 8) & 0xff] ^
3974
+ $t3[ $'.$s.(($i + $c[3]) % $Nb).' & 0xff] ^
3975
+ '.$w[++$wc].";\n";
3976
+ }
3977
+ }
3978
+
3979
+ // Finalround: subWord + shiftRows + addRoundKey
3980
+ for ($i = 0; $i < $Nb; ++$i) {
3981
+ $encrypt_block.=
3982
+ '$'.$e.$i.' =
3983
+ $sbox[ $'.$e.$i.' & 0xff] |
3984
+ ($sbox[($'.$e.$i.' >> 8) & 0xff] << 8) |
3985
+ ($sbox[($'.$e.$i.' >> 16) & 0xff] << 16) |
3986
+ ($sbox[($'.$e.$i.' >> 24) & 0xff] << 24);'."\n";
3987
+ }
3988
+ $encrypt_block .= '$in = pack("N*"'."\n";
3989
+ for ($i = 0; $i < $Nb; ++$i) {
3990
+ $encrypt_block.= ',
3991
+ ($'.$e.$i .' & '.((int)0xFF000000).') ^
3992
+ ($'.$e.(($i + $c[1]) % $Nb).' & 0x00FF0000 ) ^
3993
+ ($'.$e.(($i + $c[2]) % $Nb).' & 0x0000FF00 ) ^
3994
+ ($'.$e.(($i + $c[3]) % $Nb).' & 0x000000FF ) ^
3995
+ '.$w[$i]."\n";
3996
+ }
3997
+ $encrypt_block .= ');';
3998
+
3999
+ // Generating decrypt code:
4000
+ $init_decrypt.= '
4001
+ static $invtables;
4002
+ if (empty($invtables)) {
4003
+ $invtables = &$self->_getInvTables();
4004
+ }
4005
+ $dt0 = $invtables[0];
4006
+ $dt1 = $invtables[1];
4007
+ $dt2 = $invtables[2];
4008
+ $dt3 = $invtables[3];
4009
+ $isbox = $invtables[4];
4010
+ ';
4011
+
4012
+ $s = 'e';
4013
+ $e = 's';
4014
+ $wc = $Nb - 1;
4015
+
4016
+ // Preround: addRoundKey
4017
+ $decrypt_block = '$in = unpack("N*", $in);'."\n";
4018
+ for ($i = 0; $i < $Nb; ++$i) {
4019
+ $decrypt_block .= '$s'.$i.' = $in['.($i + 1).'] ^ '.$dw[++$wc].';'."\n";
4020
+ }
4021
+
4022
+ // Mainrounds: shiftRows + subWord + mixColumns + addRoundKey
4023
+ for ($round = 1; $round < $Nr; ++$round) {
4024
+ list($s, $e) = array($e, $s);
4025
+ for ($i = 0; $i < $Nb; ++$i) {
4026
+ $decrypt_block.=
4027
+ '$'.$e.$i.' =
4028
+ $dt0[($'.$s.$i .' >> 24) & 0xff] ^
4029
+ $dt1[($'.$s.(($Nb + $i - $c[1]) % $Nb).' >> 16) & 0xff] ^
4030
+ $dt2[($'.$s.(($Nb + $i - $c[2]) % $Nb).' >> 8) & 0xff] ^
4031
+ $dt3[ $'.$s.(($Nb + $i - $c[3]) % $Nb).' & 0xff] ^
4032
+ '.$dw[++$wc].";\n";
4033
+ }
4034
+ }
4035
+
4036
+ // Finalround: subWord + shiftRows + addRoundKey
4037
+ for ($i = 0; $i < $Nb; ++$i) {
4038
+ $decrypt_block.=
4039
+ '$'.$e.$i.' =
4040
+ $isbox[ $'.$e.$i.' & 0xff] |
4041
+ ($isbox[($'.$e.$i.' >> 8) & 0xff] << 8) |
4042
+ ($isbox[($'.$e.$i.' >> 16) & 0xff] << 16) |
4043
+ ($isbox[($'.$e.$i.' >> 24) & 0xff] << 24);'."\n";
4044
+ }
4045
+ $decrypt_block .= '$in = pack("N*"'."\n";
4046
+ for ($i = 0; $i < $Nb; ++$i) {
4047
+ $decrypt_block.= ',
4048
+ ($'.$e.$i. ' & '.((int)0xFF000000).') ^
4049
+ ($'.$e.(($Nb + $i - $c[1]) % $Nb).' & 0x00FF0000 ) ^
4050
+ ($'.$e.(($Nb + $i - $c[2]) % $Nb).' & 0x0000FF00 ) ^
4051
+ ($'.$e.(($Nb + $i - $c[3]) % $Nb).' & 0x000000FF ) ^
4052
+ '.$dw[$i]."\n";
4053
+ }
4054
+ $decrypt_block .= ');';
4055
+
4056
+ $lambda_functions[$code_hash] = $this->_createInlineCryptFunction(
4057
+ array(
4058
+ 'init_crypt' => '',
4059
+ 'init_encrypt' => $init_encrypt,
4060
+ 'init_decrypt' => $init_decrypt,
4061
+ 'encrypt_block' => $encrypt_block,
4062
+ 'decrypt_block' => $decrypt_block
4063
+ )
4064
+ );
4065
+ }
4066
+ $this->inline_crypt = $lambda_functions[$code_hash];
4067
+ }
4068
+ }
4069
+
4070
+
4071
  class DUPX_CSRF {
4072
 
4073
  /** Session var name
4100
  return true;
4101
  }
4102
  if (isset($_COOKIE[DUPX_CSRF::$prefix . '_' . $form]) && $_COOKIE[DUPX_CSRF::$prefix . '_' . $form] == $token) { // token OK
4103
+ return true;
4104
+ // return (substr($token, -32) == DUPX_CSRF::fingerprint()); // fingerprint OK?
4105
  }
4106
  return FALSE;
4107
  }
4126
 
4127
  public static function setCookie($cookieName, $cookieVal) {
4128
  $_COOKIE[$cookieName] = $cookieVal;
4129
+ $domainPath = self::getDomainPath();
4130
  return setcookie($cookieName, $cookieVal, time() + 10800, '/');
4131
  }
4132
+
4133
+ public static function getDomainPath() {
4134
+ return '/';
4135
+ // return str_replace('main.installer.php', '', $_SERVER['SCRIPT_NAME']);
4136
+ }
4137
 
4138
  /**
4139
  * @return bool
4146
  foreach ($_COOKIE as $cookieName => $cookieVal) {
4147
  $step1Key = DUPX_CSRF::$prefix . '_step1';
4148
  if ($step1Key != $cookieName && (0 === strpos($cookieName, DUPX_CSRF::$prefix) || 'archive' == $cookieName || 'bootloader' == $cookieName)) {
4149
+ // $domainPath = self::getDomainPath();
4150
  setcookie($cookieName, '', time() - 86400, '/');
4151
  unset($_COOKIE[$cookieName]);
4152
  }
4189
  const ARCHIVE_SIZE = '@@ARCHIVE_SIZE@@';
4190
  const INSTALLER_DIR_NAME = 'dup-installer';
4191
  const PACKAGE_HASH = '@@PACKAGE_HASH@@';
4192
+ const CSRF_CRYPT = @@CSRF_CRYPT@@;
4193
  const VERSION = '@@VERSION@@';
4194
 
4195
  public $hasZipArchive = false;
4481
  self::log('Server: Nginx');
4482
  }
4483
 
4484
+ if (($is_apache && function_exists('apache_get_modules') && in_array('mod_rewrite', apache_get_modules())) || $is_nginx) {
4485
  $htaccess_data = array();
4486
  foreach ($php_ini_data as $php_ini_key=>$php_ini_val) {
4487
  if ($is_apache) {
languages/duplicator.pot ADDED
@@ -0,0 +1,3362 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (C) 2019 Snap Creek
2
+ # This file is distributed under the same license as the Duplicator plugin.
3
+ msgid ""
4
+ msgstr ""
5
+ "Project-Id-Version: Duplicator 1.3.7\n"
6
+ "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/duplicator\n"
7
+ "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
8
+ "Language-Team: LANGUAGE <LL@li.org>\n"
9
+ "MIME-Version: 1.0\n"
10
+ "Content-Type: text/plain; charset=UTF-8\n"
11
+ "Content-Transfer-Encoding: 8bit\n"
12
+ "POT-Creation-Date: 2019-02-22T13:15:44+01:00\n"
13
+ "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
14
+ "X-Generator: WP-CLI 2.1.0\n"
15
+
16
+ #. Plugin Name of the plugin
17
+ msgid "Duplicator"
18
+ msgstr ""
19
+
20
+ #. Plugin URI of the plugin
21
+ msgid "https://snapcreek.com/duplicator/duplicator-free/"
22
+ msgstr ""
23
+
24
+ #. Description of the plugin
25
+ msgid "Migrate and backup a copy of your WordPress files and database. Duplicate and move a site from one location to another quickly."
26
+ msgstr ""
27
+
28
+ #. Author of the plugin
29
+ msgid "Snap Creek"
30
+ msgstr ""
31
+
32
+ #. Author URI of the plugin
33
+ msgid "http://www.snapcreek.com/duplicator/"
34
+ msgstr ""
35
+
36
+ #: classes/class.logging.php:97
37
+ msgid "No Log"
38
+ msgstr ""
39
+
40
+ #: classes/class.server.php:206
41
+ msgid "(directory)"
42
+ msgstr ""
43
+
44
+ #: classes/package/class.pack.installer.php:89
45
+ msgid "Error reading DupArchive mini expander"
46
+ msgstr ""
47
+
48
+ #: classes/package/class.pack.installer.php:102
49
+ msgid "Error writing installer contents"
50
+ msgstr ""
51
+
52
+ #: classes/package/class.pack.php:308
53
+ msgid "Package name can't be empty"
54
+ msgstr ""
55
+
56
+ #: classes/package/class.pack.php:314
57
+ msgid "Directories: <b>%1$s</b> isn't a valid path"
58
+ msgstr ""
59
+
60
+ #: classes/package/class.pack.php:320
61
+ msgid "File extension: <b>%1$s</b> isn't a valid extension"
62
+ msgstr ""
63
+
64
+ #: classes/package/class.pack.php:326
65
+ msgid "Files: <b>%1$s</b> isn't a valid file name"
66
+ msgstr ""
67
+
68
+ #: classes/package/class.pack.php:334
69
+ msgid "MySQL Server Host: <b>%1$s</b> isn't a valid host"
70
+ msgstr ""
71
+
72
+ #: classes/package/class.pack.php:345
73
+ msgid "MySQL Server Port: <b>%1$s</b> isn't a valid port"
74
+ msgstr ""
75
+
76
+ #: classes/package/class.pack.php:684
77
+ msgid "Can't find Scanfile %s. Please ensure there no non-English characters in the package or schedule name."
78
+ msgstr ""
79
+
80
+ #: classes/package/class.pack.php:708
81
+ msgid "EXPECTED FILE/DIRECTORY COUNT: %1$s"
82
+ msgstr ""
83
+
84
+ #: classes/package/class.pack.php:709
85
+ msgid "ACTUAL FILE/DIRECTORY COUNT: %1$s"
86
+ msgstr ""
87
+
88
+ #: classes/package/class.pack.php:754
89
+ msgid "ERROR: Cannot open created archive. Error code = %1$s"
90
+ msgstr ""
91
+
92
+ #: classes/package/class.pack.php:759
93
+ msgid "ERROR: Archive is not valid zip archive."
94
+ msgstr ""
95
+
96
+ #: classes/package/class.pack.php:763
97
+ msgid "ERROR: Archive doesn't pass consistency check."
98
+ msgstr ""
99
+
100
+ #: classes/package/class.pack.php:768
101
+ msgid "ERROR: Archive checksum is bad."
102
+ msgstr ""
103
+
104
+ #: classes/package/class.pack.php:779
105
+ msgid "ARCHIVE CONSISTENCY TEST: Pass"
106
+ msgstr ""
107
+
108
+ #: classes/package/duparchive/class.pack.archive.duparchive.php:46
109
+ msgid "Package build appears stuck so marking package as failed. Is the Max Worker Time set too high?."
110
+ msgstr ""
111
+
112
+ #: classes/package/duparchive/class.pack.archive.duparchive.php:47
113
+ msgid "Build Failure"
114
+ msgstr ""
115
+
116
+ #: classes/package/duparchive/class.pack.archive.duparchive.php:85
117
+ msgid "Click on \"Resolve This\" button to fix the JSON settings."
118
+ msgstr ""
119
+
120
+ #: classes/package/duparchive/class.pack.archive.duparchive.php:97
121
+ msgid "ERROR: Can't find Scanfile %s. Please ensure there no non-English characters in the package or schedule name."
122
+ msgstr ""
123
+
124
+ #: classes/package/duparchive/class.pack.archive.duparchive.php:216
125
+ msgid "Problem adding items to archive."
126
+ msgstr ""
127
+
128
+ #: classes/package/duparchive/class.pack.archive.duparchive.php:218
129
+ msgid "Problems adding items to archive."
130
+ msgstr ""
131
+
132
+ #: classes/package/duparchive/class.pack.archive.duparchive.php:316
133
+ msgid "Critical failure present in validation"
134
+ msgstr ""
135
+
136
+ #: classes/ui/class.ui.dialog.php:94
137
+ msgid "Processing please wait..."
138
+ msgstr ""
139
+
140
+ #: classes/ui/class.ui.dialog.php:97
141
+ msgid "OK"
142
+ msgstr ""
143
+
144
+ #: classes/ui/class.ui.dialog.php:98
145
+ msgid "Cancel"
146
+ msgstr ""
147
+
148
+ #: classes/ui/class.ui.notice.php:46
149
+ msgid "Safe Mode:"
150
+ msgstr ""
151
+
152
+ #: classes/ui/class.ui.notice.php:47
153
+ msgid "During the install safe mode was enabled deactivating all plugins.<br/> Please be sure to "
154
+ msgstr ""
155
+
156
+ #: classes/ui/class.ui.notice.php:48
157
+ msgid "re-activate the plugins"
158
+ msgstr ""
159
+
160
+ #: classes/ui/class.ui.notice.php:55
161
+ #: views/tools/diagnostics/information.php:157
162
+ msgid "This site has been successfully migrated!"
163
+ msgstr ""
164
+
165
+ #: classes/ui/class.ui.notice.php:56
166
+ msgid "Final step(s):"
167
+ msgstr ""
168
+
169
+ #: classes/ui/class.ui.notice.php:57
170
+ msgid "This message will be removed after all installer files are removed. Installer files must be removed to maintain a secure site. Click the link above or button below to remove all installer files and complete the migration."
171
+ msgstr ""
172
+
173
+ #: classes/ui/class.ui.notice.php:61
174
+ msgid "Remove Installation Files Now!"
175
+ msgstr ""
176
+
177
+ #: classes/ui/class.ui.notice.php:62
178
+ msgid "Optionally, Review Duplicator at WordPress.org..."
179
+ msgstr ""
180
+
181
+ #: classes/ui/class.ui.notice.php:68
182
+ msgid "Migration Almost Complete!"
183
+ msgstr ""
184
+
185
+ #: classes/ui/class.ui.notice.php:69
186
+ msgid "Reserved Duplicator installation files have been detected in the root directory. Please delete these installation files to avoid security issues. <br/> Go to:Duplicator > Tools > Information >Stored Data and click the \"Remove Installation Files\" button"
187
+ msgstr ""
188
+
189
+ #: classes/ui/class.ui.notice.php:75
190
+ msgid "Take me there now!"
191
+ msgstr ""
192
+
193
+ #: classes/ui/class.ui.notice.php:90
194
+ msgid "Redirecting Please Wait..."
195
+ msgstr ""
196
+
197
+ #: classes/ui/class.ui.notice.php:93
198
+ msgid "Invalid token permissions to perform this request."
199
+ msgstr ""
200
+
201
+ #: classes/ui/class.ui.screen.base.php:43
202
+ msgid "<b>Need Help?</b> Please check out these resources first:<ul>"
203
+ msgstr ""
204
+
205
+ #: classes/ui/class.ui.screen.base.php:51
206
+ #: views/tools/diagnostics/main.php:42
207
+ msgid "Support"
208
+ msgstr ""
209
+
210
+ #: classes/ui/class.ui.screen.base.php:64
211
+ msgid "Resources"
212
+ msgstr ""
213
+
214
+ #: classes/ui/class.ui.screen.base.php:65
215
+ msgid "Knowledge Base"
216
+ msgstr ""
217
+
218
+ #: classes/ui/class.ui.screen.base.php:66
219
+ msgid "Full User Guide"
220
+ msgstr ""
221
+
222
+ #: classes/ui/class.ui.screen.base.php:67
223
+ msgid "Technical FAQs"
224
+ msgstr ""
225
+
226
+ #: classes/ui/class.ui.screen.base.php:68
227
+ msgid "Package Settings"
228
+ msgstr ""
229
+
230
+ #: classes/utilities/class.u.json.php:87
231
+ msgid "One or more filenames isn't compatible with JSON encoding"
232
+ msgstr ""
233
+
234
+ #: classes/utilities/class.u.php:63
235
+ msgid "32-bit"
236
+ msgstr ""
237
+
238
+ #: classes/utilities/class.u.php:66
239
+ msgid "64-bit"
240
+ msgstr ""
241
+
242
+ #: classes/utilities/class.u.php:69
243
+ msgid "Unknown"
244
+ msgstr ""
245
+
246
+ #: classes/utilities/class.u.php:479
247
+ msgid "You do not have sufficient permissions to access this page."
248
+ msgstr ""
249
+
250
+ #: ctrls/ctrl.package.php:164
251
+ msgid "Error building DupArchive package"
252
+ msgstr ""
253
+
254
+ #: ctrls/ctrl.package.php:301
255
+ msgid "An unathorized security request was made to this page. Please try again!"
256
+ msgstr ""
257
+
258
+ #: ctrls/ctrl.package.php:310
259
+ msgid "Active package object error"
260
+ msgstr ""
261
+
262
+ #: ctrls/ctrl.package.php:473
263
+ #: ctrls/ctrl.package.php:491
264
+ msgid "Couldn't find a local copy of the file requested."
265
+ msgstr ""
266
+
267
+ #: duplicator.php:350
268
+ #: views/packages/details/controller.php:47
269
+ #: views/packages/main/packages.php:86
270
+ #: views/packages/main/s1.setup1.php:71
271
+ #: views/packages/main/s2.scan1.php:184
272
+ #: views/packages/main/s3.build.php:91
273
+ #: views/settings/controller.php:22
274
+ msgid "Packages"
275
+ msgstr ""
276
+
277
+ #: duplicator.php:356
278
+ #: views/tools/controller.php:14
279
+ msgid "Tools"
280
+ msgstr ""
281
+
282
+ #: duplicator.php:361
283
+ #: views/packages/main/packages.php:83
284
+ #: views/settings/controller.php:18
285
+ #: views/settings/general.php:170
286
+ msgid "Settings"
287
+ msgstr ""
288
+
289
+ #: duplicator.php:365
290
+ msgid "Go Pro!"
291
+ msgstr ""
292
+
293
+ #: duplicator.php:433
294
+ #: views/settings/license.php:6
295
+ msgid "Manage"
296
+ msgstr ""
297
+
298
+ #: duplicator.php:450
299
+ #: views/packages/main/packages.php:80
300
+ msgid "Get Help"
301
+ msgstr ""
302
+
303
+ #: duplicator.php:450
304
+ msgid "Go Pro"
305
+ msgstr ""
306
+
307
+ #: views/packages/details/controller.php:12
308
+ msgid "package log"
309
+ msgstr ""
310
+
311
+ #: views/packages/details/controller.php:13
312
+ msgid "FAQ"
313
+ msgstr ""
314
+
315
+ #: views/packages/details/controller.php:14
316
+ msgid "resources page"
317
+ msgstr ""
318
+
319
+ #: views/packages/details/controller.php:33
320
+ msgid "This package contains an error. Please review the "
321
+ msgstr ""
322
+
323
+ #: views/packages/details/controller.php:33
324
+ msgid " for details."
325
+ msgstr ""
326
+
327
+ #: views/packages/details/controller.php:34
328
+ msgid "For help visit the "
329
+ msgstr ""
330
+
331
+ #: views/packages/details/controller.php:34
332
+ msgid " and "
333
+ msgstr ""
334
+
335
+ #: views/packages/details/controller.php:41
336
+ msgid "Details"
337
+ msgstr ""
338
+
339
+ #: views/packages/details/controller.php:44
340
+ msgid "Transfer"
341
+ msgstr ""
342
+
343
+ #: views/packages/details/detail.php:62
344
+ msgid "Invalid Package ID request. Please try again!"
345
+ msgstr ""
346
+
347
+ #: views/packages/details/detail.php:74
348
+ #: views/settings/controller.php:21
349
+ #: views/tools/diagnostics/inc.settings.php:28
350
+ msgid "General"
351
+ msgstr ""
352
+
353
+ #: views/packages/details/detail.php:80
354
+ #: views/packages/details/detail.php:183
355
+ #: views/packages/main/packages.php:136
356
+ #: views/packages/main/s1.setup2.php:70
357
+ #: views/packages/main/s1.setup2.php:96
358
+ #: views/packages/main/s2.scan3.php:499
359
+ #: views/packages/main/s3.build.php:123
360
+ msgid "Name"
361
+ msgstr ""
362
+
363
+ #: views/packages/details/detail.php:84
364
+ msgid "ID"
365
+ msgstr ""
366
+
367
+ #: views/packages/details/detail.php:85
368
+ msgid "Hash"
369
+ msgstr ""
370
+
371
+ #: views/packages/details/detail.php:86
372
+ msgid "Full Name"
373
+ msgstr ""
374
+
375
+ #: views/packages/details/detail.php:91
376
+ #: views/packages/main/s1.setup2.php:79
377
+ #: views/packages/main/s2.scan3.php:500
378
+ msgid "Notes"
379
+ msgstr ""
380
+
381
+ #: views/packages/details/detail.php:92
382
+ msgid "- no notes -"
383
+ msgstr ""
384
+
385
+ #: views/packages/details/detail.php:95
386
+ msgid "Versions"
387
+ msgstr ""
388
+
389
+ #: views/packages/details/detail.php:99
390
+ #: views/packages/main/s2.scan2.php:103
391
+ msgid "WordPress"
392
+ msgstr ""
393
+
394
+ #: views/packages/details/detail.php:99
395
+ #: views/packages/details/detail.php:100
396
+ #: views/packages/details/detail.php:102
397
+ #: views/packages/details/detail.php:103
398
+ #: views/packages/details/detail.php:117
399
+ msgid "- unknown -"
400
+ msgstr ""
401
+
402
+ #: views/packages/details/detail.php:100
403
+ msgid "PHP"
404
+ msgstr ""
405
+
406
+ #: views/packages/details/detail.php:101
407
+ msgid "Mysql"
408
+ msgstr ""
409
+
410
+ #: views/packages/details/detail.php:108
411
+ msgid "Runtime"
412
+ msgstr ""
413
+
414
+ #: views/packages/details/detail.php:109
415
+ msgid "error running"
416
+ msgstr ""
417
+
418
+ #: views/packages/details/detail.php:112
419
+ msgid "Status"
420
+ msgstr ""
421
+
422
+ #: views/packages/details/detail.php:113
423
+ msgid "completed"
424
+ msgstr ""
425
+
426
+ #: views/packages/details/detail.php:113
427
+ msgid "in-complete"
428
+ msgstr ""
429
+
430
+ #: views/packages/details/detail.php:116
431
+ #: views/packages/details/detail.php:365
432
+ #: views/packages/main/s1.setup2.php:469
433
+ #: views/tools/diagnostics/inc.settings.php:108
434
+ msgid "User"
435
+ msgstr ""
436
+
437
+ #: views/packages/details/detail.php:120
438
+ #: views/packages/details/detail.php:268
439
+ #: views/packages/main/s1.setup2.php:155
440
+ #: views/packages/main/s2.scan3.php:26
441
+ #: views/packages/main/s2.scan3.php:556
442
+ #: views/packages/main/s2.scan3.php:608
443
+ msgid "Files"
444
+ msgstr ""
445
+
446
+ #: views/packages/details/detail.php:128
447
+ msgid "Log"
448
+ msgstr ""
449
+
450
+ #: views/packages/details/detail.php:129
451
+ msgid "Share"
452
+ msgstr ""
453
+
454
+ #: views/packages/details/detail.php:137
455
+ #: views/packages/details/detail.php:225
456
+ #: views/packages/main/packages.php:242
457
+ #: views/packages/main/s1.setup2.php:139
458
+ #: views/packages/main/s2.scan3.php:19
459
+ #: views/packages/main/s3.build.php:136
460
+ #: views/settings/packages.php:204
461
+ msgid "Archive"
462
+ msgstr ""
463
+
464
+ #: views/packages/details/detail.php:141
465
+ #: views/packages/details/detail.php:324
466
+ #: views/packages/main/packages.php:239
467
+ #: views/packages/main/s1.setup2.php:378
468
+ #: views/packages/main/s3.build.php:133
469
+ msgid "Installer"
470
+ msgstr ""
471
+
472
+ #: views/packages/details/detail.php:145
473
+ #: views/packages/details/detail.php:361
474
+ #: views/packages/main/s1.setup2.php:156
475
+ #: views/packages/main/s1.setup2.php:465
476
+ #: views/packages/main/s2.scan3.php:335
477
+ #: views/packages/main/s2.scan3.php:505
478
+ #: views/settings/packages.php:70
479
+ msgid "Database"
480
+ msgstr ""
481
+
482
+ #: views/packages/details/detail.php:159
483
+ msgid "Download Links"
484
+ msgstr ""
485
+
486
+ #: views/packages/details/detail.php:162
487
+ msgid "The following links contain sensitive data. Please share with caution!"
488
+ msgstr ""
489
+
490
+ #: views/packages/details/detail.php:168
491
+ msgid "The database SQL script is a quick link to your database backup script. An exact copy is also stored in the package."
492
+ msgstr ""
493
+
494
+ #: views/packages/details/detail.php:176
495
+ #: views/packages/main/s1.setup2.php:89
496
+ #: views/settings/controller.php:24
497
+ #: views/settings/general.php:101
498
+ msgid "Storage"
499
+ msgstr ""
500
+
501
+ #: views/packages/details/detail.php:184
502
+ #: views/packages/details/detail.php:285
503
+ #: views/packages/main/s1.setup2.php:97
504
+ #: views/settings/license.php:10
505
+ msgid "Type"
506
+ msgstr ""
507
+
508
+ #: views/packages/details/detail.php:185
509
+ #: views/packages/main/s1.setup2.php:98
510
+ msgid "Location"
511
+ msgstr ""
512
+
513
+ #: views/packages/details/detail.php:190
514
+ #: views/packages/main/s1.setup2.php:103
515
+ msgid "Default"
516
+ msgstr ""
517
+
518
+ #: views/packages/details/detail.php:191
519
+ #: views/packages/main/s1.setup2.php:104
520
+ msgid "Local"
521
+ msgstr ""
522
+
523
+ #: views/packages/details/detail.php:202
524
+ #: views/packages/main/s1.setup2.php:116
525
+ msgid "%1$s, %2$s, %3$s, %4$s, %5$s and other storage options available in"
526
+ msgstr ""
527
+
528
+ #: views/packages/details/detail.php:203
529
+ #: views/packages/main/s1.setup2.php:117
530
+ #: views/packages/main/s2.scan3.php:455
531
+ #: views/packages/main/s2.scan3.php:467
532
+ #: views/packages/main/s3.build.php:19
533
+ msgid "Duplicator Pro"
534
+ msgstr ""
535
+
536
+ #: views/packages/details/detail.php:205
537
+ #: views/packages/main/s1.setup2.php:119
538
+ msgid "Additional Storage:"
539
+ msgstr ""
540
+
541
+ #: views/packages/details/detail.php:206
542
+ #: views/packages/main/s1.setup2.php:120
543
+ msgid "Duplicator Pro allows you to create a package and then store it at a custom location on this server or to a cloud based location such as Google Drive, Amazon, Dropbox or FTP."
544
+ msgstr ""
545
+
546
+ #: views/packages/details/detail.php:233
547
+ #: views/packages/details/detail.php:289
548
+ #: views/packages/main/s1.setup2.php:257
549
+ msgid "Build Mode"
550
+ msgstr ""
551
+
552
+ #: views/packages/details/detail.php:240
553
+ msgid "Database Mode"
554
+ msgstr ""
555
+
556
+ #: views/packages/details/detail.php:241
557
+ msgid "Archive Database Only Enabled"
558
+ msgstr ""
559
+
560
+ #: views/packages/details/detail.php:245
561
+ #: views/packages/details/detail.php:302
562
+ msgid "Filters"
563
+ msgstr ""
564
+
565
+ #: views/packages/details/detail.php:249
566
+ #: views/packages/main/s2.scan3.php:534
567
+ #: views/packages/main/s2.scan3.php:599
568
+ msgid "Directories"
569
+ msgstr ""
570
+
571
+ #: views/packages/details/detail.php:253
572
+ #: views/packages/details/detail.php:263
573
+ #: views/packages/details/detail.php:272
574
+ #: views/packages/details/detail.php:311
575
+ msgid "- no filters -"
576
+ msgstr ""
577
+
578
+ #: views/packages/details/detail.php:259
579
+ #: views/packages/main/s2.scan3.php:545
580
+ msgid "Extensions"
581
+ msgstr ""
582
+
583
+ #: views/packages/details/detail.php:282
584
+ #: views/packages/details/detail.php:394
585
+ msgid "DATABASE"
586
+ msgstr ""
587
+
588
+ #: views/packages/details/detail.php:295
589
+ #: views/packages/main/s2.scan3.php:516
590
+ msgid "MySQL Compatibility Mode Enabled"
591
+ msgstr ""
592
+
593
+ #: views/packages/details/detail.php:296
594
+ #: views/packages/main/s1.setup2.php:333
595
+ #: views/packages/main/s2.scan2.php:73
596
+ #: views/packages/main/s2.scan2.php:84
597
+ #: views/packages/main/s2.scan2.php:91
598
+ #: views/packages/main/s2.scan3.php:517
599
+ msgid "details"
600
+ msgstr ""
601
+
602
+ #: views/packages/details/detail.php:306
603
+ #: views/packages/main/s2.scan3.php:363
604
+ msgid "Tables"
605
+ msgstr ""
606
+
607
+ #: views/packages/details/detail.php:331
608
+ msgid " Security"
609
+ msgstr ""
610
+
611
+ #: views/packages/details/detail.php:335
612
+ msgid "Password Protection"
613
+ msgstr ""
614
+
615
+ #: views/packages/details/detail.php:344
616
+ #: views/packages/main/s1.setup2.php:428
617
+ msgid "Show/Hide Password"
618
+ msgstr ""
619
+
620
+ #: views/packages/details/detail.php:354
621
+ #: views/packages/main/s1.setup2.php:454
622
+ msgid " MySQL Server"
623
+ msgstr ""
624
+
625
+ #: views/packages/details/detail.php:357
626
+ #: views/packages/main/s1.setup2.php:457
627
+ msgid "Host"
628
+ msgstr ""
629
+
630
+ #: views/packages/details/detail.php:358
631
+ #: views/packages/details/detail.php:362
632
+ #: views/packages/details/detail.php:366
633
+ msgid "- not set -"
634
+ msgstr ""
635
+
636
+ #: views/packages/details/detail.php:374
637
+ msgid "View Package Object"
638
+ msgstr ""
639
+
640
+ #: views/packages/details/detail.php:391
641
+ msgid "Package File Links"
642
+ msgstr ""
643
+
644
+ #: views/packages/details/detail.php:395
645
+ msgid "PACKAGE"
646
+ msgstr ""
647
+
648
+ #: views/packages/details/detail.php:396
649
+ msgid "INSTALLER"
650
+ msgstr ""
651
+
652
+ #: views/packages/details/detail.php:397
653
+ msgid "LOG"
654
+ msgstr ""
655
+
656
+ #: views/packages/details/transfer.php:12
657
+ msgid "Transfer your packages to multiple locations with Duplicator Pro"
658
+ msgstr ""
659
+
660
+ #: views/packages/details/transfer.php:17
661
+ #: views/settings/storage.php:16
662
+ msgid "Amazon S3"
663
+ msgstr ""
664
+
665
+ #: views/packages/details/transfer.php:18
666
+ msgid "Dropbox"
667
+ msgstr ""
668
+
669
+ #: views/packages/details/transfer.php:19
670
+ #: views/settings/storage.php:18
671
+ msgid "Google Drive"
672
+ msgstr ""
673
+
674
+ #: views/packages/details/transfer.php:20
675
+ #: views/settings/storage.php:19
676
+ msgid "One Drive"
677
+ msgstr ""
678
+
679
+ #: views/packages/details/transfer.php:21
680
+ #: views/settings/storage.php:20
681
+ msgid "FTP &amp; SFTP"
682
+ msgstr ""
683
+
684
+ #: views/packages/details/transfer.php:22
685
+ #: views/settings/storage.php:21
686
+ msgid "Custom Directory"
687
+ msgstr ""
688
+
689
+ #: views/packages/details/transfer.php:26
690
+ msgid "Set up a one-time storage location and automatically push the package to your destination."
691
+ msgstr ""
692
+
693
+ #: views/packages/details/transfer.php:32
694
+ #: views/settings/schedule.php:19
695
+ #: views/settings/storage.php:31
696
+ #: views/tools/templates.php:20
697
+ msgid "Learn More"
698
+ msgstr ""
699
+
700
+ #: views/packages/main/controller.php:6
701
+ msgid "An invalid request was made to this page."
702
+ msgstr ""
703
+
704
+ #: views/packages/main/controller.php:7
705
+ msgid "Please retry by going to the"
706
+ msgstr ""
707
+
708
+ #: views/packages/main/controller.php:8
709
+ msgid "Packages Screen"
710
+ msgstr ""
711
+
712
+ #: views/packages/main/controller.php:56
713
+ msgid "Packages &raquo; All"
714
+ msgstr ""
715
+
716
+ #: views/packages/main/controller.php:60
717
+ #: views/packages/main/controller.php:64
718
+ #: views/packages/main/controller.php:68
719
+ msgid "Packages &raquo; New"
720
+ msgstr ""
721
+
722
+ #: views/packages/main/packages.php:75
723
+ msgid "Bulk Actions"
724
+ msgstr ""
725
+
726
+ #: views/packages/main/packages.php:76
727
+ msgid "Delete selected package(s)"
728
+ msgstr ""
729
+
730
+ #: views/packages/main/packages.php:76
731
+ msgid "Delete"
732
+ msgstr ""
733
+
734
+ #: views/packages/main/packages.php:78
735
+ msgid "Apply"
736
+ msgstr ""
737
+
738
+ #: views/packages/main/packages.php:96
739
+ #: views/packages/main/s1.setup1.php:72
740
+ #: views/packages/main/s2.scan1.php:185
741
+ #: views/packages/main/s3.build.php:85
742
+ #: views/packages/main/s3.build.php:90
743
+ msgid "Create New"
744
+ msgstr ""
745
+
746
+ #: views/packages/main/packages.php:112
747
+ #: views/packages/main/packages.php:146
748
+ msgid "No Packages Found."
749
+ msgstr ""
750
+
751
+ #: views/packages/main/packages.php:113
752
+ #: views/packages/main/packages.php:147
753
+ msgid "Click the 'Create New' button to build a package."
754
+ msgstr ""
755
+
756
+ #: views/packages/main/packages.php:115
757
+ #: views/packages/main/packages.php:149
758
+ msgid "New to Duplicator?"
759
+ msgstr ""
760
+
761
+ #: views/packages/main/packages.php:117
762
+ #: views/packages/main/packages.php:151
763
+ msgid "Check out the 'Quick Start' guide!"
764
+ msgstr ""
765
+
766
+ #: views/packages/main/packages.php:133
767
+ msgid "Select all packages"
768
+ msgstr ""
769
+
770
+ #: views/packages/main/packages.php:134
771
+ msgid "Created"
772
+ msgstr ""
773
+
774
+ #: views/packages/main/packages.php:135
775
+ #: views/packages/main/s2.scan3.php:58
776
+ #: views/packages/main/s2.scan3.php:362
777
+ msgid "Size"
778
+ msgstr ""
779
+
780
+ #: views/packages/main/packages.php:138
781
+ #: views/packages/main/s2.scan3.php:498
782
+ msgid "Package"
783
+ msgstr ""
784
+
785
+ #: views/packages/main/packages.php:161
786
+ #: views/packages/main/s1.setup2.php:145
787
+ #: views/packages/main/s2.scan3.php:33
788
+ msgid "Database Only"
789
+ msgstr ""
790
+
791
+ #: views/packages/main/packages.php:162
792
+ msgid "Archive created as zip file"
793
+ msgstr ""
794
+
795
+ #: views/packages/main/packages.php:163
796
+ msgid "Archive created as daf file"
797
+ msgstr ""
798
+
799
+ #: views/packages/main/packages.php:233
800
+ msgid "Package Build Running"
801
+ msgstr ""
802
+
803
+ #: views/packages/main/packages.php:234
804
+ msgid "To stop or reset this package build goto Settings > Advanced > Reset Packages"
805
+ msgstr ""
806
+
807
+ #: views/packages/main/packages.php:244
808
+ #: views/packages/main/packages.php:273
809
+ msgid "Package Details"
810
+ msgstr ""
811
+
812
+ #: views/packages/main/packages.php:271
813
+ msgid "Error Processing"
814
+ msgstr ""
815
+
816
+ #: views/packages/main/packages.php:288
817
+ msgid "Current Server Time"
818
+ msgstr ""
819
+
820
+ #: views/packages/main/packages.php:291
821
+ #: views/packages/main/s3.build.php:310
822
+ msgid "Time"
823
+ msgstr ""
824
+
825
+ #: views/packages/main/packages.php:300
826
+ msgid "Items"
827
+ msgstr ""
828
+
829
+ #: views/packages/main/packages.php:310
830
+ msgid "Bulk Action Required"
831
+ msgstr ""
832
+
833
+ #: views/packages/main/packages.php:312
834
+ msgid "No selections made! Please select an action from the \"Bulk Actions\" drop down menu."
835
+ msgstr ""
836
+
837
+ #: views/packages/main/packages.php:316
838
+ msgid "Selection Required"
839
+ msgstr ""
840
+
841
+ #: views/packages/main/packages.php:318
842
+ msgid "No selections made! Please select at least one package to delete."
843
+ msgstr ""
844
+
845
+ #: views/packages/main/packages.php:322
846
+ msgid "Delete Packages?"
847
+ msgstr ""
848
+
849
+ #: views/packages/main/packages.php:323
850
+ msgid "Are you sure, you want to delete the selected package(s)?"
851
+ msgstr ""
852
+
853
+ #: views/packages/main/packages.php:324
854
+ msgid "Removing Packages, Please Wait..."
855
+ msgstr ""
856
+
857
+ #: views/packages/main/packages.php:331
858
+ msgid "Duplicator Help"
859
+ msgstr ""
860
+
861
+ #: views/packages/main/packages.php:336
862
+ msgid "Alert!"
863
+ msgstr ""
864
+
865
+ #: views/packages/main/packages.php:337
866
+ msgid "A package is being processed. Retry later."
867
+ msgstr ""
868
+
869
+ #: views/packages/main/packages.php:344
870
+ msgid "Common Questions:"
871
+ msgstr ""
872
+
873
+ #: views/packages/main/packages.php:345
874
+ msgid "How do I create a package"
875
+ msgstr ""
876
+
877
+ #: views/packages/main/packages.php:346
878
+ msgid "How do I install a package?"
879
+ msgstr ""
880
+
881
+ #: views/packages/main/packages.php:347
882
+ msgid "Frequently Asked Questions!"
883
+ msgstr ""
884
+
885
+ #: views/packages/main/packages.php:350
886
+ msgid "Other Resources:"
887
+ msgstr ""
888
+
889
+ #: views/packages/main/packages.php:351
890
+ msgid "Need help with the plugin?"
891
+ msgstr ""
892
+
893
+ #: views/packages/main/packages.php:352
894
+ msgid "Have an idea for the plugin?"
895
+ msgstr ""
896
+
897
+ #: views/packages/main/packages.php:354
898
+ msgid "Help review the plugin!"
899
+ msgstr ""
900
+
901
+ #: views/packages/main/s1.setup1.php:11
902
+ msgid "Package settings have been reset."
903
+ msgstr ""
904
+
905
+ #: views/packages/main/s1.setup1.php:61
906
+ #: views/packages/main/s1.setup2.php:398
907
+ #: views/packages/main/s2.scan1.php:174
908
+ #: views/packages/main/s2.scan2.php:53
909
+ #: views/packages/main/s3.build.php:75
910
+ msgid "Setup"
911
+ msgstr ""
912
+
913
+ #: views/packages/main/s1.setup1.php:62
914
+ #: views/packages/main/s2.scan1.php:175
915
+ #: views/packages/main/s3.build.php:76
916
+ msgid "Scan"
917
+ msgstr ""
918
+
919
+ #: views/packages/main/s1.setup1.php:63
920
+ #: views/packages/main/s2.scan1.php:176
921
+ #: views/packages/main/s2.scan1.php:268
922
+ #: views/packages/main/s3.build.php:77
923
+ msgid "Build"
924
+ msgstr ""
925
+
926
+ #: views/packages/main/s1.setup1.php:66
927
+ msgid "Step 1: Package Setup"
928
+ msgstr ""
929
+
930
+ #: views/packages/main/s1.setup1.php:89
931
+ msgid "Requirements:"
932
+ msgstr ""
933
+
934
+ #: views/packages/main/s1.setup1.php:98
935
+ msgid "System requirements must pass for the Duplicator to work properly. Click each link for details."
936
+ msgstr ""
937
+
938
+ #: views/packages/main/s1.setup1.php:104
939
+ msgid "PHP Support"
940
+ msgstr ""
941
+
942
+ #: views/packages/main/s1.setup1.php:110
943
+ #: views/packages/main/s2.scan2.php:65
944
+ msgid "PHP Version"
945
+ msgstr ""
946
+
947
+ #: views/packages/main/s1.setup1.php:112
948
+ msgid "PHP versions 5.2.9+ or higher is required."
949
+ msgstr ""
950
+
951
+ #: views/packages/main/s1.setup1.php:116
952
+ msgid "Zip Archive Enabled"
953
+ msgstr ""
954
+
955
+ #: views/packages/main/s1.setup1.php:120
956
+ msgid "ZipArchive extension is required or"
957
+ msgstr ""
958
+
959
+ #: views/packages/main/s1.setup1.php:121
960
+ msgid "Switch to DupArchive"
961
+ msgstr ""
962
+
963
+ #: views/packages/main/s1.setup1.php:122
964
+ msgid "to by-pass this requirement."
965
+ msgstr ""
966
+
967
+ #: views/packages/main/s1.setup1.php:128
968
+ msgid "Safe Mode Off"
969
+ msgstr ""
970
+
971
+ #: views/packages/main/s1.setup1.php:130
972
+ msgid "Safe Mode should be set to Off in you php.ini file and is deprecated as of PHP 5.3.0."
973
+ msgstr ""
974
+
975
+ #: views/packages/main/s1.setup1.php:133
976
+ #: views/packages/main/s1.setup1.php:138
977
+ #: views/packages/main/s1.setup1.php:143
978
+ msgid "Function"
979
+ msgstr ""
980
+
981
+ #: views/packages/main/s1.setup1.php:149
982
+ msgid "For any issues in this section please contact your hosting provider or server administrator. For additional information see our online documentation."
983
+ msgstr ""
984
+
985
+ #: views/packages/main/s1.setup1.php:157
986
+ msgid "Required Paths"
987
+ msgstr ""
988
+
989
+ #: views/packages/main/s1.setup1.php:177
990
+ msgid "If the root WordPress path is not writable by PHP on some systems this can cause issues."
991
+ msgstr ""
992
+
993
+ #: views/packages/main/s1.setup1.php:180
994
+ msgid "If Duplicator does not have enough permissions then you will need to manually create the paths above. &nbsp; "
995
+ msgstr ""
996
+
997
+ #: views/packages/main/s1.setup1.php:189
998
+ msgid "Server Support"
999
+ msgstr ""
1000
+
1001
+ #: views/packages/main/s1.setup1.php:195
1002
+ msgid "MySQL Version"
1003
+ msgstr ""
1004
+
1005
+ #: views/packages/main/s1.setup1.php:199
1006
+ msgid "MySQLi Support"
1007
+ msgstr ""
1008
+
1009
+ #: views/packages/main/s1.setup1.php:205
1010
+ msgid "MySQL version 5.0+ or better is required and the PHP MySQLi extension (note the trailing 'i') is also required. Contact your server administrator and request that mysqli extension and MySQL Server 5.0+ be installed."
1011
+ msgstr ""
1012
+
1013
+ #: views/packages/main/s1.setup1.php:206
1014
+ #: views/tools/diagnostics/inc.data.php:25
1015
+ msgid "more info"
1016
+ msgstr ""
1017
+
1018
+ #: views/packages/main/s1.setup1.php:215
1019
+ msgid "Reserved Files"
1020
+ msgstr ""
1021
+
1022
+ #: views/packages/main/s1.setup1.php:220
1023
+ msgid "None of the reserved files where found from a previous install. This means you are clear to create a new package."
1024
+ msgstr ""
1025
+
1026
+ #: views/packages/main/s1.setup1.php:228
1027
+ msgid "WordPress Root Path:"
1028
+ msgstr ""
1029
+
1030
+ #: views/packages/main/s1.setup1.php:230
1031
+ msgid "Remove Files Now"
1032
+ msgstr ""
1033
+
1034
+ #: views/packages/main/s1.setup2.php:73
1035
+ msgid "Add Notes"
1036
+ msgstr ""
1037
+
1038
+ #: views/packages/main/s1.setup2.php:76
1039
+ msgid "Toggle a default name"
1040
+ msgstr ""
1041
+
1042
+ #: views/packages/main/s1.setup2.php:143
1043
+ msgid "File filter enabled"
1044
+ msgstr ""
1045
+
1046
+ #: views/packages/main/s1.setup2.php:144
1047
+ msgid "Database filter enabled"
1048
+ msgstr ""
1049
+
1050
+ #: views/packages/main/s1.setup2.php:145
1051
+ #: views/packages/main/s1.setup2.php:170
1052
+ msgid "Archive Only the Database"
1053
+ msgstr ""
1054
+
1055
+ #: views/packages/main/s1.setup2.php:174
1056
+ msgid "Enable File Filters"
1057
+ msgstr ""
1058
+
1059
+ #: views/packages/main/s1.setup2.php:176
1060
+ msgid "File Filters:"
1061
+ msgstr ""
1062
+
1063
+ #: views/packages/main/s1.setup2.php:177
1064
+ msgid "File filters allow you to ignore directories and file extensions. When creating a package only include the data you want and need. This helps to improve the overall archive build time and keep your backups simple and clean."
1065
+ msgstr ""
1066
+
1067
+ #: views/packages/main/s1.setup2.php:182
1068
+ #: views/packages/main/s1.setup2.php:196
1069
+ #: views/packages/main/s1.setup2.php:204
1070
+ msgid "Separate all filters by semicolon"
1071
+ msgstr ""
1072
+
1073
+ #: views/packages/main/s1.setup2.php:184
1074
+ msgid "Directories:"
1075
+ msgstr ""
1076
+
1077
+ #: views/packages/main/s1.setup2.php:185
1078
+ msgid "Number of directories filtered"
1079
+ msgstr ""
1080
+
1081
+ #: views/packages/main/s1.setup2.php:189
1082
+ msgid "root path"
1083
+ msgstr ""
1084
+
1085
+ #: views/packages/main/s1.setup2.php:190
1086
+ msgid "wp-uploads"
1087
+ msgstr ""
1088
+
1089
+ #: views/packages/main/s1.setup2.php:191
1090
+ msgid "cache"
1091
+ msgstr ""
1092
+
1093
+ #: views/packages/main/s1.setup2.php:192
1094
+ #: views/packages/main/s1.setup2.php:200
1095
+ #: views/packages/main/s1.setup2.php:212
1096
+ msgid "(clear)"
1097
+ msgstr ""
1098
+
1099
+ #: views/packages/main/s1.setup2.php:196
1100
+ msgid "File extensions"
1101
+ msgstr ""
1102
+
1103
+ #: views/packages/main/s1.setup2.php:198
1104
+ msgid "media"
1105
+ msgstr ""
1106
+
1107
+ #: views/packages/main/s1.setup2.php:199
1108
+ msgid "archive"
1109
+ msgstr ""
1110
+
1111
+ #: views/packages/main/s1.setup2.php:206
1112
+ msgid "Files:"
1113
+ msgstr ""
1114
+
1115
+ #: views/packages/main/s1.setup2.php:207
1116
+ msgid "Number of files filtered"
1117
+ msgstr ""
1118
+
1119
+ #: views/packages/main/s1.setup2.php:211
1120
+ msgid "(file path)"
1121
+ msgstr ""
1122
+
1123
+ #: views/packages/main/s1.setup2.php:217
1124
+ msgid "The directory, file and extensions paths above will be excluded from the archive file if enabled is checked."
1125
+ msgstr ""
1126
+
1127
+ #: views/packages/main/s1.setup2.php:218
1128
+ msgid "Use the full path for directories and files with semicolons to separate all paths."
1129
+ msgstr ""
1130
+
1131
+ #: views/packages/main/s1.setup2.php:228
1132
+ msgid "This option has automatically been checked because you have opted for a <i class='fa fa-random'></i> Two-Part Install Process. Please complete the package build and continue with the "
1133
+ msgstr ""
1134
+
1135
+ #: views/packages/main/s1.setup2.php:231
1136
+ #: views/packages/main/s3.build.php:268
1137
+ msgid "Quick Start Two-Part Install Instructions"
1138
+ msgstr ""
1139
+
1140
+ #: views/packages/main/s1.setup2.php:235
1141
+ msgid "<b>Overview:</b><br/> This advanced option excludes all files from the archive. Only the database and a copy of the installer.php will be included in the archive.zip file. The option can be used for backing up and moving only the database."
1142
+ msgstr ""
1143
+
1144
+ #: views/packages/main/s1.setup2.php:240
1145
+ msgid "<b><i class='fa fa-exclamation-circle'></i> Notice:</b><br/>"
1146
+ msgstr ""
1147
+
1148
+ #: views/packages/main/s1.setup2.php:242
1149
+ msgid "Please use caution when installing only the database over an existing site and be sure the correct files correspond with the database. For example, if WordPress 4.6 is on this site and you copy the database to a host that has WordPress 4.8 files then the source code of the files will not be in sync with the database causing possible errors. If you’re immediately moving the source files with the database then you can ignore this notice. Please use this advanced feature with caution!"
1150
+ msgstr ""
1151
+
1152
+ #: views/packages/main/s1.setup2.php:264
1153
+ msgid "Enable Table Filters"
1154
+ msgstr ""
1155
+
1156
+ #: views/packages/main/s1.setup2.php:266
1157
+ msgid "Enable Table Filters:"
1158
+ msgstr ""
1159
+
1160
+ #: views/packages/main/s1.setup2.php:267
1161
+ msgid "Checked tables will not be added to the database script. Excluding certain tables can possibly cause your site or plugins to not work correctly after install!"
1162
+ msgstr ""
1163
+
1164
+ #: views/packages/main/s1.setup2.php:273
1165
+ msgid "Include All"
1166
+ msgstr ""
1167
+
1168
+ #: views/packages/main/s1.setup2.php:274
1169
+ msgid "Exclude All"
1170
+ msgstr ""
1171
+
1172
+ #: views/packages/main/s1.setup2.php:318
1173
+ msgid "Checked tables will be <u>excluded</u> from the database script. "
1174
+ msgstr ""
1175
+
1176
+ #: views/packages/main/s1.setup2.php:319
1177
+ msgid "Excluding certain tables can cause your site or plugins to not work correctly after install!<br/>"
1178
+ msgstr ""
1179
+
1180
+ #: views/packages/main/s1.setup2.php:320
1181
+ msgid "<i class='core-table-info'> Use caution when excluding tables! It is highly recommended to not exclude WordPress core tables*, unless you know the impact.</i>"
1182
+ msgstr ""
1183
+
1184
+ #: views/packages/main/s1.setup2.php:325
1185
+ msgid "Compatibility Mode"
1186
+ msgstr ""
1187
+
1188
+ #: views/packages/main/s1.setup2.php:327
1189
+ msgid "Compatibility Mode:"
1190
+ msgstr ""
1191
+
1192
+ #: views/packages/main/s1.setup2.php:328
1193
+ msgid "This is an advanced database backwards compatibility feature that should ONLY be used if having problems installing packages. If the database server version is lower than the version where the package was built then these options may help generate a script that is more compliant with the older database server. It is recommended to try each option separately starting with mysql40."
1194
+ msgstr ""
1195
+
1196
+ #: views/packages/main/s1.setup2.php:349
1197
+ msgid "mysql40"
1198
+ msgstr ""
1199
+
1200
+ #: views/packages/main/s1.setup2.php:353
1201
+ msgid "no_table_options"
1202
+ msgstr ""
1203
+
1204
+ #: views/packages/main/s1.setup2.php:357
1205
+ msgid "no_key_options"
1206
+ msgstr ""
1207
+
1208
+ #: views/packages/main/s1.setup2.php:361
1209
+ msgid "no_field_options"
1210
+ msgstr ""
1211
+
1212
+ #: views/packages/main/s1.setup2.php:366
1213
+ msgid "This option is only available with mysqldump mode."
1214
+ msgstr ""
1215
+
1216
+ #: views/packages/main/s1.setup2.php:379
1217
+ msgid "Installer password protection is on"
1218
+ msgstr ""
1219
+
1220
+ #: views/packages/main/s1.setup2.php:380
1221
+ msgid "Installer password protection is off"
1222
+ msgstr ""
1223
+
1224
+ #: views/packages/main/s1.setup2.php:387
1225
+ msgid "All values in this section are"
1226
+ msgstr ""
1227
+
1228
+ #: views/packages/main/s1.setup2.php:387
1229
+ msgid "optional"
1230
+ msgstr ""
1231
+
1232
+ #: views/packages/main/s1.setup2.php:389
1233
+ msgid "Setup/Prefills"
1234
+ msgstr ""
1235
+
1236
+ #: views/packages/main/s1.setup2.php:390
1237
+ msgid "All values in this section are OPTIONAL! If you know ahead of time the database input fields the installer will use, then you can optionally enter them here and they will be prefilled at install time. Otherwise you can just enter them in at install time and ignore all these options in the Installer section."
1238
+ msgstr ""
1239
+
1240
+ #: views/packages/main/s1.setup2.php:401
1241
+ #: views/packages/main/s1.setup2.php:406
1242
+ msgid "Branding"
1243
+ msgstr ""
1244
+
1245
+ #: views/packages/main/s1.setup2.php:404
1246
+ msgid "Available with Duplicator Pro - Freelancer!"
1247
+ msgstr ""
1248
+
1249
+ #: views/packages/main/s1.setup2.php:407
1250
+ msgid "Branding is a way to customize the installer look and feel. With branding you can create multiple brands of installers."
1251
+ msgstr ""
1252
+
1253
+ #: views/packages/main/s1.setup2.php:412
1254
+ msgid "Security"
1255
+ msgstr ""
1256
+
1257
+ #: views/packages/main/s1.setup2.php:419
1258
+ msgid "Enable Password Protection"
1259
+ msgstr ""
1260
+
1261
+ #: views/packages/main/s1.setup2.php:421
1262
+ msgid "Security:"
1263
+ msgstr ""
1264
+
1265
+ #: views/packages/main/s1.setup2.php:422
1266
+ msgid "Enabling this option will allow for basic password protection on the installer. Before running the installer the password below must be entered before proceeding with an install. This password is a general deterrent and should not be substituted for properly keeping your files secure. Be sure to remove all installer files when the install process is completed."
1267
+ msgstr ""
1268
+
1269
+ #: views/packages/main/s1.setup2.php:437
1270
+ msgid "Prefills"
1271
+ msgstr ""
1272
+
1273
+ #: views/packages/main/s1.setup2.php:445
1274
+ msgid "Basic"
1275
+ msgstr ""
1276
+
1277
+ #: views/packages/main/s1.setup2.php:446
1278
+ #: views/settings/gopro.php:175
1279
+ msgid "cPanel"
1280
+ msgstr ""
1281
+
1282
+ #: views/packages/main/s1.setup2.php:458
1283
+ msgid "example: localhost (value is optional)"
1284
+ msgstr ""
1285
+
1286
+ #: views/packages/main/s1.setup2.php:461
1287
+ msgid "Host Port"
1288
+ msgstr ""
1289
+
1290
+ #: views/packages/main/s1.setup2.php:462
1291
+ msgid "example: 3306 (value is optional)"
1292
+ msgstr ""
1293
+
1294
+ #: views/packages/main/s1.setup2.php:466
1295
+ msgid "example: DatabaseName (value is optional)"
1296
+ msgstr ""
1297
+
1298
+ #: views/packages/main/s1.setup2.php:470
1299
+ msgid "example: DatabaseUserName (value is optional)"
1300
+ msgstr ""
1301
+
1302
+ #: views/packages/main/s1.setup2.php:480
1303
+ msgid "Create the database and database user at install time without leaving the installer!"
1304
+ msgstr ""
1305
+
1306
+ #: views/packages/main/s1.setup2.php:481
1307
+ msgid "This feature is only availble in "
1308
+ msgstr ""
1309
+
1310
+ #: views/packages/main/s1.setup2.php:482
1311
+ msgid "Duplicator Pro!"
1312
+ msgstr ""
1313
+
1314
+ #: views/packages/main/s1.setup2.php:483
1315
+ msgid "This feature works only with hosts that support cPanel."
1316
+ msgstr ""
1317
+
1318
+ #: views/packages/main/s1.setup2.php:495
1319
+ msgid "Reset"
1320
+ msgstr ""
1321
+
1322
+ #: views/packages/main/s1.setup2.php:496
1323
+ msgid "Next"
1324
+ msgstr ""
1325
+
1326
+ #: views/packages/main/s1.setup2.php:505
1327
+ msgid "Reset Package Settings?"
1328
+ msgstr ""
1329
+
1330
+ #: views/packages/main/s1.setup2.php:506
1331
+ msgid "This will clear and reset all of the current package settings. Would you like to continue?"
1332
+ msgstr ""
1333
+
1334
+ #: views/packages/main/s2.scan1.php:147
1335
+ msgid "Input fields not valid"
1336
+ msgstr ""
1337
+
1338
+ #: views/packages/main/s2.scan1.php:148
1339
+ #: views/packages/main/s2.scan1.php:206
1340
+ msgid "Please try again!"
1341
+ msgstr ""
1342
+
1343
+ #: views/packages/main/s2.scan1.php:150
1344
+ #: views/packages/main/s2.scan1.php:211
1345
+ #: views/packages/main/s3.build.php:342
1346
+ msgid "Error Message:"
1347
+ msgstr ""
1348
+
1349
+ #: views/packages/main/s2.scan1.php:160
1350
+ #: views/packages/main/s2.scan1.php:266
1351
+ msgid "Back"
1352
+ msgstr ""
1353
+
1354
+ #: views/packages/main/s2.scan1.php:179
1355
+ msgid "Step 2: System Scan"
1356
+ msgstr ""
1357
+
1358
+ #: views/packages/main/s2.scan1.php:196
1359
+ msgid "Scanning Site"
1360
+ msgstr ""
1361
+
1362
+ #: views/packages/main/s2.scan1.php:198
1363
+ #: views/packages/main/s3.build.php:106
1364
+ msgid "Please Wait..."
1365
+ msgstr ""
1366
+
1367
+ #: views/packages/main/s2.scan1.php:199
1368
+ msgid "Keep this window open during the scan process."
1369
+ msgstr ""
1370
+
1371
+ #: views/packages/main/s2.scan1.php:200
1372
+ msgid "This can take several minutes."
1373
+ msgstr ""
1374
+
1375
+ #: views/packages/main/s2.scan1.php:205
1376
+ msgid "Scan Error"
1377
+ msgstr ""
1378
+
1379
+ #: views/packages/main/s2.scan1.php:208
1380
+ #: views/packages/main/s3.build.php:338
1381
+ msgid "Server Status:"
1382
+ msgstr ""
1383
+
1384
+ #: views/packages/main/s2.scan1.php:220
1385
+ msgid "Scan Complete"
1386
+ msgstr ""
1387
+
1388
+ #: views/packages/main/s2.scan1.php:222
1389
+ msgid "Process Time:"
1390
+ msgstr ""
1391
+
1392
+ #: views/packages/main/s2.scan1.php:238
1393
+ msgid "A notice status has been detected, are you sure you want to continue?"
1394
+ msgstr ""
1395
+
1396
+ #: views/packages/main/s2.scan1.php:242
1397
+ msgid "Yes. Continue with the build process!"
1398
+ msgstr ""
1399
+
1400
+ #: views/packages/main/s2.scan1.php:248
1401
+ msgid "Scan checks are not required to pass, however they could cause issues on some systems."
1402
+ msgstr ""
1403
+
1404
+ #: views/packages/main/s2.scan1.php:250
1405
+ msgid "Please review the details for each section by clicking on the detail title."
1406
+ msgstr ""
1407
+
1408
+ #: views/packages/main/s2.scan1.php:257
1409
+ msgid "Do you want to continue?"
1410
+ msgstr ""
1411
+
1412
+ #: views/packages/main/s2.scan1.php:259
1413
+ msgid "At least one or more checkboxes was checked in \"Quick Filters\"."
1414
+ msgstr ""
1415
+
1416
+ #: views/packages/main/s2.scan1.php:260
1417
+ msgid "To apply a \"Quick Filter\" click the \"Add Filters & Rescan\" button"
1418
+ msgstr ""
1419
+
1420
+ #: views/packages/main/s2.scan1.php:262
1421
+ msgid "Yes. Continue without applying any file filters."
1422
+ msgstr ""
1423
+
1424
+ #: views/packages/main/s2.scan1.php:267
1425
+ msgid "Rescan"
1426
+ msgstr ""
1427
+
1428
+ #: views/packages/main/s2.scan1.php:413
1429
+ msgid "Unable to perform a full scan, please try the following actions:"
1430
+ msgstr ""
1431
+
1432
+ #: views/packages/main/s2.scan1.php:414
1433
+ msgid "1. Go back and create a root path directory filter to validate the site is scan-able."
1434
+ msgstr ""
1435
+
1436
+ #: views/packages/main/s2.scan1.php:415
1437
+ msgid "2. Continue to add/remove filters to isolate which path is causing issues."
1438
+ msgstr ""
1439
+
1440
+ #: views/packages/main/s2.scan1.php:416
1441
+ msgid "3. This message will go away once the correct filters are applied."
1442
+ msgstr ""
1443
+
1444
+ #: views/packages/main/s2.scan1.php:418
1445
+ msgid "Common Issues:"
1446
+ msgstr ""
1447
+
1448
+ #: views/packages/main/s2.scan1.php:419
1449
+ msgid "- On some budget hosts scanning over 30k files can lead to timeout/gateway issues. Consider scanning only your main WordPress site and avoid trying to backup other external directories."
1450
+ msgstr ""
1451
+
1452
+ #: views/packages/main/s2.scan1.php:420
1453
+ msgid "- Symbolic link recursion can cause timeouts. Ask your server admin if any are present in the scan path. If they are add the full path as a filter and try running the scan again."
1454
+ msgstr ""
1455
+
1456
+ #: views/packages/main/s2.scan1.php:433
1457
+ #: views/packages/main/s3.build.php:234
1458
+ msgid "Notice"
1459
+ msgstr ""
1460
+
1461
+ #: views/packages/main/s2.scan1.php:435
1462
+ msgid "Good"
1463
+ msgstr ""
1464
+
1465
+ #: views/packages/main/s2.scan1.php:436
1466
+ msgid "Fail"
1467
+ msgstr ""
1468
+
1469
+ #: views/packages/main/s2.scan2.php:4
1470
+ msgid "Server"
1471
+ msgstr ""
1472
+
1473
+ #: views/packages/main/s2.scan2.php:5
1474
+ msgid "Show Diagnostics"
1475
+ msgstr ""
1476
+
1477
+ #: views/packages/main/s2.scan2.php:60
1478
+ #: views/tools/diagnostics/inc.settings.php:50
1479
+ msgid "Web Server"
1480
+ msgstr ""
1481
+
1482
+ #: views/packages/main/s2.scan2.php:61
1483
+ msgid "Supported web servers: "
1484
+ msgstr ""
1485
+
1486
+ #: views/packages/main/s2.scan2.php:66
1487
+ msgid "The minimum PHP version supported by Duplicator is 5.2.9. It is highly recommended to use PHP 5.3+ for improved stability. For international language support please use PHP 7.0+."
1488
+ msgstr ""
1489
+
1490
+ #: views/packages/main/s2.scan2.php:71
1491
+ msgid "PHP Open Base Dir"
1492
+ msgstr ""
1493
+
1494
+ #: views/packages/main/s2.scan2.php:72
1495
+ msgid "Issues might occur when [open_basedir] is enabled. Work with your server admin to disable this value in the php.ini file if you’re having issues building a package."
1496
+ msgstr ""
1497
+
1498
+ #: views/packages/main/s2.scan2.php:77
1499
+ #: views/packages/main/s3.build.php:317
1500
+ msgid "PHP Max Execution Time"
1501
+ msgstr ""
1502
+
1503
+ #: views/packages/main/s2.scan2.php:78
1504
+ msgid "Timeouts may occur for larger packages when [max_execution_time] time in the php.ini is too low. A value of 0 (recommended) indicates that PHP has no time limits. An attempt is made to override this value if the server allows it."
1505
+ msgstr ""
1506
+
1507
+ #: views/packages/main/s2.scan2.php:81
1508
+ msgid "Note: Timeouts can also be set at the web server layer, so if the PHP max timeout passes and you still see a build timeout messages, then your web server could be killing the process. If you are on a budget host and limited on processing time, consider using the database or file filters to shrink the size of your overall package. However use caution as excluding the wrong resources can cause your install to not work properly."
1509
+ msgstr ""
1510
+
1511
+ #: views/packages/main/s2.scan2.php:89
1512
+ msgid "Get faster builds with Duplicator Pro with access to shell_exec zip."
1513
+ msgstr ""
1514
+
1515
+ #: views/packages/main/s2.scan2.php:109
1516
+ msgid "WordPress Version"
1517
+ msgstr ""
1518
+
1519
+ #: views/packages/main/s2.scan2.php:110
1520
+ msgid "It is recommended to have a version of WordPress that is greater than %1$s. Older version of WordPress can lead to migration issues and are a security risk. If possible please update your WordPress site to the latest version."
1521
+ msgstr ""
1522
+
1523
+ #: views/packages/main/s2.scan2.php:114
1524
+ msgid "Core Files"
1525
+ msgstr ""
1526
+
1527
+ #: views/packages/main/s2.scan2.php:120
1528
+ msgid "The core WordPress paths below will <u>not</u> be included in the archive. These paths are required for WordPress to function!"
1529
+ msgstr ""
1530
+
1531
+ #: views/packages/main/s2.scan2.php:131
1532
+ msgid "The core WordPress file below will <u>not</u> be included in the archive. This file is required for WordPress to function!"
1533
+ msgstr ""
1534
+
1535
+ #: views/packages/main/s2.scan2.php:150
1536
+ msgid "If the scanner is unable to locate the wp-config.php file in the root directory, then you will need to manually copy it to its new location. This check will also look for core WordPress paths that should be included in the archive for WordPress to work correctly."
1537
+ msgstr ""
1538
+
1539
+ #: views/packages/main/s2.scan2.php:169
1540
+ msgid "Multisite: Unsupported"
1541
+ msgstr ""
1542
+
1543
+ #: views/packages/main/s2.scan2.php:170
1544
+ msgid "Duplicator does not support WordPress multisite migrations. We recommend using Duplicator Pro which currently supports full multisite migrations and subsite to standalone site migrations."
1545
+ msgstr ""
1546
+
1547
+ #: views/packages/main/s2.scan2.php:174
1548
+ msgid "While it is not recommended you can still continue with the build of this package. Please note that at install time additional manual custom configurations will need to be made to finalize this multisite migration."
1549
+ msgstr ""
1550
+
1551
+ #: views/packages/main/s2.scan2.php:176
1552
+ #: views/packages/main/s2.scan2.php:181
1553
+ msgid "upgrade to pro"
1554
+ msgstr ""
1555
+
1556
+ #: views/packages/main/s2.scan2.php:178
1557
+ msgid "Multisite: N/A"
1558
+ msgstr ""
1559
+
1560
+ #: views/packages/main/s2.scan2.php:179
1561
+ msgid "This is not a multisite install so duplication will proceed without issue. Duplicator does not officially support multisite. However, Duplicator Pro supports duplication of a full multisite network and also has the ability to install a multisite subsite as a standalone site."
1562
+ msgstr ""
1563
+
1564
+ #: views/packages/main/s2.scan3.php:5
1565
+ #: views/tools/diagnostics/inc.settings.php:54
1566
+ msgid "Root Path"
1567
+ msgstr ""
1568
+
1569
+ #: views/packages/main/s2.scan3.php:21
1570
+ msgid "Show Scan Details"
1571
+ msgstr ""
1572
+
1573
+ #: views/packages/main/s2.scan3.php:36
1574
+ #: views/packages/main/s2.scan3.php:340
1575
+ #: views/packages/main/s2.scan3.php:527
1576
+ #: views/settings/general.php:149
1577
+ #: views/tools/diagnostics/inc.settings.php:157
1578
+ msgid "Enabled"
1579
+ msgstr ""
1580
+
1581
+ #: views/packages/main/s2.scan3.php:42
1582
+ msgid "Archive Size"
1583
+ msgstr ""
1584
+
1585
+ #: views/packages/main/s2.scan3.php:43
1586
+ msgid "This size includes only files BEFORE compression is applied. It does not include the size of the database script or any applied filters. Once complete the package size will be smaller than this number."
1587
+ msgstr ""
1588
+
1589
+ #: views/packages/main/s2.scan3.php:46
1590
+ #: views/packages/main/s2.scan3.php:350
1591
+ #: views/packages/main/s2.scan3.php:412
1592
+ msgid "uncompressed"
1593
+ msgstr ""
1594
+
1595
+ #: views/packages/main/s2.scan3.php:54
1596
+ msgid "Size Checks"
1597
+ msgstr ""
1598
+
1599
+ #: views/packages/main/s2.scan3.php:59
1600
+ msgid "File Count"
1601
+ msgstr ""
1602
+
1603
+ #: views/packages/main/s2.scan3.php:60
1604
+ msgid "Directory Count"
1605
+ msgstr ""
1606
+
1607
+ #: views/packages/main/s2.scan3.php:62
1608
+ msgid "Compressing larger sites on <i>some budget hosts</i> may cause timeouts. "
1609
+ msgstr ""
1610
+
1611
+ #: views/packages/main/s2.scan3.php:63
1612
+ msgid "more details..."
1613
+ msgstr ""
1614
+
1615
+ #: views/packages/main/s2.scan3.php:67
1616
+ #: views/packages/main/s2.scan3.php:357
1617
+ #: views/packages/main/s3.build.php:192
1618
+ #: views/packages/screen.php:53
1619
+ msgid "Overview"
1620
+ msgstr ""
1621
+
1622
+ #: views/packages/main/s2.scan3.php:69
1623
+ msgid "This notice is triggered at [%s] and can be ignored on most hosts. If during the build process you see a \"Host Build Interrupt\" message then this host has strict processing limits. Below are some options you can take to overcome constraints set up on this host."
1624
+ msgstr ""
1625
+
1626
+ #: views/packages/main/s2.scan3.php:73
1627
+ msgid "Timeout Options"
1628
+ msgstr ""
1629
+
1630
+ #: views/packages/main/s2.scan3.php:75
1631
+ msgid "Apply the \"Quick Filters\" below or click the back button to apply on previous page."
1632
+ msgstr ""
1633
+
1634
+ #: views/packages/main/s2.scan3.php:76
1635
+ msgid "See the FAQ link to adjust this hosts timeout limits: "
1636
+ msgstr ""
1637
+
1638
+ #: views/packages/main/s2.scan3.php:76
1639
+ msgid "What can I try for Timeout Issues?"
1640
+ msgstr ""
1641
+
1642
+ #: views/packages/main/s2.scan3.php:77
1643
+ msgid "Consider trying multi-threaded support in "
1644
+ msgstr ""
1645
+
1646
+ #: views/packages/main/s2.scan3.php:78
1647
+ msgid "Duplicator Pro."
1648
+ msgstr ""
1649
+
1650
+ #: views/packages/main/s2.scan3.php:82
1651
+ msgid "Files over %1$s are listed below. Larger files such as movies or zipped content can cause timeout issues on some budget hosts. If you are having issues creating a package try excluding the directory paths below or go back to Step 1 and add them."
1652
+ msgstr ""
1653
+
1654
+ #: views/packages/main/s2.scan3.php:91
1655
+ #: views/packages/main/s2.scan3.php:178
1656
+ #: views/packages/main/s2.scan3.php:227
1657
+ msgid "Quick Filters"
1658
+ msgstr ""
1659
+
1660
+ #: views/packages/main/s2.scan3.php:92
1661
+ msgid "Large Files"
1662
+ msgstr ""
1663
+
1664
+ #: views/packages/main/s2.scan3.php:95
1665
+ #: views/packages/main/s2.scan3.php:230
1666
+ msgid "Hide All"
1667
+ msgstr ""
1668
+
1669
+ #: views/packages/main/s2.scan3.php:96
1670
+ #: views/packages/main/s2.scan3.php:231
1671
+ msgid "Show All"
1672
+ msgstr ""
1673
+
1674
+ #: views/packages/main/s2.scan3.php:106
1675
+ #: views/packages/main/s2.scan3.php:246
1676
+ msgid "Core WordPress directories should not be filtered. Use caution when excluding files."
1677
+ msgstr ""
1678
+
1679
+ #: views/packages/main/s2.scan3.php:126
1680
+ msgid "No large files found during this scan."
1681
+ msgstr ""
1682
+
1683
+ #: views/packages/main/s2.scan3.php:129
1684
+ msgid "No large files found during this scan. If you're having issues building a package click the back button and try adding a file filter to non-essential files paths like wp-content/uploads. These excluded files can then be manually moved to the new location after you have ran the migration installer."
1685
+ msgstr ""
1686
+
1687
+ #: views/packages/main/s2.scan3.php:142
1688
+ #: views/packages/main/s2.scan3.php:272
1689
+ msgid "*Checking a directory will exclude all items recursively from that path down. Please use caution when filtering directories."
1690
+ msgstr ""
1691
+
1692
+ #: views/packages/main/s2.scan3.php:145
1693
+ #: views/packages/main/s2.scan3.php:201
1694
+ #: views/packages/main/s2.scan3.php:275
1695
+ msgid "Add Filters &amp; Rescan"
1696
+ msgstr ""
1697
+
1698
+ #: views/packages/main/s2.scan3.php:147
1699
+ #: views/packages/main/s2.scan3.php:277
1700
+ msgid "Copy Paths to Clipboard"
1701
+ msgstr ""
1702
+
1703
+ #: views/packages/main/s2.scan3.php:163
1704
+ msgid "Addon Sites"
1705
+ msgstr ""
1706
+
1707
+ #: views/packages/main/s2.scan3.php:169
1708
+ msgid "An \"Addon Site\" is a separate WordPress site(s) residing in subdirectories within this site. If you confirm these to be separate sites, then it is recommended that you exclude them by checking the corresponding boxes below and clicking the 'Add Filters & Rescan' button. To backup the other sites install the plugin on the sites needing to be backed-up."
1709
+ msgstr ""
1710
+
1711
+ #: views/packages/main/s2.scan3.php:192
1712
+ msgid "No add on sites found."
1713
+ msgstr ""
1714
+
1715
+ #: views/packages/main/s2.scan3.php:198
1716
+ msgid "*Checking a directory will exclude all items in that path recursively."
1717
+ msgstr ""
1718
+
1719
+ #: views/packages/main/s2.scan3.php:214
1720
+ #: views/packages/main/s2.scan3.php:228
1721
+ msgid "Name Checks"
1722
+ msgstr ""
1723
+
1724
+ #: views/packages/main/s2.scan3.php:219
1725
+ msgid "Unicode and special characters such as \"*?><:/\\|\", can be problematic on some hosts."
1726
+ msgstr ""
1727
+
1728
+ #: views/packages/main/s2.scan3.php:220
1729
+ msgid " Only consider using this filter if the package build is failing. Select files that are not important to your site or you can migrate manually."
1730
+ msgstr ""
1731
+
1732
+ #: views/packages/main/s2.scan3.php:221
1733
+ msgid "If this environment/system and the system where it will be installed are set up to support Unicode and long paths then these filters can be ignored. If you run into issues with creating or installing a package, then is recommended to filter these paths."
1734
+ msgstr ""
1735
+
1736
+ #: views/packages/main/s2.scan3.php:266
1737
+ msgid "No file/directory name warnings found."
1738
+ msgstr ""
1739
+
1740
+ #: views/packages/main/s2.scan3.php:289
1741
+ msgid "Read Checks"
1742
+ msgstr ""
1743
+
1744
+ #: views/packages/main/s2.scan3.php:294
1745
+ msgid "PHP is unable to read the following items and they will NOT be included in the package. Please work with your host to adjust the permissions or resolve the symbolic-link(s) shown in the lists below. If these items are not needed then this notice can be ignored."
1746
+ msgstr ""
1747
+
1748
+ #: views/packages/main/s2.scan3.php:300
1749
+ msgid "Unreadable Items:"
1750
+ msgstr ""
1751
+
1752
+ #: views/packages/main/s2.scan3.php:307
1753
+ msgid "No unreadable items found."
1754
+ msgstr ""
1755
+
1756
+ #: views/packages/main/s2.scan3.php:311
1757
+ msgid "Recursive Links:"
1758
+ msgstr ""
1759
+
1760
+ #: views/packages/main/s2.scan3.php:318
1761
+ msgid "No recursive sym-links found."
1762
+ msgstr ""
1763
+
1764
+ #: views/packages/main/s2.scan3.php:346
1765
+ msgid "Database Size:"
1766
+ msgstr ""
1767
+
1768
+ #: views/packages/main/s2.scan3.php:347
1769
+ msgid "The database size represents only the included tables. The process for gathering the size uses the query SHOW TABLE STATUS. The overall size of the database file can impact the final size of the package."
1770
+ msgstr ""
1771
+
1772
+ #: views/packages/main/s2.scan3.php:361
1773
+ msgid "TOTAL SIZE"
1774
+ msgstr ""
1775
+
1776
+ #: views/packages/main/s2.scan3.php:364
1777
+ msgid "Records"
1778
+ msgstr ""
1779
+
1780
+ #: views/packages/main/s2.scan3.php:367
1781
+ msgid "Total size and row counts are approximate values. The thresholds that trigger notices are %1$s records total for the entire database. Larger databases take more time to process. On some budget hosts that have cpu/memory/timeout limits this may cause issues."
1782
+ msgstr ""
1783
+
1784
+ #: views/packages/main/s2.scan3.php:372
1785
+ msgid "TABLE DETAILS:"
1786
+ msgstr ""
1787
+
1788
+ #: views/packages/main/s2.scan3.php:374
1789
+ msgid "The notices for tables are %1$s records or names with upper-case characters. Individual tables will not trigger a notice message, but can help narrow down issues if they occur later on."
1790
+ msgstr ""
1791
+
1792
+ #: views/packages/main/s2.scan3.php:381
1793
+ #: views/packages/main/s2.scan3.php:433
1794
+ msgid "RECOMMENDATIONS:"
1795
+ msgstr ""
1796
+
1797
+ #: views/packages/main/s2.scan3.php:384
1798
+ msgid "repair and optimization"
1799
+ msgstr ""
1800
+
1801
+ #: views/packages/main/s2.scan3.php:385
1802
+ msgid "1. Run a %1$s on the table to improve the overall size and performance."
1803
+ msgstr ""
1804
+
1805
+ #: views/packages/main/s2.scan3.php:387
1806
+ msgid "2. Remove post revisions and stale data from tables. Tables such as logs, statistical or other non-critical data should be cleared."
1807
+ msgstr ""
1808
+
1809
+ #: views/packages/main/s2.scan3.php:389
1810
+ msgid "Enable mysqldump"
1811
+ msgstr ""
1812
+
1813
+ #: views/packages/main/s2.scan3.php:390
1814
+ msgid "3. %1$s if this host supports the option."
1815
+ msgstr ""
1816
+
1817
+ #: views/packages/main/s2.scan3.php:392
1818
+ msgid "lower_case_table_names"
1819
+ msgstr ""
1820
+
1821
+ #: views/packages/main/s2.scan3.php:393
1822
+ msgid "4. For table name case sensitivity issues either rename the table with lower case characters or be prepared to work with the %1$s system variable setting."
1823
+ msgstr ""
1824
+
1825
+ #: views/packages/main/s2.scan3.php:404
1826
+ msgid "Total Size"
1827
+ msgstr ""
1828
+
1829
+ #: views/packages/main/s2.scan3.php:409
1830
+ msgid "Total Size:"
1831
+ msgstr ""
1832
+
1833
+ #: views/packages/main/s2.scan3.php:410
1834
+ msgid "The total size of the site (files plus database)."
1835
+ msgstr ""
1836
+
1837
+ #: views/packages/main/s2.scan3.php:420
1838
+ msgid "The build can't continue because the total size of files and the database exceeds the %s limit that can be processed when creating a DupArchive package. "
1839
+ msgstr ""
1840
+
1841
+ #: views/packages/main/s2.scan3.php:421
1842
+ msgid "<a href=\"javascript:void(0)\" onclick=\"jQuery('#data-ll-status-recommendations').toggle()\">Click for recommendations.</a>"
1843
+ msgstr ""
1844
+
1845
+ #: views/packages/main/s2.scan3.php:427
1846
+ #: views/packages/main/s2.scan3.php:501
1847
+ #: views/settings/packages.php:208
1848
+ msgid "Archive Engine"
1849
+ msgstr ""
1850
+
1851
+ #: views/packages/main/s2.scan3.php:438
1852
+ msgid "Step 1"
1853
+ msgstr ""
1854
+
1855
+ #: views/packages/main/s2.scan3.php:439
1856
+ msgid "- Add data filters to get the package size under %s: "
1857
+ msgstr ""
1858
+
1859
+ #: views/packages/main/s2.scan3.php:441
1860
+ msgid "- In the 'Size Checks' section above consider adding filters (if notice is shown)."
1861
+ msgstr ""
1862
+
1863
+ #: views/packages/main/s2.scan3.php:443
1864
+ msgid "- In %s consider adding file/directory or database table filters."
1865
+ msgstr ""
1866
+
1867
+ #: views/packages/main/s2.scan3.php:447
1868
+ msgid "covered here."
1869
+ msgstr ""
1870
+
1871
+ #: views/packages/main/s2.scan3.php:448
1872
+ msgid "- Perform a two part install %s"
1873
+ msgstr ""
1874
+
1875
+ #: views/packages/main/s2.scan3.php:451
1876
+ msgid "ZipArchive Engine"
1877
+ msgstr ""
1878
+
1879
+ #: views/packages/main/s2.scan3.php:452
1880
+ msgid "- Switch to the %s which requires a capable hosting provider (VPS recommended)."
1881
+ msgstr ""
1882
+
1883
+ #: views/packages/main/s2.scan3.php:456
1884
+ msgid "- Consider upgrading to %s for large site support. (unlimited)"
1885
+ msgstr ""
1886
+
1887
+ #: views/packages/main/s2.scan3.php:466
1888
+ msgid "Migrate large, multi-gig sites with"
1889
+ msgstr ""
1890
+
1891
+ #: views/packages/main/s2.scan3.php:481
1892
+ msgid "Scan Details"
1893
+ msgstr ""
1894
+
1895
+ #: views/packages/main/s2.scan3.php:488
1896
+ msgid "Copy Quick Filter Paths"
1897
+ msgstr ""
1898
+
1899
+ #: views/packages/main/s2.scan3.php:507
1900
+ msgid "Name:"
1901
+ msgstr ""
1902
+
1903
+ #: views/packages/main/s2.scan3.php:508
1904
+ msgid "Host:"
1905
+ msgstr ""
1906
+
1907
+ #: views/packages/main/s2.scan3.php:510
1908
+ msgid "Build Mode:"
1909
+ msgstr ""
1910
+
1911
+ #: views/packages/main/s2.scan3.php:526
1912
+ #: views/settings/gopro.php:54
1913
+ msgid "File Filters"
1914
+ msgstr ""
1915
+
1916
+ #: views/packages/main/s2.scan3.php:527
1917
+ #: views/tools/diagnostics/inc.settings.php:157
1918
+ msgid "Disabled"
1919
+ msgstr ""
1920
+
1921
+ #: views/packages/main/s2.scan3.php:541
1922
+ msgid "No custom directory filters set."
1923
+ msgstr ""
1924
+
1925
+ #: views/packages/main/s2.scan3.php:551
1926
+ msgid "No file extension filters have been set."
1927
+ msgstr ""
1928
+
1929
+ #: views/packages/main/s2.scan3.php:563
1930
+ msgid "No custom file filters set."
1931
+ msgstr ""
1932
+
1933
+ #: views/packages/main/s2.scan3.php:567
1934
+ msgid "Auto Directory Filters"
1935
+ msgstr ""
1936
+
1937
+ #: views/packages/main/s2.scan3.php:573
1938
+ msgid "Auto File Filters"
1939
+ msgstr ""
1940
+
1941
+ #: views/packages/main/s2.scan3.php:586
1942
+ msgid "Path filters will be skipped during the archive process when enabled."
1943
+ msgstr ""
1944
+
1945
+ #: views/packages/main/s2.scan3.php:588
1946
+ msgid "[view json result report]"
1947
+ msgstr ""
1948
+
1949
+ #: views/packages/main/s2.scan3.php:591
1950
+ msgid "Auto filters are applied to prevent archiving other backup sets."
1951
+ msgstr ""
1952
+
1953
+ #: views/packages/main/s2.scan3.php:602
1954
+ #: views/packages/main/s2.scan3.php:611
1955
+ msgid "Click to Copy"
1956
+ msgstr ""
1957
+
1958
+ #: views/packages/main/s2.scan3.php:616
1959
+ msgid "Copy the paths above and apply them as needed on Step 1 &gt; Archive &gt; Files section."
1960
+ msgstr ""
1961
+
1962
+ #: views/packages/main/s2.scan3.php:633
1963
+ msgid "Directory applied filter set."
1964
+ msgstr ""
1965
+
1966
+ #: views/packages/main/s2.scan3.php:660
1967
+ msgid "No directories have been selected!"
1968
+ msgstr ""
1969
+
1970
+ #: views/packages/main/s2.scan3.php:664
1971
+ msgid "No files have been selected!"
1972
+ msgstr ""
1973
+
1974
+ #: views/packages/main/s2.scan3.php:702
1975
+ msgid "Copied to Clipboard!"
1976
+ msgstr ""
1977
+
1978
+ #: views/packages/main/s2.scan3.php:704
1979
+ msgid "Manual copy of selected text required on this browser."
1980
+ msgstr ""
1981
+
1982
+ #: views/packages/main/s2.scan3.php:711
1983
+ msgid "Initializing Please Wait..."
1984
+ msgstr ""
1985
+
1986
+ #: views/packages/main/s2.scan3.php:754
1987
+ #: views/packages/main/s2.scan3.php:761
1988
+ msgid "Error applying filters. Please go back to Step 1 to add filter manually!"
1989
+ msgstr ""
1990
+
1991
+ #: views/packages/main/s2.scan3.php:829
1992
+ msgid "Unable to report on any tables"
1993
+ msgstr ""
1994
+
1995
+ #: views/packages/main/s2.scan3.php:855
1996
+ msgid "Unable to report on database stats"
1997
+ msgstr ""
1998
+
1999
+ #: views/packages/main/s3.build.php:14
2000
+ msgid "Help review the plugin"
2001
+ msgstr ""
2002
+
2003
+ #: views/packages/main/s3.build.php:17
2004
+ msgid "Want more power? Try"
2005
+ msgstr ""
2006
+
2007
+ #: views/packages/main/s3.build.php:80
2008
+ msgid "Step 3: Build Package"
2009
+ msgstr ""
2010
+
2011
+ #: views/packages/main/s3.build.php:104
2012
+ msgid "Building Package"
2013
+ msgstr ""
2014
+
2015
+ #: views/packages/main/s3.build.php:107
2016
+ msgid "Keep this window open and do not close during the build process."
2017
+ msgstr ""
2018
+
2019
+ #: views/packages/main/s3.build.php:108
2020
+ msgid "This may take several minutes to complete."
2021
+ msgstr ""
2022
+
2023
+ #: views/packages/main/s3.build.php:112
2024
+ msgid "Build Status"
2025
+ msgstr ""
2026
+
2027
+ #: views/packages/main/s3.build.php:119
2028
+ msgid "Package Completed"
2029
+ msgstr ""
2030
+
2031
+ #: views/packages/main/s3.build.php:124
2032
+ msgid "Process Time"
2033
+ msgstr ""
2034
+
2035
+ #: views/packages/main/s3.build.php:130
2036
+ msgid "Download Files"
2037
+ msgstr ""
2038
+
2039
+ #: views/packages/main/s3.build.php:132
2040
+ msgid "Click to download installer file"
2041
+ msgstr ""
2042
+
2043
+ #: views/packages/main/s3.build.php:135
2044
+ msgid "Click to download archive file"
2045
+ msgstr ""
2046
+
2047
+ #: views/packages/main/s3.build.php:140
2048
+ msgid "Click to download both files"
2049
+ msgstr ""
2050
+
2051
+ #: views/packages/main/s3.build.php:141
2052
+ msgid "One-Click Download"
2053
+ msgstr ""
2054
+
2055
+ #: views/packages/main/s3.build.php:144
2056
+ msgid "One Click:"
2057
+ msgstr ""
2058
+
2059
+ #: views/packages/main/s3.build.php:145
2060
+ msgid "Clicking this link will open both the installer and archive download prompts at the same time. On some browsers you may have to disable pop-up warnings on this domain for this to work correctly."
2061
+ msgstr ""
2062
+
2063
+ #: views/packages/main/s3.build.php:153
2064
+ msgid "How do I install this Package?"
2065
+ msgstr ""
2066
+
2067
+ #: views/packages/main/s3.build.php:165
2068
+ msgid "Host Build Interrupt"
2069
+ msgstr ""
2070
+
2071
+ #: views/packages/main/s3.build.php:166
2072
+ msgid "This server cannot complete the build due to host setup constraints."
2073
+ msgstr ""
2074
+
2075
+ #: views/packages/main/s3.build.php:167
2076
+ msgid "To get past this hosts limitation consider the options below by clicking each section."
2077
+ msgstr ""
2078
+
2079
+ #: views/packages/main/s3.build.php:173
2080
+ msgid "Option 1: Try DupArchive"
2081
+ msgstr ""
2082
+
2083
+ #: views/packages/main/s3.build.php:177
2084
+ msgid "OPTION 1:"
2085
+ msgstr ""
2086
+
2087
+ #: views/packages/main/s3.build.php:179
2088
+ msgid "Enable the DupArchive format which is specific to Duplicator and designed to perform better on constrained budget hosts."
2089
+ msgstr ""
2090
+
2091
+ #: views/packages/main/s3.build.php:183
2092
+ msgid "Note: DupArchive on Duplicator only supports sites up to 500MB. If your site is over 500MB then use a file filter on step 1 to get the size below 500MB or try the other options mentioned below. Alternatively, you may want to consider"
2093
+ msgstr ""
2094
+
2095
+ #: views/packages/main/s3.build.php:189
2096
+ msgid " which is capable of migrating sites much larger than 500MB."
2097
+ msgstr ""
2098
+
2099
+ #: views/packages/main/s3.build.php:193
2100
+ #: views/packages/main/s3.build.php:260
2101
+ msgid "Please follow these steps:"
2102
+ msgstr ""
2103
+
2104
+ #: views/packages/main/s3.build.php:195
2105
+ msgid "On the scanner step check to make sure your package is under 500MB. If not see additional options below."
2106
+ msgstr ""
2107
+
2108
+ #: views/packages/main/s3.build.php:197
2109
+ msgid "Go to Duplicator &gt; Settings &gt; Packages Tab &gt; Archive Engine &gt;"
2110
+ msgstr ""
2111
+
2112
+ #: views/packages/main/s3.build.php:198
2113
+ msgid "Enable DupArchive"
2114
+ msgstr ""
2115
+
2116
+ #: views/packages/main/s3.build.php:200
2117
+ msgid "Build a new package using the new engine format."
2118
+ msgstr ""
2119
+
2120
+ #: views/packages/main/s3.build.php:204
2121
+ msgid "Note: The DupArchive engine will generate an archive.daf file. This file is very similar to a .zip except that it can only be extracted by the installer.php file or the"
2122
+ msgstr ""
2123
+
2124
+ #: views/packages/main/s3.build.php:206
2125
+ msgid "commandline extraction tool"
2126
+ msgstr ""
2127
+
2128
+ #: views/packages/main/s3.build.php:214
2129
+ msgid "Option 2: File Filters"
2130
+ msgstr ""
2131
+
2132
+ #: views/packages/main/s3.build.php:218
2133
+ msgid "OPTION 2:"
2134
+ msgstr ""
2135
+
2136
+ #: views/packages/main/s3.build.php:220
2137
+ msgid "The first pass for reading files on some budget hosts maybe slow and have conflicts with strict timeout settings setup by the hosting provider. In these cases, it is recommended to retry the build by adding file filters to larger files/directories."
2138
+ msgstr ""
2139
+
2140
+ #: views/packages/main/s3.build.php:225
2141
+ msgid "For example, you could filter out the \"/wp-content/uploads/\" folder to create the package then move the files from that directory over manually. If this work-flow is not desired or does not work please check-out the other options below."
2142
+ msgstr ""
2143
+
2144
+ #: views/packages/main/s3.build.php:230
2145
+ msgid "Retry Build With Filters"
2146
+ msgstr ""
2147
+
2148
+ #: views/packages/main/s3.build.php:236
2149
+ msgid "Build Folder:"
2150
+ msgstr ""
2151
+
2152
+ #: views/packages/main/s3.build.php:237
2153
+ msgid "On some servers the build will continue to run in the background. To validate if a build is still running; open the 'tmp' folder above and see if the archive file is growing in size or check the main packages screen to see if the package completed. If it is not then your server has strict timeout constraints."
2154
+ msgstr ""
2155
+
2156
+ #: views/packages/main/s3.build.php:249
2157
+ msgid "Option 3: Two-Part Install"
2158
+ msgstr ""
2159
+
2160
+ #: views/packages/main/s3.build.php:253
2161
+ msgid "OPTION 3:"
2162
+ msgstr ""
2163
+
2164
+ #: views/packages/main/s3.build.php:255
2165
+ msgid "A two-part install minimizes server load and can avoid I/O and CPU issues encountered on some budget hosts. With this procedure you simply build a 'database-only' archive, manually move the website files, and then run the installer to complete the process."
2166
+ msgstr ""
2167
+
2168
+ #: views/packages/main/s3.build.php:259
2169
+ msgid " Overview"
2170
+ msgstr ""
2171
+
2172
+ #: views/packages/main/s3.build.php:262
2173
+ msgid "Click the button below to go back to Step 1."
2174
+ msgstr ""
2175
+
2176
+ #: views/packages/main/s3.build.php:263
2177
+ msgid "On Step 1 the \"Archive Only the Database\" checkbox will be auto checked."
2178
+ msgstr ""
2179
+
2180
+ #: views/packages/main/s3.build.php:265
2181
+ msgid "Complete the package build and follow the "
2182
+ msgstr ""
2183
+
2184
+ #: views/packages/main/s3.build.php:275
2185
+ msgid "Yes. I have read the above overview and would like to continue!"
2186
+ msgstr ""
2187
+
2188
+ #: views/packages/main/s3.build.php:277
2189
+ msgid "Start Two-Part Install Process"
2190
+ msgstr ""
2191
+
2192
+ #: views/packages/main/s3.build.php:286
2193
+ msgid "Option 4: Configure Server"
2194
+ msgstr ""
2195
+
2196
+ #: views/packages/main/s3.build.php:290
2197
+ msgid "OPTION 4:"
2198
+ msgstr ""
2199
+
2200
+ #: views/packages/main/s3.build.php:291
2201
+ msgid "This option is available on some hosts that allow for users to adjust server configurations. With this option you will be directed to an FAQ page that will show various recommendations you can take to improve/unlock constraints set up on this server."
2202
+ msgstr ""
2203
+
2204
+ #: views/packages/main/s3.build.php:297
2205
+ msgid "Diagnose Server Setup"
2206
+ msgstr ""
2207
+
2208
+ #: views/packages/main/s3.build.php:301
2209
+ msgid "RUNTIME DETAILS"
2210
+ msgstr ""
2211
+
2212
+ #: views/packages/main/s3.build.php:304
2213
+ msgid "Allowed Runtime:"
2214
+ msgstr ""
2215
+
2216
+ #: views/packages/main/s3.build.php:308
2217
+ msgid "PHP Max Execution"
2218
+ msgstr ""
2219
+
2220
+ #: views/packages/main/s3.build.php:318
2221
+ msgid "This value is represented in seconds. A value of 0 means no timeout limit is set for PHP."
2222
+ msgstr ""
2223
+
2224
+ #: views/packages/main/s3.build.php:322
2225
+ #: views/settings/packages.php:167
2226
+ msgid "Mode"
2227
+ msgstr ""
2228
+
2229
+ #: views/packages/main/s3.build.php:328
2230
+ msgid "PHP Max Execution Mode"
2231
+ msgstr ""
2232
+
2233
+ #: views/packages/main/s3.build.php:330
2234
+ msgid "If the value is [dynamic] then its possible for PHP to run longer than the default. If the value is [fixed] then PHP will not be allowed to run longer than the default. <br/><br/> If this value is larger than the [Allowed Runtime] above then the web server has been enabled with a timeout cap and is overriding the PHP max time setting."
2235
+ msgstr ""
2236
+
2237
+ #: views/packages/main/s3.build.php:351
2238
+ msgid "Read Package Log File"
2239
+ msgstr ""
2240
+
2241
+ #: views/packages/screen.php:64
2242
+ msgid "<b><i class='fa fa-archive'></i> Packages » All</b><br/> The 'Packages' section is the main interface for managing all the packages that have been created. A Package consists of two core files, the 'archive.zip' and the 'installer.php' file. The archive file is a zip file containing all your WordPress files and a copy of your WordPress database. The installer file is a php file that when browsed to via a web browser presents a wizard that redeploys/installs the website by extracting the archive file and installing the database. To create a package, click the 'Create New' button and follow the prompts. <br/><br/><b><i class='fa fa-download'></i> Downloads</b><br/>To download the package files click on the Installer and Archive buttons after creating a package. The archive file will have a copy of the installer inside of it named installer-backup.php in case the original installer file is lost. To see the details of a package click on the <i class='fa fa-archive'></i> details button.<br/><br/><b><i class='fa fa-file-archive-o'></i> Archive Types</b><br/>An archive file can be saved as either a .zip file or .daf file. A zip file is a common archive format used to compress and group files. The daf file short for 'Duplicator Archive Format' is a custom format used specifically for working with larger packages and scale-ability issues on many shared hosting platforms. Both formats work very similar. The main difference is that the daf file can only be extracted using the installer.php file or the <a href='https://snapcreek.com/duplicator/docs/faqs-tech/#faq-trouble-052-q' target='_blank'>DAF extraction tool</a>. The zip file can be used by the installer.php or other zip tools like winrar/7zip/winzip or other client-side tools. <br/><br/>"
2243
+ msgstr ""
2244
+
2245
+ #: views/packages/screen.php:85
2246
+ msgid "<b>Packages New » 1 Setup</b> <br/>The setup step allows for optional filtered directory paths, files, file extensions and database tables. To filter specific system files, click the 'Enable File Filters' checkbox and add the full path of the file or directory, followed by a semicolon. For a file extension add the name (i.e. 'zip') followed by a semicolon. <br/><br/>To exclude a database table, check the box labeled 'Enable Table Filters' and check the table name to exclude. To include only a copy of your database in the archive file check the box labeled 'Archive Only the Database'. The installer.php file can optionally be pre-filled with data at install time but is not required. <br/><br/>"
2247
+ msgstr ""
2248
+
2249
+ #: views/packages/screen.php:97
2250
+ msgid "<b>Packages » 2 Scan</b> <br/>The plugin will scan your system files and database to let you know if there are any concerns or issues that may be present. All items in green mean the checks looked good. All items in red indicate a warning. Warnings will not prevent the build from running, however if you do run into issues with the build then investigating the warnings should be considered. Click on each section for more details about each scan check. <br/><br/>"
2251
+ msgstr ""
2252
+
2253
+ #: views/packages/screen.php:105
2254
+ msgid ""
2255
+ "<b>Packages » 3 Build</b> <br/>The final step in the build process where the installer script and archive of the website can be downloaded. To start the install process follow these steps: <ol><li>Download the installer.php and archive.zip files to your local computer.</li><li>For localhost installs be sure you have PHP, Apache & MySQL installed on your local computer with software such as XAMPP, Instant WordPress or MAMP for MAC. Place the package.zip and installer.php into any empty directory under your webroot then browse to the installer.php via your web browser to launch the install wizard.</li><li>For remote installs use FTP or cPanel to upload both the archive.zip and installer.php to your hosting provider. Place the files in a new empty directory under your host's webroot accessible from a valid URL such as http://your-domain/your-wp-directory/installer.php to launch the install wizard. On some hosts the root directory will be a something like public_html -or- www. If your're not sure contact your hosting provider. </li></ol>For complete instructions see:<br/>
2256
+ "\t\t\t\t\t<a href='https://snapcreek.com/duplicator/docs/quick-start/?utm_source=duplicator_free&amp;utm_medium=wordpress_plugin&amp;utm_content=package_built_install_help&amp;utm_campaign=duplicator_free#quick-040-q' target='_blank'>
2257
+ "\t\t\t\t\tHow do I install this Package?</a><br/><br/>"
2258
+ msgstr ""
2259
+
2260
+ #: views/packages/screen.php:122
2261
+ msgid "<b>Packages » Details</b> <br/>The details view will give you a full break-down of the package including any errors that may have occured during the install. <br/><br/>"
2262
+ msgstr ""
2263
+
2264
+ #: views/settings/about-info.php:47
2265
+ msgid "Duplicator can streamline your workflow and quickly clone/migrate a WordPress site. The plugin helps admins, designers and developers speed up the migration process of moving a WordPress site. Please help us continue development by giving this plugin a 5 star."
2266
+ msgstr ""
2267
+
2268
+ #: views/settings/about-info.php:59
2269
+ msgid "Rate Duplicator"
2270
+ msgstr ""
2271
+
2272
+ #: views/settings/about-info.php:68
2273
+ msgid "Support us with a 5 star review!"
2274
+ msgstr ""
2275
+
2276
+ #: views/settings/about-info.php:80
2277
+ msgid "Spread the Word"
2278
+ msgstr ""
2279
+
2280
+ #: views/settings/about-info.php:87
2281
+ msgid "Facebook"
2282
+ msgstr ""
2283
+
2284
+ #: views/settings/about-info.php:90
2285
+ msgid "Twitter"
2286
+ msgstr ""
2287
+
2288
+ #: views/settings/about-info.php:93
2289
+ msgid "LinkedIn"
2290
+ msgstr ""
2291
+
2292
+ #: views/settings/about-info.php:96
2293
+ msgid "Google+"
2294
+ msgstr ""
2295
+
2296
+ #: views/settings/about-info.php:108
2297
+ msgid "Stay in the Loop"
2298
+ msgstr ""
2299
+
2300
+ #: views/settings/about-info.php:118
2301
+ msgid "Subscribe to the Duplicator newsletter and stay on top of great ideas, tutorials, and better ways to improve your workflows"
2302
+ msgstr ""
2303
+
2304
+ #: views/settings/controller.php:23
2305
+ msgid "Schedules"
2306
+ msgstr ""
2307
+
2308
+ #: views/settings/controller.php:25
2309
+ msgid "License"
2310
+ msgstr ""
2311
+
2312
+ #: views/settings/controller.php:26
2313
+ msgid "About"
2314
+ msgstr ""
2315
+
2316
+ #: views/settings/general.php:9
2317
+ msgid "General Settings Saved"
2318
+ msgstr ""
2319
+
2320
+ #: views/settings/general.php:79
2321
+ msgid "Plugin"
2322
+ msgstr ""
2323
+
2324
+ #: views/settings/general.php:83
2325
+ #: views/tools/diagnostics/inc.settings.php:81
2326
+ #: views/tools/diagnostics/inc.settings.php:100
2327
+ #: views/tools/diagnostics/inc.settings.php:173
2328
+ msgid "Version"
2329
+ msgstr ""
2330
+
2331
+ #: views/settings/general.php:90
2332
+ msgid "Uninstall"
2333
+ msgstr ""
2334
+
2335
+ #: views/settings/general.php:93
2336
+ msgid "Delete Plugin Settings"
2337
+ msgstr ""
2338
+
2339
+ #: views/settings/general.php:96
2340
+ msgid "Delete Entire Storage Directory"
2341
+ msgstr ""
2342
+
2343
+ #: views/settings/general.php:103
2344
+ msgid "Full Path"
2345
+ msgstr ""
2346
+
2347
+ #: views/settings/general.php:106
2348
+ msgid "Disable .htaccess File In Storage Directory"
2349
+ msgstr ""
2350
+
2351
+ #: views/settings/general.php:108
2352
+ msgid "Disable if issues occur when downloading installer/archive files."
2353
+ msgstr ""
2354
+
2355
+ #: views/settings/general.php:113
2356
+ msgid "Custom Roles"
2357
+ msgstr ""
2358
+
2359
+ #: views/settings/general.php:116
2360
+ msgid "Enable User Role Editor Plugin Integration"
2361
+ msgstr ""
2362
+
2363
+ #: views/settings/general.php:121
2364
+ msgid "The User Role Editor Plugin"
2365
+ msgstr ""
2366
+
2367
+ #: views/settings/general.php:122
2368
+ #: views/settings/gopro.php:45
2369
+ msgid "Free"
2370
+ msgstr ""
2371
+
2372
+ #: views/settings/general.php:123
2373
+ msgid "or"
2374
+ msgstr ""
2375
+
2376
+ #: views/settings/general.php:124
2377
+ #: views/settings/gopro.php:46
2378
+ msgid "Professional"
2379
+ msgstr ""
2380
+
2381
+ #: views/settings/general.php:125
2382
+ msgid "must be installed to use"
2383
+ msgstr ""
2384
+
2385
+ #: views/settings/general.php:126
2386
+ msgid "this feature."
2387
+ msgstr ""
2388
+
2389
+ #: views/settings/general.php:135
2390
+ msgid "Debug"
2391
+ msgstr ""
2392
+
2393
+ #: views/settings/general.php:139
2394
+ msgid "Debugging"
2395
+ msgstr ""
2396
+
2397
+ #: views/settings/general.php:142
2398
+ msgid "Enable debug options throughout user interface"
2399
+ msgstr ""
2400
+
2401
+ #: views/settings/general.php:146
2402
+ msgid "Trace Log"
2403
+ msgstr ""
2404
+
2405
+ #: views/settings/general.php:152
2406
+ msgid "Turns on detailed operation logging. Logging will occur in both PHP error and local trace logs."
2407
+ msgstr ""
2408
+
2409
+ #: views/settings/general.php:154
2410
+ msgid "WARNING: Only turn on this setting when asked to by support as tracing will impact performance."
2411
+ msgstr ""
2412
+
2413
+ #: views/settings/general.php:158
2414
+ msgid "Download Trace Log"
2415
+ msgstr ""
2416
+
2417
+ #: views/settings/general.php:166
2418
+ msgid "Advanced"
2419
+ msgstr ""
2420
+
2421
+ #: views/settings/general.php:173
2422
+ msgid "Reset Packages"
2423
+ msgstr ""
2424
+
2425
+ #: views/settings/general.php:176
2426
+ msgid "This process will reset all packages by deleting those without a completed status, reset the active package id and perform a cleanup of the build tmp file."
2427
+ msgstr ""
2428
+
2429
+ #: views/settings/general.php:179
2430
+ msgid "Reset Settings"
2431
+ msgstr ""
2432
+
2433
+ #: views/settings/general.php:180
2434
+ msgid "This action should only be used if the packages screen is having issues or a build is stuck."
2435
+ msgstr ""
2436
+
2437
+ #: views/settings/general.php:188
2438
+ msgid "Save General Settings"
2439
+ msgstr ""
2440
+
2441
+ #: views/settings/general.php:197
2442
+ msgid "Reset Packages ?"
2443
+ msgstr ""
2444
+
2445
+ #: views/settings/general.php:198
2446
+ msgid "This will clear and reset all of the current temporary packages. Would you like to continue?"
2447
+ msgstr ""
2448
+
2449
+ #: views/settings/general.php:199
2450
+ msgid "Resetting settings, Please Wait..."
2451
+ msgstr ""
2452
+
2453
+ #: views/settings/general.php:202
2454
+ msgid "Yes"
2455
+ msgstr ""
2456
+
2457
+ #: views/settings/general.php:203
2458
+ msgid "No"
2459
+ msgstr ""
2460
+
2461
+ #: views/settings/general.php:207
2462
+ msgid "AJAX ERROR!"
2463
+ msgstr ""
2464
+
2465
+ #: views/settings/general.php:207
2466
+ msgid "Ajax request error"
2467
+ msgstr ""
2468
+
2469
+ #: views/settings/general.php:212
2470
+ #: views/settings/general.php:265
2471
+ msgid "RESPONSE ERROR!"
2472
+ msgstr ""
2473
+
2474
+ #: views/settings/general.php:255
2475
+ msgid "Packages successfully reset"
2476
+ msgstr ""
2477
+
2478
+ #: views/settings/gopro.php:38
2479
+ msgid "The simplicity of Duplicator"
2480
+ msgstr ""
2481
+
2482
+ #: views/settings/gopro.php:39
2483
+ msgid "with power for the professional."
2484
+ msgstr ""
2485
+
2486
+ #: views/settings/gopro.php:44
2487
+ msgid "Feature"
2488
+ msgstr ""
2489
+
2490
+ #: views/settings/gopro.php:49
2491
+ msgid "Backup Files & Database"
2492
+ msgstr ""
2493
+
2494
+ #: views/settings/gopro.php:59
2495
+ msgid "Database Table Filters"
2496
+ msgstr ""
2497
+
2498
+ #: views/settings/gopro.php:64
2499
+ msgid "Migration Wizard"
2500
+ msgstr ""
2501
+
2502
+ #: views/settings/gopro.php:69
2503
+ msgid "Scheduled Backups"
2504
+ msgstr ""
2505
+
2506
+ #: views/settings/gopro.php:76
2507
+ msgid "Amazon S3 Storage"
2508
+ msgstr ""
2509
+
2510
+ #: views/settings/gopro.php:84
2511
+ msgid "Dropbox Storage "
2512
+ msgstr ""
2513
+
2514
+ #: views/settings/gopro.php:92
2515
+ msgid "Google Drive Storage"
2516
+ msgstr ""
2517
+
2518
+ #: views/settings/gopro.php:100
2519
+ msgid "Microsoft One Drive Storage"
2520
+ msgstr ""
2521
+
2522
+ #: views/settings/gopro.php:108
2523
+ msgid "Remote FTP/SFTP Storage"
2524
+ msgstr ""
2525
+
2526
+ #: views/settings/gopro.php:114
2527
+ msgid "Overwrite Live Site"
2528
+ msgstr ""
2529
+
2530
+ #: views/settings/gopro.php:116
2531
+ msgid "Overwrite Existing Site"
2532
+ msgstr ""
2533
+
2534
+ #: views/settings/gopro.php:117
2535
+ msgid "Overwrite a live site. Makes installing super-fast!"
2536
+ msgstr ""
2537
+
2538
+ #: views/settings/gopro.php:123
2539
+ #: views/settings/gopro.php:125
2540
+ msgid "Large Site Support"
2541
+ msgstr ""
2542
+
2543
+ #: views/settings/gopro.php:126
2544
+ msgid "Advanced archive engine processes multi-gig sites - even on stubborn budget hosts!"
2545
+ msgstr ""
2546
+
2547
+ #: views/settings/gopro.php:132
2548
+ msgid "Multiple Archive Engines"
2549
+ msgstr ""
2550
+
2551
+ #: views/settings/gopro.php:137
2552
+ msgid "Server Throttling"
2553
+ msgstr ""
2554
+
2555
+ #: views/settings/gopro.php:142
2556
+ msgid "Background Processing"
2557
+ msgstr ""
2558
+
2559
+ #: views/settings/gopro.php:147
2560
+ msgid "Installer Passwords"
2561
+ msgstr ""
2562
+
2563
+ #: views/settings/gopro.php:152
2564
+ msgid " Regenerate Salts"
2565
+ msgstr ""
2566
+
2567
+ #: views/settings/gopro.php:154
2568
+ msgid "Regenerate Salts"
2569
+ msgstr ""
2570
+
2571
+ #: views/settings/gopro.php:155
2572
+ msgid "Installer contains option to regenerate salts in the wp-config.php file. This feature is only available with Freelancer, Business or Gold licenses."
2573
+ msgstr ""
2574
+
2575
+ #: views/settings/gopro.php:161
2576
+ #: views/settings/gopro.php:163
2577
+ msgid "WP-Config Control Plus"
2578
+ msgstr ""
2579
+
2580
+ #: views/settings/gopro.php:164
2581
+ msgid "Control many wp-config.php settings right from the installer!"
2582
+ msgstr ""
2583
+
2584
+ #: views/settings/gopro.php:172
2585
+ msgid "cPanel Database API"
2586
+ msgstr ""
2587
+
2588
+ #: views/settings/gopro.php:176
2589
+ msgid "Create the database and database user directly in the installer. No need to browse to your host's cPanel application."
2590
+ msgstr ""
2591
+
2592
+ #: views/settings/gopro.php:182
2593
+ msgid "Multisite Network Migration"
2594
+ msgstr ""
2595
+
2596
+ #: views/settings/gopro.php:187
2597
+ msgid "Multisite Subsite &gt; Standalone"
2598
+ msgstr ""
2599
+
2600
+ #: views/settings/gopro.php:189
2601
+ msgid "Multisite"
2602
+ msgstr ""
2603
+
2604
+ #: views/settings/gopro.php:190
2605
+ msgid "Install an individual subsite from a Multisite as a standalone site. This feature is only available with Business or Gold licenses."
2606
+ msgstr ""
2607
+
2608
+ #: views/settings/gopro.php:197
2609
+ msgid "Custom Search & Replace"
2610
+ msgstr ""
2611
+
2612
+ #: views/settings/gopro.php:203
2613
+ msgid "Email Alerts"
2614
+ msgstr ""
2615
+
2616
+ #: views/settings/gopro.php:209
2617
+ msgid "Manual Transfers"
2618
+ msgstr ""
2619
+
2620
+ #: views/settings/gopro.php:214
2621
+ msgid "Active Customer Support"
2622
+ msgstr ""
2623
+
2624
+ #: views/settings/gopro.php:219
2625
+ msgid "Plus Many Other Features..."
2626
+ msgstr ""
2627
+
2628
+ #: views/settings/gopro.php:228
2629
+ msgid "Check It Out!"
2630
+ msgstr ""
2631
+
2632
+ #: views/settings/license.php:2
2633
+ msgid "Activation"
2634
+ msgstr ""
2635
+
2636
+ #: views/settings/license.php:7
2637
+ msgid "%1$sManage Licenses%2$s"
2638
+ msgstr ""
2639
+
2640
+ #: views/settings/license.php:12
2641
+ msgid "Duplicator Free"
2642
+ msgstr ""
2643
+
2644
+ #: views/settings/license.php:14
2645
+ msgid "Basic Features"
2646
+ msgstr ""
2647
+
2648
+ #: views/settings/license.php:15
2649
+ msgid "Pro Features"
2650
+ msgstr ""
2651
+
2652
+ #: views/settings/license.php:20
2653
+ msgid "License Key"
2654
+ msgstr ""
2655
+
2656
+ #: views/settings/license.php:24
2657
+ msgid "The free version of Duplicator does not require a license key. "
2658
+ msgstr ""
2659
+
2660
+ #: views/settings/license.php:26
2661
+ msgid "Professional Users: Please note that if you have already purchased the Professional version it is a separate plugin that you download and install. You can download the Professional version from the email sent after your purchase or click on the 'Manage Licenses' link above to download the plugin from your snapcreek.com dashboard. "
2662
+ msgstr ""
2663
+
2664
+ #: views/settings/license.php:29
2665
+ msgid "If you would like to purchase the professional version you can "
2666
+ msgstr ""
2667
+
2668
+ #: views/settings/license.php:30
2669
+ msgid "get a copy here"
2670
+ msgstr ""
2671
+
2672
+ #: views/settings/packages.php:8
2673
+ msgid "Package Settings Saved"
2674
+ msgstr ""
2675
+
2676
+ #: views/settings/packages.php:74
2677
+ msgid "SQL Script"
2678
+ msgstr ""
2679
+
2680
+ #: views/settings/packages.php:78
2681
+ msgid "Mysqldump"
2682
+ msgstr ""
2683
+
2684
+ #: views/settings/packages.php:88
2685
+ msgid "PHP Code"
2686
+ msgstr ""
2687
+
2688
+ #: views/settings/packages.php:98
2689
+ msgid "This server does not support the PHP shell_exec function which is required for mysqldump to run. "
2690
+ msgstr ""
2691
+
2692
+ #: views/settings/packages.php:99
2693
+ msgid "Please contact the host or server administrator to enable this feature."
2694
+ msgstr ""
2695
+
2696
+ #: views/settings/packages.php:104
2697
+ #: views/tools/diagnostics/logging.php:169
2698
+ msgid "Host Recommendation:"
2699
+ msgstr ""
2700
+
2701
+ #: views/settings/packages.php:105
2702
+ #: views/tools/diagnostics/logging.php:170
2703
+ msgid "Duplicator recommends going with the high performance pro plan or better from our recommended list"
2704
+ msgstr ""
2705
+
2706
+ #: views/settings/packages.php:109
2707
+ msgid "Please visit our recommended"
2708
+ msgstr ""
2709
+
2710
+ #: views/settings/packages.php:110
2711
+ #: views/settings/packages.php:134
2712
+ #: views/tools/diagnostics/logging.php:175
2713
+ msgid "host list"
2714
+ msgstr ""
2715
+
2716
+ #: views/settings/packages.php:111
2717
+ msgid "for reliable access to mysqldump"
2718
+ msgstr ""
2719
+
2720
+ #: views/settings/packages.php:122
2721
+ msgid "Successfully Found:"
2722
+ msgstr ""
2723
+
2724
+ #: views/settings/packages.php:129
2725
+ msgid "Mysqldump was not found at its default location or the location provided. Please enter a custom path to a valid location where mysqldump can run. If the problem persist contact your host or server administrator. "
2726
+ msgstr ""
2727
+
2728
+ #: views/settings/packages.php:133
2729
+ msgid "See the"
2730
+ msgstr ""
2731
+
2732
+ #: views/settings/packages.php:135
2733
+ msgid "for reliable access to mysqldump."
2734
+ msgstr ""
2735
+
2736
+ #: views/settings/packages.php:141
2737
+ msgid "Custom Path"
2738
+ msgstr ""
2739
+
2740
+ #: views/settings/packages.php:143
2741
+ msgid "mysqldump path:"
2742
+ msgstr ""
2743
+
2744
+ #: views/settings/packages.php:144
2745
+ msgid "Add a custom path if the path to mysqldump is not properly detected. For all paths use a forward slash as the path seperator. On Linux systems use mysqldump for Windows systems use mysqldump.exe. If the path tried does not work please contact your hosting provider for details on the correct path."
2746
+ msgstr ""
2747
+
2748
+ #: views/settings/packages.php:148
2749
+ msgid "/usr/bin/mypath/mysqldump"
2750
+ msgstr ""
2751
+
2752
+ #: views/settings/packages.php:152
2753
+ msgid "<i class=\"fa fa-exclamation-triangle\"></i> The custom path provided is not recognized as a valid mysqldump file:<br/>"
2754
+ msgstr ""
2755
+
2756
+ #: views/settings/packages.php:170
2757
+ msgid "Single-Threaded"
2758
+ msgstr ""
2759
+
2760
+ #: views/settings/packages.php:173
2761
+ msgid "Multi-Threaded"
2762
+ msgstr ""
2763
+
2764
+ #: views/settings/packages.php:177
2765
+ msgid "PHP Code Mode:"
2766
+ msgstr ""
2767
+
2768
+ #: views/settings/packages.php:179
2769
+ msgid "Single-Threaded mode attempts to create the entire database script in one request. Multi-Threaded mode allows the database script to be chunked over multiple requests. Multi-Threaded mode is typically slower but much more reliable especially for larger databases."
2770
+ msgstr ""
2771
+
2772
+ #: views/settings/packages.php:181
2773
+ msgid "<br><br><i>Multi-Threaded mode is only available in Duplicator Pro.</i>"
2774
+ msgstr ""
2775
+
2776
+ #: views/settings/packages.php:184
2777
+ msgid "Query Limit Size"
2778
+ msgstr ""
2779
+
2780
+ #: views/settings/packages.php:194
2781
+ msgid "PHP Query Limit Size"
2782
+ msgstr ""
2783
+
2784
+ #: views/settings/packages.php:195
2785
+ msgid "A higher limit size will speed up the database build time, however it will use more memory. If your host has memory caps start off low."
2786
+ msgstr ""
2787
+
2788
+ #: views/settings/packages.php:213
2789
+ msgid "ZipArchive"
2790
+ msgstr ""
2791
+
2792
+ #: views/settings/packages.php:219
2793
+ msgid "DupArchive (beta)"
2794
+ msgstr ""
2795
+
2796
+ #: views/settings/packages.php:228
2797
+ msgid "Creates a archive format (archive.zip)."
2798
+ msgstr ""
2799
+
2800
+ #: views/settings/packages.php:229
2801
+ msgid "This option uses the internal PHP ZipArchive classes to create a Zip file."
2802
+ msgstr ""
2803
+
2804
+ #: views/settings/packages.php:238
2805
+ msgid "Creates a custom archive format (archive.daf)."
2806
+ msgstr ""
2807
+
2808
+ #: views/settings/packages.php:239
2809
+ msgid "This option is recommended for large sites or sites on constrained servers."
2810
+ msgstr ""
2811
+
2812
+ #: views/settings/packages.php:246
2813
+ msgid "Archive Flush"
2814
+ msgstr ""
2815
+
2816
+ #: views/settings/packages.php:249
2817
+ msgid "Attempt Network Keep Alive"
2818
+ msgstr ""
2819
+
2820
+ #: views/settings/packages.php:250
2821
+ msgid "enable only for large archives"
2822
+ msgstr ""
2823
+
2824
+ #: views/settings/packages.php:253
2825
+ msgid "This will attempt to keep a network connection established for large archives."
2826
+ msgstr ""
2827
+
2828
+ #: views/settings/packages.php:254
2829
+ msgid " Valid only when Archive Engine for ZipArchive is enabled."
2830
+ msgstr ""
2831
+
2832
+ #: views/settings/packages.php:261
2833
+ msgid "Visual"
2834
+ msgstr ""
2835
+
2836
+ #: views/settings/packages.php:265
2837
+ msgid "Created Format"
2838
+ msgstr ""
2839
+
2840
+ #: views/settings/packages.php:269
2841
+ msgid "By Year"
2842
+ msgstr ""
2843
+
2844
+ #: views/settings/packages.php:276
2845
+ msgid "By Month"
2846
+ msgstr ""
2847
+
2848
+ #: views/settings/packages.php:283
2849
+ msgid "By Day"
2850
+ msgstr ""
2851
+
2852
+ #: views/settings/packages.php:291
2853
+ msgid "The UTC date format shown in the 'Created' column on the Packages screen."
2854
+ msgstr ""
2855
+
2856
+ #: views/settings/packages.php:292
2857
+ msgid "To use WordPress timezone formats consider an upgrade to Duplicator Pro."
2858
+ msgstr ""
2859
+
2860
+ #: views/settings/packages.php:301
2861
+ msgid "Save Package Settings"
2862
+ msgstr ""
2863
+
2864
+ #: views/settings/schedule.php:11
2865
+ #: views/tools/templates.php:12
2866
+ msgid "This option is available in Duplicator Pro."
2867
+ msgstr ""
2868
+
2869
+ #: views/settings/schedule.php:12
2870
+ msgid "Create robust schedules that automatically create packages while you sleep."
2871
+ msgstr ""
2872
+
2873
+ #: views/settings/schedule.php:14
2874
+ msgid "Simply choose your storage location and when you want it to run."
2875
+ msgstr ""
2876
+
2877
+ #: views/settings/storage.php:12
2878
+ msgid "Store your packages in multiple locations with Duplicator Pro"
2879
+ msgstr ""
2880
+
2881
+ #: views/settings/storage.php:17
2882
+ msgid " Dropbox"
2883
+ msgstr ""
2884
+
2885
+ #: views/settings/storage.php:25
2886
+ msgid "Set up a one-time storage location and automatically <br/> push the package to your destination."
2887
+ msgstr ""
2888
+
2889
+ #: views/tools/controller.php:17
2890
+ msgid "Diagnostics"
2891
+ msgstr ""
2892
+
2893
+ #: views/tools/controller.php:18
2894
+ msgid "Templates"
2895
+ msgstr ""
2896
+
2897
+ #: views/tools/diagnostics/inc.data.php:10
2898
+ msgid "Stored Data"
2899
+ msgstr ""
2900
+
2901
+ #: views/tools/diagnostics/inc.data.php:15
2902
+ msgid "Data Cleanup"
2903
+ msgstr ""
2904
+
2905
+ #: views/tools/diagnostics/inc.data.php:20
2906
+ msgid "Remove Installation Files"
2907
+ msgstr ""
2908
+
2909
+ #: views/tools/diagnostics/inc.data.php:24
2910
+ msgid "Removes all reserved installer files."
2911
+ msgstr ""
2912
+
2913
+ #: views/tools/diagnostics/inc.data.php:29
2914
+ msgid "Clicking on the 'Remove Installation Files' button will attempt to remove the installer files used by Duplicator. These files should not be left on production systems for security reasons. Below are the files that should be removed."
2915
+ msgstr ""
2916
+
2917
+ #: views/tools/diagnostics/inc.data.php:44
2918
+ msgid "Clear Build Cache"
2919
+ msgstr ""
2920
+
2921
+ #: views/tools/diagnostics/inc.data.php:47
2922
+ msgid "Removes all build data from:"
2923
+ msgstr ""
2924
+
2925
+ #: views/tools/diagnostics/inc.data.php:52
2926
+ msgid "Options Values"
2927
+ msgstr ""
2928
+
2929
+ #: views/tools/diagnostics/inc.data.php:86
2930
+ msgid "Delete Option?"
2931
+ msgstr ""
2932
+
2933
+ #: views/tools/diagnostics/inc.data.php:87
2934
+ msgid "Delete the option value just selected?"
2935
+ msgstr ""
2936
+
2937
+ #: views/tools/diagnostics/inc.data.php:88
2938
+ msgid "Removing Option, Please Wait..."
2939
+ msgstr ""
2940
+
2941
+ #: views/tools/diagnostics/inc.data.php:93
2942
+ msgid "Clear Build Cache?"
2943
+ msgstr ""
2944
+
2945
+ #: views/tools/diagnostics/inc.data.php:94
2946
+ msgid "This process will remove all build cache files. Be sure no packages are currently building or else they will be cancelled."
2947
+ msgstr ""
2948
+
2949
+ #: views/tools/diagnostics/inc.data.php:106
2950
+ msgid "Delete the option value"
2951
+ msgstr ""
2952
+
2953
+ #: views/tools/diagnostics/inc.phpinfo.php:16
2954
+ msgid "PHP Information"
2955
+ msgstr ""
2956
+
2957
+ #: views/tools/diagnostics/inc.settings.php:4
2958
+ #: views/tools/diagnostics/inc.settings.php:5
2959
+ msgid "unknow"
2960
+ msgstr ""
2961
+
2962
+ #: views/tools/diagnostics/inc.settings.php:22
2963
+ msgid "Server Settings"
2964
+ msgstr ""
2965
+
2966
+ #: views/tools/diagnostics/inc.settings.php:31
2967
+ msgid "Duplicator Version"
2968
+ msgstr ""
2969
+
2970
+ #: views/tools/diagnostics/inc.settings.php:38
2971
+ msgid "Operating System"
2972
+ msgstr ""
2973
+
2974
+ #: views/tools/diagnostics/inc.settings.php:42
2975
+ msgid "Timezone"
2976
+ msgstr ""
2977
+
2978
+ #: views/tools/diagnostics/inc.settings.php:46
2979
+ msgid "Server Time"
2980
+ msgstr ""
2981
+
2982
+ #: views/tools/diagnostics/inc.settings.php:58
2983
+ msgid "ABSPATH"
2984
+ msgstr ""
2985
+
2986
+ #: views/tools/diagnostics/inc.settings.php:62
2987
+ msgid "Plugins Path"
2988
+ msgstr ""
2989
+
2990
+ #: views/tools/diagnostics/inc.settings.php:66
2991
+ msgid "Loaded PHP INI"
2992
+ msgstr ""
2993
+
2994
+ #: views/tools/diagnostics/inc.settings.php:70
2995
+ msgid "Server IP"
2996
+ msgstr ""
2997
+
2998
+ #: views/tools/diagnostics/inc.settings.php:74
2999
+ msgid "Client IP"
3000
+ msgstr ""
3001
+
3002
+ #: views/tools/diagnostics/inc.settings.php:85
3003
+ msgid "Language"
3004
+ msgstr ""
3005
+
3006
+ #: views/tools/diagnostics/inc.settings.php:89
3007
+ #: views/tools/diagnostics/inc.settings.php:181
3008
+ msgid "Charset"
3009
+ msgstr ""
3010
+
3011
+ #: views/tools/diagnostics/inc.settings.php:93
3012
+ msgid "Memory Limit "
3013
+ msgstr ""
3014
+
3015
+ #: views/tools/diagnostics/inc.settings.php:94
3016
+ msgid "Max"
3017
+ msgstr ""
3018
+
3019
+ #: views/tools/diagnostics/inc.settings.php:112
3020
+ msgid "Process"
3021
+ msgstr ""
3022
+
3023
+ #: views/tools/diagnostics/inc.settings.php:116
3024
+ msgid "Safe Mode"
3025
+ msgstr ""
3026
+
3027
+ #: views/tools/diagnostics/inc.settings.php:120
3028
+ msgid "On"
3029
+ msgstr ""
3030
+
3031
+ #: views/tools/diagnostics/inc.settings.php:120
3032
+ msgid "Off"
3033
+ msgstr ""
3034
+
3035
+ #: views/tools/diagnostics/inc.settings.php:125
3036
+ msgid "Memory Limit"
3037
+ msgstr ""
3038
+
3039
+ #: views/tools/diagnostics/inc.settings.php:129
3040
+ msgid "Memory In Use"
3041
+ msgstr ""
3042
+
3043
+ #: views/tools/diagnostics/inc.settings.php:133
3044
+ #: views/tools/diagnostics/inc.settings.php:142
3045
+ msgid "Max Execution Time"
3046
+ msgstr ""
3047
+
3048
+ #: views/tools/diagnostics/inc.settings.php:143
3049
+ msgid "If the value shows dynamic then this means its possible for PHP to run longer than the default. If the value is fixed then PHP will not be allowed to run longer than the default."
3050
+ msgstr ""
3051
+
3052
+ #: views/tools/diagnostics/inc.settings.php:148
3053
+ msgid "Shell Exec"
3054
+ msgstr ""
3055
+
3056
+ #: views/tools/diagnostics/inc.settings.php:149
3057
+ #: views/tools/diagnostics/inc.settings.php:153
3058
+ msgid "Is Supported"
3059
+ msgstr ""
3060
+
3061
+ #: views/tools/diagnostics/inc.settings.php:149
3062
+ #: views/tools/diagnostics/inc.settings.php:153
3063
+ msgid "Not Supported"
3064
+ msgstr ""
3065
+
3066
+ #: views/tools/diagnostics/inc.settings.php:152
3067
+ msgid "Shell Exec Zip"
3068
+ msgstr ""
3069
+
3070
+ #: views/tools/diagnostics/inc.settings.php:156
3071
+ msgid "Suhosin Extension"
3072
+ msgstr ""
3073
+
3074
+ #: views/tools/diagnostics/inc.settings.php:160
3075
+ msgid "Architecture "
3076
+ msgstr ""
3077
+
3078
+ #: views/tools/diagnostics/inc.settings.php:166
3079
+ msgid "Error Log File "
3080
+ msgstr ""
3081
+
3082
+ #: views/tools/diagnostics/inc.settings.php:177
3083
+ msgid "Comments"
3084
+ msgstr ""
3085
+
3086
+ #: views/tools/diagnostics/inc.settings.php:185
3087
+ msgid "Wait Timeout"
3088
+ msgstr ""
3089
+
3090
+ #: views/tools/diagnostics/inc.settings.php:189
3091
+ msgid "Max Allowed Packets"
3092
+ msgstr ""
3093
+
3094
+ #: views/tools/diagnostics/inc.settings.php:193
3095
+ msgid "msyqldump Path"
3096
+ msgstr ""
3097
+
3098
+ #: views/tools/diagnostics/inc.settings.php:197
3099
+ msgid "Server Disk"
3100
+ msgstr ""
3101
+
3102
+ #: views/tools/diagnostics/inc.settings.php:200
3103
+ msgid "Free space"
3104
+ msgstr ""
3105
+
3106
+ #: views/tools/diagnostics/inc.settings.php:203
3107
+ msgid "Note: This value is the physical servers hard-drive allocation."
3108
+ msgstr ""
3109
+
3110
+ #: views/tools/diagnostics/inc.settings.php:204
3111
+ msgid "On shared hosts check your control panel for the 'TRUE' disk space quota value."
3112
+ msgstr ""
3113
+
3114
+ #: views/tools/diagnostics/inc.validator.php:15
3115
+ msgid "Run Validator"
3116
+ msgstr ""
3117
+
3118
+ #: views/tools/diagnostics/inc.validator.php:16
3119
+ msgid "This will run the scan validation check. This may take several minutes. Do you want to Continue?"
3120
+ msgstr ""
3121
+
3122
+ #: views/tools/diagnostics/inc.validator.php:27
3123
+ msgid "Scan Validator"
3124
+ msgstr ""
3125
+
3126
+ #: views/tools/diagnostics/inc.validator.php:32
3127
+ msgid "This utility will help to find unreadable files and sys-links in your environment that can lead to issues during the scan process. "
3128
+ msgstr ""
3129
+
3130
+ #: views/tools/diagnostics/inc.validator.php:33
3131
+ msgid "The utility will also shows how many files and directories you have in your system. This process may take several minutes to run. "
3132
+ msgstr ""
3133
+
3134
+ #: views/tools/diagnostics/inc.validator.php:34
3135
+ msgid "If there is a recursive loop on your system then the process has a built in check to stop after a large set of files and directories have been scanned. "
3136
+ msgstr ""
3137
+
3138
+ #: views/tools/diagnostics/inc.validator.php:35
3139
+ msgid "A message will show indicated that that a scan depth has been reached. If you have issues with the package scanner (step 2) during the build process then try to add The paths below to your file filters to allow the scanner to finish."
3140
+ msgstr ""
3141
+
3142
+ #: views/tools/diagnostics/inc.validator.php:42
3143
+ #: views/tools/diagnostics/inc.validator.php:152
3144
+ msgid "Run Scan Integrity Validation"
3145
+ msgstr ""
3146
+
3147
+ #: views/tools/diagnostics/inc.validator.php:76
3148
+ msgid "Note: Symlinks are not discoverable on Windows OS with PHP"
3149
+ msgstr ""
3150
+
3151
+ #: views/tools/diagnostics/inc.validator.php:121
3152
+ msgid "Scanning Environment... This may take a few minutes."
3153
+ msgstr ""
3154
+
3155
+ #: views/tools/diagnostics/information.php:24
3156
+ msgid "File Found: Unable to remove"
3157
+ msgstr ""
3158
+
3159
+ #: views/tools/diagnostics/information.php:25
3160
+ msgid "Removed"
3161
+ msgstr ""
3162
+
3163
+ #: views/tools/diagnostics/information.php:43
3164
+ msgid "Installer file cleanup ran!"
3165
+ msgstr ""
3166
+
3167
+ #: views/tools/diagnostics/information.php:47
3168
+ msgid "Build cache removed."
3169
+ msgstr ""
3170
+
3171
+ #: views/tools/diagnostics/information.php:124
3172
+ msgid "No Duplicator installer files found on this WordPress Site."
3173
+ msgstr ""
3174
+
3175
+ #: views/tools/diagnostics/information.php:131
3176
+ msgid "Security Notes"
3177
+ msgstr ""
3178
+
3179
+ #: views/tools/diagnostics/information.php:132
3180
+ msgid "If the installer files do not successfully get removed with this action, then they WILL need to be removed manually through your hosts control panel or FTP. Please remove all installer files to avoid any security issues on this site. For more details please visit the FAQ link <a href=\"https://snapcreek.com/duplicator/docs/faqs-tech/#faq-installer-295-q\" target=\"_blank\">Which files need to be removed after an install?</a>"
3181
+ msgstr ""
3182
+
3183
+ #: views/tools/diagnostics/information.php:139
3184
+ msgid "Some of the installer files did not get removed, "
3185
+ msgstr ""
3186
+
3187
+ #: views/tools/diagnostics/information.php:141
3188
+ msgid "please retry the installer cleanup process"
3189
+ msgstr ""
3190
+
3191
+ #: views/tools/diagnostics/information.php:143
3192
+ msgid " If this process continues please see the previous FAQ link."
3193
+ msgstr ""
3194
+
3195
+ #: views/tools/diagnostics/information.php:147
3196
+ msgid "Help Support Duplicator"
3197
+ msgstr ""
3198
+
3199
+ #: views/tools/diagnostics/information.php:148
3200
+ msgid "The Duplicator team has worked many years to make moving a WordPress site a much easier process. Show your support with a <a href=\"https://wordpress.org/support/plugin/duplicator/reviews/?filter=5\" target=\"_blank\">5 star review</a>! We would be thrilled if you could!"
3201
+ msgstr ""
3202
+
3203
+ #: views/tools/diagnostics/information.php:158
3204
+ msgid "Please test the entire site to validate the migration process!"
3205
+ msgstr ""
3206
+
3207
+ #: views/tools/diagnostics/information.php:164
3208
+ msgid "NOTICE: Safe mode (Basic) was enabled during install, be sure to re-enable all your plugins."
3209
+ msgstr ""
3210
+
3211
+ #: views/tools/diagnostics/information.php:169
3212
+ msgid "NOTICE: Safe mode (Advanced) was enabled during install, be sure to re-enable all your plugins."
3213
+ msgstr ""
3214
+
3215
+ #: views/tools/diagnostics/information.php:211
3216
+ msgid "Plugin settings reset."
3217
+ msgstr ""
3218
+
3219
+ #: views/tools/diagnostics/information.php:212
3220
+ msgid "View state settings reset."
3221
+ msgstr ""
3222
+
3223
+ #: views/tools/diagnostics/information.php:213
3224
+ msgid "Active package settings reset."
3225
+ msgstr ""
3226
+
3227
+ #: views/tools/diagnostics/logging.php:155
3228
+ msgid "Log file not found or unreadable"
3229
+ msgstr ""
3230
+
3231
+ #: views/tools/diagnostics/logging.php:156
3232
+ msgid "Try to create a package, since no log files were found in the snapshots directory with the extension *.log"
3233
+ msgstr ""
3234
+
3235
+ #: views/tools/diagnostics/logging.php:157
3236
+ msgid "Reasons for log file not showing"
3237
+ msgstr ""
3238
+
3239
+ #: views/tools/diagnostics/logging.php:158
3240
+ msgid "The web server does not support returning .log file extentions"
3241
+ msgstr ""
3242
+
3243
+ #: views/tools/diagnostics/logging.php:159
3244
+ msgid "The snapshots directory does not have the correct permissions to write files. Try setting the permissions to 755"
3245
+ msgstr ""
3246
+
3247
+ #: views/tools/diagnostics/logging.php:160
3248
+ msgid "The process that PHP runs under does not have enough permissions to create files. Please contact your hosting provider for more details"
3249
+ msgstr ""
3250
+
3251
+ #: views/tools/diagnostics/logging.php:174
3252
+ msgid "Consider our recommended"
3253
+ msgstr ""
3254
+
3255
+ #: views/tools/diagnostics/logging.php:176
3256
+ msgid "if you’re unhappy with your current provider"
3257
+ msgstr ""
3258
+
3259
+ #: views/tools/diagnostics/logging.php:180
3260
+ #: views/tools/diagnostics/logging.php:185
3261
+ msgid "Options"
3262
+ msgstr ""
3263
+
3264
+ #: views/tools/diagnostics/logging.php:187
3265
+ msgid "Refresh"
3266
+ msgstr ""
3267
+
3268
+ #: views/tools/diagnostics/logging.php:190
3269
+ msgid "Auto Refresh"
3270
+ msgstr ""
3271
+
3272
+ #: views/tools/diagnostics/logging.php:196
3273
+ msgid "Package Logs"
3274
+ msgstr ""
3275
+
3276
+ #: views/tools/diagnostics/logging.php:197
3277
+ msgid "Top 20"
3278
+ msgstr ""
3279
+
3280
+ #: views/tools/diagnostics/main.php:40
3281
+ msgid "Information"
3282
+ msgstr ""
3283
+
3284
+ #: views/tools/diagnostics/main.php:41
3285
+ msgid "Logs"
3286
+ msgstr ""
3287
+
3288
+ #: views/tools/diagnostics/support.php:29
3289
+ msgid "Migrating WordPress is a complex process and the logic to make all the magic happen smoothly may not work quickly with every site. With over 30,000 plugins and a very complex server eco-system some migrations may run into issues. This is why the Duplicator includes a detailed knowledgebase that can help with many common issues. Resources to additional support, approved hosting, and alternatives to fit your needs can be found below."
3290
+ msgstr ""
3291
+
3292
+ #: views/tools/diagnostics/support.php:41
3293
+ msgid "Knowledgebase"
3294
+ msgstr ""
3295
+
3296
+ #: views/tools/diagnostics/support.php:44
3297
+ msgid "Complete Online Documentation"
3298
+ msgstr ""
3299
+
3300
+ #: views/tools/diagnostics/support.php:46
3301
+ msgid "Choose A Section"
3302
+ msgstr ""
3303
+
3304
+ #: views/tools/diagnostics/support.php:47
3305
+ msgid "Quick Start"
3306
+ msgstr ""
3307
+
3308
+ #: views/tools/diagnostics/support.php:49
3309
+ msgid "User Guide"
3310
+ msgstr ""
3311
+
3312
+ #: views/tools/diagnostics/support.php:51
3313
+ msgid "FAQs"
3314
+ msgstr ""
3315
+
3316
+ #: views/tools/diagnostics/support.php:53
3317
+ msgid "Change Log"
3318
+ msgstr ""
3319
+
3320
+ #: views/tools/diagnostics/support.php:63
3321
+ msgid "Online Support"
3322
+ msgstr ""
3323
+
3324
+ #: views/tools/diagnostics/support.php:66
3325
+ msgid "Get Help From IT Professionals"
3326
+ msgstr ""
3327
+
3328
+ #: views/tools/diagnostics/support.php:70
3329
+ msgid "Get Support!"
3330
+ msgstr ""
3331
+
3332
+ #: views/tools/diagnostics/support.php:84
3333
+ msgid "Approved Hosting"
3334
+ msgstr ""
3335
+
3336
+ #: views/tools/diagnostics/support.php:87
3337
+ msgid "Servers That Work With Duplicator"
3338
+ msgstr ""
3339
+
3340
+ #: views/tools/diagnostics/support.php:90
3341
+ msgid "Trusted Providers!"
3342
+ msgstr ""
3343
+
3344
+ #: views/tools/diagnostics/support.php:101
3345
+ msgid "Alternatives"
3346
+ msgstr ""
3347
+
3348
+ #: views/tools/diagnostics/support.php:104
3349
+ msgid "Other Commercial Resources"
3350
+ msgstr ""
3351
+
3352
+ #: views/tools/diagnostics/support.php:107
3353
+ msgid "Pro Solutions!"
3354
+ msgstr ""
3355
+
3356
+ #: views/tools/templates.php:13
3357
+ msgid "Templates allow you to customize what you want to include in your site and store it as a re-usable profile."
3358
+ msgstr ""
3359
+
3360
+ #: views/tools/templates.php:15
3361
+ msgid "Save time and create a template that can be applied to a schedule or a custom package setup."
3362
+ msgstr ""
lib/snaplib/class.snaplib.exceptions.php ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ <?php
2
+ if (!class_exists('SnapLib_32BitSizeLimitException')):
3
+ class SnapLib_32BitSizeLimitException extends Exception {}
4
+ endif;
lib/snaplib/class.snaplib.u.util.php CHANGED
@@ -5,6 +5,22 @@
5
  * and open the template in the editor.
6
  */
7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
  if(!class_exists('SnapLibUtil')) {
9
  class SnapLibUtil
10
  {
@@ -159,6 +175,102 @@ class SnapLibUtil
159
  public static function sanitize($input)
160
  {
161
  return filter_var($input, FILTER_SANITIZE_STRING);
162
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
163
  }
164
  }
5
  * and open the template in the editor.
6
  */
7
 
8
+ if ( ! interface_exists( 'JsonSerializable' ) ) {
9
+ define( 'SNAP_WP_JSON_SERIALIZE_COMPATIBLE', true );
10
+ /**
11
+ * JsonSerializable interface.
12
+ *
13
+ * Compatibility shim for PHP <5.4
14
+ *
15
+ * @link https://secure.php.net/jsonserializable
16
+ *
17
+ * @since 4.4.0
18
+ */
19
+ interface JsonSerializable {
20
+ public function jsonSerialize();
21
+ }
22
+ }
23
+
24
  if(!class_exists('SnapLibUtil')) {
25
  class SnapLibUtil
26
  {
175
  public static function sanitize($input)
176
  {
177
  return filter_var($input, FILTER_SANITIZE_STRING);
178
+ }
179
+
180
+ /**
181
+ * Encode a variable into JSON, with some sanity checks.
182
+ *
183
+ * @since 4.1.0
184
+ *
185
+ * @param mixed $data Variable (usually an array or object) to encode as JSON.
186
+ * @param int $options Optional. Options to be passed to json_encode(). Default 0.
187
+ * @param int $depth Optional. Maximum depth to walk through $data. Must be
188
+ * greater than 0. Default 512.
189
+ * @return string|false The JSON encoded string, or false if it cannot be encoded.
190
+ */
191
+ public static function wp_json_encode( $data, $options = 0, $depth = 512 ) {
192
+ /*
193
+ * json_encode() has had extra params added over the years.
194
+ * $options was added in 5.3, and $depth in 5.5.
195
+ * We need to make sure we call it with the correct arguments.
196
+ */
197
+ if ( version_compare( PHP_VERSION, '5.5', '>=' ) ) {
198
+ $args = array( $data, $options, $depth );
199
+ } elseif ( version_compare( PHP_VERSION, '5.3', '>=' ) ) {
200
+ $args = array( $data, $options );
201
+ } else {
202
+ $args = array( $data );
203
+ }
204
+
205
+ // Prepare the data for JSON serialization.
206
+ $args[0] = self::_wp_json_prepare_data( $data );
207
+
208
+ $json = @call_user_func_array( 'json_encode', $args );
209
+
210
+ // If json_encode() was successful, no need to do more sanity checking.
211
+ // ... unless we're in an old version of PHP, and json_encode() returned
212
+ // a string containing 'null'. Then we need to do more sanity checking.
213
+ if ( false !== $json && ( version_compare( PHP_VERSION, '5.5', '>=' ) || false === strpos( $json, 'null' ) ) ) {
214
+ return $json;
215
+ }
216
+
217
+ try {
218
+ $args[0] = _wp_json_sanity_check( $data, $depth );
219
+ } catch ( Exception $e ) {
220
+ return false;
221
+ }
222
+
223
+ return call_user_func_array( 'json_encode', $args );
224
+ }
225
+
226
+ /**
227
+ * Prepares response data to be serialized to JSON.
228
+ *
229
+ * This supports the JsonSerializable interface for PHP 5.2-5.3 as well.
230
+ *
231
+ * @ignore
232
+ * @since 4.4.0
233
+ * @access private
234
+ *
235
+ * @param mixed $data Native representation.
236
+ * @return bool|int|float|null|string|array Data ready for `json_encode()`.
237
+ */
238
+ private static function _wp_json_prepare_data( $data ) {
239
+ if ( ! defined( 'SNAP_WP_JSON_SERIALIZE_COMPATIBLE' ) || SNAP_WP_JSON_SERIALIZE_COMPATIBLE === false || ! defined( 'WP_JSON_SERIALIZE_COMPATIBLE' ) || WP_JSON_SERIALIZE_COMPATIBLE === false ) {
240
+ return $data;
241
+ }
242
+
243
+ switch ( gettype( $data ) ) {
244
+ case 'boolean':
245
+ case 'integer':
246
+ case 'double':
247
+ case 'string':
248
+ case 'NULL':
249
+ // These values can be passed through.
250
+ return $data;
251
+
252
+ case 'array':
253
+ // Arrays must be mapped in case they also return objects.
254
+ return array_map( 'self::_wp_json_prepare_data', $data );
255
+
256
+ case 'object':
257
+ // If this is an incomplete object (__PHP_Incomplete_Class), bail.
258
+ if ( ! is_object( $data ) ) {
259
+ return null;
260
+ }
261
+
262
+ if ( $data instanceof JsonSerializable ) {
263
+ $data = $data->jsonSerialize();
264
+ } else {
265
+ $data = get_object_vars( $data );
266
+ }
267
+
268
+ // Now, pass the array (or whatever was returned from jsonSerialize through).
269
+ return self::_wp_json_prepare_data( $data );
270
+
271
+ default:
272
+ return null;
273
+ }
274
+ }
275
  }
276
  }
lib/snaplib/class.snaplib.u.wp.php ADDED
@@ -0,0 +1,134 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Wordpress utility functions
4
+ *
5
+ * Standard: PSR-2
6
+ * @link http://www.php-fig.org/psr/psr-2
7
+ *
8
+ * @package snaplib
9
+ * @subpackage classes/utilities
10
+ * @copyright (c) 2017, Snapcreek LLC
11
+ * @license https://opensource.org/licenses/GPL-3.0 GNU Public License
12
+ *
13
+ */
14
+ /**
15
+ * Wordpress utility functions
16
+ */
17
+ if (!class_exists('SnapLibUtilWp')) {
18
+
19
+ /**
20
+ * Wordpress utility functions
21
+ */
22
+ class SnapLibUtilWp
23
+ {
24
+ const PATH_FULL = 0;
25
+ const PATH_RELATIVE = 1;
26
+ const PATH_AUTO = 2;
27
+
28
+ private static $corePathList = null;
29
+ private static $safeAbsPath = null;
30
+
31
+ /**
32
+ * return safe ABSPATH without last /
33
+ * perform safe function only one time
34
+ *
35
+ * @return string
36
+ */
37
+ public static function getSafeAbsPath()
38
+ {
39
+ if (is_null(self::$safeAbsPath)) {
40
+ if (defined('ABSPATH')) {
41
+ self::$safeAbsPath = rtrim(SnapLibIOU::safePath(ABSPATH), '/');
42
+ } else {
43
+ self::$safeAbsPath = '';
44
+ }
45
+ }
46
+
47
+ return self::$safeAbsPath;
48
+ }
49
+
50
+ /**
51
+ * check if path is in wordpress core list
52
+ *
53
+ * @param string $path
54
+ * @param int $fullPath // if PATH_AUTO check if is a full path or relative path
55
+ * if PATH_FULL remove ABSPATH len without check
56
+ * if PATH_RELATIVE consider path a relative path
57
+ * @param bool $isSafe // if false call rtrim(SnapLibIOU::safePath( PATH ), '/')
58
+ * if true consider path a safe path without check
59
+ *
60
+ * PATH_FULL and PATH_RELATIVE is better optimized and perform less operations
61
+ *
62
+ * @return boolean
63
+ */
64
+ public static function isWpCore($path, $fullPath = self::PATH_AUTO, $isSafe = false)
65
+ {
66
+ if ($isSafe == false) {
67
+ $path = rtrim(SnapLibIOU::safePath($path), '/');
68
+ }
69
+
70
+
71
+
72
+ switch ($fullPath) {
73
+ case self::PATH_FULL:
74
+ $absPath = self::getSafeAbsPath();
75
+ if (strlen($path) < strlen($absPath)) {
76
+ return false;
77
+ }
78
+ $relPath = ltrim(substr($path, strlen($absPath)), '/');
79
+ break;
80
+ case self::PATH_RELATIVE:
81
+ $relPath = ltrim($path, '/');
82
+ break;
83
+ case self::PATH_AUTO:
84
+ default:
85
+ $absPath = self::getSafeAbsPath();
86
+ if (strpos($path, $absPath) === 0) {
87
+ $relPath = ltrim(substr($path, strlen($absPath)), '/');
88
+ } else {
89
+ $relPath = ltrim($path, '/');
90
+ }
91
+ }
92
+
93
+ // if rel path is empty is consider root path so is a core folder.
94
+ if (empty($relPath)) {
95
+ return true;
96
+ }
97
+
98
+ $pExploded = explode('/', $relPath);
99
+ $corePaths = self::getCorePathsList();
100
+
101
+ foreach ($pExploded as $current) {
102
+ if (!isset($corePaths[$current])) {
103
+ return false;
104
+ }
105
+
106
+ $corePaths = $corePaths[$current];
107
+ }
108
+ return true;
109
+ }
110
+
111
+ /**
112
+ * get core path list from relative abs path
113
+ * [
114
+ * 'folder' => [
115
+ * 's-folder1' => [
116
+ * file1 => [],
117
+ * file2 => [],
118
+ * ],
119
+ * 's-folder2' => [],
120
+ * file1 => []
121
+ * ]
122
+ * ]
123
+ *
124
+ * @return array
125
+ */
126
+ public static function getCorePathsList()
127
+ {
128
+ if (is_null(self::$corePathList)) {
129
+ require_once(dirname(__FILE__).'/wordpress.core.files.php');
130
+ }
131
+ return self::$corePathList;
132
+ }
133
+ }
134
+ }
lib/snaplib/snaplib.all.php CHANGED
@@ -1,4 +1,5 @@
1
  <?php
 
2
  require_once(dirname(__FILE__).'/class.snaplib.logger.php');
3
  require_once(dirname(__FILE__).'/class.snaplib.u.util.php');
4
  require_once(dirname(__FILE__).'/class.snaplib.u.io.php');
@@ -7,4 +8,5 @@ require_once(dirname(__FILE__).'/class.snaplib.u.os.php');
7
  require_once(dirname(__FILE__).'/class.snaplib.u.stream.php');
8
  require_once(dirname(__FILE__).'/class.snaplib.u.string.php');
9
  require_once(dirname(__FILE__).'/class.snaplib.u.ui.php');
10
- require_once(dirname(__FILE__).'/class.snaplib.u.url.php');
 
1
  <?php
2
+ require_once(dirname(__FILE__).'/class.snaplib.exceptions.php');
3
  require_once(dirname(__FILE__).'/class.snaplib.logger.php');
4
  require_once(dirname(__FILE__).'/class.snaplib.u.util.php');
5
  require_once(dirname(__FILE__).'/class.snaplib.u.io.php');
8
  require_once(dirname(__FILE__).'/class.snaplib.u.stream.php');
9
  require_once(dirname(__FILE__).'/class.snaplib.u.string.php');
10
  require_once(dirname(__FILE__).'/class.snaplib.u.ui.php');
11
+ require_once(dirname(__FILE__).'/class.snaplib.u.url.php');
12
+ require_once(dirname(__FILE__).'/class.snaplib.u.wp.php');
lib/snaplib/wordpress.core.files.php ADDED
@@ -0,0 +1,1765 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Core wordpress file list
4
+ *
5
+ * Standard: PSR-2
6
+ * @link http://www.php-fig.org/psr/psr-2
7
+ *
8
+ * @package snaplib
9
+ * @subpackage classes/utilities
10
+ * @copyright (c) 2017, Snapcreek LLC
11
+ * @license https://opensource.org/licenses/GPL-3.0 GNU Public License
12
+ *
13
+ */
14
+
15
+ /*
16
+ * This file is autogenerated don't modify this directly
17
+ * Use the generator script
18
+ *
19
+ */
20
+ self::$corePathList = array(
21
+ 'wp-signup.php' => array(),
22
+ 'wp-includes' => array(
23
+ 'blocks.php' => array(),
24
+ 'comment.php' => array(),
25
+ 'class-wp-roles.php' => array(),
26
+ 'class-wp-role.php' => array(),
27
+ 'media.php' => array(),
28
+ 'class-wp-widget.php' => array(),
29
+ 'ms-default-filters.php' => array(),
30
+ 'class-pop3.php' => array(),
31
+ 'class-wp-taxonomy.php' => array(),
32
+ 'class-wp-xmlrpc-server.php' => array(),
33
+ 'class-wp-site-query.php' => array(),
34
+ 'post-template.php' => array(),
35
+ 'class-wp-feed-cache-transient.php' => array(),
36
+ 'feed-rss.php' => array(),
37
+ 'class-wp-customize-control.php' => array(),
38
+ 'functions.wp-styles.php' => array(),
39
+ 'registration-functions.php' => array(),
40
+ 'deprecated.php' => array(),
41
+ 'class-wp-post.php' => array(),
42
+ 'class-wp-customize-section.php' => array(),
43
+ 'feed-rss2.php' => array(),
44
+ 'functions.php' => array(),
45
+ 'post.php' => array(),
46
+ 'class-wp-list-util.php' => array(),
47
+ 'class-snoopy.php' => array(),
48
+ 'ms-load.php' => array(),
49
+ 'class-feed.php' => array(),
50
+ 'ms-deprecated.php' => array(),
51
+ 'class-wp-http-proxy.php' => array(),
52
+ 'feed-atom-comments.php' => array(),
53
+ 'class-walker-category.php' => array(),
54
+ 'wp-db.php' => array(),
55
+ 'rest-api' => array(
56
+ 'class-wp-rest-request.php' => array(),
57
+ 'endpoints' => array(
58
+ 'class-wp-rest-controller.php' => array(),
59
+ 'class-wp-rest-posts-controller.php' => array(),
60
+ 'class-wp-rest-settings-controller.php' => array(),
61
+ 'class-wp-rest-users-controller.php' => array(),
62
+ 'class-wp-rest-blocks-controller.php' => array(),
63
+ 'class-wp-rest-revisions-controller.php' => array(),
64
+ 'class-wp-rest-taxonomies-controller.php' => array(),
65
+ 'class-wp-rest-post-statuses-controller.php' => array(),
66
+ 'class-wp-rest-attachments-controller.php' => array(),
67
+ 'class-wp-rest-block-renderer-controller.php' => array(),
68
+ 'class-wp-rest-terms-controller.php' => array(),
69
+ 'class-wp-rest-comments-controller.php' => array(),
70
+ 'class-wp-rest-themes-controller.php' => array(),
71
+ 'class-wp-rest-autosaves-controller.php' => array(),
72
+ 'class-wp-rest-search-controller.php' => array(),
73
+ 'class-wp-rest-post-types-controller.php' => array()
74
+ ),
75
+ 'search' => array(
76
+ 'class-wp-rest-post-search-handler.php' => array(),
77
+ 'class-wp-rest-search-handler.php' => array()
78
+ ),
79
+ 'class-wp-rest-response.php' => array(),
80
+ 'class-wp-rest-server.php' => array(),
81
+ 'fields' => array(
82
+ 'class-wp-rest-term-meta-fields.php' => array(),
83
+ 'class-wp-rest-post-meta-fields.php' => array(),
84
+ 'class-wp-rest-user-meta-fields.php' => array(),
85
+ 'class-wp-rest-meta-fields.php' => array(),
86
+ 'class-wp-rest-comment-meta-fields.php' => array()
87
+ )
88
+ ),
89
+ 'media-template.php' => array(),
90
+ 'update.php' => array(),
91
+ 'class-wp-comment-query.php' => array(),
92
+ 'class-wp-feed-cache.php' => array(),
93
+ 'widgets' => array(
94
+ 'class-wp-widget-media-image.php' => array(),
95
+ 'class-wp-widget-archives.php' => array(),
96
+ 'class-wp-widget-rss.php' => array(),
97
+ 'class-wp-widget-media-audio.php' => array(),
98
+ 'class-wp-nav-menu-widget.php' => array(),
99
+ 'class-wp-widget-text.php' => array(),
100
+ 'class-wp-widget-media-gallery.php' => array(),
101
+ 'class-wp-widget-search.php' => array(),
102
+ 'class-wp-widget-recent-posts.php' => array(),
103
+ 'class-wp-widget-media-video.php' => array(),
104
+ 'class-wp-widget-pages.php' => array(),
105
+ 'class-wp-widget-media.php' => array(),
106
+ 'class-wp-widget-tag-cloud.php' => array(),
107
+ 'class-wp-widget-categories.php' => array(),
108
+ 'class-wp-widget-recent-comments.php' => array(),
109
+ 'class-wp-widget-calendar.php' => array(),
110
+ 'class-wp-widget-links.php' => array(),
111
+ 'class-wp-widget-custom-html.php' => array(),
112
+ 'class-wp-widget-meta.php' => array()
113
+ ),
114
+ 'rewrite.php' => array(),
115
+ 'widgets.php' => array(),
116
+ 'class-wp-customize-widgets.php' => array(),
117
+ 'pomo' => array(
118
+ 'streams.php' => array(),
119
+ 'mo.php' => array(),
120
+ 'plural-forms.php' => array(),
121
+ 'po.php' => array(),
122
+ 'translations.php' => array(),
123
+ 'entry.php' => array()
124
+ ),
125
+ 'vars.php' => array(),
126
+ 'option.php' => array(),
127
+ 'class-wp-customize-manager.php' => array(),
128
+ 'certificates' => array(
129
+ 'ca-bundle.crt' => array()
130
+ ),
131
+ 'query.php' => array(),
132
+ 'class-wp-editor.php' => array(),
133
+ 'IXR' => array(
134
+ 'class-IXR-error.php' => array(),
135
+ 'class-IXR-introspectionserver.php' => array(),
136
+ 'class-IXR-date.php' => array(),
137
+ 'class-IXR-server.php' => array(),
138
+ 'class-IXR-clientmulticall.php' => array(),
139
+ 'class-IXR-base64.php' => array(),
140
+ 'class-IXR-message.php' => array(),
141
+ 'class-IXR-request.php' => array(),
142
+ 'class-IXR-value.php' => array(),
143
+ 'class-IXR-client.php' => array()
144
+ ),
145
+ 'class-wp-image-editor-imagick.php' => array(),
146
+ 'atomlib.php' => array(),
147
+ 'class-wp-term-query.php' => array(),
148
+ 'load.php' => array(),
149
+ 'default-widgets.php' => array(),
150
+ 'class-wp-http-encoding.php' => array(),
151
+ 'class-wp-term.php' => array(),
152
+ 'comment-template.php' => array(),
153
+ 'random_compat' => array(
154
+ 'random_bytes_libsodium_legacy.php' => array(),
155
+ 'error_polyfill.php' => array(),
156
+ 'random.php' => array(),
157
+ 'random_bytes_dev_urandom.php' => array(),
158
+ 'random_bytes_com_dotnet.php' => array(),
159
+ 'random_bytes_mcrypt.php' => array(),
160
+ 'cast_to_int.php' => array(),
161
+ 'random_bytes_openssl.php' => array(),
162
+ 'random_bytes_libsodium.php' => array(),
163
+ 'random_int.php' => array(),
164
+ 'byte_safe_strings.php' => array()
165
+ ),
166
+ 'class-wp-locale-switcher.php' => array(),
167
+ 'class-wp-theme.php' => array(),
168
+ 'Requests' => array(
169
+ 'Proxy' => array(
170
+ 'HTTP.php' => array()
171
+ ),
172
+ 'Response' => array(
173
+ 'Headers.php' => array()
174
+ ),
175
+ 'Hooks.php' => array(),
176
+ 'Exception' => array(
177
+ 'HTTP.php' => array(),
178
+ 'HTTP' => array(
179
+ '431.php' => array(),
180
+ '404.php' => array(),
181
+ 'Unknown.php' => array(),
182
+ '412.php' => array(),
183
+ '403.php' => array(),
184
+ '429.php' => array(),
185
+ '415.php' => array(),
186
+ '408.php' => array(),
187
+ '500.php' => array(),
188
+ '405.php' => array(),
189
+ '505.php' => array(),
190
+ '511.php' => array(),
191
+ '407.php' => array(),
192
+ '400.php' => array(),
193
+ '306.php' => array(),
194
+ '305.php' => array(),
195
+ '402.php' => array(),
196
+ '401.php' => array(),
197
+ '503.php' => array(),
198
+ '411.php' => array(),
199
+ '417.php' => array(),
200
+ '428.php' => array(),
201
+ '414.php' => array(),
202
+ '416.php' => array(),
203
+ '413.php' => array(),
204
+ '502.php' => array(),
205
+ '410.php' => array(),
206
+ '406.php' => array(),
207
+ '304.php' => array(),
208
+ '504.php' => array(),
209
+ '501.php' => array(),
210
+ '418.php' => array(),
211
+ '409.php' => array()
212
+ ),
213
+ 'Transport' => array(
214
+ 'cURL.php' => array()
215
+ ),
216
+ 'Transport.php' => array()
217
+ ),
218
+ 'SSL.php' => array(),
219
+ 'IDNAEncoder.php' => array(),
220
+ 'Transport' => array(
221
+ 'fsockopen.php' => array(),
222
+ 'cURL.php' => array()
223
+ ),
224
+ 'Exception.php' => array(),
225
+ 'Response.php' => array(),
226
+ 'Auth' => array(
227
+ 'Basic.php' => array()
228
+ ),
229
+ 'Transport.php' => array(),
230
+ 'IPv6.php' => array(),
231
+ 'Utility' => array(
232
+ 'FilteredIterator.php' => array(),
233
+ 'CaseInsensitiveDictionary.php' => array()
234
+ ),
235
+ 'Auth.php' => array(),
236
+ 'Hooker.php' => array(),
237
+ 'IRI.php' => array(),
238
+ 'Proxy.php' => array(),
239
+ 'Session.php' => array(),
240
+ 'Cookie.php' => array(),
241
+ 'Cookie' => array(
242
+ 'Jar.php' => array()
243
+ )
244
+ ),
245
+ 'ms-settings.php' => array(),
246
+ 'nav-menu.php' => array(),
247
+ 'ms-files.php' => array(),
248
+ 'embed.php' => array(),
249
+ 'cron.php' => array(),
250
+ 'class-wp-customize-panel.php' => array(),
251
+ 'wlwmanifest.xml' => array(),
252
+ 'class-wp-http-requests-hooks.php' => array(),
253
+ 'default-filters.php' => array(),
254
+ 'class-wp-network.php' => array(),
255
+ 'category-template.php' => array(),
256
+ 'class-walker-category-dropdown.php' => array(),
257
+ 'class-wp-http-streams.php' => array(),
258
+ 'class-wp-network-query.php' => array(),
259
+ 'feed.php' => array(),
260
+ 'session.php' => array(),
261
+ 'class-wp-embed.php' => array(),
262
+ 'class-wp-ajax-response.php' => array(),
263
+ 'class-wp-error.php' => array(),
264
+ 'class-wp-user-query.php' => array(),
265
+ 'class.wp-scripts.php' => array(),
266
+ 'class-wp-http-response.php' => array(),
267
+ 'class-walker-nav-menu.php' => array(),
268
+ 'ID3' => array(
269
+ 'module.audio-video.flv.php' => array(),
270
+ 'license.commercial.txt' => array(),
271
+ 'module.audio.flac.php' => array(),
272
+ 'module.audio-video.matroska.php' => array(),
273
+ 'module.tag.lyrics3.php' => array(),
274
+ 'module.audio-video.quicktime.php' => array(),
275
+ 'module.tag.id3v1.php' => array(),
276
+ 'module.audio.ogg.php' => array(),
277
+ 'module.audio.ac3.php' => array(),
278
+ 'getid3.php' => array(),
279
+ 'readme.txt' => array(),
280
+ 'getid3.lib.php' => array(),
281
+ 'module.audio.dts.php' => array(),
282
+ 'module.audio.mp3.php' => array(),
283
+ 'module.audio-video.asf.php' => array(),
284
+ 'module.audio-video.riff.php' => array(),
285
+ 'module.tag.apetag.php' => array(),
286
+ 'license.txt' => array(),
287
+ 'module.tag.id3v2.php' => array()
288
+ ),
289
+ 'class-walker-comment.php' => array(),
290
+ 'locale.php' => array(),
291
+ 'class-phpmailer.php' => array(),
292
+ 'theme.php' => array(),
293
+ 'kses.php' => array(),
294
+ 'ms-functions.php' => array(),
295
+ 'class-wp-block-type-registry.php' => array(),
296
+ 'spl-autoload-compat.php' => array(),
297
+ 'taxonomy.php' => array(),
298
+ 'class-walker-page.php' => array(),
299
+ 'feed-atom.php' => array(),
300
+ 'class-wp-metadata-lazyloader.php' => array(),
301
+ 'class.wp-dependencies.php' => array(),
302
+ 'class-walker-page-dropdown.php' => array(),
303
+ 'pluggable-deprecated.php' => array(),
304
+ 'embed-template.php' => array(),
305
+ 'capabilities.php' => array(),
306
+ 'post-thumbnail-template.php' => array(),
307
+ 'class.wp-styles.php' => array(),
308
+ 'class-wp-simplepie-sanitize-kses.php' => array(),
309
+ 'class-smtp.php' => array(),
310
+ 'class-wp-customize-setting.php' => array(),
311
+ 'template-loader.php' => array(),
312
+ 'class-wp-hook.php' => array(),
313
+ 'canonical.php' => array(),
314
+ 'class-wp-http-curl.php' => array(),
315
+ 'images' => array(
316
+ 'spinner.gif' => array(),
317
+ 'down_arrow-2x.gif' => array(),
318
+ 'media' => array(
319
+ 'interactive.png' => array(),
320
+ 'archive.png' => array(),
321
+ 'audio.png' => array(),
322
+ 'default.png' => array(),
323
+ 'text.png' => array(),
324
+ 'video.png' => array(),
325
+ 'spreadsheet.png' => array(),
326
+ 'code.png' => array(),
327
+ 'document.png' => array()
328
+ ),
329
+ 'toggle-arrow-2x.png' => array(),
330
+ 'admin-bar-sprite-2x.png' => array(),
331
+ 'wpicons.png' => array(),
332
+ 'wlw' => array(
333
+ 'wp-icon.png' => array(),
334
+ 'wp-comments.png' => array(),
335
+ 'wp-watermark.png' => array()
336
+ ),
337
+ 'uploader-icons-2x.png' => array(),
338
+ 'down_arrow.gif' => array(),
339
+ 'rss.png' => array(),
340
+ 'rss-2x.png' => array(),
341
+ 'wpspin-2x.gif' => array(),
342
+ 'arrow-pointer-blue.png' => array(),
343
+ 'icon-pointer-flag-2x.png' => array(),
344
+ 'spinner-2x.gif' => array(),
345
+ 'xit-2x.gif' => array(),
346
+ 'arrow-pointer-blue-2x.png' => array(),
347
+ 'smilies' => array(
348
+ 'icon_biggrin.gif' => array(),
349
+ 'icon_sad.gif' => array(),
350
+ 'icon_question.gif' => array(),
351
+ 'icon_lol.gif' => array(),
352
+ 'mrgreen.png' => array(),
353
+ 'icon_exclaim.gif' => array(),
354
+ 'frownie.png' => array(),
355
+ 'icon_rolleyes.gif' => array(),
356
+ 'icon_twisted.gif' => array(),
357
+ 'icon_surprised.gif' => array(),
358
+ 'icon_confused.gif' => array(),
359
+ 'icon_smile.gif' => array(),
360
+ 'icon_cool.gif' => array(),
361
+ 'icon_wink.gif' => array(),
362
+ 'icon_idea.gif' => array(),
363
+ 'icon_eek.gif' => array(),
364
+ 'icon_neutral.gif' => array(),
365
+ 'simple-smile.png' => array(),
366
+ 'icon_arrow.gif' => array(),
367
+ 'icon_redface.gif' => array(),
368
+ 'rolleyes.png' => array(),
369
+ 'icon_cry.gif' => array(),
370
+ 'icon_razz.gif' => array(),
371
+ 'icon_evil.gif' => array(),
372
+ 'icon_mad.gif' => array(),
373
+ 'icon_mrgreen.gif' => array()
374
+ ),
375
+ 'admin-bar-sprite.png' => array(),
376
+ 'w-logo-blue.png' => array(),
377
+ 'crystal' => array(
378
+ 'interactive.png' => array(),
379
+ 'archive.png' => array(),
380
+ 'audio.png' => array(),
381
+ 'default.png' => array(),
382
+ 'text.png' => array(),
383
+ 'video.png' => array(),
384
+ 'spreadsheet.png' => array(),
385
+ 'license.txt' => array(),
386
+ 'code.png' => array(),
387
+ 'document.png' => array()
388
+ ),
389
+ 'xit.gif' => array(),
390
+ 'uploader-icons.png' => array(),
391
+ 'icon-pointer-flag.png' => array(),
392
+ 'wpicons-2x.png' => array(),
393
+ 'blank.gif' => array(),
394
+ 'toggle-arrow.png' => array(),
395
+ 'wpspin.gif' => array()
396
+ ),
397
+ 'class-oembed.php' => array(),
398
+ 'nav-menu-template.php' => array(),
399
+ 'registration.php' => array(),
400
+ 'class-wp-image-editor.php' => array(),
401
+ 'class-wp-oembed-controller.php' => array(),
402
+ 'functions.wp-scripts.php' => array(),
403
+ 'default-constants.php' => array(),
404
+ 'script-loader.php' => array(),
405
+ 'customize' => array(
406
+ 'class-wp-customize-new-menu-control.php' => array(),
407
+ 'class-wp-customize-filter-setting.php' => array(),
408
+ 'class-wp-customize-new-menu-section.php' => array(),
409
+ 'class-wp-customize-header-image-control.php' => array(),
410
+ 'class-wp-customize-nav-menu-setting.php' => array(),
411
+ 'class-wp-widget-area-customize-control.php' => array(),
412
+ 'class-wp-customize-nav-menu-locations-control.php' => array(),
413
+ 'class-wp-customize-partial.php' => array(),
414
+ 'class-wp-customize-background-image-setting.php' => array(),
415
+ 'class-wp-customize-nav-menu-control.php' => array(),
416
+ 'class-wp-customize-upload-control.php' => array(),
417
+ 'class-wp-customize-sidebar-section.php' => array(),
418
+ 'class-wp-customize-nav-menu-item-setting.php' => array(),
419
+ 'class-wp-customize-header-image-setting.php' => array(),
420
+ 'class-wp-customize-nav-menu-item-control.php' => array(),
421
+ 'class-wp-customize-background-image-control.php' => array(),
422
+ 'class-wp-customize-date-time-control.php' => array(),
423
+ 'class-wp-customize-image-control.php' => array(),
424
+ 'class-wp-widget-form-customize-control.php' => array(),
425
+ 'class-wp-customize-nav-menus-panel.php' => array(),
426
+ 'class-wp-customize-background-position-control.php' => array(),
427
+ 'class-wp-customize-site-icon-control.php' => array(),
428
+ 'class-wp-customize-color-control.php' => array(),
429
+ 'class-wp-customize-cropped-image-control.php' => array(),
430
+ 'class-wp-customize-theme-control.php' => array(),
431
+ 'class-wp-customize-themes-panel.php' => array(),
432
+ 'class-wp-customize-nav-menu-location-control.php' => array(),
433
+ 'class-wp-customize-selective-refresh.php' => array(),
434
+ 'class-wp-customize-custom-css-setting.php' => array(),
435
+ 'class-wp-customize-themes-section.php' => array(),
436
+ 'class-wp-customize-nav-menu-section.php' => array(),
437
+ 'class-wp-customize-code-editor-control.php' => array(),
438
+ 'class-wp-customize-media-control.php' => array(),
439
+ 'class-wp-customize-nav-menu-name-control.php' => array(),
440
+ 'class-wp-customize-nav-menu-auto-add-control.php' => array()
441
+ ),
442
+ 'class-wp-session-tokens.php' => array(),
443
+ 'feed-rss2-comments.php' => array(),
444
+ 'class-wp-walker.php' => array(),
445
+ 'shortcodes.php' => array(),
446
+ 'class-wp-user.php' => array(),
447
+ 'general-template.php' => array(),
448
+ 'class-wp-http-cookie.php' => array(),
449
+ 'class-wp-dependency.php' => array(),
450
+ 'link-template.php' => array(),
451
+ 'class-wp-widget-factory.php' => array(),
452
+ 'post-formats.php' => array(),
453
+ 'class-wp-user-meta-session-tokens.php' => array(),
454
+ 'ms-blogs.php' => array(),
455
+ 'class-wp-admin-bar.php' => array(),
456
+ 'theme-compat' => array(
457
+ 'footer.php' => array(),
458
+ 'embed-content.php' => array(),
459
+ 'embed-404.php' => array(),
460
+ 'sidebar.php' => array(),
461
+ 'footer-embed.php' => array(),
462
+ 'comments.php' => array(),
463
+ 'embed.php' => array(),
464
+ 'header-embed.php' => array(),
465
+ 'header.php' => array()
466
+ ),
467
+ 'user.php' => array(),
468
+ 'author-template.php' => array(),
469
+ 'bookmark.php' => array(),
470
+ 'class-wp-simplepie-file.php' => array(),
471
+ 'class-wp-text-diff-renderer-table.php' => array(),
472
+ 'rss.php' => array(),
473
+ 'revision.php' => array(),
474
+ 'class-wp-post-type.php' => array(),
475
+ 'Text' => array(
476
+ 'Diff' => array(
477
+ 'Renderer' => array(
478
+ 'inline.php' => array()
479
+ ),
480
+ 'Engine' => array(
481
+ 'native.php' => array(),
482
+ 'shell.php' => array(),
483
+ 'xdiff.php' => array(),
484
+ 'string.php' => array()
485
+ ),
486
+ 'Renderer.php' => array()
487
+ ),
488
+ 'Diff.php' => array()
489
+ ),
490
+ 'class-wp-rewrite.php' => array(),
491
+ 'class-wp-comment.php' => array(),
492
+ 'class-wp-text-diff-renderer-inline.php' => array(),
493
+ 'rss-functions.php' => array(),
494
+ 'class-simplepie.php' => array(),
495
+ 'version.php' => array(),
496
+ 'class-wp-matchesmapregex.php' => array(),
497
+ 'category.php' => array(),
498
+ 'rest-api.php' => array(),
499
+ 'meta.php' => array(),
500
+ 'class-wp-meta-query.php' => array(),
501
+ 'template.php' => array(),
502
+ 'class-wp-site.php' => array(),
503
+ 'class-wp.php' => array(),
504
+ 'class-wp-block-parser.php' => array(),
505
+ 'cache.php' => array(),
506
+ 'class-wp-block-type.php' => array(),
507
+ 'ms-default-constants.php' => array(),
508
+ 'SimplePie' => array(
509
+ 'Net' => array(
510
+ 'IPv6.php' => array()
511
+ ),
512
+ 'Cache.php' => array(),
513
+ 'HTTP' => array(
514
+ 'Parser.php' => array()
515
+ ),
516
+ 'Rating.php' => array(),
517
+ 'Credit.php' => array(),
518
+ 'Content' => array(
519
+ 'Type' => array(
520
+ 'Sniffer.php' => array()
521
+ )
522
+ ),
523
+ 'Locator.php' => array(),
524
+ 'Caption.php' => array(),
525
+ 'XML' => array(
526
+ 'Declaration' => array(
527
+ 'Parser.php' => array()
528
+ )
529
+ ),
530
+ 'Parse' => array(
531
+ 'Date.php' => array()
532
+ ),
533
+ 'Exception.php' => array(),
534
+ 'Sanitize.php' => array(),
535
+ 'Restriction.php' => array(),
536
+ 'Misc.php' => array(),
537
+ 'Enclosure.php' => array(),
538
+ 'Registry.php' => array(),
539
+ 'Cache' => array(
540
+ 'MySQL.php' => array(),
541
+ 'Memcache.php' => array(),
542
+ 'Base.php' => array(),
543
+ 'DB.php' => array(),
544
+ 'File.php' => array()
545
+ ),
546
+ 'IRI.php' => array(),
547
+ 'Author.php' => array(),
548
+ 'Item.php' => array(),
549
+ 'Copyright.php' => array(),
550
+ 'Source.php' => array(),
551
+ 'File.php' => array(),
552
+ 'Category.php' => array(),
553
+ 'Decode' => array(
554
+ 'HTML' => array(
555
+ 'Entities.php' => array()
556
+ )
557
+ ),
558
+ 'Parser.php' => array(),
559
+ 'Core.php' => array(),
560
+ 'gzdecode.php' => array()
561
+ ),
562
+ 'blocks' => array(
563
+ 'archives.php' => array(),
564
+ 'block.php' => array(),
565
+ 'latest-posts.php' => array(),
566
+ 'categories.php' => array(),
567
+ 'latest-comments.php' => array(),
568
+ 'shortcode.php' => array()
569
+ ),
570
+ 'class-requests.php' => array(),
571
+ 'fonts' => array(
572
+ 'dashicons.woff' => array(),
573
+ 'dashicons.ttf' => array(),
574
+ 'dashicons.svg' => array(),
575
+ 'dashicons.eot' => array()
576
+ ),
577
+ 'plugin.php' => array(),
578
+ 'bookmark-template.php' => array(),
579
+ 'admin-bar.php' => array(),
580
+ 'feed-rdf.php' => array(),
581
+ 'class-http.php' => array(),
582
+ 'date.php' => array(),
583
+ 'class-phpass.php' => array(),
584
+ 'class-json.php' => array(),
585
+ 'class-wp-locale.php' => array(),
586
+ 'http.php' => array(),
587
+ 'class-wp-tax-query.php' => array(),
588
+ 'compat.php' => array(),
589
+ 'pluggable.php' => array(),
590
+ 'css' => array(
591
+ 'wp-pointer-rtl.min.css' => array(),
592
+ 'dist' => array(
593
+ 'format-library' => array(
594
+ 'style.min.css' => array(),
595
+ 'style-rtl.css' => array(),
596
+ 'style.css' => array(),
597
+ 'style-rtl.min.css' => array()
598
+ ),
599
+ 'edit-post' => array(
600
+ 'style.min.css' => array(),
601
+ 'style-rtl.css' => array(),
602
+ 'style.css' => array(),
603
+ 'style-rtl.min.css' => array()
604
+ ),
605
+ 'list-reusable-blocks' => array(
606
+ 'style.min.css' => array(),
607
+ 'style-rtl.css' => array(),
608
+ 'style.css' => array(),
609
+ 'style-rtl.min.css' => array()
610
+ ),
611
+ 'components' => array(
612
+ 'style.min.css' => array(),
613
+ 'style-rtl.css' => array(),
614
+ 'style.css' => array(),
615
+ 'style-rtl.min.css' => array()
616
+ ),
617
+ 'block-library' => array(
618
+ 'style.min.css' => array(),
619
+ 'style-rtl.css' => array(),
620
+ 'theme.min.css' => array(),
621
+ 'theme.css' => array(),
622
+ 'editor-rtl.css' => array(),
623
+ 'editor.min.css' => array(),
624
+ 'theme-rtl.min.css' => array(),
625
+ 'style.css' => array(),
626
+ 'editor.css' => array(),
627
+ 'editor-rtl.min.css' => array(),
628
+ 'theme-rtl.css' => array(),
629
+ 'style-rtl.min.css' => array()
630
+ ),
631
+ 'editor' => array(
632
+ 'style.min.css' => array(),
633
+ 'style-rtl.css' => array(),
634
+ 'editor-styles-rtl.min.css' => array(),
635
+ 'editor-styles.css' => array(),
636
+ 'style.css' => array(),
637
+ 'editor-styles-rtl.css' => array(),
638
+ 'style-rtl.min.css' => array(),
639
+ 'editor-styles.min.css' => array()
640
+ ),
641
+ 'nux' => array(
642
+ 'style.min.css' => array(),
643
+ 'style-rtl.css' => array(),
644
+ 'style.css' => array(),
645
+ 'style-rtl.min.css' => array()
646
+ )
647
+ ),
648
+ 'buttons.css' => array(),
649
+ 'admin-bar.min.css' => array(),
650
+ 'jquery-ui-dialog-rtl.css' => array(),
651
+ 'wp-pointer.min.css' => array(),
652
+ 'admin-bar.css' => array(),
653
+ 'wp-embed-template-ie.min.css' => array(),
654
+ 'customize-preview.min.css' => array(),
655
+ 'editor-rtl.css' => array(),
656
+ 'media-views.min.css' => array(),
657
+ 'customize-preview-rtl.css' => array(),
658
+ 'wp-embed-template.min.css' => array(),
659
+ 'media-views-rtl.min.css' => array(),
660
+ 'editor.min.css' => array(),
661
+ 'media-views-rtl.css' => array(),
662
+ 'wp-embed-template.css' => array(),
663
+ 'customize-preview-rtl.min.css' => array(),
664
+ 'buttons.min.css' => array(),
665
+ 'jquery-ui-dialog.css' => array(),
666
+ 'customize-preview.css' => array(),
667
+ 'media-views.css' => array(),
668
+ 'admin-bar-rtl.min.css' => array(),
669
+ 'wp-auth-check-rtl.css' => array(),
670
+ 'wp-pointer-rtl.css' => array(),
671
+ 'editor.css' => array(),
672
+ 'editor-rtl.min.css' => array(),
673
+ 'admin-bar-rtl.css' => array(),
674
+ 'wp-auth-check.min.css' => array(),
675
+ 'buttons-rtl.min.css' => array(),
676
+ 'wp-embed-template-ie.css' => array(),
677
+ 'jquery-ui-dialog.min.css' => array(),
678
+ 'jquery-ui-dialog-rtl.min.css' => array(),
679
+ 'dashicons.min.css' => array(),
680
+ 'buttons-rtl.css' => array(),
681
+ 'dashicons.css' => array(),
682
+ 'wp-auth-check-rtl.min.css' => array(),
683
+ 'wp-pointer.css' => array(),
684
+ 'wp-auth-check.css' => array()
685
+ ),
686
+ 'wp-diff.php' => array(),
687
+ 'class-wp-query.php' => array(),
688
+ 'class-wp-http-ixr-client.php' => array(),
689
+ 'js' => array(
690
+ 'autosave.min.js' => array(),
691
+ 'tw-sack.js' => array(),
692
+ 'api-request.js' => array(),
693
+ 'media-models.js' => array(),
694
+ 'colorpicker.min.js' => array(),
695
+ 'wp-list-revisions.min.js' => array(),
696
+ 'zxcvbn.min.js' => array(),
697
+ 'mediaelement' => array(
698
+ 'mediaelementplayer.css' => array(),
699
+ 'wp-playlist.min.js' => array(),
700
+ 'wp-playlist.js' => array(),
701
+ 'renderers' => array(
702
+ 'vimeo.js' => array(),
703
+ 'vimeo.min.js' => array()
704
+ ),
705
+ 'wp-mediaelement.css' => array(),
706
+ 'wp-mediaelement.min.css' => array(),
707
+ 'mediaelementplayer-legacy.css' => array(),
708
+ 'mediaelement.js' => array(),
709
+ 'mediaelement-migrate.js' => array(),
710
+ 'mejs-controls.svg' => array(),
711
+ 'mediaelementplayer.min.css' => array(),
712
+ 'mejs-controls.png' => array(),
713
+ 'mediaelement-and-player.min.js' => array(),
714
+ 'wp-mediaelement.min.js' => array(),
715
+ 'mediaelement.min.js' => array(),
716
+ 'mediaelementplayer-legacy.min.css' => array(),
717
+ 'mediaelement-and-player.js' => array(),
718
+ 'wp-mediaelement.js' => array(),
719
+ 'mediaelement-migrate.min.js' => array()
720
+ ),
721
+ 'dist' => array(
722
+ 'api-fetch.min.js' => array(),
723
+ 'viewport.js' => array(),
724
+ 'viewport.min.js' => array(),
725
+ 'format-library.min.js' => array(),
726
+ 'dom-ready.min.js' => array(),
727
+ 'element.min.js' => array(),
728
+ 'list-reusable-blocks.min.js' => array(),
729
+ 'deprecated.js' => array(),
730
+ 'date.min.js' => array(),
731
+ 'i18n.js' => array(),
732
+ 'components.min.js' => array(),
733
+ 'a11y.min.js' => array(),
734
+ 'shortcode.min.js' => array(),
735
+ 'core-data.js' => array(),
736
+ 'list-reusable-blocks.js' => array(),
737
+ 'block-serialization-default-parser.min.js' => array(),
738
+ 'shortcode.js' => array(),
739
+ 'escape-html.min.js' => array(),
740
+ 'keycodes.min.js' => array(),
741
+ 'notices.min.js' => array(),
742
+ 'date.js' => array(),
743
+ 'dom.js' => array(),
744
+ 'edit-post.min.js' => array(),
745
+ 'data.js' => array(),
746
+ 'hooks.js' => array(),
747
+ 'format-library.js' => array(),
748
+ 'blocks.min.js' => array(),
749
+ 'wordcount.js' => array(),
750
+ 'redux-routine.js' => array(),
751
+ 'rich-text.js' => array(),
752
+ 'api-fetch.js' => array(),
753
+ 'annotations.js' => array(),
754
+ 'wordcount.min.js' => array(),
755
+ 'is-shallow-equal.min.js' => array(),
756
+ 'url.min.js' => array(),
757
+ 'nux.js' => array(),
758
+ 'dom-ready.js' => array(),
759
+ 'annotations.min.js' => array(),
760
+ 'compose.js' => array(),
761
+ 'plugins.js' => array(),
762
+ 'url.js' => array(),
763
+ 'html-entities.min.js' => array(),
764
+ 'token-list.js' => array(),
765
+ 'plugins.min.js' => array(),
766
+ 'core-data.min.js' => array(),
767
+ 'edit-post.js' => array(),
768
+ 'is-shallow-equal.js' => array(),
769
+ 'vendor' => array(
770
+ 'wp-polyfill-node-contains.min.js' => array(),
771
+ 'wp-polyfill-fetch.js' => array(),
772
+ 'wp-polyfill-fetch.min.js' => array(),
773
+ 'wp-polyfill-formdata.min.js' => array(),
774
+ 'react-dom.min.js' => array(),
775
+ 'wp-polyfill-element-closest.js' => array(),
776
+ 'react-dom.js' => array(),
777
+ 'wp-polyfill.js' => array(),
778
+ 'react.min.js' => array(),
779
+ 'wp-polyfill-node-contains.js' => array(),
780
+ 'lodash.js' => array(),
781
+ 'react.js' => array(),
782
+ 'wp-polyfill-formdata.js' => array(),
783
+ 'moment.js' => array(),
784
+ 'moment.min.js' => array(),
785
+ 'lodash.min.js' => array(),
786
+ 'wp-polyfill-element-closest.min.js' => array(),
787
+ 'wp-polyfill.min.js' => array()
788
+ ),
789
+ 'block-library.min.js' => array(),
790
+ 'rich-text.min.js' => array(),
791
+ 'html-entities.js' => array(),
792
+ 'autop.js' => array(),
793
+ 'components.js' => array(),
794
+ 'nux.min.js' => array(),
795
+ 'escape-html.js' => array(),
796
+ 'blob.min.js' => array(),
797
+ 'hooks.min.js' => array(),
798
+ 'i18n.min.js' => array(),
799
+ 'compose.min.js' => array(),
800
+ 'autop.min.js' => array(),
801
+ 'redux-routine.min.js' => array(),
802
+ 'notices.js' => array(),
803
+ 'dom.min.js' => array(),
804
+ 'editor.min.js' => array(),
805
+ 'editor.js' => array(),
806
+ 'data.min.js' => array(),
807
+ 'deprecated.min.js' => array(),
808
+ 'token-list.min.js' => array(),
809
+ 'block-library.js' => array(),
810
+ 'blocks.js' => array(),
811
+ 'a11y.js' => array(),
812
+ 'element.js' => array(),
813
+ 'block-serialization-default-parser.js' => array(),
814
+ 'blob.js' => array(),
815
+ 'keycodes.js' => array()
816
+ ),
817
+ 'wp-a11y.js' => array(),
818
+ 'wp-backbone.js' => array(),
819
+ 'customize-preview-nav-menus.min.js' => array(),
820
+ 'customize-models.min.js' => array(),
821
+ 'hoverIntent.min.js' => array(),
822
+ 'jcrop' => array(
823
+ 'jquery.Jcrop.min.css' => array(),
824
+ 'jquery.Jcrop.min.js' => array(),
825
+ 'Jcrop.gif' => array()
826
+ ),
827
+ 'wp-embed-template.min.js' => array(),
828
+ 'twemoji.min.js' => array(),
829
+ 'wp-sanitize.min.js' => array(),
830
+ 'json2.js' => array(),
831
+ 'tinymce' => array(
832
+ 'wp-tinymce.js.gz' => array(),
833
+ 'tiny_mce_popup.js' => array(),
834
+ 'utils' => array(
835
+ 'mctabs.js' => array(),
836
+ 'editable_selects.js' => array(),
837
+ 'form_utils.js' => array(),
838
+ 'validate.js' => array()
839
+ ),
840
+ 'langs' => array(
841
+ 'wp-langs-en.js' => array()
842
+ ),
843
+ 'skins' => array(
844
+ 'lightgray' => array(
845
+ 'content.inline.min.css' => array(),
846
+ 'content.min.css' => array(),
847
+ 'skin.min.css' => array(),
848
+ 'img' => array(
849
+ 'trans.gif' => array(),
850
+ 'loader.gif' => array(),
851
+ 'object.gif' => array(),
852
+ 'anchor.gif' => array()
853
+ ),
854
+ 'fonts' => array(
855
+ 'tinymce-small.eot' => array(),
856
+ 'tinymce.woff' => array(),
857
+ 'tinymce.eot' => array(),
858
+ 'tinymce.svg' => array(),
859
+ 'tinymce.ttf' => array(),
860
+ 'tinymce-small.svg' => array(),
861
+ 'tinymce-small.ttf' => array(),
862
+ 'tinymce-small.woff' => array()
863
+ )
864
+ ),
865
+ 'wordpress' => array(
866
+ 'wp-content.css' => array(),
867
+ 'images' => array(
868
+ 'more-2x.png' => array(),
869
+ 'more.png' => array(),
870
+ 'audio.png' => array(),
871
+ 'pagebreak.png' => array(),
872
+ 'embedded.png' => array(),
873
+ 'gallery.png' => array(),
874
+ 'video.png' => array(),
875
+ 'gallery-2x.png' => array(),
876
+ 'dashicon-no.png' => array(),
877
+ 'playlist-audio.png' => array(),
878
+ 'dashicon-edit.png' => array(),
879
+ 'playlist-video.png' => array(),
880
+ 'pagebreak-2x.png' => array()
881
+ )
882
+ )
883
+ ),
884
+ 'wp-tinymce.php' => array(),
885
+ 'themes' => array(
886
+ 'inlite' => array(
887
+ 'theme.min.js' => array(),
888
+ 'theme.js' => array()
889
+ ),
890
+ 'modern' => array(
891
+ 'theme.min.js' => array(),
892
+ 'theme.js' => array()
893
+ )
894
+ ),
895
+ 'plugins' => array(
896
+ 'directionality' => array(
897
+ 'plugin.js' => array(),
898
+ 'plugin.min.js' => array()
899
+ ),
900
+ 'wpdialogs' => array(
901
+ 'plugin.js' => array(),
902
+ 'plugin.min.js' => array()
903
+ ),
904
+ 'wplink' => array(
905
+ 'plugin.js' => array(),
906
+ 'plugin.min.js' => array()
907
+ ),
908
+ 'hr' => array(
909
+ 'plugin.js' => array(),
910
+ 'plugin.min.js' => array()
911
+ ),
912
+ 'media' => array(
913
+ 'plugin.js' => array(),
914
+ 'plugin.min.js' => array()
915
+ ),
916
+ 'tabfocus' => array(
917
+ 'plugin.js' => array(),
918
+ 'plugin.min.js' => array()
919
+ ),
920
+ 'paste' => array(
921
+ 'plugin.js' => array(),
922
+ 'plugin.min.js' => array()
923
+ ),
924
+ 'fullscreen' => array(
925
+ 'plugin.js' => array(),
926
+ 'plugin.min.js' => array()
927
+ ),
928
+ 'image' => array(
929
+ 'plugin.js' => array(),
930
+ 'plugin.min.js' => array()
931
+ ),
932
+ 'wptextpattern' => array(
933
+ 'plugin.js' => array(),
934
+ 'plugin.min.js' => array()
935
+ ),
936
+ 'link' => array(
937
+ 'plugin.js' => array(),
938
+ 'plugin.min.js' => array()
939
+ ),
940
+ 'colorpicker' => array(
941
+ 'plugin.js' => array(),
942
+ 'plugin.min.js' => array()
943
+ ),
944
+ 'wpautoresize' => array(
945
+ 'plugin.js' => array(),
946
+ 'plugin.min.js' => array()
947
+ ),
948
+ 'textcolor' => array(
949
+ 'plugin.js' => array(),
950
+ 'plugin.min.js' => array()
951
+ ),
952
+ 'wpview' => array(
953
+ 'plugin.js' => array(),
954
+ 'plugin.min.js' => array()
955
+ ),
956
+ 'wpeditimage' => array(
957
+ 'plugin.js' => array(),
958
+ 'plugin.min.js' => array()
959
+ ),
960
+ 'wpemoji' => array(
961
+ 'plugin.js' => array(),
962
+ 'plugin.min.js' => array()
963
+ ),
964
+ 'compat3x' => array(
965
+ 'plugin.js' => array(),
966
+ 'plugin.min.js' => array(),
967
+ 'css' => array(
968
+ 'dialog.css' => array()
969
+ )
970
+ ),
971
+ 'lists' => array(
972
+ 'plugin.js' => array(),
973
+ 'plugin.min.js' => array()
974
+ ),
975
+ 'wordpress' => array(
976
+ 'plugin.js' => array(),
977
+ 'plugin.min.js' => array()
978
+ ),
979
+ 'charmap' => array(
980
+ 'plugin.js' => array(),
981
+ 'plugin.min.js' => array()
982
+ ),
983
+ 'wpgallery' => array(
984
+ 'plugin.js' => array(),
985
+ 'plugin.min.js' => array()
986
+ )
987
+ ),
988
+ 'license.txt' => array(),
989
+ 'tinymce.min.js' => array()
990
+ ),
991
+ 'wp-emoji-loader.js' => array(),
992
+ 'zxcvbn-async.js' => array(),
993
+ 'twemoji.js' => array(),
994
+ 'customize-loader.min.js' => array(),
995
+ 'shortcode.min.js' => array(),
996
+ 'wp-embed.js' => array(),
997
+ 'swfobject.js' => array(),
998
+ 'wp-lists.js' => array(),
999
+ 'shortcode.js' => array(),
1000
+ 'jquery' => array(
1001
+ 'jquery.hotkeys.js' => array(),
1002
+ 'jquery.table-hotkeys.js' => array(),
1003
+ 'jquery-migrate.min.js' => array(),
1004
+ 'jquery.form.min.js' => array(),
1005
+ 'jquery.js' => array(),
1006
+ 'jquery.table-hotkeys.min.js' => array(),
1007
+ 'jquery-migrate.js' => array(),
1008
+ 'jquery.hotkeys.min.js' => array(),
1009
+ 'jquery.ui.touch-punch.js' => array(),
1010
+ 'suggest.min.js' => array(),
1011
+ 'jquery.color.min.js' => array(),
1012
+ 'suggest.js' => array(),
1013
+ 'jquery.form.js' => array(),
1014
+ 'ui' => array(
1015
+ 'selectmenu.min.js' => array(),
1016
+ 'effect-size.min.js' => array(),
1017
+ 'dialog.min.js' => array(),
1018
+ 'effect-fade.min.js' => array(),
1019
+ 'effect-shake.min.js' => array(),
1020
+ 'effect-pulsate.min.js' => array(),
1021
+ 'draggable.min.js' => array(),
1022
+ 'sortable.min.js' => array(),
1023
+ 'effect-transfer.min.js' => array(),
1024
+ 'effect.min.js' => array(),
1025
+ 'slider.min.js' => array(),
1026
+ 'effect-bounce.min.js' => array(),
1027
+ 'mouse.min.js' => array(),
1028
+ 'widget.min.js' => array(),
1029
+ 'tabs.min.js' => array(),
1030
+ 'resizable.min.js' => array(),
1031
+ 'effect-fold.min.js' => array(),
1032
+ 'menu.min.js' => array(),
1033
+ 'button.min.js' => array(),
1034
+ 'effect-highlight.min.js' => array(),
1035
+ 'effect-puff.min.js' => array(),
1036
+ 'progressbar.min.js' => array(),
1037
+ 'effect-slide.min.js' => array(),
1038
+ 'accordion.min.js' => array(),
1039
+ 'effect-clip.min.js' => array(),
1040
+ 'spinner.min.js' => array(),
1041
+ 'effect-blind.min.js' => array(),
1042
+ 'position.min.js' => array(),
1043
+ 'datepicker.min.js' => array(),
1044
+ 'effect-drop.min.js' => array(),
1045
+ 'droppable.min.js' => array(),
1046
+ 'autocomplete.min.js' => array(),
1047
+ 'selectable.min.js' => array(),
1048
+ 'effect-scale.min.js' => array(),
1049
+ 'tooltip.min.js' => array(),
1050
+ 'effect-explode.min.js' => array(),
1051
+ 'core.min.js' => array()
1052
+ ),
1053
+ 'jquery.masonry.min.js' => array(),
1054
+ 'jquery.schedule.js' => array(),
1055
+ 'jquery.query.js' => array(),
1056
+ 'jquery.serialize-object.js' => array()
1057
+ ),
1058
+ 'media-audiovideo.min.js' => array(),
1059
+ 'wp-list-revisions.js' => array(),
1060
+ 'quicktags.js' => array(),
1061
+ 'wpdialog.min.js' => array(),
1062
+ 'json2.min.js' => array(),
1063
+ 'customize-preview-nav-menus.js' => array(),
1064
+ 'media-grid.js' => array(),
1065
+ 'crop' => array(
1066
+ 'marqueeVert.gif' => array(),
1067
+ 'cropper.css' => array(),
1068
+ 'marqueeHoriz.gif' => array(),
1069
+ 'cropper.js' => array()
1070
+ ),
1071
+ 'wp-lists.min.js' => array(),
1072
+ 'heartbeat.min.js' => array(),
1073
+ 'media-editor.js' => array(),
1074
+ 'mce-view.js' => array(),
1075
+ 'wp-pointer.js' => array(),
1076
+ 'imgareaselect' => array(
1077
+ 'jquery.imgareaselect.js' => array(),
1078
+ 'jquery.imgareaselect.min.js' => array(),
1079
+ 'border-anim-h.gif' => array(),
1080
+ 'border-anim-v.gif' => array(),
1081
+ 'imgareaselect.css' => array()
1082
+ ),
1083
+ 'codemirror' => array(
1084
+ 'csslint.js' => array(),
1085
+ 'htmlhint-kses.js' => array(),
1086
+ 'htmlhint.js' => array(),
1087
+ 'codemirror.min.css' => array(),
1088
+ 'jshint.js' => array(),
1089
+ 'jsonlint.js' => array(),
1090
+ 'codemirror.min.js' => array()
1091
+ ),
1092
+ 'zxcvbn-async.min.js' => array(),
1093
+ 'wpdialog.js' => array(),
1094
+ 'swfupload' => array(
1095
+ 'swfupload.js' => array(),
1096
+ 'handlers.js' => array(),
1097
+ 'handlers.min.js' => array(),
1098
+ 'license.txt' => array()
1099
+ ),
1100
+ 'media-editor.min.js' => array(),
1101
+ 'hoverIntent.js' => array(),
1102
+ 'utils.min.js' => array(),
1103
+ 'mce-view.min.js' => array(),
1104
+ 'wp-auth-check.js' => array(),
1105
+ 'wp-sanitize.js' => array(),
1106
+ 'imagesloaded.min.js' => array(),
1107
+ 'wp-embed.min.js' => array(),
1108
+ 'wp-emoji.js' => array(),
1109
+ 'wp-embed-template.js' => array(),
1110
+ 'media-models.min.js' => array(),
1111
+ 'quicktags.min.js' => array(),
1112
+ 'customize-base.js' => array(),
1113
+ 'wp-a11y.min.js' => array(),
1114
+ 'comment-reply.js' => array(),
1115
+ 'media-grid.min.js' => array(),
1116
+ 'customize-views.js' => array(),
1117
+ 'admin-bar.min.js' => array(),
1118
+ 'wp-api.js' => array(),
1119
+ 'plupload' => array(
1120
+ 'moxie.js' => array(),
1121
+ 'wp-plupload.js' => array(),
1122
+ 'plupload.js' => array(),
1123
+ 'moxie.min.js' => array(),
1124
+ 'handlers.js' => array(),
1125
+ 'handlers.min.js' => array(),
1126
+ 'license.txt' => array(),
1127
+ 'plupload.min.js' => array(),
1128
+ 'wp-plupload.min.js' => array()
1129
+ ),
1130
+ 'wplink.min.js' => array(),
1131
+ 'masonry.min.js' => array(),
1132
+ 'heartbeat.js' => array(),
1133
+ 'customize-loader.js' => array(),
1134
+ 'wp-custom-header.min.js' => array(),
1135
+ 'wp-auth-check.min.js' => array(),
1136
+ 'customize-preview.min.js' => array(),
1137
+ 'media-audiovideo.js' => array(),
1138
+ 'media-views.min.js' => array(),
1139
+ 'customize-selective-refresh.js' => array(),
1140
+ 'comment-reply.min.js' => array(),
1141
+ 'backbone.min.js' => array(),
1142
+ 'wp-emoji.min.js' => array(),
1143
+ 'customize-preview-widgets.js' => array(),
1144
+ 'customize-models.js' => array(),
1145
+ 'wp-util.min.js' => array(),
1146
+ 'wp-custom-header.js' => array(),
1147
+ 'customize-views.min.js' => array(),
1148
+ 'wp-pointer.min.js' => array(),
1149
+ 'wp-ajax-response.min.js' => array(),
1150
+ 'customize-selective-refresh.min.js' => array(),
1151
+ 'colorpicker.js' => array(),
1152
+ 'customize-base.min.js' => array(),
1153
+ 'wp-ajax-response.js' => array(),
1154
+ 'thickbox' => array(
1155
+ 'thickbox.css' => array(),
1156
+ 'macFFBgHack.png' => array(),
1157
+ 'thickbox.js' => array(),
1158
+ 'loadingAnimation.gif' => array()
1159
+ ),
1160
+ 'media-views.js' => array(),
1161
+ 'autosave.js' => array(),
1162
+ 'customize-preview-widgets.min.js' => array(),
1163
+ 'wp-emoji-release.min.js' => array(),
1164
+ 'wp-util.js' => array(),
1165
+ 'customize-preview.js' => array(),
1166
+ 'underscore.min.js' => array(),
1167
+ 'api-request.min.js' => array(),
1168
+ 'wp-emoji-loader.min.js' => array(),
1169
+ 'tw-sack.min.js' => array(),
1170
+ 'wplink.js' => array(),
1171
+ 'utils.js' => array(),
1172
+ 'wp-backbone.min.js' => array(),
1173
+ 'admin-bar.js' => array(),
1174
+ 'wp-api.min.js' => array()
1175
+ ),
1176
+ 'class-wp-customize-nav-menus.php' => array(),
1177
+ 'class-wp-http-requests-response.php' => array(),
1178
+ 'class-IXR.php' => array(),
1179
+ 'formatting.php' => array(),
1180
+ 'class-wp-image-editor-gd.php' => array(),
1181
+ 'l10n.php' => array()
1182
+ ),
1183
+ 'index.php' => array(),
1184
+ 'wp-links-opml.php' => array(),
1185
+ 'wp-login.php' => array(),
1186
+ 'wp-activate.php' => array(),
1187
+ 'wp-mail.php' => array(),
1188
+ 'wp-load.php' => array(),
1189
+ 'wp-admin' => array(
1190
+ 'privacy.php' => array(),
1191
+ 'comment.php' => array(),
1192
+ 'media.php' => array(),
1193
+ 'setup-config.php' => array(),
1194
+ 'press-this.php' => array(),
1195
+ 'options.php' => array(),
1196
+ 'edit-tags.php' => array(),
1197
+ 'menu.php' => array(),
1198
+ 'index.php' => array(),
1199
+ 'post.php' => array(),
1200
+ 'profile.php' => array(),
1201
+ 'edit-tag-form.php' => array(),
1202
+ 'plugin-install.php' => array(),
1203
+ 'link-add.php' => array(),
1204
+ 'customize.php' => array(),
1205
+ 'ms-users.php' => array(),
1206
+ 'update.php' => array(),
1207
+ 'user' => array(
1208
+ 'privacy.php' => array(),
1209
+ 'menu.php' => array(),
1210
+ 'index.php' => array(),
1211
+ 'profile.php' => array(),
1212
+ 'freedoms.php' => array(),
1213
+ 'user-edit.php' => array(),
1214
+ 'about.php' => array(),
1215
+ 'credits.php' => array(),
1216
+ 'admin.php' => array()
1217
+ ),
1218
+ 'ms-options.php' => array(),
1219
+ 'widgets.php' => array(),
1220
+ 'ms-sites.php' => array(),
1221
+ 'themes.php' => array(),
1222
+ 'ms-delete-site.php' => array(),
1223
+ 'install-helper.php' => array(),
1224
+ 'admin-header.php' => array(),
1225
+ 'edit-comments.php' => array(),
1226
+ 'includes' => array(
1227
+ 'comment.php' => array(),
1228
+ 'class-wp-post-comments-list-table.php' => array(),
1229
+ 'class-wp-themes-list-table.php' => array(),
1230
+ 'media.php' => array(),
1231
+ 'class-bulk-theme-upgrader-skin.php' => array(),
1232
+ 'options.php' => array(),
1233
+ 'class-ftp-pure.php' => array(),
1234
+ 'menu.php' => array(),
1235
+ 'class-wp-list-table-compat.php' => array(),
1236
+ 'class-wp-upgrader.php' => array(),
1237
+ 'deprecated.php' => array(),
1238
+ 'post.php' => array(),
1239
+ 'class-wp-filesystem-ftpsockets.php' => array(),
1240
+ 'class-bulk-upgrader-skin.php' => array(),
1241
+ 'translation-install.php' => array(),
1242
+ 'ms-deprecated.php' => array(),
1243
+ 'plugin-install.php' => array(),
1244
+ 'class-wp-terms-list-table.php' => array(),
1245
+ 'meta-boxes.php' => array(),
1246
+ 'update.php' => array(),
1247
+ 'class-wp-filesystem-direct.php' => array(),
1248
+ 'class-wp-media-list-table.php' => array(),
1249
+ 'widgets.php' => array(),
1250
+ 'ajax-actions.php' => array(),
1251
+ 'continents-cities.php' => array(),
1252
+ 'schema.php' => array(),
1253
+ 'noop.php' => array(),
1254
+ 'class-bulk-plugin-upgrader-skin.php' => array(),
1255
+ 'edit-tag-messages.php' => array(),
1256
+ 'class-wp-filesystem-ftpext.php' => array(),
1257
+ 'image.php' => array(),
1258
+ 'nav-menu.php' => array(),
1259
+ 'class-language-pack-upgrader-skin.php' => array(),
1260
+ 'class-wp-upgrader-skins.php' => array(),
1261
+ 'class-wp-community-events.php' => array(),
1262
+ 'screen.php' => array(),
1263
+ 'network.php' => array(),
1264
+ 'class-plugin-upgrader.php' => array(),
1265
+ 'dashboard.php' => array(),
1266
+ 'class-core-upgrader.php' => array(),
1267
+ 'class-automatic-upgrader-skin.php' => array(),
1268
+ 'theme.php' => array(),
1269
+ 'update-core.php' => array(),
1270
+ 'taxonomy.php' => array(),
1271
+ 'class-plugin-upgrader-skin.php' => array(),
1272
+ 'misc.php' => array(),
1273
+ 'theme-install.php' => array(),
1274
+ 'class-wp-links-list-table.php' => array(),
1275
+ 'class-wp-filesystem-base.php' => array(),
1276
+ 'class-wp-plugins-list-table.php' => array(),
1277
+ 'class-plugin-installer-skin.php' => array(),
1278
+ 'class-walker-nav-menu-edit.php' => array(),
1279
+ 'image-edit.php' => array(),
1280
+ 'class-walker-nav-menu-checklist.php' => array(),
1281
+ 'file.php' => array(),
1282
+ 'class-wp-plugin-install-list-table.php' => array(),
1283
+ 'class-wp-filesystem-ssh2.php' => array(),
1284
+ 'class-wp-site-icon.php' => array(),
1285
+ 'class-wp-posts-list-table.php' => array(),
1286
+ 'list-table.php' => array(),
1287
+ 'user.php' => array(),
1288
+ 'bookmark.php' => array(),
1289
+ 'class-theme-upgrader-skin.php' => array(),
1290
+ 'revision.php' => array(),
1291
+ 'class-theme-installer-skin.php' => array(),
1292
+ 'class-file-upload-upgrader.php' => array(),
1293
+ 'class-wp-users-list-table.php' => array(),
1294
+ 'class-theme-upgrader.php' => array(),
1295
+ 'class-wp-ms-themes-list-table.php' => array(),
1296
+ 'template.php' => array(),
1297
+ 'class-wp-ms-users-list-table.php' => array(),
1298
+ 'class-wp-internal-pointers.php' => array(),
1299
+ 'class-language-pack-upgrader.php' => array(),
1300
+ 'plugin.php' => array(),
1301
+ 'import.php' => array(),
1302
+ 'class-wp-automatic-updater.php' => array(),
1303
+ 'class-wp-list-table.php' => array(),
1304
+ 'class-pclzip.php' => array(),
1305
+ 'class-wp-comments-list-table.php' => array(),
1306
+ 'ms.php' => array(),
1307
+ 'credits.php' => array(),
1308
+ 'class-wp-upgrader-skin.php' => array(),
1309
+ 'upgrade.php' => array(),
1310
+ 'class-wp-theme-install-list-table.php' => array(),
1311
+ 'ms-admin-filters.php' => array(),
1312
+ 'class-wp-ajax-upgrader-skin.php' => array(),
1313
+ 'class-walker-category-checklist.php' => array(),
1314
+ 'class-ftp-sockets.php' => array(),
1315
+ 'class-ftp.php' => array(),
1316
+ 'admin-filters.php' => array(),
1317
+ 'admin.php' => array(),
1318
+ 'export.php' => array(),
1319
+ 'class-wp-screen.php' => array(),
1320
+ 'class-wp-ms-sites-list-table.php' => array(),
1321
+ 'class-wp-importer.php' => array()
1322
+ ),
1323
+ 'admin-post.php' => array(),
1324
+ 'custom-background.php' => array(),
1325
+ 'edit-form-advanced.php' => array(),
1326
+ 'media-upload.php' => array(),
1327
+ 'network.php' => array(),
1328
+ 'custom-header.php' => array(),
1329
+ 'freedoms.php' => array(),
1330
+ 'menu-header.php' => array(),
1331
+ 'tools.php' => array(),
1332
+ 'options-writing.php' => array(),
1333
+ 'link-parse-opml.php' => array(),
1334
+ 'post-new.php' => array(),
1335
+ 'plugins.php' => array(),
1336
+ 'nav-menus.php' => array(),
1337
+ 'update-core.php' => array(),
1338
+ 'edit.php' => array(),
1339
+ 'options-media.php' => array(),
1340
+ 'admin-footer.php' => array(),
1341
+ 'network' => array(
1342
+ 'privacy.php' => array(),
1343
+ 'site-settings.php' => array(),
1344
+ 'menu.php' => array(),
1345
+ 'index.php' => array(),
1346
+ 'profile.php' => array(),
1347
+ 'plugin-install.php' => array(),
1348
+ 'update.php' => array(),
1349
+ 'themes.php' => array(),
1350
+ 'site-info.php' => array(),
1351
+ 'freedoms.php' => array(),
1352
+ 'plugins.php' => array(),
1353
+ 'update-core.php' => array(),
1354
+ 'setup.php' => array(),
1355
+ 'edit.php' => array(),
1356
+ 'sites.php' => array(),
1357
+ 'theme-install.php' => array(),
1358
+ 'settings.php' => array(),
1359
+ 'site-new.php' => array(),
1360
+ 'site-users.php' => array(),
1361
+ 'user-edit.php' => array(),
1362
+ 'theme-editor.php' => array(),
1363
+ 'user-new.php' => array(),
1364
+ 'plugin-editor.php' => array(),
1365
+ 'about.php' => array(),
1366
+ 'users.php' => array(),
1367
+ 'credits.php' => array(),
1368
+ 'upgrade.php' => array(),
1369
+ 'site-themes.php' => array(),
1370
+ 'admin.php' => array()
1371
+ ),
1372
+ 'theme-install.php' => array(),
1373
+ 'load-scripts.php' => array(),
1374
+ 'ms-admin.php' => array(),
1375
+ 'images' => array(
1376
+ 'browser-rtl.png' => array(),
1377
+ 'sort.gif' => array(),
1378
+ 'wordpress-logo-white.svg' => array(),
1379
+ 'loading.gif' => array(),
1380
+ 'spinner.gif' => array(),
1381
+ 'generic.png' => array(),
1382
+ 'media-button-video.gif' => array(),
1383
+ 'browser.png' => array(),
1384
+ 'resize-rtl-2x.gif' => array(),
1385
+ 'arrows-2x.png' => array(),
1386
+ 'align-none-2x.png' => array(),
1387
+ 'align-center-2x.png' => array(),
1388
+ 'align-right.png' => array(),
1389
+ 'menu-2x.png' => array(),
1390
+ 'stars-2x.png' => array(),
1391
+ 'media-button.png' => array(),
1392
+ 'w-logo-white.png' => array(),
1393
+ 'align-left.png' => array(),
1394
+ 'menu.png' => array(),
1395
+ 'post-formats-vs.png' => array(),
1396
+ 'wordpress-logo.svg' => array(),
1397
+ 'wpspin_light.gif' => array(),
1398
+ 'date-button.gif' => array(),
1399
+ 'no.png' => array(),
1400
+ 'comment-grey-bubble-2x.png' => array(),
1401
+ 'imgedit-icons-2x.png' => array(),
1402
+ 'sort-2x.gif' => array(),
1403
+ 'wpspin_light-2x.gif' => array(),
1404
+ 'se.png' => array(),
1405
+ 'bubble_bg-2x.gif' => array(),
1406
+ 'resize.gif' => array(),
1407
+ 'menu-vs-2x.png' => array(),
1408
+ 'marker.png' => array(),
1409
+ 'align-right-2x.png' => array(),
1410
+ 'comment-grey-bubble.png' => array(),
1411
+ 'list-2x.png' => array(),
1412
+ 'stars.png' => array(),
1413
+ 'media-button-other.gif' => array(),
1414
+ 'arrows.png' => array(),
1415
+ 'wordpress-logo.png' => array(),
1416
+ 'media-button-music.gif' => array(),
1417
+ 'spinner-2x.gif' => array(),
1418
+ 'media-button-2x.png' => array(),
1419
+ 'bubble_bg.gif' => array(),
1420
+ 'yes.png' => array(),
1421
+ 'media-button-image.gif' => array(),
1422
+ 'icons32-vs.png' => array(),
1423
+ 'xit-2x.gif' => array(),
1424
+ 'w-logo-blue.png' => array(),
1425
+ 'wheel.png' => array(),
1426
+ 'mask.png' => array(),
1427
+ 'resize-rtl.gif' => array(),
1428
+ 'xit.gif' => array(),
1429
+ 'date-button-2x.gif' => array(),
1430
+ 'align-center.png' => array(),
1431
+ 'icons32-2x.png' => array(),
1432
+ 'icons32-vs-2x.png' => array(),
1433
+ 'resize-2x.gif' => array(),
1434
+ 'list.png' => array(),
1435
+ 'menu-vs.png' => array(),
1436
+ 'icons32.png' => array(),
1437
+ 'align-none.png' => array(),
1438
+ 'post-formats.png' => array(),
1439
+ 'post-formats32-vs.png' => array(),
1440
+ 'imgedit-icons.png' => array(),
1441
+ 'align-left-2x.png' => array(),
1442
+ 'post-formats32.png' => array()
1443
+ ),
1444
+ 'options-general.php' => array(),
1445
+ 'async-upload.php' => array(),
1446
+ 'upgrade-functions.php' => array(),
1447
+ 'options-reading.php' => array(),
1448
+ 'term.php' => array(),
1449
+ 'install.php' => array(),
1450
+ 'options-discussion.php' => array(),
1451
+ 'edit-link-form.php' => array(),
1452
+ 'upload.php' => array(),
1453
+ 'admin-ajax.php' => array(),
1454
+ 'options-permalink.php' => array(),
1455
+ 'options-head.php' => array(),
1456
+ 'revision.php' => array(),
1457
+ 'user-edit.php' => array(),
1458
+ 'theme-editor.php' => array(),
1459
+ 'ms-themes.php' => array(),
1460
+ 'user-new.php' => array(),
1461
+ 'ms-edit.php' => array(),
1462
+ 'link.php' => array(),
1463
+ 'plugin-editor.php' => array(),
1464
+ 'link-manager.php' => array(),
1465
+ 'maint' => array(
1466
+ 'repair.php' => array()
1467
+ ),
1468
+ 'moderation.php' => array(),
1469
+ 'about.php' => array(),
1470
+ 'import.php' => array(),
1471
+ 'users.php' => array(),
1472
+ 'my-sites.php' => array(),
1473
+ 'credits.php' => array(),
1474
+ 'media-new.php' => array(),
1475
+ 'upgrade.php' => array(),
1476
+ 'edit-form-comment.php' => array(),
1477
+ 'ms-upgrade-network.php' => array(),
1478
+ 'css' => array(
1479
+ 'about.min.css' => array(),
1480
+ 'login-rtl.min.css' => array(),
1481
+ 'wp-admin.css' => array(),
1482
+ 'nav-menus-rtl.min.css' => array(),
1483
+ 'install-rtl.css' => array(),
1484
+ 'deprecated-media-rtl.css' => array(),
1485
+ 'customize-widgets-rtl.min.css' => array(),
1486
+ 'color-picker-rtl.css' => array(),
1487
+ 'edit-rtl.min.css' => array(),
1488
+ 'list-tables.min.css' => array(),
1489
+ 'themes-rtl.css' => array(),
1490
+ 'about-rtl.css' => array(),
1491
+ 'site-icon.css' => array(),
1492
+ 'customize-widgets.css' => array(),
1493
+ 'code-editor-rtl.css' => array(),
1494
+ 'customize-nav-menus.min.css' => array(),
1495
+ 'about.css' => array(),
1496
+ 'l10n.css' => array(),
1497
+ 'widgets.css' => array(),
1498
+ 'customize-widgets-rtl.css' => array(),
1499
+ 'admin-menu.css' => array(),
1500
+ 'farbtastic.min.css' => array(),
1501
+ 'list-tables-rtl.min.css' => array(),
1502
+ 'login-rtl.css' => array(),
1503
+ 'common.min.css' => array(),
1504
+ 'customize-controls-rtl.min.css' => array(),
1505
+ 'install.min.css' => array(),
1506
+ 'color-picker-rtl.min.css' => array(),
1507
+ 'edit.min.css' => array(),
1508
+ 'themes.css' => array(),
1509
+ 'list-tables-rtl.css' => array(),
1510
+ 'themes-rtl.min.css' => array(),
1511
+ 'color-picker.css' => array(),
1512
+ 'media.min.css' => array(),
1513
+ 'edit.css' => array(),
1514
+ 'widgets.min.css' => array(),
1515
+ 'revisions.min.css' => array(),
1516
+ 'forms.css' => array(),
1517
+ 'customize-controls-rtl.css' => array(),
1518
+ 'list-tables.css' => array(),
1519
+ 'ie.min.css' => array(),
1520
+ 'media.css' => array(),
1521
+ 'login.css' => array(),
1522
+ 'revisions-rtl.min.css' => array(),
1523
+ 'edit-rtl.css' => array(),
1524
+ 'farbtastic-rtl.css' => array(),
1525
+ 'customize-controls.css' => array(),
1526
+ 'admin-menu.min.css' => array(),
1527
+ 'l10n.min.css' => array(),
1528
+ 'customize-nav-menus-rtl.min.css' => array(),
1529
+ 'customize-controls.min.css' => array(),
1530
+ 'revisions.css' => array(),
1531
+ 'deprecated-media.css' => array(),
1532
+ 'about-rtl.min.css' => array(),
1533
+ 'login.min.css' => array(),
1534
+ 'dashboard.css' => array(),
1535
+ 'dashboard-rtl.min.css' => array(),
1536
+ 'install-rtl.min.css' => array(),
1537
+ 'l10n-rtl.min.css' => array(),
1538
+ 'wp-admin-rtl.css' => array(),
1539
+ 'media-rtl.min.css' => array(),
1540
+ 'customize-nav-menus.css' => array(),
1541
+ 'ie.css' => array(),
1542
+ 'nav-menus-rtl.css' => array(),
1543
+ 'customize-widgets.min.css' => array(),
1544
+ 'code-editor.css' => array(),
1545
+ 'common.css' => array(),
1546
+ 'ie-rtl.min.css' => array(),
1547
+ 'common-rtl.css' => array(),
1548
+ 'widgets-rtl.css' => array(),
1549
+ 'nav-menus.min.css' => array(),
1550
+ 'forms-rtl.min.css' => array(),
1551
+ 'deprecated-media-rtl.min.css' => array(),
1552
+ 'dashboard-rtl.css' => array(),
1553
+ 'site-icon-rtl.css' => array(),
1554
+ 'code-editor.min.css' => array(),
1555
+ 'forms-rtl.css' => array(),
1556
+ 'admin-menu-rtl.min.css' => array(),
1557
+ 'wp-admin.min.css' => array(),
1558
+ 'ie-rtl.css' => array(),
1559
+ 'themes.min.css' => array(),
1560
+ 'farbtastic.css' => array(),
1561
+ 'farbtastic-rtl.min.css' => array(),
1562
+ 'code-editor-rtl.min.css' => array(),
1563
+ 'site-icon-rtl.min.css' => array(),
1564
+ 'deprecated-media.min.css' => array(),
1565
+ 'install.css' => array(),
1566
+ 'media-rtl.css' => array(),
1567
+ 'color-picker.min.css' => array(),
1568
+ 'colors' => array(
1569
+ '_admin.scss' => array(),
1570
+ '_mixins.scss' => array(),
1571
+ 'ocean' => array(
1572
+ 'colors.min.css' => array(),
1573
+ 'colors.css' => array(),
1574
+ 'colors-rtl.min.css' => array(),
1575
+ 'colors.scss' => array(),
1576
+ 'colors-rtl.css' => array()
1577
+ ),
1578
+ '_variables.scss' => array(),
1579
+ 'coffee' => array(
1580
+ 'colors.min.css' => array(),
1581
+ 'colors.css' => array(),
1582
+ 'colors-rtl.min.css' => array(),
1583
+ 'colors.scss' => array(),
1584
+ 'colors-rtl.css' => array()
1585
+ ),
1586
+ 'blue' => array(
1587
+ 'colors.min.css' => array(),
1588
+ 'colors.css' => array(),
1589
+ 'colors-rtl.min.css' => array(),
1590
+ 'colors.scss' => array(),
1591
+ 'colors-rtl.css' => array()
1592
+ ),
1593
+ 'ectoplasm' => array(
1594
+ 'colors.min.css' => array(),
1595
+ 'colors.css' => array(),
1596
+ 'colors-rtl.min.css' => array(),
1597
+ 'colors.scss' => array(),
1598
+ 'colors-rtl.css' => array()
1599
+ ),
1600
+ 'light' => array(
1601
+ 'colors.min.css' => array(),
1602
+ 'colors.css' => array(),
1603
+ 'colors-rtl.min.css' => array(),
1604
+ 'colors.scss' => array(),
1605
+ 'colors-rtl.css' => array()
1606
+ ),
1607
+ 'midnight' => array(
1608
+ 'colors.min.css' => array(),
1609
+ 'colors.css' => array(),
1610
+ 'colors-rtl.min.css' => array(),
1611
+ 'colors.scss' => array(),
1612
+ 'colors-rtl.css' => array()
1613
+ ),
1614
+ 'sunrise' => array(
1615
+ 'colors.min.css' => array(),
1616
+ 'colors.css' => array(),
1617
+ 'colors-rtl.min.css' => array(),
1618
+ 'colors.scss' => array(),
1619
+ 'colors-rtl.css' => array()
1620
+ )
1621
+ ),
1622
+ 'nav-menus.css' => array(),
1623
+ 'site-icon.min.css' => array(),
1624
+ 'wp-admin-rtl.min.css' => array(),
1625
+ 'revisions-rtl.css' => array(),
1626
+ 'common-rtl.min.css' => array(),
1627
+ 'customize-nav-menus-rtl.css' => array(),
1628
+ 'admin-menu-rtl.css' => array(),
1629
+ 'forms.min.css' => array(),
1630
+ 'widgets-rtl.min.css' => array(),
1631
+ 'dashboard.min.css' => array(),
1632
+ 'l10n-rtl.css' => array()
1633
+ ),
1634
+ 'admin.php' => array(),
1635
+ 'export.php' => array(),
1636
+ 'js' => array(
1637
+ 'word-count.min.js' => array(),
1638
+ 'postbox.js' => array(),
1639
+ 'gallery.min.js' => array(),
1640
+ 'customize-widgets.min.js' => array(),
1641
+ 'user-profile.js' => array(),
1642
+ 'media-gallery.js' => array(),
1643
+ 'updates.js' => array(),
1644
+ 'language-chooser.js' => array(),
1645
+ 'postbox.min.js' => array(),
1646
+ 'comment.js' => array(),
1647
+ 'user-suggest.min.js' => array(),
1648
+ 'widgets' => array(
1649
+ 'media-video-widget.min.js' => array(),
1650
+ 'text-widgets.js' => array(),
1651
+ 'media-image-widget.min.js' => array(),
1652
+ 'media-gallery-widget.js' => array(),
1653
+ 'media-audio-widget.js' => array(),
1654
+ 'media-widgets.min.js' => array(),
1655
+ 'custom-html-widgets.js' => array(),
1656
+ 'custom-html-widgets.min.js' => array(),
1657
+ 'media-widgets.js' => array(),
1658
+ 'media-audio-widget.min.js' => array(),
1659
+ 'media-video-widget.js' => array(),
1660
+ 'text-widgets.min.js' => array(),
1661
+ 'media-gallery-widget.min.js' => array(),
1662
+ 'media-image-widget.js' => array()
1663
+ ),
1664
+ 'revisions.js' => array(),
1665
+ 'link.min.js' => array(),
1666
+ 'common.js' => array(),
1667
+ 'inline-edit-tax.min.js' => array(),
1668
+ 'accordion.js' => array(),
1669
+ 'color-picker.js' => array(),
1670
+ 'tags-box.js' => array(),
1671
+ 'language-chooser.min.js' => array(),
1672
+ 'post.js' => array(),
1673
+ 'custom-background.js' => array(),
1674
+ 'color-picker.min.js' => array(),
1675
+ 'media-gallery.min.js' => array(),
1676
+ 'custom-header.js' => array(),
1677
+ 'theme.min.js' => array(),
1678
+ 'set-post-thumbnail.min.js' => array(),
1679
+ 'plugin-install.min.js' => array(),
1680
+ 'code-editor.min.js' => array(),
1681
+ 'media.js' => array(),
1682
+ 'user-profile.min.js' => array(),
1683
+ 'dashboard.js' => array(),
1684
+ 'tags-box.min.js' => array(),
1685
+ 'iris.min.js' => array(),
1686
+ 'tags.js' => array(),
1687
+ 'tags-suggest.min.js' => array(),
1688
+ 'customize-widgets.js' => array(),
1689
+ 'customize-nav-menus.min.js' => array(),
1690
+ 'code-editor.js' => array(),
1691
+ 'edit-comments.js' => array(),
1692
+ 'customize-controls.js' => array(),
1693
+ 'custom-background.min.js' => array(),
1694
+ 'word-count.js' => array(),
1695
+ 'password-strength-meter.js' => array(),
1696
+ 'theme.js' => array(),
1697
+ 'editor-expand.js' => array(),
1698
+ 'customize-nav-menus.js' => array(),
1699
+ 'wp-fullscreen-stub.min.js' => array(),
1700
+ 'dashboard.min.js' => array(),
1701
+ 'image-edit.js' => array(),
1702
+ 'accordion.min.js' => array(),
1703
+ 'nav-menu.min.js' => array(),
1704
+ 'customize-controls.min.js' => array(),
1705
+ 'xfn.min.js' => array(),
1706
+ 'tags.min.js' => array(),
1707
+ 'svg-painter.js' => array(),
1708
+ 'set-post-thumbnail.js' => array(),
1709
+ 'inline-edit-post.js' => array(),
1710
+ 'edit-comments.min.js' => array(),
1711
+ 'inline-edit-tax.js' => array(),
1712
+ 'nav-menu.js' => array(),
1713
+ 'comment.min.js' => array(),
1714
+ 'inline-edit-post.min.js' => array(),
1715
+ 'wp-fullscreen-stub.js' => array(),
1716
+ 'theme-plugin-editor.min.js' => array(),
1717
+ 'farbtastic.js' => array(),
1718
+ 'updates.min.js' => array(),
1719
+ 'media-upload.js' => array(),
1720
+ 'theme-plugin-editor.js' => array(),
1721
+ 'svg-painter.min.js' => array(),
1722
+ 'editor-expand.min.js' => array(),
1723
+ 'user-suggest.js' => array(),
1724
+ 'gallery.js' => array(),
1725
+ 'post.min.js' => array(),
1726
+ 'media-upload.min.js' => array(),
1727
+ 'widgets.js' => array(),
1728
+ 'password-strength-meter.min.js' => array(),
1729
+ 'xfn.js' => array(),
1730
+ 'editor.min.js' => array(),
1731
+ 'editor.js' => array(),
1732
+ 'plugin-install.js' => array(),
1733
+ 'widgets.min.js' => array(),
1734
+ 'revisions.min.js' => array(),
1735
+ 'link.js' => array(),
1736
+ 'common.min.js' => array(),
1737
+ 'media.min.js' => array(),
1738
+ 'tags-suggest.js' => array(),
1739
+ 'image-edit.min.js' => array()
1740
+ ),
1741
+ 'edit-form-blocks.php' => array(),
1742
+ 'load-styles.php' => array(),
1743
+ 'admin-functions.php' => array()
1744
+ ),
1745
+ 'wp-content' => array(
1746
+ 'index.php' => array(),
1747
+ 'themes' => array(
1748
+ 'index.php' => array()
1749
+ ),
1750
+ 'plugins' => array(
1751
+ 'index.php' => array()
1752
+ )
1753
+ ),
1754
+ 'is_core_wp_data_generator.php' => array(),
1755
+ 'wp-trackback.php' => array(),
1756
+ 'wp-blog-header.php' => array(),
1757
+ 'wordpress.core.files.php' => array(),
1758
+ 'wp-cron.php' => array(),
1759
+ 'license.txt' => array(),
1760
+ 'xmlrpc.php' => array(),
1761
+ 'readme.html' => array(),
1762
+ 'wp-comments-post.php' => array(),
1763
+ 'wp-config-sample.php' => array(),
1764
+ 'wp-settings.php' => array()
1765
+ );
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: migration, backup, restore, move, migrate, duplicate, transfer, clone, aut
4
  Requires at least: 4.0
5
  Tested up to: 5.1
6
  Requires PHP: 5.2.17
7
- Stable tag: 1.3.8
8
  License: GPLv2
9
 
10
  WordPress migration and backups are much easier with Duplicator! Clone, backup, move and transfer an entire site from one location to another.
4
  Requires at least: 4.0
5
  Tested up to: 5.1
6
  Requires PHP: 5.2.17
7
+ Stable tag: 1.3.10
8
  License: GPLv2
9
 
10
  WordPress migration and backups are much easier with Duplicator! Clone, backup, move and transfer an entire site from one location to another.
views/packages/main/s1.setup2.php CHANGED
@@ -274,7 +274,6 @@ ARCHIVE -->
274
  <a href="javascript:void(0)" id="dbnone" onclick="jQuery('#dup-dbtables .checkbox').prop('checked', false).trigger('click');">[ <?php esc_html_e('Exclude All', 'duplicator'); ?> ]</a>
275
  <div style="white-space:nowrap">
276
  <?php
277
- $coreTables = DUP_Util::getWPCoreTables();
278
  $tables = $wpdb->get_results("SHOW FULL TABLES FROM `" . DB_NAME . "` WHERE Table_Type = 'BASE TABLE' ", ARRAY_N);
279
  $num_rows = count($tables);
280
  $next_row = round($num_rows / 4, 0);
@@ -284,7 +283,7 @@ ARCHIVE -->
284
  echo '<table id="dup-dbtables"><tr><td valign="top">';
285
  foreach ($tables as $table) {
286
 
287
- if (in_array($table[0], $coreTables)) {
288
  $core_css = 'core-table';
289
  $core_note = '*';
290
  } else {
274
  <a href="javascript:void(0)" id="dbnone" onclick="jQuery('#dup-dbtables .checkbox').prop('checked', false).trigger('click');">[ <?php esc_html_e('Exclude All', 'duplicator'); ?> ]</a>
275
  <div style="white-space:nowrap">
276
  <?php
 
277
  $tables = $wpdb->get_results("SHOW FULL TABLES FROM `" . DB_NAME . "` WHERE Table_Type = 'BASE TABLE' ", ARRAY_N);
278
  $num_rows = count($tables);
279
  $next_row = round($num_rows / 4, 0);
283
  echo '<table id="dup-dbtables"><tr><td valign="top">';
284
  foreach ($tables as $table) {
285
 
286
+ if (DUP_Util::isWPCoreTable($table[0])) {
287
  $core_css = 'core-table';
288
  $core_note = '*';
289
  } else {
views/packages/main/s2.scan3.php CHANGED
@@ -11,6 +11,8 @@
11
  $archive_type_label = DUP_Settings::Get('archive_build_mode') == DUP_Archive_Build_Mode::ZipArchive ? "ZipArchive" : "DupArchive (beta)";
12
  $archive_type_extension = DUP_Settings::Get('archive_build_mode') == DUP_Archive_Build_Mode::ZipArchive ? "zip" : "daf";
13
  $duparchive_max_limit = DUP_Util::readableByteSize(DUPLICATOR_MAX_DUPARCHIVE_SIZE);
 
 
14
  ?>
15
 
16
  <!-- ================================================================
@@ -47,6 +49,23 @@ ARCHIVE -->
47
  </div>
48
  </div>
49
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
50
  <!-- ============
51
  TOTAL SIZE -->
52
  <div class="scan-item">
@@ -325,7 +344,7 @@ UNREADABLE FILES -->
325
  </div>
326
  </div>
327
 
328
-
329
 
330
  <!-- ============
331
  DATABASE -->
@@ -776,34 +795,42 @@ jQuery(document).ready(function($)
776
  $('#data-arc-dirs').text(data.ARC.DirCount || errMsg);
777
 
778
  //LARGE FILES
779
- var template = $('#hb-files-large').html();
780
- var templateScript = Handlebars.compile(template);
781
- var html = templateScript(data);
782
- $('#hb-files-large-result').html(html);
783
-
 
784
  //ADDON SITES
785
- var template = $('#hb-addon-sites').html();
786
- var templateScript = Handlebars.compile(template);
787
- var html = templateScript(data);
788
- $('#hb-addon-sites-result').html(html);
789
-
 
790
  //NAME CHECKS
791
- var template = $('#hb-files-utf8').html();
792
- var templateScript = Handlebars.compile(template);
793
- var html = templateScript(data);
794
- $('#hb-files-utf8-result').html(html);
 
 
795
 
796
  //NAME CHECKS
797
- var template = $('#unreadable-files').html();
798
- var templateScript = Handlebars.compile(template);
799
- var html = templateScript(data);
800
- $('#unreadable-files-result').html(html);
 
 
801
 
802
  //SCANNER DETAILS: Dirs
803
- var template = $('#hb-filter-file-list').html();
804
- var templateScript = Handlebars.compile(template);
805
- var html = templateScript(data);
806
- $('div.hb-filter-file-list-result').html(html);
 
 
807
 
808
  Duplicator.UI.loadQtip();
809
  }
11
  $archive_type_label = DUP_Settings::Get('archive_build_mode') == DUP_Archive_Build_Mode::ZipArchive ? "ZipArchive" : "DupArchive (beta)";
12
  $archive_type_extension = DUP_Settings::Get('archive_build_mode') == DUP_Archive_Build_Mode::ZipArchive ? "zip" : "daf";
13
  $duparchive_max_limit = DUP_Util::readableByteSize(DUPLICATOR_MAX_DUPARCHIVE_SIZE);
14
+ $skip_archive_scan = DUP_Settings::Get('skip_archive_scan');
15
+
16
  ?>
17
 
18
  <!-- ================================================================
49
  </div>
50
  </div>
51
 
52
+ <?php
53
+ if ($skip_archive_scan) { ?>
54
+ <div class="scan-item ">
55
+ <div class='title' onclick="Duplicator.Pack.toggleScanItem(this);">
56
+ <div class="text"><i class="fa fa-caret-right"></i> <?php esc_html_e('Skip archive scan enabled', 'duplicator');?></div>
57
+ <div id="skip-archive-scan-status"><div class="badge badge-warn"><?php esc_html_e("Notice", 'duplicator'); ?></div></div>
58
+ </div>
59
+ <div class="info">
60
+ <?php esc_html_e("All file checks are skipped. This could cause problems during extraction if problematic files are included.", 'duplicator'); ?>
61
+ <br><br>
62
+ <b><?php esc_html_e(" Disable the advanced option to re-enable file controls.", 'duplicator'); ?></b>
63
+ </div>
64
+ </div>
65
+ <?php
66
+ } else {
67
+ ?>
68
+
69
  <!-- ============
70
  TOTAL SIZE -->
71
  <div class="scan-item">
344
  </div>
345
  </div>
346
 
347
+ <?php } ?>
348
 
349
  <!-- ============
350
  DATABASE -->
795
  $('#data-arc-dirs').text(data.ARC.DirCount || errMsg);
796
 
797
  //LARGE FILES
798
+ if ($('#hb-files-large').length > 0) {
799
+ var template = $('#hb-files-large').html();
800
+ var templateScript = Handlebars.compile(template);
801
+ var html = templateScript(data);
802
+ $('#hb-files-large-result').html(html);
803
+ }
804
  //ADDON SITES
805
+ if ($('#hb-addon-sites').length > 0) {
806
+ var template = $('#hb-addon-sites').html();
807
+ var templateScript = Handlebars.compile(template);
808
+ var html = templateScript(data);
809
+ $('#hb-addon-sites-result').html(html);
810
+ }
811
  //NAME CHECKS
812
+ if ($('#hb-files-utf8').length > 0) {
813
+ var template = $('#hb-files-utf8').html();
814
+ var templateScript = Handlebars.compile(template);
815
+ var html = templateScript(data);
816
+ $('#hb-files-utf8-result').html(html);
817
+ }
818
 
819
  //NAME CHECKS
820
+ if ($('#unreadable-files').length > 0) {
821
+ var template = $('#unreadable-files').html();
822
+ var templateScript = Handlebars.compile(template);
823
+ var html = templateScript(data);
824
+ $('#unreadable-files-result').html(html);
825
+ }
826
 
827
  //SCANNER DETAILS: Dirs
828
+ if ($('#hb-filter-file-list').length > 0) {
829
+ var template = $('#hb-filter-file-list').html();
830
+ var templateScript = Handlebars.compile(template);
831
+ var html = templateScript(data);
832
+ $('div.hb-filter-file-list-result').html(html);
833
+ }
834
 
835
  Duplicator.UI.loadQtip();
836
  }
views/packages/main/s3.build.php CHANGED
@@ -8,6 +8,7 @@ require_once (DUPLICATOR_PLUGIN_PATH.'classes/package/duparchive/class.pack.arch
8
  $retry_nonuce = wp_create_nonce('new1-package');
9
  $zip_build_nonce = wp_create_nonce('duplicator_package_build');
10
  $duparchive_build_nonce = wp_create_nonce('duplicator_duparchive_package_build');
 
11
 
12
  //Help support Duplicator
13
  $atext0 = "<a target='_blank' href='https://wordpress.org/support/plugin/duplicator/reviews/?filter=5'>";
@@ -23,6 +24,8 @@ $rand_txt[0] = $atext0;
23
  ?>
24
 
25
  <style>
 
 
26
  div#dup-progress-area {text-align:center; max-width:800px; min-height:200px; border:1px solid silver; border-radius:5px; margin:25px auto 10px auto; padding:0px; box-shadow: 0 8px 6px -6px #999;}
27
  div.dup-progress-title {font-size:22px;padding:5px 0 20px 0; font-weight: bold}
28
  div#dup-progress-area div.inner {padding:10px; line-height:22px}
@@ -82,14 +85,20 @@ TOOL BAR: STEPS -->
82
  </div>
83
  </td>
84
  <td style="padding-bottom:4px">
85
- <div id="dup-create-area-nolink"><?php esc_html_e("Create New", 'duplicator'); ?></div>
86
- <?php
 
 
87
  $package_url = admin_url('admin.php?page=duplicator&tab=new1');
88
  $package_nonce_url = wp_nonce_url($package_url, 'new1-package');
89
  ?>
90
- <div id="dup-create-area-link"><a href="<?php echo $package_nonce_url;?>" class="add-new-h2"><?php esc_html_e("Create New", 'duplicator'); ?></a></div>
91
- <div style="float:right;margin: 0px 5px;"><a href="?page=duplicator" class="add-new-h2"><i class="fa fa-archive"></i> <?php esc_html_e("Packages",
92
- 'duplicator'); ?></a></div>
 
 
 
 
93
  </td>
94
  </tr>
95
  </table>
@@ -557,7 +566,7 @@ jQuery(document).ready(function ($)
557
  console.error(err);
558
  console.error('JSON parse failed for response data: ' + respData);
559
  console.log('Error retrieving build status');
560
- console.log(xHr);
561
  return false;
562
  }
563
  if(data.report.status == 1) {
@@ -600,7 +609,8 @@ jQuery(document).ready(function ($)
600
  $('#dup-btn-archive-size').append('&nbsp; (' + data.archiveSize + ')')
601
  $('#data-name-hash').text(pack.NameHash || 'error read');
602
  $('#data-time').text(data.runtime || 'unable to read time');
603
-
 
604
  //Wire Up Downloads
605
  $('#dup-btn-installer').click(function() { Duplicator.Pack.DownloadPackageFile(0, pack.ID); return false});
606
  $('#dup-btn-archive').click(function() {
8
  $retry_nonuce = wp_create_nonce('new1-package');
9
  $zip_build_nonce = wp_create_nonce('duplicator_package_build');
10
  $duparchive_build_nonce = wp_create_nonce('duplicator_duparchive_package_build');
11
+ $active_package_present = true;
12
 
13
  //Help support Duplicator
14
  $atext0 = "<a target='_blank' href='https://wordpress.org/support/plugin/duplicator/reviews/?filter=5'>";
24
  ?>
25
 
26
  <style>
27
+ .add-new-h2.disabled {cursor: not-allowed; border-color: #ccc !important; background: #f7f7f7 !important; color: #ccc !important;}
28
+ a#dup-create-new {margin-left:-5px}
29
  div#dup-progress-area {text-align:center; max-width:800px; min-height:200px; border:1px solid silver; border-radius:5px; margin:25px auto 10px auto; padding:0px; box-shadow: 0 8px 6px -6px #999;}
30
  div.dup-progress-title {font-size:22px;padding:5px 0 20px 0; font-weight: bold}
31
  div#dup-progress-area div.inner {padding:10px; line-height:22px}
85
  </div>
86
  </td>
87
  <td style="padding-bottom:4px">
88
+ <span><a href="?page=duplicator" class="add-new-h2">
89
+ <i class="fa fa-archive"></i> <?php esc_html_e("Packages",'duplicator'); ?>
90
+ </a></span>
91
+ <?php
92
  $package_url = admin_url('admin.php?page=duplicator&tab=new1');
93
  $package_nonce_url = wp_nonce_url($package_url, 'new1-package');
94
  ?>
95
+ <a id="dup-create-new"
96
+ onClick="return !jQuery(this).hasClass('disabled');"
97
+ href="<?php echo $package_nonce_url;?>"
98
+ class="add-new-h2 <?php echo ($active_package_present ? 'disabled' : ''); ?>"
99
+ >
100
+ <?php esc_html_e("Create New", 'duplicator'); ?>
101
+ </a>
102
  </td>
103
  </tr>
104
  </table>
566
  console.error(err);
567
  console.error('JSON parse failed for response data: ' + respData);
568
  console.log('Error retrieving build status');
569
+ console.log(xHr);
570
  return false;
571
  }
572
  if(data.report.status == 1) {
609
  $('#dup-btn-archive-size').append('&nbsp; (' + data.archiveSize + ')')
610
  $('#data-name-hash').text(pack.NameHash || 'error read');
611
  $('#data-time').text(data.runtime || 'unable to read time');
612
+ $('#dup-create-new').removeClass('disabled');
613
+
614
  //Wire Up Downloads
615
  $('#dup-btn-installer').click(function() { Duplicator.Pack.DownloadPackageFile(0, pack.ID); return false});
616
  $('#dup-btn-archive').click(function() {
views/settings/general.php CHANGED
@@ -23,6 +23,9 @@ if (isset($_POST['action']) && $_POST['action'] == 'save') {
23
 
24
  DUP_Settings::Set('wpfront_integrate', isset($_POST['wpfront_integrate']) ? "1" : "0");
25
  DUP_Settings::Set('package_debug', isset($_POST['package_debug']) ? "1" : "0");
 
 
 
26
 
27
  if(isset($_REQUEST['trace_log_enabled'])) {
28
 
@@ -47,16 +50,15 @@ if (isset($_POST['action']) && $_POST['action'] == 'save') {
47
  DUP_Util::initSnapshotDirectory();
48
  }
49
 
50
- $trace_log_enabled = DUP_Settings::Get('trace_log_enabled');
51
- $uninstall_settings = DUP_Settings::Get('uninstall_settings');
52
- $uninstall_files = DUP_Settings::Get('uninstall_files');
53
- $uninstall_tables = DUP_Settings::Get('uninstall_tables');
54
  $storage_htaccess_off = DUP_Settings::Get('storage_htaccess_off');
55
-
56
- $wpfront_integrate = DUP_Settings::Get('wpfront_integrate');
57
- $wpfront_ready = apply_filters('wpfront_user_role_editor_duplicator_integration_ready', false);
58
- $package_debug = DUP_Settings::Get('package_debug');
59
-
60
  ?>
61
 
62
  <style>
@@ -181,6 +183,16 @@ $package_debug = DUP_Settings::Get('package_debug');
181
  </p>
182
  </td>
183
  </tr>
 
 
 
 
 
 
 
 
 
 
184
  </table>
185
 
186
  <p class="submit" style="margin: 20px 0px 0xp 5px;">
23
 
24
  DUP_Settings::Set('wpfront_integrate', isset($_POST['wpfront_integrate']) ? "1" : "0");
25
  DUP_Settings::Set('package_debug', isset($_POST['package_debug']) ? "1" : "0");
26
+
27
+ $skip_archive_scan = filter_input(INPUT_POST, 'skip_archive_scan' , FILTER_VALIDATE_BOOLEAN);
28
+ DUP_Settings::Set('skip_archive_scan', $skip_archive_scan);
29
 
30
  if(isset($_REQUEST['trace_log_enabled'])) {
31
 
50
  DUP_Util::initSnapshotDirectory();
51
  }
52
 
53
+ $trace_log_enabled = DUP_Settings::Get('trace_log_enabled');
54
+ $uninstall_settings = DUP_Settings::Get('uninstall_settings');
55
+ $uninstall_files = DUP_Settings::Get('uninstall_files');
56
+ $uninstall_tables = DUP_Settings::Get('uninstall_tables');
57
  $storage_htaccess_off = DUP_Settings::Get('storage_htaccess_off');
58
+ $wpfront_integrate = DUP_Settings::Get('wpfront_integrate');
59
+ $wpfront_ready = apply_filters('wpfront_user_role_editor_duplicator_integration_ready', false);
60
+ $package_debug = DUP_Settings::Get('package_debug');
61
+ $skip_archive_scan = DUP_Settings::Get('skip_archive_scan');
 
62
  ?>
63
 
64
  <style>
183
  </p>
184
  </td>
185
  </tr>
186
+ <tr valign="top">
187
+ <th scope="row"><label><?php esc_html_e('Archive scan', 'duplicator'); ?></label></th>
188
+ <td>
189
+ <input type="checkbox" name="skip_archive_scan" id="_skip_archive_scan" <?php checked( $skip_archive_scan , true ); ?> value="1" />
190
+ <label for="_skip_archive_scan"><?php esc_html_e("Skip", 'duplicator') ?> </label><br/>
191
+ <p class="description">
192
+ <?php esc_html_e('If enable skip all files check on scan before package creation.', 'duplicator'); ?>
193
+ </p>
194
+ </td>
195
+ </tr>
196
  </table>
197
 
198
  <p class="submit" style="margin: 20px 0px 0xp 5px;">