Update of /cvsroot/php-blog/serendipity
In directory sc8-pr-cvs1:/tmp/cvs-serv18444
Modified Files:
NEWS TODO serendipity_functions.inc.php
Log Message:
Initial commit of Jim's patch that adds support for pinging weblogs.com, blo.gs, blogrolling.com and technorati.com to announce new entries.
Index: NEWS
===================================================================
RCS file: /cvsroot/php-blog/serendipity/NEWS,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -d -r1.39 -r1.40
--- NEWS 23 Dec 2003 18:06:11 -0000 1.39
+++ NEWS 18 Jan 2004 12:46:39 -0000 1.40
@@ -2,6 +2,7 @@
Version 0.5 ()
------------------------------------
+ * Added support for pinging weblogs.com, blo.gs, blogrolling.com and technorati.com to announce new entries. (jimwinstead, sebastianbergmann)
* Allow Autologin, saving login information in a cookie (tomsommer)
* HTML-Nugget can now be configured to preserve textformatting. Default is 'apply textformatting' to stay backwards-compatible. (garvinhicking)
Index: TODO
===================================================================
RCS file: /cvsroot/php-blog/serendipity/TODO,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- TODO 23 Dec 2003 18:06:11 -0000 1.11
+++ TODO 18 Jan 2004 12:46:39 -0000 1.12
@@ -13,7 +13,9 @@
* Rename serendipity_config.inc.php to serendipity.inc.php
* Allow for blogging in Mozilla/Firebird sidebars
* Allow for blogging from GNOME Blog (http://www.gnome.org/~seth/gnome-blog/)
+ and gaim-blogger (http://gaim-blogger.sourceforge.net/).
* Instead of keeping track of how many comments in the entries table, do some kind of JOIN with the comments table.
+* Make pinging of blo.gs et al. configurable.
! Don't trackback files (zip, rar etc.) (Check headers for content-type? or just file extension?)
! Allow for upgrades of Serendipity in the installer
Index: serendipity_functions.inc.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/serendipity_functions.inc.php,v
retrieving revision 1.176
retrieving revision 1.177
diff -u -d -r1.176 -r1.177
--- serendipity_functions.inc.php 13 Jan 2004 17:47:57 -0000 1.176
+++ serendipity_functions.inc.php 18 Jan 2004 12:46:39 -0000 1.177
@@ -3,6 +3,7 @@
include_once("${serendipity['serendipityPath']}serendipity_db.inc.php");
include_once("${serendipity['serendipityPath']}compat.php");
include_once("${serendipity['serendipityPath']}serendipity_functions_config.inc.php");
+include_once("${serendipity['serendipityPath']}bundled-libs/XML/RPC.php");
$serendipity['imageList'] = array();
function serendipity_logout() {
@@ -1802,6 +1803,11 @@
serendipity_purgeEntry($entry['id'], $entry['timestamp']);
+ # XXX this may not handle a previously-entered draft being made live
+ if ( $entry['isdraft'] == 'false' && $newEntry ) {
+ serendipity_announceEntry();
+ }
+
return (int)$entry['id'];
}
@@ -2505,6 +2511,67 @@
}
}
+/**
+* Announces a new entry to any ping services that are registered.
+**/
+function serendipity_announceEntry() {
+ global $serendipity;
+
+ # XXX: TODO: Allow the list of services to be configured.
+ $services = array(
+ 'weblogs.com' => array('host' => 'rpc.weblogs.com', 'path' => '/RPC2'),
+ 'blo.gs' => array('host' => 'ping.blo.gs', 'path' => '/', 'extended' => true),
+ 'blogrolling.com' => array('host' => 'rpc.blogrolling.com', 'path' => '/pinger/'),
+ 'technorati.com' => array('host' => 'rpc.technorati.com', 'path' => '/rpc/ping'),
+ );
+
+ foreach ($services as $service => $details) {
+ # XXX append $serendipity['indexFile'] to baseURL?
+ $args = array(
+ new XML_RPC_Value(
+ $serendipity['blogTitle'],
+ 'string'
+ ),
+ new XML_RPC_Value(
+ $serendipity['baseURL'],
+ 'string'
+ )
+ );
+
+ if ($details['extended']) {
+ # the checkUrl: for when the main page is not really the main page
+ $args[] = new XML_RPC_Value(
+ '',
+ 'string'
+ );
+
+ # the rssUrl
+ $args[] = new XML_RPC_Value(
+ $serendipity['baseURL'] . 'rss.php?version=2.0',
+ 'string'
+ );
+ }
+
+ $message = new XML_RPC_Message(
+ $details['extended'] ? 'weblogUpdates.extendedPing' : 'weblogUpdates.ping',
+ $args
+ );
+
+ $client = new XML_RPC_Client(
+ $details['path'],
+ $details['host']
+ );
+
+ # 15 second timeout may not be long enough for weblogs.com
+ $result = $client->send($message, 15);
+
+ # TODO do something with the result? (do we care?)
+ }
+
+ return true;
+}
+
define("serendipity_FUNCTIONS_LOADED", true);
/* vim: set sts=4 ts=4 expandtab : */
?>
+
\ No newline at end of file
|