Permalink
Browse files

Prevent adding trackbacks we already have, coming from the same URL and

pointing to the same article.
  • Loading branch information...
brockhaus committed Jan 25, 2012
1 parent a2404fb commit 92c4b0b4f67957184c4c3027e5c87ed3afa4e625
Showing with 13 additions and 3 deletions.
  1. +13 −3 include/functions_trackbacks.inc.php
@@ -362,9 +362,19 @@ function add_trackback ($id, $title, $url, $name, $excerpt) {
fclose($fp);
}
serendipity_saveComment($id, $comment, 'TRACKBACK');
return 1;
if ($id>0) {
// first check, if we already have this pingback
$comments = serendipity_fetchComments($id,1,'co.id',true,'TRACKBACK'," AND co.url='$url'");
if (is_array($comments) && sizeof($comments) == 1) {
log_pingback("We already have that TRACKBACK!");
return 0; // We already have it!
}
// We don't have it, so save the pingback
serendipity_saveComment($id, $comment, 'TRACKBACK');
return 1;
} else {
return 0;
}
}
/**

0 comments on commit 92c4b0b

Please sign in to comment.