MovableType XML-RPC api fix for ecto
Posted: Fri Apr 01, 2005 2:42 am
hi,
I've done a little hack of serendipity_xml-rpc.php to allow it to work with ecto. For anyone getting the metaWebLog.getPosts error like I was, this fixes it and allows you to view your posts in ecto. I'm not *entirely* convinced its fetching extended entries correctly, but its a big step forward at least.
Simple replace metaWebLog.getPosts function with:
function metaWeblog_getPost($message) {
global $serendipity;
$val = $message->params[0];
$postid = $val->getval();
$val = $message->params[1];
$username = $val->getval();
$val = $message->params[2];
$password = $val->getval();
if (!serendipity_authenticate_author($username, $password)) {
return new XML_RPC_Response('', 4, 'Authentication Failed');
}
$entry = serendipity_fetchEntry('id', $postid);
$tmp= new XML_RPC_Value(array(
'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($postid, 'string'),
'description' => new XML_RPC_Value($entry['body'], 'string'),
'title' => new XML_RPC_Value($entry['title'],'string'),
'link' => new XML_RPC_Value(serendipity_rewriteURL(PATH_ARCHIVES.'/' . $postid . '_.html',
'baseURL'), 'string'),
'permalink' => new XML_RPC_Value(serendipity_rewriteURL(PATH_ARCHIVES.'/' . $postid . '_.html',
'baseURL'), 'string'),
'mt_excerpt' => new XML_RPC_Value($entry['excerpt'], 'string'),
'mt_textmore' => new XML_RPC_Value($entry['extended'], 'string'),
'mt_allow_comments' => new XML_RPC_Value($entry['mt_allow_comments'], 'int'),
'mt_allow_pings' => new XML_RPC_Value($entry['mt_allow_pings'], 'int'),
'mt_convert_breaks' => new XML_RPC_Value($entry['mt_convert_breaks'], 'string'),
'mt_keywords' => new XML_RPC_Value($entry['mt_keywords'], 'string') ),
'struct');
return new XML_RPC_Response($tmp);
}
Cheers for now!
Tim
I've done a little hack of serendipity_xml-rpc.php to allow it to work with ecto. For anyone getting the metaWebLog.getPosts error like I was, this fixes it and allows you to view your posts in ecto. I'm not *entirely* convinced its fetching extended entries correctly, but its a big step forward at least.
Simple replace metaWebLog.getPosts function with:
function metaWeblog_getPost($message) {
global $serendipity;
$val = $message->params[0];
$postid = $val->getval();
$val = $message->params[1];
$username = $val->getval();
$val = $message->params[2];
$password = $val->getval();
if (!serendipity_authenticate_author($username, $password)) {
return new XML_RPC_Response('', 4, 'Authentication Failed');
}
$entry = serendipity_fetchEntry('id', $postid);
$tmp= new XML_RPC_Value(array(
'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($postid, 'string'),
'description' => new XML_RPC_Value($entry['body'], 'string'),
'title' => new XML_RPC_Value($entry['title'],'string'),
'link' => new XML_RPC_Value(serendipity_rewriteURL(PATH_ARCHIVES.'/' . $postid . '_.html',
'baseURL'), 'string'),
'permalink' => new XML_RPC_Value(serendipity_rewriteURL(PATH_ARCHIVES.'/' . $postid . '_.html',
'baseURL'), 'string'),
'mt_excerpt' => new XML_RPC_Value($entry['excerpt'], 'string'),
'mt_textmore' => new XML_RPC_Value($entry['extended'], 'string'),
'mt_allow_comments' => new XML_RPC_Value($entry['mt_allow_comments'], 'int'),
'mt_allow_pings' => new XML_RPC_Value($entry['mt_allow_pings'], 'int'),
'mt_convert_breaks' => new XML_RPC_Value($entry['mt_convert_breaks'], 'string'),
'mt_keywords' => new XML_RPC_Value($entry['mt_keywords'], 'string') ),
'struct');
return new XML_RPC_Response($tmp);
}
Cheers for now!
Tim