function spamshield_ubl_cache($method = 'chk')
{
    /***
     * Check if user has been added to blacklist cache
     * Added 1.8
     * $method: 'set','chk'
     ***/
    /* Temporarily disabled in 1.8.9.2 for testing, re-enabled with modifications in 1.8.9.6 */
    if (TRUE == WPSS_TEMP_BL_DISABLE || !empty($_SESSION['wpss_clear_blacklisted_user_' . RSMP_HASH])) {
        spamshield_clear_ubl_cache();
        return FALSE;
    }
    $wpss_ubl_cache_disable = get_option('spamshield_ubl_cache_disable');
    if (!empty($wpss_ubl_cache_disable)) {
        spamshield_clear_ubl_cache();
        return FALSE;
    }
    $ip = spamshield_get_ip_addr();
    if ($ip == RSMP_SERVER_ADDR) {
        return FALSE;
    }
    /* Skip website IP address */
    if (strpos($ip, '.') !== FALSE) {
        $ip_arr = explode('.', $ip);
        unset($ip_arr[3]);
        $ip_c = implode('.', $ip_arr) . '.';
        if (strpos(RSMP_SERVER_ADDR, $ip_c) === 0) {
            return FALSE;
        }
        /* Skip anything on same C-Block as website */
    }
    if (strpos(RSMP_SERVER_NAME_REV, RSMP_DEBUG_SERVER_NAME_REV) !== 0) {
        if (spamshield_is_admin_ip($ip)) {
            return FALSE;
        }
    }
    /* TO DO: Add logic for reverse proxies */
    $blacklist_status = FALSE;
    $wpss_lang_ck_key = 'UBR_LANG';
    $wpss_lang_ck_val = 'default';
    $wpss_ubl_cache = get_option('spamshield_ubl_cache');
    if (empty($wpss_ubl_cache)) {
        $wpss_ubl_cache = array();
    }
    /* Check */
    if (!empty($_SESSION['wpss_blacklisted_user_' . RSMP_HASH]) || !empty($_COOKIE[$wpss_lang_ck_key]) && $_COOKIE[$wpss_lang_ck_key] == $wpss_lang_ck_val || !empty($ip) && in_array($ip, $wpss_ubl_cache, TRUE) || spamshield_referrer_blacklist_chk()) {
        $blacklist_status = TRUE;
    }
    /* Set */
    if (!empty($blacklist_status) || $method == 'set') {
        if (!empty($ip) && !in_array($ip, $wpss_ubl_cache, TRUE)) {
            $wpss_ubl_cache[] = $ip;
        }
        $_SESSION['wpss_blacklisted_user_' . RSMP_HASH] = TRUE;
        update_option('spamshield_ubl_cache', $wpss_ubl_cache);
    }
    return $blacklist_status;
}
示例#2
0
function spamshield_ubl_cache($method = 'chk')
{
    /***
     * Check if user has been added to blacklist cache
     * Added 1.8
     * $method: 'set','chk'
     ***/
    return FALSE;
    /* Temporarily disabled in 1.8.9.2 for testing */
    $blacklist_status = FALSE;
    $ip = $_SERVER['REMOTE_ADDR'];
    $last_admin_ip = get_option('spamshield_last_admin');
    if ($ip == $last_admin_ip) {
        return FALSE;
    }
    $wpss_lang_ck_key = 'UBR_LANG';
    $wpss_lang_ck_val = 'default';
    $wpss_ubl_cache = get_option('spamshield_ubl_cache');
    if (empty($wpss_ubl_cache)) {
        $wpss_ubl_cache = array();
    }
    /* Check */
    if (!empty($_SESSION['wpss_blacklisted_user_' . RSMP_HASH]) || !empty($_COOKIE[$wpss_lang_ck_key]) && $_COOKIE[$wpss_lang_ck_key] == $wpss_lang_ck_val || !empty($ip) && in_array($ip, $wpss_ubl_cache, TRUE) || spamshield_referrer_blacklist_chk()) {
        $blacklist_status = TRUE;
    }
    /* Set */
    if (!empty($blacklist_status) || $method == 'set') {
        if (!empty($ip) && !in_array($ip, $wpss_ubl_cache, TRUE)) {
            $wpss_ubl_cache[] = $ip;
        }
        $_SESSION['wpss_blacklisted_user_' . RSMP_HASH] = TRUE;
        update_option('spamshield_ubl_cache', $wpss_ubl_cache);
    }
    return $blacklist_status;
}