diff --git a/wp-includes/functions-post.php b/wp-includes/functions-post.php index c3289d9958..c078ffd3dd 100644 --- a/wp-includes/functions-post.php +++ b/wp-includes/functions-post.php @@ -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 diff --git a/xmlrpc.php b/xmlrpc.php index f3161e96d2..19a52150e5 100644 --- a/xmlrpc.php +++ b/xmlrpc.php @@ -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'];