Example #1
0
 /**
  * Execute module upgrade
  *
  * @return void
  */
 public function execute_upgrade($itsec_old_version)
 {
     if ($itsec_old_version < 4000) {
         global $itsec_bwps_options;
         $current_options = get_site_option('itsec_ssl');
         // Don't do anything if settings haven't already been set, defaults exist in the module system and we prefer to use those
         if (false !== $current_options) {
             $current_options['frontend'] = isset($itsec_bwps_options['ssl_frontend']) ? intval($itsec_bwps_options['ssl_frontend']) : 0;
             update_site_option('itsec_ssl', $current_options);
             ITSEC_Response::regenerate_wp_config();
         }
     }
     if ($itsec_old_version < 4041) {
         $current_options = get_site_option('itsec_ssl');
         // If there are no current options, go with the new defaults by not saving anything
         if (is_array($current_options)) {
             // If anything in this module is being used activate it, otherwise deactivate it
             $activate = false;
             foreach ($current_options as $on) {
                 if ($on) {
                     $activate = true;
                     break;
                 }
             }
             if ($activate) {
                 ITSEC_Modules::activate('ssl');
             } else {
                 ITSEC_Modules::deactivate('ssl');
             }
             // remove 'enabled' which isn't used in the new module
             unset($current_options['enabled']);
             ITSEC_Modules::set_settings('ssl', $current_options);
         }
     }
 }
 public static function deactivate()
 {
     $self = self::get_instance();
     $self->remove_config_hooks();
     ITSEC_Response::regenerate_server_config();
     ITSEC_Response::regenerate_wp_config();
 }
Example #3
0
 protected function handle_settings_changes($old_settings)
 {
     if ($this->settings['digest_email'] && !$old_settings['digest_email']) {
         $digest_queue = array('last_sent' => ITSEC_Core::get_current_time_gmt(), 'messages' => array());
         update_site_option('itsec_message_queue', $digest_queue);
     }
     if ($this->settings['write_files'] && !$old_settings['write_files']) {
         ITSEC_Response::regenerate_server_config();
         ITSEC_Response::regenerate_wp_config();
     }
 }
Example #4
0
 protected function validate_settings()
 {
     if (!$this->can_save()) {
         return;
     }
     $previous_settings = ITSEC_Modules::get_settings($this->get_id());
     if ($this->settings['file_editor'] !== $previous_settings['file_editor']) {
         ITSEC_Response::regenerate_wp_config();
     }
     if ($this->settings['disable_xmlrpc'] !== $previous_settings['disable_xmlrpc'] || $this->settings['comment_spam'] !== $previous_settings['comment_spam']) {
         ITSEC_Response::regenerate_server_config();
     }
 }
Example #5
0
 protected function validate_settings()
 {
     if (!$this->can_save()) {
         return;
     }
     $previous_settings = ITSEC_Modules::get_settings($this->get_id());
     if ($this->settings['admin'] !== $previous_settings['admin']) {
         ITSEC_Response::regenerate_wp_config();
         if ($this->settings['admin']) {
             ITSEC_Response::force_logout();
         }
     }
 }
Example #6
0
 /**
  * Execute module upgrade
  *
  * @since 4.0
  *
  * @return void
  */
 public function execute_upgrade($itsec_old_version)
 {
     if ($itsec_old_version < 4000) {
         global $itsec_bwps_options;
         ITSEC_Lib::create_database_tables();
         $current_options = get_site_option('itsec_tweaks');
         // Don't do anything if settings haven't already been set, defaults exist in the module system and we prefer to use those
         if (false !== $current_options) {
             $current_options['protect_files'] = isset($itsec_bwps_options['st_ht_files']) && $itsec_bwps_options['st_ht_files'] == 1 ? true : false;
             $current_options['directory_browsing'] = isset($itsec_bwps_options['st_ht_browsing']) && $itsec_bwps_options['st_ht_browsing'] == 1 ? true : false;
             $current_options['request_methods'] = isset($itsec_bwps_options['st_ht_request']) && $itsec_bwps_options['st_ht_request'] == 1 ? true : false;
             $current_options['suspicious_query_strings'] = isset($itsec_bwps_options['st_ht_query']) && $itsec_bwps_options['st_ht_query'] == 1 ? true : false;
             $current_options['non_english_characters'] = isset($itsec_bwps_options['st_ht_foreign']) && $itsec_bwps_options['st_ht_foreign'] == 1 ? true : false;
             $current_options['long_url_strings'] = isset($itsec_bwps_options['st_longurl']) && $itsec_bwps_options['st_longurl'] == 1 ? true : false;
             $current_options['write_permissions'] = isset($itsec_bwps_options['st_fileperm']) && $itsec_bwps_options['st_fileperm'] == 1 ? true : false;
             update_site_option('itsec_tweaks', $current_options);
             ITSEC_Response::regenerate_server_config();
             ITSEC_Response::regenerate_wp_config();
         }
     }
     if ($itsec_old_version < 4035) {
         ITSEC_Response::regenerate_server_config();
     }
     if ($itsec_old_version < 4041) {
         $current_options = get_site_option('itsec_tweaks');
         // If there are no current options, go with the new defaults by not saving anything
         if (is_array($current_options)) {
             $new_module_settings = ITSEC_Modules::get_settings('system-tweaks');
             // Reduce to only settings in new module
             $current_options = array_intersect_key($current_options, $new_module_settings);
             // Use new module settings as defaults for any missing settings
             $current_options = array_merge($new_module_settings, $current_options);
             // If anything in this module is being used activate it, otherwise deactivate it
             $activate = false;
             foreach ($current_options as $on) {
                 if ($on) {
                     $activate = true;
                     break;
                 }
             }
             if ($activate) {
                 ITSEC_Modules::activate('system-tweaks');
             } else {
                 ITSEC_Modules::deactivate('system-tweaks');
             }
             ITSEC_Modules::set_settings('system-tweaks', $current_options);
         }
     }
 }
Example #7
0
 /**
  * Execute module upgrade
  *
  * @since 4.0
  *
  * @return void
  */
 public function execute_upgrade($itsec_old_version)
 {
     if ($itsec_old_version < 4000) {
         global $itsec_bwps_options;
         ITSEC_Lib::create_database_tables();
         $current_options = get_site_option('itsec_tweaks');
         // Don't do anything if settings haven't already been set, defaults exist in the module system and we prefer to use those
         if (false !== $current_options) {
             $current_options['wlwmanifest_header'] = isset($itsec_bwps_options['st_manifest']) && $itsec_bwps_options['st_manifest'] == 1 ? true : false;
             $current_options['edituri_header'] = isset($itsec_bwps_options['st_edituri']) && $itsec_bwps_options['st_edituri'] == 1 ? true : false;
             $current_options['comment_spam'] = isset($itsec_bwps_options['st_comment']) && $itsec_bwps_options['st_comment'] == 1 ? true : false;
             $current_options['login_errors'] = isset($itsec_bwps_options['st_loginerror']) && $itsec_bwps_options['st_loginerror'] == 1 ? true : false;
             update_site_option('itsec_tweaks', $current_options);
             ITSEC_Response::regenerate_server_config();
             ITSEC_Response::regenerate_wp_config();
         }
     }
     if ($itsec_old_version < 4035) {
         ITSEC_Response::regenerate_server_config();
     }
     if ($itsec_old_version < 4041) {
         $current_options = get_site_option('itsec_tweaks');
         // If there are no current options, go with the new defaults by not saving anything
         if (is_array($current_options)) {
             $new_module_settings = ITSEC_Modules::get_settings('wordpress-tweaks');
             // Reduce to only settings in new module
             $current_options = array_intersect_key($current_options, $new_module_settings);
             // Use new module settings as defaults for any missing settings
             $current_options = array_merge($new_module_settings, $current_options);
             // If anything in this module is being used activate it, otherwise deactivate it
             $activate = false;
             foreach ($current_options as $setting => $on) {
                 // False is actually "enabled" for blocking xmlrpc multiauth
                 if ('allow_xmlrpc_multiauth' !== $setting && $on || 'allow_xmlrpc_multiauth' === $setting && !$on) {
                     $activate = true;
                     break;
                 }
             }
             if ($activate) {
                 ITSEC_Modules::activate('wordpress-tweaks');
             } else {
                 ITSEC_Modules::deactivate('wordpress-tweaks');
             }
             ITSEC_Modules::set_settings('wordpress-tweaks', $current_options);
         }
     }
 }
Example #8
0
 /**
  * Execute module upgrade
  *
  * @since 4.0
  *
  * @return void
  */
 public function execute_upgrade($itsec_old_version)
 {
     if ($itsec_old_version < 4000) {
         global $itsec_bwps_options;
         ITSEC_Lib::create_database_tables();
         $current_options = get_site_option('itsec_tweaks');
         // Don't do anything if settings haven't already been set, defaults exist in the module system and we prefer to use those
         if (false !== $current_options) {
             $current_options['theme_updates'] = isset($itsec_bwps_options['st_themenot']) && $itsec_bwps_options['st_themenot'] == 1 ? true : false;
             $current_options['plugin_updates'] = isset($itsec_bwps_options['st_pluginnot']) && $itsec_bwps_options['st_pluginnot'] == 1 ? true : false;
             $current_options['core_updates'] = isset($itsec_bwps_options['st_corenot']) && $itsec_bwps_options['st_corenot'] == 1 ? true : false;
             update_site_option('itsec_tweaks', $current_options);
             ITSEC_Response::regenerate_server_config();
             ITSEC_Response::regenerate_wp_config();
         }
     }
     if ($itsec_old_version < 4035) {
         ITSEC_Response::regenerate_server_config();
     }
     if ($itsec_old_version < 4041) {
         $current_options = get_site_option('itsec_tweaks');
         // If there are no current options, go with the new defaults by not saving anything
         if (is_array($current_options)) {
             $new_module_settings = ITSEC_Modules::get_settings('multisite-tweaks');
             // Reduce to only settings in new module
             $current_options = array_intersect_key($current_options, $new_module_settings);
             // Use new module settings as defaults for any missing settings
             $current_options = array_merge($new_module_settings, $current_options);
             // If anything in this module is being used activate it, otherwise deactivate it
             $activate = false;
             foreach ($current_options as $on) {
                 if ($on) {
                     $activate = true;
                     break;
                 }
             }
             if ($activate) {
                 ITSEC_Modules::activate('multisite-tweaks');
             } else {
                 ITSEC_Modules::deactivate('multisite-tweaks');
             }
             ITSEC_Modules::set_settings('multisite-tweaks', $current_options);
         }
     }
 }