Version Description
- 11-11-19 =
- Fixed: WordPress 5.3 compatibility problems
- Fixed: an issue with managing BackWPup backups
- Updated: multiple error messages
- Removed: unused code
Download this release
Release Info
Developer | mainwp |
Plugin | MainWP Child |
Version | 4.0.4 |
Comparing to | |
See all releases |
Code changes from version 4.0.3 to 4.0.4
- class/class-mainwp-child-back-wp-up.php +41 -7
- class/class-mainwp-child.php +23 -17
- class/class-mainwp-helper.php +3 -3
- class/class-mainwp-keyword-links.php +1 -1
- mainwp-child.php +1 -1
- readme.txt +8 -2
class/class-mainwp-child-back-wp-up.php
CHANGED
@@ -72,7 +72,13 @@ class MainWP_Child_Back_WP_Up {
|
|
72 |
|
73 |
if ( is_plugin_active( 'backwpup-pro/backwpup.php' ) && file_exists( plugin_dir_path( __FILE__ ) . '../../backwpup-pro/backwpup.php' ) ) {
|
74 |
$file_path1 = plugin_dir_path( __FILE__ ) . '../../backwpup-pro/backwpup.php';
|
75 |
-
$file_path2 = plugin_dir_path( __FILE__ ) . '../../backwpup-pro/inc/
|
|
|
|
|
|
|
|
|
|
|
|
|
76 |
MainWP_Helper::check_files_exists(array( $file_path1, $file_path2 ));
|
77 |
require_once( $file_path1 );
|
78 |
require_once( $file_path2 );
|
@@ -90,7 +96,8 @@ class MainWP_Child_Back_WP_Up {
|
|
90 |
MainWP_Helper::check_methods('get_instance');
|
91 |
BackWPup::get_instance();
|
92 |
|
93 |
-
add_action( 'wp_ajax_mainwp_backwpup_download_backup', array( $this, 'download_backup' ) );
|
|
|
94 |
add_filter( 'mainwp-site-sync-others-data', array( $this, 'syncOthersData' ), 10, 2 );
|
95 |
}
|
96 |
} catch ( Exception $e) {
|
@@ -748,6 +755,17 @@ class MainWP_Child_Back_WP_Up {
|
|
748 |
'&',
|
749 |
admin_url( 'admin-ajax.php' ) . '?action=mainwp_backwpup_download_backup&type=',
|
750 |
), $temp_array['downloadurl'] . '&_wpnonce=' . $this->create_nonce_without_session( 'mainwp_download_backup' ) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
751 |
$temp_array['website_id'] = $website_id;
|
752 |
|
753 |
if ( ! isset( $without_dupes[ $temp_array['file'] ] ) ) {
|
@@ -765,7 +783,23 @@ class MainWP_Child_Back_WP_Up {
|
|
765 |
return array( 'success' => 1, 'response' => $array );
|
766 |
}
|
767 |
|
768 |
-
public function
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
769 |
if ( ! isset( $_GET['type'] ) || empty( $_GET['type'] ) || ! isset( $_GET['_wpnonce'] ) || empty( $_GET['_wpnonce'] ) ) {
|
770 |
die( '-1' );
|
771 |
}
|
@@ -777,21 +811,21 @@ class MainWP_Child_Back_WP_Up {
|
|
777 |
if ( ! $this->verify_nonce_without_session( $_GET['_wpnonce'], 'mainwp_download_backup' ) ) {
|
778 |
die( '-3' );
|
779 |
}
|
780 |
-
|
781 |
$dest = strtoupper( str_replace( 'download', '', $_GET['type'] ) );
|
782 |
if ( ! empty( $dest ) && strstr( $_GET['type'], 'download' ) ) {
|
783 |
$dest_class = BackWPup::get_destination( $dest );
|
784 |
if ( is_null( $dest_class ) ) {
|
785 |
die( '-4' );
|
786 |
-
}
|
787 |
|
788 |
$dest_class->file_download( (int) $_GET['jobid'], $_GET['file'] );
|
789 |
} else {
|
790 |
die( '-5' );
|
791 |
-
|
792 |
|
793 |
die();
|
794 |
-
|
795 |
|
796 |
protected function create_nonce_without_session( $action = - 1 ) {
|
797 |
$user = wp_get_current_user();
|
72 |
|
73 |
if ( is_plugin_active( 'backwpup-pro/backwpup.php' ) && file_exists( plugin_dir_path( __FILE__ ) . '../../backwpup-pro/backwpup.php' ) ) {
|
74 |
$file_path1 = plugin_dir_path( __FILE__ ) . '../../backwpup-pro/backwpup.php';
|
75 |
+
$file_path2 = plugin_dir_path( __FILE__ ) . '../../backwpup-pro/inc/Pro/class-pro.php';
|
76 |
+
|
77 |
+
// to fix
|
78 |
+
if ( ! file_exists( $file_path2 ) ) {
|
79 |
+
$file_path2 = plugin_dir_path( __FILE__ ) . '../../backwpup-pro/inc/pro/class-pro.php';
|
80 |
+
}
|
81 |
+
|
82 |
MainWP_Helper::check_files_exists(array( $file_path1, $file_path2 ));
|
83 |
require_once( $file_path1 );
|
84 |
require_once( $file_path2 );
|
96 |
MainWP_Helper::check_methods('get_instance');
|
97 |
BackWPup::get_instance();
|
98 |
|
99 |
+
//add_action( 'wp_ajax_mainwp_backwpup_download_backup', array( $this, 'download_backup' ) );
|
100 |
+
add_action( 'admin_init', array( $this, 'init_download_backup' ) );
|
101 |
add_filter( 'mainwp-site-sync-others-data', array( $this, 'syncOthersData' ), 10, 2 );
|
102 |
}
|
103 |
} catch ( Exception $e) {
|
755 |
'&',
|
756 |
admin_url( 'admin-ajax.php' ) . '?action=mainwp_backwpup_download_backup&type=',
|
757 |
), $temp_array['downloadurl'] . '&_wpnonce=' . $this->create_nonce_without_session( 'mainwp_download_backup' ) );
|
758 |
+
|
759 |
+
$temp_array['downloadurl_id'] = '/wp-admin/admin.php?page=backwpupbackups';
|
760 |
+
if ( preg_match( '/.*&jobid=([^&]+)&.*/is', $temp_array['downloadurl'], $matches )) {
|
761 |
+
if ( !empty( $matches[1] ) && is_numeric( $matches[1] ) ) {
|
762 |
+
$temp_array['downloadurl_id'] .= '&download_click_id=' . $matches[1];
|
763 |
+
}
|
764 |
+
error_log('did match' . print_r($matches, true));
|
765 |
+
} else {
|
766 |
+
error_log('not match');
|
767 |
+
}
|
768 |
+
|
769 |
$temp_array['website_id'] = $website_id;
|
770 |
|
771 |
if ( ! isset( $without_dupes[ $temp_array['file'] ] ) ) {
|
783 |
return array( 'success' => 1, 'response' => $array );
|
784 |
}
|
785 |
|
786 |
+
public function init_download_backup() {
|
787 |
+
if ( ! isset( $_GET['page'] ) || $_GET['page'] !== 'backwpupbackups' || !isset( $_GET['download_click_id'] ) || empty( $_GET['download_click_id'] )) {
|
788 |
+
return;
|
789 |
+
}
|
790 |
+
?>
|
791 |
+
<script type="text/javascript">
|
792 |
+
document.addEventListener("DOMContentLoaded", function(event) {
|
793 |
+
var downloadLink = document.querySelector( 'a.backup-download-link[data-jobid="<?php echo intval($_GET['download_click_id']); ?>"' );
|
794 |
+
if (typeof(downloadLink) !== 'undefined' && downloadLink !== null) {
|
795 |
+
downloadLink.click();
|
796 |
+
}
|
797 |
+
});
|
798 |
+
</script>
|
799 |
+
<?php
|
800 |
+
}
|
801 |
+
|
802 |
+
public function download_backup() {
|
803 |
if ( ! isset( $_GET['type'] ) || empty( $_GET['type'] ) || ! isset( $_GET['_wpnonce'] ) || empty( $_GET['_wpnonce'] ) ) {
|
804 |
die( '-1' );
|
805 |
}
|
811 |
if ( ! $this->verify_nonce_without_session( $_GET['_wpnonce'], 'mainwp_download_backup' ) ) {
|
812 |
die( '-3' );
|
813 |
}
|
814 |
+
|
815 |
$dest = strtoupper( str_replace( 'download', '', $_GET['type'] ) );
|
816 |
if ( ! empty( $dest ) && strstr( $_GET['type'], 'download' ) ) {
|
817 |
$dest_class = BackWPup::get_destination( $dest );
|
818 |
if ( is_null( $dest_class ) ) {
|
819 |
die( '-4' );
|
820 |
+
}
|
821 |
|
822 |
$dest_class->file_download( (int) $_GET['jobid'], $_GET['file'] );
|
823 |
} else {
|
824 |
die( '-5' );
|
825 |
+
}
|
826 |
|
827 |
die();
|
828 |
+
}
|
829 |
|
830 |
protected function create_nonce_without_session( $action = - 1 ) {
|
831 |
$user = wp_get_current_user();
|
class/class-mainwp-child.php
CHANGED
@@ -115,7 +115,7 @@ if ( isset( $_GET['skeleton_keyuse_nonce_key'] ) && isset( $_GET['skeleton_keyus
|
|
115 |
}
|
116 |
|
117 |
class MainWP_Child {
|
118 |
-
public static $version = '4.0.
|
119 |
private $update_version = '1.5';
|
120 |
|
121 |
private $callableFunctions = array(
|
@@ -1442,11 +1442,11 @@ class MainWP_Child {
|
|
1442 |
$auth = $this->auth( isset( $_POST['mainwpsignature'] ) ? $_POST['mainwpsignature'] : '', isset( $_POST['function'] ) ? $_POST['function'] : '', isset( $_POST['nonce'] ) ? $_POST['nonce'] : '', isset( $_POST['nossl'] ) ? $_POST['nossl'] : 0 );
|
1443 |
|
1444 |
if ( ! $auth && isset( $_POST['mainwpsignature'] ) ) {
|
1445 |
-
MainWP_Helper::error( __( 'Authentication failed! Please deactivate
|
1446 |
}
|
1447 |
|
1448 |
if ( ! $auth && isset( $_POST['function'] ) && isset( $this->callableFunctions[ $_POST['function'] ] ) && ! isset( $this->callableFunctionsNoAuth[ $_POST['function'] ] ) ) {
|
1449 |
-
MainWP_Helper::error( __( 'Authentication failed! Please deactivate
|
1450 |
}
|
1451 |
|
1452 |
$auth_user = false;
|
@@ -1470,11 +1470,11 @@ class MainWP_Child {
|
|
1470 |
}
|
1471 |
|
1472 |
if ( ! $user ) {
|
1473 |
-
MainWP_Helper::error( __( '
|
1474 |
}
|
1475 |
|
1476 |
if ( 10 != $user->wp_user_level && ( ! isset( $user->user_level ) || 10 != $user->user_level ) && ! $user->has_cap( 'level_10' ) ) {
|
1477 |
-
MainWP_Helper::error( __( '
|
1478 |
}
|
1479 |
|
1480 |
$this->login( $auth_user );
|
@@ -2404,7 +2404,7 @@ class MainWP_Child {
|
|
2404 |
// set disconnect status to yes here, it will empty after reconnected
|
2405 |
MainWP_Child_Branding::Instance()->save_branding_options('branding_disconnected', 'yes');
|
2406 |
MainWP_Helper::update_option( 'mainwp_child_branding_disconnected', 'yes', 'yes' ); // to compatible with old client reports
|
2407 |
-
MainWP_Helper::error( __( 'Public key already set. Please
|
2408 |
|
2409 |
}
|
2410 |
|
@@ -3032,7 +3032,13 @@ class MainWP_Child {
|
|
3032 |
//Read form data
|
3033 |
$new_user = maybe_unserialize( base64_decode( $_POST['new_user'] ) );
|
3034 |
$send_password = $_POST['send_password'];
|
3035 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
3036 |
$new_user_id = wp_insert_user( $new_user );
|
3037 |
|
3038 |
if ( is_wp_error( $new_user_id ) ) {
|
@@ -4926,17 +4932,17 @@ class MainWP_Child {
|
|
4926 |
|
4927 |
function search_users() {
|
4928 |
|
4929 |
-
|
4930 |
-
|
4931 |
|
4932 |
-
|
4933 |
-
|
4934 |
-
|
4935 |
-
|
4936 |
-
|
4937 |
-
|
4938 |
-
|
4939 |
-
|
4940 |
|
4941 |
$columns = explode( ',', $_POST['search_columns'] );
|
4942 |
$allusers = array();
|
115 |
}
|
116 |
|
117 |
class MainWP_Child {
|
118 |
+
public static $version = '4.0.4';
|
119 |
private $update_version = '1.5';
|
120 |
|
121 |
private $callableFunctions = array(
|
1442 |
$auth = $this->auth( isset( $_POST['mainwpsignature'] ) ? $_POST['mainwpsignature'] : '', isset( $_POST['function'] ) ? $_POST['function'] : '', isset( $_POST['nonce'] ) ? $_POST['nonce'] : '', isset( $_POST['nossl'] ) ? $_POST['nossl'] : 0 );
|
1443 |
|
1444 |
if ( ! $auth && isset( $_POST['mainwpsignature'] ) ) {
|
1445 |
+
MainWP_Helper::error( __( 'Authentication failed! Please deactivate & re-activate the MainWP Child plugin on this site and try again.', 'mainwp-child' ) );
|
1446 |
}
|
1447 |
|
1448 |
if ( ! $auth && isset( $_POST['function'] ) && isset( $this->callableFunctions[ $_POST['function'] ] ) && ! isset( $this->callableFunctionsNoAuth[ $_POST['function'] ] ) ) {
|
1449 |
+
MainWP_Helper::error( __( 'Authentication failed! Please deactivate & re-activate the MainWP Child plugin on this site and try again.', 'mainwp-child' ) );
|
1450 |
}
|
1451 |
|
1452 |
$auth_user = false;
|
1470 |
}
|
1471 |
|
1472 |
if ( ! $user ) {
|
1473 |
+
MainWP_Helper::error( __( 'Unexising administrator username. Please verify that it is an existing administrator.', 'mainwp-child' ) );
|
1474 |
}
|
1475 |
|
1476 |
if ( 10 != $user->wp_user_level && ( ! isset( $user->user_level ) || 10 != $user->user_level ) && ! $user->has_cap( 'level_10' ) ) {
|
1477 |
+
MainWP_Helper::error( __( 'Invalid user. Please verify that the user has administrator privileges.', 'mainwp-child' ) );
|
1478 |
}
|
1479 |
|
1480 |
$this->login( $auth_user );
|
2404 |
// set disconnect status to yes here, it will empty after reconnected
|
2405 |
MainWP_Child_Branding::Instance()->save_branding_options('branding_disconnected', 'yes');
|
2406 |
MainWP_Helper::update_option( 'mainwp_child_branding_disconnected', 'yes', 'yes' ); // to compatible with old client reports
|
2407 |
+
MainWP_Helper::error( __( 'Public key already set. Please deactivate & reactivate the MainWP Child plugin and try again.', 'mainwp-child' ) );
|
2408 |
|
2409 |
}
|
2410 |
|
3032 |
//Read form data
|
3033 |
$new_user = maybe_unserialize( base64_decode( $_POST['new_user'] ) );
|
3034 |
$send_password = $_POST['send_password'];
|
3035 |
+
// check role existed
|
3036 |
+
if (isset( $new_user['role'] )) {
|
3037 |
+
if ( !get_role( $new_user['role'] ) ) {
|
3038 |
+
$new_user['role'] = 'subscriber';
|
3039 |
+
}
|
3040 |
+
}
|
3041 |
+
|
3042 |
$new_user_id = wp_insert_user( $new_user );
|
3043 |
|
3044 |
if ( is_wp_error( $new_user_id ) ) {
|
4932 |
|
4933 |
function search_users() {
|
4934 |
|
4935 |
+
$search_user_role = array();
|
4936 |
+
$check_users_role = false;
|
4937 |
|
4938 |
+
if (isset($_POST['role']) && !empty($_POST['role'])) {
|
4939 |
+
$check_users_role = true;
|
4940 |
+
$all_users_role = $this->get_all_users(true);
|
4941 |
+
foreach($all_users_role as $user) {
|
4942 |
+
$search_user_role[] = $user['id'];
|
4943 |
+
}
|
4944 |
+
unset($all_users_role);
|
4945 |
+
}
|
4946 |
|
4947 |
$columns = explode( ',', $_POST['search_columns'] );
|
4948 |
$allusers = array();
|
class/class-mainwp-helper.php
CHANGED
@@ -887,9 +887,9 @@ class MainWP_Helper {
|
|
887 |
|
888 |
if ( empty( $wp_filesystem ) ) {
|
889 |
ob_start();
|
890 |
-
if ( file_exists( ABSPATH . '/wp-admin/includes/deprecated.php' ) ) {
|
891 |
-
include_once( ABSPATH . '/wp-admin/includes/deprecated.php' );
|
892 |
-
}
|
893 |
if ( file_exists( ABSPATH . '/wp-admin/includes/screen.php' ) ) {
|
894 |
include_once( ABSPATH . '/wp-admin/includes/screen.php' );
|
895 |
}
|
887 |
|
888 |
if ( empty( $wp_filesystem ) ) {
|
889 |
ob_start();
|
890 |
+
// if ( file_exists( ABSPATH . '/wp-admin/includes/deprecated.php' ) ) {
|
891 |
+
// include_once( ABSPATH . '/wp-admin/includes/deprecated.php' );
|
892 |
+
// }
|
893 |
if ( file_exists( ABSPATH . '/wp-admin/includes/screen.php' ) ) {
|
894 |
include_once( ABSPATH . '/wp-admin/includes/screen.php' );
|
895 |
}
|
class/class-mainwp-keyword-links.php
CHANGED
@@ -38,7 +38,7 @@ class MainWP_Keyword_Links {
|
|
38 |
|
39 |
|
40 |
public function keywordLinksJS() {
|
41 |
-
if ( ! is_admin() && get_option( 'mainwp_kwl_enable_statistic' ) ) {
|
42 |
wp_enqueue_script( 'jquery' );
|
43 |
wp_enqueue_script( 'keywordLinks', plugins_url( '/js/keywordlinks.js', dirname( __FILE__ ) ) );
|
44 |
add_action( 'wp_head', array( $this, 'head_loading' ), 1 );
|
38 |
|
39 |
|
40 |
public function keywordLinksJS() {
|
41 |
+
if ( ! is_admin() && get_option( 'mainwp_kwl_enable_statistic' ) && !empty($this->keyword_links) ) {
|
42 |
wp_enqueue_script( 'jquery' );
|
43 |
wp_enqueue_script( 'keywordLinks', plugins_url( '/js/keywordlinks.js', dirname( __FILE__ ) ) );
|
44 |
add_action( 'wp_head', array( $this, 'head_loading' ), 1 );
|
mainwp-child.php
CHANGED
@@ -6,7 +6,7 @@
|
|
6 |
Author: MainWP
|
7 |
Author URI: https://mainwp.com
|
8 |
Text Domain: mainwp-child
|
9 |
-
Version: 4.0.
|
10 |
*/
|
11 |
include_once( ABSPATH . 'wp-includes' . DIRECTORY_SEPARATOR . 'version.php' ); //Version information from wordpress
|
12 |
|
6 |
Author: MainWP
|
7 |
Author URI: https://mainwp.com
|
8 |
Text Domain: mainwp-child
|
9 |
+
Version: 4.0.4
|
10 |
*/
|
11 |
include_once( ABSPATH . 'wp-includes' . DIRECTORY_SEPARATOR . 'version.php' ); //Version information from wordpress
|
12 |
|
readme.txt
CHANGED
@@ -5,9 +5,9 @@ Author: mainwp
|
|
5 |
Author URI: https://mainwp.com
|
6 |
Plugin URI: https://mainwp.com
|
7 |
Requires at least: 3.6
|
8 |
-
Tested up to: 5.
|
9 |
Requires PHP: 5.6
|
10 |
-
Stable tag: 4.0.
|
11 |
License: GPLv2 or later
|
12 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
13 |
|
@@ -71,6 +71,12 @@ To see full documentation and FAQs please visit [MainWP Documentation](https://m
|
|
71 |
|
72 |
== Changelog ==
|
73 |
|
|
|
|
|
|
|
|
|
|
|
|
|
74 |
= 4.0.3 - 10-1-19 =
|
75 |
* Added: 'mainwp_child_branding_init_options' filter for disabling custom branding
|
76 |
* Updated: support for the WPVulnDB API v3
|
5 |
Author URI: https://mainwp.com
|
6 |
Plugin URI: https://mainwp.com
|
7 |
Requires at least: 3.6
|
8 |
+
Tested up to: 5.3
|
9 |
Requires PHP: 5.6
|
10 |
+
Stable tag: 4.0.4
|
11 |
License: GPLv2 or later
|
12 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
13 |
|
71 |
|
72 |
== Changelog ==
|
73 |
|
74 |
+
= 4.0.4 - 11-11-19 =
|
75 |
+
* Fixed: WordPress 5.3 compatibility problems
|
76 |
+
* Fixed: an issue with managing BackWPup backups
|
77 |
+
* Updated: multiple error messages
|
78 |
+
* Removed: unused code
|
79 |
+
|
80 |
= 4.0.3 - 10-1-19 =
|
81 |
* Added: 'mainwp_child_branding_init_options' filter for disabling custom branding
|
82 |
* Updated: support for the WPVulnDB API v3
|