]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-includes/class-wp-xmlrpc-server.php
WordPress 3.4.2
[autoinstalls/wordpress.git] / wp-includes / class-wp-xmlrpc-server.php
index 7334a85dcbd9631a034bfd0189dbe5871a44a714..14b83343b11c4bcf8f00522b969a182eca435542 100644 (file)
@@ -622,7 +622,11 @@ class wp_xmlrpc_server extends IXR_Server {
                        'post_password'     => $post['post_password'],
                        'post_excerpt'      => $post['post_excerpt'],
                        'post_content'      => $post['post_content'],
+                       'post_parent'       => strval( $post['post_parent'] ),
+                       'post_mime_type'    => $post['post_mime_type'],
                        'link'              => post_permalink( $post['ID'] ),
+                       'guid'              => $post['guid'],
+                       'menu_order'        => intval( $post['menu_order'] ),
                        'comment_status'    => $post['comment_status'],
                        'ping_status'       => $post['ping_status'],
                        'sticky'            => ( $post['post_type'] === 'post' && is_sticky( $post['ID'] ) ),
@@ -1337,7 +1341,7 @@ class wp_xmlrpc_server extends IXR_Server {
                        return new IXR_Error( 404, __( 'Invalid post ID.' ) );
 
                $post_type = get_post_type_object( $post['post_type'] );
-               if ( ! current_user_can( $post_type->cap->edit_posts, $post_id ) )
+               if ( ! current_user_can( $post_type->cap->edit_post, $post_id ) )
                        return new IXR_Error( 401, __( 'Sorry, you cannot edit this post.' ) );
 
                return $this->_prepare_post( $post, $fields );
@@ -1394,12 +1398,14 @@ class wp_xmlrpc_server extends IXR_Server {
                        $post_type = get_post_type_object( $filter['post_type'] );
                        if ( ! ( (bool) $post_type ) )
                                return new IXR_Error( 403, __( 'The post type specified is not valid' ) );
+               } else {
+                       $post_type = get_post_type_object( 'post' );
+               }
 
-                       if ( ! current_user_can( $post_type->cap->edit_posts ) )
-                               return new IXR_Error( 401, __( 'Sorry, you are not allowed to edit posts in this post type' ));
+               if ( ! current_user_can( $post_type->cap->edit_posts ) )
+                       return new IXR_Error( 401, __( 'Sorry, you are not allowed to edit posts in this post type' ));
 
-                       $query['post_type'] = $filter['post_type'];
-               }
+               $query['post_type'] = $post_type->name;
 
                if ( isset( $filter['post_status'] ) )
                        $query['post_status'] = $filter['post_status'];
@@ -1427,7 +1433,7 @@ class wp_xmlrpc_server extends IXR_Server {
 
                foreach ( $posts_list as $post ) {
                        $post_type = get_post_type_object( $post['post_type'] );
-                       if ( ! current_user_can( $post_type->cap->edit_posts, $post['ID'] ) )
+                       if ( ! current_user_can( $post_type->cap->edit_post, $post['ID'] ) )
                                continue;
 
                        $struct[] = $this->_prepare_post( $post, $fields );