Show
Ignore:
Timestamp:
07/03/05 01:03:13 (4 years ago)
Author:
ryan
Message:

Another attempt to fix xmlrpc category handling for ecto.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/1.5/wp-includes/functions-post.php

    r2681 r2690  
    104104 
    105105    // First get all of the original fields 
    106     extract(wp_get_single_post($postarr['ID'], ARRAY_A));    
    107  
    108     // Now overwrite any changed values being passed in 
     106    $post = wp_get_single_post($postarr['ID'], ARRAY_A); 
     107 
     108    // Escape data pulled from DB. 
     109    $post = add_magic_quotes($post); 
     110    extract($post); 
     111 
     112    // Now overwrite any changed values being passed in. These are  
     113    // already escaped. 
    109114    extract($postarr); 
    110115 
    111     // Make sure we set a valid category 
     116    // If no categories were passed along, use the current cats. 
    112117    if ( 0 == count($post_category) || !is_array($post_category) ) 
    113         $post_category = array(get_option('default_category'))
     118        $post_category = $post['post_category']
    114119 
    115120    $post_modified = current_time('mysql'); 
     
    150155    $result = $wpdb->get_col($sql); 
    151156 
     157    if ( !$result ) 
     158        $result = array(); 
     159 
    152160    return array_unique($result); 
    153161} 
     
    156164    global $wpdb; 
    157165    // If $post_categories isn't already an array, make it one: 
    158     if (!is_array($post_categories)) { 
    159         if (!$post_categories) { 
    160             $post_categories = get_option('default_category'); 
    161         } 
    162         $post_categories = array($post_categories); 
    163     } 
     166    if (!is_array($post_categories) || 0 == count($post_categories)) 
     167        $post_categories = array(get_option('default_category')); 
    164168 
    165169    $post_categories = array_unique($post_categories);