# This patch file was generated by NetBeans IDE
# Following Index: paths are relative to: C:\xampp\htdocs\newtrunk\wp-includes
# This patch can be applied using context Tools: Patch action on respective folder.
# It uses platform neutral UTF-8 encoding and \n newlines.
# Above lines and this line are ignored by the patching process.
Index: class-wp-xmlrpc-server.php
--- class-wp-xmlrpc-server.php Base (BASE)
+++ class-wp-xmlrpc-server.php Locally Modified (Based On LOCAL)
@@ -596,6 +596,34 @@
 
 		do_action( 'xmlrpc_call', 'wp.newPost' );
 
+                $post_type = get_post_type_object( $content_struct['post_type'] );
+		if( ! ( (bool) $post_type ) )
+			return new IXR_Error( 403, __( 'Invalid post type' ) );
+
+		if( ! current_user_can( $post_type->cap->edit_posts ) )
+			return new IXR_Error( 401, __( 'Sorry, you are not allowed to post on this site.' ) );
+
+		switch ( $content_struct['post_status'] ) {
+			case 'draft':
+			case 'pending':
+				break;
+			case 'private':
+				if( ! current_user_can( $post_type->cap->publish_posts ) )
+					return new IXR_Error( 401, __( 'Sorry, you are not allowed to create private posts in this post type' ));
+				break;
+			case 'publish':
+			case 'future':
+				if( ! current_user_can( $post_type->cap->publish_posts ) )
+					return new IXR_Error( 401, __( 'Sorry, you are not allowed to publish posts in this post type' ));
+				break;
+			default:
+				$content_struct['post_status'] = 'draft';
+			break;
+		}
+
+                if ( ! empty( $content_struct['post_password'] ) && ! current_user_can( $post_type->cap->publish_posts ) )
+			return new IXR_Error( 401, __( 'Sorry, you are not allowed to create password protected posts in this post type' ) );
+
 		unset( $content_struct['ID'] );
 
 		return $this->_wp_insertPost( $user, $content_struct );
@@ -617,31 +645,9 @@
 
 		$post_data = wp_parse_args( $content_struct, $defaults );
 
-		$post_type = get_post_type_object( $post_data['post_type'] );
-		if( ! ( (bool) $post_type ) )
-			return new IXR_Error( 403, __( 'Invalid post type' ) );
 
-		if( ! current_user_can( $post_type->cap->edit_posts ) )
-			return new IXR_Error( 401, __( 'Sorry, you are not allowed to post on this site.' ) );
 
-		switch ( $post_data['post_status'] ) {
-			case 'draft':
-			case 'pending':
-				break;
-			case 'private':
-				if( ! current_user_can( $post_type->cap->publish_posts ) )
-					return new IXR_Error( 401, __( 'Sorry, you are not allowed to create private posts in this post type' ));
-				break;
-			case 'publish':
-			case 'future':
-				if( ! current_user_can( $post_type->cap->publish_posts ) )
-					return new IXR_Error( 401, __( 'Sorry, you are not allowed to publish posts in this post type' ));
-				break;
-			default:
-				$post_data['post_status'] = 'draft';
-			break;
-		}
-
+                $post_data['post_author'] = absint( $post_data['post_author'] );
 		if ( ! empty( $post_data['post_password'] ) && ! current_user_can( $post_type->cap->publish_posts ) )
 			return new IXR_Error( 401, __( 'Sorry, you are not allowed to create password protected posts in this post type' ) );
 
@@ -852,10 +858,7 @@
 
 		do_action( 'xmlrpc_call', 'wp.editPost' );
 
-		// User Capabilities are checked in _wp_insertPost.
-
 		$post = get_post( $post_id, ARRAY_A );
-
 		if ( empty( $post["ID"] ) )
 			return new IXR_Error( 404, __( 'Invalid post ID.' ) );
 
@@ -872,6 +875,34 @@
 		$this->escape( $post );
 		$merged_content_struct = array_merge( $post, $content_struct );
 
+                $post_type = get_post_type_object( $merged_content_struct['post_type'] );
+		if( ! ( (bool) $post_type ) )
+			return new IXR_Error( 403, __( 'Invalid post type' ) );
+
+		if( ! current_user_can( $post_type->cap->edit_post, $post_id ) )
+			return new IXR_Error( 401, __( 'Sorry, you are not allowed to post on this site.' ) );
+
+		switch ( $merged_content_struct['post_status'] ) {
+			case 'draft':
+			case 'pending':
+				break;
+			case 'private':
+				if( ! current_user_can( $post_type->cap->publish_post, $post_id ) )
+					return new IXR_Error( 401, __( 'Sorry, you are not allowed to create private posts in this post type' ));
+				break;
+			case 'publish':
+			case 'future':
+				if( ! current_user_can( $post_type->cap->publish_post, $post_id ) )
+					return new IXR_Error( 401, __( 'Sorry, you are not allowed to publish posts in this post type' ));
+				break;
+			default:
+				$post_data['post_status'] = 'draft';
+			break;
+		}
+
+                if ( ! empty( $merged_content_struct['post_password'] ) && ! current_user_can( $post_type->cap->publish_post, $post_id ) )
+			return new IXR_Error( 401, __( 'Sorry, you are not allowed to create password protected posts in this post type' ) );
+
 		$retval = $this->_wp_insertPost( $user, $merged_content_struct );
 		if ( $retval instanceof IXR_Error )
 			return $retval;
