|
|
Forum-Information
Before posting about errors, make sure that the answer cannot already be found
in our FAQ or by searching this forum!
Posting is restricted to registered users ( registering is free and simple!) due to recent spam attacks. When having trouble with this board, contact garvin(-at)s9y(-dot)org.
|
Discussion corner for Developers of Serendipity.
-
TimothyP
-
by TimothyP » 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
-
TimothyP
-
Whoops
by TimothyP » Fri Apr 01, 2005 3:28 am
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);
}
-

garvinhicking
- Core Developer
-
- Posts: 28944
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
-
Re: Whoops
by garvinhicking » Fri Apr 01, 2005 11:48 am
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:
- 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); }
There I changed $postid to $entry['id'].
Regards
Garvin
-
TimothyP
- Regular
-
- Posts: 13
- Joined: Fri Apr 01, 2005 12:29 pm
- Location: UK
-
More patches?
by TimothyP » Fri Apr 01, 2005 12:40 pm
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?
-

garvinhicking
- Core Developer
-
- Posts: 28944
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
-
Re: More patches?
by garvinhicking » Fri Apr 01, 2005 3:09 pm
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.
-
TimothyP
- Regular
-
- Posts: 13
- Joined: Fri Apr 01, 2005 12:29 pm
- Location: UK
-
Re: More patches?
by TimothyP » Fri Apr 01, 2005 4:32 pm
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/archives/12-More-Serendipity-xml-rpc-patching.html
Return to Development
Who is online
Users browsing this forum: No registered users and 1 guest
|