XMLRPC category fixes
git-svn-id: https://develop.svn.wordpress.org/trunk@2693 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
b5675c3c05
commit
506091a710
|
@ -202,12 +202,11 @@ function wp_update_post($postarr = array()) {
|
||||||
$post = wp_get_single_post($postarr['ID'], ARRAY_A);
|
$post = wp_get_single_post($postarr['ID'], ARRAY_A);
|
||||||
|
|
||||||
// Escape data pulled from DB.
|
// Escape data pulled from DB.
|
||||||
foreach ($post as $key => $value)
|
$post = add_magic_quotes($post);
|
||||||
$post[$key] = $wpdb->escape($value);
|
|
||||||
|
|
||||||
// Passed post category list takes overwrites existing
|
// Passed post category list overwrites existing category list if not empty.
|
||||||
// category list.
|
if ( isset($postarr['post_category']) && is_array($postarr['post_category'])
|
||||||
if ( isset($postarr['post_category']) )
|
&& 0 != count($postarr['post_category']) )
|
||||||
$post_cats = $postarr['post_category'];
|
$post_cats = $postarr['post_category'];
|
||||||
else
|
else
|
||||||
$post_cats = $post['post_category'];
|
$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()) {
|
function wp_set_post_cats($blogid = '1', $post_ID = 0, $post_categories = array()) {
|
||||||
global $wpdb;
|
global $wpdb;
|
||||||
// If $post_categories isn't already an array, make it one:
|
// If $post_categories isn't already an array, make it one:
|
||||||
if (!is_array($post_categories)) {
|
if (!is_array($post_categories) || 0 == count($post_categories))
|
||||||
if (!$post_categories) {
|
$post_categories = array(get_option('default_category'));
|
||||||
$post_categories = 1;
|
|
||||||
}
|
|
||||||
$post_categories = array($post_categories);
|
|
||||||
}
|
|
||||||
|
|
||||||
$post_categories = array_unique($post_categories);
|
$post_categories = array_unique($post_categories);
|
||||||
|
|
||||||
// First the old categories
|
// First the old categories
|
||||||
|
|
14
xmlrpc.php
14
xmlrpc.php
|
@ -148,11 +148,17 @@ class wp_xmlrpc_server extends IXR_Server {
|
||||||
/* blogger.getUsersBlogs will make more sense once we support multiple blogs */
|
/* blogger.getUsersBlogs will make more sense once we support multiple blogs */
|
||||||
function blogger_getUsersBlogs($args) {
|
function blogger_getUsersBlogs($args) {
|
||||||
|
|
||||||
|
logIO('O', " User login : {$args[1]}");
|
||||||
|
logIO('O', " User pass : {$args[2]}");
|
||||||
|
|
||||||
$this->escape($args);
|
$this->escape($args);
|
||||||
|
|
||||||
$user_login = $args[1];
|
$user_login = $args[1];
|
||||||
$user_pass = $args[2];
|
$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)) {
|
if (!$this->login_pass_ok($user_login, $user_pass)) {
|
||||||
return $this->error;
|
return $this->error;
|
||||||
}
|
}
|
||||||
|
@ -562,9 +568,7 @@ class wp_xmlrpc_server extends IXR_Server {
|
||||||
foreach ($catnames as $cat) {
|
foreach ($catnames as $cat) {
|
||||||
$post_category[] = get_cat_ID($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:
|
// 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');
|
$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) {
|
foreach ($catnames as $cat) {
|
||||||
$post_category[] = get_cat_ID($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_excerpt = $content_struct['mt_excerpt'];
|
||||||
$post_more = $content_struct['mt_text_more'];
|
$post_more = $content_struct['mt_text_more'];
|
||||||
|
|
Loading…
Reference in New Issue