Exemple #1
0
function loginizer_load_plugin()
{
    global $loginizer;
    // Check if the installed version is outdated
    loginizer_update_check();
    $options = get_option('loginizer_options');
    $loginizer = array();
    $loginizer['max_retries'] = empty($options['max_retries']) ? 3 : $options['max_retries'];
    $loginizer['lockout_time'] = empty($options['lockout_time']) ? 900 : $options['lockout_time'];
    // 15 minutes
    $loginizer['max_lockouts'] = empty($options['max_lockouts']) ? 5 : $options['max_lockouts'];
    $loginizer['lockouts_extend'] = empty($options['lockouts_extend']) ? 86400 : $options['lockouts_extend'];
    // 24 hours
    $loginizer['reset_retries'] = empty($options['reset_retries']) ? 86400 : $options['reset_retries'];
    // 24 hours
    $loginizer['notify_email'] = empty($options['notify_email']) ? 0 : $options['notify_email'];
    // Load the blacklist and whitelist
    $loginizer['blacklist'] = get_option('loginizer_blacklist');
    $loginizer['whitelist'] = get_option('loginizer_whitelist');
    // When was the database cleared last time
    $loginizer['last_reset'] = get_option('loginizer_last_reset');
    //print_r($loginizer);
    // Clear retries
    if (time() - $loginizer['last_reset'] >= $loginizer['reset_retries']) {
        loginizer_reset_retries();
    }
    $ins_time = get_option('loginizer_ins_time');
    if (empty($ins_time)) {
        $ins_time = time();
        update_option('loginizer_ins_time', $ins_time);
    }
    $loginizer['ins_time'] = $ins_time;
    // Set the current IP
    $loginizer['current_ip'] = lz_getip();
    /* Filters and actions */
    // Use this to verify before WP tries to login
    // Is always called and is the first function to be called
    //add_action('wp_authenticate', 'loginizer_wp_authenticate', 10, 2);// Not called by XML-RPC
    add_filter('authenticate', 'loginizer_wp_authenticate', 10001, 3);
    // This one is called by xmlrpc as well as GUI
    // Is called when a login attempt fails
    // Hence Update our records that the login failed
    add_action('wp_login_failed', 'loginizer_login_failed');
    // Is called before displaying the error message so that we dont show that the username is wrong or the password
    // Update Error message
    add_action('wp_login_errors', 'loginizer_error_handler', 10001, 2);
    // Is the premium features there ?
    if (file_exists(LOGINIZER_DIR . '/premium.php')) {
        // Include the file
        include_once LOGINIZER_DIR . '/premium.php';
        loginizer_security_init();
    }
}
Exemple #2
0
function loginizer_load_plugin()
{
    global $loginizer;
    // Check if the installed version is outdated
    loginizer_update_check();
    $options = get_option('loginizer_options');
    $loginizer = array();
    $loginizer['max_retries'] = empty($options['max_retries']) ? 3 : $options['max_retries'];
    $loginizer['lockout_time'] = empty($options['lockout_time']) ? 900 : $options['lockout_time'];
    // 15 minutes
    $loginizer['max_lockouts'] = empty($options['max_lockouts']) ? 5 : $options['max_lockouts'];
    $loginizer['lockouts_extend'] = empty($options['lockouts_extend']) ? 86400 : $options['lockouts_extend'];
    // 24 hours
    $loginizer['reset_retries'] = empty($options['reset_retries']) ? 86400 : $options['reset_retries'];
    // 24 hours
    $loginizer['notify_email'] = empty($options['notify_email']) ? 0 : $options['notify_email'];
    // Load the blacklist and whitelist
    $loginizer['blacklist'] = get_option('loginizer_blacklist');
    $loginizer['whitelist'] = get_option('loginizer_whitelist');
    // When was the database cleared last time
    $loginizer_last_reset = get_option('loginizer_last_reset');
    //print_r($loginizer);
    // Clear retries
    if (time() - $loginizer_last_reset >= $loginizer['reset_retries']) {
        loginizer_reset_retries();
    }
    // Set the current IP
    $loginizer['current_ip'] = lz_getip();
    /* Filters and actions */
    // Use this to verify before WP tries to login
    // Is always called and is the first function to be called
    //add_action('wp_authenticate', 'loginizer_wp_authenticate', 10, 2);// Not called by XML-RPC
    add_filter('authenticate', 'loginizer_wp_authenticate', 10, 3);
    // This one is called by xmlrpc as well as GUI
    // This is used for additional validation
    // This function is called after the form is posted
    add_filter('wp_authenticate_user', 'loginizer_wp_authenticate_user', 99999, 2);
    // Is called when a login attempt fails
    // Hence Update our records that the login failed
    add_action('wp_login_failed', 'loginizer_login_failed');
    // Is called before displaying the error message so that we dont show that the username is wrong or the password
    // Update Error message
    add_action('login_errors', 'loginizer_update_error_msg');
}