| @@ -15,22 +15,23 @@ | ||
| 15 | 15 | |
| 16 | 16 | // Security check. |
| 17 | 17 | $wp_nonce = isset( $_REQUEST['_wpnonce'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['_wpnonce'] ) ) : ''; // input var okay. |
| 18 | 18 | if ( ! wp_verify_nonce( $wp_nonce, 'wpda-mail-settings-' . WPDA::get_current_user_login() ) ) { |
| 19 | - wp_die( __( 'ERROR: Not authorized', 'wp-data-access' ) ); | |
| 19 | + wp_die( esc_attr__( 'ERROR: Not authorized', 'wp-data-access' ) ); | |
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | if ( 'save' === $action ) { |
| 23 | 23 | |
| 24 | 24 | $mail = array( |
| 25 | - 'host' => sanitize_text_field( wp_unslash( $_POST['host'] ) ), | |
| 26 | - 'port' => sanitize_text_field( wp_unslash( $_POST['port'] ) ), | |
| 27 | - 'authenticate' => sanitize_text_field( wp_unslash( $_POST['authenticate'] ) ), | |
| 28 | - 'encryption' => sanitize_text_field( wp_unslash( $_POST['encryption'] ) ), | |
| 29 | - 'skip_verify' => sanitize_text_field( wp_unslash( $_POST['skip_verify'] ) ), | |
| 30 | - 'username' => sanitize_text_field( wp_unslash( $_POST['username'] ) ), | |
| 31 | - 'password' => sanitize_text_field( wp_unslash( $_POST['password'] ) ), | |
| 32 | - 'debug' => sanitize_text_field( wp_unslash( $_POST['debug'] ) ), | |
| 25 | + 'activate' => isset( $_POST['activate'] ) ? sanitize_text_field( wp_unslash( $_POST['activate'] ) ) : '', | |
| 26 | + 'host' => sanitize_text_field( wp_unslash( $_POST['host'] ) ), // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotValidated | |
| 27 | + 'port' => sanitize_text_field( wp_unslash( $_POST['port'] ) ), // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotValidated | |
| 28 | + 'authenticate' => isset( $_POST['authenticate'] ) ? sanitize_text_field( wp_unslash( $_POST['authenticate'] ) ) : '', | |
| 29 | + 'encryption' => sanitize_text_field( wp_unslash( $_POST['encryption'] ) ), // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotValidated | |
| 30 | + 'skip_verify' => isset( $_POST['skip_verify'] ) ? sanitize_text_field( wp_unslash( $_POST['skip_verify'] ) ) : '', | |
| 31 | + 'username' => sanitize_text_field( wp_unslash( $_POST['username'] ) ), // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotValidated | |
| 32 | + 'password' => sanitize_text_field( wp_unslash( $_POST['password'] ) ), // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotValidated | |
| 33 | + 'debug' => sanitize_text_field( wp_unslash( $_POST['debug'] ) ), // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotValidated | |
| 33 | 34 | ); |
| 34 | 35 | |
| 35 | 36 | WPDA_Mail::update_option( $mail ); |
| 36 | 37 | |
| @@ -48,8 +49,9 @@ | ||
| 48 | 49 | } |
| 49 | 50 | |
| 50 | 51 | $option = WPDA_Mail::get_option(); |
| 51 | 52 | |
| 53 | + $activate = $option['activate'] ?? ''; | |
| 52 | 54 | $host = $option['host'] ?? ''; |
| 53 | 55 | $port = $option['port'] ?? ''; |
| 54 | 56 | $authenticate = $option['authenticate'] ?? ''; |
| 55 | 57 | $encryption = $option['encryption'] ?? ''; |
| @@ -68,11 +70,21 @@ | ||
| 68 | 70 | <table class="wpda-table-settings"> |
| 69 | 71 | <tr> |
| 70 | 72 | <th> |
| 71 | 73 | SMTP Mail Server Settings |
| 74 | + <br/><br/> | |
| 75 | + <label style="font-weight: normal"> | |
| 76 | + <input | |
| 77 | + type="checkbox" | |
| 78 | + name="activate" | |
| 79 | + <?php echo 'on' === $activate ? 'checked' : ''; ?> | |
| 80 | + /> <?php esc_html_e( 'Activate', 'wp-data-access' ); ?> | |
| 81 | + </label> | |
| 72 | 82 | </th> |
| 73 | 83 | <td> |
| 74 | - SMTP mail server settings are used to send SQL Query Builder results from scheduler. | |
| 84 | + SMTP mail server settings are used to send scheduled SQL Query Builder results. | |
| 85 | + <br/><br/> | |
| 86 | + Test your mail settings using the SEND TEST MAIL button before activating. | |
| 75 | 87 | </td> |
| 76 | 88 | </tr> |
| 77 | 89 | <tr> |
| 78 | 90 | <th> |
| @@ -218,18 +230,18 @@ | ||
| 218 | 230 | <div class="wpda-table-settings-button"> |
| 219 | 231 | <input type="hidden" name="action" value="save"/> |
| 220 | 232 | <button type="submit" class="button button-primary"> |
| 221 | 233 | <i class="fas fa-check wpda_icon_on_button"></i> |
| 222 | - <?php echo __( 'Save Mail Settings', 'wp-data-access' ); ?> | |
| 234 | + <?php esc_html_e( 'Save Mail Settings', 'wp-data-access' ); ?> | |
| 223 | 235 | </button> |
| 224 | 236 | <a href="javascript:void(0)" |
| 225 | - onclick="if (confirm('<?php echo __( 'Reset to defaults?', 'wp-data-access' ); ?>')) { | |
| 237 | + onclick="if (confirm('<?php esc_html_e( 'Reset to defaults?', 'wp-data-access' ); ?>')) { | |
| 226 | 238 | jQuery('input[name=\'action\']').val('setdefaults'); |
| 227 | 239 | jQuery('#wpda_settings_mail').trigger('submit'); |
| 228 | 240 | }" |
| 229 | 241 | class="button button-secondary"> |
| 230 | 242 | <i class="fas fa-times-circle wpda_icon_on_button"></i> |
| 231 | - <?php echo __( 'Reset Mail Settings To Defaults', 'wp-data-access' ); ?> | |
| 243 | + <?php esc_html_e( 'Reset Mail Settings To Defaults', 'wp-data-access' ); ?> | |
| 232 | 244 | </a> |
| 233 | 245 | </div> |
| 234 | 246 | |
| 235 | 247 | <?php wp_nonce_field( 'wpda-mail-settings-' . WPDA::get_current_user_login(), '_wpnonce', false ); ?> |