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