Update tag.

git-svn-id: http://svn.automattic.com/wordpress/tags/1.5.1.3@2682 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2005-07-02 17:20:14 +00:00
parent b3c45632c4
commit 425850251c
2 changed files with 17 additions and 16 deletions

View File

@ -6,7 +6,7 @@
* generic function for inserting data into the posts table.
*/
function wp_insert_post($postarr = array()) {
global $wpdb, $post_default_category, $allowedtags;
global $wpdb, $allowedtags;
// export array as variables
extract($postarr);
@ -16,7 +16,7 @@ function wp_insert_post($postarr = array()) {
// Make sure we set a valid category
if (0 == count($post_category) || !is_array($post_category)) {
$post_category = array($post_default_category);
$post_category = array(get_option('default_category'));
}
$post_cat = $post_category[0];
@ -110,7 +110,7 @@ function wp_update_post($postarr = array()) {
// Make sure we set a valid category
if ( 0 == count($post_category) || !is_array($post_category) )
$post_category = array($post_default_category);
$post_category = array(get_option('default_category'));
$post_modified = current_time('mysql');
$post_modified_gmt = current_time('mysql', 1);
@ -157,7 +157,7 @@ function wp_set_post_cats($blogid = '1', $post_ID = 0, $post_categories = array(
// If $post_categories isn't already an array, make it one:
if (!is_array($post_categories)) {
if (!$post_categories) {
$post_categories = 1;
$post_categories = get_option('default_category');
}
$post_categories = array($post_categories);
}

View File

@ -10,7 +10,6 @@ include_once(ABSPATH . WPINC . '/class-IXR.php');
// error_reporting(0);
$post_default_title = ""; // posts submitted via the xmlrpc interface get that title
$post_default_category = 1; // posts submitted via the xmlrpc interface go into that category
$xmlrpc_logging = 0;
@ -563,9 +562,9 @@ class wp_xmlrpc_server extends IXR_Server {
foreach ($catnames as $cat) {
$post_category[] = get_cat_ID($cat);
}
} else {
$post_category[] = $post_default_category;
}
} else if ( !empty($catnames) ) {
$post_category = array(get_cat_ID($catnames));
}
// 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');
@ -614,14 +613,16 @@ class wp_xmlrpc_server extends IXR_Server {
$post_title = $content_struct['title'];
$post_content = apply_filters( 'content_save_pre', $content_struct['description'] );
$catnames = $content_struct['categories'];
$post_category = array();
if (is_array($catnames)) {
foreach ($catnames as $cat) {
$post_category[] = get_cat_ID($cat);
}
} else {
$post_category[] = $post_default_category;
}
} else if ( !empty($catnames) ) {
$post_category = array(get_cat_ID($catnames));
}
$post_excerpt = $content_struct['mt_excerpt'];
$post_more = $content_struct['mt_text_more'];
@ -829,11 +830,11 @@ class wp_xmlrpc_server extends IXR_Server {
// adapted from a patch by Johann Richard
// http://mycvs.org/archives/2004/06/30/file-upload-to-wordpress-in-ecto/
$this->escape($args);
global $wpdb;
$blog_ID = $args[0];
$user_login = $args[1];
$user_pass = $args[2];
$blog_ID = $wpdb->escape($args[0]);
$user_login = $wpdb->escape($args[1]);
$user_pass = $wpdb->escape($args[2]);
$data = $args[3];
$name = $data['name'];
@ -1199,7 +1200,7 @@ class wp_xmlrpc_server extends IXR_Server {
logIO("O","(PB) URI='$pagelinkedto' ID='$post_ID' Found='$way'");
$post = $wpdb->get_row("SELECT post_author FROM $wpdb->posts WHERE ID = '$post_ID'");
$post = get_post($post_ID);
if ( !$post ) // Post_ID not found
return new IXR_Error(33, 'The specified target URI cannot be used as a target. It either doesn\'t exist, or it is not a pingback-enabled resource.');