Backup & Restore Dropbox - Version 1.2.9

Version Description

Upgrade Notice

Download this release

Release Info

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

Code changes from version 1.1 to 1.2.9

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