Fixed check_comment() to ignore empty lines in moderation_keys.

git-svn-id: https://develop.svn.wordpress.org/trunk@1366 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Dougal Campbell 2004-05-27 13:53:27 +00:00
parent 9df4c2452a
commit 1cb1a9bf7a
1 changed files with 6 additions and 2 deletions

View File

@ -1342,8 +1342,12 @@ function check_comment($author, $email, $url, $comment, $user_ip) {
if ('' == trim( get_settings('moderation_keys') ) ) return true; // If moderation keys are empty
$words = explode("\n", get_settings('moderation_keys') );
foreach ($words as $word) {
$word = trim($word);
$pattern = "#$word#i";
$word = trim($word);
// Skip empty lines
if (empty($word)) { continue; }
$pattern = "#$word#i";
if ( preg_match($pattern, $author) ) return false;
if ( preg_match($pattern, $email) ) return false;
if ( preg_match($pattern, $url) ) return false;