/** * 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); } } }
/** * Execute module upgrade * * @return void */ public function execute_upgrade($itsec_old_version) { if ($itsec_old_version < 4041) { $current_options = get_site_option('itsec_ipcheck'); // If there are no current options, go with the new defaults by not saving anything if (is_array($current_options)) { $settings = ITSEC_Modules::get_defaults('network-brute-force'); if (isset($current_options['api_ban'])) { $settings['enable_ban'] = $current_options['api_ban']; } // Make sure the new module is properly activated or deactivated if ($settings['enable_ban']) { ITSEC_Modules::activate('network-brute-force'); } else { ITSEC_Modules::deactivate('network-brute-force'); } if (!empty($current_options['api_key'])) { $settings['api_key'] = $current_options['api_key']; // Don't ask users to sign up if they already have $settings['api_nag'] = false; } if (!empty($current_options['api_s'])) { $settings['api_secret'] = $current_options['api_s']; } if (!empty($current_options['optin'])) { $settings['updates_optin'] = $current_options['optin']; } ITSEC_Modules::set_settings('network-brute-force', $settings); } } }
/** * 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_brute_force'); // 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['enabled'] = isset($itsec_bwps_options['ll_enabled']) && $itsec_bwps_options['ll_enabled'] == 1 ? true : false; $current_options['max_attempts_host'] = isset($itsec_bwps_options['ll_maxattemptshost']) ? intval($itsec_bwps_options['ll_maxattemptshost']) : 5; $current_options['max_attempts_user'] = isset($itsec_bwps_options['ll_maxattemptsuser']) ? intval($itsec_bwps_options['ll_maxattemptsuser']) : 10; $current_options['check_period'] = isset($itsec_bwps_options['ll_checkinterval']) ? intval($itsec_bwps_options['ll_checkinterval']) : 5; update_site_option('itsec_brute_force', $current_options); } } if ($itsec_old_version < 4041) { $current_options = get_site_option('itsec_brute_force'); // If there are no current options, go with the new defaults by not saving anything if (is_array($current_options)) { // Make sure the new module is properly activated or deactivated if ($current_options['enabled']) { ITSEC_Modules::activate('brute-force'); } else { ITSEC_Modules::deactivate('brute-force'); } // remove 'enabled' which isn't use in the new module unset($current_options['enabled']); ITSEC_Modules::set_settings('brute-force', $current_options); } } }
/** * 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_four_oh_four'); // 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['enabled'] = isset($itsec_bwps_options['id_enabled']) && $itsec_bwps_options['id_enabled'] == 1 ? true : false; $current_options['check_period'] = isset($itsec_bwps_options['id_checkinterval']) ? intval($itsec_bwps_options['id_checkinterval']) : 5; $current_options['error_threshold'] = isset($itsec_bwps_options['id_threshold']) ? intval($itsec_bwps_options['id_threshold']) : 20; if (isset($itsec_bwps_options['id_whitelist']) && !is_array($itsec_bwps_options['id_whitelist']) && strlen($itsec_bwps_options['id_whitelist']) > 1) { $current_options['white_list'] .= explode(PHP_EOL, $itsec_bwps_options['id_whitelist']); } update_site_option('itsec_four_oh_four', $current_options); } } if ($itsec_old_version < 4041) { $current_options = get_site_option('itsec_four_oh_four'); // If there are no current options, go with the new defaults by not saving anything if (is_array($current_options)) { // Make sure the new module is properly activated or deactivated if ($current_options['enabled']) { ITSEC_Modules::activate('404-detection'); } else { ITSEC_Modules::deactivate('404-detection'); } // remove 'enabled' which isn't use in the new module unset($current_options['enabled']); ITSEC_Modules::set_settings('404-detection', $current_options); } } }
/** * 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_backup'); // 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['enabled'] = isset($itsec_bwps_options['backup_enabled']) && $itsec_bwps_options['backup_enabled'] == 1 ? true : false; $current_options['interval'] = isset($itsec_bwps_options['backup_interval']) ? intval($itsec_bwps_options['backup_interval']) : 1; update_site_option('itsec_backup', $current_options); } } if ($itsec_old_version < 4041) { $current_options = get_site_option('itsec_backup'); // If there are no current options, go with the new defaults by not saving anything if (is_array($current_options)) { // Make sure the new module is properly activated or deactivated if ($current_options['enabled']) { ITSEC_Modules::activate('backup'); } else { ITSEC_Modules::deactivate('backup'); } if (isset($current_options['location']) && !is_dir($current_options['location'])) { unset($current_options['location']); } $options = ITSEC_Modules::get_defaults('backup'); foreach ($options as $name => $value) { if (isset($current_options[$name])) { $options[$name] = $current_options[$name]; } } ITSEC_Modules::set_settings('backup', $options); } } }
/** * 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_strong_passwords'); // 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['enabled'] = isset($itsec_bwps_options['st_enablepassword']) && $itsec_bwps_options['st_enablepassword'] == 1 ? true : false; $current_options['roll'] = isset($itsec_bwps_options['st_passrole']) ? $itsec_bwps_options['st_passrole'] : 'administrator'; update_site_option('itsec_strong_passwords', $current_options); } } if ($itsec_old_version < 4041) { $current_options = get_site_option('itsec_strong_passwords'); // If there are no current options, go with the new defaults by not saving anything if (is_array($current_options)) { // Make sure the new module is properly activated or deactivated if ($current_options['enabled']) { ITSEC_Modules::activate('strong-passwords'); } else { ITSEC_Modules::deactivate('strong-passwords'); } $settings = array('role' => $current_options['roll']); ITSEC_Modules::set_settings('strong-passwords', $settings); } } }
/** * Execute module upgrade * * @return void */ public function execute_upgrade($itsec_old_version) { if ($itsec_old_version < 4000) { global $itsec_bwps_options, $itsec_globals; $current_options = get_site_option('itsec_away_mode'); $current_time = $itsec_globals['current_time']; // 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['enabled'] = isset($itsec_bwps_options['am_enabled']) && $itsec_bwps_options['am_enabled'] == 1 ? true : false; $current_options['type'] = isset($itsec_bwps_options['am_type']) && $itsec_bwps_options['am_type'] == 1 ? 1 : 2; if (isset($itsec_bwps_options['am_startdate']) && isset($itsec_bwps_options['am_starttime'])) { $current_options['start'] = strtotime(date('Y-m-d', $itsec_bwps_options['am_startdate'])) + intval($itsec_bwps_options['am_starttime']); } elseif (isset($current_options['am_starttime']) && $current_options['type'] == 1) { $current_options['start'] = strtotime(date('Y-m-d', $current_time)) + intval($itsec_bwps_options['am_starttime']); } else { $current_options['enabled'] = false; //didn't have the whole start picture so disable } if (isset($itsec_bwps_options['am_enddate']) && isset($itsec_bwps_options['am_endtime'])) { $current_options['end'] = strtotime(date('Y-m-d', $itsec_bwps_options['am_enddate'])) + intval($itsec_bwps_options['am_endtime']); } elseif (isset($itsec_bwps_options['am_endtime']) && $itsec_bwps_options['type'] == 1) { $current_options['end'] = strtotime(date('Y-m-d', $current_time)) + intval($itsec_bwps_options['am_endtime']); } else { $current_options['enabled'] = false; //didn't have the whole start picture so disable } update_site_option('itsec_away_mode', $current_options); $away_file = ITSEC_Core::get_storage_dir() . '/itsec_away.confg'; //override file if ($current_options['enabled'] === true && !file_exists($away_file)) { @file_put_contents($away_file, 'true'); } else { @unlink($away_file); } } } if ($itsec_old_version < 4041) { $current_options = get_site_option('itsec_away_mode'); $current_override_options = get_site_option('itsec_away_mode_sync_override'); // If there are no current options, go with the new defaults by not saving anything if (is_array($current_options) || is_array($current_override_options)) { $settings = ITSEC_Modules::get_defaults('away-mode'); $original_settings = $settings; if (is_array($current_options)) { $settings['type'] = 1 == $current_options['type'] ? 'daily' : 'one-time'; $settings['start'] = intval($current_options['start'] - ITSEC_Core::get_time_offset()); $settings['start_time'] = $current_options['start'] - strtotime(date('Y-m-d', $current_options['start'])); $settings['end'] = intval($current_options['end'] - ITSEC_Core::get_time_offset()); $settings['end_time'] = $current_options['end'] - strtotime(date('Y-m-d', $current_options['end'])); } if (is_array($current_override_options)) { $settings['override_type'] = $current_override_options['intention']; $settings['override_end'] = $current_override_options['expires']; } ITSEC_Modules::set_settings('away-mode', $settings); if (isset($current_options['enabled']) && $current_options['enabled']) { ITSEC_Modules::activate('away-mode'); } else { ITSEC_Modules::deactivate('away-mode'); } } } }
/** * 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_file_change'); // 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['enabled'] = isset($itsec_bwps_options['id_fileenabled']) && $itsec_bwps_options['id_fileenabled'] == 1 ? true : false; $current_options['email'] = isset($itsec_bwps_options['id_fileemailnotify']) && $itsec_bwps_options['id_fileemailnotify'] == 0 ? false : true; $current_options['notify_admin'] = isset($itsec_bwps_options['id_filedisplayerror']) && $itsec_bwps_options['id_filedisplayerror'] == 0 ? false : true; $current_options['method'] = isset($itsec_bwps_options['id_fileincex']) && $itsec_bwps_options['id_fileincex'] == 0 ? false : true; if (isset($itsec_bwps_options['id_specialfile']) && !is_array($itsec_bwps_options['id_specialfile']) && strlen($itsec_bwps_options['id_specialfile']) > 1) { $current_options['file_list'] .= explode(PHP_EOL, $itsec_bwps_options['id_specialfile']); } update_site_option('itsec_file_change', $current_options); } } if ($itsec_old_version < 4028) { if (!is_multisite()) { $options = array('itsec_local_file_list', 'itsec_local_file_list_0', 'itsec_local_file_list_1', 'itsec_local_file_list_2', 'itsec_local_file_list_3', 'itsec_local_file_list_4', 'itsec_local_file_list_5', 'itsec_local_file_list_6'); foreach ($options as $option) { $list = get_site_option($option); if ($list !== false) { delete_site_option($option); add_option($option, $list, '', 'no'); } } } } if ($itsec_old_version < 4041) { $current_options = get_site_option('itsec_file_change'); // If there are no current options, go with the new defaults by not saving anything if (is_array($current_options)) { // Make sure the new module is properly activated or deactivated if ($current_options['enabled']) { ITSEC_Modules::activate('file-change'); } else { ITSEC_Modules::deactivate('file-change'); } // remove 'enabled' which isn't use in the new module unset($current_options['enabled']); // This used to be boolean. Attempt to migrate to new string, falling back to default if (!is_array($current_options['method'])) { $current_options['method'] = $current_options['method'] ? 'exclude' : 'include'; } elseif (!in_array($current_options['method'], array('include', 'exclude'))) { $current_options['method'] = 'exclude'; } ITSEC_Modules::set_settings('file-change', $current_options); } } }
/** * 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); } } }
public function handle_ajax_request() { global $itsec_globals; if (WP_DEBUG) { ini_set('display_errors', 1); } $method = isset($_POST['method']) && is_string($_POST['method']) ? $_POST['method'] : ''; $module = isset($_POST['module']) && is_string($_POST['module']) ? $_POST['module'] : ''; if (false === check_ajax_referer('itsec-settings-nonce', 'nonce', false)) { ITSEC_Response::add_error(new WP_Error('itsec-settings-page-failed-nonce', __('A nonce security check failed, preventing the request from completing as expected. Please try reloading the page and trying again.', 'better-wp-security'))); } else { if (!ITSEC_Core::current_user_can_manage()) { ITSEC_Response::add_error(new WP_Error('itsec-settings-page-insufficient-privileges', __('A permissions security check failed, preventing the request from completing as expected. The currently logged in user does not have sufficient permissions to make this request. Please try reloading the page and trying again.', 'better-wp-security'))); } else { if (empty($method)) { ITSEC_Response::add_error(new WP_Error('itsec-settings-page-missing-method', __('The server did not receive a valid request. The required "method" argument is missing. Please try again.', 'better-wp-security'))); } else { if ('save' === $method) { $this->handle_post(); } else { if (empty($module)) { ITSEC_Response::add_error(new WP_Error('itsec-settings-page-missing-module', __('The server did not receive a valid request. The required "module" argument is missing. Please try again.', 'better-wp-security'))); } else { if ('activate' === $method) { ITSEC_Response::set_response(ITSEC_Modules::activate($module)); } else { if ('deactivate' === $method) { ITSEC_Response::set_response(ITSEC_Modules::deactivate($module)); } else { if ('is_active' === $method) { ITSEC_Response::set_response(ITSEC_Modules::is_active($module)); } else { if ('get_refreshed_module_settings' === $method) { ITSEC_Response::set_response($this->get_module_settings($module)); } else { if ('get_refreshed_widget_settings' === $method) { ITSEC_Response::set_response($this->get_widget_settings($module)); } else { if ('handle_module_request' === $method) { if (isset($this->modules[$module])) { if (isset($_POST['data'])) { $returned_value = $this->modules[$module]->handle_ajax_request($_POST['data']); if (!is_null($returned_value)) { ITSEC_Response::set_response($returned_value); } } else { ITSEC_Response::add_error(new WP_Error('itsec-settings-page-module-request-missing-data', __('The server did not receive a valid request. The required "data" argument for the module is missing. Please try again.', 'better-wp-security'))); } } else { ITSEC_Response::add_error(new WP_Error('itsec-settings-page-module-request-invalid-module', __("The server did not receive a valid request. The supplied module, \"{$module}\", does not exist. Please try again.", 'better-wp-security'))); } } else { if ('handle_widget_request' === $method) { if (isset($this->widgets[$module])) { if (isset($_POST['data'])) { $this->widgets[$module]->handle_ajax_request($_POST['data']); } else { ITSEC_Response::add_error(new WP_Error('itsec-settings-page-widget-request-missing-data', __('The server did not receive a valid request. The required "data" argument for the widget is missing. Please try again.', 'better-wp-security'))); } } else { ITSEC_Response::add_error(new WP_Error('itsec-settings-page-widget-request-invalid-widget', __("The server did not receive a valid request. The supplied widget, \"{$module}\", does not exist. Please try again.", 'better-wp-security'))); } } else { ITSEC_Response::add_error(new WP_Error('itsec-settings-page-unknown-method', __('The server did not receive a valid request. An unknown "method" argument was supplied. Please try again.', 'better-wp-security'))); } } } } } } } } } } } } ITSEC_Response::send_json(); }
/** * 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_ban_users'); // 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['enabled'] = isset($itsec_bwps_options['bu_enabled']) && $itsec_bwps_options['bu_enabled'] == 1 ? true : false; $current_options['default'] = isset($itsec_bwps_options['bu_blacklist']) && $itsec_bwps_options['bu_blacklist'] == 1 ? true : false; if (isset($itsec_bwps_options['bu_banlist']) && !is_array($itsec_bwps_options['bu_banlist']) && strlen($itsec_bwps_options['bu_banlist']) > 1) { $raw_hosts = explode(PHP_EOL, $itsec_bwps_options['bu_banlist']); foreach ($raw_hosts as $host) { if (strlen($host) > 1) { $current_options['host_list'][] = $host; } } } if (isset($itsec_bwps_options['bu_banagent']) && !is_array($itsec_bwps_options['bu_banagent']) && strlen($itsec_bwps_options['bu_banagent']) > 1) { $current_options['agent_list'] = explode(PHP_EOL, $itsec_bwps_options['bu_banagent']); $raw_agents = explode(PHP_EOL, $itsec_bwps_options['bu_banagent']); foreach ($raw_agents as $agent) { if (strlen($agent) > 1) { $current_options['agent_list'][] = $agent; } } } update_site_option('itsec_ban_users', $current_options); ITSEC_Response::regenerate_server_config(); } } if ($itsec_old_version < 4027) { ITSEC_Response::regenerate_server_config(); } if ($itsec_old_version < 4041) { $current_options = get_site_option('itsec_ban_users'); // If there are no current options, go with the new defaults by not saving anything if (is_array($current_options)) { $itsec_modules = ITSEC_Modules::get_instance(); // 'enable_ban_lists' was previously just 'enabled' // Make sure the new module is properly activated or deactivated if ($current_options['enabled']) { ITSEC_Modules::activate('backup'); $current_options['enable_ban_lists'] = true; } else { ITSEC_Modules::deactivate('backup'); $current_options['enable_ban_lists'] = false; } unset($current_options['enabled']); // Filter out invalid IPs $current_options['host_list'] = array_map('trim', $current_options['host_list']); if (!class_exists('ITSEC_Lib_IP_Tools')) { require_once ITSEC_Core::get_core_dir() . '/lib/class-itsec-lib-ip-tools.php'; } foreach ($current_options['host_list'] as $index => $ip) { if ('' === $ip || false === ITSEC_Lib_IP_Tools::ip_wild_to_ip_cidr($ip)) { unset($current_options['host_list'][$index]); } } $itsec_modules->set_settings('ban-users', $current_options); } } }
/** * 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); } } }
/** * 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); } } }