diff options
author | Dries Buytaert <dries@buytaert.net> | 2004-06-15 17:45:44 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2004-06-15 17:45:44 +0000 |
commit | 6f48727a9a7fad16334a37d84defd4ea492830f6 (patch) | |
tree | f7322174ae4f2df7a8a9990e7e785c8d1951310f /modules/blogapi/blogapi.module | |
parent | 624ffd1510e3b1ed1b4174992b95a1c2c2e11b4d (diff) | |
download | brdo-6f48727a9a7fad16334a37d84defd4ea492830f6.tar.gz brdo-6f48727a9a7fad16334a37d84defd4ea492830f6.tar.bz2 |
- Patch #8357 by Ax: added support for mt.getRecentPostTitles to the
blogapi module. Used by ecto. I changed '$titles_only' to '$bodies'
as the patch favored '!$titles_only'.
Diffstat (limited to 'modules/blogapi/blogapi.module')
-rw-r--r-- | modules/blogapi/blogapi.module | 32 |
1 files changed, 22 insertions, 10 deletions
diff --git a/modules/blogapi/blogapi.module b/modules/blogapi/blogapi.module index 008fd17f0..80ab41421 100644 --- a/modules/blogapi/blogapi.module +++ b/modules/blogapi/blogapi.module @@ -29,6 +29,7 @@ function blogapi_xmlrpc() { 'metaWeblog.newMediaObject' => array('function' => 'blogapi_new_media_object'), 'metaWeblog.getCategories' => array('function' => 'blogapi_get_category_list'), 'metaWeblog.getRecentPosts' => array('function' => 'blogapi_get_recent_posts'), + 'mt.getRecentPostTitles' => array('function' => 'blogapi_get_recent_post_titles'), 'mt.getCategoryList' => array('function' => 'blogapi_get_category_list'), 'mt.getPostCategories' => array('function' => 'blogapi_get_post_categories'), 'mt.setPostCategories' => array('function' => 'blogapi_set_post_categories') @@ -342,9 +343,11 @@ function blogapi_set_post_categories($req_params) { } /** - * Blogging API callback. Returns the latest few postings in a user's blog. + * Blogging API callback. Returns the latest few postings in a user's blog. $bodies TRUE + * <a href="http://movabletype.org/docs/mtmanual_programmatic.html#item_mt%2EgetRecentPostTitles"> + * returns a bandwidth-friendly list</a>. */ -function blogapi_get_recent_posts($req_params) { +function blogapi_get_recent_posts($req_params, $bodies = TRUE) { $params = blogapi_convert($req_params); // Remove unused appkey (from bloggerAPI). @@ -356,19 +359,28 @@ function blogapi_get_recent_posts($req_params) { return blogapi_error($user); } - $result = db_query_range("SELECT n.nid, n.title, n.body, n.created, u.name FROM {node} n, {users} u WHERE n.uid=u.uid AND n.type = 'blog' AND n.uid = %d ORDER BY n.created DESC", $user->uid, 0, $params[3]); + $result = db_query_range('SELECT n.nid, n.title,'. ($bodies ? ' n.body,' : '') ." n.created, u.name FROM {node} n, {users} u WHERE n.uid=u.uid AND n.type = 'blog' AND n.uid = %d ORDER BY n.created DESC", $user->uid, 0, $params[3]); while ($blog = db_fetch_object($result)) { - $blogs[] = new xmlrpcval(array('userid' => new xmlrpcval($blog->name, 'string'), - 'dateCreated' => new xmlrpcval(iso8601_encode($blog->created), 'dateTime.iso8601'), - 'content' => new xmlrpcval("<title>$blog->title</title>$blog->body", 'string'), - 'title' => new xmlrpcval($blog->title, 'string'), - 'description' => new xmlrpcval($blog->body, 'string'), - 'postid' => new xmlrpcval($blog->nid, 'string')), - 'struct'); + $xmlrpcval = array ( + 'userid' => new xmlrpcval($blog->name, 'string'), + 'dateCreated' => new xmlrpcval(iso8601_encode($blog->created), 'dateTime.iso8601'), + 'title' => new xmlrpcval($blog->title, 'string'), + 'postid' => new xmlrpcval($blog->nid, 'string') + ); + if ($bodies) { + $xmlrpcval['content'] = new xmlrpcval("<title>$blog->title</title>$blog->body", 'string'); + $xmlrpcval['description'] = new xmlrpcval($blog->body, 'string'); + } + $blogs[] = new xmlrpcval($xmlrpcval, 'struct'); } return new xmlrpcresp(new xmlrpcval($blogs, 'array')); } +// see above +function blogapi_get_recent_post_titles($req_params) { + return blogapi_get_recent_posts($req_params, TRUE); +} + /** * Process the parameters to an XMLRPC callback, and return them as an array. */ |