Deny duplicate pingbacks and send message about new pingbacks found in

blog.
This commit is contained in:
Grischa Brockhaus 2012-01-17 12:55:09 +01:00
parent 4822b3e7b8
commit f2c6b669ad
2 changed files with 10 additions and 3 deletions

View File

@ -876,7 +876,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);
}
@ -1133,7 +1133,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']) {
@ -1167,7 +1167,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;

View File

@ -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 {