| 1 |
<?php |
| 2 |
/** |
| 3 |
* Destination form. |
| 4 |
* |
| 5 |
* @package wpdbbkp |
| 6 |
*/ |
| 7 |
|
| 8 |
if ( ! defined( 'ABSPATH' ) ) { |
| 9 |
exit; // Exit if accessed directly. |
| 10 |
} |
| 11 |
|
| 12 |
$update_msg = ''; |
| 13 |
if ( true === isset( $_POST['wpdb_cd_s3'] ) && 'Y' === $_POST['wpdb_cd_s3'] ) { |
| 14 |
// Validate that the contents of the form request came from the current site and not somewhere else added 21-08-15 V.3.4. |
| 15 |
if ( ! isset( $_POST['wpdbbackup_update_cd_setting'] ) ) { |
| 16 |
wp_die( esc_html__('Invalid form data. form request came from the somewhere else not current site!','wpdbbkp') ); |
| 17 |
} |
| 18 |
if ( ! wp_verify_nonce( $_POST['wpdbbackup_update_cd_setting'] , 'wpdbbackup-update-cd-setting' ) ) { |
| 19 |
wp_die( esc_html__('Invalid form data. form request came from the somewhere else not current site!','wpdbbkp') ); |
| 20 |
} |
| 21 |
|
| 22 |
if ( true === isset( $_POST['wpdb_clouddrive_token'] ) ) { |
| 23 |
update_option( 'wpdb_clouddrive_token', wp_db_filter_data( sanitize_text_field( wp_unslash( $_POST['wpdb_clouddrive_token'] ) ) ), false ); |
| 24 |
} |
| 25 |
|
| 26 |
if ( isset( $_POST['wp_db_backup_destination_cd'] ) ) { |
| 27 |
update_option( 'wp_db_backup_destination_cd', 1 , false); |
| 28 |
} else { |
| 29 |
update_option( 'wp_db_backup_destination_cd', 0 , false); |
| 30 |
} |
| 31 |
// Put a "settings updated" message on the screen. |
| 32 |
$update_msg = esc_html__('Your BackupforWP CloudDrive setting has been saved.' , 'wpdbbkp'); |
| 33 |
} |
| 34 |
$wpdb_clouddrive_token = get_option( 'wpdb_clouddrive_token',null); |
| 35 |
|
| 36 |
$wpdbbkp_bb_s3_status = '<label><b>'.esc_html__('Status', 'wpdbbkp').'</b>: '.esc_html__('Not Configured', 'wpdbbkp').' </label> '; |
| 37 |
|
| 38 |
if(!empty($wpdb_clouddrive_token)) |
| 39 |
{ |
| 40 |
$wpdbbkp_bb_s3_status ='<label><b>'.esc_html__('Status', 'wpdbbkp').'</b>: <span class="dashicons dashicons-yes-alt" style="color:green;font-size:16px" title="'.esc_attr__('Destination enabled', 'wpdbbkp').'"></span><span class="configured">'.esc_html__('Configured', 'wpdbbkp').' </span> </label> '; |
| 41 |
} |
| 42 |
|
| 43 |
?> |
| 44 |
<div class="panel panel-default"> |
| 45 |
<div class="panel-heading"> |
| 46 |
<h4 class="panel-title"> |
| 47 |
<a data-toggle="collapse" data-parent="#accordion" href="#collapsebb"> |
| 48 |
<h2><?php echo esc_html__('BackupforWP CloudDrive', 'wpdbbkp') ?> <?php echo wp_kses_post($wpdbbkp_bb_s3_status);?> <span class="dashicons dashicons-admin-generic"></span></h2> |
| 49 |
|
| 50 |
</a> |
| 51 |
</h4> |
| 52 |
</div> |
| 53 |
<div id="collapsebb" class="panel-collapse collapse"> |
| 54 |
<div class="panel-body"> |
| 55 |
<?php |
| 56 |
if($update_msg){ |
| 57 |
echo '<div class="updated"><p><strong>'.esc_html( $update_msg ).'</strong></p></div>'; |
| 58 |
} |
| 59 |
?> |
| 60 |
<p> <?php echo esc_html__('Back up WordPress database to Backup for WP CloudDrive.', 'wpdbbkp') ?></p> |
| 61 |
<p><?php echo esc_html__('Enter your CloudDrive token for your offsite backup. Leave these blank for local backups OR Disable CloudDrive Destination', 'wpdbbkp') ?></p> |
| 62 |
<form class="form-group" name="CloudDrive" method="post" action=""> |
| 63 |
|
| 64 |
<input type="hidden" name="wpdb_cd_s3" value="Y"> |
| 65 |
<input name="wpdbbackup_update_cd_setting" type="hidden" value="<?php echo esc_attr( wp_create_nonce( 'wpdbbackup-update-cd-setting' ) ); ?>" /> |
| 66 |
<?php wp_nonce_field( 'wp-database-backup' ); ?> |
| 67 |
<div class="row form-group"> |
| 68 |
<label class="col-sm-2" for="wpdb_clouddrive_token"><?php echo esc_html__('BackupforWP CloudDrive API Token', 'wpdbbkp') ?></label> |
| 69 |
<div class="col-sm-6"> |
| 70 |
|
| 71 |
<input type="text" id="wpdb_clouddrive_token" class="form-control" name="wpdb_clouddrive_token" value="<?php echo esc_html( get_option( 'wpdb_clouddrive_token' ) ); ?>" size="25" placeholder="<?php esc_attr_e('26b18a624d2f5e01324bc81f90cfff63ba493bc15f00d790729fb437e90f54ea','wpdbbkp');?>"> |
| 72 |
<a href="https://app.backupforwp.com/" target="_blank"><span class="glyphicon glyphicon-question-sign" aria-hidden="true"></span></a> |
| 73 |
</div> |
| 74 |
</div> |
| 75 |
|
| 76 |
<p><input type="submit" name="Submit" class="btn btn-primary" value="<?php esc_attr_e( 'Save' , 'wpdbbkp' ); ?>" /> |
| 77 |
</p> |
| 78 |
</form> |
| 79 |
|
| 80 |
</div> |
| 81 |
</div> |
| 82 |
</div> |
| 83 |
|