'metaWeblog.newMediaObject' =>
array('function' => 'metaWeblog_newMediaObject'),
'metaWeblog.getRecentPosts' =>
- array('function' => 'mt_getRecentPostTitles'),
+ array('function' => 'metaWeblog_getRecentPosts'),
'mt.getRecentPostTitles' =>
array('function' => 'mt_getRecentPostTitles'),
'mt.getCategoryList' =>
array(
'postid' => new XML_RPC_Value($entry['id'], 'string'),
'title' => new XML_RPC_Value($entry['title'], 'string'),
+ 'content' => new XML_RPC_Value($entry['body'], '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');
+ 'dateCreated' => new XML_RPC_Value(XML_RPC_iso8601_encode($entry['timestamp']), 'dateTime.iso8601')
+ ), 'struct');
}
$xml_entries = new XML_RPC_Value($xml_entries_vals, 'array');
return new XML_RPC_Response($xml_entries);
return new XML_RPC_Response($xml_entries);
}
+function metaWeblog_getRecentPosts($message) {
+ $val = $message->params[1];
+ $username = $val->getval();
+ $val = $message->params[2];
+ $password = $val->getval();
+ $val = $message->params[3];
+ $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 $tentry) {
+ $entry = serendipity_fetchEntry('id', $tentry['id']);
+ $xml_entries_vals[] = new XML_RPC_Value(
+ 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_text_more' => new XML_RPC_Value($entry['extended'], 'string' ),
+ '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_archiveURL($entry['id'], $entry['title'], 'serendipityHTTPPath', true, array('timestamp' => $entry['timestamp'])), 'string'),
+ 'link' => new XML_RPC_Value(serendipity_archiveURL($entry['id'], $entry['title'], 'serendipityHTTPPath', true, array('timestamp' => $entry['timestamp'])), 'string')
+ ),
+ 'struct');
+
+ }
+ $xml_entries = new XML_RPC_Value($xml_entries_vals, 'array');
+ return new XML_RPC_Response($xml_entries);
+
+}
function mt_getRecentPostTitles($message) {
$val = $message->params[1];
$username = $val->getval();
'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')
+ 'dateCreated' => new XML_RPC_Value(XML_RPC_iso8601_encode($entry['timestamp']), 'dateTime.iso8601')
),
'struct');
}
}
$val = $message->params[4];
$entry['body'] = $val->getval();
+ $val = $message->params[5];
+ $topublish = $val->getval();
+ if ($topublish == 1){
+ $entry['isdraft'] = 'false';
+ } else { $entry['isdraft'] = 'true'; }
+
$entry['allow_comments'] = $serendipity['allowCommentsDefault'];
$entry['moderate_comments'] = $serendipity['moderateCommentsDefault'];
$id = serendipity_updertEntry($entry);
if (!serendipity_authenticate_author($username, $password)) {
return new XML_RPC_Response('', 4, 'Authentication Failed');
}
- $val = $message->params[4];
- $entry['body'] = $val->getval();
- $entry['author'] = $username;
+
$id = serendipity_deleteEntry($entry['id']);
return new XML_RPC_Response(new XML_RPC_Value(1, 'boolean'));
}
$val = $message->params[4];
$publish = $val->getval();
+
$entry['categories'] = universal_fetchCategories($post_array['categories']);
$entry['title'] = $post_array['title'];
$entry['body'] = $post_array['description'];
$entry['extended'] = $post_array['mt_text_more'];
$entry['isdraft'] = ($publish == 0) ? 'true' : 'false';
- $entry['allow_comments'] = $serendipity['allowCommentsDefault'];
+ if (isset($post_array['mt_allow_comments'])) {
+ $entry['allow_comments'] = $post_array['mt_allow_comments'];
+ } else {
+ $entry['allow_comments'] = $serendipity['allowCommentsDefault'];
+ }
+
$entry['moderate_comments'] = $serendipity['moderateCommentsDefault'];
+ $entry['keywords'] = $post_array['mt_keywords'];
$id = serendipity_updertEntry($entry);
$val = $message->params[4];
$publish = $val->getval();
- $entry['categories'] = universal_fetchCategories($post_array['categories']);
+ if (isset($post_array['categories'])) {
+ $entry['categories'] = universal_fetchCategories($post_array['categories']);
+ }
$entry['title'] = $post_array['title'];
$entry['body'] = $post_array['description'];
$entry['extended'] = $post_array['mt_text_more'];
return new XML_RPC_Response(new XML_RPC_Value($id ? true : false, 'boolean'));
}
+
function metaWeblog_getPost($message) {
global $serendipity;
$val = $message->params[0];
}
$entry = serendipity_fetchEntry('id', $postid);
- $entry = new XML_RPC_Value(metaWeblog_setEntry($entry), 'struct');
- return new XML_RPC_Response($entry);
+ $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_archiveURL($entry['id'], $entry['title'], 'baseURL', true, array('timestamp' => $entry['timestamp'])), 'string'),
+ 'permalink' => new XML_RPC_Value(serendipity_archiveURL($entry['id'], $entry['title'], 'baseURL', true, array('timestamp' => $entry['timestamp'])), '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_deletePost($message) {
}
$category_ids = universal_fetchCategories($categories->getval(), true);
- serendipity_updateEntryCategories($postid, $category_ids);
+ $entry = serendipity_fetchEntry ( 'id', $postid );
+ $entry['categories'] = $category_ids;
+ $entry = serendipity_updertEntry ( $entry );
+ //serendipity_updateEntryCategories($postid, $category_ids);
return new XML_RPC_Response(new XML_RPC_Value(1, 'boolean'));
}
}
$fp = fopen($full, 'w');
- fwrite($fp, base64_decode($struct['bits']));
+ fwrite($fp, $struct['bits']);
fclose($fp);
$path = $serendipity['baseURL'] . $serendipity['uploadPath'] . $struct['name'];
return new XML_RPC_Response(new XML_RPC_Value(array('url' => new XML_RPC_Value($path, 'string')), 'struct'));