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:
parent
2fbbab314f
commit
563e4e9ff9
|
@ -727,27 +727,27 @@ function check_comment($author, $email, $url, $comment, $user_ip, $user_agent, $
|
||||||
return false; // Check # of external links
|
return false; // Check # of external links
|
||||||
|
|
||||||
$mod_keys = trim( get_settings('moderation_keys') );
|
$mod_keys = trim( get_settings('moderation_keys') );
|
||||||
if ('' == $mod_keys )
|
if ( !empty($mod_keys) ) {
|
||||||
return true; // If moderation keys are empty
|
$words = explode("\n", $mod_keys );
|
||||||
$words = explode("\n", $mod_keys );
|
|
||||||
|
|
||||||
foreach ($words as $word) {
|
foreach ($words as $word) {
|
||||||
$word = trim($word);
|
$word = trim($word);
|
||||||
|
|
||||||
// Skip empty lines
|
// Skip empty lines
|
||||||
if (empty($word)) { continue; }
|
if (empty($word)) { continue; }
|
||||||
|
|
||||||
// Do some escaping magic so that '#' chars in the
|
// Do some escaping magic so that '#' chars in the
|
||||||
// spam words don't break things:
|
// spam words don't break things:
|
||||||
$word = preg_quote($word, '#');
|
$word = preg_quote($word, '#');
|
||||||
|
|
||||||
$pattern = "#$word#i";
|
$pattern = "#$word#i";
|
||||||
if ( preg_match($pattern, $author) ) return false;
|
if ( preg_match($pattern, $author) ) return false;
|
||||||
if ( preg_match($pattern, $email) ) return false;
|
if ( preg_match($pattern, $email) ) return false;
|
||||||
if ( preg_match($pattern, $url) ) return false;
|
if ( preg_match($pattern, $url) ) return false;
|
||||||
if ( preg_match($pattern, $comment) ) return false;
|
if ( preg_match($pattern, $comment) ) return false;
|
||||||
if ( preg_match($pattern, $user_ip) ) return false;
|
if ( preg_match($pattern, $user_ip) ) return false;
|
||||||
if ( preg_match($pattern, $user_agent) ) return false;
|
if ( preg_match($pattern, $user_agent) ) return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Comment whitelisting:
|
// Comment whitelisting:
|
||||||
|
|
Loading…
Reference in New Issue