Make WordPress Core

Changeset 2690


Ignore:
Timestamp:
07/03/2005 01:03:13 AM (19 years ago)
Author:
ryan
Message:

Another attempt to fix xmlrpc category handling for ecto.

Location:
branches/1.5
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • 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);
  • branches/1.5/xmlrpc.php

    r2679 r2690  
    563563          $post_category[] = get_cat_ID($cat);
    564564        }
    565       } else if ( !empty($catnames) ) {
    566             $post_category = array(get_cat_ID($catnames));
    567         }
     565      }
    568566       
    569567      // We've got all the data -- post it:
     
    621619          $post_category[] = get_cat_ID($cat);
    622620        }
    623       } else if ( !empty($catnames) ) {
    624             $post_category = array(get_cat_ID($catnames));
    625         }
     621      }
    626622
    627623      $post_excerpt = $content_struct['mt_excerpt'];
Note: See TracChangeset for help on using the changeset viewer.