diff options
author | donncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36> | 2007-01-30 17:46:07 +0000 |
---|---|---|
committer | donncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36> | 2007-01-30 17:46:07 +0000 |
commit | 006898584b668bc04aeff31f8180d048e6ca4071 (patch) | |
tree | 760b44188ab02261ba351de90e216e1b419fa87c /xmlrpc.php | |
parent | eeae9d5c09399fa7cb89fe52d5676bf18fa61457 (diff) | |
download | wordpress-mu-006898584b668bc04aeff31f8180d048e6ca4071.tar.gz wordpress-mu-006898584b668bc04aeff31f8180d048e6ca4071.tar.xz wordpress-mu-006898584b668bc04aeff31f8180d048e6ca4071.zip |
WP Merge to rev 3834 and reverted to novalueindb option code
git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@873 7be80a69-a1ef-0310-a953-fb0f7c49ff36
Diffstat (limited to 'xmlrpc.php')
-rw-r--r-- | xmlrpc.php | 83 |
1 files changed, 57 insertions, 26 deletions
@@ -22,6 +22,7 @@ header('Content-type: text/xml; charset=' . get_option('blog_charset'), true); <engineLink>http://wordpress.org/</engineLink> <homePageLink><?php bloginfo_rss('url') ?></homePageLink> <apis> + <api name="WordPress" blogID="1" preferred="false" apiLink="<?php bloginfo_rss('url') ?>/xmlrpc.php" /> <api name="Movable Type" blogID="1" preferred="true" apiLink="<?php bloginfo_rss('url') ?>/xmlrpc.php" /> <api name="MetaWeblog" blogID="1" preferred="false" apiLink="<?php bloginfo_rss('url') ?>/xmlrpc.php" /> <api name="Blogger" blogID="1" preferred="false" apiLink="<?php bloginfo_rss('url') ?>/xmlrpc.php" /> @@ -183,6 +184,13 @@ class wp_xmlrpc_server extends IXR_Server { $full_page = get_extended($page->post_content); $link = post_permalink($page->ID); + // Get info the page parent if there is one. + $parent_title = ""; + if(!empty($page->post_parent)) { + $parent = get_page($page->post_parent); + $parent_title = $parent->post_title; + } + // Determine comment and ping settings. $allow_comments = ("open" == $page->comment_status) ? 1 : 0; $allow_pings = ("open" == $page->ping_status) ? 1 : 0; @@ -196,28 +204,30 @@ class wp_xmlrpc_server extends IXR_Server { $categories[] = get_cat_name($cat_id); } - // Get the users nicename. - $nicename = get_profile("user_nicename", $username); + // Get the author info. + $author = get_userdata($page->post_author); $page_struct = array( - "dateCreated" => new IXR_Date($page_date), - "userid" => $page->post_author, - "page_id" => $page->ID, - "page_status" => $page->post_status, - "description" => $full_page["main"], - "title" => $page->post_title, - "link" => $link, - "permaLink" => $link, - "categories" => $categories, - "excerpt" => $page->post_excerpt, - "text_more" => $full_page["extended"], - "mt_allow_comments" => $allow_comments, - "mt_allow_pings" => $allow_pings, - "wp_slug" => $page->post_name, - "wp_password" => $page->post_password, - "wp_author" => $nicename, - "wp_page_parent_id" => $page->post_parent, - "wp_page_order" => $page->menu_order + "dateCreated" => new IXR_Date($page_date), + "userid" => $page->post_author, + "page_id" => $page->ID, + "page_status" => $page->post_status, + "description" => $full_page["main"], + "title" => $page->post_title, + "link" => $link, + "permaLink" => $link, + "categories" => $categories, + "excerpt" => $page->post_excerpt, + "text_more" => $full_page["extended"], + "mt_allow_comments" => $allow_comments, + "mt_allow_pings" => $allow_pings, + "wp_slug" => $page->post_name, + "wp_password" => $page->post_password, + "wp_author" => $author->user_nicename, + "wp_page_parent_id" => $page->post_parent, + "wp_page_parent_title" => $parent_title, + "wp_page_order" => $page->menu_order, + "wp_author_username" => $author->user_login ); return($page_struct); @@ -408,7 +418,8 @@ class wp_xmlrpc_server extends IXR_Server { // Get list of pages ids and titles $page_list = $wpdb->get_results(" SELECT ID page_id, - post_title page_title + post_title page_title, + post_parent page_parent_id FROM {$wpdb->posts} WHERE post_type = 'page' ORDER BY ID @@ -1074,11 +1085,16 @@ class wp_xmlrpc_server extends IXR_Server { $post_parent = $content_struct["wp_page_parent_id"]; } - // Only ste the menu_order if it was given. + // Only set the menu_order if it was given. if(!empty($content_struct["wp_page_order"])) { $menu_order = $content_struct["wp_page_order"]; } + // Only set the post_author if one is set. + if(!empty($content_struct["wp_author"])) { + $post_author = $content_struct["wp_author"]; + } + $post_title = $content_struct['title']; $post_content = apply_filters( 'content_save_pre', $content_struct['description'] ); $catnames = $content_struct['categories']; @@ -1121,7 +1137,7 @@ class wp_xmlrpc_server extends IXR_Server { } // We've got all the data -- post it: - $newpost = compact('ID', 'post_content', 'post_title', 'post_category', 'post_status', 'post_excerpt', 'comment_status', 'ping_status', 'post_date', 'post_date_gmt', 'to_ping', 'post_name', 'post_password', 'post_parent', 'menu_order'); + $newpost = compact('ID', 'post_content', 'post_title', 'post_category', 'post_status', 'post_excerpt', 'comment_status', 'ping_status', 'post_date', 'post_date_gmt', 'to_ping', 'post_name', 'post_password', 'post_parent', 'menu_order', 'post_author'); $result = wp_update_post($newpost); if (!$result) { @@ -1165,6 +1181,9 @@ class wp_xmlrpc_server extends IXR_Server { $post = get_extended($postdata['post_content']); $link = post_permalink($postdata['ID']); + // Get the author info. + $author = get_userdata($postdata['post_author']); + $allow_comments = ('open' == $postdata['comment_status']) ? 1 : 0; $allow_pings = ('open' == $postdata['ping_status']) ? 1 : 0; @@ -1182,7 +1201,11 @@ class wp_xmlrpc_server extends IXR_Server { 'mt_excerpt' => $postdata['post_excerpt'], 'mt_text_more' => $post['extended'], 'mt_allow_comments' => $allow_comments, - 'mt_allow_pings' => $allow_pings + 'mt_allow_pings' => $allow_pings, + 'wp_slug' => $postdata['post_name'], + 'wp_password' => $postdata['post_password'], + 'wp_author' => $author->user_nicename, + 'wp_author_username' => $author->user_login ); return $resp; @@ -1225,6 +1248,9 @@ class wp_xmlrpc_server extends IXR_Server { $post = get_extended($entry['post_content']); $link = post_permalink($entry['ID']); + // Get the post author info. + $author = get_userdata($entry['ID']); + $allow_comments = ('open' == $entry['comment_status']) ? 1 : 0; $allow_pings = ('open' == $entry['ping_status']) ? 1 : 0; @@ -1242,7 +1268,11 @@ class wp_xmlrpc_server extends IXR_Server { 'mt_excerpt' => $entry['post_excerpt'], 'mt_text_more' => $post['extended'], 'mt_allow_comments' => $allow_comments, - 'mt_allow_pings' => $allow_pings + 'mt_allow_pings' => $allow_pings, + 'wp_slug' => $entry['post_name'], + 'wp_password' => $entry['post_password'], + 'wp_author' => $author->user_nicename, + 'wp_author_username' => $author->user_login ); } @@ -1274,9 +1304,10 @@ class wp_xmlrpc_server extends IXR_Server { $categories_struct = array(); // FIXME: can we avoid using direct SQL there? - if ($cats = $wpdb->get_results("SELECT cat_ID,cat_name FROM $wpdb->categories", ARRAY_A)) { + if ($cats = $wpdb->get_results("SELECT cat_ID,cat_name,category_parent FROM $wpdb->categories", ARRAY_A)) { foreach ($cats as $cat) { $struct['categoryId'] = $cat['cat_ID']; + $struct['parentId'] = $cat['category_parent']; $struct['description'] = $cat['cat_name']; $struct['categoryName'] = $cat['cat_name']; $struct['htmlUrl'] = wp_specialchars(get_category_link($cat['cat_ID'])); |