Permalink
Browse files

Backport: Deny duplicate pingbacks and send message about new pingbacks

found in blog.
  • Loading branch information...
brockhaus committed Jan 17, 2012
1 parent ce431de commit 03141f34a15f8fb09a26571dab94be6d482ab840
Showing with 10 additions and 3 deletions.
  1. +3 −3 include/functions_comments.inc.php
  2. +7 −0 include/functions_trackbacks.inc.php
@@ -862,7 +862,7 @@ function serendipity_insertComment($id, $commentInfo, $type = 'NORMAL', $source
// Send mail to the author if he chose to receive these mails, or if the comment is awaiting moderation
if ($status != 'confirm' && (serendipity_db_bool($ca['moderate_comments'])
|| ($type == 'NORMAL' && serendipity_db_bool($row['mail_comments']))
|| ($type == 'TRACKBACK' && serendipity_db_bool($row['mail_trackbacks'])))) {
|| (($type == 'TRACKBACK' || $type == 'PINGBACK') && serendipity_db_bool($row['mail_trackbacks'])))) {
serendipity_sendComment($cid, $row['email'], $name, $email, $url, $id, $row['title'], $comments, $type, serendipity_db_bool($ca['moderate_comments']), $referer);
}
@@ -1119,7 +1119,7 @@ function serendipity_sendComment($comment_id, $to, $fromName, $fromEmail, $fromU
}
$entryURI = serendipity_archiveURL($id, $title, 'baseURL');
$path = ($type == 'TRACKBACK') ? 'trackback' : 'comment';
$path = ($type == 'TRACKBACK' || $type == 'PINGBACK') ? 'trackback' : 'comment';
// Check for using Tokens
if ($serendipity['useCommentTokens']) {
@@ -1153,7 +1153,7 @@ function serendipity_sendComment($comment_id, $to, $fromName, $fromEmail, $fromU
$action_more .= "\n" . str_repeat(' ', 3) . $action;
}
if ($type == 'TRACKBACK') {
if ($type == 'TRACKBACK' || $type == 'PINGBACK') {
/******************* TRACKBACKS *******************/
$subject = ($moderate_comment ? '[' . REQUIRES_REVIEW . '] ' : '') . NEW_TRACKBACK_TO . ' ' . $title;
@@ -400,6 +400,13 @@ function add_pingback ($id, $postdata) {
}
if ($id>0) {
// first check, if we already have this pingback
$comments = serendipity_fetchComments($id,1,'co.id',true,'PINGBACK'," AND co.url='$remote'");
if (is_array($comments) && sizeof($comments) == 1) {
log_pingback("We already have that PINGBACK!");
return 0; // We already have it!
}
// We don't have it, so save the pingback
serendipity_saveComment($id, $comment, 'PINGBACK');
return 1;
} else {

0 comments on commit 03141f3

Please sign in to comment.