PluginProbe
Patchstack – WordPress & Plugins Security / 2.3.5
Patchstack – WordPress & Plugins Security v2.3.5
2.3.7 trunk 2.1.0 2.1.1 2.1.10 2.1.11 2.1.12 2.1.13 2.1.14 2.1.15 2.1.16 2.1.17 2.1.18 2.1.19 2.1.2 2.1.20 2.1.21 2.1.22 2.1.23 2.1.24 2.1.25 2.1.3 2.1.4 2.1.5 2.1.6 All 49 releases
← All changes | includes/activation.php +9 -14 trunk2.3.5 View file →
@@ -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();
@@ -394,13 +394,9 @@
394 394
395 395 // Deactivate the license.
396 396 if ( $action == 'deactivate' ) {
397 397 update_option( 'patchstack_api_token', '' );
398 - update_option( 'patchstack_license_activated', '0' );
399 - update_option( 'patchstack_clientid', '' );
400 - update_option( 'patchstack_secretkey', '' );
401 - update_option( 'patchstack_secretkey_nonce', '' );
402 -
398 + update_option( 'patchstack_license_activated', '0', true );
403 399 $this->auto_prepend_removal();
404 400
405 401 return [
406 402 'result' => 'success',
@@ -749,9 +745,9 @@
749 745
750 746 // Ensure that the SERVER_SOFTWARE value is set.
751 747 $software = isset( $_SERVER['SERVER_SOFTWARE'] ) ? $_SERVER['SERVER_SOFTWARE'] : '';
752 748 if ( ! $software ) {
753 - update_option( 'patchstack_firewall_ap_error', 'Unsupported SERVER_SOFTWARE, found: ' . $software );
749 + update_option( 'patchstack_firewall_ap_error', 'Unsupported SERVER_SOFTWARE, found: ' . $_SERVER['SERVER_SOFTWARE'] );
754 750 return false;
755 751 }
756 752
757 753 // At this time, reject non-Apache environments.
@@ -765,11 +761,11 @@
765 761 $is_litespeed = stripos( $_SERVER['SERVER_SOFTWARE'], 'litespeed' ) !== false || $sapi == 'litespeed';
766 762
767 763 // Attempt to find the Apache version, < 2.4 does not support <If>.
768 764 // 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 );
765 + $version = function_exists( 'apache_get_version' ) ? apache_get_version() : $_SERVER['SERVER_SOFTWARE'];
766 + if ( stripos( $version, 'Apache/2.4' ) === false ) {
767 + update_option( 'patchstack_firewall_ap_error', 'Unsupported SERVER_SOFTWARE, found: ' . $_SERVER['SERVER_SOFTWARE'] );
772 768 return false;
773 769 }
774 770
775 771 // Add c-style slashes.
@@ -841,11 +837,10 @@
841 837 * @param mixed $value
842 838 * @return void
843 839 */
844 840 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' ] ) ) {
841 + // Only allow to run for our options.
842 + if ( !in_array( $option_name, [ 'patchstack_basic_firewall', 'patchstack_license_free', 'patchstack_firewall_rules_v3_ap' ] ) ) {
848 843 return;
849 844 }
850 845
851 846 // Not strict type matching.