[geeklog-cvs] geeklog-1.3/system lib-trackback.php,1.3,1.4
dhaun at iowaoutdoors.org
dhaun at iowaoutdoors.org
Fri Jan 28 03:38:43 EST 2005
Update of /var/cvs/geeklog-1.3/system
In directory www:/tmp/cvs-serv5382
Modified Files:
lib-trackback.php
Log Message:
Moved code to save a trackback comment to its own function. Also delete any old trackback comments from the same URL before adding the new one.
Index: lib-trackback.php
===================================================================
RCS file: /var/cvs/geeklog-1.3/system/lib-trackback.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** lib-trackback.php 21 Jan 2005 12:04:21 -0000 1.3
--- lib-trackback.php 28 Jan 2005 08:38:41 -0000 1.4
***************
*** 187,190 ****
--- 187,231 ----
/**
+ * Save a trackback (or pingback) comment.
+ *
+ * @param string $sid entry id
+ * @param string $type type of entry ('article' = story, etc.)
+ * @param string $url URL of the trackback comment
+ * @param string $title title of the comment (set to $url if empty)
+ * @param string $blog name of the blog that sent the comment
+ * @param string $excerpt excerpt from the comment
+ * @return void
+ *
+ */
+ function TRB_saveTrackbackComment ($sid, $type, $url, $title = '', $blog = '', $excerpt = '')
+ {
+ global $_TABLES;
+
+ // MT does that, so follow its example ...
+ if (strlen ($excerpt) > 255) {
+ $excerpt = substr ($excerpt, 0, 252) . '...';
+ }
+
+ $title = str_replace (array ('$', '{', '}'),
+ array ('$', '{', '~'), $title);
+ $excerpt = str_replace (array ('$', '{', '}'),
+ array ('$', '{', '~'), $excerpt);
+ $blog = str_replace (array ('$', '{', '}'),
+ array ('$', '{', '~'), $blog);
+
+ $url = addslashes ($url);
+ $title = addslashes ($title);
+ $blog = addslashes ($blog);
+ $excerpt = addslashes ($excerpt);
+
+ // delete any earlier trackbacks from the same URL
+ DB_delete ($_TABLES['trackback'], array ('url', 'sid', 'type'),
+ array ($url, $sid, $type));
+
+ DB_save ($_TABLES['trackback'], 'sid,url,title,blog,excerpt,date,type,ipaddress',
+ "'$sid','$url','$title','$blog','$excerpt',NOW(),'$type','{$_SERVER['REMOTE_ADDR']}'");
+ }
+
+ /**
* Delete a trackback comment
*
***************
*** 348,370 ****
}
! // MT does that, so follow its example ...
! if (strlen ($excerpt) > 255) {
! $excerpt = substr ($excerpt, 0, 252) . '...';
! }
!
! $title = str_replace (array ('$', '{', '}'),
! array ('$', '{', '~'), $title);
! $excerpt = str_replace (array ('$', '{', '}'),
! array ('$', '{', '~'), $excerpt);
! $blog = str_replace (array ('$', '{', '}'),
! array ('$', '{', '~'), $blog);
!
! $url = addslashes ($url);
! $title = addslashes ($title);
! $blog = addslashes ($blog);
! $excerpt = addslashes ($excerpt);
!
! DB_save ($_TABLES['trackback'], 'sid,url,title,blog,excerpt,date,type,ipaddress',
! "'$sid','$url','$title','$blog','$excerpt',NOW(),'$type','{$_SERVER['REMOTE_ADDR']}'");
COM_updateSpeedlimit ('trackback');
--- 389,393 ----
}
! TRB_saveTrackbackComment ($sid, $type, $url, $title, $blog, $excerpt);
COM_updateSpeedlimit ('trackback');
More information about the geeklog-cvs
mailing list