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
MovableType XML-RPC api fix for ecto
Whoops
Correction,
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_text_more' => new XML_RPC_Value($entry['extended'], 'string'),
'mt_allow_comments' => new XML_RPC_Value($entry['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);
}
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_text_more' => new XML_RPC_Value($entry['extended'], 'string'),
'mt_allow_comments' => new XML_RPC_Value($entry['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);
}
-
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Re: Whoops
Hi Timothy!
You are the man! I think you solved most of your XML-RPC issues just now.
However I found an even easier fix to this. The Variable $postid is used inside a function but not defined, thus it returns an invalid postid.
Please use this replacement function:
There I changed $postid to $entry['id'].
Regards
Garvin
You are the man! I think you solved most of your XML-RPC issues just now.
However I found an even easier fix to this. The Variable $postid is used inside a function but not defined, thus it returns an invalid postid.
Please use this replacement function:
Code: Select all
function universal_setEntry(&$entry, &$tmp) {
$tmp = array(
'dateCreated' => new XML_RPC_Value(XML_RPC_iso8601_encode($entry['timestamp']), 'dateTime.iso8601'),
'postid' => new XML_RPC_Value($entry['id'], 'string'),
'userid' => new XML_RPC_Value($entry['authorid'], 'string'),
'description' => new XML_RPC_Value($entry['body'], '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_rewriteURL(PATH_ARCHIVES.'/' . $postid . '_.html', 'baseURL'), 'string'),
'link' => new XML_RPC_Value(serendipity_rewriteURL(PATH_ARCHIVES.'/' . $postid . '_.html', 'baseURL'), 'string'),
);
return array_merge($entry, $tmp);
}
Regards
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
More patches?
Do you mean use this patch instead of the one I suggested? I'm not sure it fixes it on its own.
Whilst on the subject, with the above patches its definitely improved a great deal but its still not working correctly (e.g. preview in ecto fails to load content until you specifically grab the post), and looking briefly into this shows theres at least one or two more functions not running to spec - would it be acceptable for me to have a go at fixing these issues?
Whilst on the subject, with the above patches its definitely improved a great deal but its still not working correctly (e.g. preview in ecto fails to load content until you specifically grab the post), and looking briefly into this shows theres at least one or two more functions not running to spec - would it be acceptable for me to have a go at fixing these issues?
-
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Re: More patches?
Yes, yes - we are all hands on needing someone working on our XMLRPC code, as it's currently unmaintained. Any fixes you can come up with would be much appreciated!
If possible, please use our recent CVS and provide unified diffs instead of full pasted code.
Thanks a lot,
Garvin.
If possible, please use our recent CVS and provide unified diffs instead of full pasted code.
Thanks a lot,
Garvin.
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Re: More patches?
I'll have to look into that. In the meantime this is a link to a tweaked serendipity_xmlrpc.php file which includes my previous fix, your fix, and a number of others which pretty much complete compatibility with ecto. Theres a number of issues, and I'm not having any success with MarsEdit either, so I'll sort out using your cvs and maybe do some more in future.
http://fracsoft.com/serendipity/archive ... ching.html
http://fracsoft.com/serendipity/archive ... ching.html