| @@ -37,8 +37,16 @@ | ||
| 37 | 37 | if ( ! $ticket->id ) { |
| 38 | 38 | return; |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | + // Validate the submitted auth code against the stored one before | |
| 42 | + // doing anything with the ticket. Never redirect to (and thereby | |
| 43 | + // disclose) the real ticket URL/auth code for an invalid guess. | |
| 44 | + $submitted_auth_code = sanitize_text_field( wp_unslash( $_REQUEST['auth_code'] ) ); // phpcs:ignore | |
| 45 | + if ( ! $ticket->auth_code || ! $submitted_auth_code || ! hash_equals( (string) $ticket->auth_code, $submitted_auth_code ) ) { | |
| 46 | + return; | |
| 47 | + } | |
| 48 | + | |
| 41 | 49 | wp_safe_redirect( $ticket->get_url() ); |
| 42 | 50 | exit; |
| 43 | 51 | } |
| 44 | 52 | } |
| @@ -50,10 +58,9 @@ | ||
| 50 | 58 | */ |
| 51 | 59 | public static function load_scripts() { |
| 52 | 60 | |
| 53 | 61 | // Check load scripts setting to load script on perticular page. |
| 54 | - $page_settings = get_option( 'wpsc-gs-page-settings' ); | |
| 55 | - if ( $page_settings['load-scripts'] == 'custom' && ! in_array( get_the_id(), $page_settings['load-script-pages'] ) ) { | |
| 62 | + if ( ! WPSC_Functions::is_load_scripts_page() ) { | |
| 56 | 63 | return; |
| 57 | 64 | } |
| 58 | 65 | |
| 59 | 66 | // jquery. |