Update of /cvsroot/php-blog/serendipity
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18087
Modified Files:
Tag: branch-smarty
NEWS serendipity_functions.inc.php
Log Message:
don't send more than one trackback to a link
Index: serendipity_functions.inc.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/serendipity_functions.inc.php,v
retrieving revision 1.419.2.22
retrieving revision 1.419.2.23
diff -u -d -r1.419.2.22 -r1.419.2.23
--- serendipity_functions.inc.php 19 Sep 2004 21:30:43 -0000 1.419.2.22
+++ serendipity_functions.inc.php 20 Sep 2004 09:43:59 -0000 1.419.2.23
@@ -2309,22 +2309,29 @@
$names = $matches[1];
$tmpid = serendipity_db_escape_string($id);
-
+ $checked_locations = array();
for ($i = 0, $j = count($locations); $i < $j; ++$i) {
- if($locations[$i][0] == '/') {
+ if ($locations[$i][0] == '/') {
$locations[$i] = 'http' . (!empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) != 'off' ? 's' : '') . '://' . $_SERVER['HTTP_HOST'] . $locations[$i];
}
+ if (!empty($checked_locations[$locations[$i]])) {
+ // If the same link in an entry has been trackbacked already, don't try another time.
+ continue;
+ }
+
$query = "SELECT COUNT(id) FROM {$serendipity['dbPrefix']}references
- WHERE entry_id = '". (int)$tmpid ."'
- AND link = '" . serendipity_db_escape_string($locations[$i]) . "'";
+ WHERE entry_id = '". (int)$tmpid ."'
+ AND link = '" . serendipity_db_escape_string($locations[$i]) . "'";
$row = serendipity_db_query($query, true, 'num');
if ($row[0] > 0) {
continue;
}
+
if (!isset($serendipity['noautodiscovery']) || !$serendipity['noautodiscovery']) {
serendipity_reference_autodiscover($locations[$i], $url, $author, $title, serendipity_trackback_excerpt($text));
+ $checked_locations[$locations[$i]] = true; // Store trackbacked link so that no further trackbacks will be sent to the same link
}
}
serendipity_db_query("DELETE FROM {$serendipity['dbPrefix']}references WHERE entry_id='$tmpid'");
@@ -3433,8 +3440,8 @@
function serendipity_smarty_hookPlugin($params, &$smarty) {
global $serendipity;
- static $hookable = array('frontend_header',
- 'entries_footer',
+ static $hookable = array('frontend_header',
+ 'entries_footer',
'frontend_comment');
if ( !isset($params['hook']) ) {
Index: NEWS
===================================================================
RCS file: /cvsroot/php-blog/serendipity/NEWS,v
retrieving revision 1.214.2.12
retrieving revision 1.214.2.13
diff -u -d -r1.214.2.12 -r1.214.2.13
--- NEWS 20 Sep 2004 09:23:33 -0000 1.214.2.12
+++ NEWS 20 Sep 2004 09:43:59 -0000 1.214.2.13
@@ -3,6 +3,9 @@
Version 0.8 ()
------------------------------------------------------------------------
+ * Fixed bug #1031059 - Trackbacks to a link will not be sent more
+ than once (garvinhicking)
+
* Added "Ping-o-Matic!" to weblogping plugin (garvinhicking)
* RSS Feed export will not contain rewritten URLs using event
|