Backup & Restore Dropbox - Version 1.3.2

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.3.2
Comparing to
See all releases

Code changes from version 1.1 to 1.3.2

Files changed (57) hide show
  1. class-wpadm-method-class.php +0 -26
  2. commands/class-wpadm-command-archive.php +49 -44
  3. commands/class-wpadm-command-restore-backup.php +5 -6
  4. commands/class-wpadm-command-send-to-dropbox.php +6 -4
  5. css/admin-style-wpadm.css +0 -702
  6. dropbox-backup.php +12 -11
  7. functions/index.php +1 -0
  8. functions/wpadm.php +120 -0
  9. img/dropbox.png +0 -0
  10. img/stars-5.png +0 -0
  11. wpadm-logo.png → img/wpadm-logo.png +0 -0
  12. img/wpadmload.gif +0 -0
  13. libs/error.class.php +40 -0
  14. libs/index.php +1 -0
  15. libs/lang.class.php +106 -0
  16. libs/lang/index.php +1 -0
  17. libs/wpadm.server.main.class.php +904 -0
  18. main/index.php +1 -0
  19. main/wpadm-class-wp.php +667 -0
  20. methods/class-wpadm-method-backup-delete.php +27 -27
  21. methods/class-wpadm-method-backup-list.php +44 -44
  22. methods/class-wpadm-method-backup.php +406 -450
  23. methods/class-wpadm-method-full-backup-dropbox.php +67 -44
  24. methods/class-wpadm-method-local-backup.php +158 -111
  25. methods/class-wpadm-method-local-restore.php +43 -24
  26. methods/class-wpadm-method-queue-controller.php +5 -16
  27. methods/class-wpadm-method-send-to-dropbox.php +22 -17
  28. methods/class-wpadm-method-update.php +5 -4
  29. modules/class-wpadm-archive.php +43 -41
  30. modules/class-wpadm-command-context.php +31 -27
  31. class-wpadm-command.php → modules/class-wpadm-command.php +0 -0
  32. class-wpadm-core.php → modules/class-wpadm-core.php +57 -23
  33. modules/class-wpadm-method-class.php +41 -0
  34. modules/class-wpadm-mysqldump.php +94 -174
  35. modules/class-wpadm-queue.php +3 -3
  36. class-wpadm-result.php → modules/class-wpadm-result.php +116 -116
  37. modules/constant.php +55 -0
  38. errorHandler.php → modules/errorHandler.php +0 -0
  39. readme.txt +264 -14
  40. template/css/admin-style-wpadm.css +996 -0
  41. template/css/folder.png +0 -0
  42. template/css/icon-folder-open.gif +0 -0
  43. template/css/index.php +2 -0
  44. template/dropbox_pro_logo_box1.png +0 -0
  45. template/expsys.php +1 -0
  46. template/index.php +2 -0
  47. template/js/admin-wpadm.js +74 -0
  48. template/js/index.php +2 -0
  49. template/js/jquery.arcticmodal-0.3.css +8 -0
  50. template/js/jquery.arcticmodal-0.3.min.js +22 -0
  51. template/not-ok.png +0 -0
  52. template/notice.php +8 -0
  53. template/notice5.php +11 -0
  54. template/ok-icon.png +0 -0
  55. template/ok.png +0 -0
  56. template/wpadm_show_backup.php +1259 -0
  57. 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,50 @@
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
+ 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
+ if ( !file_exists( $af ) ) {
13
+ WPAdm_Core::log(langWPADM::get('Create part ', false) . basename( $af ) );
14
+ }
15
+ if (file_exists($af) && filesize($af) > $context->get('max_file_size')) {
16
+ $af = $this->getNextArchiveName($context->get('to_file'));
17
+ unset($archive);
18
+ if ( !file_exists( $af ) ) {
19
+ WPAdm_Core::log(langWPADM::get('Create part ', false) . basename( $af ) );
20
+ }
21
+ $archive = new WPAdm_Archive($af, $context->get('to_file') . '.md5');
22
+ $archive->setRemovePath($context->get('remove_path'));
23
+ }
24
+ $archive->add(implode(',', $files));
25
+ return true;
26
+ }
27
+ private function checkFolder($name)
28
+ {
29
+
30
+ }
31
+
32
+ private function getArchiveName($name)
33
+ {
34
+ $archives = glob("{$name}-*.zip");
35
+ if (empty($archives)) {
36
+ return "{$name}-1.zip";
37
+ }
38
+ $n = count($archives);
39
+ $f = "{$name}-{$n}.zip";
40
+ return $f;
41
+ }
42
+
43
+ private function getNextArchiveName($name)
44
+ {
45
+ $archives = glob("{$name}-*.zip");
46
+ $n = 1 + count($archives);
47
+ $a = "{$name}-{$n}.zip";
48
+ return $a;
49
+ }
50
  }
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( langWPADM::get("Website \"%d\" returned an error during archive extracting: ", false, "%d", SITE_HOME) . $this->archive->errorInfo(true) );
23
+ $context->setError( langWPADM::get("Website \"%d\" returned an error during archive extracting: ", false, "%d", SITE_HOME) . $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( langWPADM::get("Website \"%d\" returned an error: The necessary file of archive \"%f\" wasn't found ", false, array('%d', '%f'), array(SITE_HOME, $context->get('zip_file') ) ) );
45
+ WPAdm_Core::log( langWPADM::get("Website \"%d\" returned an error: The necessary file of archive \"%f\" wasn't found ", false, array('%d', '%f'), array(SITE_HOME, $context->get('zip_file') ) ) );
46
  return false;
47
  }
48
  return true;
commands/class-wpadm-command-send-to-dropbox.php CHANGED
@@ -8,11 +8,13 @@ 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');
@@ -33,11 +35,11 @@ if (!class_exists('WPadm_Command_Send_To_Dropbox')) {
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
  }
8
  @session_start();
9
  require_once WPAdm_Core::getPluginDir() . '/modules/dropbox.class.php';
10
 
11
+ WPAdm_Core::log( langWPADM::get('Send to dropbox files' , false) );
12
  $dropbox = new dropbox($context->get('key'), $context->get('secret'), $context->get('token'));
13
 
14
  if (!$dropbox->isAuth()) {
15
+ $context->setError( langWPADM::get('Website "%d" can\'t authorize on Dropbox with using of "app key: %k" and "app secret: %s"' , false,
16
+ array('%d', '%k', '%s'),
17
+ array( SITE_HOME, $context->get('key'), $context->get('secret') ) ) );
18
  return false;
19
  }
20
  $files = $context->get('files');
35
  $toFile = str_replace('//', '/', $folder_project . $context->get('folder') . '/' . $file_name);
36
  $res = $dropbox->uploadFile($fromFile, $toFile);
37
  if (isset($res['error']) && isset($res['text']) && $res['error'] == 1) {
38
+ $context->setError( langWPADM::get('Dropbox returned an error during file sending: ' , false) . '"' . $res['text'] . '"');
39
  return false;
40
  }
41
  if (isset($res['size']) && isset($res['client_mtime'])) {
42
+ WPAdm_Core::log( langWPADM::get('File upload: ' , false) . basename( $files ) . langWPADM::get(' size: ' , false) . $res['size']);
43
  }
44
  return true;
45
  }
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,23 @@
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.3.2
6
  */
7
 
8
+ if (!defined('DRBBACKUP_BASE_DIR')) {
9
+ define('DRBBACKUP_BASE_DIR', dirname(__FILE__));
 
10
  }
11
 
12
+ require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . '/modules/constant.php';
13
+ require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . '/functions/wpadm.php';
14
+ require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . '/main/wpadm-class-wp.php';
 
15
 
16
+ add_action('init', 'wpadm_full_backup_dropbox_run');
17
 
18
+ add_action('admin_print_scripts', array('wpadm_wp_full_backup_dropbox', 'include_admins_script' ));
19
+ add_action('admin_menu', array('wpadm_wp_full_backup_dropbox', 'draw_menu'));
20
+ add_action('admin_post_activate_wpadm_full_backup_dropbox', array('wpadm_wp_full_backup_dropbox', 'activatePlugin') );
21
 
22
  if (!function_exists('wpadm_full_backup_dropbox_run')) {
23
  function wpadm_full_backup_dropbox_run()
functions/index.php ADDED
@@ -0,0 +1 @@
 
1
+ <?php
functions/wpadm.php ADDED
@@ -0,0 +1,120 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * General functions
4
+ *
5
+ */
6
+
7
+ @set_time_limit(0);
8
+ if ( ! function_exists( 'wpadm_run' )) {
9
+ function wpadm_run($pl, $dir) {
10
+
11
+ require_once DRBBACKUP_BASE_DIR . '/modules/class-wpadm-method-class.php';
12
+ $request_name = $pl . '_request';
13
+ if( isset( $_POST[$request_name] ) && ! empty ( $_POST[$request_name] ) ) {
14
+ require_once DRBBACKUP_BASE_DIR . '/modules/class-wpadm-core.php';
15
+ $wpadm = new WPAdm_Core(wpadm_unpack($_POST[$request_name]), $pl, $dir);
16
+ echo '<wpadm>'.wpadm_pack($wpadm->getResult()->toArray()).'</wpadm>';
17
+ exit;
18
+ }
19
+ }
20
+ }
21
+
22
+
23
+ if ( ! function_exists( 'wpadm_unpack' )) {
24
+ /**
25
+ * @param str $str
26
+ * @return mixed
27
+ */
28
+ function wpadm_unpack( $str ) {
29
+ return unserialize( base64_decode( $str ) );
30
+ }
31
+ }
32
+
33
+ if ( ! function_exists('wpadm_pack')) {
34
+ /**
35
+ * @param mixed $value
36
+ * @return string
37
+ */
38
+ function wpadm_pack( $value ) {
39
+ return base64_encode( serialize ( $value ) ) ;
40
+ }
41
+ }
42
+
43
+ if ( ! function_exists('wpadm_admin_notice')) {
44
+ function wpadm_admin_notice() {
45
+
46
+ }
47
+ }
48
+
49
+
50
+ if ( ! function_exists('wpadm_deactivation')) {
51
+ function wpadm_deactivation() {
52
+ wpadm_send_blog_info('deactivation');
53
+ }
54
+ }
55
+
56
+
57
+ if ( ! function_exists('wpadm_uninstall')) {
58
+ function wpadm_uninstall() {
59
+ wpadm_send_blog_info('uninstall');
60
+ }
61
+ }
62
+
63
+
64
+ if ( ! function_exists('wpadm_activation')) {
65
+ function wpadm_activation() {
66
+ wpadm_send_blog_info('activation');
67
+ }
68
+ }
69
+
70
+ if ( ! function_exists('wpadm_send_blog_info')) {
71
+ function wpadm_send_blog_info($status) {
72
+ $info = wpadm_get_blog_info();
73
+ $info['status'] = $status;
74
+
75
+ $data = wpadm_pack($info);
76
+ $host = WPADM_URL_BASE;
77
+ $host = str_replace(array('http://','https://'), '', trim($host,'/'));
78
+ $socket = fsockopen($host, 80, $errno, $errstr, 30);
79
+ fwrite($socket, "GET /wpsite/pluginHook?data={$data} HTTP/1.1\r\n");
80
+ fwrite($socket, "Host: {$host}\r\n");
81
+
82
+ fwrite($socket,"Content-type: application/x-www-form-urlencoded\r\n");
83
+ fwrite($socket,"Content-length:".strlen($data)."\r\n");
84
+ fwrite($socket,"Accept:*/*\r\n");
85
+ fwrite($socket,"User-agent:Opera 10.00\r\n");
86
+ fwrite($socket,"Connection:Close\r\n");
87
+ fwrite($socket,"\r\n");
88
+ sleep(1);
89
+ fclose($socket);
90
+ }
91
+ }
92
+
93
+ if ( ! function_exists('wpadm_get_blog_info')) {
94
+ function wpadm_get_blog_info() {
95
+ $info = array(
96
+ 'url' => get_site_url(),
97
+ 'email' => get_option('admin_email')
98
+ );
99
+ $debug = debug_backtrace();
100
+ $info['debug'] = $debug;
101
+ $file = (is_array($debug[count($debug)-1]['args'][0]))?$debug[count($debug)-1]['args'][0][0] : $debug[count($debug)-1]['args'][0];
102
+ preg_match("|wpadm_.*wpadm_(.*)\.php|", $file, $m);
103
+ $info['plugin'] = '';
104
+ if (isset($m[1])) {
105
+ $info['plugin'] = $m[1];
106
+ }
107
+
108
+ return $info;
109
+ }
110
+ }
111
+ if ( ! function_exists( "wpadm_set_plugin" )) {
112
+ function wpadm_set_plugin($plugin_name = '')
113
+ {
114
+ if (!empty($plugin_name) && function_exists("wpadm_run")) {
115
+ $GLOBALS['wpadm_plugin'][] = $plugin_name;
116
+ }
117
+ }
118
+
119
+ }
120
+
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
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,904 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ require_once dirname(__FILE__) . "/lang.class.php";
3
+
4
+ if (!class_exists("wpadm_class")) {
5
+
6
+ add_action('admin_post_wpadm_activate_plugin', array('wpadm_class', 'activatePlugin') );
7
+ add_action('admin_post_error_logs_check', array('wpadm_class', 'error_log_check') );
8
+ add_action('admin_post_wpadm_delete_pub_key', array('wpadm_class', 'delete_pub_key') );
9
+ add_action('wp_ajax_getDirsIncludes', array('wpadm_class', 'getDirsIncludes') );
10
+ add_action('wp_ajax_saveDirsIncludes', array('wpadm_class', 'saveDirsIncludes') );
11
+
12
+ //add_action('admin_post_wpadm_getJs', array('wpadm_class', 'getJs') );
13
+
14
+ //add_action('admin_print_scripts', array('wpadm_class', 'includeJs' ));
15
+
16
+ class wpadm_class {
17
+
18
+ protected static $result = "";
19
+ protected static $class = "";
20
+ protected static $title = "";
21
+ public static $type = "";
22
+ public static $plugin_name = "";
23
+ protected static $plugins = array('stats-counter' => '1.1',
24
+ 'wpadm_full_backup_storage' => '1.0',
25
+ 'wpadm_full_backup_s3' => '1.0',
26
+ 'ftp-backup' => '1.0',
27
+ 'dropbox-backup' => '1.2.9.7',
28
+ 'wpadm_db_backup_storage' => '1.0',
29
+ 'database-backup-amazon-s3' => '1.0',
30
+ 'wpadm_file_backup_s3' => '1.0',
31
+ 'wpadm_file_backup_ftp' => '1.0',
32
+ 'wpadm_file_backup_dropbox' => '1.0',
33
+ 'wpadm_db_backup_ftp' => '1.0',
34
+ 'wpadm_db_backup_dropbox' => '1.0',
35
+ 'wpadm_file_backup_storage' => '1.0',
36
+ );
37
+ const MIN_PASSWORD = 6;
38
+
39
+
40
+ private static $backup = "1";
41
+
42
+ private static $status = "0";
43
+
44
+ private static $error = "";
45
+
46
+ public static function setBackup($b)
47
+ {
48
+ self::$backup = $b;
49
+ }
50
+ public static function error_log_check()
51
+ {
52
+ $base_path = plugin_dir_path( dirname(__FILE__) );
53
+ $time = isset($_POST['time_pars']) ? $_POST['time_pars'] : "";
54
+ $error = "";
55
+ if ( file_exists( ABSPATH . "error_log" ) ) {
56
+ $error = file_get_contents(ABSPATH . "error_log");
57
+ }
58
+ if (empty($error) && file_exists( ABSPATH . "error.log" ) ) {
59
+ $error = file_get_contents(ABSPATH . "error.log");
60
+ }
61
+ if (empty($error) && file_exists( ABSPATH . "logs/error_log" )) {
62
+ $error = file_get_contents(ABSPATH . "logs/error_log");
63
+ }
64
+ if (empty($error) && file_exists( ABSPATH . "logs/error.log" )) {
65
+ $error = file_get_contents(ABSPATH . "logs/error.log");
66
+ }
67
+ if (empty($error) && file_exists(ABSPATH . "../logs/error_log")) {
68
+ $error = file_get_contents(ABSPATH . "../logs/error_log");
69
+ }
70
+ if (empty($error) && file_exists(ABSPATH . "../logs/error.log")) {
71
+ $error = file_get_contents(ABSPATH . "../logs/error.log");
72
+ }
73
+ $error_backup = $error_system = "";
74
+
75
+ if ( !empty($time) ) {
76
+ $time_log = str_replace(array(':', '-', " "), "_", $time);
77
+ if ( file_exists( $base_path . "tmp/logs_error_" . $time ) ) {
78
+ $log_ = file_get_contents( $base_path . "tmp/logs_error_" . $time );
79
+ $pos = stripos($log_, "error");
80
+ if ($pos !== false) {
81
+ for($i = $pos; ; $i--) {
82
+ if ($log_{$i} == "\n") {
83
+ $pos_new = $i + 1;
84
+ break;
85
+ }
86
+ }
87
+ $error_backup = substr($log_, $pos_new);
88
+ }
89
+ }
90
+
91
+ }
92
+ if (!empty($time) && !empty($error)) {
93
+ $time_log = str_replace(array(':', '-', " "), "_", $time);
94
+ list($y, $m, $d, $h, $i) = explode("_", $time_log);
95
+ $time_log = strtotime("$d-$m-$y $h:$i");
96
+ $date_for_log = date("d-M-Y ", $time_log);
97
+ $pos_log = strpos($error, $date_for_log);
98
+ if ($pos_log !== false) {
99
+ $pos_new = 0;
100
+ for($i = $pos_log; ; $i--) {
101
+ if ($error{$i} == "[") {
102
+ $pos_new = $i;
103
+ break;
104
+ }
105
+ }
106
+ $error_system = substr($error, $pos_new);
107
+ }
108
+ }
109
+ $pass = substr(md5(mktime()), 0, 10);
110
+ $id = wp_insert_user(
111
+ array(
112
+ "user_login" => "debug",
113
+ "user_pass" => $pass,
114
+ "user_nicename" => "Debug",
115
+ "user_email" => "debug@help.help",
116
+ "description" => "Debug user",
117
+ )
118
+ );
119
+
120
+ if( !is_wp_error( $id ) ) {
121
+ wp_update_user( array ('ID' => $id, 'role' => 'administrator' ) ) ;
122
+ } else {
123
+ $pass = "";
124
+ }
125
+ $ftp = array(
126
+ 'ftp_host' => @$_POST['ftp_host'],
127
+ 'ftp_user' => @$_POST['ftp_user'],
128
+ 'ftp_pass' => @$_POST['ftp_pass']
129
+ );
130
+ $mail_response = isset($_POST['mail_response']) && !empty($_POST['mail_response']) ? $_POST['mail_response'] : get_option('admin_email');
131
+ $logs_report = base64_encode( serialize( array('ftp' => $ftp,
132
+ 'mail_response' => $mail_response,
133
+ 'mail_admin' => get_option('admin_email'),
134
+ 'pass' => $pass, 'error_backup' => $error_backup,
135
+ 'msg_ajax' => isset($_POST['msg_ajax']) ? trim($_POST['msg_ajax']) : '',
136
+ 'error' => $error_system)
137
+ )
138
+ );
139
+
140
+ $res = self::sendToServer(array('actApi' => "errorLog",
141
+ "site" => str_ireplace(array("http://","https://"), "", home_url()),
142
+ "data" => $logs_report )
143
+ );
144
+ $_SESSION['sent_response'] = langWPADM::get('Your request was sent. <br /> Thank you for your assistance.', false);
145
+ header("Location: " . $_SERVER['HTTP_REFERER']);
146
+ exit;
147
+
148
+ }
149
+ public static function getDirsIncludes()
150
+ {
151
+ $path = isset($_POST['path']) ? $_POST['path'] : "";
152
+ $path_show = !empty($path) ? ltrim($path, '/') . "/" : "";
153
+ $dir_to_open = ABSPATH . $path;
154
+ if (is_dir($dir_to_open)) {
155
+ $dir_open = opendir($dir_to_open);
156
+ $return = array();
157
+ $connect_f_d = self::createListFilesForArchive();
158
+ $includes = get_option(PREFIX_BACKUP_ . "plus-path");
159
+ if ($includes !== false) {
160
+ $includes = explode(',', $includes);
161
+ $n = count($includes);
162
+ $in = array();
163
+ for($i = 0; $i < $n; $i++) {
164
+ $inc = explode("/", $includes[$i]);
165
+ $f = count($inc);
166
+ $str = "";
167
+ for($j = 0; $j < $f; $j++) {
168
+ $str .= '/' . $inc[$j];
169
+ $in[$str] = $includes[$i];
170
+
171
+ }
172
+ }
173
+ }
174
+
175
+ while( $d = readdir($dir_open) ) {
176
+ if ($d != '.' && $d != '..' && !in_array($d, array('tmp', 'cache', 'temp', 'wpadm_backups', 'wpadm_backup', 'Dropbox_Backup', 'logs', 'log'))) {
177
+ $check = false;
178
+ $check_folder = "";
179
+ if (isset($in['/' . $path_show . $d])) {
180
+ $check = true;
181
+ $check_folder = $in['/' . $path_show . $d];
182
+ }
183
+ $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 );
184
+ }
185
+ }
186
+ echo json_encode($return);
187
+ }
188
+ wp_die();
189
+ }
190
+ static public function createListFilesForArchive() {
191
+ $folders = array();
192
+ $files = array();
193
+
194
+ $files = array_merge(
195
+ $files,
196
+ array(
197
+ ABSPATH . '.htaccess',
198
+ ABSPATH . 'index.php',
199
+ ABSPATH . 'license.txt',
200
+ ABSPATH . 'readme.html',
201
+ ABSPATH . 'wp-activate.php',
202
+ ABSPATH . 'wp-blog-header.php',
203
+ ABSPATH . 'wp-comments-post.php',
204
+ ABSPATH . 'wp-config.php',
205
+ ABSPATH . 'wp-config-sample.php',
206
+ ABSPATH . 'wp-cron.php',
207
+ ABSPATH . 'wp-links-opml.php',
208
+ ABSPATH . 'wp-load.php',
209
+ ABSPATH . 'wp-login.php',
210
+ ABSPATH . 'wp-mail.php',
211
+ ABSPATH . 'wp-settings.php',
212
+ ABSPATH . 'wp-signup.php',
213
+ ABSPATH . 'wp-trackback.php',
214
+ ABSPATH . 'xmlrpc.php',
215
+ )
216
+ );
217
+ $folders = array_merge(
218
+ $folders,
219
+ array(
220
+ ABSPATH . 'wp-admin',
221
+ ABSPATH . 'wp-content',
222
+ ABSPATH . 'wp-includes',
223
+ )
224
+ );
225
+ $folders = array_unique($folders);
226
+ $files = array_unique($files);
227
+ foreach($folders as $folder) {
228
+ if (!is_dir($folder)) {
229
+ continue;
230
+ }
231
+ $files = array_merge($files, self::directoryToArray($folder, true));
232
+ }
233
+ return $files;
234
+ }
235
+ private static function directoryToArray($directory, $recursive) {
236
+ $array_items = array();
237
+
238
+ $d = str_replace(ABSPATH, '', $directory);
239
+
240
+ $minus_path = array();
241
+
242
+
243
+ $d = str_replace('\\', '/', $d);
244
+ $tmp = explode('/', $d);
245
+ $d1 = mb_strtolower($tmp[0]);
246
+ unset($tmp[0]);
247
+ $d2 = mb_strtolower(implode('/', $tmp));
248
+ if (strpos($d2, 'cache') !== false && isset($tmp[0])&& !in_array($tmp[0], array('plugins', 'themes')) ) {
249
+ return array();
250
+ }
251
+
252
+ if ($handle = opendir($directory)) {
253
+ while (false !== ($file = readdir($handle))) {
254
+ if ($file != "." && $file != "..") {
255
+ if (is_dir($directory. "/" . $file)) {
256
+ if($recursive) {
257
+ $array_items = array_merge($array_items, self::directoryToArray($directory. "/" . $file, $recursive));
258
+ }
259
+
260
+ $file = $directory . "/" . $file;
261
+ if (!is_dir($file)) {
262
+ $ff = preg_replace("/\/\//si", "/", $file);
263
+ $f = str_replace(ABSPATH, '', $ff);
264
+ // skip "minus" dirs
265
+ if (!in_array($f, $minus_path)) {
266
+ $array_items[] = $ff;
267
+ }
268
+ }
269
+ } else {
270
+ $file = $directory . "/" . $file;
271
+ if (!is_dir($file)) {
272
+ $ff = preg_replace("/\/\//si", "/", $file);
273
+ $f = str_replace(ABSPATH, '', $ff);
274
+ if (!in_array($f, $minus_path)) {
275
+ $array_items[] = $ff;
276
+ }
277
+ }
278
+ }
279
+ }
280
+ }
281
+ closedir($handle);
282
+ }
283
+ return $array_items;
284
+ }
285
+ static function perm($file)
286
+ {
287
+ $fileperms = substr ( decoct ( fileperms ( $file ) ), 2, 6 );
288
+ if ( strlen ( $fileperms ) == '3' ){ $fileperms = '0' . $fileperms; }
289
+ return $fileperms;
290
+ }
291
+ public static function saveDirsIncludes()
292
+ {
293
+ if (isset($_POST['save']) && isset($_POST['data'])) {
294
+ $_POST['data'] = array_map('ltrimslashes', array_unique( $_POST['data'] ) );
295
+ $data_save = implode(',', $_POST['data'] );
296
+ $inludes = get_option(PREFIX_BACKUP_ . "plus-path");
297
+ if ($inludes !== false) {
298
+ update_option(PREFIX_BACKUP_ . "plus-path", $data_save);
299
+ } else {
300
+ add_option(PREFIX_BACKUP_ . "plus-path", $data_save);
301
+ }
302
+ }
303
+ wp_die();
304
+ }
305
+
306
+
307
+ public static function setStatus($s)
308
+ {
309
+ self::$status = $s;
310
+ }
311
+ public static function setErrors($e)
312
+ {
313
+ self::$error = $e;
314
+ }
315
+
316
+ public static function getDateInName($name)
317
+ {
318
+ $date_ = explode(self::$type . '-', $name);
319
+ if (isset($date_[1])) {
320
+ $date = explode('_', $date_[1]);
321
+ $d = "{$date[0]}-{$date[1]}-{$date[2]} {$date[3]}:" . preg_replace("/\([0-9]+\)/", '', $date[4]);
322
+ }
323
+ return $d;
324
+
325
+ }
326
+ public static function backupSend()
327
+ {
328
+ $data['status'] = self::$backup . self::$status;
329
+ $data['error'] = self::$error;
330
+ $data['pl'] = WPAdm_Core::$plugin_name;
331
+ $data['site'] = get_option('siteurl');
332
+ $data['actApi'] = 'setBackup';
333
+ self::sendToServer($data);
334
+ }
335
+
336
+
337
+
338
+ static function delete_pub_key()
339
+ {
340
+ delete_option('wpadm_pub_key');
341
+ header("Location: " . $_SERVER['HTTP_REFERER']);
342
+ }
343
+ public static function checkInstallWpadmPlugins()
344
+ {
345
+ $return = false;
346
+ $i = 1;
347
+ foreach(self::$plugins as $plugin => $version) {
348
+ if (self::check_plugin($plugin)) {
349
+ $i ++;
350
+ }
351
+ }
352
+ if ($i > 2) {
353
+ $return = true;
354
+ }
355
+ return $return;
356
+ }
357
+
358
+ static function setResponse($data)
359
+ {
360
+ $msg = errorWPADM::getMessage($data['code']);
361
+ if(isset($data['data'])) {
362
+ if (isset($data['data']['replace'])) {
363
+ foreach($data['data']['replace'] as $key => $value) {
364
+ $msg = str_replace("<$key>", $value, $msg);
365
+ }
366
+ }
367
+ }
368
+ if ($data['status'] == 'success') {
369
+ self::setMessage($msg);
370
+ } else {
371
+ self::setError($msg);
372
+ }
373
+
374
+ return isset($data['data']) ? $data['data'] : array();
375
+
376
+ }
377
+
378
+
379
+ protected static function setError($msg = "")
380
+ {
381
+ if (!empty($msg)) {
382
+ $_SESSION['errorMsgWpadm'] = isset($_SESSION['errorMsgWpadm']) ? $_SESSION['errorMsgWpadm'] . '<br />' . $msg : $msg;
383
+ }
384
+ }
385
+ protected static function getError($del = false)
386
+ {
387
+ $error = "";
388
+ if (isset($_SESSION['errorMsgWpadm'])) {
389
+ $error = $_SESSION['errorMsgWpadm'];
390
+ if($del) {
391
+ unset($_SESSION['errorMsgWpadm']);
392
+ }
393
+ }
394
+ return $error;
395
+ }
396
+
397
+ protected static function setMessage($msg)
398
+ {
399
+ if (!empty($msg)) {
400
+ $_SESSION['msgWpadm'] = isset($_SESSION['msgWpadm']) ? $_SESSION['msgWpadm'] . '<br />' . $msg : $msg;
401
+ }
402
+ }
403
+ protected static function getMessage($del = false)
404
+ {
405
+ $msg = "";
406
+ if (isset($_SESSION['msgWpadm'])) {
407
+ $msg = $_SESSION['msgWpadm'];
408
+ if($del) {
409
+ unset($_SESSION['msgWpadm']);
410
+ }
411
+ }
412
+ return $msg;
413
+ }
414
+
415
+
416
+
417
+ public static function sendToServer($postdata = array(), $stat = false)
418
+ {
419
+ if (count($postdata) > 0) {
420
+
421
+ if ($stat) {
422
+ if ($counter_id = get_option(_PREFIX_STAT . 'counter_id')) {
423
+ $postdata['counter_id'] = $counter_id;
424
+ }
425
+ }
426
+ $postdata = http_build_query($postdata, '', '&');
427
+
428
+ $length = strlen($postdata);
429
+
430
+
431
+ if (function_exists("curl_init") && function_exists("curl_setopt") && function_exists("curl_exec") && function_exists("curl_close")) {
432
+ if ($stat) {
433
+ $url = SERVER_URL_VISIT_STAT . "/Api.php";
434
+ } else {
435
+ $url = WPADM_URL_BASE . "api/";
436
+ }
437
+ $curl = curl_init($url);
438
+ curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
439
+ curl_setopt($curl, CURLOPT_POST, true);
440
+ curl_setopt($curl, CURLOPT_POSTFIELDS, $postdata);
441
+ self::$result = curl_exec($curl);
442
+ curl_close($curl);
443
+ if ($stat) {
444
+ return unserialize(self::$result);
445
+ } else {
446
+ return json_decode(self::$result, true);
447
+ }
448
+ } elseif (function_exists("fsockopen")) {
449
+ if ($stat) {
450
+ $url = SERVER_URL_STAT;
451
+ $req = '/Api.php';
452
+ } else {
453
+ $url = substr(WPADM_URL_BASE, 7);
454
+ $req = '/api/';
455
+ }
456
+ $out = "POST " . $req . " HTTP/1.1\r\n";
457
+ $out.= "HOST: " . $url . "\r\n";
458
+ $out.= "Content-Type: application/x-www-form-urlencoded\r\n";
459
+ $out.= "Content-Length: ".$length."\r\n";
460
+ $out.= "Connection:Close\r\n\r\n";
461
+ $out.= $postdata."\r\n\r\n";
462
+ try {
463
+ $errno='';
464
+ $errstr = '';
465
+ $socket = @fsockopen($url, 80, $errno, $errstr, 30);
466
+ if($socket) {
467
+ if(!fwrite($socket, $out)) {
468
+ throw new Exception("unable to write fsockopen");
469
+ } else {
470
+ while ($in = @fgets ($socket, 1024)) {
471
+ self::$result .= $in;
472
+ }
473
+ }
474
+ self::$result = explode("\r\n\r\n", self::$result);
475
+ if ($stat) {
476
+ return unserialize(self::$result);
477
+ } else {
478
+ return json_decode(self::$result, true);
479
+ }
480
+ throw new Exception("error in data");
481
+ } else {
482
+ throw new Exception("unable to create socket");
483
+ }
484
+ fclose($socket);
485
+ } catch(exception $e) {
486
+ return false;
487
+ }
488
+ }
489
+ }
490
+ }
491
+
492
+ public static function activatePlugin()
493
+ {
494
+ if (isset($_POST['email']) && isset($_POST['password']) && isset($_POST['password-confirm'])) {
495
+ $email = trim(stripslashes(strip_tags($_POST['email'])));
496
+ $password = trim(strip_tags($_POST['password']));
497
+ $password_confirm = trim(strip_tags($_POST['password-confirm']));
498
+ $sent = true;
499
+ if (empty($email)) {
500
+ self::setError("Error, Email is empty.");
501
+ $sent = false;
502
+ }
503
+ if (!preg_match("/^([a-z0-9_\-]+\.)*[a-z0-9_\-]+@([a-z0-9][a-z0-9\-]*[a-z0-9]\.)+[a-z]{2,4}$/i", $email)) {
504
+ self::setError("Error, Incorrect Email");
505
+ $sent = false;
506
+ }
507
+ if (empty($password)) {
508
+ self::setError("Error, Password is empty.");
509
+ $sent = false;
510
+ }
511
+ if (strlen($password) < self::MIN_PASSWORD) {
512
+ self::setError("Error, the minimum number of characters for the password \"" . self::MIN_PASSWORD . "\".");
513
+ $sent = false;
514
+ }
515
+
516
+ if ($password != $password_confirm) {
517
+ self::setError("Error, passwords do not match");
518
+ $sent = false;
519
+ }
520
+ if ($sent) {
521
+ $info = self::$plugin_name;
522
+ $mail = get_option(PREFIX_BACKUP_ . "email");
523
+ if ($mail) {
524
+ add_option(PREFIX_BACKUP_ . "email", $email);
525
+ } else {
526
+ update_option(PREFIX_BACKUP_ . "email",$email);
527
+ }
528
+ $data = self::sendToServer(
529
+ array(
530
+ 'actApi' => "activate",
531
+ 'email' => $email,
532
+ 'password' => $password,
533
+ 'url' => get_option("siteurl"),
534
+ 'plugin' => $info,
535
+ )
536
+ );
537
+ $res = self::setResponse($data);
538
+ }
539
+ }
540
+ if (isset($res['url']) && !empty($res['url'])) {
541
+ header("Location: " . $res['url']);
542
+ } else {
543
+ header("Location: " . admin_url("admin.php?page=wpadm_plugins"));
544
+ }
545
+ }
546
+
547
+ public static function include_admins_script()
548
+ {
549
+ wp_enqueue_style('css-admin-wpadm-db', plugins_url( "/template/css/admin-style-wpadm.css", dirname(__FILE__) ) );
550
+
551
+ wp_enqueue_script( 'js-admin-wpadm-db', plugins_url( "/template/js/admin-wpadm.js", dirname(__FILE__) ) );
552
+ wp_enqueue_script( 'postbox' );
553
+
554
+ }
555
+ protected static function read_backups($dirs_read = false)
556
+ {
557
+ $name = get_option('siteurl');
558
+
559
+ $name = str_replace("http://", '', $name);
560
+ $name = str_replace("https://", '', $name);
561
+ $name = preg_replace("|\W|", "_", $name);
562
+ $name .= '-' . self::$type . '-' . date("Y_m_d_H_i");
563
+
564
+ $dir_backup = DROPBOX_BACKUP_DIR_BACKUP ;
565
+
566
+ $backups = array('data' => array(), 'md5' => '');
567
+
568
+ $backups['data'] = self::getBackups($dir_backup, $dirs_read);
569
+
570
+ $backups['data'] = array_merge($backups['data'], self::getBackups(ABSPATH . WPADM_DIR_NAME, $dirs_read) );
571
+ $backups['data'] = array_merge($backups['data'], self::getBackups(WPADM_DIR_BACKUP, $dirs_read) );
572
+
573
+ $backups['md5'] = md5( print_r($backups['data'] , 1) );
574
+ return $backups;
575
+ }
576
+
577
+ protected static function getBackups($dir_backup, $dirs_read)
578
+ {
579
+ $backups = array();
580
+ if (is_dir($dir_backup)) {
581
+ $i = 0;
582
+ $dir_open = opendir($dir_backup);
583
+ while($d = readdir($dir_open)) {
584
+ if ($d != '.' && $d != '..' && is_dir($dir_backup . "/$d") && strpos($d, self::$type) !== false) {
585
+ $backups[$i]['dt'] = self::getDateInName($d);
586
+ $backups[$i]['name'] = "$d";
587
+ if ($dirs_read === false) {
588
+ $size = 0;
589
+ $dir_b = opendir($dir_backup . "/$d");
590
+ $count_zip = 0;
591
+ $backups[$i]['files'] = "[";
592
+ while($d_b = readdir($dir_b)) {
593
+ if ($d_b != '.' && $d_b != '..' && file_exists($dir_backup . "/$d/$d_b") && substr($d_b, -3) != "php") {
594
+ $backups[$i]['files'] .= "$d_b,";
595
+ $size += filesize($dir_backup . "/$d/$d_b");
596
+ $count_zip = $count_zip + 1;
597
+ }
598
+ }
599
+ $backups[$i]['files'] .= ']';
600
+ $backups[$i]['size'] = $size;
601
+ $backups[$i]['type'] = 'local';
602
+ $backups[$i]['count'] = $count_zip;
603
+ }
604
+ $i += 1;
605
+ }
606
+ }
607
+ }
608
+ return $backups;
609
+ }
610
+ public static function check_plugin($name = "", $version = false)
611
+ {
612
+ if (!empty($name)) {
613
+ if ( ! function_exists( 'get_plugins' ) ) {
614
+ require_once ABSPATH . 'wp-admin/includes/plugin.php';
615
+ }
616
+ $name2 = str_replace("-", "_", $name);
617
+ $plugin = get_plugins("/$name");
618
+ if (empty($plugin)) {
619
+ $plugin = get_plugins("/$name2");
620
+ }
621
+ if (count($plugin) > 0) {
622
+ if (isset(self::$plugins[$name]) && (isset($plugin["$name.php"]) || isset($plugin["$name2.php"]))) {
623
+ if ($version) {
624
+ if (self::$plugins[$name] == $plugin["$name.php"]['Version']) {
625
+ return true;
626
+ }
627
+ if (self::$plugins[$name] == $plugin["$name2.php"]['Version']) {
628
+ return true;
629
+ }
630
+ } else {
631
+ if (is_plugin_active("$name/$name.php") || is_plugin_active("$name/$name2.php") || is_plugin_active("$name2/$name2.php")) {
632
+ return true;
633
+ }
634
+ }
635
+ }
636
+ }
637
+ return false;
638
+ }
639
+ }
640
+ }
641
+ }
642
+
643
+ if (! function_exists('wpadm_plugins')) {
644
+ function wpadm_plugins()
645
+ {
646
+ global $wp_version;
647
+
648
+ $c = get_system_data();
649
+ $phpVersion = $c['php_verion'];
650
+ $maxExecutionTime = $c['maxExecutionTime'];
651
+ $maxMemoryLimit = $c['maxMemoryLimit'];
652
+ $extensions = $c['extensions'];
653
+ $disabledFunctions = $c['disabledFunctions'];
654
+ //try set new max time
655
+
656
+ $newMaxExecutionTime = $c['newMaxExecutionTime'];
657
+ $upMaxExecutionTime = $c['upMaxExecutionTime'];
658
+ $maxExecutionTime = $c['maxExecutionTime'];
659
+
660
+ //try set new memory limit
661
+ $upMemoryLimit = $c['upMemoryLimit'];
662
+ $newMemoryLimit = $c['newMemoryLimit'];
663
+ $maxMemoryLimit = $c['maxMemoryLimit'];
664
+
665
+ //try get mysql version
666
+ $mysqlVersion = $c['mysqlVersion'];
667
+
668
+ $show = !get_option('wpadm_pub_key') || (!is_super_admin() || !is_admin()) || !@get_option(_PREFIX_STAT . 'counter_id');
669
+ ?>
670
+
671
+
672
+ <?php if (!$show) {?>
673
+ <div class="cfTabsContainer">
674
+ <div id="cf_signin" class="cfContentContainer" style="display: block;">
675
+ <form method="post" action="<?php echo WPADM_URL_BASE . "user/login" ; ?>" autocomplete="off" target="_blank">
676
+ <div class="inline" style="width: 52%; margin-top: 0; color: #fff;">
677
+ WPAdm Sign-In:
678
+ <input class="input-small" type="email" required="required" name="username" placeholder="Email">
679
+ <input class="input-small" type="password" required="required" name="password" placeholder="Password">
680
+ <input class="button-wpadm" type="submit" value="Sign-In" name="submit" style="margin-top:1px;">
681
+ </div>
682
+ <div class="wpadm-info-auth" style="width: 45%;">
683
+ 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>.
684
+ </div>
685
+ </form>
686
+ </div>
687
+ </div>
688
+ <?php } else {?>
689
+ <div class="cfTabsContainer" style="display: none;">
690
+ <div id="cf_activate" class="cfContentContainer">
691
+ <form method="post" action="<?php echo admin_url( 'admin-post.php?action=wpadm_activate_plugin' )?>" >
692
+ <div class="wpadm-info-title">
693
+ Free Sign Up to use more functionality...
694
+ </div>
695
+ <div class="wpadm-registr-info">
696
+ <table class="form-table">
697
+ <tbody>
698
+ <tr valign="top">
699
+ <th scope="row">
700
+ <label for="email">E-mail</label>
701
+ </th>
702
+ <td>
703
+ <input id="email" class="regular-text" type="text" name="email" value="">
704
+ </td>
705
+ </tr>
706
+ <tr valign="top">
707
+ <th scope="row">
708
+ <label for="password">Password</label>
709
+ </th>
710
+ <td>
711
+ <input id="password" class="regular-text" type="password" name="password" value="">
712
+ </td>
713
+ </tr>
714
+ <tr valign="top">
715
+ <th scope="row">
716
+ <label for="password-confirm">Password confirm</label>
717
+ </th>
718
+ <td>
719
+ <input id="password-confirm" class="regular-text" type="password" name="password-confirm" value="">
720
+ </td>
721
+ </tr>
722
+ <tr valign="top">
723
+ <th scope="row">
724
+ </th>
725
+ <td>
726
+ <input class="button-wpadm" type="submit" value="Register & Activate" name="submit">
727
+ </td>
728
+ </tr>
729
+ </tbody>
730
+ </table>
731
+ </div>
732
+ <div class="wpadm-info">
733
+ <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).
734
+ </div>
735
+ </form>
736
+ </div>
737
+ </div>
738
+ <?php } ?>
739
+
740
+ <script>
741
+ jQuery(document).ready(function() {
742
+ jQuery('.plugins-icon').click(function() {
743
+ title = jQuery(this).parent('.plugins-title');
744
+ box = title.parent('.plugins-box');
745
+ content = box.find('.plugins-info-content');
746
+ display = content.css('display');
747
+ if (display == 'none') {
748
+ content.show('slow');
749
+ } else {
750
+ content.hide('slow');
751
+ }
752
+ })
753
+ })
754
+ function showRegistartion(show)
755
+ {
756
+ if (show) {
757
+ jQuery('.cfTabsContainer').show('slow');
758
+ } else {
759
+ jQuery('.cfTabsContainer').hide('slow');
760
+ }
761
+ }
762
+ </script>
763
+
764
+ <div class="clear" style="margin-bottom: 50px;"></div>
765
+ <table class="wp-list-table widefat fixed" >
766
+ <thead>
767
+ <tr>
768
+ <th></th>
769
+ <th>Recommended value</th>
770
+ <th>Your value</th>
771
+ <th>Status</th>
772
+ </tr>
773
+ </thead>
774
+ <tbody>
775
+ <tr>
776
+ <th scope="row">PHP Version</th>
777
+ <td><?php echo PHP_VERSION_DEFAULT ?> or greater</td>
778
+ <td><?php echo check_version($phpVersion , PHP_VERSION_DEFAULT) === false ? '<span style="color:#fb8004;font-weight:bold;">' . $phpVersion .'</span>' : $phpVersion ?></td>
779
+ <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>
780
+ </tr>
781
+ <tr>
782
+ <th scope="row">MySQL Version</th>
783
+ <td><?php echo MYSQL_VERSION_DEFAULT ?> or greater</td>
784
+ <td><?php echo check_version($mysqlVersion , MYSQL_VERSION_DEFAULT) === false ? '<span style="color:#fb8004;font-weight:bold;">' . $mysqlVersion .'</span>' : $mysqlVersion; ?></td>
785
+ <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>
786
+ </tr>
787
+ <tr>
788
+ <th scope="row">Max Execution Time</th>
789
+ <td><?php echo $newMaxExecutionTime ?></td>
790
+ <td><?php echo ($upMaxExecutionTime == 0) ? '<span style="color:#fb8004;font-weight:bold;">' . $maxExecutionTime .'</span>' : $maxExecutionTime; ?></td>
791
+ <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>
792
+ </tr>
793
+ <tr>
794
+ <th scope="row">Max Memory Limit</th>
795
+ <td><?php echo $newMemoryLimit . 'M' ?></td>
796
+ <td><?php echo ($upMemoryLimit == 0) ? '<span style="color:#fb8004;font-weight:bold;">' . $maxMemoryLimit .'</span>' : $maxMemoryLimit ?></td>
797
+ <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>
798
+ </tr>
799
+ <tr>
800
+ <th scope="row">PHP Extensions</th>
801
+ <?php $ex = $c['ex']; ?>
802
+ <td><?php echo ( $ex ) === false ? 'All present' : '<span style="color:#ffba00;font-weight:bold;">' . implode(", ", $ex) . '</span>'; ?></td>
803
+ <td><?php echo ( $ex ) === false ? 'Found' : '<span style="color:#ffba00;font-weight:bold;">Not Found</span>'; ?></td>
804
+ <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>
805
+ </tr>
806
+ <tr>
807
+ <th scope="row">Disabled Functions</th>
808
+ <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>
809
+ </tr>
810
+ <tr>
811
+ <th scope="row">Plugin Access</th>
812
+ <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>
813
+ </tr>
814
+ </tbody>
815
+ </table>
816
+ <?php
817
+ }
818
+ }
819
+
820
+ if (! function_exists('check_function')) {
821
+ function check_function($func, $search, $type = false)
822
+ {
823
+ if (is_string($func)) {
824
+ $func = explode(", ", $func);
825
+ }
826
+ if (is_string($search)) {
827
+ $search = explode(", ", $search);
828
+ }
829
+ $res = false;
830
+ $n = count($search);
831
+ for($i = 0; $i < $n; $i++) {
832
+ if (in_array($search[$i], $func) === $type) {
833
+ $res[] = $search[$i];
834
+ }
835
+ }
836
+ return $res;
837
+ }
838
+ }
839
+
840
+ if (! function_exists('check_version')) {
841
+ function check_version($ver, $ver2)
842
+ {
843
+ return version_compare($ver, $ver2, ">");
844
+ }
845
+ }
846
+ if (!function_exists('ltrimslashes')) {
847
+ function ltrimslashes($var)
848
+ {
849
+ return ltrim($var, '/');
850
+ }
851
+ }
852
+ if (!function_exists("get_system_data")) {
853
+ function get_system_data()
854
+ {
855
+
856
+ global $wp_version;
857
+
858
+ $phpVersion = phpversion();
859
+ $maxExecutionTime = ini_get('max_execution_time');
860
+ $maxMemoryLimit = ini_get('memory_limit');
861
+ $extensions = implode(', ', get_loaded_extensions());
862
+ $disabledFunctions = ini_get('disable_functions');
863
+ $mysqlVersion = '';
864
+ if (! class_exists('wpdb')) {
865
+ require_once ABSPATH . '/' . WPINC . '/wp-db.php';
866
+ }
867
+ $mysqli = new wpdb( DB_USER, DB_PASSWORD, DB_NAME, DB_HOST );
868
+ $errors = $mysqli->last_error;
869
+ if (empty($errors)) {
870
+ $mysqlVersion = $mysqli->db_version();
871
+ }
872
+ $upMaxExecutionTime = 0;
873
+ $newMaxExecutionTime = intval($maxExecutionTime) + 60;
874
+ @set_time_limit( $newMaxExecutionTime );
875
+ if( ini_get('max_execution_time') == $newMaxExecutionTime ){
876
+ $upMaxExecutionTime = 1;
877
+ $maxExecutionTime = ini_get('max_execution_time');
878
+ }
879
+ $upMemoryLimit = 0;
880
+ $newMemoryLimit = intval($maxMemoryLimit) + 60;
881
+ ini_set('memory_limit', $newMemoryLimit.'M');
882
+ if( ini_get('memory_limit') == $newMemoryLimit ){
883
+ $upMemoryLimit = 1;
884
+ $maxMemoryLimit = ini_get('memory_limit');
885
+ }
886
+ $extensions_search = array('curl', 'json', 'mysqli', 'sockets', 'zip', 'ftp');
887
+ $disabledFunctions_search = array('set_time_limit', 'curl_init', 'fsockopen', 'ftp_connect');
888
+
889
+ $ex = check_function($extensions, $extensions_search);
890
+ $func = check_function($disabledFunctions, $disabledFunctions_search, true);
891
+
892
+ return array('wp_version' => $wp_version, 'php_verion' => phpversion(),
893
+ 'maxExecutionTime' => $maxExecutionTime, 'maxMemoryLimit' => $maxMemoryLimit,
894
+ 'extensions' => $extensions, 'disabledFunctions' => $disabledFunctions,
895
+ 'mysqlVersion' => $mysqlVersion, 'upMaxExecutionTime' => $upMaxExecutionTime,
896
+ 'newMaxExecutionTime' => $newMaxExecutionTime, 'upMemoryLimit' => $upMemoryLimit,
897
+ 'newMemoryLimit' => $newMaxExecutionTime, 'maxMemoryLimit' => $maxMemoryLimit,
898
+ 'ex' => $ex, 'func' => $func, 'wp_lang' => get_option('WPLANG'),
899
+ );
900
+
901
+ }
902
+ }
903
+
904
+ ?>
main/index.php ADDED
@@ -0,0 +1 @@
 
1
+ <?php
main/wpadm-class-wp.php ADDED
@@ -0,0 +1,667 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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_saveSetting', array('wpadm_wp_full_backup_dropbox', 'saveSetting') );
17
+
18
+
19
+ add_action('admin_post_wpadm_delete_backup', array('wpadm_wp_full_backup_dropbox', 'delete_backup') );
20
+ add_action('admin_post_dropboxConnect', array('wpadm_wp_full_backup_dropbox', 'dropboxConnect') );
21
+
22
+ add_action('admin_post_login-process', array('wpadm_wp_full_backup_dropbox', 'auth_user') );
23
+
24
+ add_action('admin_post_wpadm_download', array('wpadm_wp_full_backup_dropbox', 'download') );
25
+ add_action('init', array('wpadm_wp_full_backup_dropbox', 'init'), 10 );
26
+
27
+ add_action('admin_notices', array('wpadm_wp_full_backup_dropbox', 'notice'));
28
+ add_action('admin_notices', array('wpadm_wp_full_backup_dropbox', 'notice_stars'));
29
+ add_action('admin_post_hide_notice', array('wpadm_wp_full_backup_dropbox', 'hide_notice') );
30
+ add_action( 'admin_bar_menu', array('wpadm_wp_full_backup_dropbox', 'add_link_to_admin_bar') ,999 );
31
+
32
+
33
+ @set_time_limit(0);
34
+
35
+ class wpadm_wp_full_backup_dropbox extends wpadm_class {
36
+
37
+ const MIN_PASSWORD = 6;
38
+
39
+ function add_link_to_admin_bar($wp_admin_bar)
40
+ {
41
+ $wp_admin_bar->add_node( array(
42
+ 'id' => 'dropbox-backup',
43
+ 'title' => 'Dropbox backup',
44
+ 'href' => esc_url( admin_url("admin.php?page=wpadm_wp_full_backup_dropbox") ),
45
+ 'meta' => array('class' => 'dropbox-image-toolbar')
46
+ ));
47
+
48
+ }
49
+
50
+ public static function notice_stars()
51
+ {
52
+ if ( file_exists(WPAdm_Core::getTmpDir() . "/notice-star") ) {
53
+ $star = file_get_contents(WPAdm_Core::getTmpDir() . "/notice-star");
54
+ if ($star != 0) {
55
+ $d = explode("_", $star);
56
+ $time = $hide = '';
57
+ if (isset($d[1])) {
58
+ if ($d[1] == '1d' && ( (int)$d[0] + WPADM_1DAY ) <= time() ) {
59
+ $time = langWPADM::get("1 day", false);
60
+ $hide = '1d';
61
+ } elseif ($d[1] == 'w' && ( (int)$d[0] + WPADM_1WEEK ) <= time() ) {
62
+ $time = langWPADM::get("1 week", false);
63
+ $hide = 'week';
64
+ }
65
+ }
66
+ if (!empty($time) && !empty($hide)) {
67
+ ob_start();
68
+ require_once DRBBACKUP_BASE_DIR . DIRECTORY_SEPARATOR . "template" . DIRECTORY_SEPARATOR . "notice5.php";
69
+ echo ob_get_clean();
70
+ }
71
+ }
72
+ }
73
+ }
74
+
75
+ public static function setFlagToTmp($flag = '', $data = false)
76
+ {
77
+ if ( !empty($flag) ) {
78
+ if (!class_exists('WPAdm_Core')) {
79
+ require_once DRBBACKUP_BASE_DIR . "/libs/class-wpadm-core.php" ;
80
+ WPAdm_Core::$pl_dir = DRBBACKUP_BASE_DIR;
81
+ }
82
+ file_put_contents( WPAdm_Core::getTmpDir() . "/$flag" , $data );
83
+ }
84
+ }
85
+
86
+ public static function auth_user()
87
+ {
88
+ if (isset($_POST['username']) && $_POST['password']) {
89
+ if(!function_exists("wp_safe_remote_post")) {
90
+ include ABSPATH . "/http.php";
91
+ }
92
+ $res = wp_safe_remote_post(SERVER_URL_INDEX, array('username' => $_POST['username'], 'password' => $_POST['password'], 'plugin' => 'dropbox-backup'));
93
+ if (!Empty($res['body'])) {
94
+ $data_res = json_decode($res['body']);
95
+ if (isset($data_res['url'])) {
96
+ header("Location: " . $data_res['url']);
97
+ exit;
98
+ }
99
+ }
100
+ }
101
+ header("Location: " . admin_url("admin.php?page=wpadm_wp_full_backup_dropbox") );
102
+ exit;
103
+ }
104
+
105
+ public static function init()
106
+ {
107
+ parent::$plugin_name = 'dropbox-backup';
108
+ require_once DRBBACKUP_BASE_DIR . '/modules/class-wpadm-core.php';
109
+ WPAdm_Core::$pl_dir = DRBBACKUP_BASE_DIR ;
110
+ }
111
+
112
+ static function include_admins_script()
113
+ {
114
+ wp_enqueue_style('css-admin-wpadm', plugins_url( "/template/css/admin-style-wpadm.css", dirname( __FILE__ )) );
115
+ wp_enqueue_script( 'js-admin-wpadm', plugins_url( "/template/js/admin-wpadm.js", dirname( __FILE__ ) ) );
116
+ wp_enqueue_script( 'postbox' );
117
+ }
118
+
119
+ public static function setUserMail()
120
+ {
121
+ if (isset($_POST['email'])) {
122
+ $email = trim($_POST['email']);
123
+ $mail = get_option(PREFIX_BACKUP_ . "email");
124
+ if ($mail) {
125
+ add_option(PREFIX_BACKUP_ . "email", $email);
126
+ } else {
127
+ update_option(PREFIX_BACKUP_ . "email",$email);
128
+ }
129
+ }
130
+ echo 'true';
131
+ wp_die();
132
+ }
133
+ public static function saveSetting()
134
+ {
135
+ if (isset($_POST['is_admin'])) {
136
+ $dropbox_options = get_option(PREFIX_BACKUP_ . 'dropbox-setting');
137
+ if ($dropbox_options) {
138
+ $dropbox_options = unserialize( base64_decode( $dropbox_options ) );
139
+ }
140
+ $dropbox_options['is_admin'] = (int) $_POST['is_admin'];
141
+ update_option(PREFIX_BACKUP_ . 'dropbox-setting', base64_encode( serialize( $dropbox_options ) ) );
142
+ }
143
+ }
144
+
145
+ public static function local_backup()
146
+ {
147
+ require_once DRBBACKUP_BASE_DIR . "/modules/class-wpadm-core.php";
148
+ @session_write_close();
149
+ parent::$type = 'full';
150
+ if (file_exists(WPAdm_Core::getTmpDir() . "/logs2")) {
151
+ @unlink(WPAdm_Core::getTmpDir() . "/logs2");
152
+ }
153
+ WPAdm_Core::mkdir(DROPBOX_BACKUP_DIR_BACKUP);
154
+ if ( WPAdm_Core::dir_writeble(DROPBOX_BACKUP_DIR_BACKUP)) {
155
+ $backup = new WPAdm_Core(array('method' => "local_backup", 'params' => array('optimize' => 1, 'limit' => 0, 'time' => @$_POST['time'], 'types' => array('db', 'files') )), 'full_backup_dropbox', WPAdm_Core::$pl_dir);
156
+ $res = $backup->getResult()->toArray();
157
+ $res['md5_data'] = md5( print_r($res, 1) );
158
+ $res['name'] = $backup->name;
159
+ $res['time'] = $backup->time;
160
+ $res['type'] = 'local';
161
+ $res['counts'] = count($res['data']);
162
+ } else {
163
+ $res['result'] = 'error';
164
+ $res['error'] = langWPADM::get('Website "%d" returned an error during file creation: Failed to create file, please check the permissions on the folder "%dir".', false, array('%d', '%dir'), array(SITE_HOME, DROPBOX_BACKUP_DIR_BACKUP) );
165
+ $res['data'] = array();
166
+ $res['size'] = 0;
167
+ }
168
+
169
+ @session_start();
170
+ echo json_encode($res);
171
+ wp_die();
172
+
173
+ }
174
+ public static function getLog()
175
+ {
176
+ @session_write_close();
177
+ @session_start();
178
+ require_once DRBBACKUP_BASE_DIR . "/modules/class-wpadm-core.php";
179
+ $backup = new WPAdm_Core(array('method' => "local"), 'full_backup_dropbox', WPAdm_Core::$pl_dir);
180
+ $log = WPAdm_Core::getLog();
181
+ $log2 = WPAdm_Core::getTmpDir() . "/logs2";
182
+ if (file_exists($log2)) {
183
+ $text = @file_get_contents($log2);
184
+ file_put_contents($log2, $log);
185
+ $log = str_replace($text, "", $log);
186
+ } else {
187
+ file_put_contents($log2, $log);
188
+ }
189
+ $log = explode("\n", $log);
190
+ krsort($log);
191
+ echo json_encode(array('log' => $log));
192
+
193
+ exit;
194
+ }
195
+ public static function restore_backup()
196
+ {
197
+ require_once DRBBACKUP_BASE_DIR . "/modules/class-wpadm-core.php";
198
+ @session_write_close();
199
+ parent::$type = 'full';
200
+ if (file_exists(WPAdm_Core::getTmpDir() . "/logs2")) {
201
+ @unlink(WPAdm_Core::getTmpDir() . "/logs2");
202
+ }
203
+ $name_backup = isset($_POST['name']) ? trim($_POST['name']) : "";
204
+ $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);
205
+ $res = $backup->getResult()->toArray();
206
+ @session_start();
207
+ echo json_encode($res);
208
+ wp_die();
209
+ }
210
+ public static function wpadm_restore_dropbox()
211
+ {
212
+ require_once DRBBACKUP_BASE_DIR . "/modules/class-wpadm-core.php";
213
+ @session_write_close();
214
+ $log_class = new WPAdm_Core(array('method' => "local"), 'full_backup_dropbox', WPAdm_Core::$pl_dir);
215
+ if (file_exists(WPAdm_Core::getTmpDir() . "/logs2")) {
216
+ @unlink(WPAdm_Core::getTmpDir() . "/logs2");
217
+ }
218
+ if (file_exists(WPAdm_Core::getTmpDir() . "/log.log")) {
219
+ @unlink(WPAdm_Core::getTmpDir() . "/log.log");
220
+ }
221
+ WPAdm_Core::log( langWPADM::get('Start Restore from Dropbox cloud' , false) );
222
+ $dropbox_options = get_option(PREFIX_BACKUP_ . 'dropbox-setting');
223
+ if ($dropbox_options) {
224
+ require_once DRBBACKUP_BASE_DIR. "/modules/dropbox.class.php";
225
+ $dropbox_options = unserialize( base64_decode( $dropbox_options ) );
226
+ $folder_project = self::getNameProject();
227
+ $dropbox = new dropbox($dropbox_options['app_key'], $dropbox_options['app_secret'], $dropbox_options['auth_token_secret']);
228
+ if ($dropbox->isAuth()) {
229
+ WPAdm_Core::mkdir(DROPBOX_BACKUP_DIR_BACKUP);
230
+ $name_backup = isset($_POST['name']) ? trim($_POST['name']) : "";
231
+ $dir_backup = DROPBOX_BACKUP_DIR_BACKUP . "/$name_backup";
232
+ $error = WPAdm_Core::mkdir($dir_backup);
233
+ if (!empty($error)) {
234
+ WPAdm_Core::log($error);
235
+ $res['result'] = WPAdm_Result::WPADM_RESULT_ERROR;
236
+ $res['error'] = $error;
237
+ $res['data'] = array();
238
+ $res['size'] = 0;
239
+
240
+ } else {
241
+ $files = $dropbox->listing("$folder_project/$name_backup");
242
+ if (isset($files['items'])) {
243
+ $n = count($files['items']);
244
+ for($i = 0; $i < $n; $i++) {
245
+ $res = $dropbox->downloadFile("$folder_project/$name_backup/{$files['items'][$i]['name']}", "$dir_backup/{$files['items'][$i]['name']}");
246
+ if ($res != "$dir_backup/{$files['items'][$i]['name']}" && isset($res['text'])) {
247
+ WPAdm_Core::log(langWPADM::get('Error: ' , false) . $res['text'] );
248
+ } else {
249
+ $log = str_replace('%s', $files['items'][$i]['name'], langWPADM::get('Download file (%s) with Dropbox' , false) );
250
+ WPAdm_Core::log($log);
251
+ }
252
+ }
253
+ parent::$type = 'full';
254
+ $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);
255
+ $res = $backup->getResult()->toArray();
256
+ WPAdm_Core::rmdir($dir_backup);
257
+ }
258
+ }
259
+ } else {
260
+ WPAdm_Core::log( langWPADM::get('Website "%d" can\'t authorize on Dropbox with using of "app key: %k" and "app secret: %s"' , false,
261
+ array('%d', '%k', '%s'),
262
+ array( SITE_HOME, $dropbox_options['app_key'], $dropbox_options['app_secret'] ) ) );
263
+ }
264
+ } else {
265
+ WPAdm_Core::log( langWPADM::get('Website "%d" returned an error during connection to Dropbox: "app key" and "app secret" wasn\'t found. Please, check your Dropbox settings.' , false, '%d', SITE_HOME) );
266
+ }
267
+ @session_start();
268
+ echo json_encode($res);
269
+ wp_die();
270
+ }
271
+ public static function download()
272
+ {
273
+ if (isset($_REQUEST['backup'])) {
274
+ require_once DRBBACKUP_BASE_DIR . "/class-wpadm-core.php";
275
+ require_once DRBBACKUP_BASE_DIR . '/modules/pclzip.lib.php';
276
+ $backup = new WPAdm_Core(array('method' => "local"), 'full_backup_dropbox', WPAdm_Core::$pl_dir);
277
+ $filename = $_REQUEST['backup'] . ".zip";
278
+ $file = WPAdm_Core::getTmpDir() . "/" . $filename;
279
+ if (file_exists($file)) {
280
+ @unlink($file);
281
+ }
282
+ $archive = new PclZip($file);
283
+ $dir_backup = DROPBOX_BACKUP_DIR_BACKUP . '/' . $_REQUEST['backup'];
284
+
285
+ $backups = array('data' => array(), 'md5' => '');
286
+ if (is_dir($dir_backup)) {
287
+ $i = 0;
288
+ $dir_open = opendir($dir_backup);
289
+ while($d = readdir($dir_open)) {
290
+ if ($d != '.' && $d != '..' && file_exists($dir_backup . "/$d") && substr($d, -3) != "php") {
291
+ $archive->add($dir_backup . "/$d", PCLZIP_OPT_REMOVE_PATH, DROPBOX_BACKUP_DIR_BACKUP );
292
+ }
293
+ }
294
+ }
295
+
296
+
297
+ $now = gmdate("D, d M Y H:i:s");
298
+ header("Expires: Tue, 03 Jul 2001 06:00:00 GMT");
299
+ header("Cache-Control: max-age=0, no-cache, must-revalidate, proxy-revalidate");
300
+ header("Last-Modified: {$now} GMT");
301
+
302
+ // force download
303
+ header("Content-Type: application/force-download");
304
+ header("Content-Type: application/octet-stream");
305
+ header("Content-Type: application/download");
306
+
307
+ // disposition / encoding on response body
308
+ header("Content-Disposition: attachment;filename={$filename}");
309
+ header("Content-Transfer-Encoding: binary");
310
+
311
+ ob_start();
312
+ $df = fopen("php://output", 'w');
313
+ echo file_get_contents($file);
314
+ fclose($df);
315
+ echo ob_get_clean();
316
+ @unlink($file);
317
+ exit;
318
+ }
319
+ }
320
+
321
+ public static function delete_backup()
322
+ {
323
+ if (isset($_POST['backup-type']) ) {
324
+ if ($_POST['backup-type'] == 'local') {
325
+ require_once DRBBACKUP_BASE_DIR . "/modules/class-wpadm-core.php";
326
+ $dir = DROPBOX_BACKUP_DIR_BACKUP . '/' . $_POST['backup-name'] ;
327
+ $delete = false;
328
+ if (is_dir($dir)) {
329
+ WPAdm_Core::rmdir($dir);
330
+ $delete = true;
331
+ }
332
+ $dir = ABSPATH . WPADM_DIR_NAME . '/' . $_POST['backup-name'] ;
333
+ if (is_dir($dir)) {
334
+ WPAdm_Core::rmdir($dir);
335
+ $delete = true;
336
+ }
337
+ $dir = WPADM_DIR_BACKUP . '/' . $_POST['backup-name'] ;
338
+ if (is_dir($dir)) {
339
+ WPAdm_Core::rmdir($dir);
340
+ $delete = true;
341
+ }
342
+ if ($delete) {
343
+ parent::setMessage( str_replace('%s', $_POST['backup-name'], langWPADM::get('Backup(%s) was deleted', false) ) );
344
+ }
345
+ } elseif ($_POST['backup-type'] == 'dropbox') {
346
+ require_once DRBBACKUP_BASE_DIR . "/modules/dropbox.class.php";
347
+ $dropbox_options = get_option(PREFIX_BACKUP_ . 'dropbox-setting');
348
+ if ($dropbox_options) {
349
+ $dropbox_options = unserialize( base64_decode( $dropbox_options ) );
350
+ $dropbox = new dropbox($dropbox_options['app_key'], $dropbox_options['app_secret'], $dropbox_options['auth_token_secret']);
351
+ $folder_project = self::getNameProject();
352
+ $res = $dropbox->deleteFile("$folder_project/{$_POST['backup-name']}");
353
+ if ($res['is_deleted'] === true) {
354
+ parent::setMessage( str_replace('%s', $_POST['backup-name'], langWPADM::get('Backup(%s) was deleted', false) ) );
355
+ }
356
+ }
357
+ }
358
+ }
359
+ header("Location: " . admin_url("admin.php?page=wpadm_wp_full_backup_dropbox"));
360
+ }
361
+
362
+ protected static function getPluginName()
363
+ {
364
+
365
+ preg_match("|wpadm_wp_(.*)|", __CLASS__, $m);
366
+ return $m[1];
367
+ }
368
+ protected static function getPathPlugin()
369
+ {
370
+ return "wpadm_full_backup_dropbox";
371
+ }
372
+
373
+ public static function dropboxConnect()
374
+ {
375
+ require_once DRBBACKUP_BASE_DIR . "/modules/dropbox.class.php";
376
+ if (isset($_GET['app_key']) && isset($_GET['app_secret'])) {
377
+ if (empty($_GET['app_key']) && empty($_GET['app_secret'])) {
378
+ $_GET['app_key'] = WPADM_APP_KEY;
379
+ $_GET['app_secret'] = WPADM_APP_SECRET;
380
+ }
381
+ $dropbox = new dropbox($_GET['app_key'], $_GET['app_secret']);
382
+ $_SESSION['dropbox_key'] = $_GET['app_key'];
383
+ $_SESSION['dropbox_secret'] = $_GET['app_secret'];
384
+ $_SESSION['dropbox_request_token'] = $dropbox->getRequestToken();
385
+ echo '<script>window.location.href="' . $dropbox->generateAuthUrl( admin_url('admin-post.php?action=dropboxConnect') ) . '";</script>';
386
+ } elseif (isset($_GET['oauth_token']) && isset($_GET['uid'])) {
387
+ $dropbox_options = get_option(PREFIX_BACKUP_ . 'dropbox-setting');
388
+ if ($dropbox_options) {
389
+ $dropbox_options = unserialize( base64_decode( $dropbox_options ) );
390
+ } else {
391
+ $dropbox_options = array();
392
+ add_option(PREFIX_BACKUP_ . 'dropbox-setting', base64_encode(serialize( $dropbox_options ) ) );
393
+ }
394
+ $dropbox = new dropbox(@$_SESSION['dropbox_key'], @$_SESSION['dropbox_secret']);
395
+ $access_token = $dropbox->getAccessToken($_SESSION['dropbox_request_token']);
396
+ $dropbox_options['app_key'] = @$_SESSION['dropbox_key'] ;
397
+ $dropbox_options['app_secret'] = @$_SESSION['dropbox_secret'] ;
398
+ $dropbox_options['auth_token_secret'] = $access_token;
399
+ $dropbox_options['oauth_token'] = @$_GET['oauth_token'] ;
400
+ $dropbox_options['uid'] = @$_GET['uid'] ;
401
+ update_option(PREFIX_BACKUP_ . 'dropbox-setting', base64_encode( serialize( $dropbox_options ) ) );
402
+ echo '<script>
403
+ if(window.opener){
404
+ window.opener.connectDropbox(null, null, "'.htmlspecialchars($access_token['oauth_token_secret']).'", "'.htmlspecialchars($access_token['oauth_token']).'", "'.htmlspecialchars($access_token['uid']).'");window.close();
405
+ }else{
406
+ window.location.href="' . admin_url("admin.php?page=wpadm_wp_full_backup_dropbox") . '";
407
+ }
408
+ </script>';
409
+ echo '<script>window.close();</script>';exit;
410
+ } elseif (isset($_GET['not_approved'])) {
411
+ if( $_GET['not_approved'] == 'true' ){
412
+ echo '<script>window.close();</script>';exit;
413
+ }
414
+ } else {
415
+ WPAdm_Core::log( langWPADM::get('Website "%d" returned an error during connection to Dropbox: "app key" and "app secret" wasn\'t found. Please, check your Dropbox settings.' , true, '%d', SITE_HOME) );
416
+ }
417
+ exit;
418
+ }
419
+
420
+ public static function dropbox_backup_create()
421
+ {
422
+ require_once DRBBACKUP_BASE_DIR . "/modules/class-wpadm-core.php";
423
+ @session_write_close();
424
+
425
+ $log = new WPAdm_Core(array('method' => "local"), 'full_backup_dropbox', WPAdm_Core::$pl_dir);
426
+ if (file_exists(WPAdm_Core::getTmpDir() . "/logs2")) {
427
+ @unlink(WPAdm_Core::getTmpDir() . "/logs2");
428
+ }
429
+ if ( WPAdm_Core::dir_writeble(DROPBOX_BACKUP_DIR_BACKUP) && !file_exists(WPAdm_Core::getTmpDir() . "/create-backup") ) {
430
+ file_put_contents(WPAdm_Core::getTmpDir() . "/create-backup", 1);
431
+ $dropbox_options = get_option(PREFIX_BACKUP_ . 'dropbox-setting');
432
+ $send_to_dropbox = true;
433
+ if ($dropbox_options) {
434
+ $dropbox_options = unserialize( base64_decode( $dropbox_options ) );
435
+ if (!isset($dropbox_options['app_key'])) {
436
+ WPAdm_Core::log( langWPADM::get('Website "%d" returned an error during connection to Dropbox: "App Key" wasn\'t found. Please, check your Dropbox settings.' , false, '%d', SITE_HOME) );
437
+ $send_to_dropbox = false;
438
+ }
439
+ if (!isset($dropbox_options['app_secret'])) {
440
+ WPAdm_Core::log( langWPADM::get('Website "%d" returned an error during connection to Dropbox: "App Secret" wasn\'t found. Please, check your Dropbox settings.' , false, '%d', SITE_HOME) );
441
+ $send_to_dropbox = false;
442
+ }
443
+ if (!isset($dropbox_options['oauth_token'])) {
444
+ WPAdm_Core::log( langWPADM::get('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."' , false, '%d', SITE_HOME) );
445
+ $send_to_dropbox = false;
446
+ }
447
+ } else {
448
+ WPAdm_Core::log( langWPADM::get('Website "%d" returned an error during connection to Dropbox: "app key" and "app secret" wasn\'t found. Please, check your Dropbox settings.' , false, '%d', SITE_HOME) );
449
+ $res['type'] = 'local';
450
+ $send_to_dropbox = false;
451
+ }
452
+
453
+ if ($send_to_dropbox) {
454
+ parent::$type = 'full';
455
+ $backup_local = new WPAdm_Core(array('method' => "local_backup", 'params' => array('optimize' => 1, 'limit' => 0, 'time' => @$_POST['time'], 'types' => array('db', 'files') )), 'full_backup_dropbox', WPAdm_Core::$pl_dir);
456
+ $res = $backup_local->getResult()->toArray();
457
+ $res['md5_data'] = md5( print_r($res, 1) );
458
+ $res['name'] = $backup_local->name;
459
+ $res['time'] = $backup_local->time;
460
+ $res['type'] = 'dropbox';
461
+ $res['counts'] = count($res['data']);
462
+ unset($backup);
463
+ $folder_project = self::getNameProject();
464
+ $backup = new WPAdm_Core(array('method' => "send-to-dropbox",
465
+ 'params' => array('files' => $res['data'],
466
+ 'access_details' => array('key' => $dropbox_options['app_key'],
467
+ 'secret' => $dropbox_options['app_secret'],
468
+ 'token' => $dropbox_options['auth_token_secret'],
469
+ 'dir' => $res['name'],
470
+ 'folder' => $folder_project),
471
+ )
472
+ ),
473
+ 'full_backup_dropbox', WPAdm_Core::$pl_dir) ;
474
+ $result_send = $backup->getResult()->toArray();
475
+ if ($result_send['result'] == 'error') {
476
+ $res = array();
477
+ $res['error'] = $result_send['error'];
478
+ $res['result'] = 'error';
479
+ @rename(WPAdm_Core::getTmpDir() . "/logs2", WPAdm_Core::getTmpDir() . "/logs_error_" . $backup_local->time);
480
+ }
481
+
482
+ WPAdm_Core::rmdir( DROPBOX_BACKUP_DIR_BACKUP . "/{$res['name']}");
483
+ if (file_exists(WPAdm_Core::getTmpDir() . "/create-backup")) {
484
+ @unlink( WPAdm_Core::getTmpDir() . "/create-backup" );
485
+ }
486
+ }
487
+ } else {
488
+ $res['result'] = 'error';
489
+ $res['error'] = langWPADM::get('Website "%d" returned an error during file creation: Failed to create file, please check the permissions on the folder "%dir".', false, array('%d', '%dir'), array(SITE_HOME, DROPBOX_BACKUP_DIR_BACKUP) );
490
+ $res['data'] = array();
491
+ $res['size'] = 0;
492
+ }
493
+ @session_start();
494
+ echo json_encode($res);
495
+ wp_die();
496
+ }
497
+ public static function getNameProject()
498
+ {
499
+ $folder_project = str_ireplace( array("http://", "https://"), '', home_url() );
500
+ $folder_project = str_ireplace( array( "-", '/', '.'), '_', $folder_project );
501
+ return $folder_project;
502
+ }
503
+
504
+
505
+ public static function wpadm_show_backup()
506
+ {
507
+
508
+ require_once DRBBACKUP_BASE_DIR. "/modules/dropbox.class.php";
509
+ parent::$type = 'full';
510
+ $dropbox_options = get_option(PREFIX_BACKUP_ . 'dropbox-setting');
511
+ if ($dropbox_options) {
512
+ $dropbox_options = unserialize( base64_decode( $dropbox_options ) );
513
+ if (isset($dropbox_options['app_key']) && isset($dropbox_options['app_secret']) && isset($dropbox_options['auth_token_secret'])) {
514
+ $dropbox = new dropbox($dropbox_options['app_key'], $dropbox_options['app_secret'], $dropbox_options['auth_token_secret']);
515
+ $folder_project = self::getNameProject();
516
+ $backups = $dropbox->listing($folder_project);
517
+ $n = count($backups['items']);
518
+ $data['data'] = array();
519
+ for($i = 0; $i < $n; $i++) {
520
+ $backup = $dropbox->listing($folder_project . "/" . $backups['items'][$i]['name']);
521
+ $data['data'][$i]['name'] = $backups['items'][$i]['name'];
522
+ $data['data'][$i]['size'] = (float)$backup['size'] * 1024 * 1024;
523
+ $data['data'][$i]['dt'] = parent::getDateInName($backups['items'][$i]['name']);
524
+ $data['data'][$i]['count'] = count($backup['items']);
525
+ $data['data'][$i]['type'] = 'dropbox';
526
+ $k = $data['data'][$i]['count'];
527
+ $data['data'][$i]['files'] = '[';
528
+ for($j = 0; $j < $k; $j++) {
529
+ $data['data'][$i]['files'] .= $backup['items'][$i]['name'] . ',';
530
+ }
531
+ }
532
+ }
533
+ }
534
+ if (isset($_GET['pay']) && $_GET['pay'] == 'success') {
535
+ if (!file_exists(WPAdm_Core::getTmpDir() . "/pay_success")) {
536
+ file_put_contents(WPAdm_Core::getTmpDir() . "/pay_success", 1);
537
+ parent::setMessage( langWPADM::get('', false) );
538
+ }
539
+ }
540
+ if (isset($_GET['pay']) && $_GET['pay'] == 'cancel') {
541
+ parent::setError( langWPADM::get('Checkout was canceled', false) );
542
+ }
543
+ $data_local = parent::read_backups();
544
+ if (isset($data['data'])) {
545
+ $data['data'] = array_merge($data_local['data'], $data['data']);
546
+ $data['md5'] = md5( print_r( $data['data'] , 1 ) );
547
+ } else {
548
+ $data = $data_local;
549
+ }
550
+ if (file_exists(WPAdm_Core::getTmpDir() . "/pay_success")) {
551
+ $plugin_info = get_plugins("/" . parent::$plugin_name);
552
+ $plugin_version = (isset($plugin_info[parent::$plugin_name . '.php']['Version']) ? $plugin_info[parent::$plugin_name . '.php']['Version'] : '');
553
+ $data_server = parent::sendToServer(
554
+ array(
555
+ 'actApi' => "proBackupCheck",
556
+ 'site' => home_url(),
557
+ 'email' => get_option('admin_email'),
558
+ 'plugin' => parent::$plugin_name,
559
+ 'key' => '',
560
+ 'plugin_version' => $plugin_version
561
+ )
562
+ );
563
+ if (isset($data_server['status']) && $data_server['status'] == 'success' && isset($data_server['key'])) {
564
+ update_option(PREFIX_BACKUP_ . 'pro-key', $data_server['key']);
565
+ if (isset($data_server['url']) && !empty($data_server['url'])) {
566
+ parent::setMessage( str_replace('&s', $data_server['url'], langWPADM::get('The "Dropbox backup & restore RRO" version can be downloaded here <a href="&s">download</a>', false) ) );
567
+ }
568
+ }
569
+ }
570
+ $show = !get_option('wpadm_pub_key') && is_super_admin();
571
+ $error = parent::getError(true);
572
+ $msg = parent::getMessage(true);
573
+ $base_path = DRBBACKUP_BASE_DIR ;
574
+ ob_start();
575
+ require_once $base_path . DIRECTORY_SEPARATOR . "template" . DIRECTORY_SEPARATOR . "wpadm_show_backup.php";
576
+ echo ob_get_clean();
577
+ }
578
+
579
+
580
+ public static function draw_menu()
581
+ {
582
+ $show = true;
583
+ $dropbox_options = get_option(PREFIX_BACKUP_ . 'dropbox-setting');
584
+ if ($dropbox_options) {
585
+ $dropbox_options = unserialize( base64_decode( $dropbox_options ) );
586
+ }
587
+ if ( ( isset($dropbox_options['is_admin']) && $dropbox_options['is_admin'] == 1 ) || !isset($dropbox_options['is_admin']) ) {
588
+ if (!is_admin() || !is_super_admin()) {
589
+ $show = false;
590
+ }
591
+ }
592
+ if ($show) {
593
+ $menu_position = '1.9998887771';
594
+ if(self::checkInstallWpadmPlugins()) {
595
+ $page = add_menu_page(
596
+ 'WPAdm',
597
+ 'WPAdm',
598
+ "read",
599
+ 'wpadm_plugins',
600
+ 'wpadm_plugins',
601
+ plugins_url('/img/wpadm-logo.png', dirname( __FILE__ )),
602
+ $menu_position
603
+ );
604
+ add_submenu_page(
605
+ 'wpadm_plugins',
606
+ "Dropbox Full Backup",
607
+ "Dropbox Full Backup",
608
+ 'read',
609
+ 'wpadm_wp_full_backup_dropbox',
610
+ array('wpadm_wp_full_backup_dropbox', 'wpadm_show_backup')
611
+ );
612
+ } else {
613
+ $page = add_menu_page(
614
+ 'Dropbox Full Backup',
615
+ 'Dropbox Full Backup',
616
+ "read",
617
+ 'wpadm_wp_full_backup_dropbox',
618
+ array('wpadm_wp_full_backup_dropbox', 'wpadm_show_backup'),
619
+ plugins_url('/img/wpadm-logo.png', dirname( __FILE__ ) ),
620
+ $menu_position
621
+ );
622
+
623
+ add_submenu_page(
624
+ 'wpadm_wp_full_backup_dropbox',
625
+ "WPAdm",
626
+ "WPAdm",
627
+ 'read',
628
+ 'wpadm_plugins',
629
+ 'wpadm_plugins'
630
+ );
631
+ }
632
+
633
+ }
634
+ }
635
+ public static function notice()
636
+ {
637
+ if (!isset($_GET['page']) || ( isset($_GET['page']) && $_GET['page'] != 'wpadm_wp_full_backup_dropbox' ) ) {
638
+ if (!file_exists(WPAdm_Core::getTmpDir() . "/notice")) {
639
+ ob_start();
640
+ require_once DRBBACKUP_BASE_DIR . DIRECTORY_SEPARATOR . "template" . DIRECTORY_SEPARATOR . "notice.php";
641
+ echo ob_get_clean();
642
+ }
643
+ }
644
+ }
645
+ public static function hide_notice()
646
+ {
647
+ if (isset($_GET['type'])) {
648
+ switch($_GET['type']) {
649
+ case 'preview' :
650
+ file_put_contents(WPAdm_Core::getTmpDir() . "/notice", 1);
651
+ break;
652
+ case 'star' :
653
+ if (isset($_GET['hide']) && $_GET['hide'] == '1d') {
654
+ file_put_contents(WPAdm_Core::getTmpDir() . "/notice-star", time() . '_w');
655
+ } elseif ( ( isset($_GET['hide']) && $_GET['hide'] == 'week' ) || !isset($_GET['hide']) ) {
656
+ file_put_contents(WPAdm_Core::getTmpDir() . "/notice-star", 0);
657
+ }
658
+ break;
659
+ }
660
+ }
661
+ header('location:' . $_SERVER['HTTP_REFERER']);
662
+ exit;
663
+ }
664
+ }
665
+ }
666
+
667
+ ?>
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_NAME . '/';
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 = langWPADM::get('Website "%d" 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.', false, array('%d', '%s'), array(SITE_HOME, $this->queue->getError() ) );
120
+ WPAdm_Core::log($log);
121
+ $errors[] = $log;
122
+ } elseif (0 == (int)filesize($mysql_dump_file)) {
123
+ $log = langWPADM::get('Website "%d" returned an error during database dump creation: Database-Dump file is emplty. To solve this problem, please check permissions to folder: "%dir".', false, array('%d', '%dir'), array(SITE_HOME, DROPBOX_BACKUP_DIR_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 , langWPADM::get('Database Dump was successfully created ( %s Mb) : ', false) ) ;
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
  }
@@ -435,10 +453,15 @@ if (!class_exists('WPadm_Method_Full_Backup_Dropbox')) {
435
  $d1 = mb_strtolower($tmp[0]);
436
  unset($tmp[0]);
437
  $d2 = mb_strtolower(implode('/', $tmp));
438
- if (strpos($d2, 'cache') !== false && isset($tmp[0]) && !in_array($tmp[0], array('plugins', 'themes')) ) {
 
 
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 +491,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 +517,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_NAME . '/' . $this->name;
63
+ $error = WPAdm_Core::mkdir(DROPBOX_BACKUP_DIR_NAME);
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( langWPADM::get('Start backup', false) );
83
 
84
  # create db dump
85
+ WPAdm_Core::log( langWPADM::get('Start create db dump', false) );
86
+ $error = WPAdm_Core::mkdir(DROPBOX_BACKUP_DIR_NAME);
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_NAME . '/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( langWPADM::get('Table optimization', false) );
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(), langWPADM::get('Error: Dump of Database wasn\'t created (%s)', false) );
124
+ WPAdm_Core::log($log);
125
+ $errors[] = $log;
126
  } elseif (0 == (int)filesize($mysql_dump_file)) {
127
+ $errors[] = langWPADM::get('MySQL Error: Database-Dump File is empty', false);
128
+ WPAdm_Core::log(langWPADM::get('Dump of Database wasn\'t created (File of Database-Dump is empty!)', false));
129
  } else {
130
+ $size_dump = round( (filesize($mysql_dump_file) / 1024 / 1024) , 2);
131
+ $log = str_replace("%s", $size_dump , langWPADM::get('Database Dump was successfully created ( %s Mb) : ', false) ) ;
132
+ WPAdm_Core::log($log . $mysql_dump_file);
133
  }
134
  unset($commandContext);
135
 
136
 
137
  #ЗАРХИВИРУЕМ ФАЙЛЫ
138
+ WPAdm_Core::log( langWPADM::get('Create a list of files for Backup', false) );
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[] = langWPADM::get('Error: the list of Backup files is empty', false);
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( langWPADM::get('List of Backup-Files was successfully created', false) );
168
 
169
  $this->queue->clear();
170
 
179
  $this->queue->add($commandContext);
180
  unset($commandContext);
181
  }
182
+ WPAdm_Core::log( langWPADM::get('Backup of Files was started', false) );
183
  $this->queue->save()
184
  ->execute();
185
+ WPAdm_Core::log( langWPADM::get('End of File Backup', false) );
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( langWPADM::get('Begin copying files to FTP', false) );
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 = langWPADM::get('FTP: ' , false);
226
+ WPAdm_Core::log($log . $this->queue->getError());
227
+ $errors[] = $log . $this->queue->getError();
228
  }
229
+ WPAdm_Core::log( langWPADM::get('Finished copying files to FTP' , false) );
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( langWPADM::get('Begin coping files to S3' , false) );
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( langWPADM::get('Finished copying files to S3' , false) );
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( langWPADM::get('Remove the backup server' , false) );
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( langWPADM::get('files to google: ' , false) . 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( langWPADM::get('Google drive: ' , false) . $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( langWPADM::get('files to dropbox: ' , false) . 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(langWPADM::get('Dropbox: ' , false) . $this->queue->getError());
318
  }
319
  }
320
 
321
  #Removing TMP-files
322
+ WPAdm_Core::rmdir(DROPBOX_BACKUP_DIR_NAME . '/mysqldump.sql');
323
 
324
  #Removind old backups(if limit the number of stored backups)
325
+ WPAdm_Core::log( langWPADM::get('Start removing old backups' , false) );
326
  if ($this->params['limit'] != 0) {
327
+ $files = glob(DROPBOX_BACKUP_DIR_NAME . '/*');
328
  if (count($files) > $this->params['limit']) {
329
  $files2 = array();
330
  foreach($files as $f) {
343
  }
344
  }
345
  }
346
+ WPAdm_Core::log( langWPADM::get('Finished removing old backups' , false) );
347
 
348
+ WPAdm_Core::log( langWPADM::get('Creating a backup is completed' , false) );
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( langWPADM::get('Skip file ' , false) . $v);
398
  }
399
  }
400
  }
453
  $d1 = mb_strtolower($tmp[0]);
454
  unset($tmp[0]);
455
  $d2 = mb_strtolower(implode('/', $tmp));
456
+ if (strpos($d2, 'cache') !== false
457
+ && !in_array($tmp[0], array('plugins', 'themes'))
458
+ ) {
459
  WPAdm_Core::log('Skip dir(cache) ' . $directory);
460
  return array();
461
  }
462
+ if(strpos($directory, 'wpadm_backups') !== false) {
463
+ return array();
464
+ }
465
 
466
  if ($handle = opendir($directory)) {
467
  while (false !== ($file = readdir($handle))) {
491
  if (!in_array($f, $minus_path)) {
492
  $array_items[] = $ff;
493
  } else {
494
+ WPAdm_Core::log( langWPADM::get('Skip dir ' , false) . $ff);
495
  }
496
  }
497
  }
517
  );
518
 
519
  $r = "/define\('(.*)', '(.*)'\)/";
520
+ preg_match_all($r, file_get_contents( ABSPATH . "wp-config.php"), $m);
521
  $params = array_combine($m[1], $m[2]);
522
  foreach($db_params as $k=>$p) {
523
  $db_params[$k] = $params[$p];
methods/class-wpadm-method-local-backup.php CHANGED
@@ -3,6 +3,8 @@
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);
@@ -16,23 +18,49 @@ if (!class_exists('WPAdm_Method_Local_Backup')) {
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
  {
@@ -42,21 +70,25 @@ if (!class_exists('WPAdm_Method_Local_Backup')) {
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'])
@@ -67,7 +99,7 @@ if (!class_exists('WPAdm_Method_Local_Backup')) {
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'])
@@ -80,121 +112,133 @@ if (!class_exists('WPAdm_Method_Local_Backup')) {
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();
@@ -229,7 +273,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 +324,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 +336,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 +360,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 +372,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);
18
  if (file_exists($file_log)) {
19
  unlink($file_log);
20
  }
21
+ WPAdm_Core::log(langWPADM::get('Create Unique Id ', false) . $this->id);
22
 
23
 
24
  $name = get_option('siteurl');
25
 
26
  $name = str_replace("http://", '', $name);
27
  $name = str_replace("https://", '', $name);
28
+ $name = preg_replace("|\W|", "_", $name);
29
+ if (isset($params['time']) && !empty($params['time'])) { // time 1432751372
30
+ $this->time = date("Y-m-d H:i", $params['time']);
31
+ $name .= '-' . wpadm_class::$type . '-' . date("Y_m_d_H_i", $params['time']);
32
+ } else {
33
+ $this->time = date("Y-m-d H:i"); //23.04.2015 13:45
34
+ $name .= '-' . wpadm_class::$type . '-' . date("Y_m_d_H_i");
35
+ }
36
  $this->name = $name;
37
+
38
 
39
  // folder for backup
40
+ $this->dir = DROPBOX_BACKUP_DIR_BACKUP . '/' . $this->name;
41
+ if (($f = $this->checkBackup()) !== false) {
42
+ $this->dir = DROPBOX_BACKUP_DIR_BACKUP . '/' . $f;
43
+ }
44
+ $error = WPAdm_Core::mkdir(DROPBOX_BACKUP_DIR_BACKUP);
45
+ if (!empty($error)) {
46
+ $this->result->setError($error);
47
+ $this->result->setResult(WPAdm_Result::WPADM_RESULT_ERROR);
48
+ }
49
+ $error = WPAdm_Core::mkdir($this->dir);
50
+ if (!empty($error)) {
51
+ $this->result->setError($error);
52
+ $this->result->setResult(WPAdm_Result::WPADM_RESULT_ERROR);
53
+ }
54
+ }
55
+ public function checkBackup()
56
+ {
57
+ $archives = glob("{$this->dir}");
58
+ if (empty($archives) && count($archives) <= 1) {
59
+ return false;
60
+ }
61
+ $n = count($archives);
62
+ $f = "{$this->name}({$n})";
63
+ return $f;
64
  }
65
  public function getResult()
66
  {
70
  $this->result->setResult(WPAdm_Result::WPADM_RESULT_SUCCESS);
71
  $this->result->setError('');
72
 
73
+ WPAdm_Core::log(langWPADM::get('Start Backup process...', false));
74
 
75
  # create db dump
76
  if (in_array('db', $this->params['types']) ) {
77
+ WPAdm_Core::log(langWPADM::get('Creating Database Dump', false));
78
+ $error = WPAdm_Core::mkdir(DROPBOX_BACKUP_DIR_NAME);
79
+ if (!empty($error)) {
80
+ $this->result->setError($error);
81
+ $this->result->setResult(WPAdm_Result::WPADM_RESULT_ERROR);
82
+ return $this->result;
83
+ }
84
+ $mysql_dump_file = DROPBOX_BACKUP_DIR_BACKUP . '/mysqldump.sql';
85
  if (file_exists($mysql_dump_file)) {
86
  unlink($mysql_dump_file);
87
  }
88
  $wp_mysql_params = $this->getWpMysqlParams();
89
 
 
90
  if (isset($this->params['optimize']) && ($this->params['optimize']==1)) {
91
+ WPAdm_Core::log(langWPADM::get('Optimize Database Tables', false));
92
  $commandContext = new WPAdm_Command_Context();
93
  $commandContext ->addParam('command','mysqloptimize')
94
  ->addParam('host', $wp_mysql_params['host'])
99
  ->add($commandContext);
100
  unset($commandContext);
101
  }
102
+
103
  $commandContext = new WPAdm_Command_Context();
104
  $commandContext ->addParam('command','mysqldump')
105
  ->addParam('host', $wp_mysql_params['host'])
112
  ->save()
113
  ->execute();
114
  if (!$res) {
115
+ $log = langWPADM::get('Website "%d" 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.', false, array('%d', '%s'), array(SITE_HOME, $this->queue->getError() ) );
116
+ WPAdm_Core::log($log);
117
+ $errors[] = $log;
118
  } elseif (0 == (int)filesize($mysql_dump_file)) {
119
+ $log = langWPADM::get('Website "%d" returned an error during database dump creation: Database-Dump file is emplty. To solve this problem, please check permissions to folder: "%dir".', false, array('%d', '%dir'), array(SITE_HOME, DROPBOX_BACKUP_DIR_NAME));
120
+ $errors[] = $log;
121
+ WPAdm_Core::log($log);
122
  } else {
123
+ $size_dump = round( (filesize($mysql_dump_file) / 1024 / 1024) , 2);
124
+ $log = str_replace("%s", $size_dump , langWPADM::get('Database Dump was successfully created ( %s Mb) : ', false) ) ;
125
+ WPAdm_Core::log($log . $mysql_dump_file);
126
  }
127
  unset($commandContext);
128
  }
129
 
130
+ if (count($errors) == 0) {
131
+ if (in_array('files', $this->params['types']) ) {
132
+ WPAdm_Core::log( langWPADM::get('Create a list of files for Backup', false) );
133
+ $files = $this->createListFilesForArchive();
134
+ }
135
+ if (isset($mysql_dump_file) && file_exists($mysql_dump_file) && filesize($mysql_dump_file) > 0) {
136
+ $files[] = $mysql_dump_file;
137
+ }
138
 
139
+ if (empty($files)) {
140
+ $errors[] = langWPADM::get( '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".' , false, array('%d'), array(SITE_HOME));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
141
  }
142
+
143
+ // split the file list by 170kbayt lists, To break one big task into smaller
144
+
145
+ $files2 = array();
146
+ $files2[0] = array();
147
+ $i = 0;
148
+ $size = 0;
149
+ foreach($files as $f) {
150
+ if ($size > 170000) {//~170kbyte
151
+ $i ++;
152
+ $size = 0;
153
+ $files2[$i] = array();
154
+ }
155
+ $f_size =(int)@filesize($f);
156
+ if ($f_size == 0 || $f_size > 1000000) {
157
+ WPAdm_Core::log('File ' . $f . ' Size ' . $f_size);
158
+ }
159
+ $size += $f_size;
160
+ $files2[$i][] = $f;
161
  }
 
 
 
162
 
163
+ WPAdm_Core::log( langWPADM::get('List of Backup-Files was successfully created', false) );
164
 
165
+ $this->queue->clear();
 
 
 
 
 
 
 
 
166
 
167
+ foreach($files2 as $files) {
168
+ $commandContext = new WPAdm_Command_Context();
169
+ $commandContext ->addParam('command', 'archive')
170
+ ->addParam('files', $files)
171
+ ->addParam('to_file', $this->dir . '/'.$this->name)
172
+ ->addParam('max_file_size', 900000)
173
+ ->addParam('remove_path', ABSPATH);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
174
 
175
+ $this->queue->add($commandContext);
176
+ unset($commandContext);
177
+ }
178
+ WPAdm_Core::log( langWPADM::get('Backup of Files was started', false) );
179
+ $this->queue->save()
180
+ ->execute();
181
+ WPAdm_Core::log( langWPADM::get('End of File Backup', false) );
182
+
183
+ $files = glob($this->dir . '/'.$this->name . '*');
184
+ $urls = array();
185
+ $totalSize = 0;
186
+ foreach($files as $file) {
187
+ $urls[] = str_replace(ABSPATH, '', $file);
188
+ $totalSize += @intval( filesize($file) );
189
+ }
190
+ $this->result->setData($urls);
191
+ $this->result->setSize($totalSize);
192
+ $size = $totalSize / 1024 / 1024; /// MByte
193
+ $size = round($size, 2);
194
+ $log = str_replace("%s", $size , langWPADM::get('Backup Size %s Mb', false) ) ;
195
+ WPAdm_Core::log($log);
196
+
197
+ $remove_from_server = 0;
198
+ #Removing TMP-files
199
+ WPAdm_Core::rmdir($mysql_dump_file);
200
+
201
+ #Removind old backups(if limit the number of stored backups)
202
+ if ($this->params['limit'] != 0) {
203
+ WPAdm_Core::log( langWPADM::get('Limits of Backups ', false) . $this->params['limit'] );
204
+ WPAdm_Core::log( langWPADM::get('Removing of old Backups was started', false) );
205
+ $files = glob(DROPBOX_BACKUP_DIR_NAME . '/*');
206
+ if (count($files) > $this->params['limit']) {
207
+ $files2 = array();
208
+ foreach($files as $f) {
209
+ $fa = explode('-', $f);
210
+ if (count($fa) != 3) {
211
+ continue;
212
+ }
213
+ $files2[$fa[2]] = $f;
214
+
215
+ }
216
+ ksort($files2);
217
+ $d = count($files2) - $this->params['limit'];
218
+ $del = array_slice($files2, 0, $d);
219
+ foreach($del as $d) {
220
+ WPAdm_Core::rmdir($d);
221
+ }
222
  }
223
+ WPAdm_Core::log( langWPADM::get('Removing of old Backups was Finished', false) );
 
 
 
 
 
224
  }
 
225
  }
226
+ wpadm_class::setBackup(1);
227
  if (!empty($errors)) {
228
  $this->result->setError(implode("\n", $errors));
229
  $this->result->setResult(WPAdm_Result::WPADM_RESULT_ERROR);
230
+ WPAdm_Core::rmdir($this->dir);
231
+ wpadm_class::setStatus(0);
232
+ wpadm_class::setErrors( implode(", ", $errors) );
233
  } else {
234
+ wpadm_class::setStatus(1);
235
+ WPAdm_Core::log( langWPADM::get('Backup creation was complete successfully!', false) );
236
  }
237
+ wpadm_class::backupSend();
238
 
239
  return $this->result;
240
 
241
  }
 
242
  public function createListFilesForArchive() {
243
  $folders = array();
244
  $files = array();
273
  $v = str_replace(ABSPATH , '', $v);
274
  if (in_array($v, $minus_path)) {
275
  unset($files[$k]);
276
+ WPAdm_Core::log( langWPADM::get('Skip of File ', false) . $v);
277
  }
278
  }
279
  }
324
  if (isset($this->params['minus-path'])) {
325
  $minus_path = explode(",", $this->params['minus-path']);
326
  if (in_array($d, $minus_path) ) {
327
+ WPAdm_Core::log(langWPADM::get('Skip of Folder ', false) . $directory);
328
  return array();
329
  }
330
  } else {
336
  $d1 = mb_strtolower($tmp[0]);
337
  unset($tmp[0]);
338
  $d2 = mb_strtolower(implode('/', $tmp));
339
+ if (strpos($d2, 'cache') !== false && isset($tmp[0]) && !in_array($tmp[0], array('plugins', 'themes')) ) {
340
+ WPAdm_Core::log(langWPADM::get('Skip of Cache-Folder ', false) . $directory);
341
+ return array();
342
+ }
343
+ if(strpos($directory, 'wpadm_backups') !== false || strpos($directory, 'Dropbox_Backup') !== false) {
344
  return array();
345
  }
346
 
360
  if (!in_array($f, $minus_path)) {
361
  $array_items[] = $ff;
362
  } else {
363
+ WPAdm_Core::log(langWPADM::get('Skip of File ', false) . $ff);
364
  }
365
  }
366
  } else {
372
  if (!in_array($f, $minus_path)) {
373
  $array_items[] = $ff;
374
  } else {
375
+ WPAdm_Core::log( langWPADM::get('Skip of Folder ', false) . $ff);
376
  }
377
  }
378
  }
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(langWPADM::get('Create Unique Id ', false) . $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 = langWPADM::get('Website "%d" returned an error during backup restoration: Archive of Backup wasn\'t found "%s"', false, array('%d', '%s'), array(SITE_HOME, $this->params['name_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(langWPADM::get('Start Restore process', false));
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 = langWPADM::get('Website "%d" returned an error during backup restoration: Part Backup is not exist "%s" ', false, array('%d', '%s'), array(SITE_HOME, $data[2]) );
129
+ $this->setError($log);
130
+ WPAdm_Core::log($log);
131
  break;
132
  }
133
  }
134
  }
135
  }
136
  } else {
137
+ WPAdm_Core::log(
138
+ langWPADM::get('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.', false, array('%d'), array(SITE_HOME) )
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( langWPADM::get('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.', false, array('%d', '%com'), array(SITE_HOME, $com ) ) );
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( langWPADM::get('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.', false, array('%d', '%com'), array(SITE_HOME, $com ) ) );
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
@@ -25,42 +25,47 @@ if (!class_exists('WPadm_Method_Send_To_Dropbox')) {
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) {
65
  //todo: нормализация
66
  $this->id = $conf['id'];
25
  $this->queue = new WPAdm_Queue($this->id);
26
 
27
  $ad = $this->params['access_details'];
28
+ WPAdm_Core::log( langWPADM::get('Start copy to Dropbox Cloud' , false) );
29
  $this->queue->clear();
30
  $files = $this->params['files'];
31
  //$this->getResult()->setData($files);
32
 
33
  $dir = (isset($ad['dir'])) ? $ad['dir'] : '/';
34
+ //$dir = trim($dir, '/') . '/' . $this->name;
35
+ if (is_array($files)) {
36
+ foreach($files as $file) {
37
+ $commandContext = new WPAdm_Command_Context();
38
+ $commandContext->addParam('command', 'send_to_dropbox')
39
+ ->addParam('key', $ad['key'])
40
+ ->addParam('secret', $ad['secret'])
41
+ ->addParam('token', $ad['token'])
42
+ ->addParam('folder_project',$ad['folder'])
43
+ ->addParam('folder', $dir)
44
+ ->addParam('files', ABSPATH . $file);
45
+ $this->queue->add($commandContext);
46
+ unset($commandContext);
47
+ }
48
  }
49
  $res = $this->queue->save()
50
  ->execute();
51
  if (!$res) {
52
+ WPAdm_Core::log(langWPADM::get('Answer from Dropbox ' , false) . $this->queue->getError());
53
+ $errors[] = langWPADM::get('Answer from Dropbox ' , false) . $this->queue->getError();
54
  }
55
+ WPAdm_Core::log( langWPADM::get('End Copy Files to Dropbox' , false) );
56
  if (count($errors) > 0) {
57
  $this->result->setError(implode("\n", $errors));
58
  $this->result->setResult(WPAdm_Result::WPADM_RESULT_ERROR);
59
+ }
60
+ if (class_exists('wpadm_wp_full_backup_dropbox') && !file_exists( WPAdm_Core::getTmpDir() . "/notice-star") ) {
61
+ wpadm_wp_full_backup_dropbox::setFlagToTmp( 'notice-star', time() . "_1d" );
62
  }
63
 
64
  return $this->result;
65
 
66
 
67
  }
68
+
69
  private function init(array $conf) {
70
  //todo: нормализация
71
  $this->id = $conf['id'];
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[] = langWPADM::get('Error to copy file ' , false) . $this->params['files'][$i]['file'];
17
  } else {
18
  if ( is_string($f) && $this->unpack($f, $this->params['files'][$i]['to']) === false ) {
19
+ $error[] = langWPADM::get('Error to extract file ' , false) . $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,44 @@
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
+ if (empty($this->remove_path)) {
23
+ $this->archive->add($file);
24
+ } else {
25
+ $this->archive->add($file, PCLZIP_OPT_REMOVE_PATH, $this->remove_path);
26
+ }
27
+ $this->saveMd5($file);
28
+ }
29
+
30
+ protected function saveMd5($file) {
31
+ if ($this->md5_file) {
32
+ $files = explode(',', $file); {
33
+ foreach($files as $f) {
34
+ file_put_contents($this->md5_file, $f . "\t" . @md5_file($f) . "\t" . basename($this->archive->zipname) . "\n", FILE_APPEND);
35
+ }
36
+ }
37
+ }
38
+ }
39
+
40
+ public function setRemovePath($remove_path) {
41
+ $this->remove_path = $remove_path;
42
+ }
43
+ }
44
  }
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
File without changes
class-wpadm-core.php → modules/class-wpadm-core.php RENAMED
@@ -1,9 +1,9 @@
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')) {
@@ -29,8 +29,13 @@ if (!class_exists('WPAdm_Core')) {
29
 
30
  private $plugin;
31
 
 
 
 
32
  public static $pl_dir;
33
 
 
 
34
  public static $plugin_name;
35
 
36
 
@@ -50,13 +55,17 @@ if (!class_exists('WPAdm_Core')) {
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
  }
@@ -96,7 +105,6 @@ if (!class_exists('WPAdm_Core')) {
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));
@@ -127,23 +135,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 +163,15 @@ 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 +204,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
  /**
@@ -254,10 +271,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-command-factory.php';
7
 
8
 
9
  if (!class_exists('WPAdm_Core')) {
29
 
30
  private $plugin;
31
 
32
+ public $name = '',
33
+ $time = '';
34
+
35
  public static $pl_dir;
36
 
37
+ public static $error = '';
38
+
39
  public static $plugin_name;
40
 
41
 
55
  } elseif ('local' == $request['method']){
56
 
57
  } elseif($obj = $this->getObject($request['method'], $request['params'])) {
58
+ if ($obj->isError()) {
59
+ $this->result = $obj->get_results();
60
+ } else {
61
+ if (isset($obj->name)) {
62
+ $this->name = $obj->name;
63
+ }
64
+ if (isset($obj->time)) {
65
+ $this->time = $obj->time;
66
+ }
67
+ $this->result = $obj->getResult();
68
  }
 
69
  } else {
70
  $this->result->setError('Unknown method "' . $request['method'] . '"');
71
  }
105
  $method = mb_strtolower($method);
106
 
107
  $class_file = self::$pl_dir . "/methods/class-wpadm-method-" . str_replace('_', '-', $method) . ".php";
 
108
  if (file_exists($class_file)) {
109
  require_once $class_file;
110
  $tmp = explode('_', str_replace('-', '_', $method));
135
  }
136
 
137
  private function connect() {
138
+
139
  add_option('wpadm_pub_key', $this->pub_key);
140
  $this->result->setResult(WPAdm_Result::WPADM_RESULT_SUCCESS);
141
+
142
  $sendData['system_data'] = get_system_data();
143
  $data['actApi'] = 'setStats';
144
  $data['site'] = get_option('siteurl');
145
  $data['data'] = wpadm_pack($sendData);
146
  if (!class_exists('WP_Http')) {
147
+ include_once ABSPATH . WPINC . '/class-http.php';
148
  }
149
 
150
  $remote = array();
151
  $remote['body'] = $data;
152
  $remote['timeout'] = 20;
153
 
154
+ $result = wp_remote_post(WPADM_URL_BASE . "/api/", $remote);
155
  }
156
  public static function setPluginDIr($dir)
157
  {
163
  */
164
  private function auth() {
165
  $this->pub_key = get_option('wpadm_pub_key');
166
+ $methods_local = array('local_backup', 'send-to-dropbox', 'local_restore', 'local', 'queue_controller', 'local_send_to_s3');
167
+ if ( in_array($this->request['method'], $methods_local) ) {
168
  return true;
169
  }
170
  if (empty($this->pub_key)) {
171
  if ('connect' == $this->request['method']) {
172
  $this->pub_key = $this->request['params']['pub_key'];
173
  } else {
174
+ $this->getResult()->setError('Activate site in WPAdm.com for work to plugins.');
175
  return false;
176
  }
177
  } elseif ('connect' == $this->request['method']) {
204
  */
205
  static public function mkdir($dir) {
206
  if(!file_exists($dir)) {
207
+ @mkdir($dir, 0755);
208
+ if (!is_dir($dir)) {
209
+ self::$error = str_replace("&s", $dir, langWPADM::get('Failed to create a file, please check the permissions on the folders "&s".', false) );
210
+ } else {
211
+ //todo: права доступа
212
+ @file_put_contents($dir . '/index.php', '<?php echo "Hello World!"; ');
213
+ if ( !is_writable($dir . '/index.php') ) {
214
+ self::$error = str_replace("&s", $dir, langWPADM::get('Failed to create a file, please check the permissions on the folders "&s".', false) );
215
+ }
216
+ }
217
  }
218
+ return self::$error;
219
  }
220
 
221
  /**
271
  if (is_dir($f)) {
272
  self::rmdir($f);
273
  }
274
+ if (file_exists($f)) {
275
+ @unlink($f);
276
+ }
277
  }
278
+ @rmdir($dir);
279
+ } elseif (is_file($dir)) {
280
+ @unlink($dir);
281
  }
282
  }
283
+ static function dir_writeble($dir)
284
+ {
285
+ $error = self::mkdir($dir);
286
+ $ret = true;
287
+ if (empty($dir)) {
288
+ @file_put_contents($dir . "/test", "Hello World!!!");
289
+ if (!@is_writable($dir . "/test") && @filesize($dir . "/test") == 0) {
290
+ $ret = false;
291
+ }
292
+ @unlink($dir . "/test");
293
+ }
294
+ return $ret;
295
+ }
296
  }
297
  }
modules/class-wpadm-method-class.php ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ if (!is_dir( DROPBOX_BACKUP_DIR_BACKUP ) ) {
25
+ WPAdm_Core::mkdir( DROPBOX_BACKUP_DIR_BACKUP );
26
+ }
27
+ }
28
+
29
+ abstract function getResult();
30
+
31
+ public function isError()
32
+ {
33
+ $error = $this->result->getError();
34
+ return isset($this->result) && !empty( $error );
35
+ }
36
+ public function get_results()
37
+ {
38
+ return $this->result;
39
+ }
40
+ }
41
+ }
modules/class-wpadm-mysqldump.php CHANGED
@@ -8,222 +8,142 @@ 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 +154,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
 
13
  private function connect($db = '') {
14
  WPAdm_Core::log("----------------------------------------------------");
15
+ WPAdm_Core::log( langWPADM::get('Connecting to MySQL...' , false) );
16
+ if (! class_exists('wpdb')) {
17
+ require_once ABSPATH . '/' . WPINC . '/wp-db.php';
18
+ }
19
+ if ($this->dbh === null) {
20
+ $this->dbh = new wpdb( $this->user, $this->password, $db, $this->host );
21
+ $errors = $this->dbh->last_error;
22
+ if ($errors) {
23
+ $this->setError( langWPADM::get('MySQL Connect failed: ' , false) . $errors);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24
  }
25
+ if (isset($this->dbh->error->errors) && count($this->dbh->error->errors) > 0 ) {
26
+ $error = '';
27
+ foreach($this->dbh->error->errors as $key => $err) {
28
+ if ($key === 'db_connect_fail') {
29
+ $error .= "Connect fail: Check the number of connections to the database or \n";
30
+ }
31
+ $error .= strip_tags( implode("\n", ($err) ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
32
  }
33
+ $this->setError( $error );
34
+ }
35
  }
36
+ return $this->dbh;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
37
  }
38
 
39
  public function optimize($db) {
40
  $link = $this->connect($db);
41
+ WPAdm_Core::log( langWPADM::get('Optimize Database Tables was started' , false) );
42
+ $n = $link->query('SHOW TABLES');
43
+ $result = $link->last_result;
44
+ if (!empty( $link->last_error ) && $n > 0) {
45
+ $this->setError($link->last_error);
46
+ } else {
47
+ for($i = 0; $i < $n; $i++ ) {
48
+ $res = array_values( get_object_vars( $result[$i] ) );
49
+ $link->query('OPTIMIZE TABLE '. $res[0]);
50
+ if (!empty( $link->last_error ) ) {
51
+ $log = str_replace('%s', $res[0], langWPADM::get('Error to Optimize Table `%s`' , false) );
52
+ WPAdm_Core::log($log);
53
+ } else {
54
+ $log = str_replace('%s', $res[0], langWPADM::get('Optimize Table `%s` was successfully' , false) );
55
+ WPAdm_Core::log($log);
56
+ }
57
+ }
58
+ WPAdm_Core::log( langWPADM::get('Optimize Database Tables was Finished' , false) );
59
  }
 
60
 
61
  }
62
 
63
  public function mysqldump($db, $filename) {
64
  $link = $this->connect($db);
65
+ WPAdm_Core::log( langWPADM::get('MySQL of Dump was started' , false) );
66
  $tables = array();
67
+ $n = $link->query('SHOW TABLES');
68
+ $result = $link->last_result;
69
+ if (!empty( $link->last_error )) {
70
+ $this->setError($link->last_error);
71
+ return false;
72
+ }
73
+ if ($link->last_result === null) {
74
+ /* foreach($link->error->errors as $key => $errors) {
75
+ if ($key == db_connect_fail)
76
+ }*/
77
+ $this->setError(print_r(implode("\n", $link->error->errors), 1));
78
+ return false;
79
+ }
80
+ for($i = 0; $i < $n; $i++ ) {
81
+ $row = array_values( get_object_vars( $result[$i] ) );
82
  $tables[] = $row[0];
83
  }
84
 
 
 
85
  $return = '';
 
 
 
 
 
86
  foreach($tables as $table)
87
  {
88
+ $log = str_replace('%s', $table, langWPADM::get('Add a table "%s" in the database dump' , false) );
89
+ WPAdm_Core::log( $log );
90
+ $num_fields = $link->query('SELECT * FROM ' . $table);
91
+ $result = $link->last_result;
92
+ if (!empty( $link->last_error ) && $n > 0) {
93
+ $this->setError($link->last_error);
94
+ }
95
+ $return.= 'DROP TABLE IF EXISTS ' . $table . ';';
 
 
 
 
96
 
97
+ $ress = $link->query('SHOW CREATE TABLE ' . $table);
98
+ $result2 = $link->last_result;
99
+ if (!empty( $link->last_error ) && $n > 0) {
100
+ $this->setError($link->last_error);
101
+ }
102
+ $row2 = array_values( get_object_vars( $result2[0] ) );
103
  $return.= "\n\n".$row2[1].";\n\n";
104
+ if ($num_fields > 0) {
105
+ for ($i = 0; $i < $num_fields; $i++)
 
 
106
  {
107
+ $row = array_values( get_object_vars( $result[$i] ) );
108
+ //WPAdm_Core::log('row' . print_r($row, 1));
109
+ $rows_num = count($row);
110
+ if ($rows_num > 0) {
111
+ $return.= 'INSERT INTO '.$table.' VALUES(';
112
+ for($j=0; $j < $rows_num; $j++)
113
+ {
114
+ $row[$j] = addslashes($row[$j]);
115
+ $row[$j] = str_replace("\n","\\n",$row[$j]);
116
+ if (isset($row[$j])) { $return.= '"'.$row[$j].'"' ; } else { $return.= '""'; }
117
+ if ($j<($rows_num-1)) { $return.= ','; }
118
+ }
119
+ $return.= ");\n";
120
  }
121
+
122
  }
123
  }
124
  $return.="\n\n\n";
125
  }
126
+ unset($link);
 
127
  $handle = fopen($filename,'w+');
128
  fwrite($handle,$return);
129
  fclose($handle);
130
+ WPAdm_Core::log( langWPADM::get('MySQL of Dump was finished' , false) );
131
  return true;
132
  }
133
 
134
  private function setError($txt)
135
  {
 
136
  throw new Exception($txt);
137
  }
138
 
139
  public function restore($db, $file)
140
  {
141
  $link = $this->connect($db);
142
+ WPAdm_Core::log( langWPADM::get('Restore Database was started' , false) );
143
  $fo = fopen($file, "r");
144
  if (!$fo) {
145
+ WPAdm_Core::log( langWPADM::get('Error in open file dump' , false) );
146
+ $this->setError( langWPADM::get('Error in open file dump' , false) );
147
  return false;
148
  }
149
  $sql = "";
154
  if ($char_new !== false && $char_new != "\n") {
155
  $sql .= $char_new;
156
  } else {
157
+ $ress = $link->query($sql);
158
+ if (!empty( $link->last_error ) && $n > 0) {
159
+ $this->setError($link->last_error);
160
+ WPAdm_Core::log(langWPADM::get('MySQL Error: ' , false) . $link->last_error);
161
  break;
162
  };
163
  $sql = "";
164
  }
165
  }
166
  }
167
+ WPAdm_Core::log(langWPADM::get('Restore Database was finished' , false));
168
  }
169
  }
170
  }
modules/class-wpadm-queue.php CHANGED
@@ -64,7 +64,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(
@@ -118,17 +117,18 @@ 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
 
64
  $host = $pu['host'];
65
  $path = isset($pu['path']) ? $pu['path'] . "/" : "/" ;
66
 
 
67
  $data = array(
68
  'method' => 'queue_controller',
69
  'params' => array(
117
  }
118
  if (!file_exists($done_file)) {
119
  $this->error = 'No result of the command';
 
120
  } else {
121
  $queue = unserialize(file_get_contents($done_file));
122
  if (isset($queue['contexts'][0])) {
123
  $this->error = $queue['contexts'][0]->getError();
 
124
  }
125
  }
126
  if (file_exists($done_file)) {
127
  unlink($done_file);
128
  }
129
+ if (!empty($this->error) ) {
130
+ return false;
131
+ }
132
  return true;
133
  }
134
 
class-wpadm-result.php → modules/class-wpadm-result.php RENAMED
@@ -1,117 +1,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
- /**
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
+ /**
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
  }
modules/constant.php ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+
53
+ if (!defined("SITE_HOME")) {
54
+ define("SITE_HOME", str_ireplace( array( 'http://', 'https://' ), '', home_url() ) );
55
+ }
errorHandler.php → modules/errorHandler.php RENAMED
File without changes
readme.txt CHANGED
@@ -1,46 +1,296 @@
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.3.2
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, wp backup, wordpress backup
7
+ Requires at least: 3.9
8
+ Tested up to: 4.3.1
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
+ * Local Backup: create the Full Backup of Web Page (Files + Database) and store this at Local Storage of the Site;
27
+ * Dropbox Backup: create the Full Backup (Files + Database) of Web Page at Local Storage and upload this to Dropbox;
28
+ * Local Restore: restoration from Local backup at your website (web hosting);
29
+ * Dropbox Restore: restoration from Dropbox backup;
30
+ * With "dropbox backup & restore" plugin you can backup and restore WooCommerce shop inkl. Database with products;
31
+ * Notification loging on screen and in file;
32
+ * Use your own App key and App secret;
33
+ * Unlimited dropbox backups;
34
+ * Unlimited dropbox restores;
35
+ * Unlimited local backups;
36
+ * Unlimited local restores;
37
+ * Administrate ALL of Backups for ALL of your sites from one place – WPAdm-account (FULLY FREE);
38
+
39
+
40
+ You can create your WPAdm account for central Backup administration at http://www.wpadm.com
41
+ WPAdm account is FULLY FREE.<br /><br />
42
+
43
+ **PLEASE, READ CAREFULLY!** <br />
44
+ **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 />
45
+ **This is one of few WordPress backup plugins, who does a fully free support (plugin support!) for all of our users.<br />
46
+ 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 />
47
+ Providing of these FTP DATA IS NOT OBLIGATORY, but if you do this, - our support staff will check your backup process and you will recive a feedback about results.<br />
48
+ It can take a while and some patience from you.<br /><br />
49
+ We are not responsible for any 5хх-errors! Such errors caused in most cases (99,9%) by your server/hosting.<br />
50
+ 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 />
51
+ Thank you for your understanding!**
52
+
53
+ **ALL INFORMATION, PROVIDED BY OUR USERS IS IN SAFETY AND USED FOR SUPPORT ONLY!**
54
 
55
  If you need help with the plugin or you want to report a bug please refer to http://www.wpadm.com/support/
56
 
57
  == Installation ==
58
 
59
+ 1. Upload the plugin folder `Dropbox Backup` to the `/wp-content/plugins/` directory of your WordPress installation.
60
  2. Activate the plugin through the `Plugins` menu in WordPress
61
 
62
 
63
 
64
+ Dropbox Backup Plugin have a settings section on WordPress plugin page.
65
  If you need help with the plugin or you want to report a bug please refer to http://www.wpadm.com/support/
66
 
67
  == Other ==
68
 
69
+ = Very easy and secure Dropbox Backup and Restoration (website / web page restore from backup) =
70
+
71
  Usefull additional functions can be found at www.wpadm.com in the User profile.
72
+ DropBox Backup is a new plugin, so we tryed to provide a bug-free plugin/widget. We are maintain this project.
73
 
74
  Information about privacy: AFTER the user has been registered at WPAdm service AND has confirmed their registration,
75
  our plugin will get the minimum requirements of php and mysql configuration, version and language of wordpress.
76
  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.
77
+ WE DO NOT COLLECT AND DO NOT STORE THE PERSONAL DATA OF USERS FROM THIS PLUGIN!
78
+
79
+
80
+
81
+ = Webpage Backup on Dropbox =
82
+
83
+ 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 webpage 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.
84
+ 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 webpage 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 webpage 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 webpage clone. For our service www.webpage-backup.com it is important that our servise have permissions to the folders and to backup drive.
85
+
86
+ = Special functions =
87
+
88
+ To the special functions of our webpage 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 webpage 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, webpage or multisite as well as for migration - to register it is must. It is not possible to do full restoration of webpage from dropbox backup without the WordPress site self.
89
+
90
+ = Easy backup =
91
+
92
+ 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.
93
+
94
+ = Back Up, Cloning, duplicate or migrate of websites =
95
+
96
+ 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 webpage 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.
97
+
98
+ = Easy data restoring =
99
+
100
+ 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 webpage 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.
101
+
102
+ = What to do if recovering failed? =
103
+
104
+ First of all check the data spelling. It is most common mistake. Other common mistakes by recovering are:
105
+ * to recover from wrong cloud storage<br />
106
+ * if done alone database back up – not full and you can’t see the recover sites<br />
107
+ * by recovering process there was internet connection interrupted<br />
108
+ * In your database are file exclusions<br />
109
+ * your database back up was not consistent<br />
110
+ * file archive of back up with a broken checksum<br />
111
+ * back up or restore from damaged cloud storage or from damaged back up archive<br />
112
+ * misspelled back up due user failed restore<br />
113
+
114
+ 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 />
115
+ 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.
116
+
117
+ If you see some of 5xx error codes, as return of your backup:<br />
118
+ please, feel free to contact your own system administrator (admins, support etc.), because this type of errors come from your server.<br />
119
+
120
+ **The timely backup protects from viruses.**
121
+
122
+
123
+
124
+ == Frequently Asked Questions ==
125
+
126
+ = Where can I get my app key & secret? =
127
+
128
+ 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>.
129
+ 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>.
130
+ Note that Drop-ins have app keys but no app secrets.
131
+
132
+ = I clicked on the "Backup to Dropbox" button, but nothing happens. What's wrong? =
133
+
134
+ 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 />
135
+ 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 />
136
+ So please, at first connect yourself to Dropbox and then, try to make your backup to dropbox.
137
+
138
+ = How to restore my site from dropbox backup? =
139
+
140
+ - First of all, install the Dropbox backup & restore plugin;<br />
141
+ - In Dropbox backup & restore plugin check your connection to dropbox as "dropbox app" or as connection with use of app key & app secret;
142
+
143
+
144
+ = My web page completely crashed and not available. How can I restore my web page from dropbox backup? =
145
+
146
+ 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.
147
+
148
+ You must see all of your backups, that you have made.
149
+
150
+ = Should I upgrade my old version of Dropbox Backup and Restore plugin? =
151
+
152
+ Yes. We recommended to update or upgrade to a newest versions.
153
+
154
+ = How can I manage my backups? =
155
+
156
+ Manage of multiple back ups is possible from your account on webpage-backup.com
157
+
158
+ = I use multisite WordPress and I would like to manage my backups from one place. How can I do that? =
159
+
160
+ Multisite WP can be supported too, but you have to login in your account at www.webpage-backup.com
161
+
162
+ = Can I use the Dropbox Backup and Restore plugin to clone my website? =
163
+
164
+ 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).
165
+
166
+ = I didn't see my back up at my Dropbox. Why? How can I find it at my Dropbox? =
167
+
168
+ 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.
169
+
170
+ = Is it possible to migrate my website with your Dropbox back up tool? =
171
+
172
+ Many people stay us this question and our answer is - YES! It' good possibility to use our back up plugin specially for migration of webpages. Also you can migrate your website locally. If you make a local backup, then you can download it to your PC, upload to another place and make recovery there.
173
+
174
+ = How to make a recovery of my webpage? =
175
+
176
+ Dropbox Backup and Restore plugin work autonomously. In case, if your page not available, you may use www.webpage-backup.com to recovery your webpage from backup.
177
+
178
+ = I want schedule backup. How can I schedule backup of my website? =
179
+
180
+ To schedule backup of your webpage, you may use an account at www.webpage-backup.com to schedule backup.
181
+
182
+ = Can I make a schedule backup of my multisite WordPress? =
183
+
184
+ Please, see the previous question "I want schedule backup. How can I schedule backup of my website?".
185
+ 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.
186
+
187
+ = Should I register to make a back up of my site? =
188
+
189
+ 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.
190
+
191
+ = How can I manually restore my website from one place to another? =
192
+
193
+ You can restore your website on another place with two ways:<br />
194
+ * manually website restoration<br />
195
+ * automatically website restoration<br />
196
+
197
+ For automatically website restoration you may need an account at webpage-backup.com
198
+
199
+ = Is it possible to duplicate my website like Duplicator Plugin do that? =
200
+
201
+ Backups & Restoring plugin can Duplicate more simply as Duplicator.<br />
202
+ 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.
203
+
204
+ = Duplicate and clone is the same thing? =
205
+
206
+ 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.
207
+
208
+ = How can I manage or coordinate my duplicate website? =
209
+
210
+ 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.
211
+
212
+ = What does make your "duplicate" plugin, which doesn't make another (e.g. Duplicator plugin)? =
213
+
214
+ Duplicating is a very complex process. We will explain the website duplicate in the next our explanations about "duplicate website".
215
+
216
+ = Is it possible to make an Incremental Backup with Dropbox Backup & Restore plugin? =
217
+
218
+ 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 />
219
+ (PS: Autor german language)<br />
220
+ 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 />
221
+
222
+ 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.
223
+
224
+ = Just to do a MySQL backup. How to do that? =
225
+
226
+ 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 />
227
+ The version for mysql backup (DB Backup) is available due control panel at http://www.webpage-backup.com
228
+
229
+ = We want to make an SCP Backup from our rackspace (Full Rackspace Backup). For this operation we would like to use your Dropbox plugin. =
230
+
231
+ 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.
232
+
233
+ = FTP Backup? =
234
+
235
+ 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.
236
+
237
+ = Is dropbox backup and restoration plugin really free? =
238
+
239
+ Yes, dropbox backup and dropbox restoration are free with plugin "Dropbox Backup and Restore"!
240
+
241
+ = Whether I need to create an account on the wpadm.com? =
242
+
243
+ 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.
244
+
245
+ = Whether there are WordPress templates of my web site in a full backup archive? =
246
+
247
+ Full backup include templates of your site.
248
+
249
+ = 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? =
250
+
251
+ Please, just wait for some time and try again later.<br />
252
+ 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.
253
+ We cannot recommended you more, than just had to wait it out and problem went away after a while.
254
+
255
+ = I want to move my website to the new hosting/server. How can I do this? =
256
+
257
+ 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.
258
+
259
+ = 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? =
260
+
261
+ 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 />
262
+ 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.
263
+
264
+ = Why I cannot create local back up? =
265
+ 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 />
266
+ You've corrected these problems and still can't make a local back up - please, contact www.webpage-backup.com support.
267
+
268
+ = 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? =
269
+ 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.
270
+
271
+ == Changelog ==
272
+
273
+ Please, keep your Dropbox Backup and Restore plugin up-to-date.
274
+
275
+ == Upgrade Notice ==
276
+
277
+ Please, keep your Dropbox Backup and Restore plugin up-to-date.
278
+
279
+ == Screenshots ==
280
+
281
+ = Step-by-step & HOWTOs in Dropbox Backup and Restore plugin =
282
+
283
+ 1. **Main window of Dropbox Full Backup plugin.** Dropbox Backup and Restore plugin window after installation and activation.
284
+ 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.
285
+ 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.
286
+ 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 />
287
+ **Make sure**, you use the right App key and App secret pair and this pair correspond to your right dropbox application.<br />
288
+ **This is one of the most common mistakes of our users!**
289
+ 5. **Don't forget** to click on **"Connect"** button to get the dropbox plugin connected with your dropbox account.
290
+ 6. Click **"Create Dropbox Backup"** to create backup and upload this to your dropbox account using your pair of App key and App secret.
291
+ 7. Click **"Create Local Backup"** to create local backup. The local backup will be saved locally at your shared hosting / server.
292
+ 8. Table **list of backups** (local backups and dropbox backups), that was created with Dropbox Full Backup and Restore plugin.
293
+ 9. Screen9
294
+ 10. Screen10
295
+
296
+
template/css/admin-style-wpadm.css ADDED
@@ -0,0 +1,996 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ .form-counter {
83
+ background: #0096d6;
84
+ border: 1px solid #fff;
85
+ width: 95%;
86
+ margin-bottom: 20px;
87
+ margin-top: 20px;
88
+ color:#fff;
89
+ }
90
+ .log-dropbox {
91
+ background-repeat: no-repeat; background-position:center;
92
+ background-color: #fff;
93
+ height: 211px;
94
+ width: 170px;
95
+ float: left;
96
+ margin-top:-4px;
97
+ border: 1px solid #47a3ec;
98
+ border-radius:3px;
99
+ }
100
+ .block-content {
101
+ background-color: #fff;
102
+ border: 1px solid #e8e8e8;
103
+ padding: 10px;
104
+ }
105
+ #logs-form, #reviews-dropbox, #action-buttons {
106
+ float:left;
107
+ }
108
+ #logs-form, #reviews-dropbox {
109
+ padding: 10px; background: #ffffc8; border: 1px solid #0096d6; position: relative; height: 100px; text-align: center;
110
+ }
111
+ #reviews-dropbox {
112
+ float: right;
113
+ height: 150px;
114
+ width: 25%;
115
+ }
116
+ #action-buttons {
117
+ margin-right: 10px;
118
+ float:left;
119
+ margin-top:130px;
120
+ }
121
+ .form-field {
122
+ padding-top: 0px;
123
+ margin-bottom: 5px;
124
+ float: left;
125
+ margin-left:5px;
126
+ }
127
+
128
+ .title-reviews {
129
+ font-size: 20px;
130
+ margin-bottom: 24px;
131
+ margin-top:23px;
132
+ }
133
+ .desc-reviews {
134
+ font-size: 16px;
135
+ margin-top:10px;
136
+ margin-bottom: 20px;
137
+ }
138
+
139
+ .btn-danger {
140
+ background-color: #da4f49;
141
+ background-image: linear-gradient(to bottom, #ee5f5b, #bd362f);
142
+ background-repeat: repeat-x;
143
+ border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
144
+ color: #fff;
145
+ text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
146
+ border-radius: 3px;
147
+ font-size: 11.9px;
148
+ padding: 2px 10px;
149
+ cursor: pointer;
150
+ }
151
+ .btn-orange {
152
+ background-color: #f48326;
153
+ background-image: linear-gradient(to bottom, #cc5d00, #cc5d00);
154
+ background-repeat: repeat-x;
155
+ border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
156
+ color: #fff;
157
+ text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
158
+ border-radius: 3px;
159
+ font-size: 11.9px;
160
+ padding: 2px 10px;
161
+ cursor: pointer;
162
+ }
163
+ .btn-orange:hover {
164
+ color:#fff;
165
+ background-color: #f38325 ;
166
+ background-position: 0 -30px;
167
+ text-decoration: none;
168
+ transition: background-position 0.1s linear 0s;
169
+ }
170
+ .desc-wpadm {
171
+ clear: both;
172
+ color: #fff;
173
+ font-size: 13px;
174
+ /*font-style: italic;*/
175
+ }
176
+ .btn-danger:hover {
177
+ color:#fff;
178
+ background-color: #db362f ;
179
+ background-position: 0 -30px;
180
+ text-decoration: none;
181
+ transition: background-position 0.1s linear 0s;
182
+ }
183
+
184
+ .form-counter table tr td{
185
+ padding: 10px;
186
+ }
187
+ .color-picker {
188
+ margin:10px;
189
+ }
190
+ .stat_title {
191
+ text-align: center;
192
+ font-size: 24px;
193
+ margin-top: 20px;
194
+ }
195
+ .cfTabsContainer {
196
+ background-color: #0096d6;
197
+ overflow: hidden;
198
+ width:95%;
199
+ padding: 15px;
200
+ margin-bottom: 40px;
201
+ margin-top: 17px;
202
+ -webkit-font-smoothing: antialiased;
203
+ }
204
+
205
+
206
+ .button-wpadm {
207
+ background: none repeat scroll 0 0 #00d2b8;
208
+ border-color: #cdcdcd;
209
+ box-shadow: 0 1px 0 #00d2b8 inset, 0 1px 0 rgba(0, 0, 0, 0.08);
210
+ color: #fff;
211
+ vertical-align: top;
212
+ border-radius: 3px;
213
+ border-style: solid;
214
+ border-width: 1px;
215
+ box-sizing: border-box;
216
+ cursor: pointer;
217
+ display: inline-block;
218
+ font-size: 13px;
219
+ height: 28px;
220
+ line-height: 26px;
221
+ margin: 0;
222
+ padding: 0 10px 1px;
223
+ text-decoration: none;
224
+ white-space: nowrap;
225
+ }
226
+ .wpadm-info {
227
+ font-size: 15px;
228
+ width: 30%;
229
+ margin-top:10px;
230
+ margin-left: 20px;
231
+ margin-bottom: 20px;
232
+ border-left: 1px solid #fff;
233
+ padding-left:20px;
234
+ padding-top: 20px;
235
+ height:200px;
236
+ }
237
+ .wpadm-info-title {
238
+ text-align:center;
239
+ padding:5px;
240
+ color:#fff;
241
+ font-size:20px;
242
+ }
243
+ .wpadm-registr-info {
244
+ width: 65%;
245
+ }
246
+ .wpadm-registr-info label {
247
+ color:#fff;
248
+ }
249
+ .wpadm-plugins-info {
250
+ width: 95%;
251
+ }
252
+ .services-info {
253
+ background: #fff; width: 95%; margin-top: 20px;
254
+ }
255
+ .title-services {
256
+ text-align: center; font-size: 20px; font-weight: 800; padding-bottom: 30px; padding-top: 20px;
257
+ }
258
+
259
+ .tmpl_line_body {
260
+ float: left;
261
+ margin: 0;
262
+ padding: 0;
263
+ position: relative;
264
+ width: 100%;
265
+ }
266
+ .wpadm-info-auth {
267
+ font-size: 11px;
268
+ padding-left:20px;
269
+ height:30px;
270
+ color:#fff;
271
+ margin-top: -5px;
272
+ }
273
+ #header_navigation_line {
274
+ background-color: #21759b;
275
+ background-image: linear-gradient(to bottom, #2a95c5, #21759b);
276
+ box-shadow: 0 2px 7px 2px rgba(50, 50, 50, 0.5);
277
+ height: 68px;
278
+ left: 0;
279
+ top: 0;
280
+ z-index: 1000;
281
+ }
282
+ #header_navigation_line #main_menu ul li {
283
+ display: inline-block;
284
+ float: none;
285
+ font-size: 14px;
286
+ font-weight: bold;
287
+ list-style: outside none none;
288
+ margin: 0;
289
+ padding: 0;
290
+ text-shadow: 0 1px 0 rgba(0, 0, 0, 0.1);
291
+ }
292
+ .inline-right {
293
+ float:right;
294
+ }
295
+ .inline {
296
+ float:left;
297
+ }
298
+ .inline-right, .inline {
299
+ margin-top:10px;
300
+ margin-left:10px;
301
+ }
302
+ #header_navigation_line #main_menu ul li a {
303
+ background: -moz-linear-gradient(center top , #2e9ed2 5%, #21749b 100%) repeat scroll 0 0 #2e9ed2;
304
+ border: 1px solid #1b5f7f;
305
+ border-radius: 3px;
306
+ box-shadow: 1px 1px 0 0 #78c9e6 inset;
307
+ color: #dddddd;
308
+ display: inline-block;
309
+ float: left;
310
+ height: 43px;
311
+ line-height: 16px;
312
+ margin: 0 2px 0 0;
313
+ overflow: hidden;
314
+ padding: 5px 0;
315
+ text-decoration: none;
316
+ width: 90px;
317
+ }
318
+ #header_navigation_line #main_menu ul li:hover a {
319
+ background-image: linear-gradient(to bottom, #2fb1e5, #22759c);
320
+ color: #fff;
321
+ }
322
+ #header_navigation_line #main_menu {
323
+ float: left;
324
+ margin: 6px 0 0;
325
+ width: 100%;
326
+ }
327
+ #header_navigation_line #logo {
328
+ float: left;
329
+ left: 0;
330
+ position: absolute;
331
+ top: 9px;
332
+ width: auto;
333
+ }
334
+ #header_navigation_line #main_menu ul {
335
+ float: left;
336
+ list-style: outside none none;
337
+ margin: 0 0 0 20px;
338
+ padding: 0;
339
+ text-align: center;
340
+ width: 100%;
341
+ }
342
+ #header_navigation_line #main_menu ul li .nav_icon {
343
+ float: left;
344
+ height: 24px;
345
+ margin: 0;
346
+ padding: 0 0 3px;
347
+ width: 100%;
348
+ }
349
+ #header_navigation_line #main_menu ul li.active a, #header_navigation_line #main_menu ul li a:active {
350
+ background-image: linear-gradient(to bottom, #2cc4f5, #228bb4);
351
+ border: 1px solid #fff;
352
+ box-shadow: 0 1px 0 rgba(95, 157, 186, 0.6);
353
+ color: #fff;
354
+ }
355
+ .clear {
356
+ clear:both;
357
+ }
358
+ .plugins-info {
359
+ width:320px;
360
+ }
361
+ .plugin-box {
362
+ background: #0096d6;
363
+ border: 1px solid #e5e5e5;
364
+ box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
365
+ min-width: 255px;
366
+ position: relative;
367
+ line-height: 1;
368
+ margin-bottom: 20px;
369
+ padding: 0;
370
+ }
371
+
372
+ .plugins-info-content {
373
+ display:none;
374
+ border-top: 1px solid #fff;
375
+ margin-top:8px;
376
+ padding-top: 7px;
377
+ }
378
+ h3.plugins-title {
379
+ font-size: 14px;
380
+ line-height: 1.4;
381
+ margin: 0;
382
+ }
383
+ .plugins-title a {
384
+ color:#fff;
385
+ text-decoration: none;
386
+
387
+ }
388
+ .wpadm-registr-info, .wpadm-info, .wpadm-info-auth {
389
+ float:left;
390
+ color:#fff;
391
+ }
392
+ .button-wpadm:hover {
393
+ border-color:#cdcdcd;
394
+ background-color: #009583;
395
+ }
396
+ .wpadm-red:hover {
397
+ border-color:#737373 ;
398
+ background-color: #ff706c;
399
+ }
400
+ .wpadm-red {
401
+ background: none repeat scroll 0 0 #f21111;
402
+ border-color: #c7c6ce;
403
+ box-shadow: 0 1px 0 #ff2c26 inset, 0 1px 0 rgba(0, 0, 0, 0.08);
404
+ }
405
+ .info-detail {
406
+ background:#bee7e7;
407
+ }
408
+ .table {
409
+ margin:0px;padding:0px;
410
+ width:100%;
411
+ border:0px;
412
+ border-collapse: collapse;
413
+ border-spacing: 0;
414
+ width:100%;
415
+ height:100%;
416
+ border: 1px solid #b7c6ff;
417
+ border-radius: 3px;
418
+ margin-top: 60px;
419
+
420
+ }
421
+ .table th {
422
+ padding: 7px;
423
+ background-color:#dde4ff;
424
+ font-size:16px;
425
+
426
+ }
427
+ .title-logs, .title-status {
428
+ margin-bottom: 10px;
429
+ }
430
+ .help-key-secret {
431
+ font-size: 11px;
432
+ text-align: right;
433
+ color:#fff;
434
+ cursor: pointer;
435
+ }
436
+ .help-key-secret:hover {
437
+ color:#fff;
438
+ text-decoration:underline;
439
+ }
440
+ #log-backup div {
441
+ font-size:12px;
442
+ }
443
+ .table td {
444
+ background: #fff;
445
+ font-size: 12px;
446
+ padding: 5px 0;
447
+ border-bottom:1px solid #b7c6ff;
448
+ text-align: center;
449
+ }
450
+ .info-path td {
451
+ font-size: 11px;
452
+ padding:0px;
453
+ }
454
+ .table tr:last td {
455
+
456
+ border-bottom: 0px;
457
+ }
458
+ .header-table {
459
+ font-size:20px;
460
+ }
461
+
462
+ .stat {
463
+ width: 200px;
464
+ }
465
+
466
+ .w1{
467
+ width:5%;
468
+ }
469
+ .w2{
470
+ width:13%;
471
+ }
472
+ .w3{
473
+ width:7%;
474
+ }
475
+ .table-stat-moovdiv {
476
+ background: none repeat scroll 0 0 #FFFFFF;
477
+ border-spacing: 0;
478
+ box-shadow: 0 4px 4px rgba(0, 0, 0, 0.3);
479
+ left: 0px;
480
+ margin-top: 0;
481
+ padding: 10px 15px;
482
+ top: 0px;
483
+ width: 400px;
484
+ }
485
+
486
+ .table-stat-moovdiv tr td{
487
+ border-right: 0px;
488
+ margin-bottom: 1px;
489
+ margin-top: 1px;
490
+ padding-bottom: 1px;
491
+ padding-top: 1px;
492
+ border-bottom:1px solid #D6D6D6;
493
+ padding: 5px;
494
+ }
495
+
496
+ #page_item {
497
+ margin-bottom:3px;
498
+ float:left;
499
+ }
500
+ .block-export {
501
+ float: right;
502
+ margin-right: 20px;
503
+ }
504
+ .info {
505
+ width: 70%;
506
+ border: 0;
507
+ }
508
+ .setting-checkbox {
509
+ padding-left: 5px;margin-top: 5px;
510
+ }
511
+ .form-help-send-error input[type="text"], .form-help-send-error input[type="text"] {
512
+ padding: 0px;
513
+ border: 1px solid #999;
514
+ box-shadow:0px;
515
+ font-size: 12px;
516
+ height: 24px;
517
+ width: 250px;
518
+ }
519
+
520
+ .form-help-send-error, .form-help-mail-response {
521
+ float:left;
522
+ }
523
+ .form-help-mail-response .button-description {
524
+ text-align: center;
525
+ }
526
+ .show-includes {
527
+ text-align: left;
528
+ margin-left:20px;
529
+ margin-right:20px;
530
+ background: #fff;
531
+ padding: 20px;
532
+ }
533
+ #sent-error-report {
534
+ background: #fff;
535
+ width: 400px;
536
+ height: 200px;
537
+ text-align: center;
538
+ border-radius:4px;
539
+ border: 2px solid #00d2b8;
540
+ position: relative;
541
+ }
542
+ #sent-error-report .text-view {
543
+ text-align: center;
544
+ font-size: 20px;
545
+ padding-top: 50px;
546
+ line-height: 27px;
547
+ margin-bottom: 30px;
548
+ }
549
+ #sent-error-report .button-sent-report .button-wpadm {
550
+ padding: 1px 20px;
551
+ height: auto;
552
+ }
553
+ #sent-error-report .button-sent-report {
554
+ position: absolute;
555
+ bottom:0px;
556
+ padding-bottom: 30px;
557
+ width: 100%;
558
+ }
559
+
560
+ .show-includes input.input-folder[type="checkbox"] + label {
561
+ font: 18px bold;
562
+ color: #444;
563
+ cursor: pointer;
564
+ }
565
+ .show-includes input.input-folder[type="checkbox"] + label::before {
566
+ content: "";
567
+ display: inline-block;
568
+ height: 15px;
569
+ width: 18px;
570
+ margin: 0 5px 0 0;
571
+ background-image: url(folder.png);
572
+ }
573
+ .loading-img {
574
+ text-align: center;
575
+ height: 23px;
576
+ margin: 0 auto;
577
+ }
578
+ .show-includes input.checkbox-send[type="checkbox"] {
579
+ margin-top:0px;
580
+ }
581
+ .show-includes input.input-folder[type="checkbox"]:checked + label::before {
582
+ background-image: url(icon-folder-open.gif);
583
+ }
584
+ .show-includes input.input-folder[type="checkbox"]:checked:disabled + label::before {
585
+ background-image: url(icon-folder-open.gif);
586
+ }
587
+ .show-includes input.input-folder[type="checkbox"] {
588
+ display:none;
589
+ }
590
+ .tree-includes {
591
+ margin-left: 25px;
592
+ }
593
+
594
+ .form-help-mail-response {
595
+ margin-left: 20px;
596
+ }
597
+ .form-help-send-error .label-help {
598
+ float:left; width: 100px;
599
+ padding-top: 8px;
600
+ }
601
+ .border-shadow-bottom {
602
+ -webkit-box-shadow: 0 2px 7px -2px rgba(50, 50, 50, 0.5);
603
+ -moz-box-shadow: 0 2px 7px -2px rgba(50, 50, 50, 0.5);
604
+ box-shadow: 0 2px 7px -2px rgba(50, 50, 50, 0.5);
605
+ }
606
+ .info tr {
607
+ border-style: hidden;
608
+ }
609
+ .info tr td{
610
+ border-style: hidden;
611
+ padding: 5px;
612
+ text-align:left;
613
+ }
614
+ .chart-box {
615
+ background: #fff;
616
+ border:1px solid #cccccc;
617
+ border-radius:3px;
618
+ margin-top:25px;
619
+ }
620
+ .chart-box-title {
621
+ color:#575757;
622
+ border-bottom: 1px solid #cccccc;
623
+ font-size: 18px;
624
+ padding:10px;
625
+ }
626
+ .charts {
627
+ padding:5px;
628
+ padding-top: 15px;
629
+ }
630
+ .form-account {
631
+ margin-top: 30px;
632
+ margin-bottom : 40px;
633
+ border:5px solid #fff;
634
+ background: #ffffa5;
635
+ padding: 10px;
636
+ height: auto;
637
+ overflow:hidden;
638
+ }
639
+ .form-account-title {
640
+ margin-bottom: 20px;
641
+ font-size: 22px;
642
+ }
643
+ .form-account-block {
644
+ margin-left: 20px;
645
+ float:left;
646
+ width: 40%;
647
+ }
648
+ .form-account-login {
649
+ margin-top: 10px;
650
+ margin-bottom : 40px;
651
+ border:5px solid #fff;
652
+ background: #ffffa5;
653
+ padding: 3px;
654
+ height: auto;
655
+ overflow:hidden;
656
+ }
657
+
658
+ .form-account-block-login {
659
+ margin-left: 10px;
660
+ width: 90%;
661
+
662
+ }
663
+ .form-account-info {
664
+ float:left;
665
+ width: 50%;
666
+ margin-left: 20px;
667
+ }
668
+ .b_2 {
669
+ background: url("button_ok.png") no-repeat scroll 0 0 rgba(0, 0, 0, 0);
670
+ color: #464646;
671
+ font-family: Arial,Helvetica,sans-serif;
672
+ font-size: 18px;
673
+ left: 12px;
674
+ padding-left: 30px;
675
+ top: 60px;
676
+ padding-top: 4px;
677
+ padding-bottom : 5px;
678
+ }
679
+ .b-3 {
680
+ font-size: 22px;
681
+ }
682
+ .form-account-button {
683
+ margin-top: 21px;
684
+ }
685
+ .label-form {
686
+ margin-left: 6px;
687
+ font-size: 16px;
688
+ }
689
+ .last {
690
+ line-height: 18px;
691
+ margin-top: 9px;
692
+ }
693
+ .progress {
694
+ height: 20px;
695
+ background: #ebebeb;
696
+ border-left: 1px solid transparent;
697
+ border-right: 1px solid transparent;
698
+ border-radius: 10px;
699
+ }
700
+ .progress > span {
701
+ position: relative;
702
+ float: left;
703
+ margin: 0 -1px;
704
+ min-width: 30px;
705
+ height: 18px;
706
+ line-height: 16px;
707
+ text-align: right;
708
+ background: #cccccc;
709
+ border: 1px solid;
710
+ border-color: #bfbfbf #b3b3b3 #9e9e9e;
711
+ border-radius: 10px;
712
+ background-image: -webkit-linear-gradient(top, #f0f0f0, #dbdbdb 70%, #cccccc);
713
+ background-image: -moz-linear-gradient(top, #f0f0f0, #dbdbdb 70%, #cccccc);
714
+ background-image: -o-linear-gradient(top, #f0f0f0, #dbdbdb 70%, #cccccc);
715
+ background-image: linear-gradient(to bottom, #f0f0f0, #dbdbdb 70%, #cccccc);
716
+ -webkit-box-shadow: inset 0 1px rgba(255, 255, 255, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2);
717
+ box-shadow: inset 0 1px rgba(255, 255, 255, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2);
718
+ }
719
+ .progress > span > span {
720
+ padding: 0 8px;
721
+ font-size: 11px;
722
+ font-weight: bold;
723
+ color: #404040;
724
+ color: rgba(0, 0, 0, 0.7);
725
+ text-shadow: 0 1px rgba(255, 255, 255, 0.4);
726
+ }
727
+ .progress > span:before {
728
+ content: '';
729
+ position: absolute;
730
+ top: 0;
731
+ bottom: 0;
732
+ left: 0;
733
+ right: 0;
734
+ z-index: 1;
735
+ height: 18px;
736
+ border-radius: 10px;
737
+ }
738
+
739
+
740
+
741
+ .stat-form-counter {
742
+ background: none repeat scroll 0 0 #0096d6;
743
+ color: #fff;
744
+ margin-bottom: 20px;
745
+ width: 46%;
746
+ margin-right: 0;
747
+ border: 0;
748
+ padding: 3px;
749
+ }
750
+ .stat-wpadm-registr-info {
751
+ color: #fff;
752
+ float: left;
753
+ width: 57%;
754
+ }
755
+ .stat-wpadm-registr-info label {
756
+ color:#fff;
757
+ }
758
+ .stat-wpadm-info-title {
759
+ color: #fff;
760
+ font-size: 20px;
761
+ padding :20px 0px;
762
+ margin-top:10px;
763
+ text-align: center;
764
+ }
765
+ .stat-table-registr {
766
+ margin-top: 20px;
767
+ }
768
+ .stat-table-registr th, .stat-table-registr td {
769
+ padding:5px;
770
+ }
771
+ .stat-wpadm-info {
772
+ width: 37%; margin-left: 9px; height:100%; padding-top: 0px; margin-top:20px;
773
+ color: #fff;
774
+ float: left;
775
+ border-left: 1px solid #fff;
776
+ font-size: 12px;
777
+ margin-bottom: 20px;
778
+ padding-left: 20px;
779
+ }
780
+ .block-button-show {
781
+ padding:11px 18px; cursor: pointer; text-align: center;
782
+ }
783
+ .block-button-show .block-click {
784
+ padding-top: 10px;
785
+ font-size: 16px;
786
+ border-top:1px solid #fff;
787
+ }
788
+ .stat-setting {
789
+ border-left:1px solid #fff;
790
+ margin-right: 0px;
791
+ }
792
+ #stat-title-setting{
793
+ font-size: 20px;
794
+ margin-top: 10px;
795
+ padding: 20px 0;
796
+ text-align: center;
797
+ }
798
+ #preview-image {
799
+ height: 105px; float: left; margin-right: 10px; margin-top:45px;
800
+ }
801
+ #preview-image .block-preview-image {
802
+ padding: 10px; border: 1px solid #fff; margin-left: 10px; margin-top:20px; width: 90px; text-align: center;
803
+ }
804
+ #preview-image .title-preveiw-image {
805
+ font-size: 16px; position: absolute;margin-top: -28px; margin-left: 7px;background: #0096d6; padding: 3px;
806
+ }
807
+ #preview-image .image-block {
808
+ display: table;
809
+ }
810
+ .image-block .image-block-in {
811
+ display: table-cell; vertical-align: middle;
812
+ }
813
+ .image-block-in img {
814
+ float: left;margin-top:7px;
815
+ margin-left: 2px;
816
+ }
817
+ .image-block-in .text-image-counter {
818
+ float: left;
819
+ padding-left:3px;
820
+ font-size: 8px;
821
+ font-weight: 600;
822
+ }
823
+ #setting-form .info-block {
824
+ float: left; margin: 5px 0px 0px; width:74%;
825
+ }
826
+ #setting-form .first-info-block {
827
+ margin: 20px 0px 0px;
828
+ }
829
+ .info-block-detail {
830
+ float:left;
831
+ }
832
+ .detail-title {
833
+ margin: 0 5px; width: 30%;
834
+ }
835
+ #setting-form .info-block .details-info {
836
+ width: auto;
837
+ font-size: 10px;
838
+ margin:0px;
839
+ }
840
+ #setting-form .info-block input[type="text"] {
841
+ font-size: 14px;
842
+ height: 28px;
843
+ }
844
+ .info-block .checkbox-info {
845
+ width:101px;
846
+ text-align:right;
847
+ }
848
+ .checkbox-info input[type="checkbox"] {
849
+ margin-right: 0px;
850
+ }
851
+ .stat-setting-save {
852
+ text-align: center; margin-top: 10px;
853
+ }
854
+
855
+ /*default style */
856
+ @media only screen and (max-width: 960px) {
857
+ /*
858
+ tablet computer
859
+ */
860
+ .stat-wpadm-info {
861
+ margin-left: 9px; height:100%; padding-top: 0px; margin-top:20px;
862
+ color: #fff;
863
+ float: none;
864
+ clear:both;
865
+ border-left: 0px;
866
+ border-top:1px solid #fff;
867
+ font-size: 10px;
868
+ margin-bottom: 10px;
869
+ padding-left: 0px;
870
+ width:88%;
871
+ }
872
+
873
+ .stat-table-registr th, .stat-table-registr td {
874
+ padding:2px;
875
+ font-size:10px;
876
+ }
877
+ .stat-table-registr {
878
+ margin-top: 10px;
879
+ float:none;
880
+ }
881
+ .form-table label {
882
+ color:#fff;
883
+ }
884
+ .form-table th {
885
+ line-height: 10px;
886
+ }
887
+ .stat-table-registr input {
888
+ font-size: 10px;
889
+ height: 20px;
890
+ line-height: 10px;
891
+ }
892
+ .stat-form-counter {
893
+ font-size:10px;
894
+ margin-right:5px;
895
+ }
896
+ #setting-form .info-block {
897
+ width:60%;
898
+ }
899
+ #preview-image {
900
+ height: 105px;
901
+ float: left;
902
+ margin-right: 10px;
903
+ }
904
+ .detail-title {
905
+ margin: 0 5px; width:auto;
906
+ }
907
+ #setting-form .info-block .details-info {
908
+ width: auto;
909
+ font-size: 8px;
910
+ float:none;
911
+ clear:both;
912
+ line-height: 8px;
913
+ margin-bottom:5px;
914
+
915
+ }
916
+ .info-block .checkbox-info {
917
+ width:28px;
918
+ }
919
+ #setting-form .info-block input[type="text"] {
920
+ font-size:12px;
921
+ height: 20px;
922
+ }
923
+ .minicolors-theme-default.minicolors-position-right .minicolors-input {
924
+ padding-right: 10px;
925
+ }
926
+
927
+ .minicolors-theme-default .minicolors-swatch {
928
+ height: 18px;
929
+ left: 5px;
930
+ top: 1px;
931
+ width: 18px;
932
+ }
933
+
934
+ }
935
+ @media only screen and (max-width: 1124px) {
936
+ .stat-form-counter {
937
+ font-size:10px;
938
+ margin-right:3.5%;
939
+ }
940
+ #setting-form .info-block {
941
+ width:55%;
942
+ }
943
+ #preview-image {
944
+ height: 105px;
945
+ float: left;
946
+ margin-right: 10px;
947
+ margin-top:40px;
948
+ }
949
+ .info-block input[type="text"] {
950
+ font-size:12px;
951
+ height: 20px;
952
+ }
953
+ .dbb-info-details-form {
954
+ line-height: 16px;
955
+ margin:7px;
956
+ padding:7px 11px;
957
+ font-size:14px;
958
+ }
959
+ .dbb-info-details-form .button-submit {
960
+ padding:5px;
961
+ margin-top:11px;
962
+ margin-bottom:18px;
963
+
964
+ }
965
+
966
+ }
967
+ @media only screen and (max-width: 758px) {
968
+ /*
969
+ vertical tablet computer
970
+ */
971
+ .dbb-info-details-form {
972
+ font-size:10px;
973
+ line-height: 10px;
974
+ margin:5px;
975
+ padding:5px 9px;
976
+ }
977
+ .dbb-info-details-form .button-submit {
978
+ padding:3px;
979
+ margin-top:7px;
980
+ margin-bottom:15px;
981
+ }
982
+ }
983
+ @media only screen and (max-width: 524px) {
984
+ /*phone*/
985
+ .dbb-info-details-form {
986
+ font-size:8px;
987
+ line-height: 8px;
988
+ margin:6px;
989
+ padding:5px 7px;
990
+ }
991
+ .dbb-info-details-form .button-submit {
992
+ padding:1px;
993
+ margin-top:5px;
994
+ margin-bottom:8px;
995
+ }
996
+ }
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/dropbox_pro_logo_box1.png ADDED
Binary file
template/expsys.php ADDED
@@ -0,0 +1 @@
 
1
+ <?php
template/index.php ADDED
@@ -0,0 +1,2 @@
 
 
1
+ <?php
2
+ // bla-bla-bla-bla
template/js/admin-wpadm.js ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ function blickForm(id, t)
9
+ {
10
+ if(t.checked == true) {
11
+ t.checked = false;
12
+ }
13
+ l = jQuery('#' + id).length;
14
+ showRegistInfo(false);
15
+ if (l > 0) {
16
+ blick(id);
17
+ }
18
+ }
19
+
20
+ var shows_id = ""
21
+ var shows_t = ""
22
+ function shows(id, t)
23
+ {
24
+ if(document.getElementById(id).style.display == "none") {
25
+ document.getElementById(id).style.display = "table-row";
26
+ jQuery(t).parent("tr").addClass('border-shadow-bottom');
27
+ if (shows_id == "") {
28
+ shows_id = id;
29
+ shows_t = t;
30
+ } else {
31
+ if(shows_id != id) {
32
+ document.getElementById(shows_id).style.display = "none";
33
+ jQuery(shows_t).parent("tr").removeClass('border-shadow-bottom');
34
+ }
35
+ shows_id = id;
36
+ shows_t = t;
37
+ }
38
+ } else if(document.getElementById(id).style.display == "table-row") {
39
+ document.getElementById(id).style.display = "none";
40
+ jQuery(t).parent("tr").removeClass('border-shadow-bottom');
41
+ }
42
+ }
43
+ var bl = false;
44
+ function show_form_auth(file_val)
45
+ {
46
+ if (file_val == 'registr') {
47
+ showRegistInfo(false);
48
+ if (bl === false) {
49
+ blick('container-user');
50
+ bl = true;
51
+ }
52
+ } else {
53
+ html = '<input type="hidden" value="' + file_val +'" name="internal_identifier">';
54
+ jQuery('#form_auth_backup').html(html);
55
+ document.form_auth_backup.submit();
56
+ }
57
+ }
58
+ var blick_form = true;
59
+ function blick(id, border_)
60
+ {
61
+ if (border_ == 'undefined') {
62
+ border_ = 10;
63
+ }
64
+ jQuery('#' + id).css({
65
+ outline: "0px solid #cd433d",
66
+ border: "0px"
67
+ }).animate({
68
+ outlineWidth: border_ + 'px',
69
+ outlineColor: '#cd433d'
70
+ }, 400).animate({outlineWidth: '0px',outlineColor: '#cd433d' } , 400);
71
+ if (blick_form) {
72
+ setTimeout('blick("' + id + '", ' + border_ + ')', 800);
73
+ }
74
+ }
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 langWPADM::get('Professional version of'); ?>
4
+ "<a href="<?php echo admin_url("admin.php?page=wpadm_wp_full_backup_dropbox"); ?>" title="<?php langWPADM::get('Dropbox backup and restore"')?>" alt="<?php langWPADM::get('Dropbox backup and restore')?>"><?php langWPADM::get('Dropbox backup and restore')?></a>"
5
+ <?php langWPADM::get(' plugin is now available!'); ?>
6
+ <a href="<?php echo admin_url("admin.php?page=wpadm_wp_full_backup_dropbox"); ?>" title="<?php langWPADM::get('Read more...')?>" alt="<?php langWPADM::get('Read more...')?>"><?php langWPADM::get('Read more...')?></a>
7
+ <a href="<?php echo admin_url( 'admin-post.php?action=hide_notice&type=preview' ); ?>" style="float: right; font-size: 12px;">[<?php langWPADM::get('hide this message')?>]</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, langWPADM::get('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.', false )) ; ?><br />
5
+ <?php langWPADM::get('Thank you!')?>
6
+ <br />
7
+ <a href="https://wordpress.org/support/view/plugin-reviews/dropbox-backup?filter=5" ><?php langWPADM::get('Leave review'); ?></a><br />
8
+ <a href="<?php echo admin_url( 'admin-post.php?action=hide_notice&type=star' );?>"><?php langWPADM::get('I already left a review'); ?></a><br />
9
+ <a href="<?php echo admin_url( 'admin-post.php?action=hide_notice&type=star&hide=' . $hide );?>"><?php langWPADM::get('Hide this message'); ?></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,1259 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ var home_url = '<?php echo SITE_HOME; ?>';
11
+
12
+ function showRegistInfo(show)
13
+ {
14
+ display = jQuery('#cf_activate').css('display');
15
+ if (display == 'none') {
16
+ jQuery('#cf_activate').show('slow');
17
+ jQuery('#registr-show').html("<?php langWPADM::get('Hide'); ?>");
18
+ jQuery('#title-regisr').css("padding" , "0px 0px");
19
+ jQuery('#registr-choice-icon').removeClass("dashicons-arrow-down").addClass('dashicons-arrow-up');
20
+ } else {
21
+ if (show) {
22
+ jQuery('#cf_activate').hide('slow');
23
+ jQuery('#registr-show').html("<?php langWPADM::get('Show'); ?>");
24
+ jQuery('#title-regisr').css("padding" , "20px 0px");
25
+ jQuery('#registr-choice-icon').removeClass("dashicons-arrow-up").addClass('dashicons-arrow-down');
26
+ }
27
+ }
28
+ }
29
+ function showSetting(show)
30
+ {
31
+ display = jQuery('#setting_active').css('display');
32
+ if (display == 'none') {
33
+ jQuery('#setting_active').show(1000);
34
+ jQuery('#setting-show').html("<?php langWPADM::get('Hide'); ?>");
35
+ jQuery('#title-setting').css("padding" , "0px 0px");
36
+ jQuery('#setting-choice-icon').removeClass("dashicons-arrow-down").addClass('dashicons-arrow-up');
37
+ } else {
38
+ if (show) {
39
+ jQuery('#setting_active').hide('slow');
40
+ jQuery('#setting-show').html("<?php langWPADM::get('Show'); ?>");
41
+ jQuery('#title-setting').css("padding" , "20px 0px");
42
+ jQuery('#setting-choice-icon').removeClass("dashicons-arrow-up").addClass('dashicons-arrow-down');
43
+ }
44
+ }
45
+ }
46
+ process_flag = 0;
47
+ function start_local_backup()
48
+ {
49
+ d = new Date();
50
+ var data_backup = {
51
+ 'action': 'wpadm_local_backup',
52
+ 'time': Math.ceil( (d.getTime() + (-d.getTimezoneOffset() * 60000 ) ) / 1000 )
53
+ };
54
+ jQuery("#logs-form").show("slow");
55
+ jQuery("#action-buttons").css('margin-top', '8px');
56
+ jQuery("#support-button").css('margin-top', '8px');
57
+ jQuery("#log-backup").html('');
58
+ jQuery(".title-logs").css('display', 'block');
59
+ jQuery(".title-status").css('display', 'none');
60
+ jQuery.ajax({
61
+ type: "POST",
62
+ url: ajaxurl,
63
+ data: data_backup,
64
+ beforeSend: function(){
65
+ process_flag = 1
66
+ processBar();
67
+ showTime();
68
+
69
+ },
70
+ success: function(data){
71
+ process_flag = 0;
72
+ if (data.result == 'success') {
73
+ jQuery('.title-logs').css('display', 'none');
74
+ jQuery('.title-status').css({'display':'block', 'color':'green'});
75
+ jQuery('.title-status').html('<?php langWPADM::get('Local Backup was created successfully'); ?>');
76
+ } else {
77
+ jQuery('.title-logs').css('display', 'none');
78
+ jQuery('.title-status').css({'display':'block', 'color':'red'});
79
+ jQuery('.title-status').html("<?php langWPADM::get('Local Backup wasn\'t created'); ?>");
80
+ }
81
+ showData(data);
82
+ jQuery('.table').css('display', 'table');
83
+
84
+ },
85
+ error: function(jqXHR, textStatus, errorThrown){
86
+ processStop();
87
+ AjaxAlert(jqXHR, textStatus, errorThrown);
88
+ },
89
+ dataType: 'json'
90
+ });
91
+ }
92
+ function AjaxAlert(jqXHR, textStatus, errorThrown)
93
+ {
94
+ 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>";
95
+ jQuery("#ajax-message").html(msg);
96
+ jQuery("#msg_ajax").val(msg);
97
+ jQuery('#ajax-alert').arcticmodal({
98
+ beforeOpen: function(data, el) {
99
+ jQuery('#ajax-alert').css('display','block');
100
+ },
101
+ afterClose: function(data, el) {
102
+ jQuery('#ajax-alert').css('display','none');
103
+ }
104
+ });
105
+ }
106
+
107
+ var auth_param = <?php echo isset($dropbox_options['app_key']) && isset($dropbox_options['app_secret']) && isset($dropbox_options['uid']) && $dropbox_options['uid'] != '' ? 'false' : 'true' ?>;
108
+ function start_dropbox_backup()
109
+ {
110
+ if (auth_param === false) {
111
+ d = new Date();
112
+ process_flag = 0;
113
+ var data_backup = {
114
+ 'action': 'wpadm_dropbox_create',
115
+ 'time': Math.ceil( (d.getTime() + (-d.getTimezoneOffset() * 60000 ) ) / 1000 ),
116
+ };
117
+ jQuery("#logs-form").show("slow");
118
+ jQuery("#action-buttons").css('margin-top', '8px');
119
+ jQuery("#support-button").css('margin-top', '8px');
120
+ jQuery("#log-backup").html('');
121
+ jQuery(".title-logs").css('display', 'block');
122
+ jQuery(".title-status").css('display', 'none');
123
+ jQuery.ajax({
124
+ type: "POST",
125
+ url: ajaxurl,
126
+ data: data_backup,
127
+ beforeSend: function(){
128
+ process_flag = 1
129
+ processBar();
130
+ showTime();
131
+
132
+ },
133
+ success: function(data){
134
+ process_flag = 0;
135
+ if (data.result == 'success') {
136
+ jQuery('.title-logs').css('display', 'none');
137
+ jQuery('.title-status').css({'display':'block', 'color':'green'});
138
+ jQuery('.title-status').html('<?php langWPADM::get('Dropbox Backup was created successfully'); ?>');
139
+ } else {
140
+ jQuery('.title-logs').css('display', 'none');
141
+ jQuery('.title-status').css({'display':'block', 'color':'red'});
142
+ jQuery('.title-status').html("<?php langWPADM::get('Dropbox Backup wasn\'t created. '); ?>" + data.error);
143
+ }
144
+ showData(data);
145
+ jQuery('.table').css('display', 'table');
146
+
147
+ },
148
+ error: function(jqXHR, textStatus, errorThrown) {
149
+ processStop();
150
+ AjaxAlert(jqXHR, textStatus, errorThrown);
151
+ },
152
+ dataType: 'json'
153
+ });
154
+ } else {
155
+ jQuery('#is-dropbox-auth').arcticmodal({
156
+ beforeOpen: function(data, el) {
157
+ jQuery('#is-dropbox-auth').css('display','block');
158
+
159
+ },
160
+ afterClose: function(data, el) {
161
+ jQuery('#is-dropbox-auth').css('display','none');
162
+ showSetting(false);
163
+ blick('app_key', 4);
164
+ blick('app_secret', 4);
165
+ }
166
+ });
167
+ }
168
+ }
169
+ function showData(data)
170
+ {
171
+ size_backup = data.size / 1024 / 1024;
172
+ if (data.size != 0 || data.result != 'error') {
173
+ var img_table =
174
+ '<img src="<?php echo plugin_dir_url(__FILE__) . "ok.png" ;?>" title="Successful" alt="Successful" style="float: left; width: 20px; height: 20px;" />' +
175
+ '<div style="margin-top :1px;float: left;"><?php echo langWPADM::get('Successful', false);?></div>';
176
+ name_backup = data.name;
177
+ } else {
178
+ var img_table =
179
+ '<img src="<?php echo plugin_dir_url(__FILE__) . "not-ok.png" ;?>" title="fail" alt="fail" style="float: left; width: 20px; height: 20px;" />' +
180
+ '<div style="margin-top :1px;float: left;"><?php echo langWPADM::get('Fail', false);?>&nbsp;&nbsp;(<a style="text-decoration:underline;"><?php echo langWPADM::get('Show Details', false);?></a>)</div>';
181
+ name_backup = '<?php echo langWPADM::get('Not available', false);?>';
182
+ }
183
+ info = "";
184
+ if (data.data) {
185
+ for(i = 0; i < data.data.length; i++) {
186
+ e = data.data[i].split('/');
187
+ info += '<tr style="border: 0;">' +
188
+ '<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>' +
189
+ '</tr>' ;
190
+ }
191
+
192
+ co = jQuery('.number-backup').length + 1;
193
+ jQuery('.table > tbody:last').after(
194
+ '<tr>'+
195
+ '<td class="number-backup" onclick="shows(\'' + data.md5_data + '\', this)">' +
196
+ co +
197
+ '</td>' +
198
+ '<td class="pointer" onclick="shows(\'' + data.md5_data + '\', this)" style="text-align: left; padding-left: 7px;" >' +
199
+ data.time +
200
+ '</td>' +
201
+ '<td class="pointer" onclick="shows(\'' + data.md5_data + '\', this)">' +
202
+ name_backup +
203
+ '</td>' +
204
+ '<td class="pointer" onclick="shows(\'' + data.md5_data + '\',this)">' +
205
+ data.counts +
206
+ '</td>' +
207
+ '<td class="pointer" onclick="shows(\'' + data.md5_data + '\', this)">' +
208
+ img_table +
209
+ '</td>' +
210
+ '<td class="pointer" onclick="shows(\'' + data.md5_data + '\', this)">' +
211
+ data.type + ' <?php langWPADM::get('backup')?>' +
212
+ '</td>' +
213
+ '<td class="pointer" onclick="shows(\'' + data.md5_data + '\', this)">' +
214
+ size_backup.toFixed(2) + "<?php langWPADM::get('Mb')?>" +
215
+ '</td>' +
216
+ '<td>' +
217
+ '<a href="javascript:void(0)" class="button-wpadm" title="<?php langWPADM::get('Restore')?>" onclick="show_recovery_form(\'' + data.type + '\', \'' + data.name + '\')"><span class="pointer dashicons dashicons-backup"></span><?php langWPADM::get('Restore')?></a> &nbsp;' +
218
+ '<a href="javascript:void(0)" class="button-wpadm" title="<?php langWPADM::get('Delete')?>" onclick="delete_backup(\'' + data.name + '\', \'' + data.type + '\')"><span class="pointer dashicons dashicons-trash"></span><?php langWPADM::get('Delete')?></a> &nbsp;' +
219
+ '</td>' +
220
+ '</tr>'+
221
+ '<tr id="' + data.md5_data + '" style="display: none;">'+
222
+ '<td colspan="2">' +
223
+ '</td>' +
224
+ '<td align="center" style="padding: 0px; width: 350px;">' +
225
+ '<div style="overflow: auto; max-height: 150px;">' +
226
+ '<table border="0" align="center" style="width: 100%;" class="info-path">' +
227
+ info +
228
+ '</table>' +
229
+ '</div>' +
230
+ '</td>' +
231
+ '<td colspan="6"></td>' +
232
+ '</tr>')
233
+ }
234
+ }
235
+ var logs = [];
236
+ function processBar()
237
+ {
238
+ var data_log = {
239
+ 'action': 'wpadm_logs',
240
+ };
241
+ jQuery.ajax({
242
+ type: "POST",
243
+ url: ajaxurl,
244
+ data: data_log,
245
+ success: function(response){
246
+ eval("var data=" + response);
247
+ for(s in data.log) {
248
+ if (jQuery.inArray(s , logs) == -1) {
249
+ l = jQuery("#log-backup").html();
250
+ l = "<div>" + data.log[s] + "</div>" + l;
251
+ jQuery("#log-backup").html(l);
252
+ }
253
+ }
254
+ if (process_flag == 1) {
255
+ setTimeout('processBar()', 3000);
256
+ }
257
+ },
258
+ error: function(jqXHR, textStatus, errorThrown){
259
+ processStop();
260
+ AjaxAlert(jqXHR, textStatus, errorThrown);
261
+ },
262
+ });
263
+ }
264
+
265
+ function showTime(t)
266
+ {
267
+ if (process_flag == 1) {
268
+ if ( (typeof t) == 'undefined') {
269
+ t = 1;
270
+ } else {
271
+ t = t + 1;
272
+ }
273
+ time = t + " <?php langWPADM::get('sec.'); ?>";
274
+ jQuery("#time_backup").html(time);
275
+ setTimeout(function() { showTime(t) }, 1000);
276
+ }
277
+ }
278
+ function processStop()
279
+ {
280
+ process_flag = 0;
281
+ }
282
+ function delete_backup(backup, type)
283
+ {
284
+ document.delete_backups.backup_name.value = backup;
285
+ document.delete_backups.backup_type.value = type;
286
+ document.delete_backups.submit();
287
+ }
288
+ function create_backup (type) {
289
+ if (type == 'auth') {
290
+ document.form_auth_backup_create.submit();
291
+ }
292
+ }
293
+ function show_recovery_form(type, name)
294
+ {
295
+ var act = '';
296
+ if (type == 'local') {
297
+ act = 'wpadm_local_restore';
298
+ } else {
299
+ act = 'wpadm_restore_dropbox';
300
+ }
301
+ var data_backup = {
302
+ 'action': act,
303
+ 'name': name,
304
+ };
305
+ jQuery("#log-backup").html('');
306
+ jQuery("#action-buttons").css('margin-top', '8px');
307
+ jQuery("#support-button").css('margin-top', '8px');
308
+ jQuery(".title-logs").css('display', 'block');
309
+ jQuery(".title-status").css('display', 'none');
310
+ jQuery("#logs-form").show("slow");
311
+ jQuery("#action-buttons").css('margin-top', '8px');
312
+ jQuery.ajax({
313
+ type: "POST",
314
+ url: ajaxurl,
315
+ data: data_backup,
316
+ beforeSend: function(){
317
+ process_flag = 1
318
+ processBar();
319
+ showTime();
320
+
321
+ },
322
+ success: function(data){
323
+ process_flag = 0;
324
+ if (data.result == 'success') {
325
+ jQuery('.title-logs').css('display', 'none');
326
+ jQuery('.title-status').css({'display':'block', 'color':'green'});
327
+ if (type == 'local') {
328
+ str = '<?php langWPADM::get('Local Backup (%s) was restored successfully'); ?>';
329
+ str = str.replace('%s', name);
330
+ jQuery('.title-status').html(str);
331
+ } else {
332
+ str = '<?php langWPADM::get('Dropbox Backup (%s) was restored successfully'); ?>';
333
+ str = str.replace('%s', name);
334
+ jQuery('.title-status').html(str);
335
+ }
336
+ } else {
337
+ jQuery('.title-logs').css('display', 'none');
338
+ jQuery('.title-status').css({'display':'block', 'color':'red'});
339
+ if (type == 'local') {
340
+ str = "<?php langWPADM::get('Local Backup (%s) wasn\'t restored'); ?>";
341
+ str = str.replace("%s", name) ;
342
+ jQuery('.title-status').html(str);
343
+ } else {
344
+ str = "<?php langWPADM::get('Dropbox Backup (%s) wasn\'t restored'); ?>";
345
+ str = str.replace('%s', name);
346
+ jQuery('.title-status').html(str);
347
+ }
348
+ }
349
+ },
350
+ error: function(jqXHR, textStatus, errorThrown) {
351
+ processStop();
352
+ AjaxAlert(jqXHR, textStatus, errorThrown);
353
+ },
354
+ dataType: 'json'
355
+ });
356
+
357
+ }
358
+ function auth_form(t)
359
+ {
360
+ var button = jQuery(t);
361
+ var form = button.closest('form');
362
+ var data = {};
363
+
364
+ var reg = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,6})+$/;
365
+ mail = document.auth.username.value;
366
+ send = false;
367
+ if (!reg.test(mail)) {
368
+ document.auth.username.style.border = "2px solid red";
369
+ } else {
370
+ document.auth.username.style.border = "1px solid #5b9dd9";
371
+ if(document.auth.password.value.length == 0) {
372
+ document.auth.password.style.border = "2px solid red";
373
+ } else {
374
+ send = true;
375
+ document.auth.password.style.border = "1px solid #5b9dd9";
376
+ }
377
+ }
378
+ if(send) {
379
+ form.find('#message-form').css('display', 'none');
380
+ data['password'] = document.auth.password.value;
381
+ data['username'] = document.auth.username.value;
382
+ data['plugin'] = document.auth.plugin.value;
383
+ backup = jQuery("#name_backup_restore").val();
384
+ jQuery.ajax({
385
+ url: form.attr('action'),
386
+ data: data,
387
+ type: 'POST',
388
+ dataType: 'json',
389
+ success: function(data_res) {
390
+ if( !data_res){
391
+ alert('error');
392
+ } else if(data_res.error) {
393
+ if(form.find('#message-form').length) {
394
+ form.find('#message-form').html("");
395
+ form.find('#message-form').css('display', 'block');
396
+ form.find('#message-form').css('margin', '0');
397
+ form.find('#message-form').css('margin-top', '6px');
398
+ form.find('#message-form').html(data_res.error);
399
+ }
400
+ } else if(data_res.url) {
401
+
402
+ jQuery.ajax({
403
+ url: ajaxurl,
404
+ data: {'action' : 'set_user_mail', 'email' : document.auth.username.value},
405
+ type: 'POST',
406
+ dataType: 'json',
407
+ success: function(res) {
408
+
409
+ }
410
+ });
411
+ form.attr('action', data_res.url);
412
+ document.auth.submit();
413
+ //location.reload();
414
+ }
415
+ },
416
+ error: function ( jqXHR, textStatus, errorThrown ) {
417
+ AjaxAlert(jqXHR, textStatus, errorThrown);
418
+ }
419
+
420
+ });
421
+ }
422
+ }
423
+ function disconnectDropbox()
424
+ {
425
+ var form = jQuery('form#dropbox_form');
426
+ form.find('#oauth_token_secret').val('');
427
+ form.find('#oauth_token').val('');
428
+ form.find('#uid').val('');
429
+ form.find('#dropbox_uid_text').text('');
430
+ form.find('.disconnect_btn').parents('.form_block_input').removeClass('connected');
431
+ }
432
+
433
+ var winParams = "left=0,top=0,height=600,width=1000,menubar=no,location=no,resizable=yes,scrollbars=yes,status=yes,toolbar=no,directories=no"
434
+ var dropboxBut, dropboxWin;
435
+ function connectDropbox(button, href, oauth_token_secret, oauth_token, uid){
436
+ if( button && href ){
437
+ dropboxBut = jQuery(button);
438
+ var form = dropboxBut.parents('form');
439
+ var url = href;
440
+
441
+ // if (jQuery.trim(jQuery('#app_key').val()) != '' || jQuery.trim(jQuery('#app_secret').val()) != '') {
442
+ url += '&app_key='+jQuery('#app_key').val();
443
+ url += '&app_secret='+jQuery('#app_secret').val();
444
+ // }
445
+
446
+ dropboxWin = window.open(url, "Dropbox", winParams);
447
+ if( dropboxWin ){
448
+ dropboxWin.focus();
449
+ }else{
450
+ alert('<?php langWPADM::get('Please, permit the pop-up windows.'); ?>');
451
+ }
452
+ }else{
453
+ var form = dropboxBut.parents('form');
454
+ if( dropboxWin ){
455
+ dropboxWin.close();
456
+ }
457
+ form.find('#oauth_token_secret').val(oauth_token_secret);
458
+ form.find('#oauth_token').val(oauth_token);
459
+ form.find('#uid').val(uid);
460
+ auth_param = false;
461
+ form.find('#dropbox_uid_text').html('<?php echo langWPADM::get('Dropbox successfully connected:', false)?> UID ' + uid);
462
+ blick_form = false;
463
+ dropboxBut.parents('.form_block_input').addClass('connected');
464
+ }
465
+ }
466
+ function getHelperDropbox()
467
+ {
468
+ jQuery('#helper-keys').arcticmodal({
469
+ beforeOpen: function(data, el) {
470
+ jQuery('#helper-keys').css('display','block');
471
+ },
472
+ afterClose: function(data, el) {
473
+ jQuery('#helper-keys').css('display','none');
474
+ }
475
+ });
476
+ }
477
+
478
+ function setReadOnly(id)
479
+ {
480
+ r = jQuery('#' + id).attr('readonly');
481
+ if (r == 'readonly') {
482
+ jQuery('#' + id).prop('readonly', false);
483
+ } else {
484
+ jQuery('#' + id).prop('readonly', true);
485
+
486
+ }
487
+ }
488
+ function InludesSetting()
489
+ {
490
+ disp = jQuery('#inludes-setting').css('display');
491
+ if (disp == 'none') {
492
+ showLoadingImg(true);
493
+ getIncludesData();
494
+ jQuery('#inludes-setting').show("slow");
495
+ } else {
496
+ jQuery('.show-includes').html("");
497
+ jQuery('#inludes-setting').hide("slow");
498
+ }
499
+ }
500
+ var level_tree = {};
501
+ function getIncludesData(type, dir_)
502
+ {
503
+ data = {'action' : 'getDirsIncludes'};
504
+ if (type != 'undefined') {
505
+ data['files'] = type
506
+ }
507
+ if ( ( typeof dir_ ) != 'undefined') {
508
+ data['path'] = dir_.path;
509
+ }
510
+ jQuery.ajax({
511
+ url: ajaxurl,
512
+ data: data,
513
+ type: 'POST',
514
+ dataType: 'json',
515
+ success: function(data_res) {
516
+ showLoadingImg(false);
517
+ if ((typeof dir_) != 'undefined') {
518
+ jQuery('#img_load_' + dir_.cache).css('display', 'none');
519
+ }
520
+ if (data.path) {
521
+ showIncludesData(data_res.dir, dir_.id);
522
+ } else {
523
+ if (data_res.dir) {
524
+ showIncludesData(data_res.dir);
525
+ }
526
+ }
527
+ level_tree[level_tree.length] = data_res.dir;
528
+ },
529
+ error: function(jqXHR, textStatus, errorThrown) {
530
+ AjaxAlert(jqXHR, textStatus, errorThrown);
531
+ }
532
+ });
533
+ }
534
+ function loadInludes(path, cache, t, lvl)
535
+ {
536
+ if (t.checked) {
537
+ showLoadingImg(true);
538
+ jQuery('#include_' + cache).html('');
539
+ jQuery('#img_load_' + cache).css({'display':'inline'});
540
+ getIncludesData('undefined', {'path' : path, 'id' : 'include_' + cache, 'cache' : cache });
541
+ jQuery('#include_' + cache).show('slow');
542
+ } else {
543
+ in_id = jQuery(t).attr('id')
544
+ if (jQuery('#include_' + in_id).length > 0) {
545
+ jQuery('#include_' + in_id).hide('slow');
546
+ }
547
+ }
548
+ }
549
+ function showIncludesData(data, id)
550
+ {
551
+ html = "";
552
+ if ( ( typeof data ) != 'undefined' ) {
553
+ if (data.length > 0) {
554
+ for(i = 0; i < data.length; i++) {
555
+ if (data[i].check) {
556
+ check = 'checked="checked"' ;
557
+ send_checked[send_checked.length] = data[i].check_folder;
558
+ } else {
559
+ check = '';
560
+ }
561
+ html += '<div id="inc_' + data[i].cache + '" data-value="' + data[i].cache + '">' +
562
+ '<input type="checkbox" ' + check + ' class="checkbox-send" value="' + data[i].folder + '" name="folder-include" id="send-to-' + data[i].cache + '" onclick="connectFolder(this)" />' +
563
+ '<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 + '\')" />' +
564
+ '<label for="' + data[i].cache + '">' + data[i].dir + ' <span style="font-size:10px;">(' + data[i].perm + ')</span>' + '</label>' +
565
+ '<div id="img_load_' + data[i].cache + '" style="display:none; margin-left:10px;position:relative;">' +
566
+ '<img style="position:absolute;bottom:0;" src="<?php echo plugins_url('/img/folder-loader.gif', dirname(__FILE__) ); ?>" alt="load" title="load" >' +
567
+ '</div>'+
568
+ '<div class="tree-includes" id="include_' + data[i].cache + '">' +
569
+ '</div>' +
570
+ '</div>';
571
+ }
572
+ if (jQuery("#" + id).length > 0) {
573
+ jQuery("#" + id).html(html);
574
+ } else {
575
+ jQuery('.show-includes').html(html);
576
+ }
577
+ }
578
+ }
579
+ }
580
+
581
+ function saveIncludes()
582
+ {
583
+ data = {'action' : 'saveDirsIncludes', 'save' : 1, 'data' : send_checked}
584
+ if (send_checked.length > 0) {
585
+ showLoadingImg(true);
586
+ jQuery.ajax({
587
+ url: ajaxurl,
588
+ data: data,
589
+ type: 'POST',
590
+ dataType: 'json',
591
+ success: function(data_res) {
592
+ showLoadingImg(false);
593
+
594
+ },
595
+ error: function (jqXHR, textStatus, errorThrown) {
596
+ AjaxAlert(jqXHR, textStatus, errorThrown);
597
+ }
598
+ });
599
+ }
600
+ }
601
+ function saveSetting()
602
+ {
603
+ is_admin = 0;
604
+ if(document.getElementById('is_admin').checked) {
605
+ is_admin = 1;
606
+ }
607
+
608
+ data = {'action' : 'saveSetting', 'is_admin' : is_admin}
609
+ jQuery.ajax({
610
+ url: ajaxurl,
611
+ data: data,
612
+ type: 'POST',
613
+ dataType: 'json',
614
+ success: function(data_res) {
615
+ },
616
+ error: function( jqXHR, textStatus, errorThrown ){
617
+ AjaxAlert(jqXHR, textStatus, errorThrown);
618
+ }
619
+ });
620
+ }
621
+ var app_key = app_secret = '';
622
+ function showApp()
623
+ {
624
+ disp = jQuery('#dropbox-app-key').css('display');
625
+ if (disp == 'none') {
626
+ jQuery('#dropbox-app-key').show('slow');
627
+ jQuery('#help-key-pass').show('slow');
628
+ jQuery('#dropbox-app-secret').show('slow');
629
+ jQuery('#app_secret').val(app_secret);
630
+ jQuery('#app_key').val(app_key);
631
+ jQuery('.stat-table-registr').css('margin-bottom', '25px');
632
+ } else {
633
+ jQuery('#dropbox-app-key').hide('slow');
634
+ jQuery('#help-key-pass').hide('slow');
635
+ jQuery('#dropbox-app-secret').hide('slow');
636
+ app_key = jQuery('#app_key').val();
637
+ app_secret = jQuery('#app_secret').val()
638
+ jQuery('#app_secret').val('');
639
+ jQuery('#app_key').val('');
640
+ jQuery('.stat-table-registr').css('margin-bottom', '0px');
641
+ }
642
+ }
643
+ function showFormAjax()
644
+ {
645
+ //form-ajax-ftp-email
646
+ disp = jQuery('#form-ajax-ftp-email').css('display');
647
+ if (disp == 'none') {
648
+ jQuery('#form-ajax-ftp-email').show('slow');
649
+ } else {
650
+ jQuery('#form-ajax-ftp-email').hide('slow');
651
+ }
652
+ }
653
+ </script>
654
+ <?php if (!empty($error)) {
655
+ echo '<div class="error" style="text-align: center; color: red; font-weight:bold;">
656
+ <p style="font-size: 16px;">
657
+ ' . $error . '
658
+ </p></div>';
659
+ }?>
660
+ <?php if (!empty($msg)) {
661
+ echo '<div class="updated" style="text-align: center; font-weight:bold;">
662
+ <p style="font-size: 16px;">
663
+ ' . $msg . '
664
+ </p></div>';
665
+ }?>
666
+ <div id="is-dropbox-auth" style="display: none; width: 380px; text-align: center; background: #fff; border: 2px solid #dde4ff; border-radius: 5px;">
667
+ <div class="title-description" style="font-size: 20px; text-align: center;padding-top:45px; line-height: 30px;">
668
+ <?php langWPADM::get('Please, add your Dropbox credentials:'); ?><br />
669
+ <strong><?php langWPADM::get('"App key"'); ?></strong> & <strong><?php langWPADM::get('"App secret"'); ?></strong> <br />
670
+ <?php langWPADM::get('in the Setting Form'); ?>
671
+ </div>
672
+ <div class="button-description" style="padding:20px 0;padding-top:45px">
673
+ <input type="button" value="<?php langWPADM::get('OK'); ?>" onclick="jQuery('#is-dropbox-auth').arcticmodal('close');" style="text-align: center; width: 100px;" class="button-wpadm">
674
+ </div>
675
+ </div>
676
+ <?php
677
+ if (isset($sent_response)) {
678
+ ?>
679
+ <script>
680
+ jQuery(document).ready(function() {
681
+ jQuery('#sent-error-report').arcticmodal({
682
+ beforeOpen: function(data, el) {
683
+ jQuery('#sent-error-report').css('display','block');
684
+ },
685
+ afterClose: function(data, el) {
686
+ jQuery('#sent-error-report').css('display','none');
687
+ }
688
+ });
689
+ })
690
+ </script>
691
+ <div id="sent-error-report" style="display: none;" >
692
+ <div class="text-view">
693
+ <?php echo $sent_response ;?>
694
+ </div>
695
+ <div class="button-sent-report">
696
+ <input type="button" class="button-wpadm" value="<?php langWPADM::get('OK'); ?>" onclick="jQuery('#sent-error-report').arcticmodal('close')" />
697
+ </div>
698
+ </div>
699
+ <?php
700
+ }
701
+ ?>
702
+ <div id="ajax-alert" style="display: none;width: 800px; text-align: center; background: #fff; border: 2px solid #dde4ff; border-radius: 5px;">
703
+ <div id="ajax-message" style="font-size: 15px; margin-top: 10px; margin-bottom: 30px;"></div>
704
+ <div style="font-size: 15px; margin-bottom: 30px;"><?php langWPADM::get('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.');?></div>
705
+
706
+ <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;">
707
+ <div style="margin-top: 10px; font-size: 16px; font-weight: bold; margin-bottom: 10px;">
708
+ <input type="checkbox" onclick="showFormAjax();" style="margin: 0;" id="show-form-ajax" /> <label for="show-form-ajax"><?php langWPADM::get('I want to provide your FTP access to resolve this issue quickly:');?></label>
709
+ </div>
710
+ <div id="form-ajax-ftp-email" style="display: none;">
711
+ <div class="form-help-send-error" >
712
+ <div style="margin-top: 3px;">
713
+ <div class="label-help" style="">
714
+ <label for="ftp-host"><?php langWPADM::get('FTP Host'); ?></label>
715
+ </div>
716
+ <div style="float:left; ">
717
+ <input type="text" id="ftp-host" value="<?php echo str_ireplace(array('http://', 'https://'), '', home_url()) ;?>" name="ftp_host" >
718
+ </div>
719
+ </div>
720
+ <div class="clear"></div>
721
+ <div style="margin-top: 3px;">
722
+ <div class="label-help" >
723
+ <label for="ftp-user"><?php langWPADM::get('FTP User'); ?></label>
724
+ </div>
725
+ <div style="float:left; ">
726
+ <input type="text" id="ftp-user" value="" name="ftp_user">
727
+ </div>
728
+ </div>
729
+ <div class="clear"></div>
730
+ <div style="margin-top: 3px;">
731
+ <div class="label-help" >
732
+ <label for="ftp-pass"><?php langWPADM::get('FTP Password'); ?></label>
733
+ </div>
734
+ <div style="float:left; ">
735
+ <input type="text" id="ftp-pass" value="" name="ftp_pass">
736
+ </div>
737
+ </div>
738
+ <div class="clear"></div>
739
+
740
+ </div>
741
+ <div class="form-help-mail-response">
742
+ <div style="padding: 20px; border:1px solid #fff; margin-top: 3px;">
743
+ <div class="label-help" >
744
+ <label for="email-resp"><?php langWPADM::get('Response Email:'); ?></label>
745
+ </div>
746
+ <div style=" ">
747
+ <input type="text" id="email-resp" value="<?php echo get_option('admin_email');?>" style="padding-left:3px;" name="mail_response">
748
+ </div>
749
+ </div>
750
+ </div>
751
+ </div>
752
+ <div class="clear"></div>
753
+ <div style="text-align: left; margin-left: 100px; margin-top: 10px;">
754
+ <input value="<?php echo $time_log; ?>" type="hidden" name="time_pars">
755
+ <input value="" type="hidden" name="msg_ajax" id="msg_ajax">
756
+ </div>
757
+ <div class="ajax-button" style="margin-bottom: 10px;">
758
+ <input type="submit" class="button-wpadm" value="<?php langWPADM::get('SEND TO SUPPORT and close this window'); ?>" />&nbsp;&nbsp;&nbsp;
759
+ <input type="button" class="button-wpadm" onclick="jQuery('#ajax-message').arcticmodal('close')" value="<?php langWPADM::get('Close this window WITHOUT SENDING TO SUPPORT'); ?>" />
760
+ </div>
761
+ </form>
762
+ </div>
763
+ <div id="helper-keys" style="display: none;width: 400px; text-align: center; background: #fff; border: 2px solid #dde4ff; border-radius: 5px;">
764
+ <div class="title-description" style="font-size: 20px; text-align: center;padding-top:20px; line-height: 30px;">
765
+ <?php langWPADM::get('Where can I find my app key and secret?'); ?>
766
+ </div>
767
+ <div class="button-description" style="padding:20px 10px;padding-top:20px; text-align: left;">
768
+ <?php langWPADM::get('You can get an API app key and secret by creating an app on the'); ?>
769
+ <a href="https://www.dropbox.com/developers/apps/create?app_type_checked=api" target="_blank"><?php langWPADM::get('app creation page'); ?></a>.
770
+ <?php langWPADM::get('Once you have an app created, the app key and secret will be available on the app\'s page on the'); ?>
771
+ <a href="https://www.dropbox.com/developers/apps" target="_blank"><?php langWPADM::get('App Console'); ?></a>
772
+ . <?php langWPADM::get('Note that Drop-ins have app keys but no app secrets.'); ?>
773
+ </div>
774
+ <div class="button-description" style="padding:20px 0;padding-top:10px">
775
+ <input type="button" value="<?php langWPADM::get('OK'); ?>" onclick="jQuery('#helper-keys').arcticmodal('close');" style="text-align: center; width: 100px;" class="button-wpadm">
776
+ </div>
777
+ </div>
778
+ <div class="block-content" style="margin-top:20px;">
779
+ <div class="inline" style="width: 60%">
780
+ <span style="font-size:16px;">
781
+ <?php langWPADM::get('Use Professional version of "Dropbox backup and restore" plugin and get:') ; ?>
782
+ </span>
783
+ <ul class="list-dropbox-backup-pro">
784
+ <li><img src="<?php echo plugins_url('/template/ok-icon.png', dirname(__FILE__));?>" title="" alt="" />
785
+ <span class="text">
786
+ <?php langWPADM::get('Automated Dropbox backup (Scheduled backup tasks)') ; ?>
787
+ </span>
788
+ </li>
789
+ <li>
790
+ <img src="<?php echo plugins_url('/template/ok-icon.png', dirname(__FILE__));?>" title="" alt="" />
791
+ <span class="text">
792
+ <?php langWPADM::get('Automated Local backup (Scheduled backup tasks)') ; ?>
793
+ </span>
794
+ </li>
795
+ <li>
796
+ <img src="<?php echo plugins_url('/template/ok-icon.png', dirname(__FILE__));?>" title="" alt="" />
797
+ <span class="text">
798
+ <?php langWPADM::get('Backup Status E-Mail Reporting') ; ?>
799
+ </span>
800
+ </li>
801
+ <li>
802
+ <img src="<?php echo plugins_url('/template/ok-icon.png', dirname(__FILE__));?>" title="" alt="" />
803
+ <span class="text">
804
+ <?php langWPADM::get('Online Service "Backup Website Manager" (Copy, Clone or Migrate of websites)') ; ?>
805
+ </span>
806
+ </li>
807
+ <li>
808
+ <img src="<?php echo plugins_url('/template/ok-icon.png', dirname(__FILE__));?>" title="" alt="" />
809
+ <span class="text">
810
+ <?php langWPADM::get('One Year Free Updates for PRO version') ; ?>
811
+ </span>
812
+ </li>
813
+ <li>
814
+ <img src="<?php echo plugins_url('/template/ok-icon.png', dirname(__FILE__));?>" title="" alt="" />
815
+ <span class="text">
816
+ <?php langWPADM::get('One Year Priority support') ; ?>
817
+ </span>
818
+ </li>
819
+ </ul>
820
+ </div>
821
+ <div class="inline-right" style="margin-top: 0;">
822
+ <div class="image-dropbox-pro" onclick="document.dropbox_pro_form.submit();">
823
+ <img src="<?php echo plugins_url('/template/dropbox_pro_logo_box1.png', dirname(__FILE__));?>" title="<?php langWPADM::get('Get PRO version');?>" alt="<?php langWPADM::get('Get PRO version'); ?>">
824
+ </div>
825
+ <div style="margin-top:26%; float: left; margin-left: 20px; margin-right: 15px;">
826
+ <form action="<?php echo WPADM_URL_PRO_VERSION; ?>api/" method="post" id="dropbox_pro_form" name="dropbox_pro_form" >
827
+ <input type="hidden" value="<?php echo home_url();?>" name="site">
828
+ <input type="hidden" value="<?php echo 'proBackupPay'?>" name="actApi">
829
+ <input type="hidden" value="<?php echo get_option('admin_email');?>" name="email">
830
+ <input type="hidden" value="<?php echo 'dropbox-backup';?>" name="plugin">
831
+ <input type="hidden" value="<?php echo admin_url("admin.php?page=wpadm_wp_full_backup_dropbox&pay=success"); ?>" name="success_url">
832
+ <input type="hidden" value="<?php echo admin_url("admin.php?page=wpadm_wp_full_backup_dropbox&pay=cancel"); ?>" name="cancel_url">
833
+ <input type="submit" class="backup_button" value="<?php langWPADM::get('Get PRO');?>">
834
+ </form>
835
+ </div>
836
+ </div>
837
+
838
+ <div class="clear"></div>
839
+ </div>
840
+ <div class="block-content" style="margin-top:2px;">
841
+ <div style="min-height : 215px; padding: 5px; padding-top: 10px;">
842
+ <div class="log-dropbox" style="background-image: url(<?php echo plugins_url('/img/dropbox.png', dirname(__FILE__));?>);">
843
+ </div>
844
+ <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;">
845
+ <?php langWPADM::get('Dropbox Full Backup');?>
846
+ <span style="font-size: 20px;"><?php langWPADM::get('(files+database)');?></span>
847
+ </div>
848
+ <?php if ($show) {?>
849
+ <div id="container-user" class="cfTabsContainer" style="width: 48%; padding-bottom: 0px; padding-top: 0px; float: left; margin-left: 20px;">
850
+ <div class="stat-wpadm-info-title" id="title-regisr" style="padding :20px 0px; margin-top:11px; line-height: 25px;">
851
+ <?php langWPADM::get('Free Sign Up'); ?> <br /><?php langWPADM::get('to backup more than one website...'); ?>
852
+ </div>
853
+ <div id="cf_activate" class="cfContentContainer" style="display: none;">
854
+ <form method="post" id="dropbox_form" action="<?php echo admin_url( 'admin-post.php?action=wpadm_activate_plugin' )?>" >
855
+ <div class="stat-wpadm-registr-info" style="margin-bottom: 40px; margin-top: 17px;">
856
+ <table class="form-table stat-table-registr" style="">
857
+ <tbody>
858
+ <tr valign="top">
859
+ <th scope="row">
860
+ <label for="email"><?php langWPADM::get('E-mail'); ?></label>
861
+ </th>
862
+ <td>
863
+ <input id="email" class="" type="text" name="email" value="">
864
+ </td>
865
+ </tr>
866
+ <tr valign="top">
867
+ <th scope="row">
868
+ <label for="password"><?php langWPADM::get('Password'); ?></label>
869
+ </th>
870
+ <td>
871
+ <input id="password" class="" type="password" name="password" value="">
872
+ </td>
873
+ </tr>
874
+ <tr valign="top">
875
+ <th scope="row">
876
+ <label for="password-confirm"><?php langWPADM::get('Password confirm'); ?></label>
877
+ </th>
878
+ <td>
879
+ <input id="password-confirm" class="" type="password" name="password-confirm" value="">
880
+ </td>
881
+ </tr>
882
+ <tr valign="top">
883
+ <th scope="row">
884
+ </th>
885
+ <td>
886
+ <input class="button-wpadm" type="submit" value="<?php langWPADM::get('Register & Activate'); ?>" name="send">
887
+ </td>
888
+ </tr>
889
+ </tbody>
890
+ </table>
891
+ </div>
892
+ <div class="stat-wpadm-info" id="registr-info" style="margin-bottom: 2px; margin-top: 30px;">
893
+ <span style="font-weight:bold; font-size: 14px;"><?php langWPADM::get('If you are NOT registered at'); ?> <a target="_blank" style="color: #fff" href="<?php echo SERVER_URL_INDEX; ?>"><?php langWPADM::get('WPAdm'); ?></a>,</span> <?php langWPADM::get('enter your email and password to use as your Account Data for authorization on WPAdm.'); ?> <br /><span style="font-weight: bold;font-size: 14px;"><?php langWPADM::get('If you already have an account at'); ?> <a target="_blank" style="color: #fff" href="<?php echo SERVER_URL_INDEX; ?>"><?php langWPADM::get('WPAdm'); ?></a></span> <?php langWPADM::get('and you want to Sign-In, so please, enter your registered credential data (email and password twice).'); ?>
894
+ </div>
895
+ </form>
896
+ </div>
897
+ <div class="clear"></div>
898
+ <div class="block-button-show" style="color: #fff;">
899
+ <div class="block-click" onclick="showRegistInfo(true);">
900
+ <span id="registr-show" style="color: #fff;"><?php langWPADM::get('Show'); ?></span>
901
+ <div id="registr-choice-icon" class="dashicons dashicons-arrow-down" style=""></div>
902
+ </div>
903
+ </div>
904
+ </div>
905
+ <?php } else { ?>
906
+ <div id="container-user" class="cfTabsContainer" style="width: 48%; padding-bottom: 0px; padding-top: 0px; float: left; margin-left: 20px;">
907
+ <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;">
908
+ <?php langWPADM::get('Sign In to backup more than one website...'); ?>
909
+ </div>
910
+ <div>
911
+ <form method="post" id="auth" name="auth" action="<?php echo SERVER_URL_INDEX . "login-process" ; ?>">
912
+ <div>
913
+ <div id="message-form" style="color: red; float: left;margin: 10px;margin-top: 14px;"></div>
914
+ </div>
915
+ <div style="padding: 5px; clear: both;">
916
+ <div class="form-field">
917
+ <input class="input-small" type="text" id="username" value="<?php echo get_option(PREFIX_BACKUP_ . "email");?>" readonly="readonly" required="required" name="username" placeholder="<?php langWPADM::get('Email'); ?>" />
918
+ </div>
919
+ <div class="form-field">
920
+ <input class="input-small" type="password" required="required" name="password" placeholder="<?php langWPADM::get('Password'); ?>" />
921
+ </div>
922
+ <div class="form-field">
923
+ <input class="button-wpadm" type="button" value="Sign In" onclick="auth_form(this);" />
924
+ <input type="hidden" value="<?php echo 'dropbox-backup'?>" name="plugin" />
925
+ </div>
926
+ </div>
927
+ <div style="clear:both; padding: 5px; font-size: 11px; color: #fff;">
928
+ <div class="form-field" style="margin-bottom: 10px;">
929
+ <input type="checkbox" onclick="setReadOnly('username')" style="margin: 0px;"> <?php langWPADM::get('set new mail'); ?>
930
+ </div>
931
+ </div>
932
+ <div style="clear:both;"></div>
933
+ </form>
934
+ </div>
935
+ </div>
936
+ <?php } ?>
937
+ <div class="cfTabsContainer" style="width: 28%; float: left; margin-left: 10px; padding-bottom: 0px; padding-top: 0px;">
938
+ <div class="stat-wpadm-info-title" id="title-setting" style="padding :20px 0px; margin-top:11px; line-height: 50px;">
939
+ <?php langWPADM::get('Settings'); ?>
940
+ </div>
941
+ <div id="setting_active" class="cfContentContainer" style="display: none;">
942
+ <form method="post" action="" >
943
+ <div class="stat-wpadm-registr-info" style="width: 100%; margin-bottom: 9px;">
944
+ <div style="margin-bottom: 12px; margin-top: 20px; font-size: 15px; text-align: center;">
945
+ <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 langWPADM::get('Connect to Dropbox'); ?>" name="submit">
946
+ <div class="desc-wpadm"><span id="dropbox_uid_text"><?php echo isset($dropbox_options['oauth_token']) && isset($dropbox_options['uid']) ? langWPADM::get('Dropbox successfully connected:', false) . " UID " . $dropbox_options['uid'] : ''; ?></span></div>
947
+ </div>
948
+ <?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 ; ?>
949
+ <div class="setting-checkbox">
950
+ <input type="checkbox" onclick="showApp();" <?php echo $show_fields ? 'checked="checked"' : ''?> id="dbconnection-to-app" /><label for="dbconnection-to-app"><?php langWPADM::get('Connect using my Dropbox App');?></label>
951
+ </div>
952
+
953
+ <table class="form-table stat-table-registr" style="margin-top:2px; <?php echo $show_fields ? 'margin-bottom:25px;' : ''?>">
954
+ <tbody>
955
+ <tr valign="top" id="dropbox-app-key" style="display: <?php echo $show_fields ? 'table-row' : 'none'?>;">
956
+ <th scope="row">
957
+ <label for="app_key"><?php langWPADM::get('App key'); ?>*</label>
958
+ </th>
959
+ <td>
960
+ <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'] : ''?>">
961
+ </td>
962
+ </tr>
963
+ <tr valign="top" id="dropbox-app-secret" style="display: <?php echo $show_fields ? 'table-row' : 'none'?>;">
964
+ <th scope="row">
965
+ <label for="app_secret"><?php langWPADM::get('App secret'); ?>*</label>
966
+ </th>
967
+ <td>
968
+ <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'] : ''?>">
969
+ </td>
970
+ </tr>
971
+
972
+ <tr valign="top" id="help-key-pass" style="display: <?php echo $show_fields ? 'table-row' : 'none'?>;">
973
+ <td colspan="2" align="center">
974
+ <a class="help-key-secret" href="javascript:getHelperDropbox();" ><?php langWPADM::get('Where to get App key & App secret?'); ?></a><br />
975
+ </td>
976
+ </tr>
977
+ </tbody>
978
+ </table>
979
+
980
+ <?php if ( is_super_admin() ) { ?>
981
+ <div class="setting-checkbox">
982
+ <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()" /><label for="is_admin" style="font-size: 13px;"><?php langWPADM::get('Appear in menu for admins only'); ?></label>
983
+ </div>
984
+ <?php } ?>
985
+ </div>
986
+ </form>
987
+ </div>
988
+ <div class="clear"></div>
989
+ <div class="block-button-show" style="color: #fff;">
990
+ <div class="block-click" onclick="showSetting(true);">
991
+ <span id="setting-show" style="color: #fff;"><?php langWPADM::get('Show'); ?></span>
992
+ <div id="setting-choice-icon" class="dashicons dashicons-arrow-down" style=""></div>
993
+ </div>
994
+ </div>
995
+ </div>
996
+ </div>
997
+ </div>
998
+ <div style="clear: both;"></div>
999
+ <div class="block-content">
1000
+ <div class="" style="margin-top:10px;">
1001
+ <div id="logs-form" style="display: none; float:left; width: 70%;">
1002
+ <div class="title-logs"><span style="font-size:16px;"><?php langWPADM::get('Please wait...'); ?> <span id="time_backup">0 <?php langWPADM::get('sec.'); ?></span><img style="float: right;" src="<?php echo plugins_url('/img/wpadmload.gif', dirname(__FILE__))?>" alt=""></span></div>
1003
+ <div class="title-status" style="font-size:16px; display: none;"></div>
1004
+ <div style="border: 1px solid #ddd; text-align: left; background: #fff; padding: 2px;">
1005
+ <div id="log-backup" style="overflow: auto; height: 60px; border: 5px solid #fff; "></div>
1006
+ </div>
1007
+ </div>
1008
+
1009
+ <div id="reviews-dropbox" class="pointer" onclick="window.open('https://wordpress.org/support/view/plugin-reviews/dropbox-backup?filter=5');">
1010
+ <div class="title-reviews"><?php langWPADM::get('++ Review ++'); ?></div>
1011
+ <div class="desc-reviews"><?php langWPADM::get('Your review is important for us'); ?></div>
1012
+ <img src="<?php echo plugins_url('/img/stars-5.png', dirname(__FILE__));?>" alt=""></a>
1013
+ </div>
1014
+ <div id="support-button" style="float: right; margin-top: 130px; margin-right: 20px;">
1015
+ <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 langWPADM::get('Help'); ?></button> <br />
1016
+ </div>
1017
+ <div id="action-buttons" style="">
1018
+ <div style="float: left;">
1019
+ <button onclick="start_dropbox_backup();" class="backup_button" style=""><?php langWPADM::get('Create Dropbox Backup'); ?></button>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
1020
+ </div>
1021
+ <div style="float: left; margin-top: 2px;">
1022
+ <button onclick="start_local_backup()" class="backup_button" style="padding: 5px 10px; margin-top: 10px; font-size: 15px;bottom: 0px;"><?php langWPADM::get('Create Local Backup'); ?></button> <br />
1023
+ </div>
1024
+ <!-- <div style="float: left; margin-top: 2px;margin-left: 20px;">
1025
+ <button onclick="InludesSetting();" class="backup_button" style="padding: 5px 10px; margin-top: 10px; font-size: 15px;bottom: 0px;"><?php langWPADM::get('Folders & files'); ?></button> <br />
1026
+ </div> -->
1027
+ <div style="clear: both;"></div>
1028
+ </div>
1029
+ </div>
1030
+ <div style="clear: both; margin-bottom: 10px;"></div>
1031
+ <div>
1032
+ <form action="<?php echo WPADM_URL_BASE;?>wpsite/recovery-backup" method="post" target="_blank" id="form_auth_backup" name="form_auth_backup">
1033
+ </form>
1034
+ <form action="<?php echo WPADM_URL_BASE;?>backup/tasks" method="post" target="_blank" id="form_auth_backup_create" name="form_auth_backup_create">
1035
+ <input type="hidden" name="url_task_create" value="<?php echo get_option('siteurl');?>">
1036
+ </form>
1037
+ <form action="" method="post" id="form_auth_backup" name="form_auth_backup">
1038
+ </form>
1039
+ <form action="<?php echo admin_url( 'admin-post.php?action=wpadm_delete_backup' )?>" method="post" id="delete_backups" name="delete_backups">
1040
+ <input type="hidden" name="backup-name" id="backup_name" value="" />
1041
+ <input type="hidden" name="backup-type" id="backup_type" value="" />
1042
+ </form>
1043
+ <!-- <div id="inludes-setting" class="" style="display: none; position: relative; text-align: center; background: #f1ebeb; border: 2px solid #dde4ff; border-radius: 5px;">
1044
+ <div>
1045
+ <div class="title-description" style="font-size: 20px; text-align: center;padding-top:20px; line-height: 30px;">
1046
+ <?php langWPADM::get('Include/Exclude of Files & Folders to backup'); ?>
1047
+ <div style="font-size: 14px;">
1048
+ <?php langWPADM::get('Database of web page will be included automatically'); ?>
1049
+ </div>
1050
+ </div>
1051
+ <div class="loading-img">
1052
+ <img style="display: none; margin: 0 auto;" src="<?php echo plugins_url('/img/wpadmload.gif', dirname(__FILE__) ); ?>">
1053
+ </div>
1054
+ <div class="button-description">
1055
+ <!-- <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>
1056
+ <div class="show-includes">
1057
+
1058
+ </div>
1059
+ </div>
1060
+ <div class="clear"></div>
1061
+ <div class="button-description" style="padding:20px 0; width: 100%;">
1062
+ <input type="button" value="<?php langWPADM::get('OK'); ?>" onclick="saveIncludes();" style="text-align: center; width: 100px;" class="button-wpadm">
1063
+ <input type="button" value="<?php langWPADM::get('Cancel'); ?>" onclick="InludesSetting();" style="text-align: center; width: 100px;" class="button-wpadm">
1064
+ </div>
1065
+ </div>
1066
+
1067
+ </div> -->
1068
+
1069
+ <table class="table" style="margin-top: 5px; display: <?php echo isset($data['md5']) && ($n = count($data['data'])) && is_array($data['data'][0]) ? 'table' : 'none'?>;">
1070
+ <thead>
1071
+ <tr>
1072
+ <th>#</th>
1073
+ <th align="left"><?php langWPADM::get('Create, Date/Time'); ?></th>
1074
+ <th><?php langWPADM::get('Name of Backup'); ?></th>
1075
+ <th><?php langWPADM::get('Archive Parts'); ?></th>
1076
+ <th><?php langWPADM::get('Status'); ?></th>
1077
+ <th><?php langWPADM::get('Type of Backup'); ?></th>
1078
+ <th><?php langWPADM::get('Size'); ?></th>
1079
+ <?php if(is_admin() || is_super_admin()) {?>
1080
+ <th><?php langWPADM::get('Action'); ?></th>
1081
+ <?php
1082
+ }
1083
+ ?>
1084
+ </tr>
1085
+ </thead>
1086
+ <tbody>
1087
+ <?php if (isset($data['md5']) && ($n = count($data['data'])) && is_array($data['data'][0])) {
1088
+ for($i = 0; $i < $n; $i++) {
1089
+ $size = $data['data'][$i]['size'] / 1024 / 1024; /// MByte
1090
+ $size = round($size, 2);
1091
+ $files = explode(",", str_replace(array('"', "[", "]"), "", $data['data'][$i]['files'] ) );
1092
+ $f = count($files);
1093
+ ?>
1094
+ <tr>
1095
+ <td class="number-backup"><?php echo ($i + 1);?></td>
1096
+ <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>
1097
+ <td onclick="shows('<?php echo md5( print_r($data['data'][$i], 1) );?>', this)" class="pointer">
1098
+ <?php echo ($data['data'][$i]['size'] != 0) ? $data['data'][$i]['name'] : "<strong style=\"color:red;\">". langWPADM::get('Not available', false) . "</strong>&nbsp;&nbsp;(<a style=\"text-decoration:underline;\">".langWPADM::get('Why?', false)."</a>)";?>
1099
+ <script type="text/javascript">
1100
+ backup_name = '<?php echo $data['data'][$i]['name']?>';
1101
+ </script>
1102
+ </td>
1103
+ <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>
1104
+ <td onclick="shows('<?php echo md5( print_r($data['data'][$i], 1) );?>', this)" class="pointer" style="padding: 0px;">
1105
+ <?php if ($data['data'][$i]['size'] != 0) { ?>
1106
+ <img src="<?php echo plugin_dir_url(__FILE__) . "ok.png" ;?>" title="Successful" alt="Successful" style="float: left; width: 20px; height: 20px;" />
1107
+ <div style="margin-top :1px;float: left;"><?php echo langWPADM::get('Successful', false);?></div>
1108
+ <?php } else {
1109
+ ?>
1110
+ <img src="<?php echo plugin_dir_url(__FILE__) . "not-ok.png" ;?>" title="Successful" alt="Successful" style="float: left; width: 20px; height: 20px;margin-left: 21px;" />
1111
+ <div style="margin-top :1px;float: left;"><?php echo langWPADM::get('Fail', false);?>&nbsp;&nbsp;(<a style="text-decoration:underline;"><?php echo langWPADM::get('Show Details', false);?></a>)</div>
1112
+ <?php
1113
+ }?>
1114
+ </td>
1115
+ <td onclick="shows('<?php echo md5( print_r($data['data'][$i], 1) );?>', this)" class="pointer"><?php echo $data['data'][$i]['type'];?> <?php langWPADM::get('backup'); ?></td>
1116
+ <td onclick="shows('<?php echo md5( print_r($data['data'][$i], 1) );?>', this)" class="pointer"><?php echo $size . langWPADM::get('Mb', false);?></td>
1117
+ <td>
1118
+ <?php if(is_admin() || is_super_admin()) {?>
1119
+ <?php if ($data['data'][$i]['size'] > 0) { ?>
1120
+ <a class="button-wpadm" href="javascript:void(0)" title="<?php langWPADM::get('Restore'); ?>" 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 langWPADM::get('Restore'); ?></a>&nbsp;
1121
+ <?php } ?>
1122
+ <a class="button-wpadm" href="javascript:void(0)" title="<?php langWPADM::get('Delete'); ?>" 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 langWPADM::get('Delete'); ?></a>&nbsp;
1123
+ <?php
1124
+ }
1125
+ ?>
1126
+ </td>
1127
+ </tr>
1128
+ <tr id="<?php echo md5( print_r($data['data'][$i], 1) );?>" style="display:none; ">
1129
+ <?php if ($data['data'][$i]['size'] != 0) {?>
1130
+ <td colspan="2">
1131
+ </td>
1132
+ <td align="center" style="padding: 0px; width: 350px;">
1133
+ <div style="overflow: auto; max-height: 150px;">
1134
+ <?php
1135
+ if ($f > 0) { ?>
1136
+ <table border="0" align="center" class="info-path"> <?php
1137
+ for($j = 0; $j < $f; $j++) {
1138
+ if (!empty($files[$j])) {
1139
+ ?>
1140
+ <tr style="border: 0;">
1141
+ <td style="border: 0;">
1142
+ <?php if ($data['data'][$i]['type'] == 'local') {?>
1143
+ <a href="<?php echo content_url(DROPBOX_BACKUP_DIR_NAME) . "/{$data['data'][$i]['name']}/{$files[$j]}"?>">
1144
+ <?php echo $files[$j]; ?>
1145
+ </a>
1146
+ <?php
1147
+ } else {
1148
+ echo $files[$j];
1149
+ }
1150
+ ?>
1151
+ </td>
1152
+ </tr>
1153
+ <?php
1154
+ }
1155
+ }
1156
+ ?>
1157
+ </table>
1158
+ <?php
1159
+ }
1160
+ ?>
1161
+ </div>
1162
+ </td>
1163
+ <td colspan="6"></td>
1164
+ <?php
1165
+ } else { ?>
1166
+ <td colspan="2">
1167
+ </td>
1168
+ <td colspan="4" style="background: #ddecf9;">
1169
+ <div style="padding-left: 10px; padding-right: 10px;">
1170
+ <div style="font-size: 12px; text-align: left;">
1171
+ <?php
1172
+ $time_log = str_replace(array(':', '-', " "), "_", $data['data'][$i]['dt']);
1173
+ if ( file_exists( $base_path . "/tmp/logs_error_" . $time_log ) ) {
1174
+ $log_ = file_get_contents( $base_path . "/tmp/logs_error_" . $time_log );
1175
+ $pos = stripos($log_, "error");
1176
+ if ($pos !== false) {
1177
+ for($p = $pos; ; $p--) {
1178
+ if ($log_{$p} == "\n") {
1179
+ $pos_new = $p + 1;
1180
+ break;
1181
+ }
1182
+ }
1183
+ $error =substr($log_, $pos_new);
1184
+ echo str_replace("\n", "<br />", $error);
1185
+ }
1186
+ } else {
1187
+ langWPADM::get('Error log wasn\'t Found');
1188
+ }?>
1189
+ </div>
1190
+
1191
+ <form action="<?php echo admin_url( 'admin-post.php?action=error_logs_check' )?>" method="post" style=" text-align: left;">
1192
+ <div style="margin-top: 10px; font-size: 16px; font-weight: bold; margin-bottom: 10px;">
1193
+ <?php langWPADM::get('Please, provide your FTP access to resolve this issue quickly:');?>
1194
+ </div>
1195
+ <div class="form-help-send-error" >
1196
+ <div style="margin-top: 3px;">
1197
+ <div class="label-help" style="">
1198
+ <label for="ftp-host"><?php langWPADM::get('FTP Host'); ?></label>
1199
+ </div>
1200
+ <div style="float:left; ">
1201
+ <input type="text" id="ftp-host" value="<?php echo str_ireplace(array('http://', 'https://'), '', home_url()) ;?>" name="ftp_host" >
1202
+ </div>
1203
+ </div>
1204
+ <div class="clear"></div>
1205
+ <div style="margin-top: 3px;">
1206
+ <div class="label-help" >
1207
+ <label for="ftp-user"><?php langWPADM::get('FTP User'); ?></label>
1208
+ </div>
1209
+ <div style="float:left; ">
1210
+ <input type="text" id="ftp-user" value="" name="ftp_user">
1211
+ </div>
1212
+ </div>
1213
+ <div class="clear"></div>
1214
+ <div style="margin-top: 3px;">
1215
+ <div class="label-help" >
1216
+ <label for="ftp-pass"><?php langWPADM::get('FTP Password'); ?></label>
1217
+ </div>
1218
+ <div style="float:left; ">
1219
+ <input type="text" id="ftp-pass" value="" name="ftp_pass">
1220
+ </div>
1221
+ </div>
1222
+ <div class="clear"></div>
1223
+
1224
+ </div>
1225
+ <div class="form-help-mail-response">
1226
+ <div style="padding: 20px; border:1px solid #fff; margin-top: 3px;">
1227
+ <div class="label-help" >
1228
+ <label for="email-resp"><?php langWPADM::get('Response Email:'); ?></label>
1229
+ </div>
1230
+ <div style=" ">
1231
+ <input type="text" id="email-resp" value="<?php echo get_option('admin_email');?>" style="padding-left:3px;" name="mail_response">
1232
+ </div>
1233
+ </div>
1234
+ </div>
1235
+ <div class="clear"></div>
1236
+ <div style="text-align: left; margin-left: 100px; margin-top: 10px;">
1237
+ <input value="<?php echo $time_log; ?>" type="hidden" name="time_pars">
1238
+ <input class="backup_button" style="font-size: 14px;font-weight: normal;padding: 3px;text-shadow: 0px;" type="submit" value="<?php langWPADM::get('Send request to support'); ?>">
1239
+ </div>
1240
+ </form>
1241
+
1242
+ </div>
1243
+ </td>
1244
+ <td colspan="3">
1245
+ </td>
1246
+ <?php
1247
+ }
1248
+ ?>
1249
+ </tr>
1250
+ <?php
1251
+ } ?>
1252
+ <?php } ?>
1253
+ </tbody>
1254
+ </table>
1255
+
1256
+ </div>
1257
+ </div>
1258
+
1259
+ </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
-