From 8968f4f1aa21007a4e381066cebc9376d0198c14 Mon Sep 17 00:00:00 2001 From: rboren Date: Fri, 21 Jan 2005 03:33:13 +0000 Subject: [PATCH] Fix whitelist. Bug 664. git-svn-id: http://svn.automattic.com/wordpress/trunk@2114 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/comment-functions.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/wp-includes/comment-functions.php b/wp-includes/comment-functions.php index 6b7613f594..51d2865397 100644 --- a/wp-includes/comment-functions.php +++ b/wp-includes/comment-functions.php @@ -726,17 +726,20 @@ function check_comment($author, $email, $url, $comment, $user_ip, $user_agent, $ // Comment whitelisting: if ( 1 == get_settings('comment_whitelist')) { - if( $author != '' && $email != '' ) { - $ok_to_comment = $wpdb->get_var("SELECT comment_approved FROM $wpdb->comments WHERE comment_author = '$author' AND comment_author_email = '$email' and comment_approved = '1' "); - if ( 1 == $ok_to_comment && false === strpos( $email, get_settings('moderation_keys')) ) - return true; - } if ( 'trackback' == $comment_type || 'pingback' == $comment_type ) { // check if domain is in blogroll $uri = parse_url($url); $domain = $uri['host']; $in_blogroll = $wpdb->get_var("SELECT link_id FROM $wpdb->links WHERE link_url LIKE ('%$domain%') LIMIT 1"); if ( $in_blogroll ) return true; + } elseif( $author != '' && $email != '' ) { + $ok_to_comment = $wpdb->get_var("SELECT comment_approved FROM $wpdb->comments WHERE comment_author = '$author' AND comment_author_email = '$email' and comment_approved = '1' "); + if ( 1 == $ok_to_comment && false === strpos( $email, get_settings('moderation_keys')) ) + return true; + else + return false; + } else { + return false; } }