global $wordpress_success; // save dashboard widget settings if (isset($_POST['brute_dashboard_widget_hide'])) { update_site_option('brute_dashboard_widget_hide', $_POST['brute_dashboard_widget_hide']); } // save dashboard widget settings if (isset($_POST['brute_dashboard_widget_admin_only'])) { update_site_option('brute_dashboard_widget_admin_only', $_POST['brute_dashboard_widget_admin_only']); } $wordpress_success = 'Your WordPress settings were saved.'; } if (isset($_POST['brute_action']) && $_POST['brute_action'] == 'register_and_link') { global $register_error, $linking_success, $current_user; $action = 'register_and_link'; $core_update = brute_protect_get_core_update(); $plugin_updates = bruteprotect_get_out_of_date_plugins(); $theme_updates = bruteprotect_get_out_of_date_themes(); $additional_data = array('first_name' => $_POST['first_name'], 'last_name' => $_POST['last_name'], 'email' => $_POST['email'], 'company' => $_POST['company'], 'password' => $_POST['password'], 'remote_id' => strval($current_user->ID), 'core_update' => $core_update, 'plugin_updates' => strval(count($plugin_updates)), 'theme_updates' => strval(count($theme_updates))); $sign = true; $response = $this->brute_call($action, $additional_data, $sign); if (isset($response['link_key'])) { update_user_meta($current_user->ID, 'bruteprotect_user_linked', $response['link_key']); update_site_option('bruteprotect_user_linked', '1'); $linking_success = $response['message']; } else { $register_error = $response['message']; } } if (isset($_POST['brute_action']) && $_POST['brute_action'] == 'update_brute_whitelist') { global $whitelist_success; //check the whitelist to make sure that it's clean
/** * Returns an array of installed plugins * * @since 2.0 * * @return array */ function bruteprotect_get_plugins() { if (!function_exists('get_plugins')) { require_once ABSPATH . 'wp-admin/includes/plugin.php'; } $installed_plugins = get_plugins(); $out_of_date_plugins = bruteprotect_get_out_of_date_plugins(); $bp_plugins = array(); if (is_array($installed_plugins)) { foreach ($installed_plugins as $key => &$plugin) { $needs_update = isset($out_of_date_plugins[$key]) ? '1' : '0'; $update_to_version = isset($out_of_date_plugins[$key]) ? $out_of_date_plugins[$key]->new_version : ''; $key_parts = explode('/', $key); $plugin['slug'] = $key_parts[0]; $plugin['path'] = $key; $plugin['needs_update'] = $needs_update; $plugin['update_to_version'] = $update_to_version; if (is_plugin_active($key)) { $plugin['active'] = '1'; } else { $plugin['active'] = '0'; } $bp_plugins[] = $plugin; } } return $bp_plugins; }