diff options
| author | donncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36> | 2006-06-13 11:18:16 +0000 |
|---|---|---|
| committer | donncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36> | 2006-06-13 11:18:16 +0000 |
| commit | 19b51f30bd324ecb36f99d159947b75c22b6fecf (patch) | |
| tree | 9423e53c5fddbfca6e4cd05f43c4e1e11bc508b4 /wp-inst/wp-includes/comment.php | |
| parent | 242d432d82cefdf3aab7135b5298c2db02c9114c (diff) | |
| download | wordpress-mu-19b51f30bd324ecb36f99d159947b75c22b6fecf.tar.gz wordpress-mu-19b51f30bd324ecb36f99d159947b75c22b6fecf.tar.xz wordpress-mu-19b51f30bd324ecb36f99d159947b75c22b6fecf.zip | |
WP Merge
git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@559 7be80a69-a1ef-0310-a953-fb0f7c49ff36
Diffstat (limited to 'wp-inst/wp-includes/comment.php')
| -rw-r--r-- | wp-inst/wp-includes/comment.php | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/wp-inst/wp-includes/comment.php b/wp-inst/wp-includes/comment.php index 931a8a5..45547db 100644 --- a/wp-inst/wp-includes/comment.php +++ b/wp-inst/wp-includes/comment.php @@ -195,6 +195,52 @@ function wp_allow_comment($commentdata) { return $approved; } +function wp_blacklist_check($author, $email, $url, $comment, $user_ip, $user_agent) { + global $wpdb; + + do_action('wp_blacklist_check', $author, $email, $url, $comment, $user_ip, $user_agent); + + if ( preg_match_all('/&#(\d+);/', $comment . $author . $url, $chars) ) { + foreach ($chars[1] as $char) { + // If it's an encoded char in the normal ASCII set, reject + if ( 38 == $char ) + continue; // Unless it's & + if ($char < 128) + return true; + } + } + + $mod_keys = trim( get_settings('blacklist_keys') ); + if ('' == $mod_keys ) + return false; // If moderation keys are empty + $words = explode("\n", $mod_keys ); + + foreach ($words as $word) { + $word = trim($word); + + // Skip empty lines + if ( empty($word) ) { continue; } + + // Do some escaping magic so that '#' chars in the + // spam words don't break things: + $word = preg_quote($word, '#'); + + $pattern = "#$word#i"; + if ( preg_match($pattern, $author ) ) return true; + if ( preg_match($pattern, $email ) ) return true; + if ( preg_match($pattern, $url ) ) return true; + if ( preg_match($pattern, $comment ) ) return true; + if ( preg_match($pattern, $user_ip ) ) return true; + if ( preg_match($pattern, $user_agent) ) return true; + } + + if ( isset($_SERVER['REMOTE_ADDR']) ) { + if ( wp_proxy_check($_SERVER['REMOTE_ADDR']) ) return true; + } + + return false; +} + function wp_delete_comment($comment_id) { global $wpdb; do_action('delete_comment', $comment_id); |
