Backup & Restore Dropbox - Version 1.2

Version Description

Upgrade Notice

Download this release

Release Info

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

Code changes from version 1.1 to 1.2

class-wpadm-core.php CHANGED
@@ -155,14 +155,14 @@ 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']) {
155
  */
156
  private function auth() {
157
  $this->pub_key = get_option('wpadm_pub_key');
158
+ if ('local_backup' == $this->request['method'] || 'send-to-dropbox' == $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('Activate site in WPAdm.com for work to plugins.Активируйте сайт на wpadm.com для работы плагинов.');
166
  return false;
167
  }
168
  } elseif ('connect' == $this->request['method']) {
commands/class-wpadm-command-send-to-dropbox.php CHANGED
@@ -8,9 +8,12 @@ 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;
8
  @session_start();
9
  require_once WPAdm_Core::getPluginDir() . '/modules/dropbox.class.php';
10
 
11
+ WPAdm_Core::log('Send to drop box files');
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("Error auth in Dropbox");
19
  return false;
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
4
+ Description: Dropbox Backup Plugin to create Dropbox Full Backup (Files + Database) of your Web Page
5
+ Version: 1.2
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
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/wpadm.server.main.class.php ADDED
@@ -0,0 +1,628 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if (!defined("SERVER_URL_INDEX")) {
4
+ define("SERVER_URL_INDEX", "http://www.wpadm.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
+ if (!class_exists("wpadm_class")) {
25
+
26
+ add_action('admin_post_wpadm_activate_plugin', array('wpadm_class', 'activatePlugin') );
27
+ add_action('admin_post_wpadm_delete_pub_key', array('wpadm_class', 'delete_pub_key') );
28
+
29
+ //add_action('admin_post_wpadm_getJs', array('wpadm_class', 'getJs') );
30
+
31
+ //add_action('admin_print_scripts', array('wpadm_class', 'includeJs' ));
32
+
33
+ class wpadm_class {
34
+
35
+ protected static $result = "";
36
+ protected static $class = "";
37
+ protected static $title = "";
38
+ public static $type = "";
39
+ public static $plugin_name = "";
40
+ protected static $plugins = array('stats-counter' => '1.1',
41
+ 'wpadm_full_backup_storage' => '1.0',
42
+ 'wpadm_full_backup_s3' => '1.0',
43
+ 'wpadm_full_backup_ftp' => '1.0',
44
+ 'dropbox-backup' => '1.0',
45
+ 'wpadm_db_backup_storage' => '1.0',
46
+ 'wpadm_db_backup_s3' => '1.0',
47
+ 'wpadm_file_backup_s3' => '1.0',
48
+ 'wpadm_file_backup_ftp' => '1.0',
49
+ 'wpadm_file_backup_dropbox' => '1.0',
50
+ 'wpadm_db_backup_ftp' => '1.0',
51
+ 'wpadm_db_backup_dropbox' => '1.0',
52
+ 'wpadm_file_backup_storage' => '1.0',
53
+ );
54
+ const MIN_PASSWORD = 6;
55
+
56
+
57
+ private static $backup = "1";
58
+
59
+ private static $status = "0";
60
+ private static $error = "";
61
+
62
+ public static function setBackup($b)
63
+ {
64
+ self::$backup = $b;
65
+ }
66
+
67
+ public static function setStatus($s)
68
+ {
69
+ self::$status = $s;
70
+ }
71
+ public static function setErrors($e)
72
+ {
73
+ self::$error = $e;
74
+ }
75
+
76
+ public static function backupSend()
77
+ {
78
+ $data['status'] = self::$backup . self::$status;
79
+ $data['error'] = self::$error;
80
+ $data['pl'] = WPAdm_Core::$plugin_name;
81
+ $data['site'] = get_option('siteurl');
82
+ $data['actApi'] = 'setBackup';
83
+ self::sendToServer($data);
84
+ }
85
+
86
+
87
+
88
+ static function delete_pub_key()
89
+ {
90
+ delete_option('wpadm_pub_key');
91
+ header("Location: " . $_SERVER['HTTP_REFERER']);
92
+ }
93
+ public static function checkInstallWpadmPlugins()
94
+ {
95
+ $return = false;
96
+ $i = 1;
97
+ foreach(self::$plugins as $plugin => $version) {
98
+ if (self::check_plugin($plugin)) {
99
+ $i ++;
100
+ }
101
+ }
102
+ if ($i > 2) {
103
+ $return = true;
104
+ }
105
+ return $return;
106
+ }
107
+
108
+ static function setResponse($data)
109
+ {
110
+ $msg = errorWPADM::getMessage($data['code']);
111
+ if(isset($data['data'])) {
112
+ if (isset($data['data']['replace'])) {
113
+ foreach($data['data']['replace'] as $key => $value) {
114
+ $msg = str_replace("<$key>", $value, $msg);
115
+ }
116
+ }
117
+ }
118
+ if ($data['status'] == 'success') {
119
+ self::setMessage($msg);
120
+ } else {
121
+ self::setError($msg);
122
+ }
123
+
124
+ return isset($data['data']) ? $data['data'] : array();
125
+
126
+ }
127
+
128
+
129
+ protected static function setError($msg = "")
130
+ {
131
+ if (!empty($msg)) {
132
+ $_SESSION['errorMsgWpadmDB'] = isset($_SESSION['errorMsgWpadmDB']) ? $_SESSION['errorMsgWpadmDB'] . '<br />' . $msg : $msg;
133
+ }
134
+ }
135
+ protected static function getError($del = false)
136
+ {
137
+ $error = "";
138
+ if (isset($_SESSION['errorMsgWpadmDB'])) {
139
+ $error = $_SESSION['errorMsgWpadmDB'];
140
+ if($del) {
141
+ unset($_SESSION['errorMsgWpadmDB']);
142
+ }
143
+ }
144
+ return $error;
145
+ }
146
+
147
+ protected static function setMessage($msg)
148
+ {
149
+ if (!empty($msg)) {
150
+ $_SESSION['msgWpadmDB'] = isset($_SESSION['msgWpadmDB']) ? $_SESSION['msgWpadmDB'] . '<br />' . $msg : $msg;
151
+ }
152
+ }
153
+ protected static function getMessage($del = false)
154
+ {
155
+ $msg = "";
156
+ if (isset($_SESSION['msgWpadmDB'])) {
157
+ $msg = $_SESSION['msgWpadmDB'];
158
+ if($del) {
159
+ unset($_SESSION['msgWpadmDB']);
160
+ }
161
+ }
162
+ return $msg;
163
+ }
164
+
165
+
166
+
167
+ public static function sendToServer($postdata = array(), $stat = false)
168
+ {
169
+ if (count($postdata) > 0) {
170
+
171
+ if ($stat) {
172
+ if ($counter_id = get_option(_PREFIX_STAT . 'counter_id')) {
173
+ $postdata['counter_id'] = $counter_id;
174
+ }
175
+ }
176
+ $postdata = http_build_query($postdata, '', '&');
177
+
178
+ $length = strlen($postdata);
179
+
180
+
181
+ if (function_exists("curl_init") && function_exists("curl_setopt") && function_exists("curl_exec") && function_exists("curl_close")) {
182
+ if ($stat) {
183
+ $url = SERVER_URL_VISIT_STAT . "/Api.php";
184
+ } else {
185
+ $url = WPADM_URL_BASE . "api/";
186
+ }
187
+ $curl = curl_init($url);
188
+ curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
189
+ curl_setopt($curl, CURLOPT_POST, true);
190
+ curl_setopt($curl, CURLOPT_POSTFIELDS, $postdata);
191
+ curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
192
+ curl_setopt($curl, CURLOPT_USERPWD, "admin24:admin24");
193
+ self::$result = curl_exec($curl);
194
+ curl_close($curl);
195
+ if ($stat) {
196
+ return unserialize(self::$result);
197
+ } else {
198
+ return json_decode(self::$result, true);
199
+ }
200
+ } elseif (function_exists("fsockopen")) {
201
+ if ($stat) {
202
+ $url = SERVER_URL_STAT;
203
+ $req = '/Api.php';
204
+ } else {
205
+ $url = substr(WPADM_URL_BASE, 7);
206
+ $req = '/api/';
207
+ }
208
+ $out = "POST " . $req . " HTTP/1.1\r\n";
209
+ $out.= "HOST: " . $url . "\r\n";
210
+ $out.= "Content-Type: application/x-www-form-urlencoded\r\n";
211
+ $out.= "Content-Length: ".$length."\r\n";
212
+ $out.= "Connection:Close\r\n\r\n";
213
+ $out.= $postdata."\r\n\r\n";
214
+ try {
215
+ $errno='';
216
+ $errstr = '';
217
+ $socket = @fsockopen($url, 80, $errno, $errstr, 30);
218
+ if($socket) {
219
+ if(!fwrite($socket, $out)) {
220
+ throw new Exception("unable to write fsockopen");
221
+ } else {
222
+ while ($in = @fgets ($socket, 1024)) {
223
+ self::$result .= $in;
224
+ }
225
+ }
226
+ self::$result = explode("\r\n\r\n", self::$result);
227
+ if ($stat) {
228
+ return unserialize(self::$result);
229
+ } else {
230
+ return json_decode(self::$result, true);
231
+ }
232
+ throw new Exception("error in data");
233
+ } else {
234
+ throw new Exception("unable to create socket");
235
+ }
236
+ fclose($socket);
237
+ } catch(exception $e) {
238
+ return false;
239
+ }
240
+ }
241
+ }
242
+ }
243
+
244
+ public static function activatePlugin()
245
+ {
246
+ if (isset($_POST['email']) && isset($_POST['password']) && isset($_POST['password-confirm'])) {
247
+ $email = trim(stripslashes(strip_tags($_POST['email'])));
248
+ $password = trim(strip_tags($_POST['password']));
249
+ $password_confirm = trim(strip_tags($_POST['password-confirm']));
250
+ $sent = true;
251
+ if (empty($email)) {
252
+ parent::setError("Error, Email is empty.");
253
+ $sent = false;
254
+ }
255
+ if (!preg_match("/^([a-z0-9_\-]+\.)*[a-z0-9_\-]+@([a-z0-9][a-z0-9\-]*[a-z0-9]\.)+[a-z]{2,4}$/i", $email)) {
256
+ parent::setError("Error, Incorrect Email");
257
+ $sent = false;
258
+ }
259
+ if (empty($password)) {
260
+ parent::setError("Error, Password is empty.");
261
+ $sent = false;
262
+ }
263
+ if (strlen($password) < self::MIN_PASSWORD) {
264
+ parent::setError("Error, the minimum number of characters for the password \"" . self::MIN_PASSWORD . "\".");
265
+ $sent = false;
266
+ }
267
+
268
+ if ($password != $password_confirm) {
269
+ parent::setError("Error, passwords do not match");
270
+ $sent = false;
271
+ }
272
+ if ($sent) {
273
+ $info = self::$plugin_name;
274
+ $data = self::sendToServer(
275
+ array(
276
+ 'actApi' => "activate",
277
+ 'email' => $email,
278
+ 'password' => $password,
279
+ 'url' => get_option("siteurl"),
280
+ 'plugin' => $info,
281
+ )
282
+ );
283
+ $res = self::setResponse($data);
284
+ }
285
+ }
286
+ if (isset($res['url']) && !empty($res['url'])) {
287
+ header("Location: " . $res['url']);
288
+ } else {
289
+ header("Location: " . admin_url("admin.php?page=wpadm_plugins"));
290
+ }
291
+ }
292
+
293
+ public static function include_admins_script()
294
+ {
295
+ wp_enqueue_style('css-admin-wpadm-db', plugins_url( "/template/css/admin-style-wpadm.css", dirname(__FILE__) ) );
296
+
297
+ wp_enqueue_script( 'js-admin-wpadm-db', plugins_url( "/template/js/admin-wpadm.js", dirname(__FILE__) ) );
298
+ wp_enqueue_script( 'postbox' );
299
+
300
+ }
301
+ protected static function read_backups($dirs_read = false)
302
+ {
303
+ $name = get_option('siteurl');
304
+
305
+ $name = str_replace("http://", '', $name);
306
+ $name = str_replace("https://", '', $name);
307
+ $name = preg_replace("|\W|", "_", $name);
308
+ $name .= '-' . self::$type . '-' . date("Y_m_d_H_i");
309
+
310
+ $dir_backup = ABSPATH . 'wpadm_backups';
311
+
312
+ $backups = array('data' => array(), 'md5' => '');
313
+ if (is_dir($dir_backup)) {
314
+ $i = 0;
315
+ $dir_open = opendir($dir_backup);
316
+ while($d = readdir($dir_open)) {
317
+ if ($d != '.' && $d != '..' && is_dir($dir_backup . "/$d") && strpos($d, self::$type) !== false) {
318
+ $backups['data'][$i]['dt'] = date("d.m.Y H:i", filectime($dir_backup . "/$d"));
319
+ $backups['data'][$i]['name'] = "$d";
320
+ if ($dirs_read === false) {
321
+ $size = 0;
322
+ $dir_b = opendir($dir_backup . "/$d");
323
+ $count_zip = 0;
324
+ $backups['data'][$i]['files'] = "[";
325
+ while($d_b = readdir($dir_b)) {
326
+ if ($d_b != '.' && $d_b != '..' && file_exists($dir_backup . "/$d/$d_b") && substr($d_b, -3) != "php") {
327
+ $backups['data'][$i]['files'] .= "$d_b,";
328
+ $size += filesize($dir_backup . "/$d/$d_b");
329
+ $count_zip = $count_zip + 1;
330
+ }
331
+ }
332
+ $backups['data'][$i]['files'] .= ']';
333
+ $backups['data'][$i]['size'] = $size;
334
+ $backups['data'][$i]['type'] = 'local';
335
+ $backups['data'][$i]['count'] = $count_zip;
336
+ }
337
+ $i += 1;
338
+ }
339
+ }
340
+ }
341
+ $backups['md5'] = md5( print_r($backups['data'] , 1) );
342
+ return $backups;
343
+ }
344
+ public static function check_plugin($name = "", $version = false)
345
+ {
346
+ if (!empty($name)) {
347
+ if ( ! function_exists( 'get_plugins' ) ) {
348
+ require_once ABSPATH . 'wp-admin/includes/plugin.php';
349
+ }
350
+ $name2 = str_replace("-", "_", $name);
351
+ $plugin = get_plugins("/$name");
352
+ if (empty($plugin)) {
353
+ $plugin = get_plugins("/$name2");
354
+ }
355
+ if (count($plugin) > 0) {
356
+ if (isset(self::$plugins[$name]) && (isset($plugin["$name.php"]) || isset($plugin["$name2.php"]))) {
357
+ if ($version) {
358
+ if (self::$plugins[$name] == $plugin["$name.php"]['Version']) {
359
+ return true;
360
+ }
361
+ if (self::$plugins[$name] == $plugin["$name2.php"]['Version']) {
362
+ return true;
363
+ }
364
+ } else {
365
+ if (is_plugin_active("$name/$name.php") || is_plugin_active("$name/$name2.php") || is_plugin_active("$name2/$name2.php")) {
366
+ return true;
367
+ }
368
+ }
369
+ }
370
+ }
371
+ return false;
372
+ }
373
+ }
374
+ }
375
+ }
376
+
377
+ if (! function_exists('wpadm_plugins')) {
378
+ function wpadm_plugins()
379
+ {
380
+ global $wp_version;
381
+
382
+ $c = get_system_data();
383
+ $phpVersion = $c['php_verion'];
384
+ $maxExecutionTime = $c['maxExecutionTime'];
385
+ $maxMemoryLimit = $c['maxMemoryLimit'];
386
+ $extensions = $c['extensions'];
387
+ $disabledFunctions = $c['disabledFunctions'];
388
+ //try set new max time
389
+
390
+ $newMaxExecutionTime = $c['newMaxExecutionTime'];
391
+ $upMaxExecutionTime = $c['upMaxExecutionTime'];
392
+ $maxExecutionTime = $c['maxExecutionTime'];
393
+
394
+ //try set new memory limit
395
+ $upMemoryLimit = $c['upMemoryLimit'];
396
+ $newMemoryLimit = $c['newMemoryLimit'];
397
+ $maxMemoryLimit = $c['maxMemoryLimit'];
398
+
399
+ //try get mysql version
400
+ $mysqlVersion = $c['mysqlVersion'];
401
+
402
+ $show = !get_option('wpadm_pub_key') || (!is_super_admin() || !is_admin()) || !get_option(_PREFIX_STAT . 'counter_id');
403
+ ?>
404
+
405
+
406
+ <?php if (!$show) {?>
407
+ <div class="cfTabsContainer">
408
+ <div id="cf_signin" class="cfContentContainer" style="display: block;">
409
+ <form method="post" action="<?php echo WPADM_URL_BASE . "user/login" ; ?>" autocomplete="off" target="_blank">
410
+ <div class="inline" style="width: 52%; margin-top: 0; color: #fff;">
411
+ WPAdm Sign-In:
412
+ <input class="input-small" type="email" required="required" name="username" placeholder="Email">
413
+ <input class="input-small" type="password" required="required" name="password" placeholder="Password">
414
+ <input class="button-wpadm" type="submit" value="Sign-In" name="submit" style="margin-top:1px;">
415
+ </div>
416
+ <div class="wpadm-info-auth" style="width: 45%;">
417
+ 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>.
418
+ </div>
419
+ </form>
420
+ </div>
421
+ </div>
422
+ <?php } else {?>
423
+ <div class="cfTabsContainer" style="display: none;">
424
+ <div id="cf_activate" class="cfContentContainer">
425
+ <form method="post" action="<?php echo admin_url( 'admin-post.php?action=wpadm_activate_plugin' )?>" >
426
+ <div class="wpadm-info-title">
427
+ Free Sign Up to use more functionality...
428
+ </div>
429
+ <div class="wpadm-registr-info">
430
+ <table class="form-table">
431
+ <tbody>
432
+ <tr valign="top">
433
+ <th scope="row">
434
+ <label for="email">E-mail</label>
435
+ </th>
436
+ <td>
437
+ <input id="email" class="regular-text" type="text" name="email" value="">
438
+ </td>
439
+ </tr>
440
+ <tr valign="top">
441
+ <th scope="row">
442
+ <label for="password">Password</label>
443
+ </th>
444
+ <td>
445
+ <input id="password" class="regular-text" type="password" name="password" value="">
446
+ </td>
447
+ </tr>
448
+ <tr valign="top">
449
+ <th scope="row">
450
+ <label for="password-confirm">Password confirm</label>
451
+ </th>
452
+ <td>
453
+ <input id="password-confirm" class="regular-text" type="password" name="password-confirm" value="">
454
+ </td>
455
+ </tr>
456
+ <tr valign="top">
457
+ <th scope="row">
458
+ </th>
459
+ <td>
460
+ <input class="button-wpadm" type="submit" value="Register & Activate" name="submit">
461
+ </td>
462
+ </tr>
463
+ </tbody>
464
+ </table>
465
+ </div>
466
+ <div class="wpadm-info">
467
+ <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).
468
+ </div>
469
+ </form>
470
+ </div>
471
+ </div>
472
+ <?php } ?>
473
+
474
+ <script>
475
+ jQuery(document).ready(function() {
476
+ jQuery('.plugins-icon').click(function() {
477
+ title = jQuery(this).parent('.plugins-title');
478
+ box = title.parent('.plugins-box');
479
+ content = box.find('.plugins-info-content');
480
+ display = content.css('display');
481
+ if (display == 'none') {
482
+ content.show('slow');
483
+ } else {
484
+ content.hide('slow');
485
+ }
486
+ })
487
+ })
488
+ function showRegistartion(show)
489
+ {
490
+ if (show) {
491
+ jQuery('.cfTabsContainer').show('slow');
492
+ } else {
493
+ jQuery('.cfTabsContainer').hide('slow');
494
+ }
495
+ }
496
+ </script>
497
+
498
+ <div class="clear" style="margin-bottom: 50px;"></div>
499
+ <table class="wp-list-table widefat fixed" >
500
+ <thead>
501
+ <tr>
502
+ <th></th>
503
+ <th>Recommended value</th>
504
+ <th>Your value</th>
505
+ <th>Status</th>
506
+ </tr>
507
+ </thead>
508
+ <tbody>
509
+ <tr>
510
+ <th scope="row">PHP Version</th>
511
+ <td><?php echo PHP_VERSION_DEFAULT ?> or greater</td>
512
+ <td><?php echo check_version($phpVersion , PHP_VERSION_DEFAULT) === false ? '<span style="color:#fb8004;font-weight:bold;">' . $phpVersion .'</span>' : $phpVersion ?></td>
513
+ <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 version for correct working of plugin</span>') ?></td>
514
+ </tr>
515
+ <tr>
516
+ <th scope="row">MySQL Version</th>
517
+ <td><?php echo MYSQL_VERSION_DEFAULT ?> or greater</td>
518
+ <td><?php echo check_version($mysqlVersion , MYSQL_VERSION_DEFAULT) === false ? '<span style="color:#fb8004;font-weight:bold;">' . $mysqlVersion .'</span>' : $mysqlVersion; ?></td>
519
+ <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 version for correct working of plugin</span>') ?></td>
520
+ </tr>
521
+ <tr>
522
+ <th scope="row">Max Execution Time</th>
523
+ <td><?php echo $newMaxExecutionTime ?></td>
524
+ <td><?php echo ($upMaxExecutionTime == 0) ? '<span style="color:#fb8004;font-weight:bold;">' . $maxExecutionTime .'</span>' : $maxExecutionTime; ?></td>
525
+ <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>
526
+ </tr>
527
+ <tr>
528
+ <th scope="row">Max Memory Limit</th>
529
+ <td><?php echo $newMemoryLimit . 'M' ?></td>
530
+ <td><?php echo ($upMemoryLimit == 0) ? '<span style="color:#fb8004;font-weight:bold;">' . $maxMemoryLimit .'</span>' : $maxMemoryLimit ?></td>
531
+ <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>
532
+ </tr>
533
+ <tr>
534
+ <th scope="row">PHP Extensions</th>
535
+ <?php $ex = $c['ex']; ?>
536
+ <td><?php echo ( $ex ) === false ? 'All present' : '<span style="color:#ffba00;font-weight:bold;">' . implode(", ", $ex) . '</span>'; ?></td>
537
+ <td><?php echo ( $ex ) === false ? 'Found' : '<span style="color:#ffba00;font-weight:bold;">Not Found</span>'; ?></td>
538
+ <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>
539
+ </tr>
540
+ <tr>
541
+ <th scope="row">Disabled Functions</th>
542
+ <td colspan="3" align="left"><?php echo ( $func = $c['func']) === false ? '<span style="color:green;font-weight:bold;">All the necessary functions are enabled</span>' : '<span style="color:#fb8004;font-weight:bold;">Please enable these functions for correct work of plugin: ' . implode(", ", $func) . '</span>'; ?></td>
543
+ </tr>
544
+ <tr>
545
+ <th scope="row">Plugin Access</th>
546
+ <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;\">You can't administrate this WPAdm Plugin(s) as it requires an 'Admin' access for this website</span>")?></td>
547
+ </tr>
548
+ </tbody>
549
+ </table>
550
+ <?php
551
+ }
552
+ }
553
+
554
+ if (! function_exists('check_function')) {
555
+ function check_function($func, $search, $type = false)
556
+ {
557
+ if (is_string($func)) {
558
+ $func = explode(", ", $func);
559
+ }
560
+ if (is_string($search)) {
561
+ $search = explode(", ", $search);
562
+ }
563
+ $res = false;
564
+ $n = count($search);
565
+ for($i = 0; $i < $n; $i++) {
566
+ if (in_array($search[$i], $func) === $type) {
567
+ $res[] = $search[$i];
568
+ }
569
+ }
570
+ return $res;
571
+ }
572
+ }
573
+
574
+ if (! function_exists('check_version')) {
575
+ function check_version($ver, $ver2)
576
+ {
577
+ return version_compare($ver, $ver2, ">");
578
+ }
579
+ }
580
+ if (!function_exists("get_system_data")) {
581
+ function get_system_data()
582
+ {
583
+
584
+ global $wp_version;
585
+
586
+ $phpVersion = phpversion();
587
+ $maxExecutionTime = ini_get('max_execution_time');
588
+ $maxMemoryLimit = ini_get('memory_limit');
589
+ $extensions = implode(', ', get_loaded_extensions());
590
+ $disabledFunctions = ini_get('disable_functions');
591
+ $mysqlVersion = '';
592
+ $mysqli = new mysqli(DB_HOST, DB_USER, DB_PASSWORD);
593
+ if (!mysqli_connect_errno()) {
594
+ $mysqlVersion = $mysqli->server_info;
595
+ }
596
+ $upMaxExecutionTime = 0;
597
+ $newMaxExecutionTime = intval($maxExecutionTime) + 60;
598
+ @set_time_limit( $newMaxExecutionTime );
599
+ if( ini_get('max_execution_time') == $newMaxExecutionTime ){
600
+ $upMaxExecutionTime = 1;
601
+ $maxExecutionTime = ini_get('max_execution_time');
602
+ }
603
+ $upMemoryLimit = 0;
604
+ $newMemoryLimit = intval($maxMemoryLimit) + 60;
605
+ ini_set('memory_limit', $newMemoryLimit.'M');
606
+ if( ini_get('memory_limit') == $newMemoryLimit ){
607
+ $upMemoryLimit = 1;
608
+ $maxMemoryLimit = ini_get('memory_limit');
609
+ }
610
+ $extensions_search = array('curl', 'json', 'mysqli', 'sockets', 'zip', 'ftp');
611
+ $disabledFunctions_search = array('set_time_limit', 'curl_init', 'fsockopen', 'ftp_connect');
612
+
613
+ $ex = check_function($extensions, $extensions_search);
614
+ $func = check_function($disabledFunctions, $disabledFunctions_search, true);
615
+
616
+ return array('wp_version' => $wp_version, 'php_verion' => phpversion(),
617
+ 'maxExecutionTime' => $maxExecutionTime, 'maxMemoryLimit' => $maxMemoryLimit,
618
+ 'extensions' => $extensions, 'disabledFunctions' => $disabledFunctions,
619
+ 'mysqlVersion' => $mysqlVersion, 'upMaxExecutionTime' => $upMaxExecutionTime,
620
+ 'newMaxExecutionTime' => $newMaxExecutionTime, 'upMemoryLimit' => $upMemoryLimit,
621
+ 'newMemoryLimit' => $newMaxExecutionTime, 'maxMemoryLimit' => $maxMemoryLimit,
622
+ 'ex' => $ex, 'func' => $func, 'wp_lang' => get_option('WPLANG'),
623
+ );
624
+
625
+ }
626
+ }
627
+
628
+ ?>
methods/class-wpadm-method-full-backup-dropbox.php CHANGED
@@ -140,7 +140,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
  }
@@ -330,11 +330,16 @@ if (!class_exists('WPadm_Method_Full_Backup_Dropbox')) {
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
 
@@ -435,7 +440,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
  }
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
  }
330
 
331
  WPAdm_Core::log('Creating a backup is completed');
332
 
333
+ wpadm_class::setBackup(2);
334
  if (!empty($errors)) {
335
  $this->result->setError(implode("\n", $errors));
336
  $this->result->setResult(WPAdm_Result::WPADM_RESULT_ERROR);
337
+ wpadm_class::setStatus(0);
338
+ wpadm_class::setErrors( implode(", ", $errors) );
339
+ } else {
340
+ wpadm_class::setStatus(1);
341
  }
342
+ wpadm_class::backupSend();
343
  return $this->result;
344
 
345
 
440
  $d1 = mb_strtolower($tmp[0]);
441
  unset($tmp[0]);
442
  $d2 = mb_strtolower(implode('/', $tmp));
443
+ if (strpos($d2, 'cache') !== false
444
+ && !in_array($tmp[0], array('plugins', 'themes'))
445
+ ) {
446
  WPAdm_Core::log('Skip dir(cache) ' . $directory);
447
  return array();
448
  }
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);
@@ -27,16 +29,33 @@ if (!class_exists('WPAdm_Method_Local_Backup')) {
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);
@@ -54,7 +73,6 @@ 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();
@@ -67,7 +85,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'])
@@ -86,13 +104,15 @@ if (!class_exists('WPAdm_Method_Local_Backup')) {
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
  }
@@ -115,7 +135,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
  }
@@ -126,7 +146,7 @@ if (!class_exists('WPAdm_Method_Local_Backup')) {
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')
@@ -184,17 +204,21 @@ if (!class_exists('WPAdm_Method_Local_Backup')) {
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();
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);
29
  $this->time = date("d.m.Y H:i"); //23.04.2015 13:45
30
  $name .= '-' . wpadm_class::$type . '-' . date("Y_m_d_H_i");
31
  $this->name = $name;
32
+
33
 
34
  // folder for backup
35
  $this->dir = ABSPATH . 'wpadm_backups/' . $this->name;
36
+ if (($f = $this->checkBackup()) !== false) {
37
+ $this->dir = ABSPATH . 'wpadm_backups/' . $f;
38
+ }
39
  WPAdm_Core::mkdir(ABSPATH . 'wpadm_backups/');
40
  WPAdm_Core::mkdir($this->dir);
41
  }
42
+ public function checkBackup()
43
+ {
44
+ $archives = glob("{$this->dir}");
45
+ if (empty($archives) && count($archives) <= 1) {
46
+ return false;
47
+ }
48
+ $n = count($archives);
49
+ $f = "{$this->name}({$n})";
50
+ return $f;
51
+ }
52
  public function getResult()
53
  {
54
+ if ($this->start === false) {
55
+ $this->result->setResult(WPAdm_Result::WPADM_RESULT_ERROR);
56
+ $this->result->setError('Backup process was started, please, wait a few minutes...');
57
+ return $this->result;
58
+ }
59
  $errors = array();
60
 
61
  $this->result->setResult(WPAdm_Result::WPADM_RESULT_SUCCESS);
73
  }
74
  $wp_mysql_params = $this->getWpMysqlParams();
75
 
 
76
  if (isset($this->params['optimize']) && ($this->params['optimize']==1)) {
77
  WPAdm_Core::log('Optimize Database Tables');
78
  $commandContext = new WPAdm_Command_Context();
85
  ->add($commandContext);
86
  unset($commandContext);
87
  }
88
+
89
  $commandContext = new WPAdm_Command_Context();
90
  $commandContext ->addParam('command','mysqldump')
91
  ->addParam('host', $wp_mysql_params['host'])
104
  $errors[] = 'MySQL Error: Database-Dump File is empty';
105
  WPAdm_Core::log('Dump of Database wasn\'t created (File of Database-Dump is empty!)');
106
  } else {
107
+ $size_dump = round( (filesize($mysql_dump_file) / 1024 / 1024) , 2);
108
+ WPAdm_Core::log('Database Dump was successfully created(' . $size_dump . 'Mb):' . $mysql_dump_file);
109
  }
110
  unset($commandContext);
111
  }
112
 
113
 
114
  if (in_array('files', $this->params['types']) ) {
115
+ #ЗАРХИВИРУЕМ ФАЙЛЫ
116
  WPAdm_Core::log('Create a list of files for Backup');
117
  $files = $this->createListFilesForArchive();
118
  }
135
  $size = 0;
136
  $files2[$i] = array();
137
  }
138
+ $f_size =(int)@filesize($f);
139
  if ($f_size == 0 || $f_size > 1000000) {
140
  WPAdm_Core::log('File '. $f .' Size ' . $f_size);
141
  }
146
  WPAdm_Core::log('List of Backup-Files was successfully created');
147
 
148
  $this->queue->clear();
149
+
150
  foreach($files2 as $files) {
151
  $commandContext = new WPAdm_Command_Context();
152
  $commandContext ->addParam('command', 'archive')
204
  }
205
  WPAdm_Core::log('Removing of old Backups was Finished');
206
  }
207
+ wpadm_class::setBackup(1);
208
  if (!empty($errors)) {
209
  $this->result->setError(implode("\n", $errors));
210
  $this->result->setResult(WPAdm_Result::WPADM_RESULT_ERROR);
211
+ wpadm_class::setStatus(0);
212
+ wpadm_class::setErrors( implode(", ", $errors) );
213
  } else {
214
+ wpadm_class::setStatus(1);
215
  WPAdm_Core::log('Backup creating is completed successfully!');
216
  }
217
+ wpadm_class::backupSend();
218
 
219
  return $this->result;
220
 
221
  }
 
222
  public function createListFilesForArchive() {
223
  $folders = array();
224
  $files = array();
methods/class-wpadm-method-queue-controller.php CHANGED
@@ -76,13 +76,14 @@ if (!class_exists('WPAdm_Method_Queue_Controller')) {
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));
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')
@@ -50,17 +50,17 @@ if (!class_exists('WPadm_Method_Send_To_Dropbox')) {
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('Start copy to Dropbox Cloud');
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')
50
  WPAdm_Core::log('Dropbox: ' . $this->queue->getError());
51
  $errors[] = 'Dropbox: '.$this->queue->getError();
52
  }
53
+ WPAdm_Core::log('End Copy 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'];
methods/class-wpadm-method-update.php CHANGED
@@ -58,6 +58,7 @@ if (!class_exists('WPAdm_Method_Update')) {
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
  }
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
  }
readme.txt CHANGED
@@ -1,6 +1,6 @@
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
@@ -12,27 +12,30 @@ 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 ==
@@ -43,4 +46,21 @@ DropBox Backup is a new plugin, so we tryed have to provide a bug-free plugin/wi
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 ===
2
+ Plugin Name: Dropbox Backup
3
+ Version: 1.2
4
  Donate link: http://www.wpadm.com/donate
5
  URI: http://www.wpadm.com/dropbox-backup
6
  Tags: DropBox, Backup, Dropbox Backup, database, file, full backup, manage, sicherung, database backup, file backup, page backup, page, web, web backup, web page, web page backup, site, site backup, back up, cloud, Cloud Files, db backup, dump, german, migrate, multisite, Russian, schedule, storage, time, upload
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 Backup 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
+ * Administrate ALL of Backups for ALL of your sites from one place – WPAdm-account (FULLY FREE);
24
 
25
 
26
+ You can create your WPAdm account for central Backup administration at http://www.wpadm.com
27
+ WPAdm account is FULLY FREE.
28
 
29
  If you need help with the plugin or you want to report a bug please refer to http://www.wpadm.com/support/
30
 
31
  == Installation ==
32
 
33
+ 1. Upload the plugin folder `Dropbox Backup` to the `/wp-content/plugins/` directory of your WordPress installation.
34
  2. Activate the plugin through the `Plugins` menu in WordPress
35
 
36
 
37
 
38
+ Dropbox Backup Plugin have a settings section on WordPress plugin page.
39
  If you need help with the plugin or you want to report a bug please refer to http://www.wpadm.com/support/
40
 
41
  == Other ==
46
  Information about privacy: AFTER the user has been registered at WPAdm service AND has confirmed their registration,
47
  our plugin will get the minimum requirements of php and mysql configuration, version and language of wordpress.
48
  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.
49
+ WE DO NOT COLLECT AND DO NOT STORE THE PERSONAL DATA OF USERS FROM THIS PLUGIN!
50
+
51
+ == Frequently Asked Questions ==
52
+
53
+ FAQ coming soon
54
+
55
+ == Changelog ==
56
+
57
+ ChangeLog
58
+
59
+ == Upgrade Notice ==
60
+
61
+ Upgrade Notice
62
+
63
+ == Screenshots ==
64
+
65
+
66
+ Screens coming soon
{css → template/css}/admin-style-wpadm.css RENAMED
@@ -1,38 +1,4 @@
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;
@@ -41,6 +7,50 @@
41
  margin-top: 20px;
42
  color:#fff;
43
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
44
 
45
  .form-counter table tr td{
46
  padding: 10px;
@@ -280,16 +290,22 @@ h3.plugins-title {
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
 
@@ -610,9 +626,8 @@ 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;
@@ -621,6 +636,9 @@ font-size:10px;
621
  margin-top: 10px;
622
  float:none;
623
  }
 
 
 
624
  .form-table th {
625
  line-height: 10px;
626
  }
1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  .form-counter {
3
  background: #0096d6;
4
  border: 1px solid #fff;
7
  margin-top: 20px;
8
  color:#fff;
9
  }
10
+ .btn-danger {
11
+ background-color: #da4f49;
12
+ background-image: linear-gradient(to bottom, #ee5f5b, #bd362f);
13
+ background-repeat: repeat-x;
14
+ border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
15
+ color: #fff;
16
+ text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
17
+ border-radius: 3px;
18
+ font-size: 11.9px;
19
+ padding: 2px 10px;
20
+ cursor: pointer;
21
+ }
22
+ .btn-orange {
23
+ background-color: #f48326;
24
+ background-image: linear-gradient(to bottom, #cc5d00, #cc5d00);
25
+ background-repeat: repeat-x;
26
+ border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
27
+ color: #fff;
28
+ text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
29
+ border-radius: 3px;
30
+ font-size: 11.9px;
31
+ padding: 2px 10px;
32
+ cursor: pointer;
33
+ }
34
+ .btn-orange:hover {
35
+ color:#fff;
36
+ background-color: #f38325 ;
37
+ background-position: 0 -30px;
38
+ text-decoration: none;
39
+ transition: background-position 0.1s linear 0s;
40
+ }
41
+ .desc-wpadm {
42
+ clear: both;
43
+ color: #fff;
44
+ font-size: 12px;
45
+ font-style: italic;
46
+ }
47
+ .btn-danger:hover {
48
+ color:#fff;
49
+ background-color: #db362f ;
50
+ background-position: 0 -30px;
51
+ text-decoration: none;
52
+ transition: background-position 0.1s linear 0s;
53
+ }
54
 
55
  .form-counter table tr td{
56
  padding: 10px;
290
  font-size:16px;
291
 
292
  }
293
+ .title-logs, .title-status {
294
+ margin-bottom: 10px;
295
+ }
296
+ #log-backup div {
297
+ font-size:12px;
298
+ }
299
  .table td {
300
  background: #fff;
301
+ font-size: 12px;
302
  padding: 5px 0;
303
  border-bottom:1px solid #b7c6ff;
304
  text-align: center;
305
  }
306
  .info-path td {
307
+ font-size: 11px;
308
+ padding:0px;
309
  }
310
  .table tr:last td {
311
 
626
  margin-bottom: 10px;
627
  padding-left: 0px;
628
  width:88%;
 
 
629
  }
630
+
631
  .stat-table-registr th, .stat-table-registr td {
632
  padding:2px;
633
  font-size:10px;
636
  margin-top: 10px;
637
  float:none;
638
  }
639
+ .form-table label {
640
+ color:#fff;
641
+ }
642
  .form-table th {
643
  line-height: 10px;
644
  }
template/js/admin-wpadm.js ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ function shows(id)
11
+ {
12
+ if(document.getElementById(id).style.display == "none") {
13
+ document.getElementById(id).style.display = "table-row";
14
+ if (shows_id == "") {
15
+ shows_id = id;
16
+ } else {
17
+ if(shows_id != id) {
18
+ document.getElementById(shows_id).style.display = "none";
19
+ }
20
+ shows_id = id;
21
+ }
22
+ } else if(document.getElementById(id).style.display == "table-row") {
23
+ document.getElementById(id).style.display = "none";
24
+ }
25
+ }
26
+ var bl = false;
27
+ function show_form_auth(file_val)
28
+ {
29
+ if (file_val == 'registr') {
30
+ showRegistInfo(false);
31
+ if (bl === false) {
32
+ blick('container-user');
33
+ bl = true;
34
+ }
35
+ } else {
36
+ html = '<input type="hidden" value="' + file_val +'" name="internal_identifier">';
37
+ jQuery('#form_auth_backup').html(html);
38
+ document.form_auth_backup.submit();
39
+ }
40
+ }
41
+ var blick_form = true;
42
+ function blick(id, border_)
43
+ {
44
+ if (border_ == 'undefined') {
45
+ border_ = 10;
46
+ }
47
+ jQuery('#' + id).css({
48
+ outline: "0px solid #cd433d",
49
+ border: "0px"
50
+ }).animate({
51
+ outlineWidth: border_ + 'px',
52
+ outlineColor: '#cd433d'
53
+ }, 500).animate({outlineWidth: '0px',outlineColor: '#cd433d' } , 500);
54
+ if (blick_form) {
55
+ setTimeout('blick("' + id + '", ' + border_ + ')', 2000);
56
+ }
57
+ }
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,705 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ <script>
5
+ var global={};
6
+ function blickForm(id, t)
7
+ {
8
+ if(t.checked == true) {
9
+ t.checked = false;
10
+ }
11
+ l = jQuery('#' + id).length;
12
+ showRegistInfo(false);
13
+ if (l > 0) {
14
+ blick(id);
15
+ }
16
+ }
17
+ function showRegistInfo(show)
18
+ {
19
+ display = jQuery('#cf_activate').css('display');
20
+ if (display == 'none') {
21
+ jQuery('#cf_activate').show('slow');
22
+ jQuery('#registr-show').html("Hide");
23
+ jQuery('#title-regisr').css("padding" , "0px 0px");
24
+ jQuery('#registr-choice-icon').removeClass("dashicons-arrow-down").addClass('dashicons-arrow-up');
25
+ } else {
26
+ if (show) {
27
+ jQuery('#cf_activate').hide('slow');
28
+ jQuery('#registr-show').html("Show");
29
+ jQuery('#title-regisr').css("padding" , "20px 0px");
30
+ jQuery('#registr-choice-icon').removeClass("dashicons-arrow-up").addClass('dashicons-arrow-down');
31
+ }
32
+ }
33
+ }
34
+ function showSetting(show)
35
+ {
36
+ display = jQuery('#setting_active').css('display');
37
+ if (display == 'none') {
38
+ jQuery('#setting_active').show(1000);
39
+ jQuery('#setting-show').html("Hide");
40
+ jQuery('#title-setting').css("padding" , "0px 0px");
41
+ jQuery('#setting-choice-icon').removeClass("dashicons-arrow-down").addClass('dashicons-arrow-up');
42
+ } else {
43
+ if (show) {
44
+ jQuery('#setting_active').hide('slow');
45
+ jQuery('#registr-show').html("Show");
46
+ jQuery('#title-setting').css("padding" , "20px 0px");
47
+ jQuery('#setting-choice-icon').removeClass("dashicons-arrow-up").addClass('dashicons-arrow-down');
48
+ }
49
+ }
50
+ }
51
+ process_flag = 0;
52
+ function start_local_backup()
53
+ {
54
+ var data_backup = {
55
+ 'action': 'wpadm_local_backup',
56
+ };
57
+ jQuery("#logs-form").show("slow");
58
+ jQuery("#log-backup").html('');
59
+ jQuery(".title-logs").css('display', 'block');
60
+ jQuery(".title-status").css('display', 'none');
61
+ jQuery.ajax({
62
+ type: "POST",
63
+ url: ajaxurl,
64
+ data: data_backup,
65
+ beforeSend: function(){
66
+ process_flag = 1
67
+ processBar();
68
+ showTime();
69
+
70
+ },
71
+ success: function(data){
72
+ process_flag = 0;
73
+ if (data.result == 'success') {
74
+ jQuery('.title-logs').css('display', 'none');
75
+ jQuery('.title-status').css({'display':'block', 'color':'green'});
76
+ jQuery('.title-status').html('Local Backup was created successfully');
77
+ } else {
78
+ jQuery('.title-logs').css('display', 'none');
79
+ jQuery('.title-status').css({'display':'block', 'color':'red'});
80
+ jQuery('.title-status').html('Local Backup wasn\'t created');
81
+ }
82
+ showData(data);
83
+ jQuery('.table').css('display', 'table');
84
+
85
+ },
86
+ error: function(){
87
+ processStop();
88
+ },
89
+ dataType: 'json'
90
+ });
91
+ }
92
+
93
+ function start_dropbox_backup()
94
+ {
95
+ auth_param = <?php echo isset($dropbox_options['app_key']) && isset($dropbox_options['app_secret']) && isset($dropbox_options['uid']) && $dropbox_options['uid'] != '' ? 'false' : 'true' ?>;
96
+ if (auth_param === false) {
97
+ process_flag = 0;
98
+ var data_backup = {
99
+ 'action': 'wpadm_dropbox_create',
100
+ };
101
+ jQuery("#logs-form").show("slow");
102
+ jQuery("#log-backup").html('');
103
+ jQuery(".title-logs").css('display', 'block');
104
+ jQuery(".title-status").css('display', 'none');
105
+ jQuery.ajax({
106
+ type: "POST",
107
+ url: ajaxurl,
108
+ data: data_backup,
109
+ beforeSend: function(){
110
+ process_flag = 1
111
+ processBar();
112
+ showTime();
113
+
114
+ },
115
+ success: function(data){
116
+ process_flag = 0;
117
+ if (data.result == 'success') {
118
+ jQuery('.title-logs').css('display', 'none');
119
+ jQuery('.title-status').css({'display':'block', 'color':'green'});
120
+ jQuery('.title-status').html('Dropbox Backup was created successfully');
121
+ } else {
122
+ jQuery('.title-logs').css('display', 'none');
123
+ jQuery('.title-status').css({'display':'block', 'color':'red'});
124
+ jQuery('.title-status').html('Dropbox Backup wasn\'t created: ' + data.error);
125
+ }
126
+ showData(data);
127
+ jQuery('.table').css('display', 'table');
128
+
129
+ },
130
+ error: function(){
131
+ processStop();
132
+ },
133
+ dataType: 'json'
134
+ });
135
+ } else {
136
+ jQuery('#is-dropbox-auth').arcticmodal({
137
+ beforeOpen: function(data, el) {
138
+ jQuery('#is-dropbox-auth').css('display','block');
139
+
140
+ },
141
+ afterClose: function(data, el) {
142
+ jQuery('#is-dropbox-auth').css('display','none');
143
+ showSetting(false);
144
+ blick('app_key', 4);
145
+ blick('app_secret', 4);
146
+ }
147
+ });
148
+ }
149
+ }
150
+ function showData(data)
151
+ {
152
+ size_backup = data.size / 1024 / 1024;
153
+ info = "";
154
+ for(i = 0; i < data.data.length; i++) {
155
+ e = data.data[i].split('/');
156
+ info += '<tr style="border: 0;">' +
157
+ '<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>' +
158
+ '</tr>' ;
159
+ }
160
+
161
+ co = jQuery('.number-backup').length + 1;
162
+ jQuery('.table > tbody:last').after(
163
+ '<tr>'+
164
+ '<td class="number-backup" onclick="shows(\'' + data.md5_data + '\')">' +
165
+ co +
166
+ '</td>' +
167
+ '<td class="pointer" onclick="shows(\'' + data.md5_data + '\')" style="text-align: left; padding-left: 7px;" >' +
168
+ data.time +
169
+ '</td>' +
170
+ '<td class="pointer" onclick="shows(\'' + data.md5_data + '\')">' +
171
+ data.name +
172
+ '</td>' +
173
+ '<td class="pointer" onclick="shows(\'' + data.md5_data + '\')">' +
174
+ data.counts +
175
+ '</td>' +
176
+ '<td class="pointer" onclick="shows(\'' + data.md5_data + '\')">' +
177
+ '<img src="<?php echo plugin_dir_url(__FILE__) . "/ok.png" ;?>" title="Successful" alt="Successful" style="float: left; width:20px; hight:20px;" />'+
178
+ '<div style="margin-top :1px;float: left;"><?php echo 'Successful';?></div>' +
179
+ '</td>' +
180
+ '<td class="pointer" onclick="shows(\'' + data.md5_data + '\')">' +
181
+ data.type + ' backup' +
182
+ '</td>' +
183
+ '<td class="pointer" onclick="shows(\'' + data.md5_data + '\')">' +
184
+ size_backup.toFixed(2) + "Mb" +
185
+ '</td>' +
186
+ '<td>' +
187
+ '<a href="javascript:void(0)" class="button-wpadm" title="Restore" onclick="show_recovery_form(\'local\', \'' + data.name + '\')"><span class="pointer dashicons dashicons-backup"></span>Restore</a> &nbsp;' +
188
+ '<a href="javascript:void(0)" class="button-wpadm" title="Delete" onclick="delete_backup(\'' + data.name + '\', \'' + data.type + '\')"><span class="pointer dashicons dashicons-trash"></span>Delete</a> &nbsp;' +
189
+ '</td>' +
190
+ '</tr>'+
191
+ '<tr id="' + data.md5_data + '" style="display: none;">'+
192
+ '<td colspan="2">' +
193
+ '</td>' +
194
+ '<td align="center" style="padding: 0px; width: 350px;">' +
195
+ '<div style="overflow: auto; max-height: 150px;">' +
196
+ '<table border="0" align="center" style="width: 100%;" class="info-path">' +
197
+ info +
198
+ '</table>' +
199
+ '</div>' +
200
+ '</td>' +
201
+ '<td colspan="6"></td>' +
202
+ '</tr>')
203
+ }
204
+ var logs = [];
205
+ function processBar()
206
+ {
207
+ var data_log = {
208
+ 'action': 'wpadm_logs',
209
+ };
210
+ jQuery.ajax({
211
+ type: "POST",
212
+ url: ajaxurl,
213
+ data: data_log,
214
+ success: function(response){
215
+ eval("var data=" + response);
216
+ for(s in data.log) {
217
+ if (jQuery.inArray(s , logs) == -1) {
218
+ l = jQuery("#log-backup").html();
219
+ l = "<div>" + data.log[s] + "</div>" + l;
220
+ jQuery("#log-backup").html(l);
221
+ }
222
+ }
223
+ if (process_flag == 1) {
224
+ setTimeout('processBar()', 3000);
225
+ }
226
+ },
227
+ error: function(){
228
+ processStop();
229
+ },
230
+ });
231
+ }
232
+
233
+ function showTime(t)
234
+ {
235
+ if (process_flag == 1) {
236
+ if ( (typeof t) == 'undefined') {
237
+ t = 1;
238
+ } else {
239
+ t = t + 1;
240
+ }
241
+ time = t + " sec.";
242
+ jQuery("#time_backup").html(time);
243
+ setTimeout(function() { showTime(t) }, 1000);
244
+ }
245
+ }
246
+ function processStop()
247
+ {
248
+ process_flag = 0;
249
+ }
250
+ function delete_backup(backup, type)
251
+ {
252
+ document.delete_backups.backup_name.value = backup;
253
+ document.delete_backups.backup_type.value = type;
254
+ document.delete_backups.submit();
255
+ }
256
+ function create_backup (type) {
257
+ if (type == 'auth') {
258
+ document.form_auth_backup_create.submit();
259
+ }
260
+ }
261
+ function show_recovery_form(type, name)
262
+ {
263
+ var act = '';
264
+ if (type == 'local') {
265
+ act = 'wpadm_local_restore';
266
+ } else {
267
+ act = 'wpadm_restore_dropbox';
268
+ }
269
+ var data_backup = {
270
+ 'action': act,
271
+ 'name': name,
272
+ };
273
+ jQuery("#log-backup").html('');
274
+ jQuery(".title-logs").css('display', 'block');
275
+ jQuery(".title-status").css('display', 'none');
276
+ jQuery("#logs-form").show("slow");
277
+ jQuery.ajax({
278
+ type: "POST",
279
+ url: ajaxurl,
280
+ data: data_backup,
281
+ beforeSend: function(){
282
+ process_flag = 1
283
+ processBar();
284
+ showTime();
285
+
286
+ },
287
+ success: function(data){
288
+ process_flag = 0;
289
+ if (data.result == 'success') {
290
+ jQuery('.title-logs').css('display', 'none');
291
+ jQuery('.title-status').css({'display':'block', 'color':'green'});
292
+ if (type == 'local') {
293
+ jQuery('.title-status').html('Local Backup(' + name + ') was restore is successfully');
294
+ } else {
295
+ jQuery('.title-status').html('Dropbox Backup(' + name + ') was restore is successfully');
296
+ }
297
+ } else {
298
+ jQuery('.title-logs').css('display', 'none');
299
+ jQuery('.title-status').css({'display':'block', 'color':'red'});
300
+ if (type == 'local') {
301
+ jQuery('.title-status').html('Local Backup(' + name + ') wasn\'t restore');
302
+ } else {
303
+ jQuery('.title-status').html('Dropbox Backup(' + name + ') was restore is successfully');
304
+ }
305
+ }
306
+ },
307
+ error: function(){
308
+ processStop();
309
+ },
310
+ dataType: 'json'
311
+ });
312
+
313
+ }
314
+ function auth_form(t)
315
+ {
316
+ var button = jQuery(t);
317
+ var form = button.closest('form');
318
+ var data = {};
319
+
320
+ var reg = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,6})+$/;
321
+ mail = document.auth.username.value;
322
+ send = false;
323
+ if (!reg.test(mail)) {
324
+ document.auth.username.style.border = "2px solid red";
325
+ } else {
326
+ document.auth.username.style.border = "1px solid #5b9dd9";
327
+ if(document.auth.password.value.length == 0) {
328
+ document.auth.password.style.border = "2px solid red";
329
+ } else {
330
+ send = true;
331
+ document.auth.password.style.border = "1px solid #5b9dd9";
332
+ }
333
+ }
334
+ if(send) {
335
+ form.find('#message-form').css('display', 'none');
336
+ data['password'] = document.auth.password.value;
337
+ data['username'] = document.auth.username.value;
338
+ backup = jQuery("#name_backup_restore").val();
339
+ jQuery.ajax({
340
+ url: form.attr('action'),
341
+ data: data,
342
+ type: 'POST',
343
+ dataType: 'json',
344
+ success: function(data) {
345
+ if( !data){
346
+ alert('error');
347
+ } else if(data.error) {
348
+ if(form.find('#message-form').length) {
349
+ form.find('#message-form').html("");
350
+ form.find('#message-form').css('display', 'block');
351
+ form.find('#message-form').html(data.error);
352
+ }
353
+ } else if(data.url) {
354
+ form.attr('action', data.url);
355
+ jQuery('#name_backups_restore_files').val(jQuery.param( global[backup] ))
356
+ jQuery.arcticmodal('close');
357
+ jQuery(form).submit();
358
+ }
359
+ }
360
+
361
+ });
362
+ }
363
+ }
364
+ function disconnectDropbox()
365
+ {
366
+ var form = jQuery('form#dropbox_form');
367
+ form.find('#oauth_token_secret').val('');
368
+ form.find('#oauth_token').val('');
369
+ form.find('#uid').val('');
370
+ form.find('#dropbox_uid_text').text('');
371
+ form.find('.disconnect_btn').parents('.form_block_input').removeClass('connected');
372
+ }
373
+
374
+ var winParams = "left=0,top=0,height=600,width=1000,menubar=no,location=no,resizable=yes,scrollbars=yes,status=yes,toolbar=no,directories=no"
375
+ //https://www.dropbox.com/1/oauth/authorize?oauth_token=mIF2gsXq2jijPL95&oauth_callback=http%3A%2F%2Fdev.wpadm.com%2Fbackup%2FdropboxConnect%3Fauth_callback%3D1
376
+ var dropboxBut, dropboxWin;
377
+ function connectDropbox(button, href, oauth_token_secret, oauth_token, uid){
378
+ if( button && href ){
379
+ dropboxBut = jQuery(button);
380
+ var form = dropboxBut.parents('form');
381
+ var url = href;
382
+
383
+ if (jQuery.trim(jQuery('#app_key').val()) != '' || jQuery.trim(jQuery('#app_secret').val()) != '') {
384
+ url += '&app_key='+jQuery('#app_key').val();
385
+ url += '&app_secret='+jQuery('#app_secret').val();
386
+ }
387
+
388
+ dropboxWin = window.open(url, "Dropbox", winParams);
389
+ if( dropboxWin ){
390
+ dropboxWin.focus();
391
+ }else{
392
+ alert('Please, permit the pop-up windows.');
393
+ }
394
+ }else{
395
+ var form = dropboxBut.parents('form');
396
+ if( dropboxWin ){
397
+ dropboxWin.close();
398
+ }
399
+ form.find('#oauth_token_secret').val(oauth_token_secret);
400
+ form.find('#oauth_token').val(oauth_token);
401
+ form.find('#uid').val(uid);
402
+ form.find('#dropbox_uid_text').html('<b>UID:</b>' + uid);
403
+ blick_form = false;
404
+ dropboxBut.parents('.form_block_input').addClass('connected');
405
+ }
406
+ }
407
+ </script>
408
+ <?php if (!empty($error)) {
409
+ echo '<div class="error" style="text-align: center; color: red; font-weight:bold;">
410
+ <p style="font-size: 16px;">
411
+ ' . $error . '
412
+ </p></div>';
413
+ }?>
414
+ <?php if (!empty($msg)) {
415
+ echo '<div class="updated" style="text-align: center; color: red; font-weight:bold;">
416
+ <p style="font-size: 16px;">
417
+ ' . $msg . '
418
+ </p></div>';
419
+ }?>
420
+ <div id="is-dropbox-auth" style="display: none; width: 380px; text-align: center; background: #fff; border: 2px solid #dde4ff; border-radius: 5px;">
421
+ <div class="title-description" style="font-size: 20px; text-align: center;padding-top:45px; line-height: 30px;">
422
+ Please, add your Dropbox credentials:<br />
423
+ <strong>"App key"</strong> & <strong>"App secret"</strong> <br />
424
+ in the Setting Form
425
+ </div>
426
+ <div class="button-description" style="padding:20px 0;padding-top:45px">
427
+ <input type="button" value="OK" onclick="jQuery('#is-dropbox-auth').arcticmodal('close');" style="text-align: center; width: 100px;" class="button-wpadm">
428
+ </div>
429
+ </div>
430
+ <div id="recovery-backup" style="width: 500px; display: none;">
431
+ <div style="background: #fff; border-radius: 10px; height: 200px; border: 2px solid #0096d6;">
432
+ <form method="post" id="auth" name="auth" action="<?php echo SERVER_URL_INDEX . "login-process/" ; ?>" target="_blank">
433
+ <div class="title-recover" style="font-size: 16px; text-align: center;margin-bottom: 10px; margin-top: 15px;">
434
+ Backup Restore: <span style="font-size: 14px;"></span>
435
+ </div>
436
+ <div style="margin: 15px;">
437
+ <div id="message-form" style="color: red; float: left;"></div>
438
+ </div>
439
+ <div style="padding: 5px; height: 70px; clear: both;">
440
+ <div style="padding-top: 0px;margin-bottom: 5px; float: left;">
441
+ <div style="margin-top: 10px;">
442
+ <input class="input-small" type="email" required="required" name="username" placeholder="Email" />
443
+ </div>
444
+ <div style="margin-top: 10px;">
445
+ <input class="input-small" type="password" required="required" name="password" placeholder="Password" />
446
+ </div>
447
+
448
+ </div>
449
+ <div style="height: 40px; float: left; padding-top: 0px;margin-top:10px; margin-left: 10px; color: #939393; width: 55%;">
450
+ Enter for Restore your backup. It is necessary for the proper functionality of your site.
451
+ </div>
452
+ </div>
453
+ <div style="margin-top: 20px; clear: both; text-align: center;">
454
+ <input type="hidden" id="name_backup_restore" value="">
455
+ <input type="hidden" id="name_backups_restore_files" name="name_backups_restore_files" value="">
456
+ <input type="hidden" id="url" name="<?php echo get_option('siteurl')?>" value="">
457
+ <input class="button-wpadm" type="button" value="Next" onclick="auth_form(this);" />&nbsp;&nbsp;&nbsp;&nbsp;
458
+ <input class="button-wpadm wpadm-red" type="button" value="Cancel" onclick="jQuery.arcticmodal('close')" />
459
+ </div>
460
+ </form>
461
+ </div>
462
+ </div>
463
+ <div style="margin-top:20px;">
464
+ <div style="background-image: url(<?php echo plugins_url('/img/dropbox.png', dirname(__FILE__));?>); height: 180px; width: 154px; float: left;">
465
+ </div>
466
+ <div style="float: bottom; font-size: 40px; font-weight: bold; text-shadow: 1px 2px 2px #666;">
467
+ Dropbox Full Backup <span style="font-size: 20px;">(files+database)</span>
468
+ </div>
469
+ <?php if ($show) {?>
470
+ <div id="container-user" class="cfTabsContainer" style="width: 48%; padding-bottom: 0px; padding-top: 0px; float: left; margin-left: 10px;">
471
+ <div class="stat-wpadm-info-title" id="title-regisr" style="padding :20px 0px; margin-top:11px; line-height: 25px;">
472
+ Free Sign Up <br />to backup more than one web page...
473
+ </div>
474
+ <div id="cf_activate" class="cfContentContainer" style="display: none;">
475
+ <form method="post" id="dropbox_form" action="<?php echo admin_url( 'admin-post.php?action=wpadm_activate_plugin' )?>" >
476
+ <div class="stat-wpadm-registr-info" style="">
477
+ <table class="form-table stat-table-registr" style="">
478
+ <tbody>
479
+ <tr valign="top">
480
+ <th scope="row">
481
+ <label for="email">E-mail</label>
482
+ </th>
483
+ <td>
484
+ <input id="email" class="" type="text" name="email" value="">
485
+ </td>
486
+ </tr>
487
+ <tr valign="top">
488
+ <th scope="row">
489
+ <label for="password">Password</label>
490
+ </th>
491
+ <td>
492
+ <input id="password" class="" type="password" name="password" value="">
493
+ </td>
494
+ </tr>
495
+ <tr valign="top">
496
+ <th scope="row">
497
+ <label for="password-confirm">Password confirm</label>
498
+ </th>
499
+ <td>
500
+ <input id="password-confirm" class="" type="password" name="password-confirm" value="">
501
+ </td>
502
+ </tr>
503
+ <tr valign="top">
504
+ <th scope="row">
505
+ </th>
506
+ <td>
507
+ <input class="button-wpadm" type="submit" value="Register & Activate" name="submit">
508
+ </td>
509
+ </tr>
510
+ </tbody>
511
+ </table>
512
+ </div>
513
+ <div class="stat-wpadm-info" id="registr-info" style="margin-bottom: 2px;">
514
+ <span style="font-weight:bold; font-size: 14px;">If you are NOT registered at <a target="_blank" style="color: #fff" href="<?php echo SERVER_URL_INDEX; ?>">WPAdm</a>,</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 <a target="_blank" style="color: #fff" href="<?php echo SERVER_URL_INDEX; ?>">WPAdm</a></span> and you want to Sign-In, so please, enter your registered credential data (email and password twice).
515
+ </div>
516
+ </form>
517
+ </div>
518
+ <div class="clear"></div>
519
+ <div class="block-button-show" style="color: #fff;">
520
+ <div class="block-click" onclick="showRegistInfo(true);">
521
+ <span id="registr-show" style="color: #fff;">Show</span>
522
+ <div id="registr-choice-icon" class="dashicons dashicons-arrow-down" style=""></div>
523
+ </div>
524
+ </div>
525
+ </div>
526
+ <?php } ?>
527
+ <div class="cfTabsContainer" style="width: 28%; float: left; margin-left: 10px; padding-bottom: 0px; padding-top: 0px;">
528
+ <div class="stat-wpadm-info-title" id="title-setting" style="padding :20px 0px; margin-top:11px; line-height: 50px;">
529
+ Settings
530
+ </div>
531
+ <div id="setting_active" class="cfContentContainer" style="display: none;">
532
+ <form method="post" action="" >
533
+ <div class="stat-wpadm-registr-info" style="width: auto; margin-bottom: 9px;">
534
+ <div style="margin-bottom: 12px; margin-top: 20px; font-size: 15px;">
535
+ Please, add your Dropbox credentials:
536
+ </div>
537
+ <table class="form-table stat-table-registr" style="margin-top:2px">
538
+ <tbody>
539
+ <tr valign="top">
540
+ <th scope="row">
541
+ <label for="email">App key*</label>
542
+ </th>
543
+ <td>
544
+ <input id="app_key" class="" type="text" name="app_key" value="<?php echo isset($dropbox_options['app_key']) ? $dropbox_options['app_key'] : ''?>">
545
+ </td>
546
+ </tr>
547
+ <tr valign="top">
548
+ <th scope="row">
549
+ <label for="password">App secret*</label>
550
+ </th>
551
+ <td>
552
+ <input id="app_secret" class="" type="text" name="app_secret" value="<?php echo isset($dropbox_options['app_secret']) ? $dropbox_options['app_secret'] : ''?>">
553
+ </td>
554
+ </tr>
555
+
556
+ <tr valign="top">
557
+ <th scope="row">
558
+ </th>
559
+ <td>
560
+ <input class="btn-orange" type="button" onclick="connectDropbox(this,'<?php echo admin_url( 'admin-post.php?action=dropboxConnect' )?>')" value="Connect" name="submit">
561
+ <span id="dropbox_uid_text"><?php echo isset($dropbox_options['oauth_token']) && isset($dropbox_options['uid']) ? "UID " . $dropbox_options['uid'] : ''; ?></span>
562
+ <div class="desc-wpadm">Click to Connect your Dropbox</div>
563
+ </td>
564
+ </tr>
565
+ </tbody>
566
+ </table>
567
+ </div>
568
+ </form>
569
+ </div>
570
+ <div class="clear"></div>
571
+ <div class="block-button-show" style="color: #fff;">
572
+ <div class="block-click" onclick="showSetting(true);">
573
+ <span id="setting-show" style="color: #fff;">Show</span>
574
+ <div id="setting-choice-icon" class="dashicons dashicons-arrow-down" style=""></div>
575
+ </div>
576
+ </div>
577
+ </div>
578
+ </div>
579
+ <div style="clear: both;"></div>
580
+ <hr style="color:#fff;border-color:#fff" />
581
+ <div id="logs-form" style="display: none; padding: 10px; background: #ffffc8; border: 1px solid #0096d6; position: relative; height: 100px; text-align: center;">
582
+ <div class="title-logs"><span style="font-size:16px;">Please wait... <span id="time_backup">0 sec.</span></span></div>
583
+ <div class="title-status" style="font-size:16px; display: none;"></div>
584
+ <div style="border: 1px solid #ddd; text-align: left; background: #fff; padding: 2px;">
585
+ <div id="log-backup" style="overflow: auto; height: 60px; border: 5px solid #fff; "></div>
586
+ </div>
587
+ </div>
588
+ <div>
589
+ <form action="<?php echo WPADM_URL_BASE;?>wpsite/recovery-backup" method="post" target="_blank" id="form_auth_backup" name="form_auth_backup">
590
+ </form>
591
+ <form action="<?php echo WPADM_URL_BASE;?>backup/tasks" method="post" target="_blank" id="form_auth_backup_create" name="form_auth_backup_create">
592
+ <input type="hidden" name="url_task_create" value="<?php echo get_option('siteurl');?>">
593
+ </form>
594
+ <form action="" method="post" id="form_auth_backup" name="form_auth_backup">
595
+ </form>
596
+ <form action="<?php echo admin_url( 'admin-post.php?action=wpadm_delete_backup' )?>" method="post" id="delete_backups" name="delete_backups">
597
+ <input type="hidden" name="backup-name" id="backup_name" value="" />
598
+ <input type="hidden" name="backup-type" id="backup_type" value="" />
599
+ </form>
600
+ <div style="margin-top: 30px;">
601
+ <a href="javascript:void(0);" class="button-wpadm" onclick="start_dropbox_backup()" style="color: #fff;">Create Dropbox Backup</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
602
+ <a href="javascript:start_local_backup();" class="button-wpadm" style="color: #fff;">Create Local Backup</a> <br />
603
+ </div>
604
+ <style>
605
+ .pointer {
606
+ cursor: pointer;
607
+ }
608
+ </style>
609
+ <table class="table" style="margin-top: 5px; display: <?php echo isset($data['md5']) && ($n = count($data['data'])) && is_array($data['data'][0]) ? 'table' : 'none'?>;">
610
+ <thead>
611
+ <tr>
612
+ <th>#</th>
613
+ <th align="left">Create, Date/Time</th>
614
+ <th>Name of Backup</th>
615
+ <th>Arhive Parts</th>
616
+ <th>Status</th>
617
+ <th>Type of Backup</th>
618
+ <th>Size</th>
619
+ <?php if(is_admin() || is_super_admin()) {?>
620
+ <th>Action</th>
621
+ <?php
622
+ }
623
+ ?>
624
+ </tr>
625
+ </thead>
626
+ <tbody>
627
+ <?php if (isset($data['md5']) && ($n = count($data['data'])) && is_array($data['data'][0])) {
628
+ for($i = 0; $i < $n; $i++) {
629
+ $size = $data['data'][$i]['size'] / 1024 / 1024; /// MByte
630
+ $size = round($size, 2);
631
+ $files = explode(",", str_replace(array('"', "[", "]"), "", $data['data'][$i]['files'] ) );
632
+ $f = count($files);
633
+ ?>
634
+ <tr>
635
+ <td class="number-backup"><?php echo ($i + 1);?></td>
636
+ <td onclick="shows('<?php echo md5( print_r($data['data'][$i], 1) );?>')" class="pointer" style="text-align: left; padding-left: 7px;"><?php echo $data['data'][$i]['dt'];?></td>
637
+ <td onclick="shows('<?php echo md5( print_r($data['data'][$i], 1) );?>')" class="pointer">
638
+ <?php echo $data['data'][$i]['name'];?>
639
+ <script type="text/javascript">
640
+ backup_name = '<?php echo $data['data'][$i]['name']?>';
641
+ global[backup_name] = {};
642
+ </script>
643
+ </td>
644
+ <td onclick="shows('<?php echo md5( print_r($data['data'][$i], 1) );?>')" class="pointer"><?php echo isset($data['data'][$i]['count']) ? $data['data'][$i]['count'] : $f ;?></td>
645
+ <td onclick="shows('<?php echo md5( print_r($data['data'][$i], 1) );?>')" class="pointer" style="padding: 0px;">
646
+ <img src="<?php echo plugin_dir_url(__FILE__) . "ok.png" ;?>" title="Successful" alt="Successful" style="float: left; width: 20px; height: 20px;" />
647
+ <div style="margin-top :1px;float: left;"><?php echo 'Successful';?></div>
648
+ </td>
649
+ <td onclick="shows('<?php echo md5( print_r($data['data'][$i], 1) );?>')" class="pointer"><?php echo $data['data'][$i]['type'];?> backup</td>
650
+ <td onclick="shows('<?php echo md5( print_r($data['data'][$i], 1) );?>')" class="pointer"><?php echo $size . "Mb";?></td>
651
+ <td>
652
+ <?php if(is_admin() || is_super_admin()) {?>
653
+ <a class="button-wpadm" href="javascript:void(0)" title="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>Restore</a>&nbsp;
654
+ <a class="button-wpadm" href="javascript:void(0)" title="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>Delete</a>&nbsp;
655
+ <?php
656
+ }
657
+ ?>
658
+ </td>
659
+ </tr>
660
+ <tr id="<?php echo md5( print_r($data['data'][$i], 1) );?>" style="display:none; ">
661
+ <td colspan="2">
662
+ </td>
663
+ <td align="center" style="padding: 0px; width: 350px;">
664
+ <div style="overflow: auto; max-height: 150px;">
665
+ <?php
666
+ if ($f > 0) { ?>
667
+ <table border="0" align="center" class="info-path"> <?php
668
+ for($j = 0; $j < $f; $j++) {
669
+ if (!empty($files[$j])) {
670
+ ?>
671
+ <tr style="border: 0;">
672
+ <td style="border: 0;">
673
+ <?php if ($data['data'][$i]['type'] == 'local') {?>
674
+ <a href="<?php echo get_option('siteurl') . "/wpadm_backups/{$data['data'][$i]['name']}/{$files[$j]}"?>">
675
+ <?php echo $files[$j]; ?>
676
+ </a>
677
+ <?php
678
+ } else {
679
+ echo $files[$j];
680
+ }
681
+ ?>
682
+ </td>
683
+ </tr>
684
+ <?php
685
+ }
686
+ }
687
+ ?>
688
+ </table>
689
+ <?php
690
+ }
691
+ ?>
692
+ </div>
693
+ </td>
694
+ <td colspan="6"></td>
695
+ </tr>
696
+ <?php
697
+ } ?>
698
+
699
+ <?php } ?>
700
+ </tbody>
701
+ </table>
702
+
703
+ </div>
704
+
705
+ </div>
wpadm-class-wp.php ADDED
@@ -0,0 +1,427 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if (! defined("WPADM_URL_BASE")) {
3
+ define("WPADM_URL_BASE", 'http://secure.wpadm.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
+
20
+ add_action('admin_post_wpadm_delete_backup', array('wpadm_wp_full_backup_dropbox', 'delete_backup') );
21
+ add_action('admin_post_dropboxConnect', array('wpadm_wp_full_backup_dropbox', 'dropboxConnect') );
22
+
23
+ add_action('admin_post_wpadm_download', array('wpadm_wp_full_backup_dropbox', 'download') );
24
+
25
+ @set_time_limit(0);
26
+
27
+ class wpadm_wp_full_backup_dropbox extends wpadm_class {
28
+
29
+ const MIN_PASSWORD = 6;
30
+
31
+ public static function local_backup()
32
+ {
33
+ require_once dirname(__FILE__) . "/class-wpadm-core.php";
34
+ @session_write_close();
35
+ parent::$type = 'full';
36
+ if (file_exists(WPAdm_Core::getTmpDir() . "/logs2")) {
37
+ unlink(WPAdm_Core::getTmpDir() . "/logs2");
38
+ }
39
+ $backup = new WPAdm_Core(array('method' => "local_backup", 'params' => array('optimize' => 1, 'limit' => 0, 'types' => array('db', 'files') )), 'full_backup_dropbox', dirname(__FILE__));
40
+ $res = $backup->getResult()->toArray();
41
+ $res['md5_data'] = md5( print_r($res, 1) );
42
+ $res['name'] = $backup->name;
43
+ $res['time'] = $backup->time;
44
+ $res['type'] = 'local';
45
+ $res['counts'] = count($res['data']);
46
+
47
+ @session_start();
48
+ echo json_encode($res);
49
+ wp_die();
50
+
51
+ }
52
+ public static function getLog()
53
+ {
54
+ @session_write_close();
55
+ @session_start();
56
+ require_once dirname(__FILE__) . "/class-wpadm-core.php";
57
+ $backup = new WPAdm_Core(array('method' => "local"), 'full_backup_dropbox', dirname(__FILE__));
58
+ $log = WPAdm_Core::getLog();
59
+ $log2 = WPAdm_Core::getTmpDir() . "/logs2";
60
+ if (file_exists($log2)) {
61
+ $text = file_get_contents($log2);
62
+ $log = str_replace($text, "", $log);
63
+ file_put_contents($log2, $log);
64
+ } else {
65
+ file_put_contents($log2, $log);
66
+ }
67
+ $log = explode("\n", $log);
68
+ krsort($log);
69
+ echo json_encode(array('log' => $log));
70
+
71
+ exit;
72
+ }
73
+ public static function restore_backup()
74
+ {
75
+ require_once dirname(__FILE__) . "/class-wpadm-core.php";
76
+ @session_write_close();
77
+ parent::$type = 'full';
78
+ if (file_exists(WPAdm_Core::getTmpDir() . "/logs2")) {
79
+ unlink(WPAdm_Core::getTmpDir() . "/logs2");
80
+ }
81
+ $name_backup = isset($_POST['name']) ? trim($_POST['name']) : "";
82
+ $backup = new WPAdm_Core(array('method' => "local_restore", 'params' => array('types' => array('files', 'db'), 'name_backup' => $name_backup )), 'full_backup_dropbox', dirname(__FILE__));
83
+ $res = $backup->getResult()->toArray();
84
+ @session_start();
85
+ echo json_encode($res);
86
+ wp_die();
87
+ }
88
+ public static function wpadm_restore_dropbox()
89
+ {
90
+ require_once dirname(__FILE__) . "/class-wpadm-core.php";
91
+ @session_write_close();
92
+ $log = new WPAdm_Core(array('method' => "local"), 'full_backup_dropbox', dirname(__FILE__));
93
+ if (file_exists(WPAdm_Core::getTmpDir() . "/logs2")) {
94
+ unlink(WPAdm_Core::getTmpDir() . "/logs2");
95
+ }
96
+ if (file_exists(WPAdm_Core::getTmpDir() . "/log.log")) {
97
+ unlink(WPAdm_Core::getTmpDir() . "/log.log");
98
+ }
99
+ WPAdm_Core::log("Start Restore from Dropbox cloud");
100
+ $dropbox_options = get_option(PREFIX_BACKUP_ . 'dropbox-setting');
101
+ if ($dropbox_options) {
102
+ require_once dirname(__FILE__) . "/modules/dropbox.class.php";
103
+ $dropbox_options = unserialize( base64_decode( $dropbox_options ) );
104
+ $folder_project = self::getNameProject();
105
+ $dropbox = new dropbox($dropbox_options['app_key'], $dropbox_options['app_secret'], $dropbox_options['auth_token_secret']);
106
+ if ($dropbox->isAuth()) {
107
+ $name_backup = isset($_POST['name']) ? trim($_POST['name']) : "";
108
+ $dir_backup = ABSPATH . "wpadm_backups/$name_backup";
109
+ WPAdm_Core::mkdir($dir_backup);
110
+ $files = $dropbox->listing("$folder_project/$name_backup");
111
+ if (isset($files['items'])) {
112
+ $n = count($files['items']);
113
+ for($i = 0; $i < $n; $i++) {
114
+ $res = $dropbox->downloadFile("$folder_project/$name_backup/{$files['items'][$i]['name']}", "$dir_backup/{$files['items'][$i]['name']}");
115
+ if ($res != "$dir_backup/{$files['items'][$i]['name']}" && isset($res['text'])) {
116
+ WPAdm_Core::log("Error: " . $res['text'] );
117
+ } else {
118
+ WPAdm_Core::log("Download file({$files['items'][$i]['name']}) with Dropbox");
119
+ }
120
+ }
121
+ parent::$type = 'full';
122
+ $backup = new WPAdm_Core(array('method' => "local_restore", 'params' => array('types' => array('files', 'db'), 'name_backup' => $name_backup )), 'full_backup_dropbox', dirname(__FILE__));
123
+ $res = $backup->getResult()->toArray();
124
+ WPAdm_Core::rmdir($dir_backup);
125
+ }
126
+ } else {
127
+ WPAdm_Core::log("Error: Auth to Dropbox is empty, please repeat connection");
128
+ }
129
+ } else {
130
+ WPAdm_Core::log("Error: Auth to Dropbox is not connections");
131
+ }
132
+ @session_start();
133
+ echo json_encode($res);
134
+ wp_die();
135
+ }
136
+ public static function download()
137
+ {
138
+ if (isset($_REQUEST['backup'])) {
139
+ require_once dirname(__FILE__) . "/class-wpadm-core.php";
140
+ require_once dirname(__FILE__) . '/modules/pclzip.lib.php';
141
+ $backup = new WPAdm_Core(array('method' => "local"), 'full_backup_dropbox', dirname(__FILE__));
142
+ $filename = $_REQUEST['backup'] . ".zip";
143
+ $file = WPAdm_Core::getTmpDir() . "/" . $filename;
144
+ if (file_exists($file)) {
145
+ unlink($file);
146
+ }
147
+ $archive = new PclZip($file);
148
+ $dir_backup = ABSPATH . 'wpadm_backups/' . $_REQUEST['backup'];
149
+
150
+ $backups = array('data' => array(), 'md5' => '');
151
+ if (is_dir($dir_backup)) {
152
+ $i = 0;
153
+ $dir_open = opendir($dir_backup);
154
+ while($d = readdir($dir_open)) {
155
+ if ($d != '.' && $d != '..' && file_exists($dir_backup . "/$d") && substr($d, -3) != "php") {
156
+ $archive->add($dir_backup . "/$d", PCLZIP_OPT_REMOVE_PATH, ABSPATH . 'wpadm_backups');
157
+ }
158
+ }
159
+ }
160
+
161
+
162
+ $now = gmdate("D, d M Y H:i:s");
163
+ header("Expires: Tue, 03 Jul 2001 06:00:00 GMT");
164
+ header("Cache-Control: max-age=0, no-cache, must-revalidate, proxy-revalidate");
165
+ header("Last-Modified: {$now} GMT");
166
+
167
+ // force download
168
+ header("Content-Type: application/force-download");
169
+ header("Content-Type: application/octet-stream");
170
+ header("Content-Type: application/download");
171
+
172
+ // disposition / encoding on response body
173
+ header("Content-Disposition: attachment;filename={$filename}");
174
+ header("Content-Transfer-Encoding: binary");
175
+
176
+ ob_start();
177
+ $df = fopen("php://output", 'w');
178
+ echo file_get_contents($file);
179
+ fclose($df);
180
+ echo ob_get_clean();
181
+ unlink($file);
182
+ exit;
183
+ }
184
+ }
185
+
186
+ public static function delete_backup()
187
+ {
188
+ if (isset($_POST['backup-type']) ) {
189
+ if ($_POST['backup-type'] == 'local') {
190
+ require_once dirname(__FILE__) . "/class-wpadm-core.php";
191
+ $dir = ABSPATH . 'wpadm_backups/' . $_POST['backup-name'] ;
192
+ if (is_dir($dir)) {
193
+ WPAdm_Core::rmdir($dir);
194
+ }
195
+ } elseif ($_POST['backup-type'] == 'dropbox') {
196
+ require_once dirname(__FILE__) . "/modules/dropbox.class.php";
197
+ $dropbox_options = get_option(PREFIX_BACKUP_ . 'dropbox-setting');
198
+ if ($dropbox_options) {
199
+ $dropbox_options = unserialize( base64_decode( $dropbox_options ) );
200
+ $dropbox = new dropbox($dropbox_options['app_key'], $dropbox_options['app_secret'], $dropbox_options['auth_token_secret']);
201
+ $folder_project = self::getNameProject();
202
+ $res = $dropbox->deleteFile("$folder_project/{$_POST['backup-name']}");
203
+ if ($res['is_deleted'] == true) {
204
+
205
+ }
206
+ }
207
+ }
208
+ }
209
+ header("Location: " . admin_url("admin.php?page=wpadm_wp_full_backup_dropbox"));
210
+ }
211
+
212
+ protected static function getPluginName()
213
+ {
214
+
215
+ preg_match("|wpadm_wp_(.*)|", __CLASS__, $m);
216
+ return $m[1];
217
+ }
218
+ protected static function getPathPlugin()
219
+ {
220
+ return "wpadm_full_backup_dropbox";
221
+ }
222
+
223
+ public static function dropboxConnect()
224
+ {
225
+ require_once dirname(__FILE__) . "/modules/dropbox.class.php";
226
+ if (isset($_GET['app_key']) && isset($_GET['app_secret'])) {
227
+
228
+ $dropbox = new dropbox($_GET['app_key'], $_GET['app_secret']);
229
+ $_SESSION['dropbox_key'] = $_GET['app_key'];
230
+ $_SESSION['dropbox_secret'] = $_GET['app_secret'];
231
+ $_SESSION['dropbox_request_token'] = $dropbox->getRequestToken();
232
+ echo '<script>window.location.href="' . $dropbox->generateAuthUrl( admin_url('admin-post.php?action=dropboxConnect') ) . '";</script>';
233
+ } elseif (isset($_GET['oauth_token']) && isset($_GET['uid'])) {
234
+ $dropbox_options = get_option(PREFIX_BACKUP_ . 'dropbox-setting');
235
+ if ($dropbox_options) {
236
+ $dropbox_options = unserialize( base64_decode( $dropbox_options ) );
237
+ } else {
238
+ $dropbox_options = array();
239
+ add_option(PREFIX_BACKUP_ . 'dropbox-setting', base64_encode(serialize( $dropbox_options ) ) );
240
+ }
241
+ $dropbox = new dropbox(@$_SESSION['dropbox_key'], @$_SESSION['dropbox_secret']);
242
+ $access_token = $dropbox->getAccessToken($_SESSION['dropbox_request_token']);
243
+ $dropbox_options['app_key'] = @$_SESSION['dropbox_key'] ;
244
+ $dropbox_options['app_secret'] = @$_SESSION['dropbox_secret'] ;
245
+ $dropbox_options['auth_token_secret'] = $access_token;
246
+ $dropbox_options['oauth_token'] = @$_GET['oauth_token'] ;
247
+ $dropbox_options['uid'] = @$_GET['uid'] ;
248
+ update_option(PREFIX_BACKUP_ . 'dropbox-setting', base64_encode( serialize( $dropbox_options ) ) );
249
+ echo '<script>
250
+ if(window.opener){
251
+ window.opener.connectDropbox(null, null, "'.htmlspecialchars($access_token['oauth_token_secret']).'", "'.htmlspecialchars($access_token['oauth_token']).'", "'.htmlspecialchars($access_token['uid']).'");window.close();
252
+ }else{
253
+ window.location.href="/wpsite";
254
+ }
255
+ </script>';
256
+ echo '<script>window.close();</script>';exit;
257
+ } elseif (isset($_GET['not_approved'])) {
258
+ if( $_GET['not_approved'] == 'true' ){
259
+ echo '<script>window.close();</script>';exit;
260
+ }
261
+ } else {
262
+ echo 'Error App Key Or App Secret is empty';
263
+ }
264
+ exit;
265
+ }
266
+
267
+ public static function dropbox_backup_create()
268
+ {
269
+ require_once dirname(__FILE__) . "/class-wpadm-core.php";
270
+ @session_write_close();
271
+ $log = new WPAdm_Core(array('method' => "local"), 'full_backup_dropbox', dirname(__FILE__));
272
+ if (file_exists(WPAdm_Core::getTmpDir() . "/logs2")) {
273
+ unlink(WPAdm_Core::getTmpDir() . "/logs2");
274
+ }
275
+ $dropbox_options = get_option(PREFIX_BACKUP_ . 'dropbox-setting');
276
+ $send_to_dropbox = true;
277
+ if ($dropbox_options) {
278
+ $dropbox_options = unserialize( base64_decode( $dropbox_options ) );
279
+ if (!isset($dropbox_options['app_key'])) {
280
+ WPAdm_Core::log("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.");
281
+ $send_to_dropbox = false;
282
+ }
283
+ if (!isset($dropbox_options['app_secret'])) {
284
+ WPAdm_Core::log("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.");
285
+ $send_to_dropbox = false;
286
+ }
287
+ if (!isset($dropbox_options['oauth_token'])) {
288
+ WPAdm_Core::log("Error: \"Token\" is not exist. Files cannot be sent to Dropbox cloud. Please, test your connection within Settings form.");
289
+ $send_to_dropbox = false;
290
+ }
291
+ } else {
292
+ WPAdm_Core::log("Error: \"App Key\" && \"App Secret\" is not exist. ");
293
+ $res['type'] = 'local';
294
+ $send_to_dropbox = false;
295
+ }
296
+
297
+ if ($send_to_dropbox) {
298
+ parent::$type = 'full';
299
+
300
+ $backup = new WPAdm_Core(array('method' => "local_backup", 'params' => array('optimize' => 1, 'limit' => 0, 'types' => array('db', 'files') )), 'full_backup_dropbox', dirname(__FILE__));
301
+ $res = $backup->getResult()->toArray();
302
+ $res['md5_data'] = md5( print_r($res, 1) );
303
+ $res['name'] = $backup->name;
304
+ $res['time'] = $backup->time;
305
+ $res['type'] = 'dropbox';
306
+ $res['counts'] = count($res['data']);
307
+ unset($backup);
308
+ $folder_project = self::getNameProject();
309
+ $backup = new WPAdm_Core(array('method' => "send-to-dropbox",
310
+ 'params' => array('files' => $res['data'],
311
+ 'access_details' => array('key' => $dropbox_options['app_key'],
312
+ 'secret' => $dropbox_options['app_secret'],
313
+ 'token' => $dropbox_options['auth_token_secret'],
314
+ 'dir' => $res['name'],
315
+ 'folder' => $folder_project),
316
+ )
317
+ ),
318
+
319
+ 'full_backup_dropbox', dirname(__FILE__)) ;
320
+ WPAdm_Core::rmdir( ABSPATH . "wpadm_backups/{$res['name']}");
321
+ }
322
+ @session_start();
323
+ echo json_encode($res);
324
+ wp_die();
325
+ }
326
+ public static function getNameProject()
327
+ {
328
+ $folder_project = str_ireplace( array("http://", "https://"), '', home_url() );
329
+ $folder_project = str_ireplace( array( "-", '/', '.'), '_', $folder_project );
330
+ return $folder_project;
331
+ }
332
+
333
+
334
+ public static function wpadm_show_backup()
335
+ {
336
+
337
+ require_once dirname(__FILE__) . "/modules/dropbox.class.php";
338
+ $dropbox_options = get_option(PREFIX_BACKUP_ . 'dropbox-setting');
339
+ if ($dropbox_options) {
340
+ $dropbox_options = unserialize( base64_decode( $dropbox_options ) );
341
+ if (isset($dropbox_options['app_key']) && isset($dropbox_options['app_secret']) && isset($dropbox_options['auth_token_secret'])) {
342
+ $dropbox = new dropbox($dropbox_options['app_key'], $dropbox_options['app_secret'], $dropbox_options['auth_token_secret']);
343
+ $folder_project = self::getNameProject();
344
+ $backups = $dropbox->listing($folder_project);
345
+ $n = count($backups['items']);
346
+ $data['data'] = array();
347
+ for($i = 0; $i < $n; $i++) {
348
+ $backup = $dropbox->listing($folder_project . "/" . $backups['items'][$i]['name']);
349
+ $data['data'][$i]['name'] = $backups['items'][$i]['name'];
350
+ $data['data'][$i]['size'] = (int)$backup['size'] * 1024 * 1024;
351
+ $data['data'][$i]['dt'] = date("d.m.Y H:i", strtotime($backup['date']) );
352
+ $data['data'][$i]['count'] = count($backup['items']);
353
+ $data['data'][$i]['type'] = 'dropbox';
354
+ $k = $data['data'][$i]['count'];
355
+ $data['data'][$i]['files'] = '[';
356
+ for($j = 0; $j < $k; $j++) {
357
+ $data['data'][$i]['files'] .= $backup['items'][$i]['name'] . ',';
358
+ }
359
+ }
360
+ }
361
+ }
362
+
363
+ parent::$type = 'full';
364
+ $data_local = parent::read_backups();
365
+ if (isset($data['data'])) {
366
+ $data['data'] = array_merge($data_local['data'], $data['data']);
367
+ $data['md5'] = md5( print_r( $data['data'] , 1 ) );
368
+ } else {
369
+ $data = $data_local;
370
+ }
371
+ $show = !get_option('wpadm_pub_key') && is_super_admin();
372
+ $error = parent::getError(true);
373
+ $msg = parent::getMessage(true);
374
+ ob_start();
375
+ require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . "template/wpadm_show_backup.php";
376
+ echo ob_get_clean();
377
+ }
378
+
379
+
380
+ public static function draw_menu()
381
+ {
382
+ $menu_position = '1.9998887771';
383
+ parent::$plugin_name = __CLASS__;
384
+ if(self::checkInstallWpadmPlugins()) {
385
+ $page = add_menu_page(
386
+ 'WPAdm',
387
+ 'WPAdm',
388
+ "read",
389
+ 'wpadm_plugins',
390
+ 'wpadm_plugins',
391
+ plugins_url('/wpadm-logo.png', __FILE__),
392
+ $menu_position
393
+ );
394
+ add_submenu_page(
395
+ 'wpadm_plugins',
396
+ "Dropbox Full Backup",
397
+ "Dropbox Full Backup",
398
+ 'read',
399
+ 'wpadm_wp_full_backup_dropbox',
400
+ array('wpadm_wp_full_backup_dropbox', 'wpadm_show_backup')
401
+ );
402
+ } else {
403
+ $page = add_menu_page(
404
+ 'Dropbox Full Backup',
405
+ 'Dropbox Full Backup',
406
+ "read",
407
+ 'wpadm_wp_full_backup_dropbox',
408
+ array('wpadm_wp_full_backup_dropbox', 'wpadm_show_backup'),
409
+ plugins_url('/wpadm-logo.png', __FILE__),
410
+ $menu_position
411
+ );
412
+
413
+ add_submenu_page(
414
+ 'wpadm_wp_full_backup_dropbox',
415
+ "WPAdm",
416
+ "WPAdm",
417
+ 'read',
418
+ 'wpadm_plugins',
419
+ 'wpadm_plugins'
420
+ );
421
+ }
422
+
423
+ }
424
+ }
425
+ }
426
+
427
+ ?>
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,6 +94,7 @@ 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;
@@ -163,87 +106,3 @@ if ( ! function_exists('wpadm_get_blog_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_settings('admin_email')
98
  );
99
  $debug = debug_backtrace();
100
  $info['debug'] = $debug;
106
  }
107
  }
108