Example #1
0
function cerber_enable_citadel()
{
    global $wpdb;
    if (get_transient('cerber_citadel')) {
        return;
    }
    set_transient('cerber_citadel', true, cerber_get_options('ciduration') * 60);
    $wpdb->query($wpdb->prepare('INSERT INTO ' . CERBER_LOG_TABLE . ' (ip,stamp,activity) VALUES (%s,%d,%d)', cerber_get_ip(), time(), 12));
    // Notify admin
    if (cerber_get_options('cinotify')) {
        cerber_send_notify('citadel');
    }
}
Example #2
0
function cerber_sanitize_options($new, $old)
{
    $new['attempts'] = absint($new['attempts']);
    $new['period'] = absint($new['period']);
    $new['lockout'] = absint($new['lockout']);
    $new['agperiod'] = absint($new['agperiod']);
    $new['aglocks'] = absint($new['aglocks']);
    $new['aglast'] = absint($new['aglast']);
    if (get_option('permalink_structure')) {
        $new['loginpath'] = urlencode(str_replace('/', '', $new['loginpath']));
        if ($new['loginpath'] && $new['loginpath'] != $old['loginpath']) {
            $href = get_home_url() . '/' . $new['loginpath'] . '/';
            $url = urldecode($href);
            $msg = __('Attention! You have changed the login URL! The new login URL is', 'cerber');
            update_site_option('cerber_admin_notice', $msg . ': <a href="' . $href . '">' . $url . '</a>');
            cerber_send_notify('newlurl', $msg . ': ' . $url);
        }
    } else {
        $new['loginpath'] = '';
        $new['loginnowp'] = 0;
    }
    $new['ciduration'] = absint($new['ciduration']);
    $new['cilimit'] = absint($new['cilimit']);
    $new['cilimit'] = $new['cilimit'] == 0 ? '' : $new['cilimit'];
    $new['ciperiod'] = absint($new['ciperiod']);
    $new['ciperiod'] = $new['ciperiod'] == 0 ? '' : $new['ciperiod'];
    if (!$new['cilimit']) {
        $new['ciperiod'] = '';
    }
    if (!$new['ciperiod']) {
        $new['cilimit'] = '';
    }
    if (absint($new['keeplog']) == 0) {
        $new['keeplog'] = '';
    }
    return $new;
}