Do not skip whitelist checking if moderation keys are empty. http://mosquito.wordpress.org/view.php?id=1028 Props: ColdForged

git-svn-id: http://svn.automattic.com/wordpress/trunk@2414 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2005-03-07 00:16:06 +00:00
parent 2fbbab314f
commit 563e4e9ff9
1 changed files with 17 additions and 17 deletions

View File

@ -727,27 +727,27 @@ function check_comment($author, $email, $url, $comment, $user_ip, $user_agent, $
return false; // Check # of external links
$mod_keys = trim( get_settings('moderation_keys') );
if ('' == $mod_keys )
return true; // If moderation keys are empty
$words = explode("\n", $mod_keys );
if ( !empty($mod_keys) ) {
$words = explode("\n", $mod_keys );
foreach ($words as $word) {
$word = trim($word);
foreach ($words as $word) {
$word = trim($word);
// Skip empty lines
if (empty($word)) { continue; }
// 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, '#');
// 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 false;
if ( preg_match($pattern, $email) ) return false;
if ( preg_match($pattern, $url) ) return false;
if ( preg_match($pattern, $comment) ) return false;
if ( preg_match($pattern, $user_ip) ) return false;
if ( preg_match($pattern, $user_agent) ) return false;
$pattern = "#$word#i";
if ( preg_match($pattern, $author) ) return false;
if ( preg_match($pattern, $email) ) return false;
if ( preg_match($pattern, $url) ) return false;
if ( preg_match($pattern, $comment) ) return false;
if ( preg_match($pattern, $user_ip) ) return false;
if ( preg_match($pattern, $user_agent) ) return false;
}
}
// Comment whitelisting: