Whitelist trackbacks and pingbacks from domains in blogroll.

git-svn-id: http://svn.automattic.com/wordpress/trunk@2077 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
saxmatt 2005-01-10 23:21:42 +00:00
parent 2a6738aacb
commit 743313fa50
2 changed files with 12 additions and 7 deletions

View File

@ -713,7 +713,7 @@ function wp_notify_moderator($comment_id) {
return true;
}
function check_comment($author, $email, $url, $comment, $user_ip, $user_agent) {
function check_comment($author, $email, $url, $comment, $user_ip, $user_agent, $comment_type) {
global $wpdb;
if (1 == get_settings('comment_moderation')) return false; // If moderation is set to manual
@ -724,11 +724,16 @@ 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;
} else {
return false;
$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;
}
}

View File

@ -452,7 +452,7 @@ function wp_new_comment( $commentdata, $spam = false ) {
die( __('Sorry, you can only post a new comment once every 15 seconds. Slow down cowboy.') );
}
if ( check_comment($author, $email, $url, $comment, $user_ip, $user_agent) )
if ( check_comment($author, $email, $url, $comment, $user_ip, $user_agent, $comment_type) )
$approved = 1;
else
$approved = 0;