/** * Check to see if a member is banned (or not) * * @access public * @param string Type of ban check (ip/ipAddress, name, email) * @param string String to check * @return boolean TRUE (banned) - FALSE (not banned) */ public static function isBanned($type, $string) { /* Try and be helpful */ switch (strtolower($type)) { case 'ip': $type = 'ipAddress'; break; case 'emailaddress': $type = 'email'; break; case 'username': case 'displayname': $type = 'name'; break; } if ($type == 'ipAddress') { $banCache = ipsRegistry::cache()->getCache('banfilters'); } else { if (!is_array(self::$_banFiltersCache)) { self::$_banFiltersCache = array(); /* Load Ban Filters */ ipsRegistry::DB()->build(array('select' => '*', 'from' => 'banfilters')); ipsRegistry::DB()->execute(); while ($r = ipsRegistry::DB()->fetch()) { self::$_banFiltersCache[$r['ban_type']][] = $r['ban_content']; } } $banCache = self::$_banFiltersCache[$type]; } if (is_array($banCache) and count($banCache)) { foreach ($banCache as $entry) { $ip = str_replace('\\*', '.*', preg_quote(trim($entry), "/")); if ($ip and preg_match("/^{$ip}\$/", $string)) { return TRUE; } } } return FALSE; }