# HG changeset patch # User Dan # Date 1232985809 18000 # Node ID 4d846a3850631b2a59779b7b41526234a267b11a First (and probably only) commit. This plugin is intended only for developers to see how to do spam filtering. diff -r 000000000000 -r 4d846a385063 plugins/SampleSpamcheck.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/plugins/SampleSpamcheck.php Mon Jan 26 11:03:29 2009 -0500 @@ -0,0 +1,43 @@ +attachHook('spam_check', 'sample_spam_check($string, $name, $email, $url, $ip);'); + +function sample_spam_check(&$string, &$name, &$email, &$url, &$ip) +{ + // Define our word list + $words = array('boob', 'titty', 'teenage', 'viagra'); + foreach ( $words as $word ) + { + if ( stristr($string, $word) ) + return false; + } + // This name always means trouble. + if ( $name == 'Pojo' ) + return false; + // Block hotmail e-mail addresses + if ( preg_match('/@hotmail\.com$/', $email) ) + return false; + // Check URL for bad words + foreach ( $words as $word ) + { + if ( stristr($url, $word) ) + return false; + } + // block IPs + if ( $ip == '127.0.1.1') + return false; + + // Always return true if all checks pass! + return true; +}