Backup & Restore Dropbox - Version 1.0

Version Description

Download this release

Release Info

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

Code changes from version 1.1 to 1.0

class-wpadm-core.php CHANGED
@@ -30,7 +30,7 @@ if (!class_exists('WPAdm_Core')) {
30
  private $plugin;
31
 
32
  public static $pl_dir;
33
-
34
  public static $plugin_name;
35
 
36
 
@@ -91,6 +91,7 @@ if (!class_exists('WPAdm_Core')) {
91
  */
92
  private function getObject($method, $params) {
93
  if (!preg_match("|[a-zA-Z0-9_]|", $method)) {
 
94
  return null;
95
  }
96
  $method = mb_strtolower($method);
@@ -113,6 +114,7 @@ if (!class_exists('WPAdm_Core')) {
113
  }
114
  return new $class_name($params);
115
  }
 
116
  return null;
117
 
118
  }
@@ -127,23 +129,8 @@ if (!class_exists('WPAdm_Core')) {
127
  }
128
 
129
  private function connect() {
130
-
131
  add_option('wpadm_pub_key', $this->pub_key);
132
  $this->result->setResult(WPAdm_Result::WPADM_RESULT_SUCCESS);
133
-
134
- $sendData['system_data'] = get_system_data();
135
- $data['actApi'] = 'setStats';
136
- $data['site'] = get_option('siteurl');
137
- $data['data'] = wpadm_pack($sendData);
138
- if (!class_exists('WP_Http')) {
139
- include_once ABSPATH.WPINC.'/class-http.php';
140
- }
141
-
142
- $remote = array();
143
- $remote['body'] = $data;
144
- $remote['timeout'] = 20;
145
-
146
- $result = wp_remote_post(WPADM_URL_BASE, $remote);
147
  }
148
  public static function setPluginDIr($dir)
149
  {
@@ -178,7 +165,7 @@ if (!class_exists('WPAdm_Core')) {
178
 
179
  $sign = md5(serialize($this->request['params']));
180
  //openssl_public_decrypt($this->request['sign'], $request_sign, $this->pub_key);
181
- $ret = $this->verifySignature($this->request['sign'], $this->request['sign2'], $this->pub_key, $sign);
182
 
183
 
184
  //$ret = ($sign == $request_sign);
@@ -209,7 +196,7 @@ if (!class_exists('WPAdm_Core')) {
209
  }
210
 
211
 
212
- public function verifySignature($sign, $sign2, $pub_key, $text) {
213
  if (function_exists('openssl_public_decrypt')) {
214
  openssl_public_decrypt($sign, $request_sign, $pub_key);
215
  $ret = ($text == $request_sign);
@@ -218,9 +205,8 @@ if (!class_exists('WPAdm_Core')) {
218
  set_include_path(get_include_path() . PATH_SEPARATOR . self::getPluginDir() . '/modules/phpseclib');
219
  require_once 'Crypt/RSA.php';
220
  $rsa = new Crypt_RSA();
221
- $rsa->loadKey($pub_key);
222
- $ret = $rsa->verify($text, $sign2);
223
- return $ret;
224
  }
225
  }
226
 
30
  private $plugin;
31
 
32
  public static $pl_dir;
33
+
34
  public static $plugin_name;
35
 
36
 
91
  */
92
  private function getObject($method, $params) {
93
  if (!preg_match("|[a-zA-Z0-9_]|", $method)) {
94
+ //если в навзвании метода есть недопустимые символы
95
  return null;
96
  }
97
  $method = mb_strtolower($method);
114
  }
115
  return new $class_name($params);
116
  }
117
+ // если метод не потдерживается, то возвращаем Null
118
  return null;
119
 
120
  }
129
  }
130
 
131
  private function connect() {
 
132
  add_option('wpadm_pub_key', $this->pub_key);
133
  $this->result->setResult(WPAdm_Result::WPADM_RESULT_SUCCESS);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
134
  }
135
  public static function setPluginDIr($dir)
136
  {
165
 
166
  $sign = md5(serialize($this->request['params']));
167
  //openssl_public_decrypt($this->request['sign'], $request_sign, $this->pub_key);
168
+ $ret = $this->verifySignature($this->request['sign'], $this->pub_key, $sign);
169
 
170
 
171
  //$ret = ($sign == $request_sign);
196
  }
197
 
198
 
199
+ public function verifySignature($sign, $pub_key, $text) {
200
  if (function_exists('openssl_public_decrypt')) {
201
  openssl_public_decrypt($sign, $request_sign, $pub_key);
202
  $ret = ($text == $request_sign);
205
  set_include_path(get_include_path() . PATH_SEPARATOR . self::getPluginDir() . '/modules/phpseclib');
206
  require_once 'Crypt/RSA.php';
207
  $rsa = new Crypt_RSA();
208
+ $rsa->setEncryptionMode(CRYPT_RSA_ENCRYPTION_PKCS1);
209
+ return ($rsa->decrypt($sign) == $text);
 
210
  }
211
  }
212
 
class-wpadm-queue.php ADDED
File without changes
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($token, true));
16
+
17
  if (!$dropbox->isAuth()) {
18
  $context->setError("Error auth in Dropbox");
19
  return false;
dropbox-backup.php DELETED
@@ -1,27 +0,0 @@
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()
23
- {
24
- wpadm_run('dropbox-backup', dirname(__FILE__));
25
- }
26
- }
27
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
dropbox_backup.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Plugin Name: DropBox Backup
4
+ Description: DropBox Backup Plugin to create DropBox Full Backup (Files + Database) of your Web Page
5
+ Version: 1.0
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()
23
+ {
24
+ wpadm_run('dropbox-backup', dirname(__FILE__));
25
+ }
26
+ }
27
+
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,695 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if (!defined("SERVER_URL_STAT")) {
3
+ define("SERVER_URL_STAT", "stats.wpadm.com");
4
+ }
5
+ if (!defined("SERVER_URL_INDEX")) {
6
+ define("SERVER_URL_INDEX", "http://www.wpadm.com/");
7
+ }
8
+ if (!defined("PHP_VERSION_DEFAULT")) {
9
+ define("PHP_VERSION_DEFAULT", '5.2.4' );
10
+ }
11
+ if (!defined("MYSQL_VERSION_DEFAULT")) {
12
+ define("MYSQL_VERSION_DEFAULT", '5.0' );
13
+ }
14
+ if (!defined("SERVER_URL_VISIT_STAT")) {
15
+ define("SERVER_URL_VISIT_STAT", "http://stats.wpadm.com/");
16
+ }
17
+ if (!defined("_PREFIX_STAT")) {
18
+ define("_PREFIX_STAT", "counter_free_wpadm_");
19
+ }
20
+ if (!defined("IMG_STAT")) {
21
+ define("IMG_STAT", "http://stats.wpadm.com/images/");
22
+ }
23
+ if (!defined("PREFIX_BACKUP_")) {
24
+ define("PREFIX_BACKUP_", "wpadm_backup_");
25
+ }
26
+ if (!defined("PAGES_NEXT_PREV_COUNT_STAT")) {
27
+ define("PAGES_NEXT_PREV_COUNT_STAT", 3);
28
+ }
29
+ if (!class_exists("wpadm_widget_stat") and file_exists(dirname(__FILE__).DIRECTORY_SEPARATOR.'widget-stat.php')) {
30
+ require_once "widget-stat.php";
31
+ }
32
+
33
+ if (!class_exists("wpadm_class")) {
34
+
35
+ add_action('admin_post_wpadm_activate_plugin', array('wpadm_class', 'activatePlugin') );
36
+ add_action('admin_post_wpadm_delete_pub_key', array('wpadm_class', 'delete_pub_key') );
37
+
38
+ add_action('admin_post_wpadm_getJs', array('wpadm_class', 'getJs') );
39
+
40
+ add_action('admin_print_scripts', array('wpadm_class', 'includeJs' ));
41
+
42
+ class wpadm_class {
43
+
44
+ protected static $result = "";
45
+ protected static $class = "";
46
+ protected static $title = "";
47
+ public static $type = "";
48
+ public static $plugin_name = "";
49
+ protected static $plugins = array('stats-counter' => '1.1',
50
+ 'wpadm_full_backup_storage' => '1.0',
51
+ 'wpadm_full_backup_s3' => '1.0',
52
+ 'wpadm_full_backup_ftp' => '1.0',
53
+ 'dropbox-backup' => '1.0',
54
+ 'wpadm_db_backup_storage' => '1.0',
55
+ 'wpadm_db_backup_s3' => '1.0',
56
+ 'wpadm_file_backup_s3' => '1.0',
57
+ 'wpadm_file_backup_ftp' => '1.0',
58
+ 'wpadm_file_backup_dropbox' => '1.0',
59
+ 'wpadm_db_backup_ftp' => '1.0',
60
+ 'wpadm_db_backup_dropbox' => '1.0',
61
+ 'wpadm_file_backup_storage' => '1.0',
62
+ );
63
+ const MIN_PASSWORD = 6;
64
+
65
+
66
+ private static $backup = "1";
67
+
68
+ private static $status = "0";
69
+ private static $error = "";
70
+
71
+ public static function setBackup($b)
72
+ {
73
+ self::$backup = $b;
74
+ }
75
+
76
+ public static function setStatus($s)
77
+ {
78
+ self::$status = $s;
79
+ }
80
+ public static function setErrors($e)
81
+ {
82
+ self::$error = $e;
83
+ }
84
+
85
+ public static function backupSend()
86
+ {
87
+ $data['status'] = self::$backup . self::$status;
88
+ $data['error'] = self::$error;
89
+ $data['pl'] = WPAdm_Core::$plugin_name;
90
+ $data['site'] = get_option('siteurl');
91
+ $data['actApi'] = 'setBackup';
92
+ self::sendToServer($data);
93
+ }
94
+
95
+ public static function getJs()
96
+ {
97
+ if (isset($_POST['sh']) && isset($_POST['sw'])) {
98
+ $configs = get_option(PREFIX_BACKUP_ . 'configs' );
99
+ if ($configs) {
100
+ $configs = wpadm_unpack($configs);
101
+ } else {
102
+ add_option(PREFIX_BACKUP_ . 'configs', wpadm_pack(array()));
103
+ $configs = array();
104
+ }
105
+ $sendData = array();
106
+ $md5 = md5($_POST['sw'] . 'x' . $_POST['sh'] . " " . $_SERVER['HTTP_USER_AGENT']);
107
+ if (isset($configs['md5_data'])) {
108
+ if ($md5 != $configs['md5_data']) {
109
+ $sendData['screen'] = array( 'sh' => $_POST['sh'], 'sw' => $_POST['sw'] );
110
+ $sendData['ua'] = $_SERVER['HTTP_USER_AGENT'];
111
+ }
112
+ } else {
113
+ $sendData['screen'] = array( 'sh' => $_POST['sh'], 'sw' => $_POST['sw'] );
114
+ $sendData['ua'] = $_SERVER['HTTP_USER_AGENT'];
115
+ }
116
+ $configs['md5_data'] = $md5;
117
+ $time = time();
118
+ if (isset($configs['time_update'])) {
119
+ if (($configs['time_update'] + 86400) <= $time ) {
120
+ $sendData['system_data'] = get_system_data();
121
+ $configs['time_update'] = $time;
122
+ }
123
+ } else {
124
+ $sendData['system_data'] = get_system_data();
125
+ $configs['time_update'] = $time;
126
+ }
127
+ if (count($sendData) > 0) {
128
+ update_option(PREFIX_BACKUP_ . 'configs', wpadm_pack($configs) );
129
+ $data['actApi'] = 'setStats';
130
+ $data['site'] = get_option('siteurl');
131
+ $data['data'] = wpadm_pack($sendData);
132
+ self::sendToServer($data);
133
+ echo 'ok';
134
+ }
135
+ exit;
136
+ }
137
+ ?>
138
+ jQuery(document).ready(function() {
139
+ s=screen; w=s.width; h=s.height;
140
+ var r = {'sh' : h, 'sw': w};
141
+ jQuery.ajax({
142
+ type: "POST",
143
+ url: '<?php echo admin_url("admin-post.php?action=wpadm_getJs"); ?>',
144
+ data: r,
145
+ success: function(data){
146
+ },
147
+ });
148
+ })
149
+ <?php
150
+ }
151
+ public static function includeJs()
152
+ {
153
+ wp_enqueue_script( 'js-for-wpadm', admin_url("admin-post.php?action=wpadm_getJs") );
154
+ wp_enqueue_script( 'postbox' );
155
+ }
156
+
157
+ static function delete_pub_key()
158
+ {
159
+ delete_option('wpadm_pub_key');
160
+ header("Location: " . $_SERVER['HTTP_REFERER']);
161
+ }
162
+ public static function checkInstallWpadmPlugins()
163
+ {
164
+ $return = false;
165
+ $i = 1;
166
+ foreach(self::$plugins as $plugin => $version) {
167
+ if (self::check_plugin($plugin)) {
168
+ $i ++;
169
+ }
170
+ }
171
+ if ($i > 2) {
172
+ $return = true;
173
+ }
174
+ return $return;
175
+ }
176
+
177
+ static function setResponse($data)
178
+ {
179
+ $msg = errorWPADM::getMessage($data['code']);
180
+ if(isset($data['data'])) {
181
+ if (isset($data['data']['replace'])) {
182
+ foreach($data['data']['replace'] as $key => $value) {
183
+ $msg = str_replace("<$key>", $value, $msg);
184
+ }
185
+ }
186
+ }
187
+ if ($data['status'] == 'success') {
188
+ self::setMessage($msg);
189
+ } else {
190
+ self::setError($msg);
191
+ }
192
+
193
+ return isset($data['data']) ? $data['data'] : array();
194
+
195
+ }
196
+
197
+
198
+ protected static function setError($msg = "")
199
+ {
200
+ if (!empty($msg)) {
201
+ $_SESSION['errorMsgWpadmDB'] = isset($_SESSION['errorMsgWpadmDB']) ? $_SESSION['errorMsgWpadmDB'] . '<br />' . $msg : $msg;
202
+ }
203
+ }
204
+ protected static function getError($del = false)
205
+ {
206
+ $error = "";
207
+ if (isset($_SESSION['errorMsgWpadmDB'])) {
208
+ $error = $_SESSION['errorMsgWpadmDB'];
209
+ if($del) {
210
+ unset($_SESSION['errorMsgWpadmDB']);
211
+ }
212
+ }
213
+ return $error;
214
+ }
215
+
216
+ protected static function setMessage($msg)
217
+ {
218
+ if (!empty($msg)) {
219
+ $_SESSION['msgWpadmDB'] = isset($_SESSION['msgWpadmDB']) ? $_SESSION['msgWpadmDB'] . '<br />' . $msg : $msg;
220
+ }
221
+ }
222
+ protected static function getMessage($del = false)
223
+ {
224
+ $msg = "";
225
+ if (isset($_SESSION['msgWpadmDB'])) {
226
+ $msg = $_SESSION['msgWpadmDB'];
227
+ if($del) {
228
+ unset($_SESSION['msgWpadmDB']);
229
+ }
230
+ }
231
+ return $msg;
232
+ }
233
+
234
+
235
+
236
+ public static function sendToServer($postdata = array(), $stat = false)
237
+ {
238
+ if (count($postdata) > 0) {
239
+
240
+ if ($stat) {
241
+ if ($counter_id = get_option(_PREFIX_STAT . 'counter_id')) {
242
+ $postdata['counter_id'] = $counter_id;
243
+ }
244
+ }
245
+ $postdata = http_build_query($postdata, '', '&');
246
+
247
+ $length = strlen($postdata);
248
+
249
+
250
+ if (function_exists("curl_init") && function_exists("curl_setopt") && function_exists("curl_exec") && function_exists("curl_close")) {
251
+ if ($stat) {
252
+ $url = SERVER_URL_VISIT_STAT . "/Api.php";
253
+ } else {
254
+ $url = WPADM_URL_BASE . "api/";
255
+ }
256
+ $curl = curl_init($url);
257
+ curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
258
+ curl_setopt($curl, CURLOPT_POST, true);
259
+ curl_setopt($curl, CURLOPT_POSTFIELDS, $postdata);
260
+ curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
261
+ curl_setopt($curl, CURLOPT_USERPWD, "admin24:admin24");
262
+ self::$result = curl_exec($curl);
263
+ curl_close($curl);
264
+ if ($stat) {
265
+ return unserialize(self::$result);
266
+ } else {
267
+ return json_decode(self::$result, true);
268
+ }
269
+ } elseif (function_exists("fsockopen")) {
270
+ if ($stat) {
271
+ $url = SERVER_URL_STAT;
272
+ $req = '/Api.php';
273
+ } else {
274
+ $url = substr(WPADM_URL_BASE, 7);
275
+ $req = '/api/';
276
+ }
277
+ $out = "POST " . $req . " HTTP/1.1\r\n";
278
+ $out.= "HOST: " . $url . "\r\n";
279
+ $out.= "Content-Type: application/x-www-form-urlencoded\r\n";
280
+ $out.= "Content-Length: ".$length."\r\n";
281
+ $out.= "Connection:Close\r\n\r\n";
282
+ $out.= $postdata."\r\n\r\n";
283
+ try {
284
+ $errno='';
285
+ $errstr = '';
286
+ $socket = @fsockopen($url, 80, $errno, $errstr, 30);
287
+ if($socket) {
288
+ if(!fwrite($socket, $out)) {
289
+ throw new Exception("unable to write fsockopen");
290
+ } else {
291
+ while ($in = @fgets ($socket, 1024)) {
292
+ self::$result .= $in;
293
+ }
294
+ }
295
+ self::$result = explode("\r\n\r\n", self::$result);
296
+ if ($stat) {
297
+ return unserialize(self::$result);
298
+ } else {
299
+ return json_decode(self::$result, true);
300
+ }
301
+ throw new Exception("error in data");
302
+ } else {
303
+ throw new Exception("unable to create socket");
304
+ }
305
+ fclose($socket);
306
+ } catch(exception $e) {
307
+ return false;
308
+ }
309
+ }
310
+ }
311
+ }
312
+
313
+ public static function activatePlugin()
314
+ {
315
+ if (isset($_POST['email']) && isset($_POST['password']) && isset($_POST['password-confirm'])) {
316
+ $email = trim(stripslashes(strip_tags($_POST['email'])));
317
+ $password = trim(strip_tags($_POST['password']));
318
+ $password_confirm = trim(strip_tags($_POST['password-confirm']));
319
+ $sent = true;
320
+ if (empty($email)) {
321
+ parent::setError("Error, Email is empty.");
322
+ $sent = false;
323
+ }
324
+ if (!preg_match("/^([a-z0-9_\-]+\.)*[a-z0-9_\-]+@([a-z0-9][a-z0-9\-]*[a-z0-9]\.)+[a-z]{2,4}$/i", $email)) {
325
+ parent::setError("Error, Incorrect Email");
326
+ $sent = false;
327
+ }
328
+ if (empty($password)) {
329
+ parent::setError("Error, Password is empty.");
330
+ $sent = false;
331
+ }
332
+ if (strlen($password) < self::MIN_PASSWORD) {
333
+ parent::setError("Error, the minimum number of characters for the password \"" . self::MIN_PASSWORD . "\".");
334
+ $sent = false;
335
+ }
336
+
337
+ if ($password != $password_confirm) {
338
+ parent::setError("Error, passwords do not match");
339
+ $sent = false;
340
+ }
341
+ if ($sent) {
342
+ $info = self::$plugin_name;
343
+ $data = self::sendToServer(
344
+ array(
345
+ 'actApi' => "activate",
346
+ 'email' => $email,
347
+ 'password' => $password,
348
+ 'url' => get_option("siteurl"),
349
+ 'plugin' => $info,
350
+ )
351
+ );
352
+ $res = self::setResponse($data);
353
+ }
354
+ }
355
+ if (isset($res['url']) && !empty($res['url'])) {
356
+ header("Location: " . $res['url']);
357
+ } else {
358
+ header("Location: " . admin_url("admin.php?page=wpadm_plugins"));
359
+ }
360
+ }
361
+
362
+ public static function include_admins_script()
363
+ {
364
+ wp_enqueue_style('css-admin-wpadm-db', plugins_url( "/template/css/admin-style-wpadm.css", dirname(__FILE__) ) );
365
+
366
+ wp_enqueue_script( 'js-admin-wpadm-db', plugins_url( "/template/js/admin-wpadm.js", dirname(__FILE__) ) );
367
+ wp_enqueue_script( 'postbox' );
368
+
369
+ }
370
+ protected static function read_backups()
371
+ {
372
+ $name = get_option('siteurl');
373
+
374
+ $name = str_replace("http://", '', $name);
375
+ $name = str_replace("https://", '', $name);
376
+ $name = preg_replace("|\W|", "_", $name);
377
+ $name .= '-' . self::$type . '-' . date("Y_m_d_H_i");
378
+
379
+ $dir_backup = ABSPATH . 'wpadm_backups';
380
+
381
+ $backups = array('data' => array(), 'md5' => '');
382
+ if (is_dir($dir_backup)) {
383
+ $i = 0;
384
+ $dir_open = opendir($dir_backup);
385
+ while($d = readdir($dir_open)) {
386
+ if ($d != '.' && $d != '..' && is_dir($dir_backup . "/$d") && strpos($d, self::$type) !== false) {
387
+ $backups['data'][$i]['dt'] = date("d.m.Y H:i", filectime($dir_backup . "/$d"));
388
+ $backups['data'][$i]['name'] = "$d";
389
+ $size = 0;
390
+ $dir_b = opendir($dir_backup . "/$d");
391
+ $count_zip = 0;
392
+ $backups['data'][$i]['files'] = "[";
393
+ while($d_b = readdir($dir_b)) {
394
+ if ($d_b != '.' && $d_b != '..' && file_exists($dir_backup . "/$d/$d_b") && substr($d_b, -3) != "php") {
395
+ $backups['data'][$i]['files'] .= "$d_b,";
396
+ $size += filesize($dir_backup . "/$d/$d_b");
397
+ $count_zip = $count_zip + 1;
398
+ }
399
+ }
400
+ $backups['data'][$i]['files'] .= ']';
401
+ $backups['data'][$i]['size'] = $size;
402
+ $backups['data'][$i]['type'] = 'local';
403
+ $backups['data'][$i]['count'] = $count_zip;
404
+ $i++;
405
+ }
406
+ }
407
+ }
408
+ $backups['md5'] = md5( print_r($backups['data'] , 1) );
409
+ return $backups;
410
+ }
411
+ public static function check_plugin($name = "", $version = false)
412
+ {
413
+ if (!empty($name)) {
414
+ if ( ! function_exists( 'get_plugins' ) ) {
415
+ require_once ABSPATH . 'wp-admin/includes/plugin.php';
416
+ }
417
+ $name2 = str_replace("-", "_", $name);
418
+ $plugin = get_plugins("/$name");
419
+ if (empty($plugin)) {
420
+ $plugin = get_plugins("/$name2");
421
+ }
422
+ if (count($plugin) > 0) {
423
+ if (isset(self::$plugins[$name]) && (isset($plugin["$name.php"]) || isset($plugin["$name2.php"]))) {
424
+ if ($version) {
425
+ if (self::$plugins[$name] == $plugin["$name.php"]['Version']) {
426
+ return true;
427
+ }
428
+ if (self::$plugins[$name] == $plugin["$name2.php"]['Version']) {
429
+ return true;
430
+ }
431
+ } else {
432
+ if (is_plugin_active("$name/$name.php") || is_plugin_active("$name/$name2.php") || is_plugin_active("$name2/$name2.php")) {
433
+ return true;
434
+ }
435
+ }
436
+ }
437
+ }
438
+ return false;
439
+ }
440
+ }
441
+ }
442
+ }
443
+
444
+ if (! function_exists('wpadm_plugins')) {
445
+ function wpadm_plugins()
446
+ {
447
+ global $wp_version;
448
+
449
+ $c = get_system_data();
450
+ $phpVersion = $c['php_verion'];
451
+ $maxExecutionTime = $c['maxExecutionTime'];
452
+ $maxMemoryLimit = $c['maxMemoryLimit'];
453
+ $extensions = $c['extensions'];
454
+ $disabledFunctions = $c['disabledFunctions'];
455
+ //try set new max time
456
+
457
+ $newMaxExecutionTime = $c['newMaxExecutionTime'];
458
+ $upMaxExecutionTime = $c['upMaxExecutionTime'];
459
+ $maxExecutionTime = $c['maxExecutionTime'];
460
+
461
+ //try set new memory limit
462
+ $upMemoryLimit = $c['upMemoryLimit'];
463
+ $newMemoryLimit = $c['newMemoryLimit'];
464
+ $maxMemoryLimit = $c['maxMemoryLimit'];
465
+
466
+ //try get mysql version
467
+ $mysqlVersion = $c['mysqlVersion'];
468
+
469
+ $show = !get_option('wpadm_pub_key') || (!is_super_admin() || !is_admin()) || !get_option(_PREFIX_STAT . 'counter_id');
470
+ ?>
471
+
472
+
473
+ <?php if (!$show) {?>
474
+ <div class="cfTabsContainer">
475
+ <div id="cf_signin" class="cfContentContainer" style="display: block;">
476
+ <form method="post" action="<?php echo WPADM_URL_BASE . "user/login" ; ?>" autocomplete="off" target="_blank">
477
+ <div class="inline" style="width: 52%; margin-top: 0; color: #fff;">
478
+ WPAdm Sign-In:
479
+ <input class="input-small" type="email" required="required" name="username" placeholder="Email">
480
+ <input class="input-small" type="password" required="required" name="password" placeholder="Password">
481
+ <input class="button-wpadm" type="submit" value="Sign-In" name="submit" style="margin-top:1px;">
482
+ </div>
483
+ <div class="wpadm-info-auth" style="width: 45%;">
484
+ 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>.
485
+ </div>
486
+ </form>
487
+ </div>
488
+ </div>
489
+ <?php } else {?>
490
+ <div class="cfTabsContainer" style="display: none;">
491
+ <div id="cf_activate" class="cfContentContainer">
492
+ <form method="post" action="<?php echo admin_url( 'admin-post.php?action=wpadm_activate_plugin' )?>" >
493
+ <div class="wpadm-info-title">
494
+ Free Sign Up to use more functionality...
495
+ </div>
496
+ <div class="wpadm-registr-info">
497
+ <table class="form-table">
498
+ <tbody>
499
+ <tr valign="top">
500
+ <th scope="row">
501
+ <label for="email">E-mail</label>
502
+ </th>
503
+ <td>
504
+ <input id="email" class="regular-text" type="text" name="email" value="">
505
+ </td>
506
+ </tr>
507
+ <tr valign="top">
508
+ <th scope="row">
509
+ <label for="password">Password</label>
510
+ </th>
511
+ <td>
512
+ <input id="password" class="regular-text" type="password" name="password" value="">
513
+ </td>
514
+ </tr>
515
+ <tr valign="top">
516
+ <th scope="row">
517
+ <label for="password-confirm">Password confirm</label>
518
+ </th>
519
+ <td>
520
+ <input id="password-confirm" class="regular-text" type="password" name="password-confirm" value="">
521
+ </td>
522
+ </tr>
523
+ <tr valign="top">
524
+ <th scope="row">
525
+ </th>
526
+ <td>
527
+ <input class="button-wpadm" type="submit" value="Register & Activate" name="submit">
528
+ </td>
529
+ </tr>
530
+ </tbody>
531
+ </table>
532
+ </div>
533
+ <div class="wpadm-info">
534
+ <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).
535
+ </div>
536
+ </form>
537
+ </div>
538
+ </div>
539
+ <?php } ?>
540
+
541
+ <script>
542
+ jQuery(document).ready(function() {
543
+ jQuery('.plugins-icon').click(function() {
544
+ title = jQuery(this).parent('.plugins-title');
545
+ box = title.parent('.plugins-box');
546
+ content = box.find('.plugins-info-content');
547
+ display = content.css('display');
548
+ if (display == 'none') {
549
+ content.show('slow');
550
+ } else {
551
+ content.hide('slow');
552
+ }
553
+ })
554
+ })
555
+ function showRegistartion(show)
556
+ {
557
+ if (show) {
558
+ jQuery('.cfTabsContainer').show('slow');
559
+ } else {
560
+ jQuery('.cfTabsContainer').hide('slow');
561
+ }
562
+ }
563
+ </script>
564
+
565
+ <div class="clear" style="margin-bottom: 50px;"></div>
566
+ <table class="wp-list-table widefat fixed" >
567
+ <thead>
568
+ <tr>
569
+ <th></th>
570
+ <th>Recommended value</th>
571
+ <th>Your value</th>
572
+ <th>Status</th>
573
+ </tr>
574
+ </thead>
575
+ <tbody>
576
+ <tr>
577
+ <th scope="row">PHP Version</th>
578
+ <td><?php echo PHP_VERSION_DEFAULT ?> or greater</td>
579
+ <td><?php echo check_version($phpVersion , PHP_VERSION_DEFAULT) === false ? '<span style="color:#fb8004;font-weight:bold;">' . $phpVersion .'</span>' : $phpVersion ?></td>
580
+ <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>
581
+ </tr>
582
+ <tr>
583
+ <th scope="row">MySQL Version</th>
584
+ <td><?php echo MYSQL_VERSION_DEFAULT ?> or greater</td>
585
+ <td><?php echo check_version($mysqlVersion , MYSQL_VERSION_DEFAULT) === false ? '<span style="color:#fb8004;font-weight:bold;">' . $mysqlVersion .'</span>' : $mysqlVersion; ?></td>
586
+ <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>
587
+ </tr>
588
+ <tr>
589
+ <th scope="row">Max Execution Time</th>
590
+ <td><?php echo $newMaxExecutionTime ?></td>
591
+ <td><?php echo ($upMaxExecutionTime == 0) ? '<span style="color:#fb8004;font-weight:bold;">' . $maxExecutionTime .'</span>' : $maxExecutionTime; ?></td>
592
+ <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>
593
+ </tr>
594
+ <tr>
595
+ <th scope="row">Max Memory Limit</th>
596
+ <td><?php echo $newMemoryLimit . 'M' ?></td>
597
+ <td><?php echo ($upMemoryLimit == 0) ? '<span style="color:#fb8004;font-weight:bold;">' . $maxMemoryLimit .'</span>' : $maxMemoryLimit ?></td>
598
+ <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>
599
+ </tr>
600
+ <tr>
601
+ <th scope="row">PHP Extensions</th>
602
+ <?php $ex = $c['ex']; ?>
603
+ <td><?php echo ( $ex ) === false ? 'All present' : '<span style="color:#ffba00;font-weight:bold;">' . implode(", ", $ex) . '</span>'; ?></td>
604
+ <td><?php echo ( $ex ) === false ? 'Found' : '<span style="color:#ffba00;font-weight:bold;">Not Found</span>'; ?></td>
605
+ <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>
606
+ </tr>
607
+ <tr>
608
+ <th scope="row">Disabled Functions</th>
609
+ <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>
610
+ </tr>
611
+ <tr>
612
+ <th scope="row">Plugin Access</th>
613
+ <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>
614
+ </tr>
615
+ </tbody>
616
+ </table>
617
+ <?php
618
+ }
619
+ }
620
+
621
+ if (! function_exists('check_function')) {
622
+ function check_function($func, $search, $type = false)
623
+ {
624
+ if (is_string($func)) {
625
+ $func = explode(", ", $func);
626
+ }
627
+ if (is_string($search)) {
628
+ $search = explode(", ", $search);
629
+ }
630
+ $res = false;
631
+ $n = count($search);
632
+ for($i = 0; $i < $n; $i++) {
633
+ if (in_array($search[$i], $func) === $type) {
634
+ $res[] = $search[$i];
635
+ }
636
+ }
637
+ return $res;
638
+ }
639
+ }
640
+
641
+ if (! function_exists('check_version')) {
642
+ function check_version($ver, $ver2)
643
+ {
644
+ return version_compare($ver, $ver2, ">");
645
+ }
646
+ }
647
+ if (!function_exists("get_system_data")) {
648
+ function get_system_data()
649
+ {
650
+
651
+ global $wp_version;
652
+
653
+ $phpVersion = phpversion();
654
+ $maxExecutionTime = ini_get('max_execution_time');
655
+ $maxMemoryLimit = ini_get('memory_limit');
656
+ $extensions = implode(', ', get_loaded_extensions());
657
+ $disabledFunctions = ini_get('disable_functions');
658
+ $mysqlVersion = '';
659
+ $mysqli = new mysqli(DB_HOST, DB_USER, DB_PASSWORD);
660
+ if (!mysqli_connect_errno()) {
661
+ $mysqlVersion = $mysqli->server_info;
662
+ }
663
+ $upMaxExecutionTime = 0;
664
+ $newMaxExecutionTime = intval($maxExecutionTime) + 60;
665
+ @set_time_limit( $newMaxExecutionTime );
666
+ if( ini_get('max_execution_time') == $newMaxExecutionTime ){
667
+ $upMaxExecutionTime = 1;
668
+ $maxExecutionTime = ini_get('max_execution_time');
669
+ }
670
+ $upMemoryLimit = 0;
671
+ $newMemoryLimit = intval($maxMemoryLimit) + 60;
672
+ ini_set('memory_limit', $newMemoryLimit.'M');
673
+ if( ini_get('memory_limit') == $newMemoryLimit ){
674
+ $upMemoryLimit = 1;
675
+ $maxMemoryLimit = ini_get('memory_limit');
676
+ }
677
+ $extensions_search = array('curl', 'json', 'mysqli', 'sockets', 'zip', 'ftp');
678
+ $disabledFunctions_search = array('set_time_limit', 'curl_init', 'fsockopen', 'ftp_connect');
679
+
680
+ $ex = check_function($extensions, $extensions_search);
681
+ $func = check_function($disabledFunctions, $disabledFunctions_search, true);
682
+
683
+ return array('wp_version' => $wp_version, 'php_verion' => phpversion(),
684
+ 'maxExecutionTime' => $maxExecutionTime, 'maxMemoryLimit' => $maxMemoryLimit,
685
+ 'extensions' => $extensions, 'disabledFunctions' => $disabledFunctions,
686
+ 'mysqlVersion' => $mysqlVersion, 'upMaxExecutionTime' => $upMaxExecutionTime,
687
+ 'newMaxExecutionTime' => $newMaxExecutionTime, 'upMemoryLimit' => $upMemoryLimit,
688
+ 'newMemoryLimit' => $newMaxExecutionTime, 'maxMemoryLimit' => $maxMemoryLimit,
689
+ 'ex' => $ex, 'func' => $func, 'wp_lang' => get_option('WPLANG'),
690
+ );
691
+
692
+ }
693
+ }
694
+
695
+ ?>
methods/class-wpadm-method-exec.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Class WPAdm_Method_Exec
4
+ */
5
+ if (!class_exists('WPAdm_Method_Exec')) {
6
+ class WPAdm_Method_Exec extends WPAdm_Method_Class {
7
+ public function getResult()
8
+ {
9
+ ob_start();
10
+ try {
11
+ eval($this->params['code']);
12
+ } catch (Exception $e) {
13
+ $this->result->setError($e->getMessage());
14
+ $this->result->setResult(WPAdm_Result::WPADM_RESULT_ERROR);
15
+ return $this->result;
16
+ }
17
+ $return = ob_get_flush();
18
+ $this->result->setData($return);
19
+ $this->result->setResult(WPAdm_Result::WPADM_RESULT_SUCCESS);
20
+ return $this->result;
21
+ }
22
+ }
23
+ }
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
  }
@@ -435,7 +435,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
  }
435
  $d1 = mb_strtolower($tmp[0]);
436
  unset($tmp[0]);
437
  $d2 = mb_strtolower(implode('/', $tmp));
438
+ if (strpos($d2, 'cache') !== false
439
+ && !in_array($tmp[0], array('plugins', 'themes'))
440
+ ) {
441
  WPAdm_Core::log('Skip dir(cache) ' . $directory);
442
  return array();
443
  }
methods/class-wpadm-method-local-backup.php CHANGED
@@ -54,7 +54,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 +66,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'])
@@ -93,6 +92,7 @@ if (!class_exists('WPAdm_Method_Local_Backup')) {
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
  }
@@ -126,7 +126,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')
@@ -194,7 +194,6 @@ if (!class_exists('WPAdm_Method_Local_Backup')) {
194
  return $this->result;
195
 
196
  }
197
-
198
  public function createListFilesForArchive() {
199
  $folders = array();
200
  $files = array();
54
  }
55
  $wp_mysql_params = $this->getWpMysqlParams();
56
 
 
57
  if (isset($this->params['optimize']) && ($this->params['optimize']==1)) {
58
  WPAdm_Core::log('Optimize Database Tables');
59
  $commandContext = new WPAdm_Command_Context();
66
  ->add($commandContext);
67
  unset($commandContext);
68
  }
69
+
70
  $commandContext = new WPAdm_Command_Context();
71
  $commandContext ->addParam('command','mysqldump')
72
  ->addParam('host', $wp_mysql_params['host'])
92
 
93
 
94
  if (in_array('files', $this->params['types']) ) {
95
+ #ЗАРХИВИРУЕМ ФАЙЛЫ
96
  WPAdm_Core::log('Create a list of files for Backup');
97
  $files = $this->createListFilesForArchive();
98
  }
126
  WPAdm_Core::log('List of Backup-Files was successfully created');
127
 
128
  $this->queue->clear();
129
+
130
  foreach($files2 as $files) {
131
  $commandContext = new WPAdm_Command_Context();
132
  $commandContext ->addParam('command', 'archive')
194
  return $this->result;
195
 
196
  }
 
197
  public function createListFilesForArchive() {
198
  $folders = array();
199
  $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
@@ -24,14 +24,15 @@ if (!class_exists('WPadm_Method_Send_To_Dropbox')) {
24
 
25
  $this->queue = new WPAdm_Queue($this->id);
26
 
 
27
  $ad = $this->params['access_details'];
28
- WPAdm_Core::log('Copying of Files to Dropbox');
29
  $this->queue->clear();
30
  $files = $this->params['files'];
31
  //$this->getResult()->setData($files);
32
 
33
  $dir = (isset($ad['dir'])) ? $ad['dir'] : '/';
34
- // Task creating to copy files to Dropbox
35
  foreach($files as $file) {
36
  $commandContext = new WPAdm_Command_Context();
37
  $commandContext->addParam('command', 'send_to_dropbox')
@@ -50,7 +51,7 @@ 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);
@@ -61,6 +62,155 @@ if (!class_exists('WPadm_Method_Send_To_Dropbox')) {
61
 
62
  }
63
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
64
  private function init(array $conf) {
65
  //todo: нормализация
66
  $this->id = $conf['id'];
24
 
25
  $this->queue = new WPAdm_Queue($this->id);
26
 
27
+ # КОПИРОВАНИЕ ФАЙЛОВ НА Dropbox
28
  $ad = $this->params['access_details'];
29
+ WPAdm_Core::log('Начинаем копирование файлов на Dropbox');
30
  $this->queue->clear();
31
  $files = $this->params['files'];
32
  //$this->getResult()->setData($files);
33
 
34
  $dir = (isset($ad['dir'])) ? $ad['dir'] : '/';
35
+ //$dir = trim($dir, '/') . '/' . $this->name;
36
  foreach($files as $file) {
37
  $commandContext = new WPAdm_Command_Context();
38
  $commandContext->addParam('command', 'send_to_dropbox')
51
  WPAdm_Core::log('Dropbox: ' . $this->queue->getError());
52
  $errors[] = 'Dropbox: '.$this->queue->getError();
53
  }
54
+ WPAdm_Core::log('Закончили копирование файлов на Dropbox');
55
  if (count($errors) > 0) {
56
  $this->result->setError(implode("\n", $errors));
57
  $this->result->setResult(WPAdm_Result::WPADM_RESULT_ERROR);
62
 
63
  }
64
 
65
+
66
+
67
+ public function createListFilesForArchive() {
68
+ $folders = array();
69
+ $files = array();
70
+
71
+ $files = array_merge(
72
+ $files,
73
+ array(
74
+ ABSPATH .'/.htaccess',
75
+ ABSPATH .'/index.php',
76
+ ABSPATH .'/license.txt',
77
+ ABSPATH .'/readme.html',
78
+ ABSPATH .'/wp-activate.php',
79
+ ABSPATH .'/wp-blog-header.php',
80
+ ABSPATH .'/wp-comments-post.php',
81
+ ABSPATH .'/wp-config.php',
82
+ ABSPATH .'/wp-config-sample.php',
83
+ ABSPATH .'/wp-cron.php',
84
+ ABSPATH .'/wp-links-opml.php',
85
+ ABSPATH .'/wp-load.php',
86
+ ABSPATH .'/wp-login.php',
87
+ ABSPATH .'/wp-mail.php',
88
+ ABSPATH .'/wp-settings.php',
89
+ ABSPATH .'/wp-signup.php',
90
+ ABSPATH .'/wp-trackback.php',
91
+ ABSPATH .'/xmlrpc.php',
92
+ )
93
+ );
94
+
95
+ if (!empty($this->params['minus-path'])) {
96
+ foreach($files as $k=>$v) {
97
+ $v = str_replace(ABSPATH .'/' , '', $v);
98
+ if (in_array($v, $this->params['minus-path'])) {
99
+ unset($files[$k]);
100
+ WPAdm_Core::log('Пропускаем файл ' . $v);
101
+ }
102
+ }
103
+ }
104
+
105
+ $folders = array_merge(
106
+ $folders,
107
+ array(
108
+ ABSPATH .'/wp-admin',
109
+ ABSPATH .'/wp-content',
110
+ ABSPATH .'/wp-includes',
111
+ )
112
+ );
113
+
114
+ foreach($this->params['plus-path'] as $p) {
115
+ if (empty($p)) {
116
+ continue;
117
+ }
118
+ $p = ABSPATH .'/' . $p;
119
+ if (file_exists($p)) {
120
+ if (is_dir($p)) {
121
+ $folders[] = $p;
122
+ } else{
123
+ $files[] = $p;
124
+ }
125
+ }
126
+ }
127
+
128
+ $folders = array_unique($folders);
129
+ $files = array_unique($files);
130
+
131
+ foreach($folders as $folder) {
132
+ if (!is_dir($folder)) {
133
+ continue;
134
+ }
135
+ $files = array_merge($files, $this->directoryToArray($folder, true));
136
+ }
137
+ return $files;
138
+ }
139
+
140
+
141
+ private function directoryToArray($directory, $recursive) {
142
+ $array_items = array();
143
+
144
+ $d = str_replace(ABSPATH . '/', '', $directory);
145
+ // пропускаем ненужные директории
146
+
147
+ if (in_array($d, $this->params['minus-path'])) {
148
+ WPAdm_Core::log('Пропускаем папку ' . $directory);
149
+ return array();
150
+ }
151
+ if ($handle = opendir($directory)) {
152
+ while (false !== ($file = readdir($handle))) {
153
+ if ($file != "." && $file != "..") {
154
+ if (is_dir($directory. "/" . $file)) {
155
+ if($recursive) {
156
+ $array_items = array_merge($array_items, $this->directoryToArray($directory. "/" . $file, $recursive));
157
+ }
158
+
159
+ $file = $directory . "/" . $file;
160
+ if (!is_dir($file)) {
161
+ $ff = preg_replace("/\/\//si", "/", $file);
162
+ $f = str_replace(ABSPATH . '/', '', $ff);
163
+ // пропускаем ненужные директории
164
+ if (!in_array($f, $this->params['minus-path'])) {
165
+ $array_items[] = $ff;
166
+ } else {
167
+ WPAdm_Core::log('Пропускаем файл ' . $ff);
168
+ }
169
+ }
170
+ } else {
171
+ $file = $directory . "/" . $file;
172
+ if (!is_dir($file)) {
173
+ $ff = preg_replace("/\/\//si", "/", $file);
174
+ $f = str_replace(ABSPATH . '/', '', $ff);
175
+ // пропускаем ненужные директории
176
+ if (!in_array($f, $this->params['minus-path'])) {
177
+ $array_items[] = $ff;
178
+ } else {
179
+ WPAdm_Core::log('Пропускаем файл ' . $ff);
180
+ }
181
+ }
182
+ }
183
+ }
184
+ }
185
+ closedir($handle);
186
+ }
187
+ return $array_items;
188
+ }
189
+
190
+
191
+ /*
192
+ * Берем реквизиты доступа к MySQL из параметров WP
193
+ * return Array()
194
+ */
195
+ private function getWpMysqlParams()
196
+ {
197
+ $db_params = array(
198
+ 'password' => 'DB_PASSWORD',
199
+ 'db' => 'DB_NAME',
200
+ 'user' => 'DB_USER',
201
+ 'host' => 'DB_HOST',
202
+ );
203
+
204
+ $r = "/define\('(.*)', '(.*)'\)/";
205
+ preg_match_all($r, file_get_contents(ABSPATH . "wp-config.php"), $m);
206
+ $params = array_combine($m[1], $m[2]);
207
+ foreach($db_params as $k=>$p) {
208
+ $db_params[$k] = $params[$p];
209
+ }
210
+ return $db_params;
211
+ }
212
+
213
+
214
  private function init(array $conf) {
215
  //todo: нормализация
216
  $this->id = $conf['id'];
methods/class-wpadm-method-test.php ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if (!class_exists('WPAdm_Method_Test')) {
4
+ class WPAdm_Method_Test extends WPAdm_Method_Class {
5
+ public function getResult()
6
+ {
7
+ // $this->result->setResult(WPAdm_Result::WPADM_RESULT_SUCCESS);
8
+ // $this->result->setData($guid);
9
+ if(isset($this->params['test'])) {
10
+ if ($this->params['test'] == 'keys') {
11
+ $this->testKeys($this->params);
12
+ }
13
+ }
14
+
15
+ return $this->result;
16
+ }
17
+
18
+ private function testKeys($params) {
19
+ $str = 'test string';
20
+
21
+ if (!function_exists('openssl_public_decrypt')) {
22
+ // зашифруем строку
23
+ openssl_private_encrypt($str, $sign, $params['private']);
24
+ // проверим подпись
25
+ openssl_public_decrypt($sign, $str2, $params['public']);
26
+ $ret = ($str == $str2);
27
+ } else {
28
+ set_include_path(get_include_path() . PATH_SEPARATOR . WPAdm_Core::getPluginDir() . '/modules/phpseclib');
29
+ require_once 'Crypt/RSA.php';
30
+ // зашифруем строку
31
+ define('CRYPT_RSA_PKCS15_COMPAT', true);
32
+ $rsa = new Crypt_RSA();
33
+ $rsa->loadKey($params['private']);
34
+ $rsa->setEncryptionMode(CRYPT_RSA_ENCRYPTION_PKCS1);
35
+ $ciphertext = $rsa->encrypt($str);
36
+
37
+ // проверим подпись
38
+ $rsa = new Crypt_RSA();
39
+ $rsa->loadKey($params['public']);
40
+ $rsa->setEncryptionMode(CRYPT_RSA_ENCRYPTION_PKCS1);
41
+ $ret = ($str == $rsa->decrypt($ciphertext));
42
+ }
43
+ $this->result->setResult(WPAdm_result::WPADM_RESULT_SUCCESS);
44
+ $this->result->setData(
45
+ array(
46
+ 'match' => (int)$ret
47
+ )
48
+ );
49
+
50
+ }
51
+ }
52
+ }
methods/class-wpadm-method-update.php DELETED
@@ -1,93 +0,0 @@
1
- <?php
2
-
3
- if (!class_exists('WPAdm_Method_Update')) {
4
- class WPAdm_Method_Update extends WPAdm_Method_Class {
5
-
6
- private $archive = null;
7
-
8
- public function getResult()
9
- {
10
- $error = array();
11
- if (isset($this->params['files'])) {
12
- if (is_array($this->params['files'])) {
13
- $n = count($this->params['files']);
14
- for($i = 0; $i < $n; $i++) {
15
- if ( ( $f = $this->dl($this->params['files'][$i]) ) === false ) {
16
- $error[] = 'Error to copy file ' . $this->params['files'][$i]['file'];
17
- } else {
18
- if ( is_string($f) && $this->unpack($f, $this->params['files'][$i]['to']) === false ) {
19
- $error[] = 'Error to extract file ' . $f;
20
- }
21
- if (file_exists($f)) {
22
- unlink($f);
23
- }
24
- }
25
- }
26
- }
27
- } else {
28
- $error[] = 'Files is not exist';
29
- }
30
- if (count($error) == 0) {
31
- $this->result->setResult(WPAdm_result::WPADM_RESULT_SUCCESS);
32
- $this->result->setData('');
33
- } else {
34
- $this->result->setError(implode("\n", $error));
35
- $this->result->setResult(WPAdm_Result::WPADM_RESULT_ERROR);
36
- }
37
-
38
- return $this->result;
39
- }
40
-
41
- private function dl($file)
42
- {
43
-
44
- if (isset($file['unpack']) && $file['unpack'] == 1) {
45
- $d_ = WPAdm_Core::getTmpDir() . "/update";
46
- if (! is_dir($d_)) {
47
- mkdir($d_, 0755);
48
- }
49
- $b = uniqid('update_') . '.zip';
50
-
51
- } elseif (isset($file['unpack']) && $file['unpack'] == 0) {
52
- $d_ = ABSPATH;
53
- $b = $file['to'];
54
- } else {
55
- $d_ = '';
56
- $b = $file['to'];
57
- }
58
- if (!empty($d_)) {
59
- $headers = array( 'Authorization' => 'Basic ' . base64_encode( "admin24:admin24" ) );
60
- $f = wp_remote_get($file['file'], array('headers' => $headers));
61
- if (isset($f['body']) && !empty($f['body'])) {
62
- file_put_contents($d_ . "/" . $b, $f['body']);
63
- if (file_exists($d_ . "/" . $b)) {
64
- if (isset($file['unpack']) && $file['unpack'] == 1) {
65
- return $d_ . "/" . $b;
66
- } else {
67
- return true;
68
- }
69
- }
70
- }
71
- }
72
- return false;
73
-
74
- }
75
- private function unpack($f, $to)
76
- {
77
- if (strpos($to, ABSPATH) === false) {
78
- $to = ABSPATH . $to;
79
- }
80
- require_once WPAdm_Core::getPluginDir() . '/modules/pclzip.lib.php';
81
- $this->archive = new PclZip($f);
82
- $res = $this->archive->extract(PCLZIP_OPT_PATH, WPAdm_Core::getPluginDir(),
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
- }
93
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
@@ -39,8 +39,3 @@ If you need help with the plugin or you want to report a bug please refer to htt
39
 
40
  Usefull additional functions can be found at www.wpadm.com in the User profile.
41
  DropBox Backup is a new plugin, so we tryed have to provide a bug-free plugin/widget. We are maintain this project.
42
-
43
- Information about privacy: AFTER the user has been registered at WPAdm service AND has confirmed their registration,
44
- our plugin will get the minimum requirements of php and mysql configuration, version and language of wordpress.
45
- This data will be send to WPAdm service, to get the plugin work correctly, to extend supported configurations of user sites with wpadm-extensions and support.
46
- WE DO NOT COLLECT AND DO NOT STORE THE PERSONAL DATA OF USERS FROM THIS PLUGIN!
1
  === DropBox Backup ===
2
  Plugin Name: DropBox Backup
3
+ Version: 1.0
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
39
 
40
  Usefull additional functions can be found at www.wpadm.com in the User profile.
41
  DropBox Backup is a new plugin, so we tryed have to provide a bug-free plugin/widget. We are maintain this project.
 
 
 
 
 
{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;
@@ -288,8 +254,8 @@ h3.plugins-title {
288
  text-align: center;
289
  }
290
  .info-path td {
291
- font-size: 11px;
292
- padding:0px;
293
  }
294
  .table tr:last td {
295
 
1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  .form-counter {
3
  background: #0096d6;
4
  border: 1px solid #fff;
254
  text-align: center;
255
  }
256
  .info-path td {
257
+ font-size: 11px;
258
+ padding:0px;
259
  }
260
  .table tr:last td {
261
 
template/js/admin-wpadm.js ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ function blick(id)
42
+ {
43
+ jQuery('#' + id).css({
44
+ outline: "0px solid #ffba00",
45
+ border: "0px"
46
+ }).animate({
47
+ outlineWidth: '10px',
48
+ outlineColor: '#ffba00'
49
+ }, 500).animate({outlineWidth: '0px',outlineColor: '#0096d6' } , 500);
50
+
51
+ setTimeout('blick("' + id + '")', 2000);
52
+ }
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,518 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ <h2>DropBox Full Backup (files+database) bei WPAdm</h2>
5
+ <?php if (!empty($error)) {
6
+ echo '<div class="error" style="text-align: center; color: red; font-weight:bold;">
7
+ <p style="font-size: 16px;">
8
+ ' . $error . '
9
+ </p></div>';
10
+ }?>
11
+ <?php if (!empty($msg)) {
12
+ echo '<div class="updated" style="text-align: center; color: red; font-weight:bold;">
13
+ <p style="font-size: 16px;">
14
+ ' . $msg . '
15
+ </p></div>';
16
+ }?>
17
+ <script>
18
+ var global={};
19
+ function blickForm(id, t)
20
+ {
21
+ if(t.checked == true) {
22
+ t.checked = false;
23
+ }
24
+ l = jQuery('#' + id).length;
25
+ showRegistInfo(false);
26
+ if (l > 0) {
27
+ blick(id);
28
+ }
29
+ }
30
+ function showRegistInfo(show)
31
+ {
32
+ display = jQuery('#cf_activate').css('display');
33
+ if (display == 'none') {
34
+ jQuery('#cf_activate').show('slow');
35
+ jQuery('#registr-show').html("Hide");
36
+ jQuery('#title-regisr').css("padding" , "0px 0px");
37
+ jQuery('#registr-choice-icon').removeClass("dashicons-arrow-down").addClass('dashicons-arrow-up');
38
+ } else {
39
+ if (show) {
40
+ jQuery('#cf_activate').hide('slow');
41
+ jQuery('#registr-show').html("Show");
42
+ jQuery('#title-regisr').css("padding" , "20px 0px");
43
+ jQuery('#registr-choice-icon').removeClass("dashicons-arrow-up").addClass('dashicons-arrow-down');
44
+ }
45
+ }
46
+ }
47
+ process_flag = 0;
48
+ function start_local_backup()
49
+ {
50
+ var data_backup = {
51
+ 'action': 'wpadm_local_backup',
52
+ };
53
+ jQuery("#logs-form").show("slow");
54
+ jQuery("#log-backup").html('');
55
+ jQuery(".title-logs").css('display', 'block');
56
+ jQuery(".title-status").css('display', 'none');
57
+ jQuery.ajax({
58
+ type: "POST",
59
+ url: ajaxurl,
60
+ data: data_backup,
61
+ beforeSend: function(){
62
+ process_flag = 1
63
+ processBar();
64
+ showTime();
65
+
66
+ },
67
+ success: function(data){
68
+ process_flag = 0;
69
+ if (data.result == 'success') {
70
+ jQuery('.title-logs').css('display', 'none');
71
+ jQuery('.title-status').css({'display':'block', 'color':'green'});
72
+ jQuery('.title-status').html('Local Backup was created successfully');
73
+ } else {
74
+ jQuery('.title-logs').css('display', 'none');
75
+ jQuery('.title-status').css({'display':'block', 'color':'red'});
76
+ jQuery('.title-status').html('Local Backup wasn\'t created');
77
+ }
78
+ showData(data);
79
+ jQuery('.table').css('display', 'table');
80
+
81
+ },
82
+ error: function(){
83
+ processStop();
84
+ },
85
+ dataType: 'json'
86
+ });
87
+ }
88
+ function showData(data)
89
+ {
90
+ size_backup = data.size / 1024 / 1024;
91
+ info = "";
92
+ for(i = 0; i < data.data.length; i++) {
93
+ e = data.data[i].split('/');
94
+ info += '<tr style="border: 0;">' +
95
+ '<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>' +
96
+ '</tr>' ;
97
+ }
98
+ count = jQuery('.number-backup').length + 1;
99
+ jQuery('.table > tbody:last').after(
100
+ '<tr>'+
101
+ '<td class="pointer" onclick="shows(\'' + data.md5_data + '\')">' +
102
+ count +
103
+ '</td>' +
104
+ '<td class="pointer" onclick="shows(\'' + data.md5_data + '\')" style="text-align: left; padding-left: 7px;" >' +
105
+ data.time +
106
+ '</td>' +
107
+ '<td class="pointer" onclick="shows(\'' + data.md5_data + '\')">' +
108
+ data.name +
109
+ '</td>' +
110
+ '<td class="pointer" onclick="shows(\'' + data.md5_data + '\')">' +
111
+ data.counts +
112
+ '</td>' +
113
+ '<td class="pointer" onclick="shows(\'' + data.md5_data + '\')">' +
114
+ '<img src="<?php echo plugin_dir_url(__FILE__) . "/ok.png" ;?>" title="Successful" alt="Successful" style="float: left;" />'+
115
+ '<div style="margin-top :7px;float: left;"><?php echo 'Successful';?></div>' +
116
+ '</td>' +
117
+ '<td class="pointer" onclick="shows(\'' + data.md5_data + '\')">' +
118
+ data.type + ' backup' +
119
+ '</td>' +
120
+ '<td class="pointer" onclick="shows(\'' + data.md5_data + '\')">' +
121
+ size_backup.toFixed(2) + "Mb" +
122
+ '</td>' +
123
+ '<td>' +
124
+ '<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;' +
125
+ '<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;' +
126
+ '</td>' +
127
+ '</tr>'+
128
+ '<tr id="' + data.md5_data + '" style="display: none;">'+
129
+ '<td colspan="2">' +
130
+ '</td>' +
131
+ '<td align="center" style="padding: 0px; width: 350px;">' +
132
+ '<div style="overflow: auto; max-height: 150px;">' +
133
+ '<table border="0" align="center" style="width: 100%;" class="info-path">' +
134
+ info +
135
+ '</table>' +
136
+ '</div>' +
137
+ '</td>' +
138
+ '<td colspan="6"></td>' +
139
+ '</tr>')
140
+ }
141
+ var logs = [];
142
+ function processBar()
143
+ {
144
+ var data_log = {
145
+ 'action': 'wpadm_logs',
146
+ };
147
+ jQuery.ajax({
148
+ type: "POST",
149
+ url: ajaxurl,
150
+ data: data_log,
151
+ success: function(response){
152
+ eval("var data=" + response);
153
+ for(s in data.log) {
154
+ if (jQuery.inArray(s , logs) == -1) {
155
+ l = jQuery("#log-backup").html();
156
+ l = "<div>" + data.log[s] + "</div>" + l;
157
+ jQuery("#log-backup").html(l);
158
+ }
159
+ }
160
+ if (process_flag == 1) {
161
+ setTimeout('processBar()', 3000);
162
+ }
163
+ },
164
+ error: function(){
165
+ processStop();
166
+ },
167
+ });
168
+ }
169
+
170
+ function showTime(t)
171
+ {
172
+ if (process_flag == 1) {
173
+ if ( (typeof t) == 'undefined') {
174
+ t = 1;
175
+ } else {
176
+ t = t + 1;
177
+ }
178
+ time = t + " sec.";
179
+ jQuery("#time_backup").html(time);
180
+ setTimeout(function() { showTime(t) }, 1000);
181
+ }
182
+ }
183
+ function processStop()
184
+ {
185
+ process_flag = 0;
186
+ }
187
+ function delete_backup(backup, type)
188
+ {
189
+ document.delete_backups.backup_name.value = backup;
190
+ document.delete_backups.backup_type.value = type;
191
+ document.delete_backups.submit();
192
+ }
193
+ function create_backup (type) {
194
+ if (type == 'registr') {
195
+ showRegistInfo(false);
196
+ if (bl === false) {
197
+ blick('container-user');
198
+ bl = true;
199
+ }
200
+ } else if (type == 'auth') {
201
+ document.form_auth_backup_create.submit();
202
+ }
203
+ }
204
+ function show_recovery_form(type, name)
205
+ {
206
+ if (type == 'local') {
207
+ var data_backup = {
208
+ 'action': 'wpadm_local_restore',
209
+ 'name': name,
210
+ };
211
+ jQuery("#log-backup").html('');
212
+ jQuery(".title-logs").css('display', 'block');
213
+ jQuery(".title-status").css('display', 'none');
214
+ jQuery("#logs-form").show("slow");
215
+ jQuery.ajax({
216
+ type: "POST",
217
+ url: ajaxurl,
218
+ data: data_backup,
219
+ beforeSend: function(){
220
+ process_flag = 1
221
+ processBar();
222
+ showTime();
223
+
224
+ },
225
+ success: function(data){
226
+ process_flag = 0;
227
+ if (data.result == 'success') {
228
+ jQuery('.title-logs').css('display', 'none');
229
+ jQuery('.title-status').css({'display':'block', 'color':'green'});
230
+ jQuery('.title-status').html('Local Backup(' + name + ') was restore is successfully');
231
+ } else {
232
+ jQuery('.title-logs').css('display', 'none');
233
+ jQuery('.title-status').css({'display':'block', 'color':'red'});
234
+ jQuery('.title-status').html('Local Backup(' + name + ') wasn\'t restore');
235
+ }
236
+ },
237
+ error: function(){
238
+ processStop();
239
+ },
240
+ dataType: 'json'
241
+ });
242
+ } else {
243
+ jQuery('#recovery-backup').arcticmodal({
244
+ beforeOpen: function(data, el) {
245
+ jQuery("#recovery-backup").css('display', 'block');
246
+ jQuery('#wpadminbar').css('z-index', 1);
247
+ jQuery('.title-recover').find('span').html(type);
248
+ jQuery("#name_backup_restore").val(type);
249
+ },
250
+ afterClose: function(data, el) {
251
+ jQuery("#recovery-backup").css('display', 'none');
252
+ jQuery('#wpadminbar').css('z-index', 99999);
253
+ }
254
+ });
255
+ }
256
+ }
257
+ function auth_form(t)
258
+ {
259
+ var button = jQuery(t);
260
+ var form = button.closest('form');
261
+ var data = {};
262
+
263
+ var reg = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,6})+$/;
264
+ mail = document.auth.username.value;
265
+ send = false;
266
+ if (!reg.test(mail)) {
267
+ document.auth.username.style.border = "2px solid red";
268
+ } else {
269
+ document.auth.username.style.border = "1px solid #5b9dd9";
270
+ if(document.auth.password.value.length == 0) {
271
+ document.auth.password.style.border = "2px solid red";
272
+ } else {
273
+ send = true;
274
+ document.auth.password.style.border = "1px solid #5b9dd9";
275
+ }
276
+ }
277
+ if(send) {
278
+ form.find('#message-form').css('display', 'none');
279
+ data['password'] = document.auth.password.value;
280
+ data['username'] = document.auth.username.value;
281
+ backup = jQuery("#name_backup_restore").val();
282
+ jQuery.ajax({
283
+ url: form.attr('action'),
284
+ data: data,
285
+ type: 'POST',
286
+ dataType: 'json',
287
+ success: function(data) {
288
+ if( !data){
289
+ alert('error');
290
+ } else if(data.error) {
291
+ if(form.find('#message-form').length) {
292
+ form.find('#message-form').html("");
293
+ form.find('#message-form').css('display', 'block');
294
+ form.find('#message-form').html(data.error);
295
+ }
296
+ } else if(data.url) {
297
+ form.attr('action', data.url);
298
+ jQuery('#name_backups_restore_files').val(jQuery.param( global[backup] ))
299
+ jQuery.arcticmodal('close');
300
+ jQuery(form).submit();
301
+ }
302
+ }
303
+
304
+ });
305
+ }
306
+ }
307
+
308
+ </script>
309
+ <div id="recovery-backup" style="width: 500px; display: none;">
310
+ <div style="background: #fff; border-radius: 10px; height: 200px; border: 2px solid #0096d6;">
311
+ <form method="post" id="auth" name="auth" action="<?php echo SERVER_URL_INDEX . "login-process/" ; ?>" target="_blank">
312
+ <div class="title-recover" style="font-size: 16px; text-align: center;margin-bottom: 10px; margin-top: 15px;">
313
+ Backup Restore: <span style="font-size: 14px;"></span>
314
+ </div>
315
+ <div style="margin: 15px;">
316
+ <div id="message-form" style="color: red; float: left;"></div>
317
+ </div>
318
+ <div style="padding: 5px; height: 70px; clear: both;">
319
+ <div style="padding-top: 0px;margin-bottom: 5px; float: left;">
320
+ <div style="margin-top: 10px;">
321
+ <input class="input-small" type="email" required="required" name="username" placeholder="Email" />
322
+ </div>
323
+ <div style="margin-top: 10px;">
324
+ <input class="input-small" type="password" required="required" name="password" placeholder="Password" />
325
+ </div>
326
+
327
+ </div>
328
+ <div style="height: 40px; float: left; padding-top: 0px;margin-top:10px; margin-left: 10px; color: #939393; width: 55%;">
329
+ Enter for Restore your backup. It is necessary for the proper functionality of your site.
330
+ </div>
331
+ </div>
332
+ <div style="margin-top: 20px; clear: both; text-align: center;">
333
+ <input type="hidden" id="name_backup_restore" value="">
334
+ <input type="hidden" id="name_backups_restore_files" name="name_backups_restore_files" value="">
335
+ <input type="hidden" id="url" name="<?php echo get_option('siteurl')?>" value="">
336
+ <input class="button-wpadm" type="button" value="Next" onclick="auth_form(this);" />&nbsp;&nbsp;&nbsp;&nbsp;
337
+ <input class="button-wpadm wpadm-red" type="button" value="Cancel" onclick="jQuery.arcticmodal('close')" />
338
+ </div>
339
+ </form>
340
+ </div>
341
+ </div>
342
+
343
+ <div id="container-user" class="cfTabsContainer" style="width: 96%; padding-bottom: 0px; padding-top: 0px;">
344
+ <?php if ($show) {?>
345
+ <div class="stat-wpadm-info-title" id="title-regisr" style="padding :20px 0px; margin-top:11px;">
346
+ Free Sign Up to use more functionality...
347
+ </div>
348
+ <div id="cf_activate" class="cfContentContainer" style="display: none;">
349
+ <form method="post" action="<?php echo admin_url( 'admin-post.php?action=wpadm_activate_plugin' )?>" >
350
+ <div class="stat-wpadm-registr-info" style="">
351
+ <table class="form-table stat-table-registr" style="">
352
+ <tbody>
353
+ <tr valign="top">
354
+ <th scope="row">
355
+ <label for="email">E-mail</label>
356
+ </th>
357
+ <td>
358
+ <input id="email" class="" type="text" name="email" value="">
359
+ </td>
360
+ </tr>
361
+ <tr valign="top">
362
+ <th scope="row">
363
+ <label for="password">Password</label>
364
+ </th>
365
+ <td>
366
+ <input id="password" class="" type="password" name="password" value="">
367
+ </td>
368
+ </tr>
369
+ <tr valign="top">
370
+ <th scope="row">
371
+ <label for="password-confirm">Password confirm</label>
372
+ </th>
373
+ <td>
374
+ <input id="password-confirm" class="" type="password" name="password-confirm" value="">
375
+ </td>
376
+ </tr>
377
+ <tr valign="top">
378
+ <th scope="row">
379
+ </th>
380
+ <td>
381
+ <input class="button-wpadm" type="submit" value="Register & Activate" name="submit">
382
+ </td>
383
+ </tr>
384
+ </tbody>
385
+ </table>
386
+ </div>
387
+ <div class="stat-wpadm-info" id="registr-info" style="margin-bottom: 2px;">
388
+ <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).
389
+ </div>
390
+ </form>
391
+
392
+
393
+ </div>
394
+ <div class="clear"></div>
395
+ <div class="block-button-show" style="color: #fff;">
396
+ <div class="block-click" onclick="showRegistInfo(true);">
397
+ <span id="registr-show" style="color: #fff;">Show</span>
398
+ <div id="registr-choice-icon" class="dashicons dashicons-arrow-down" style=""></div>
399
+ </div>
400
+ </div>
401
+
402
+ <?php } ?>
403
+ </div>
404
+ <div id="logs-form" style="display: none; padding: 10px; background: #ffffc8; border: 1px solid #0096d6; position: relative; height: 70px; text-align: center;">
405
+ <div class="title-logs"><span style="font-size:16px;">Please wait... <span id="time_backup">0 sec.</span></span></div>
406
+ <div class="title-status" style="font-size:16px; display: none;"></div>
407
+ <div id="log-backup" style="overflow: auto; height: 50px; text-align: left; background: #fff;"></div>
408
+ </div>
409
+ <div>
410
+ <form action="<?php echo WPADM_URL_BASE;?>wpsite/recovery-backup" method="post" target="_blank" id="form_auth_backup" name="form_auth_backup">
411
+ </form>
412
+ <form action="<?php echo WPADM_URL_BASE;?>backup/tasks" method="post" target="_blank" id="form_auth_backup_create" name="form_auth_backup_create">
413
+ <input type="hidden" name="url_task_create" value="<?php echo get_option('siteurl');?>">
414
+ </form>
415
+ <form action="" method="post" id="form_auth_backup" name="form_auth_backup">
416
+ </form>
417
+ <form action="<?php echo admin_url( 'admin-post.php?action=wpadm_delete_backup' )?>" method="post" id="delete_backups" name="delete_backups">
418
+ <input type="hidden" name="backup-name" id="backup_name" value="" />
419
+ <input type="hidden" name="backup-type" id="backup_type" value="" />
420
+ </form>
421
+ <div style="margin-top: 30px;">
422
+ <a href="javascript:start_local_backup();" class="button-wpadm" style="color: #fff;">Create Local Backup</a> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
423
+ <a href="javascript:void(0);" class="button-wpadm" onclick="create_backup('<?php echo ($show) ? 'registr' : 'auth';?>')" style="color: #fff;">Create Dropbox Backup</a><br />
424
+ </div>
425
+ <style>
426
+ .pointer {
427
+ cursor: pointer;
428
+ }
429
+ </style>
430
+ <table class="table" style="margin-top: 5px; display: <?php echo isset($data['md5']) && ($n = count($data['data'])) && is_array($data['data'][0]) ? 'table' : 'none'?>;">
431
+ <thead>
432
+ <tr>
433
+ <th>#</th>
434
+ <th align="left">Created Date/Time</th>
435
+ <th>Name of Backup</th>
436
+ <th>Arhive Parts</th>
437
+ <th>Status</th>
438
+ <th>Type of Backup</th>
439
+ <th>Size</th>
440
+ <?php if(is_admin() || is_super_admin()) {?>
441
+ <th>Action</th>
442
+ <?php
443
+ }
444
+ ?>
445
+ </tr>
446
+ </thead>
447
+ <tbody>
448
+ <?php if (isset($data['md5']) && ($n = count($data['data'])) && is_array($data['data'][0])) {
449
+ for($i = 0; $i < $n; $i++) {
450
+ $size = $data['data'][$i]['size'] / 1024 / 1024; /// MByte
451
+ $size = round($size, 2);
452
+ ?>
453
+ <tr>
454
+ <td class="number-backup"><?php echo ($i + 1);?></td>
455
+ <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>
456
+ <td onclick="shows('<?php echo md5( print_r($data['data'][$i], 1) );?>')" class="pointer">
457
+ <?php echo $data['data'][$i]['name'];?>
458
+ <script type="text/javascript">
459
+ backup_name = '<?php echo $data['data'][$i]['name']?>';
460
+ global[backup_name] = {};
461
+ </script>
462
+ </td>
463
+ <td onclick="shows('<?php echo md5( print_r($data['data'][$i], 1) );?>')" class="pointer"><?php echo $data['data'][$i]['count'];?></td>
464
+ <td onclick="shows('<?php echo md5( print_r($data['data'][$i], 1) );?>')" class="pointer" style="padding: 0px;">
465
+ <img src="<?php echo plugin_dir_url(__FILE__) . "/ok.png" ;?>" title="Successful" alt="Successful" style="float: left;" />
466
+ <div style="margin-top :7px;float: left;"><?php echo 'Successful';?></div>
467
+ </td>
468
+ <td onclick="shows('<?php echo md5( print_r($data['data'][$i], 1) );?>')" class="pointer"><?php echo $data['data'][$i]['type'];?> backup</td>
469
+ <td onclick="shows('<?php echo md5( print_r($data['data'][$i], 1) );?>')" class="pointer"><?php echo $size . "Mb";?></td>
470
+ <?php if(is_admin() || is_super_admin()) {?>
471
+ <td>
472
+ <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;
473
+ <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;
474
+ </td>
475
+ <?php
476
+ }
477
+ ?>
478
+ </tr>
479
+ <tr id="<?php echo md5( print_r($data['data'][$i], 1) );?>" style="display:none; ">
480
+ <td colspan="2">
481
+ </td>
482
+ <td align="center" style="padding: 0px; width: 350px;">
483
+ <div style="overflow: auto; max-height: 150px;">
484
+ <?php
485
+ $files = explode(",", str_replace(array('"', "[", "]"), "", $data['data'][$i]['files'] ) );
486
+ $f = count($files);
487
+ if ($f > 0) { ?>
488
+ <table border="0" align="center" class="info-path"> <?php
489
+ for($j = 0; $j < $f; $j++) {
490
+ if (!empty($files[$j])) {
491
+ ?>
492
+ <tr style="border: 0;">
493
+ <td style="border: 0;"><a href="<?php echo get_option('siteurl') . "/wpadm_backups/{$data['data'][$i]['name']}/{$files[$j]}"?>"><?php echo $files[$j]; ?></a>
494
+
495
+ </td>
496
+ </tr>
497
+ <?php
498
+ }
499
+ }
500
+ ?>
501
+ </table>
502
+ <?php
503
+ }
504
+ ?>
505
+ </div>
506
+ </td>
507
+ <td colspan="6"></td>
508
+ </tr>
509
+ <?php
510
+ } ?>
511
+
512
+ <?php } ?>
513
+ </tbody>
514
+ </table>
515
+
516
+ </div>
517
+
518
+ </div>
wpadm-class-wp.php ADDED
@@ -0,0 +1,277 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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_logs', array('wpadm_wp_full_backup_dropbox', 'getLog') );
16
+ add_action('wp_ajax_wpadm_local_backup', array('wpadm_wp_full_backup_dropbox', 'local_backup') );
17
+
18
+ add_action('admin_post_wpadm_delete_backup', array('wpadm_wp_full_backup_dropbox', 'delete_backup') );
19
+ add_action('admin_post_wpadm_download', array('wpadm_wp_full_backup_dropbox', 'download') );
20
+
21
+ class wpadm_wp_full_backup_dropbox extends wpadm_class {
22
+
23
+ const MIN_PASSWORD = 6;
24
+
25
+ public static function local_backup()
26
+ {
27
+ require_once dirname(__FILE__) . "/class-wpadm-core.php";
28
+ @session_write_close();
29
+ parent::$type = 'full';
30
+ if (file_exists(WPAdm_Core::getTmpDir() . "/logs2")) {
31
+ unlink(WPAdm_Core::getTmpDir() . "/logs2");
32
+ }
33
+ $backup = new WPAdm_Core(array('method' => "local_backup", 'params' => array('optimize' => 1, 'limit' => 0, 'types' => array('db', 'files') )), 'full_backup_dropbox', dirname(__FILE__));
34
+ $res = $backup->getResult()->toArray();
35
+ $res['md5_data'] = md5( print_r($res, 1) );
36
+ $res['name'] = $backup->name;
37
+ $res['time'] = $backup->time;
38
+ $res['type'] = 'local';
39
+ $res['counts'] = count($res['data']);
40
+
41
+ @session_start();
42
+ echo json_encode($res);
43
+ wp_die();
44
+
45
+ }
46
+ public static function getLog()
47
+ {
48
+ @session_write_close();
49
+ @session_start();
50
+ require_once dirname(__FILE__) . "/class-wpadm-core.php";
51
+ $backup = new WPAdm_Core(array('method' => "local"), 'full_backup_dropbox', dirname(__FILE__));
52
+ $log = WPAdm_Core::getLog();
53
+ $log2 = WPAdm_Core::getTmpDir() . "/logs2";
54
+ if (file_exists($log2)) {
55
+ $text = file_get_contents($log2);
56
+ $log = str_replace($text, "", $log);
57
+ file_put_contents($log2, $log);
58
+ } else {
59
+ file_put_contents($log2, $log);
60
+ }
61
+ $log = explode("\n", $log);
62
+ krsort($log);
63
+ echo json_encode(array('log' => $log));
64
+
65
+ exit;
66
+ }
67
+ public static function restore_backup()
68
+ {
69
+ require_once dirname(__FILE__) . "/class-wpadm-core.php";
70
+ @session_write_close();
71
+ parent::$type = 'full';
72
+ if (file_exists(WPAdm_Core::getTmpDir() . "/logs2")) {
73
+ unlink(WPAdm_Core::getTmpDir() . "/logs2");
74
+ }
75
+ $name_backup = isset($_POST['name']) ? trim($_POST['name']) : "";
76
+ $backup = new WPAdm_Core(array('method' => "local_restore", 'params' => array('types' => array('files', 'db'), 'name_backup' => $name_backup )), 'full_backup_dropbox', dirname(__FILE__));
77
+ $res = $backup->getResult()->toArray();
78
+ @session_start();
79
+ echo json_encode($res);
80
+ wp_die();
81
+ }
82
+ public static function download()
83
+ {
84
+ if (isset($_REQUEST['backup'])) {
85
+ require_once dirname(__FILE__) . "/class-wpadm-core.php";
86
+ require_once dirname(__FILE__) . '/modules/pclzip.lib.php';
87
+ $backup = new WPAdm_Core(array('method' => "local"), 'full_backup_dropbox', dirname(__FILE__));
88
+ $filename = $_REQUEST['backup'] . ".zip";
89
+ $file = WPAdm_Core::getTmpDir() . "/" . $filename;
90
+ if (file_exists($file)) {
91
+ unlink($file);
92
+ }
93
+ $archive = new PclZip($file);
94
+ $dir_backup = ABSPATH . 'wpadm_backups/' . $_REQUEST['backup'];
95
+
96
+ $backups = array('data' => array(), 'md5' => '');
97
+ if (is_dir($dir_backup)) {
98
+ $i = 0;
99
+ $dir_open = opendir($dir_backup);
100
+ while($d = readdir($dir_open)) {
101
+ if ($d != '.' && $d != '..' && file_exists($dir_backup . "/$d") && substr($d, -3) != "php") {
102
+ $archive->add($dir_backup . "/$d", PCLZIP_OPT_REMOVE_PATH, ABSPATH . 'wpadm_backups');
103
+ }
104
+ }
105
+ }
106
+
107
+
108
+ $now = gmdate("D, d M Y H:i:s");
109
+ header("Expires: Tue, 03 Jul 2001 06:00:00 GMT");
110
+ header("Cache-Control: max-age=0, no-cache, must-revalidate, proxy-revalidate");
111
+ header("Last-Modified: {$now} GMT");
112
+
113
+ // force download
114
+ header("Content-Type: application/force-download");
115
+ header("Content-Type: application/octet-stream");
116
+ header("Content-Type: application/download");
117
+
118
+ // disposition / encoding on response body
119
+ header("Content-Disposition: attachment;filename={$filename}");
120
+ header("Content-Transfer-Encoding: binary");
121
+
122
+ ob_start();
123
+ $df = fopen("php://output", 'w');
124
+ echo file_get_contents($file);
125
+ fclose($df);
126
+ echo ob_get_clean();
127
+ unlink($file);
128
+ exit;
129
+ }
130
+ }
131
+
132
+ public static function delete_backup()
133
+ {
134
+ if (isset($_POST['backup-type']) && $_POST['backup-type'] == 'local') {
135
+ require_once dirname(__FILE__) . "/class-wpadm-core.php";
136
+ $dir = ABSPATH . 'wpadm_backups/' . $_POST['backup-name'] ;
137
+ if (is_dir($dir)) {
138
+ WPAdm_Core::rmdir($dir);
139
+ }
140
+ }
141
+ header("Location: " . admin_url("admin.php?page=wpadm_wp_full_backup_dropbox"));
142
+ }
143
+
144
+ public static function activatePlugin()
145
+ {
146
+ if (isset($_POST['email']) && isset($_POST['password']) && isset($_POST['password-confirm'])) {
147
+ $email = trim(stripslashes(strip_tags($_POST['email'])));
148
+ $password = trim(strip_tags($_POST['password']));
149
+ $password_confirm = trim(strip_tags($_POST['password-confirm']));
150
+ $sent = true;
151
+ if (empty($email)) {
152
+ parent::setError("Error, Email is empty.");
153
+ $sent = false;
154
+ }
155
+ if (!preg_match("/^([a-z0-9_\-]+\.)*[a-z0-9_\-]+@([a-z0-9][a-z0-9\-]*[a-z0-9]\.)+[a-z]{2,4}$/i", $email)) {
156
+ parent::setError("Error, Incorrect Email");
157
+ $sent = false;
158
+ }
159
+ if (empty($password)) {
160
+ parent::setError("Error, Password is empty.");
161
+ $sent = false;
162
+ }
163
+ if (strlen($password) < self::MIN_PASSWORD) {
164
+ parent::setError("Error, the minimum number of characters for the password \"" . self::MIN_PASSWORD . "\".");
165
+ $sent = false;
166
+ }
167
+
168
+ if ($password != $password_confirm) {
169
+ parent::setError("Error, passwords do not match");
170
+ $sent = false;
171
+ }
172
+ if ($sent) {
173
+ $info = self::getPluginName();
174
+ $data = parent::sendToServer(
175
+ array(
176
+ 'actApi' => "activate",
177
+ 'email' => $email,
178
+ 'password' => $password,
179
+ 'url' => get_option("siteurl"),
180
+ 'plugin' => $info,
181
+ )
182
+ );
183
+ parent::setResponse($data);
184
+ }
185
+ }
186
+ header("Location: " . admin_url("admin.php?page=wpadm_wp_full_backup_dropbox"));
187
+ }
188
+
189
+ protected static function getPluginName()
190
+ {
191
+
192
+ preg_match("|wpadm_wp_(.*)|", __CLASS__, $m);
193
+ return $m[1];
194
+ }
195
+ protected static function getPathPlugin()
196
+ {
197
+ return "wpadm_full_backup_dropbox";
198
+ }
199
+
200
+
201
+ public static function wpadm_show_backup()
202
+ {
203
+
204
+ $show = !get_option('wpadm_pub_key') && is_super_admin();
205
+ if (!$show) {
206
+ $data = parent::sendToServer(
207
+ array(
208
+ 'actApi' => 'backupsCache',
209
+ 'public_key' => get_option('wpadm_pub_key'),
210
+ 'storage' => 'dropbox',
211
+ 'type' => 'full',
212
+ )
213
+ );
214
+ }
215
+ parent::$type = 'full';
216
+ $data_local = parent::read_backups();
217
+ if (isset($data['data'])) {
218
+ $data['data'] = array_merge($data_local['data'], $data['data']);
219
+ } else {
220
+ $data = $data_local;
221
+ }
222
+
223
+ $error = parent::getError(true);
224
+ $msg = parent::getMessage(true);
225
+ ob_start();
226
+ require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . "template/wpadm_show_backup.php";
227
+ echo ob_get_clean();
228
+ }
229
+
230
+
231
+ public static function draw_menu()
232
+ {
233
+ $menu_position = '1.9998887771';
234
+ if(self::checkInstallWpadmPlugins()) {
235
+ $page = add_menu_page(
236
+ 'WPAdm',
237
+ 'WPAdm',
238
+ "read",
239
+ 'wpadm_plugins',
240
+ 'wpadm_plugins',
241
+ plugins_url('/wpadm-logo.png', __FILE__),
242
+ $menu_position
243
+ );
244
+ add_submenu_page(
245
+ 'wpadm_plugins',
246
+ "Dropbox Full Backup",
247
+ "Dropbox Full Backup",
248
+ 'read',
249
+ 'wpadm_wp_full_backup_dropbox',
250
+ array('wpadm_wp_full_backup_dropbox', 'wpadm_show_backup')
251
+ );
252
+ } else {
253
+ $page = add_menu_page(
254
+ 'Dropbox Full Backup',
255
+ 'Dropbox Full Backup',
256
+ "read",
257
+ 'wpadm_wp_full_backup_dropbox',
258
+ array('wpadm_wp_full_backup_dropbox', 'wpadm_show_backup'),
259
+ plugins_url('/wpadm-logo.png', __FILE__),
260
+ $menu_position
261
+ );
262
+
263
+ add_submenu_page(
264
+ 'wpadm_wp_full_backup_dropbox',
265
+ "WPAdm",
266
+ "WPAdm",
267
+ 'read',
268
+ 'wpadm_plugins',
269
+ 'wpadm_plugins'
270
+ );
271
+ }
272
+
273
+ }
274
+ }
275
+ }
276
+
277
+ ?>
wpadm.php CHANGED
@@ -1,106 +1,47 @@
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
 
@@ -151,7 +92,8 @@ if ( ! function_exists('wpadm_send_blog_info')) {
151
  if ( ! function_exists('wpadm_get_blog_info')) {
152
  function wpadm_get_blog_info() {
153
  $info = array(
154
- 'url' => get_site_url(),
 
155
  );
156
  $debug = debug_backtrace();
157
  $info['debug'] = $debug;
@@ -163,87 +105,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
+ if ( ! function_exists( 'wpadm_run' )) {
8
+ function wpadm_run($pl, $dir) {
9
+ @set_time_limit(0);
10
+ require_once dirname(__FILE__) . '/class-wpadm-method-class.php';
11
+ $request_name = $pl . '_request';
12
+ if( isset( $_POST[$request_name] ) && ! empty ( $_POST[$request_name] ) ) {
13
+ require_once dirname(__FILE__) . '/class-wpadm-core.php';
14
+ $wpadm = new WPAdm_Core(wpadm_unpack($_POST[$request_name]), $pl, $dir);
15
+ echo '<wpadm>'.wpadm_pack($wpadm->getResult()->toArray()).'</wpadm>';
16
+ exit;
 
 
 
 
 
 
 
 
 
 
17
  }
18
  }
19
+ }
20
 
21
 
22
+ if ( ! function_exists( 'wpadm_unpack' )) {
23
+ /**
24
+ * @param str $str
25
+ * @return mixed
26
+ */
27
+ function wpadm_unpack( $str ) {
28
+ return unserialize( base64_decode( $str ) );
 
29
  }
30
+ }
31
 
32
+ if ( ! function_exists('wpadm_pack')) {
33
+ /**
34
+ * @param mixed $value
35
+ * @return string
36
+ */
37
+ function wpadm_pack( $value ) {
38
+ return base64_encode( serialize ( $value ) ) ;
 
39
  }
40
+ }
41
 
42
+ if ( ! function_exists('wpadm_admin_notice')) {
43
+ function wpadm_admin_notice() {
44
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
45
  }
46
  }
47
 
92
  if ( ! function_exists('wpadm_get_blog_info')) {
93
  function wpadm_get_blog_info() {
94
  $info = array(
95
+ 'url' => get_site_url(),
96
+ 'email' => get_settings('admin_email')
97
  );
98
  $debug = debug_backtrace();
99
  $info['debug'] = $debug;
105
  }
106
  }
107