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);
|
||||
|
||||
// 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,12 +237,8 @@ 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);
|
||||
|
||||
|
|
10
xmlrpc.php
10
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,8 +568,6 @@ 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:
|
||||
|
@ -617,8 +621,6 @@ 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'];
|
||||
|
|
Loading…
Reference in New Issue