XMLRPC category fixes

git-svn-id: http://svn.automattic.com/wordpress/trunk@2693 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2005-07-03 18:33:03 +00:00
parent e2d9a4c765
commit 54766eade4
2 changed files with 15 additions and 18 deletions

View File

@ -202,12 +202,11 @@ function wp_update_post($postarr = array()) {
$post = wp_get_single_post($postarr['ID'], ARRAY_A);
// Escape data pulled from DB.
foreach ($post as $key => $value)
$post[$key] = $wpdb->escape($value);
$post = add_magic_quotes($post);
// Passed post category list takes overwrites existing
// category list.
if ( isset($postarr['post_category']) )
// Passed post category list overwrites existing category list if not empty.
if ( isset($postarr['post_category']) && is_array($postarr['post_category'])
&& 0 != count($postarr['post_category']) )
$post_cats = $postarr['post_category'];
else
$post_cats = $post['post_category'];
@ -238,13 +237,9 @@ function wp_get_post_cats($blogid = '1', $post_ID = 0) {
function wp_set_post_cats($blogid = '1', $post_ID = 0, $post_categories = array()) {
global $wpdb;
// If $post_categories isn't already an array, make it one:
if (!is_array($post_categories)) {
if (!$post_categories) {
$post_categories = 1;
}
$post_categories = array($post_categories);
}
if (!is_array($post_categories) || 0 == count($post_categories))
$post_categories = array(get_option('default_category'));
$post_categories = array_unique($post_categories);
// First the old categories

View File

@ -148,11 +148,17 @@ class wp_xmlrpc_server extends IXR_Server {
/* blogger.getUsersBlogs will make more sense once we support multiple blogs */
function blogger_getUsersBlogs($args) {
logIO('O', " User login : {$args[1]}");
logIO('O', " User pass : {$args[2]}");
$this->escape($args);
$user_login = $args[1];
$user_pass = $args[2];
logIO('O', " User login : $user_login");
logIO('O', " User pass : $user_pass");
if (!$this->login_pass_ok($user_login, $user_pass)) {
return $this->error;
}
@ -562,9 +568,7 @@ class wp_xmlrpc_server extends IXR_Server {
foreach ($catnames as $cat) {
$post_category[] = get_cat_ID($cat);
}
} else if ( !empty($catnames) ) {
$post_category = array(get_cat_ID($catnames));
}
}
// We've got all the data -- post it:
$postdata = compact('post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_title', 'post_category', 'post_status', 'post_excerpt', 'comment_status', 'ping_status', 'to_ping');
@ -617,9 +621,7 @@ class wp_xmlrpc_server extends IXR_Server {
foreach ($catnames as $cat) {
$post_category[] = get_cat_ID($cat);
}
} else if ( !empty($catnames) ) {
$post_category = array(get_cat_ID($catnames));
}
}
$post_excerpt = $content_struct['mt_excerpt'];
$post_more = $content_struct['mt_text_more'];