// 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
    $whitelist = $_POST['brute_ip_whitelist'];
Example #2
0
/**
 * Returns an array of installed themes
 *
 * @since 2.0
 *
 * @return array
 */
function bruteprotect_get_themes()
{
    if (!function_exists('wp_get_themes')) {
        require_once ABSPATH . 'wp-admin/includes/theme.php';
    }
    $themes = wp_get_themes();
    $out_of_date_themes = bruteprotect_get_out_of_date_themes();
    $installed_themes = array();
    $current_theme = get_template();
    if (is_array($themes)) {
        foreach ($themes as $slug => $theme) {
            $needs_update = isset($out_of_date_themes[$slug]) ? '1' : '0';
            $update_to_version = isset($out_of_date_themes[$slug]) ? $out_of_date_themes[$slug]['new_version'] : '';
            $active = $current_theme == $slug ? '1' : '0';
            $installed_themes[$slug]['Name'] = $theme->get('Name');
            $installed_themes[$slug]['ThemeURI'] = $theme->get('ThemeURI');
            $installed_themes[$slug]['Description'] = $theme->get('Description');
            $installed_themes[$slug]['Author'] = $theme->get('Author');
            $installed_themes[$slug]['AuthorURI'] = $theme->get('AuthorURI');
            $installed_themes[$slug]['Version'] = $theme->get('Version');
            $installed_themes[$slug]['Template'] = $theme->get('Template');
            $installed_themes[$slug]['Status'] = $theme->get('Status');
            $installed_themes[$slug]['Tags'] = $theme->get('Tags');
            $installed_themes[$slug]['TextDomain'] = $theme->get('TextDomain');
            $installed_themes[$slug]['DomainPath'] = $theme->get('DomainPath');
            $installed_themes[$slug]['needs_update'] = $needs_update;
            $installed_themes[$slug]['update_to_version'] = $update_to_version;
            $installed_themes[$slug]['active'] = $active;
        }
    }
    return $installed_themes;
}