Version Description
- 1-17-20 =
- Fixed: encoding problem in error messages
- Added: site ID parameter in the sync request
- Updated: MainWP_Child_WPvivid_BackupRestore class
- Preventative: security improvements
Download this release
Release Info
Developer | mainwp |
Plugin | MainWP Child |
Version | 4.0.6 |
Comparing to | |
See all releases |
Code changes from version 4.0.5.1 to 4.0.6
- class/class-mainwp-child-skeleton-key.php +1 -1
- class/class-mainwp-child-updraft-plus-backups.php +8 -1
- class/class-mainwp-child-wpvivid-backuprestore.php +10 -6
- class/class-mainwp-child.php +5 -1
- class/class-mainwp-client-report.php +34 -52
- class/class-mainwp-clone.php +3 -0
- class/class-mainwp-custom-post-type.php +12 -2
- class/class-mainwp-helper.php +22 -5
- class/class-mainwp-security.php +1 -1
- mainwp-child.php +1 -1
- readme.txt +9 -3
class/class-mainwp-child-skeleton-key.php
CHANGED
@@ -135,7 +135,7 @@ class MainWP_Child_Skeleton_Key {
|
|
135 |
$received_content = wp_remote_retrieve_body( $response );
|
136 |
|
137 |
if ( preg_match( '/<mainwp>(.*)<\/mainwp>/', $received_content, $received_result ) > 0 ) {
|
138 |
-
$received_content_mainwp = json_decode( base64_decode( $received_result[1] ), true );
|
139 |
if ( isset( $received_content_mainwp['error'] ) ) {
|
140 |
return array( 'error' => $received_content_mainwp['error'] );
|
141 |
}
|
135 |
$received_content = wp_remote_retrieve_body( $response );
|
136 |
|
137 |
if ( preg_match( '/<mainwp>(.*)<\/mainwp>/', $received_content, $received_result ) > 0 ) {
|
138 |
+
$received_content_mainwp = json_decode( base64_decode( $received_result[1] ), true ); // json format
|
139 |
if ( isset( $received_content_mainwp['error'] ) ) {
|
140 |
return array( 'error' => $received_content_mainwp['error'] );
|
141 |
}
|
class/class-mainwp-child-updraft-plus-backups.php
CHANGED
@@ -3969,7 +3969,14 @@ ENDHERE;
|
|
3969 |
}
|
3970 |
|
3971 |
private function close_browser_connection( $txt = '' ) {
|
3972 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3973 |
// Close browser connection so that it can resume AJAX polling
|
3974 |
header( 'Content-Length: ' . ( ( ! empty( $txt ) ) ? strlen( $txt ) : '0' ) );
|
3975 |
header( 'Connection: close' );
|
3969 |
}
|
3970 |
|
3971 |
private function close_browser_connection( $txt = '' ) {
|
3972 |
+
|
3973 |
+
if (isset( $_REQUEST['json_result'] ) && $_REQUEST['json_result'] == true) :
|
3974 |
+
$output = json_encode( $txt );
|
3975 |
+
else:
|
3976 |
+
$output = serialize( $txt );
|
3977 |
+
endif;
|
3978 |
+
|
3979 |
+
$txt = '<mainwp>' . base64_encode( $output ) . '</mainwp>';
|
3980 |
// Close browser connection so that it can resume AJAX polling
|
3981 |
header( 'Content-Length: ' . ( ( ! empty( $txt ) ) ? strlen( $txt ) : '0' ) );
|
3982 |
header( 'Connection: close' );
|
class/class-mainwp-child-wpvivid-backuprestore.php
CHANGED
@@ -1,10 +1,4 @@
|
|
1 |
<?php
|
2 |
-
/**
|
3 |
-
* Created by PhpStorm.
|
4 |
-
* User: alienware`x
|
5 |
-
* Date: 2019/4/30
|
6 |
-
* Time: 10:26
|
7 |
-
*/
|
8 |
|
9 |
class MainWP_Child_WPvivid_BackupRestore
|
10 |
{
|
@@ -134,6 +128,9 @@ class MainWP_Child_WPvivid_BackupRestore
|
|
134 |
case 'set_remote':
|
135 |
$information = $this->set_remote();
|
136 |
break;
|
|
|
|
|
|
|
137 |
}
|
138 |
} catch (Exception $e) {
|
139 |
$information = array('error' => $e->getMessage());
|
@@ -143,6 +140,13 @@ class MainWP_Child_WPvivid_BackupRestore
|
|
143 |
}
|
144 |
}
|
145 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
146 |
public function prepare_backup()
|
147 |
{
|
148 |
global $wpvivid_plugin;
|
1 |
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
class MainWP_Child_WPvivid_BackupRestore
|
4 |
{
|
128 |
case 'set_remote':
|
129 |
$information = $this->set_remote();
|
130 |
break;
|
131 |
+
default:
|
132 |
+
$information = $this->post_mainwp_data($_POST);
|
133 |
+
break;
|
134 |
}
|
135 |
} catch (Exception $e) {
|
136 |
$information = array('error' => $e->getMessage());
|
140 |
}
|
141 |
}
|
142 |
|
143 |
+
public function post_mainwp_data($data){
|
144 |
+
global $wpvivid_plugin;
|
145 |
+
|
146 |
+
$ret =$wpvivid_plugin->wpvivid_handle_mainwp_action($data);
|
147 |
+
return $ret;
|
148 |
+
}
|
149 |
+
|
150 |
public function prepare_backup()
|
151 |
{
|
152 |
global $wpvivid_plugin;
|
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(
|
@@ -3586,6 +3586,10 @@ class MainWP_Child {
|
|
3586 |
MainWP_Helper::update_option( 'mainwp_child_clone_sites', '0' );
|
3587 |
}
|
3588 |
}
|
|
|
|
|
|
|
|
|
3589 |
|
3590 |
if ( isset( $_POST['pluginDir'] ) ) {
|
3591 |
if ( get_option( 'mainwp_child_pluginDir' ) !== $_POST['pluginDir'] ) {
|
115 |
}
|
116 |
|
117 |
class MainWP_Child {
|
118 |
+
public static $version = '4.0.6';
|
119 |
private $update_version = '1.5';
|
120 |
|
121 |
private $callableFunctions = array(
|
3586 |
MainWP_Helper::update_option( 'mainwp_child_clone_sites', '0' );
|
3587 |
}
|
3588 |
}
|
3589 |
+
|
3590 |
+
if ( isset( $_POST['siteId'] ) ) {
|
3591 |
+
MainWP_Helper::update_option( 'mainwp_child_siteid', intval($_POST['siteId']) );
|
3592 |
+
}
|
3593 |
|
3594 |
if ( isset( $_POST['pluginDir'] ) ) {
|
3595 |
if ( get_option( 'mainwp_child_pluginDir' ) !== $_POST['pluginDir'] ) {
|
class/class-mainwp-client-report.php
CHANGED
@@ -508,26 +508,6 @@ class MainWP_Client_Report {
|
|
508 |
|
509 |
return $token_values;
|
510 |
}
|
511 |
-
|
512 |
-
// function get_meta_value_from_summary( $summary, $meta ) {
|
513 |
-
// $value = '';
|
514 |
-
// if ( $meta == 'name' ) {
|
515 |
-
// $value = str_replace(array('Updated plugin:', 'Updated theme:'), '', $summary);
|
516 |
-
// $value = trim( $value );
|
517 |
-
// $last_space_pos = strrpos($value, ' ');
|
518 |
-
// if ($last_space_pos !== false) {
|
519 |
-
// $value = substr($value , 0, 0 - $last_space_pos);
|
520 |
-
// }
|
521 |
-
// } else if ( $meta == 'version') {
|
522 |
-
// $last_space_pos = strrpos($value, ' ');
|
523 |
-
// if ($last_space_pos !== false) {
|
524 |
-
// $value = substr($value , $last_space_pos);
|
525 |
-
// }
|
526 |
-
// } else if ( $meta == 'old_version' ) {
|
527 |
-
// $value = 'N/A';
|
528 |
-
// }
|
529 |
-
// return $value;
|
530 |
-
// }
|
531 |
|
532 |
function get_section_loop_data( $records, $tokens, $section, $skip_records = array() ) {
|
533 |
|
@@ -577,19 +557,8 @@ class MainWP_Client_Report {
|
|
577 |
|
578 |
foreach ( $records as $record ) {
|
579 |
|
580 |
-
// $fix_meta_name = $fix_old_version = $fix_version = '';
|
581 |
-
|
582 |
if ( in_array($record->ID, $skip_records) ) {
|
583 |
-
|
584 |
-
// if ( 'updated' === $action && ('themes' === $context || 'plugins' === $context)) {
|
585 |
-
// if ( !isset( $record->meta ) || $record->meta == '') {
|
586 |
-
// $fix_meta_name = get_meta_value_from_summary($record->summary, 'name');
|
587 |
-
// $fix_old_version = get_meta_value_from_summary($record->summary, 'old_version');
|
588 |
-
// $fix_version = get_meta_value_from_summary($record->summary, 'version');
|
589 |
-
// }
|
590 |
-
// } else {
|
591 |
-
continue;
|
592 |
-
// }
|
593 |
}
|
594 |
|
595 |
// check connector
|
@@ -643,8 +612,9 @@ class MainWP_Client_Report {
|
|
643 |
}
|
644 |
}
|
645 |
|
646 |
-
|
647 |
-
|
|
|
648 |
foreach ( $tokens as $token ) {
|
649 |
// parse $data value from tokens in sections
|
650 |
$data = '';
|
@@ -677,17 +647,17 @@ class MainWP_Client_Report {
|
|
677 |
|
678 |
switch ( $data ) {
|
679 |
case 'ID':
|
680 |
-
$
|
681 |
break;
|
682 |
case 'date':
|
683 |
-
$
|
684 |
break;
|
685 |
case 'time':
|
686 |
-
$
|
687 |
break;
|
688 |
case 'area':
|
689 |
$data = 'sidebar_name';
|
690 |
-
$
|
691 |
break;
|
692 |
case 'name':
|
693 |
case 'version':
|
@@ -699,18 +669,18 @@ class MainWP_Client_Report {
|
|
699 |
if ( $context == 'profiles' )
|
700 |
$data = 'display_name';
|
701 |
}
|
702 |
-
$
|
703 |
break;
|
704 |
case 'title':
|
705 |
if ( 'comments' === $context ) {
|
706 |
-
$
|
707 |
} else {
|
708 |
if ( 'page' === $context || 'post' === $context ) {
|
709 |
$data = 'post_title';
|
710 |
} else if ( 'menus' === $record->connector ) {
|
711 |
$data = 'name';
|
712 |
}
|
713 |
-
$
|
714 |
}
|
715 |
break;
|
716 |
case 'author':
|
@@ -731,7 +701,7 @@ class MainWP_Client_Report {
|
|
731 |
$value = $this->get_stream_meta_data( $record, 'author_meta' );
|
732 |
}
|
733 |
|
734 |
-
$
|
735 |
break;
|
736 |
case 'status': // sucuri cases
|
737 |
case 'webtrust':
|
@@ -751,17 +721,17 @@ class MainWP_Client_Report {
|
|
751 |
$status[] = __( 'Site With Warnings', 'mainwp-child' ); }
|
752 |
|
753 |
if ($data == 'status') {
|
754 |
-
$
|
755 |
} else if ($data == 'webtrust') {
|
756 |
-
$
|
757 |
}
|
758 |
}
|
759 |
|
760 |
} else {
|
761 |
-
$
|
762 |
}
|
763 |
} else {
|
764 |
-
$
|
765 |
}
|
766 |
break;
|
767 |
case 'details':
|
@@ -781,12 +751,12 @@ class MainWP_Client_Report {
|
|
781 |
}
|
782 |
}
|
783 |
}
|
784 |
-
$
|
785 |
|
786 |
} else if ( 'wordfence_scan' === $context || 'mainwp_maintenance' === $context ) {
|
787 |
$meta_value = $this->get_stream_meta_data( $record, $data );
|
788 |
// to fix
|
789 |
-
if ('
|
790 |
// SUM_FINAL:Scan complete. You have xxx new issues to fix. See below.
|
791 |
// SUM_FINAL:Scan complete. Congratulations, no new problems found
|
792 |
if (stripos($meta_value, 'Congratulations')) {
|
@@ -797,27 +767,39 @@ class MainWP_Client_Report {
|
|
797 |
$meta_value = '';
|
798 |
}
|
799 |
}
|
800 |
-
$
|
801 |
}
|
802 |
break;
|
803 |
//case 'destination': // for backup tokens
|
804 |
case 'type':
|
805 |
if ( 'backups' === $context ) {
|
806 |
-
$
|
807 |
} else {
|
808 |
-
$
|
809 |
}
|
810 |
break;
|
811 |
default:
|
812 |
-
$
|
813 |
break;
|
814 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
815 |
} // foreach $tokens
|
816 |
|
817 |
if ( ! empty( $token_values ) ) {
|
818 |
$loops[ $loop_count ] = $token_values;
|
819 |
$loop_count ++;
|
820 |
}
|
|
|
821 |
} // foreach $records
|
822 |
return $loops;
|
823 |
}
|
508 |
|
509 |
return $token_values;
|
510 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
511 |
|
512 |
function get_section_loop_data( $records, $tokens, $section, $skip_records = array() ) {
|
513 |
|
557 |
|
558 |
foreach ( $records as $record ) {
|
559 |
|
|
|
|
|
560 |
if ( in_array($record->ID, $skip_records) ) {
|
561 |
+
continue;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
562 |
}
|
563 |
|
564 |
// check connector
|
612 |
}
|
613 |
}
|
614 |
|
615 |
+
//$skip_this_loop = false;
|
616 |
+
$token_values = array();
|
617 |
+
|
618 |
foreach ( $tokens as $token ) {
|
619 |
// parse $data value from tokens in sections
|
620 |
$data = '';
|
647 |
|
648 |
switch ( $data ) {
|
649 |
case 'ID':
|
650 |
+
$tok_value = $record->ID;
|
651 |
break;
|
652 |
case 'date':
|
653 |
+
$tok_value = MainWP_Helper::formatDate( MainWP_Helper::getTimestamp( strtotime( $record->created ) ) );
|
654 |
break;
|
655 |
case 'time':
|
656 |
+
$tok_value = MainWP_Helper::formatTime( MainWP_Helper::getTimestamp( strtotime( $record->created ) ) );
|
657 |
break;
|
658 |
case 'area':
|
659 |
$data = 'sidebar_name';
|
660 |
+
$tok_value = $this->get_stream_meta_data( $record, $data );
|
661 |
break;
|
662 |
case 'name':
|
663 |
case 'version':
|
669 |
if ( $context == 'profiles' )
|
670 |
$data = 'display_name';
|
671 |
}
|
672 |
+
$tok_value = $this->get_stream_meta_data( $record, $data );
|
673 |
break;
|
674 |
case 'title':
|
675 |
if ( 'comments' === $context ) {
|
676 |
+
$tok_value = $record->summary;
|
677 |
} else {
|
678 |
if ( 'page' === $context || 'post' === $context ) {
|
679 |
$data = 'post_title';
|
680 |
} else if ( 'menus' === $record->connector ) {
|
681 |
$data = 'name';
|
682 |
}
|
683 |
+
$tok_value = $this->get_stream_meta_data( $record, $data );
|
684 |
}
|
685 |
break;
|
686 |
case 'author':
|
701 |
$value = $this->get_stream_meta_data( $record, 'author_meta' );
|
702 |
}
|
703 |
|
704 |
+
$tok_value = $value;
|
705 |
break;
|
706 |
case 'status': // sucuri cases
|
707 |
case 'webtrust':
|
721 |
$status[] = __( 'Site With Warnings', 'mainwp-child' ); }
|
722 |
|
723 |
if ($data == 'status') {
|
724 |
+
$tok_value = count( $status ) > 0 ? implode( ', ', $status ) : __( 'Verified Clear', 'mainwp-child' );
|
725 |
} else if ($data == 'webtrust') {
|
726 |
+
$tok_value = $blacklisted ? __( 'Site Blacklisted', 'mainwp-child' ) : __( 'Trusted', 'mainwp-child' );
|
727 |
}
|
728 |
}
|
729 |
|
730 |
} else {
|
731 |
+
$tok_value = $this->get_stream_meta_data( $record, $data );
|
732 |
}
|
733 |
} else {
|
734 |
+
$tok_value = $value;
|
735 |
}
|
736 |
break;
|
737 |
case 'details':
|
751 |
}
|
752 |
}
|
753 |
}
|
754 |
+
$tok_value = implode(", ", $details);
|
755 |
|
756 |
} else if ( 'wordfence_scan' === $context || 'mainwp_maintenance' === $context ) {
|
757 |
$meta_value = $this->get_stream_meta_data( $record, $data );
|
758 |
// to fix
|
759 |
+
if ('wordfence_scan' === $context && $data == 'result') {
|
760 |
// SUM_FINAL:Scan complete. You have xxx new issues to fix. See below.
|
761 |
// SUM_FINAL:Scan complete. Congratulations, no new problems found
|
762 |
if (stripos($meta_value, 'Congratulations')) {
|
767 |
$meta_value = '';
|
768 |
}
|
769 |
}
|
770 |
+
$tok_value = $meta_value;
|
771 |
}
|
772 |
break;
|
773 |
//case 'destination': // for backup tokens
|
774 |
case 'type':
|
775 |
if ( 'backups' === $context ) {
|
776 |
+
$tok_value = $this->get_stream_meta_data( $record, $data );
|
777 |
} else {
|
778 |
+
$tok_value = $token;
|
779 |
}
|
780 |
break;
|
781 |
default:
|
782 |
+
$tok_value = 'N/A';
|
783 |
break;
|
784 |
}
|
785 |
+
|
786 |
+
$token_values[ $token ] = $tok_value;
|
787 |
+
|
788 |
+
if ( empty( $tok_value ) ) {
|
789 |
+
//$skip_this_loop = true;
|
790 |
+
if ( defined( 'MAINWP_CHILD_DEBUG' ) && MAINWP_CHILD_DEBUG === TRUE ) {
|
791 |
+
error_log("MainWP Child Report:: skip empty value :: token :: " . $token . " :: record :: " . print_r( $record, true ));
|
792 |
+
}
|
793 |
+
//break;
|
794 |
+
}
|
795 |
+
|
796 |
} // foreach $tokens
|
797 |
|
798 |
if ( ! empty( $token_values ) ) {
|
799 |
$loops[ $loop_count ] = $token_values;
|
800 |
$loop_count ++;
|
801 |
}
|
802 |
+
|
803 |
} // foreach $records
|
804 |
return $loops;
|
805 |
}
|
class/class-mainwp-clone.php
CHANGED
@@ -1208,6 +1208,7 @@ class MainWP_Clone {
|
|
1208 |
'f' => $rand,
|
1209 |
'wpversion' => $wp_version,
|
1210 |
'zipmethod' => $method,
|
|
|
1211 |
) );
|
1212 |
|
1213 |
if ( ! $result['backup'] ) {
|
@@ -1252,6 +1253,7 @@ class MainWP_Clone {
|
|
1252 |
'cloneFunc' => 'createCloneBackupPoll',
|
1253 |
'key' => $key,
|
1254 |
'f' => $rand,
|
|
|
1255 |
) );
|
1256 |
|
1257 |
if ( ! isset( $result['size'] ) ) {
|
@@ -1339,6 +1341,7 @@ class MainWP_Clone {
|
|
1339 |
'cloneFunc' => 'deleteCloneBackup',
|
1340 |
'key' => $siteToClone['extauth'],
|
1341 |
'f' => $_POST['file'],
|
|
|
1342 |
) );
|
1343 |
}
|
1344 |
}
|
1208 |
'f' => $rand,
|
1209 |
'wpversion' => $wp_version,
|
1210 |
'zipmethod' => $method,
|
1211 |
+
'json_result' => true
|
1212 |
) );
|
1213 |
|
1214 |
if ( ! $result['backup'] ) {
|
1253 |
'cloneFunc' => 'createCloneBackupPoll',
|
1254 |
'key' => $key,
|
1255 |
'f' => $rand,
|
1256 |
+
'json_result' => true
|
1257 |
) );
|
1258 |
|
1259 |
if ( ! isset( $result['size'] ) ) {
|
1341 |
'cloneFunc' => 'deleteCloneBackup',
|
1342 |
'key' => $siteToClone['extauth'],
|
1343 |
'f' => $_POST['file'],
|
1344 |
+
'json_result' => true
|
1345 |
) );
|
1346 |
}
|
1347 |
}
|
class/class-mainwp-custom-post-type.php
CHANGED
@@ -19,10 +19,20 @@ class MainWP_Custom_Post_Type {
|
|
19 |
|
20 |
$error = error_get_last();
|
21 |
if ( isset( $error['type'] ) && E_ERROR === $error['type'] && isset( $error['message'] ) ) {
|
22 |
-
|
|
|
23 |
} else {
|
24 |
-
|
|
|
25 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
}
|
27 |
|
28 |
register_shutdown_function( "mainwp_custom_post_type_handle_fatal_error" );
|
19 |
|
20 |
$error = error_get_last();
|
21 |
if ( isset( $error['type'] ) && E_ERROR === $error['type'] && isset( $error['message'] ) ) {
|
22 |
+
$data = array( 'error' => 'MainWPChild fatal error : ' . $error['message'] . ' Line: ' . $error['line'] . ' File: ' . $error['file'] );
|
23 |
+
// die( '<mainwp>' . base64_encode( serialize( ) ) . '</mainwp>' );
|
24 |
} else {
|
25 |
+
$data = MainWP_Custom_Post_Type::$information;
|
26 |
+
// die( '<mainwp>' . base64_encode( serialize( MainWP_Custom_Post_Type::$information ) ) . '</mainwp>' );
|
27 |
}
|
28 |
+
|
29 |
+
if ( isset( $_REQUEST['json_result'] ) && $_REQUEST['json_result'] ) {
|
30 |
+
$data = json_encode( $data );
|
31 |
+
} else {
|
32 |
+
$data = serialize( $data );
|
33 |
+
}
|
34 |
+
|
35 |
+
die('<mainwp>' . base64_encode( $data ) . '</mainwp>');
|
36 |
}
|
37 |
|
38 |
register_shutdown_function( "mainwp_custom_post_type_handle_fatal_error" );
|
class/class-mainwp-helper.php
CHANGED
@@ -2,13 +2,24 @@
|
|
2 |
|
3 |
class MainWP_Helper {
|
4 |
|
5 |
-
static function write( $val ) {
|
6 |
-
$
|
|
|
|
|
|
|
|
|
|
|
7 |
die( '<mainwp>' . base64_encode( $output ) . '</mainwp>' );
|
8 |
}
|
9 |
|
10 |
static function close_connection( $val = null ) {
|
11 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
$output = '<mainwp>' . base64_encode( $output ) . '</mainwp>';
|
13 |
// Close browser connection so that it can resume AJAX polling
|
14 |
header( 'Content-Length: ' . strlen( $output ) );
|
@@ -989,7 +1000,12 @@ class MainWP_Helper {
|
|
989 |
public static function _fetchUrl( $url, $postdata ) {
|
990 |
//$agent = 'Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)';
|
991 |
$agent = 'Mozilla/5.0 (compatible; MainWP-Child/' . MainWP_Child::$version . '; +http://mainwp.com)';
|
992 |
-
|
|
|
|
|
|
|
|
|
|
|
993 |
$ch = curl_init();
|
994 |
curl_setopt( $ch, CURLOPT_URL, $url );
|
995 |
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
|
@@ -1007,7 +1023,8 @@ class MainWP_Helper {
|
|
1007 |
} else if ( preg_match( '/<mainwp>(.*)<\/mainwp>/', $data, $results ) > 0 ) {
|
1008 |
$result = $results[1];
|
1009 |
$result_base = base64_decode( $result );
|
1010 |
-
|
|
|
1011 |
|
1012 |
return $information;
|
1013 |
} else if ( '' === $data ) {
|
2 |
|
3 |
class MainWP_Helper {
|
4 |
|
5 |
+
static function write( $val ) {
|
6 |
+
if (isset( $_REQUEST['json_result'] ) && $_REQUEST['json_result'] == true) :
|
7 |
+
$output = json_encode( $val );
|
8 |
+
else:
|
9 |
+
$output = serialize( $val );
|
10 |
+
endif;
|
11 |
+
|
12 |
die( '<mainwp>' . base64_encode( $output ) . '</mainwp>' );
|
13 |
}
|
14 |
|
15 |
static function close_connection( $val = null ) {
|
16 |
+
|
17 |
+
if (isset( $_REQUEST['json_result'] ) && $_REQUEST['json_result'] == true) :
|
18 |
+
$output = json_encode( $val );
|
19 |
+
else:
|
20 |
+
$output = serialize( $val );
|
21 |
+
endif;
|
22 |
+
|
23 |
$output = '<mainwp>' . base64_encode( $output ) . '</mainwp>';
|
24 |
// Close browser connection so that it can resume AJAX polling
|
25 |
header( 'Content-Length: ' . strlen( $output ) );
|
1000 |
public static function _fetchUrl( $url, $postdata ) {
|
1001 |
//$agent = 'Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)';
|
1002 |
$agent = 'Mozilla/5.0 (compatible; MainWP-Child/' . MainWP_Child::$version . '; +http://mainwp.com)';
|
1003 |
+
|
1004 |
+
if (!is_array( $postdata ))
|
1005 |
+
$postdata = array();
|
1006 |
+
|
1007 |
+
$postdata['json_result'] = true; // forced all response in json format
|
1008 |
+
|
1009 |
$ch = curl_init();
|
1010 |
curl_setopt( $ch, CURLOPT_URL, $url );
|
1011 |
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
|
1023 |
} else if ( preg_match( '/<mainwp>(.*)<\/mainwp>/', $data, $results ) > 0 ) {
|
1024 |
$result = $results[1];
|
1025 |
$result_base = base64_decode( $result );
|
1026 |
+
//$information = maybe_unserialize( $result_base );
|
1027 |
+
$information = json_decode( $result_base, true ); // it is json_encode result
|
1028 |
|
1029 |
return $information;
|
1030 |
} else if ( '' === $data ) {
|
class/class-mainwp-security.php
CHANGED
@@ -54,7 +54,7 @@ class MainWP_Security {
|
|
54 |
$h = fopen( $file, 'w' );
|
55 |
fwrite( $h, '<?php ' . "\n" );
|
56 |
fwrite( $h, "header(\$_SERVER['SERVER_PROTOCOL'] . ' 403 Forbidden' );" . "\n" );
|
57 |
-
fwrite( $h, "die( '403
|
58 |
fclose( $h );
|
59 |
}
|
60 |
}
|
54 |
$h = fopen( $file, 'w' );
|
55 |
fwrite( $h, '<?php ' . "\n" );
|
56 |
fwrite( $h, "header(\$_SERVER['SERVER_PROTOCOL'] . ' 403 Forbidden' );" . "\n" );
|
57 |
+
fwrite( $h, "die( '403 Forbidden' );" . "\n" );
|
58 |
fclose( $h );
|
59 |
}
|
60 |
}
|
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.6
|
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.3.
|
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 |
|
@@ -32,7 +32,7 @@ The MainWP Child plugin is used to securely manage multiple WordPress websites f
|
|
32 |
= More Information =
|
33 |
[MainWP Documentation](https://mainwp.com/help/)
|
34 |
|
35 |
-
[MainWP
|
36 |
|
37 |
[MainWP Support](https://mainwp.com/support/)
|
38 |
|
@@ -71,6 +71,12 @@ To see full documentation and FAQs please visit [MainWP Documentation](https://m
|
|
71 |
|
72 |
== Changelog ==
|
73 |
|
|
|
|
|
|
|
|
|
|
|
|
|
74 |
= 4.0.5.1 - 12-13-19 =
|
75 |
* Fixed: Child Reports data conversion problem
|
76 |
|
5 |
Author URI: https://mainwp.com
|
6 |
Plugin URI: https://mainwp.com
|
7 |
Requires at least: 3.6
|
8 |
+
Tested up to: 5.3.2
|
9 |
Requires PHP: 5.6
|
10 |
+
Stable tag: 4.0.6
|
11 |
License: GPLv2 or later
|
12 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
13 |
|
32 |
= More Information =
|
33 |
[MainWP Documentation](https://mainwp.com/help/)
|
34 |
|
35 |
+
[MainWP Community](https://meta.mainwp.com/)
|
36 |
|
37 |
[MainWP Support](https://mainwp.com/support/)
|
38 |
|
71 |
|
72 |
== Changelog ==
|
73 |
|
74 |
+
= 4.0.6 - 1-17-20 =
|
75 |
+
* Fixed: encoding problem in error messages
|
76 |
+
* Added: site ID parameter in the sync request
|
77 |
+
* Updated: MainWP_Child_WPvivid_BackupRestore class
|
78 |
+
* Preventative: security improvements
|
79 |
+
|
80 |
= 4.0.5.1 - 12-13-19 =
|
81 |
* Fixed: Child Reports data conversion problem
|
82 |
|