You are here

function spambot_check_whitelist in Spambot 7

Same name and namespace in other branches
  1. 8 spambot.module \spambot_check_whitelist()

Check if current data $type is whitelisted.

Parameters

string $type: Type can be one of these three values: 'ip', 'email' or 'username'.

string $value: Value to be checked.

Return value

bool TRUE if data is whitelisted, FALSE otherwise.

3 calls to spambot_check_whitelist()
spambot_account_is_spammer in ./spambot.module
Checks an account to see if it's a spammer.
spambot_user_register_form_validate in ./spambot.module
Validate callback for user_register form.
_spambot_user_spam_admin_form_submit_check in ./spambot.pages.inc
Do complex checking at this user account.

File

./spambot.module, line 662
Main module file.

Code

function spambot_check_whitelist($type, $value) {
  switch ($type) {
    case 'ip':
      $whitelist_ips = variable_get('spambot_whitelist_ip', '');
      $result = strpos($whitelist_ips, $value) !== FALSE;
      break;
    case 'email':
      $whitelist_usernames = variable_get('spambot_whitelist_email', '');
      $result = strpos($whitelist_usernames, $value) !== FALSE;
      break;
    case 'username':
      $whitelist_emails = variable_get('spambot_whitelist_username', '');
      $result = strpos($whitelist_emails, $value) !== FALSE;
      break;
    default:
      $result = FALSE;
      break;
  }
  return $result;
}