Fix restore from backup

This commit is contained in:
ruben- 2016-04-28 19:06:52 +02:00
parent c232857821
commit 9f748a1810
2 changed files with 29 additions and 8 deletions

View file

@ -593,13 +593,21 @@ class MainWP_Child {
<?php } ?>
<?php if ( !$hide_restore ) { ?>
<div class="mainwp-child-setting-tab restore-clone" <?php echo ('restore-clone' !== $shownPage) ? $hide_style : '' ; ?>>
<div class="mainwp-child-setting-tab restore-clone" <?php echo ( 'restore-clone' !== $shownPage ) ? $hide_style : ''; ?>>
<?php
$sitesToClone = get_option( 'mainwp_child_clone_sites' );
if ( 0 !== (int)$sitesToClone ) {
MainWP_Clone::render();
if ( '' === session_id() ) {
@session_start();
}
if ( isset( $_SESSION['file'] ) ) {
MainWP_Clone::renderRestore();
} else {
MainWP_Clone::renderNormalRestore();
$sitesToClone = get_option( 'mainwp_child_clone_sites' );
if ( 0 !== (int) $sitesToClone ) {
MainWP_Clone::render();
} else {
MainWP_Clone::renderNormalRestore();
}
}
?>
</div>
@ -873,7 +881,16 @@ class MainWP_Child {
}
function check_login() {
$auth = $this->auth( isset( $_POST['mainwpsignature'] ) ? $_POST['mainwpsignature'] : '', isset( $_POST['function'] ) ? $_POST['function'] : '', isset( $_POST['nonce'] ) ? $_POST['nonce'] : '', isset( $_POST['nossl'] ) ? $_POST['nossl'] : 0 );
$file = '';
if ( isset( $_REQUEST['f'] ) ) {
$file = $_REQUEST['f'];
} else if ( isset( $_REQUEST['file'] ) ) {
$file = $_REQUEST['file'];
} else if ( isset( $_REQUEST['fdl'] ) ) {
$file = $_REQUEST['fdl'];
}
$auth = $this->auth( isset( $_POST['mainwpsignature'] ) ? rawurldecode( $_POST['mainwpsignature'] ) : '', isset( $_POST['function'] ) ? $_POST['function'] : rawurldecode( ( isset( $_REQUEST['where'] ) ? $_REQUEST['where'] : $file ) ), isset( $_POST['nonce'] ) ? $_POST['nonce'] : '', isset( $_POST['nossl'] ) ? $_POST['nossl'] : 0 );
if ( ! $auth && isset( $_POST['mainwpsignature'] ) ) {
MainWP_Helper::error( __( 'Authentication failed! Please deactivate and re-activate the MainWP Child plugin on this site.', 'mainwp-child' ) );
@ -1111,7 +1128,7 @@ class MainWP_Child {
$file = $_POST['file'];
}
$where = 'admin.php?page=mainwp-child-restore';
$where = 'admin.php?page=mainwp_child_tab&tab=restore-clone';
if ( '' === session_id() ) {
session_start();
}

View file

@ -1464,7 +1464,9 @@ class MainWP_Clone {
self::renderStyle();
?>
<div id="icon-options-general" class="icon32"><br></div><h2><?php esc_html_e( 'Restore', 'mainwp-child' ); ?></h2>
<div class="postbox">
<h2 class="hndle"><?php esc_html_e( 'Restore', 'mainwp-child' ); ?></h2>
<div class="inside">
<div class="mainwp-hide-after-restore">
<br/><?php esc_html_e( 'Be sure to use a FULL backup created by your Network dashboard, if critical folders are excluded it may result in a not working installation.', 'mainwp-child' ); ?>
<br/><br/><a href="#" class="button-primary" file="<?php echo esc_attr( urldecode( $file ) ); ?>"
@ -1475,6 +1477,8 @@ class MainWP_Clone {
<div class="mainwp-child_info-box-green"
style="display: none;"><?php esc_html_e( 'Restore process completed successfully! You will now need to click ', 'mainwp-child' ); ?>
<a href="<?php echo esc_attr( admin_url( 'options-permalink.php' ) ); ?>"><?php esc_html_e( 'here', 'mainwp-child' ); ?></a><?php esc_html_e( ' to re-login to the admin and re-save permalinks.', 'mainwp-child' ); ?>
</div>
</div>
</div>
<?php
self::renderJavaScript();