Exemple #1
0
/**
 * Helper for {@link b2_getcategories()} and {@link mt_getPostCategories()}, because they differ
 * only in the "categoryId" case ("categoryId" (b2) vs "categoryID" (MT))
 *
 * @param string Type, either "b2" or "mt"
 * @param xmlrpcmsg XML-RPC Message
 *					0 blogid (string): Unique identifier of the blog to query
 *					1 username (string): Login for a Blogger user who is member of the blog.
 *					2 password (string): Password for said username.
 * @return xmlrpcresp XML-RPC Response
 */
function _b2_or_mt_get_categories($type, $m)
{
    global $xmlrpcerruser, $DB;
    // CHECK LOGIN:
    /**
     * @var User
     */
    if (!($current_User =& xmlrpcs_login($m, 1, 2))) {
        // Login failed, return (last) error:
        return xmlrpcs_resperror();
    }
    // GET BLOG:
    /**
     * @var Blog
     */
    if (!($Blog =& xmlrpcs_get_Blog($m, 0))) {
        // Login failed, return (last) error:
        return xmlrpcs_resperror();
    }
    // CHECK PERMISSION: (we need at least one post/edit status)
    if (!$current_User->check_perm('blog_post_statuses', 1, false, $Blog->ID)) {
        // Permission denied
        return xmlrpcs_resperror(3);
        // User error 3
    }
    logIO('Permission granted.');
    $sql = 'SELECT *
					  FROM T_categories ';
    $BlogCache =& get_Cache('BlogCache');
    $current_Blog = $BlogCache->get_by_ID($Blog->ID);
    $aggregate_coll_IDs = $current_Blog->get_setting('aggregate_coll_IDs');
    if (empty($aggregate_coll_IDs)) {
        // We only want posts from the current blog:
        $sql .= 'WHERE cat_blog_ID =' . $current_Blog->ID;
    } else {
        // We are aggregating posts from several blogs:
        $sql .= 'WHERE cat_blog_ID IN (' . $aggregate_coll_IDs . ')';
    }
    $sql .= " ORDER BY cat_name ASC";
    $rows = $DB->get_results($sql);
    if ($DB->error) {
        // DB error
        return new xmlrpcresp(0, $xmlrpcerruser + 9, 'DB error: ' . $DB->last_error);
        // user error 9
    }
    xmlrpc_debugmsg('Categories:' . count($rows));
    $categoryIdName = $type == 'b2' ? 'categoryID' : 'categoryId';
    $data = array();
    foreach ($rows as $row) {
        $data[] = new xmlrpcval(array($categoryIdName => new xmlrpcval($row->cat_ID), 'categoryName' => new xmlrpcval($row->cat_name)), 'struct');
    }
    logIO('OK.');
    return new xmlrpcresp(new xmlrpcval($data, "array"));
}
Exemple #2
0
/**
 * mt.publishPost
 *
 * @see http://www.sixapart.com/developers/xmlrpc/movable_type_api/mtpublishpost.html
 *
 * @param xmlrpcmsg XML-RPC Message
 *					0 postid (string): Unique identifier of the post to publish
 *					1 username (string): Login for a user who is member of the blog.
 *					2 password (string): Password for said username.
 */
function mt_publishPost($m)
{
    global $localtimenow, $DB;
    // CHECK LOGIN:
    /**
     * @var User
     */
    if (!($current_User =& xmlrpcs_login($m, 1, 2))) {
        // Login failed, return (last) error:
        return xmlrpcs_resperror();
    }
    logIO('mt_publishPost: Login OK');
    // GET POST:
    /**
     * @var Item
     */
    if (!($edited_Item =& xmlrpcs_get_Item($m, 0))) {
        // Failed, return (last) error:
        return xmlrpcs_resperror();
    }
    if (!$current_User->check_perm('item_post!published', 'edit', false, $edited_Item)) {
        return xmlrpcs_resperror(3);
        // Permission denied
    }
    logIO('mt_publishPost: Permission granted');
    logIO('mt_publishPost: Old post status: ' . $edited_Item->status);
    $edited_Item->set('status', 'published');
    //$edited_Item->set( 'datestart', date('Y-m-d H:i:s', $localtimenow) );
    if ($edited_Item->dbupdate() === false) {
        // Could not update item...
        return xmlrpcs_resperror(99, 'Database error: ' . $DB->last_error);
        // DB error
    }
    logIO('mt_publishPost: Item published.');
    // Execute or schedule notifications & pings:
    logIO('mt_publishPost: Handling notifications...');
    $edited_Item->handle_post_processing(false, false);
    logIO('mt_publishPost: OK.');
    return new xmlrpcresp(new xmlrpcval(1, 'boolean'));
}
/**
 * metaWeblog.getCategories
 *
 * @see http://www.xmlrpc.com/metaWeblogApi#metawebloggetcategories
 *
 * @param xmlrpcmsg XML-RPC Message
 *					0 blogid (string): Unique identifier of the blog the post will be added to.
 *						Currently ignored in b2evo, in favor of the category.
 *					1 username (string): Login for a Blogger user who has permission to edit the given
 *						post (either the user who originally created it or an admin of the blog).
 *					2 password (string): Password for said username.
 * @param array of params to narrow category selection
 */
function _wp_mw_getcategories($m, $params = array())
{
    global $DB, $Settings;
    // CHECK LOGIN:
    /**
     * @var User
     */
    if (!($current_User =& xmlrpcs_login($m, 1, 2))) {
        // Login failed, return (last) error:
        return xmlrpcs_resperror();
    }
    // GET BLOG:
    /**
     * @var Blog
     */
    if (!($Blog =& xmlrpcs_get_Blog($m, 0))) {
        // Login failed, return (last) error:
        return xmlrpcs_resperror();
    }
    $SQL = new SQL();
    $SQL->SELECT('cat_ID, cat_name, cat_order');
    $SQL->FROM('T_categories');
    $SQL->WHERE($Blog->get_sql_where_aggregate_coll_IDs('cat_blog_ID'));
    if (!empty($params['search'])) {
        // Category name starts with 'search'
        $SQL->WHERE_and('cat_name LIKE "' . $DB->like_escape($params['search']) . '%"');
    }
    if ($Settings->get('chapter_ordering') == 'manual') {
        // Manual order
        $SQL->ORDER_BY('cat_order');
    } else {
        // Alphabetic order
        $SQL->ORDER_BY('cat_name');
    }
    $rows = $DB->get_results($SQL->get());
    if ($DB->error) {
        // DB error
        return xmlrpcs_resperror(99, 'DB error: ' . $DB->last_error);
        // user error 9
    }
    $total_rows = count($rows);
    logIO('Categories: ' . $total_rows);
    $ChapterCache =& get_ChapterCache();
    $data = array();
    for ($i = 0; $i < $total_rows; $i++) {
        if (!empty($params['limit']) && $i >= $params['limit']) {
            // We found enough, exit the loop
            break;
        }
        $Chapter =& $ChapterCache->get_by_ID($rows[$i]->cat_ID, false, false);
        if (!$Chapter) {
            continue;
        }
        if (isset($params['search'])) {
            // wp.suggestCategories
            $data[] = new xmlrpcval(array('category_id' => new xmlrpcval(intval($Chapter->ID)), 'category_name' => new xmlrpcval($Chapter->name)), 'struct');
        } else {
            $data[] = new xmlrpcval(array('categoryId' => new xmlrpcval(intval($Chapter->ID)), 'parentId' => new xmlrpcval(intval($Chapter->parent_ID)), 'description' => new xmlrpcval($Chapter->name), 'categoryDescription' => new xmlrpcval($Chapter->description), 'categoryName' => new xmlrpcval($Chapter->name), 'htmlUrl' => new xmlrpcval($Chapter->get_permanent_url()), 'rssUrl' => new xmlrpcval(url_add_param($Chapter->get_permanent_url(), 'tempskin=_rss2'))), 'struct');
        }
    }
    logIO('OK.');
    return new xmlrpcresp(new xmlrpcval($data, 'array'));
}
Exemple #4
0
/**
 * blogger.getRecentPosts retieves X most recent posts.
 *
 * This API call is not documented on
 * {@link http://www.blogger.com/developers/api/1_docs/}
 * @see http://www.sixapart.com/developers/xmlrpc/blogger_api/bloggergetrecentposts.html
 *
 * @param xmlrpcmsg XML-RPC Message
 *					0 appkey (string): Unique identifier/passcode of the application sending the post.
 *						(See access info {@link http://www.blogger.com/developers/api/1_docs/#access} .)
 *					1 blogid (string): Unique identifier of the blog the post will be added to.
 *						Currently ignored in b2evo, in favor of the category.
 *					2 username (string): Login for a Blogger user who has permission to edit the given
 *						post (either the user who originally created it or an admin of the blog).
 *					3 password (string): Password for said username.
 *					4 numposts (integer): number of posts to retrieve.
 * @return xmlrpcresp XML-RPC Response
 */
function blogger_getrecentposts($m)
{
    global $xmlrpcerruser, $DB;
    // CHECK LOGIN:
    /**
     * @var User
     */
    if (!($current_User =& xmlrpcs_login($m, 2, 3))) {
        // Login failed, return (last) error:
        return xmlrpcs_resperror();
    }
    // GET BLOG:
    /**
     * @var Blog
     */
    if (!($Blog =& xmlrpcs_get_Blog($m, 1))) {
        // Login failed, return (last) error:
        return xmlrpcs_resperror();
    }
    $numposts = $m->getParam(4);
    $numposts = $numposts->scalarval();
    // Get the posts to display:
    load_class('items/model/_itemlist.class.php', 'ItemList');
    $MainList = new ItemList2($Blog, NULL, NULL, $numposts);
    // Protected and private get checked by statuses_where_clause().
    $statuses = array('published', 'redirected', 'protected', 'private');
    if ($current_User->check_perm('blog_ismember', 'view', false, $Blog->ID)) {
        // These statuses require member status:
        $statuses = array_merge($statuses, array('draft', 'deprecated'));
    }
    logIO('Statuses: ' . implode(', ', $statuses));
    $MainList->set_filters(array('visibility_array' => $statuses, 'order' => 'DESC', 'unit' => 'posts'));
    // Run the query:
    $MainList->query();
    logIO('Items:' . $MainList->result_num_rows);
    $data = array();
    while ($Item =& $MainList->get_item()) {
        logIO('Item:' . $Item->title . ' - Issued: ' . $Item->issue_date . ' - Modified: ' . $Item->datemodified);
        $post_date = mysql2date('U', $Item->issue_date);
        $post_date = gmdate('Ymd', $post_date) . 'T' . gmdate('H:i:s', $post_date);
        $content = '<title>' . $Item->title . '</title>';
        $content .= '<category>' . $Item->main_cat_ID . '</category>';
        $content .= $Item->content;
        // Load Item's creator User:
        $Item->get_creator_User();
        $authorname = $Item->creator_User->get('preferredname');
        $data[] = new xmlrpcval(array('authorName' => new xmlrpcval($authorname), 'userid' => new xmlrpcval($Item->creator_user_ID), 'dateCreated' => new xmlrpcval($post_date, 'dateTime.iso8601'), 'content' => new xmlrpcval($content), 'postid' => new xmlrpcval($Item->ID)), 'struct');
    }
    $resp = new xmlrpcval($data, 'array');
    logIO('OK.');
    return new xmlrpcresp($resp);
}
Exemple #5
0
/**
 * mt.getPostCategories : Get the categories for a given post.
 *
 * @param xmlrpcmsg XML-RPC Message
 *					0 postid (string): Unique identifier of the post to query
 *					1 username (string): Login for a Blogger user who is member of the blog.
 *					2 password (string): Password for said username.
 */
function mt_getPostCategories($m)
{
    global $xmlrpcerruser;
    global $DB;
    // CHECK LOGIN:
    /**
     * @var User
     */
    if (!($current_User =& xmlrpcs_login($m, 1, 2))) {
        // Login failed, return (last) error:
        return xmlrpcs_resperror();
    }
    // GET POST:
    /**
     * @var Item
     */
    if (!($edited_Item =& xmlrpcs_get_Item($m, 0))) {
        // Failed, return (last) error:
        return xmlrpcs_resperror();
    }
    // CHECK PERMISSION: (we need at least one post/edit status)
    if (!$current_User->check_perm('blog_post_statuses', 1, false, $edited_Item->blog_ID)) {
        // Permission denied
        return xmlrpcs_resperror(3);
        // User error 3
    }
    logIO('Permission granted.');
    $categories = postcats_get_byID($edited_Item->ID);
    // Secondary categories
    $iSize = count($categories);
    // The number of objects ie categories
    logIO("mt_getgategorylist  no of categories..." . $iSize);
    // works
    $struct = array();
    for ($i = 0; $i < $iSize; $i++) {
        logIO("mt_getPostCategories categories  ..." . $categories[$i]);
        // In database cat_ID and cat_name from tablecategories
        $sql = "SELECT * FROM T_categories WHERE  cat_ID = {$categories[$i]} ";
        logIO("mt_getgategorylist  sql..." . $sql);
        $rows = $DB->get_results($sql);
        foreach ($rows as $row) {
            $Categoryname = $row->cat_name;
            logIO("mt_getPostCategories Categoryname  ..." . $Categoryname);
        }
        // Is this the primary cat?
        $isPrimary = $categories[$i] == $edited_Item->main_cat_ID ? 1 : 0;
        $struct[$i] = new xmlrpcval(array("categoryId" => new xmlrpcval($categories[$i]), "categoryName" => new xmlrpcval($Categoryname), "isPrimary" => new xmlrpcval($isPrimary)), "struct");
    }
    logIO('OK.');
    return new xmlrpcresp(new xmlrpcval($struct, "array"));
}
/**
 * wp.getOptions
 *
 * @see http://codex.wordpress.org/XML-RPC_wp#wp.getOptions
 *
 * Note: If passing in a struct, search for options listed within it.
 *
 * @param xmlrpcmsg XML-RPC Message
 *					0 blogid (int): Unique identifier of the blog.
 *					1 username (string): User login.
 *					2 password (string): Password for said username.
 *					3 options (struct)
 */
function wp_getoptions($m)
{
    global $Settings;
    // CHECK LOGIN:
    /**
     * @var User
     */
    if (!($current_User =& xmlrpcs_login($m, 1, 2))) {
        // Login failed, return (last) error:
        return xmlrpcs_resperror();
    }
    // GET BLOG:
    /**
     * @var Blog
     */
    if (!($Blog =& xmlrpcs_get_Blog($m, 0))) {
        // Login failed, return (last) error:
        return xmlrpcs_resperror();
    }
    if (isset($m->params[3])) {
        $options = $m->getParam(3);
        $options = xmlrpc_decode_recurse($options);
    }
    $defaults = array('software_name' => array('desc' => 'Software Name', 'value' => 'WordPress'), 'software_version' => array('desc' => 'Software Version', 'value' => '3.3.2'), 'blog_url' => array('desc' => 'Site URL', 'value' => $Blog->gen_blogurl()), 'blog_title' => array('desc' => 'Site TitleL', 'value' => $Blog->get('name')), 'blog_tagline' => array('desc' => 'Site Tagline', 'value' => $Blog->get('tagline')), 'date_format' => array('desc' => 'Date Format', 'value' => locale_datefmt()), 'time_format' => array('desc' => 'Time Format', 'value' => locale_timefmt()), 'users_can_register' => array('desc' => 'Allow new users to sign up', 'value' => $Settings->get('newusers_canregister')), 'thumbnail_crop' => array('desc' => 'Crop thumbnail to exact dimensions', 'value' => false), 'thumbnail_size_w' => array('desc' => 'Thumbnail Width', 'value' => '160'), 'thumbnail_size_h' => array('desc' => 'Thumbnail Height', 'value' => '160'), 'medium_size_w' => array('desc' => 'Medium size image width', 'value' => '320'), 'medium_size_h' => array('desc' => 'Medium size image height', 'value' => '320'), 'large_size_w' => array('desc' => 'Large size image width', 'value' => '720'), 'large_size_h' => array('desc' => 'Large size image height', 'value' => '500'));
    $data = array();
    if (empty($options)) {
        // No specific options where asked for, return all of them
        foreach ($defaults as $k => $opt) {
            $data[$k] = new xmlrpcval(array('desc' => new xmlrpcval($opt['desc']), 'readonly' => new xmlrpcval(true, 'boolean'), 'value' => new xmlrpcval($opt['value'])), 'struct');
        }
        logIO('Retrieving all options');
    } else {
        foreach ($options as $k) {
            if (!isset($defaults[$k])) {
                continue;
            }
            $data[$k] = new xmlrpcval(array('desc' => new xmlrpcval($defaults[$k]['desc']), 'readonly' => new xmlrpcval(true, 'boolean'), 'value' => new xmlrpcval($defaults[$k]['value'])), 'struct');
            logIO('Retrieving option: ' . $k);
        }
    }
    logIO('OK.');
    return new xmlrpcresp(new xmlrpcval($data, 'struct'));
}
Exemple #7
0
/**
 * b2.getPostURL
 *
 * @param xmlrpcmsg XML-RPC Message
 *					0 ? NO LONGER USED (was: blogid (string): Unique identifier of the blog to query)
 *					1 ? (string)
 *					2 username (string): Login for a Blogger user who is member of the blog.
 *					3 password (string): Password for said username.193
 *
 *					4 post_ID (string): Post to query
 * @return xmlrpcresp XML-RPC Response
 */
function b2_getposturl($m)
{
    global $xmlrpcerruser;
    global $siteurl;
    // CHECK LOGIN:
    /**
     * @var User
     */
    if (!($current_User =& xmlrpcs_login($m, 2, 3))) {
        // Login failed, return (last) error:
        return xmlrpcs_resperror();
    }
    // GET POST:
    /**
     * @var Item
     */
    if (!($edited_Item =& xmlrpcs_get_Item($m, 4))) {
        // Failed, return (last) error:
        return xmlrpcs_resperror();
    }
    // CHECK PERMISSION: (we need at least one post/edit status)
    if (!$current_User->check_perm('blog_post_statuses', 1, false, $edited_Item->blog_ID)) {
        // Permission denied
        return xmlrpcs_resperror(3);
        // User error 3
    }
    logIO('Permission granted.');
    logIO('OK.');
    return new xmlrpcresp(new xmlrpcval($edited_Item->get_permanent_url()));
}
Exemple #8
0
/**
 * b2.getPostURL
 *
 * @param xmlrpcmsg XML-RPC Message
 *					0 ? NO LONGER USED (was: blogid (string): Unique identifier of the blog to query)
 *					1 ? (string)
 *					2 username (string): Login for a Blogger user who is member of the blog.
 *					3 password (string): Password for said username.193
 *
 *					4 post_ID (string): Post to query
 * @return xmlrpcresp XML-RPC Response
 */
function b2_getposturl($m)
{
    // CHECK LOGIN:
    /**
     * @var User
     */
    if (!($current_User =& xmlrpcs_login($m, 2, 3))) {
        // Login failed, return (last) error:
        return xmlrpcs_resperror();
    }
    // GET POST:
    /**
     * @var Item
     */
    if (!($edited_Item =& xmlrpcs_get_Item($m, 4))) {
        // Failed, return (last) error:
        return xmlrpcs_resperror();
    }
    // CHECK PERMISSION: (user needs to be able to view the item)
    if (!xmlrpcs_can_view_item($edited_Item, $User)) {
        // Permission denied
        return xmlrpcs_resperror(3);
        // User error 3
    }
    logIO('OK.');
    return new xmlrpcresp(new xmlrpcval($edited_Item->get_permanent_url()));
}
/**
 * metaWeblog.deletePost deletes a given post.
 *
 * This API call is not documented on
 * {@link http://www.blogger.com/developers/api/1_docs/}
 * @see http://www.xmlrpc.com/stories/storyReader$2460
 *
 * @param xmlrpcmsg XML-RPC Message
 *					0 appkey (string): Unique identifier/passcode of the application sending the post.
 *						(See access info {@link http://www.blogger.com/developers/api/1_docs/#access} .)
 *					1 postid (string): Unique identifier of the post to be deleted.
 *					2 username (string): Login for a Blogger user who has permission to edit the given
 *						post (either the user who originally created it or an admin of the blog).
 *					3 password (string): Password for said username.
 * @return xmlrpcresp XML-RPC Response
 */
function mw_deletepost($m)
{
    // CHECK LOGIN:
    if (!($current_User =& xmlrpcs_login($m, 2, 3))) {
        // Login failed, return (last) error:
        return xmlrpcs_resperror();
    }
    // GET POST:
    /**
     * @var Item
     */
    if (!($edited_Item =& xmlrpcs_get_Item($m, 1))) {
        // Failed, return (last) error:
        return xmlrpcs_resperror();
    }
    return xmlrpcs_delete_item($edited_Item);
}
Exemple #10
0
/**
 * metaweblog.getPost retieves a given post.
 *
 * @see http://www.xmlrpc.com/metaWeblogApi#basicEntrypoints
 *
 * @param xmlrpcmsg XML-RPC Message
 *					0 postid (string): Unique identifier of the post
 *					1 username (string): Login for a Blogger user who has permission to edit the given
 *						post (either the user who originally created it or an admin of the blog).
 *					2 password (string): Password for said username.
 * @return xmlrpcresp XML-RPC Response
 */
function mw_getpost($m)
{
    global $xmlrpcerruser;
    // CHECK LOGIN:
    /**
     * @var User
     */
    if (!($current_User =& xmlrpcs_login($m, 1, 2))) {
        // Login failed, return (last) error:
        return xmlrpcs_resperror();
    }
    // GET POST:
    /**
     * @var Item
     */
    if (!($edited_Item =& xmlrpcs_get_Item($m, 0))) {
        // Failed, return (last) error:
        return xmlrpcs_resperror();
    }
    // CHECK PERMISSION: (we need at least one post/edit status)
    if (!$current_User->check_perm('blog_post_statuses', 1, false, $edited_Item->blog_ID)) {
        // Permission denied
        return xmlrpcs_resperror(3);
        // User error 3
    }
    logIO('Permission granted.');
    $post_date = mysql2date("U", $edited_Item->issue_date);
    $post_date = gmdate("Ymd", $post_date) . "T" . gmdate("H:i:s", $post_date);
    $struct = new xmlrpcval(array('link' => new xmlrpcval($edited_Item->get_permanent_url()), 'title' => new xmlrpcval($edited_Item->title), 'description' => new xmlrpcval($edited_Item->content), 'dateCreated' => new xmlrpcval($post_date, "dateTime.iso8601"), 'userid' => new xmlrpcval($edited_Item->creator_user_ID), 'postid' => new xmlrpcval($edited_Item->ID), 'content' => new xmlrpcval($edited_Item->content), 'permalink' => new xmlrpcval($edited_Item->get_permanent_url()), 'categories' => new xmlrpcval($edited_Item->main_cat_ID)), "struct");
    $resp = $struct;
    logIO('OK.');
    return new xmlrpcresp($resp);
}
Exemple #11
0
/**
 * blogger.getRecentPosts retieves X most recent posts.
 *
 * This API call is not documented on
 * {@link http://www.blogger.com/developers/api/1_docs/}
 * @see http://www.sixapart.com/developers/xmlrpc/blogger_api/bloggergetrecentposts.html
 *
 * @param xmlrpcmsg XML-RPC Message
 *					0 appkey (string): Unique identifier/passcode of the application sending the post.
 *						(See access info {@link http://www.blogger.com/developers/api/1_docs/#access} .)
 *					1 blogid (string): Unique identifier of the blog the post will be added to.
 *						Currently ignored in b2evo, in favor of the category.
 *					2 username (string): Login for a Blogger user who has permission to edit the given
 *						post (either the user who originally created it or an admin of the blog).
 *					3 password (string): Password for said username.
 *					4 numposts (integer): number of posts to retrieve.
 * @return xmlrpcresp XML-RPC Response
 */
function blogger_getrecentposts($m)
{
    global $xmlrpcerruser, $DB;
    // CHECK LOGIN:
    /**
     * @var User
     */
    if (!($current_User =& xmlrpcs_login($m, 2, 3))) {
        // Login failed, return (last) error:
        return xmlrpcs_resperror();
    }
    // GET BLOG:
    /**
     * @var Blog
     */
    if (!($Blog =& xmlrpcs_get_Blog($m, 1))) {
        // Login failed, return (last) error:
        return xmlrpcs_resperror();
    }
    // CHECK PERMISSION: (we need at least one post/edit status)
    // (we should be able to see all even if we cannot edit the particular status of a post)
    if (!$current_User->check_perm('blog_post_statuses', 1, false, $Blog->ID)) {
        // Permission denied
        return xmlrpcs_resperror(3);
        // User error 3
    }
    logIO('Permission granted.');
    $numposts = $m->getParam(4);
    $numposts = $numposts->scalarval();
    // Get the posts to display:
    load_class('items/model/_itemlist.class.php');
    $MainList =& new ItemList2($Blog, NULL, NULL, $numposts);
    $MainList->set_filters(array('visibility_array' => array('published', 'protected', 'private', 'draft', 'deprecated', 'redirected'), 'order' => 'DESC', 'unit' => 'posts'));
    // Run the query:
    $MainList->query();
    xmlrpc_debugmsg('Items:' . $MainList->result_num_rows);
    $data = array();
    while ($Item =& $MainList->get_item()) {
        xmlrpc_debugmsg('Item:' . $Item->title . ' - Issued: ' . $Item->issue_date . ' - Modified: ' . $Item->mod_date);
        $post_date = mysql2date("U", $Item->issue_date);
        $post_date = gmdate("Ymd", $post_date) . "T" . gmdate("H:i:s", $post_date);
        $content = '<title>' . $Item->title . '</title>';
        $content .= '<category>' . $Item->main_cat_ID . '</category>';
        $content .= $Item->content;
        // Load Item's creator User:
        $Item->get_creator_User();
        $authorname = $Item->creator_User->get('preferredname');
        $data[] = new xmlrpcval(array("authorName" => new xmlrpcval($authorname), "userid" => new xmlrpcval($Item->creator_user_ID), "dateCreated" => new xmlrpcval($post_date, "dateTime.iso8601"), "content" => new xmlrpcval($content), "postid" => new xmlrpcval($Item->ID)), "struct");
    }
    $resp = new xmlrpcval($data, "array");
    logIO('OK.');
    return new xmlrpcresp($resp);
}