Update of /cvsroot/php-blog/serendipity
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26353
Modified Files:
NEWS serendipity_xmlrpc.php
Log Message:
xmlrpc api
Index: serendipity_xmlrpc.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/serendipity_xmlrpc.php,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- serendipity_xmlrpc.php 21 Mar 2004 16:26:56 -0000 1.14
+++ serendipity_xmlrpc.php 27 May 2004 13:11:35 -0000 1.15
@@ -14,6 +14,10 @@
array('function' => 'blogger_editPost'),
'blogger.deletePost' =>
array('function' => 'blogger_deletePost'),
+ 'blogger.getRecentPosts' =>
+ array('function' => 'blogger_getRecentPosts'),
+ 'blogger.getPost' =>
+ array('function' => 'blogger_getPost'),
'metaWeblog.newPost' =>
array('function' => 'metaWeblog_newPost'),
'metaWeblog.editPost' =>
@@ -80,6 +84,62 @@
return($r);
}
+function blogger_getRecentPosts($message) {
+ $val = $message->params[2];
+ $username = $val->getval();
+ $val = $message->params[3];
+ $password = $val->getval();
+ $val = $message->params[4];
+ $numposts = $val->getval();
+ if(!serendipity_authenticate_author($username, $password)) {
+ return new XML_RPC_Response('', 4, 'Authentication Failed');
+ }
+ $entries = serendipity_fetchEntries('', false, $numposts);
+ $xml_entries_vals = array();
+ foreach ( $entries as $entry ) {
+ $xml_entries_vals[] = new XML_RPC_Value(
+ array(
+ 'postid' => new XML_RPC_Value($entry['id'], 'string'),
+ 'title' => new XML_RPC_Value($entry['title'], 'string'),
+ 'userid' => new XML_RPC_Value($entry['authorid'], 'string'),
+ 'dateCreated' => new XML_RPC_Value(XML_RPC_iso8601_encode($entry['timestamp']), 'dateTime.iso8601'),
+ 'postid' => new XML_RPC_Value($entry['id'], 'string')), 'struct');
+ }
+ $xml_entries = new XML_RPC_Value($xml_entries_vals, 'array');
+ return new XML_RPC_Response($xml_entries);
+}
+
+function blogger_getPost($message) {
+ global $serendipity;
+ $val = $message->params[1];
+ $postid = $val->getval();
+ $val = $message->params[2];
+ $username = $val->getval();
+ $val = $message->params[3];
+ $password = $val->getval();
+ if(!serendipity_authenticate_author($username, $password)) {
+ return new XML_RPC_Response('', 4, 'Authentication Failed');
+ }
+ $entry = serendipity_fetchEntry('id', $postid);
+
+ $tmp = array(
+ 'dateCreated' => new XML_RPC_Value(XML_RPC_iso8601_encode($entry['timestamp']), 'dateTime.iso8601'),
+ 'postid' => new XML_RPC_Value($postid, 'string'),
+ 'userid' => new XML_RPC_Value($entry['authorid'], 'string'),
+ 'description' => new XML_RPC_Value($entry['body'], 'string'),
+ 'content' => new XML_RPC_Value($entry['extended'], 'string'),
+ 'mt_excerpt' => new XML_RPC_Value('', 'string'),
+ 'mt_allow_comments' => new XML_RPC_Value(1, 'int'),
+ 'mt_allow_pings' => new XML_RPC_Value(1, 'int'),
+ 'mt_convert_breaks' => new XML_RPC_Value('', 'string'),
+ 'mt_keywords' => new XML_RPC_Value('', 'string'),
+ 'title' => new XML_RPC_Value($entry['title'],'string'),
+ 'permalink' => new XML_RPC_Value($serendipity['baseURL'] . ($serendipity['rewrite'] == 'none' ? '/' . $serendipity['indexFile'] . '?' : '') . '/'.PATH_ARCHIVES.'/' . $postid . '_.html', 'string'),
+ 'link' => new XML_RPC_Value($serendipity['baseURL'] . ($serendipity['rewrite'] == 'none' ? '/' . $serendipity['indexFile'] . '?' : '') . '/'.PATH_ARCHIVES.'/' . $postid . '_.html', 'string'));
+ $entry = new XML_RPC_Value($tmp, 'struct');
+ return new XML_RPC_Response($entry);
+}
+
function mt_getCategoryList($message) {
global $serendipity;
Index: NEWS
===================================================================
RCS file: /cvsroot/php-blog/serendipity/NEWS,v
retrieving revision 1.135
retrieving revision 1.136
diff -u -d -r1.135 -r1.136
--- NEWS 27 May 2004 12:01:02 -0000 1.135
+++ NEWS 27 May 2004 13:11:35 -0000 1.136
@@ -3,6 +3,9 @@
Version 0.7 ()
------------------------------------------------------------------------
+ * XML-RPC methods updated to includer blogger.getRecentPosts and
+ blogger.getPost (Till Adam)
+
* Upgraded karma-plugin to allow logging (IP/User-Agent) of votes
(garvinhicking)
|