Make WordPress Core

Changeset 2693


Ignore:
Timestamp:
07/03/2005 06:33:03 PM (21 years ago)
Author:
ryan
Message:

XMLRPC category fixes

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/functions-post.php

    r2683 r2693  
    203203
    204204        // Escape data pulled from DB.
    205         foreach ($post as $key => $value)
    206                 $post[$key] = $wpdb->escape($value);
    207 
    208         // Passed post category list takes overwrites existing
    209         // category list.
    210         if ( isset($postarr['post_category']) )
     205        $post = add_magic_quotes($post);
     206
     207        // Passed post category list overwrites existing category list if not empty.
     208        if ( isset($postarr['post_category']) && is_array($postarr['post_category'])
     209                         && 0 != count($postarr['post_category']) )
    211210                $post_cats = $postarr['post_category'];
    212211        else
    … …  
    239238        global $wpdb;
    240239        // If $post_categories isn't already an array, make it one:
    241         if (!is_array($post_categories)) {
    242                 if (!$post_categories) {
    243                         $post_categories = 1;
    244                 }
    245                 $post_categories = array($post_categories);
    246         }
    247 
     240        if (!is_array($post_categories) || 0 == count($post_categories))
     241                $post_categories = array(get_option('default_category'));
     242       
    248243        $post_categories = array_unique($post_categories);
    249244
  • trunk/xmlrpc.php

    r2680 r2693  
    149149        function blogger_getUsersBlogs($args) {
    150150
     151          logIO('O', " User login :  {$args[1]}");
     152          logIO('O', " User pass :  {$args[2]}");
     153
    151154                $this->escape($args);
    152155
    153156          $user_login = $args[1];
    154157          $user_pass  = $args[2];
     158
     159          logIO('O', " User login :  $user_login");
     160          logIO('O', " User pass :  $user_pass");
    155161
    156162          if (!$this->login_pass_ok($user_login, $user_pass)) {
    … …  
    563569              $post_category[] = get_cat_ID($cat);
    564570            }
    565           } else if ( !empty($catnames) ) {
    566                         $post_category = array(get_cat_ID($catnames));
    567                 }
     571          }
    568572               
    569573          // We've got all the data -- post it:
    … …  
    618622              $post_category[] = get_cat_ID($cat);
    619623            }
    620           } else if ( !empty($catnames) ) {
    621                         $post_category = array(get_cat_ID($catnames));
    622                 }
     624          }
    623625
    624626          $post_excerpt = $content_struct['mt_excerpt'];
Note: See TracChangeset for help on using the changeset viewer.