| @@ -305,9 +305,9 @@ | ||
| 305 | 305 | // |
| 306 | 306 | } |
| 307 | 307 | |
| 308 | 308 | // Clear all Patchstack scheduled tasks. |
| 309 | - $tasks = [ 'patchstack_zip_backup', 'patchstack_send_software_data', 'patchstack_send_hacker_logs', 'patchstack_send_visitor_logs', 'patchstack_send_event_logs', 'patchstack_reset_blocked_attacks', 'patchstack_post_firewall_rules', 'patchstack_post_firewall_htaccess_rules', 'patchstack_post_dynamic_firewall_rules', 'patchstack_update_license_status', 'patchstack_update_plugins', 'patchstack_send_ping', 'patchstack_check_env', 'puc_cron_check_updates-webarx' ]; | |
| 309 | + $tasks = [ 'patchstack_zip_backup', 'patchstack_send_software_data', 'patchstack_send_hacker_logs', 'patchstack_send_visitor_logs', 'patchstack_send_event_logs', 'patchstack_reset_blocked_attacks', 'patchstack_post_firewall_rules', 'patchstack_post_firewall_htaccess_rules', 'patchstack_post_dynamic_firewall_rules', 'patchstack_update_license_status', 'patchstack_update_plugins', 'patchstack_send_ping', 'puc_cron_check_updates-webarx' ]; | |
| 310 | 310 | foreach ( $tasks as $task ) { |
| 311 | 311 | wp_clear_scheduled_hook( $task ); |
| 312 | 312 | } |
| 313 | 313 | |
| @@ -362,9 +362,9 @@ | ||
| 362 | 362 | // Successfully activated. |
| 363 | 363 | update_option( 'patchstack_license_activated', '1', true ); |
| 364 | 364 | |
| 365 | 365 | // Update license status and fetch policy settings. |
| 366 | - $fetchPolicy = (int) get_option( 'patchstack_last_license_check', 0 ) == 0; | |
| 366 | + $fetchPolicy = get_option( 'patchstack_last_license_check', 0 ) == 0; | |
| 367 | 367 | $this->plugin->api->update_license_status( $fetchPolicy ); |
| 368 | 368 | |
| 369 | 369 | // Perform post-activation actions, incl. access token retrieval. |
| 370 | 370 | $token = $this->plugin->api->get_access_token(); |
| @@ -749,9 +749,9 @@ | ||
| 749 | 749 | |
| 750 | 750 | // Ensure that the SERVER_SOFTWARE value is set. |
| 751 | 751 | $software = isset( $_SERVER['SERVER_SOFTWARE'] ) ? $_SERVER['SERVER_SOFTWARE'] : ''; |
| 752 | 752 | if ( ! $software ) { |
| 753 | - update_option( 'patchstack_firewall_ap_error', 'Unsupported SERVER_SOFTWARE, found: ' . $software ); | |
| 753 | + update_option( 'patchstack_firewall_ap_error', 'Unsupported SERVER_SOFTWARE, found: ' . $_SERVER['SERVER_SOFTWARE'] ); | |
| 754 | 754 | return false; |
| 755 | 755 | } |
| 756 | 756 | |
| 757 | 757 | // At this time, reject non-Apache environments. |
| @@ -765,11 +765,11 @@ | ||
| 765 | 765 | $is_litespeed = stripos( $_SERVER['SERVER_SOFTWARE'], 'litespeed' ) !== false || $sapi == 'litespeed'; |
| 766 | 766 | |
| 767 | 767 | // Attempt to find the Apache version, < 2.4 does not support <If>. |
| 768 | 768 | // This depends on ServerTokens value, so only stop execution if we can't find the specific unsupported versions. |
| 769 | - $version = function_exists( 'apache_get_version' ) ? apache_get_version() : $software; | |
| 770 | - if ( ! $is_litespeed && stripos( $version, 'Apache/2.4' ) === false ) { | |
| 771 | - update_option( 'patchstack_firewall_ap_error', 'Unsupported SERVER_SOFTWARE, found: ' . $software ); | |
| 769 | + $version = function_exists( 'apache_get_version' ) ? apache_get_version() : $_SERVER['SERVER_SOFTWARE']; | |
| 770 | + if ( stripos( $version, 'Apache/2.4' ) === false ) { | |
| 771 | + update_option( 'patchstack_firewall_ap_error', 'Unsupported SERVER_SOFTWARE, found: ' . $_SERVER['SERVER_SOFTWARE'] ); | |
| 772 | 772 | return false; |
| 773 | 773 | } |
| 774 | 774 | |
| 775 | 775 | // Add c-style slashes. |
| @@ -841,11 +841,10 @@ | ||
| 841 | 841 | * @param mixed $value |
| 842 | 842 | * @return void |
| 843 | 843 | */ |
| 844 | 844 | public function updated_option( $option_name, $old_value, $value ) { |
| 845 | - // Only allow to run for our options. The IP header is embedded in the AP config | |
| 846 | - // file too, so a change there must also regenerate it. | |
| 847 | - if ( !in_array( $option_name, [ 'patchstack_basic_firewall', 'patchstack_license_free', 'patchstack_firewall_rules_v3_ap', 'patchstack_firewall_ip_header' ] ) ) { | |
| 845 | + // Only allow to run for our options. | |
| 846 | + if ( !in_array( $option_name, [ 'patchstack_basic_firewall', 'patchstack_license_free', 'patchstack_firewall_rules_v3_ap' ] ) ) { | |
| 848 | 847 | return; |
| 849 | 848 | } |
| 850 | 849 | |
| 851 | 850 | // Not strict type matching. |