mirror of
https://github.com/mainwp/mainwp-child.git
synced 2025-09-06 09:20:28 +08:00
Add CSRF
This commit is contained in:
parent
53218d02cb
commit
d65bf1179e
1 changed files with 6 additions and 2 deletions
|
@ -109,7 +109,7 @@ class MainWP_Clone {
|
||||||
public static function render() {
|
public static function render() {
|
||||||
$uploadError = false;
|
$uploadError = false;
|
||||||
$uploadFile = false;
|
$uploadFile = false;
|
||||||
if ( isset( $_REQUEST['upload'] ) ) {
|
if ( isset( $_REQUEST['upload'] ) && wp_verify_nonce( $_POST['_nonce'], 'cloneRestore' ) ) {
|
||||||
if ( isset( $_FILES['file'] ) ) {
|
if ( isset( $_FILES['file'] ) ) {
|
||||||
if ( ! function_exists( 'wp_handle_upload' ) ) {
|
if ( ! function_exists( 'wp_handle_upload' ) ) {
|
||||||
require_once( ABSPATH . 'wp-admin/includes/file.php' );
|
require_once( ABSPATH . 'wp-admin/includes/file.php' );
|
||||||
|
@ -230,6 +230,7 @@ class MainWP_Clone {
|
||||||
class="button button-primary"
|
class="button button-primary"
|
||||||
disabled="disabled"
|
disabled="disabled"
|
||||||
value="<?php esc_attr_e( 'Clone/Restore Website', 'mainwp-child' ); ?>"/>
|
value="<?php esc_attr_e( 'Clone/Restore Website', 'mainwp-child' ); ?>"/>
|
||||||
|
<input type="hidden" name="_nonce" value="<?php echo wp_create_nonce( 'cloneRestore' ); ?>" />
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -244,7 +245,7 @@ class MainWP_Clone {
|
||||||
public static function renderNormalRestore() {
|
public static function renderNormalRestore() {
|
||||||
$uploadError = false;
|
$uploadError = false;
|
||||||
$uploadFile = false;
|
$uploadFile = false;
|
||||||
if ( isset( $_REQUEST['upload'] ) ) {
|
if ( isset( $_REQUEST['upload'] ) && wp_verify_nonce( $_POST['_nonce'], 'cloneRestore' ) ) {
|
||||||
if ( isset( $_FILES['file'] ) ) {
|
if ( isset( $_FILES['file'] ) ) {
|
||||||
if ( ! function_exists( 'wp_handle_upload' ) ) {
|
if ( ! function_exists( 'wp_handle_upload' ) ) {
|
||||||
require_once( ABSPATH . 'wp-admin/includes/file.php' );
|
require_once( ABSPATH . 'wp-admin/includes/file.php' );
|
||||||
|
@ -298,6 +299,8 @@ class MainWP_Clone {
|
||||||
<p><?php esc_html_e( 'Upload backup in .zip format (Maximum filesize for your server settings: ', 'mainwp-child' ); ?><?php echo esc_html( $uploadSize ); ?>)</p>
|
<p><?php esc_html_e( 'Upload backup in .zip format (Maximum filesize for your server settings: ', 'mainwp-child' ); ?><?php echo esc_html( $uploadSize ); ?>)</p>
|
||||||
<em><?php esc_html_e( 'If you have a FULL backup created by basic MainWP Backup system you may restore it by uploading here. Backups created by 3rd party plugins will not work.', 'mainwp-child' ); ?>
|
<em><?php esc_html_e( 'If you have a FULL backup created by basic MainWP Backup system you may restore it by uploading here. Backups created by 3rd party plugins will not work.', 'mainwp-child' ); ?>
|
||||||
<br/>
|
<br/>
|
||||||
|
|
||||||
|
|
||||||
<?php esc_html_e( 'A database only backup will not work.', 'mainwp-child' ); ?></em><br/><br/>
|
<?php esc_html_e( 'A database only backup will not work.', 'mainwp-child' ); ?></em><br/><br/>
|
||||||
<form action="<?php echo esc_attr( admin_url( 'admin.php?page=MainWPRestore&upload=yes' ) ); ?>"
|
<form action="<?php echo esc_attr( admin_url( 'admin.php?page=MainWPRestore&upload=yes' ) ); ?>"
|
||||||
method="post"
|
method="post"
|
||||||
|
@ -309,6 +312,7 @@ class MainWP_Clone {
|
||||||
id="filesubmit"
|
id="filesubmit"
|
||||||
disabled="disabled"
|
disabled="disabled"
|
||||||
value="<?php esc_html_e( 'Restore Website', 'mainwp-child' ); ?>"/>
|
value="<?php esc_html_e( 'Restore Website', 'mainwp-child' ); ?>"/>
|
||||||
|
<input type="hidden" name="_nonce" value="<?php echo wp_create_nonce( 'cloneRestore' ); ?>" />
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue