= get_settings('comment_max_links') )
$strike += 1;
//Strike: If there is a Spam Words Match, you have two strikes
$words = explode("\n", get_settings('moderation_keys') );
foreach ($words as $word) {
$word = trim($word);
$pattern = "#$word#i";
if ( preg_match($pattern, $author) ) $strike += 1;
if ( preg_match($pattern, $email) ) $strike += 1;
if ( preg_match($pattern, $url) ) $strike += 1;
if ( preg_match($pattern, $comment) ) $strike += 1;
if ( preg_match($pattern, $user_ip) ) $strike += 1;
if ( preg_match($pattern, $author_encoded) ) $strike += 1;
if ( preg_match($pattern, $email_encoded) ) $strike += 1;
if ( preg_match($pattern, $url_encoded) ) $strike += 1;
if ( preg_match($pattern, $comment_encoded) ) $strike += 1;
}
//This code is from Dougal's Spam Tar Pit
// If using moderation_keys, get the IPs and add them to the list
$modkeys = get_settings( 'moderation_keys' );
// Got this monster regexp from http://www.regular-expressions.info/examples.html
$ip_regex = '/^\s*(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\s*$/m';
$mcount = preg_match_all( $ip_regex, $modkeys, $match_ips );
$matches = $match_ips[0];
if ( count( $matches ) > 0 ) {
// Add IP numbers found
foreach ( $matches as $ip ) {
$ip = trim($ip);
$spammer_ips[] = "/^$ip$/";
}
}
// Strike: Match current visitor IP against banned addresses, every match is a major "strike"
if ( is_array( $spammer_ips ) ) {
foreach ($spammer_ips as $ip) {
if ( preg_match( $ip, $_SERVER['REMOTE_ADDR'] ) ) {
$strike += 5;
}
}
}
//Strike: If there is no referer for the posted comment, that is, it did not come from the blog, another strike
if ('' == $_SERVER['HTTP_REFERER']) {
$strike += 1;
}
//This is where the strikes are processed.
if ($strike >= $SpamThreshold) {
// header("Location: $RedirectSite");
//die('Too Bad Spammer');
// Your email address
$email = get_settings("admin_email");
// The subject
$subject = "WordPress comment blocked";
// The message
$message = $comment."
".$author."
".$email."
".$url."
".$user_ip."
"."";
mail($email, $subject, $message, "From: $email");
echo ("Your Comment: ");
echo ($comment);
die( __("Sorry, but some of the content of this comment appears to violate our comment policies. This determination has been made using filtering software. If you believe you have received this message in error, please contact us by e-mail as soon as possible. In addition, please note that this comment will not be saved on our server. Therefore, if you wish to preserve any of the content of this comment, you should copy it from this screen right now. Thank you.") );
}
}
?>