# 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.
|
|
|
|
| 596 | 596 | |
| 597 | 597 | do_action( 'xmlrpc_call', 'wp.newPost' ); |
| 598 | 598 | |
| | 599 | $post_type = get_post_type_object( $content_struct['post_type'] ); |
| | 600 | if( ! ( (bool) $post_type ) ) |
| | 601 | return new IXR_Error( 403, __( 'Invalid post type' ) ); |
| | 602 | |
| | 603 | if( ! current_user_can( $post_type->cap->edit_posts ) ) |
| | 604 | return new IXR_Error( 401, __( 'Sorry, you are not allowed to post on this site.' ) ); |
| | 605 | |
| | 606 | switch ( $content_struct['post_status'] ) { |
| | 607 | case 'draft': |
| | 608 | case 'pending': |
| | 609 | break; |
| | 610 | case 'private': |
| | 611 | if( ! current_user_can( $post_type->cap->publish_posts ) ) |
| | 612 | return new IXR_Error( 401, __( 'Sorry, you are not allowed to create private posts in this post type' )); |
| | 613 | break; |
| | 614 | case 'publish': |
| | 615 | case 'future': |
| | 616 | if( ! current_user_can( $post_type->cap->publish_posts ) ) |
| | 617 | return new IXR_Error( 401, __( 'Sorry, you are not allowed to publish posts in this post type' )); |
| | 618 | break; |
| | 619 | default: |
| | 620 | $content_struct['post_status'] = 'draft'; |
| | 621 | break; |
| | 622 | } |
| | 623 | |
| | 624 | if ( ! empty( $content_struct['post_password'] ) && ! current_user_can( $post_type->cap->publish_posts ) ) |
| | 625 | return new IXR_Error( 401, __( 'Sorry, you are not allowed to create password protected posts in this post type' ) ); |
| | 626 | |
| 599 | 627 | unset( $content_struct['ID'] ); |
| 600 | 628 | |
| 601 | 629 | return $this->_wp_insertPost( $user, $content_struct ); |
| … |
… |
|
| 617 | 645 | |
| 618 | 646 | $post_data = wp_parse_args( $content_struct, $defaults ); |
| 619 | 647 | |
| 620 | | $post_type = get_post_type_object( $post_data['post_type'] ); |
| 621 | | if( ! ( (bool) $post_type ) ) |
| 622 | | return new IXR_Error( 403, __( 'Invalid post type' ) ); |
| 623 | 648 | |
| 624 | | if( ! current_user_can( $post_type->cap->edit_posts ) ) |
| 625 | | return new IXR_Error( 401, __( 'Sorry, you are not allowed to post on this site.' ) ); |
| 626 | 649 | |
| 627 | | switch ( $post_data['post_status'] ) { |
| 628 | | case 'draft': |
| 629 | | case 'pending': |
| 630 | | break; |
| 631 | | case 'private': |
| 632 | | if( ! current_user_can( $post_type->cap->publish_posts ) ) |
| 633 | | return new IXR_Error( 401, __( 'Sorry, you are not allowed to create private posts in this post type' )); |
| 634 | | break; |
| 635 | | case 'publish': |
| 636 | | case 'future': |
| 637 | | if( ! current_user_can( $post_type->cap->publish_posts ) ) |
| 638 | | return new IXR_Error( 401, __( 'Sorry, you are not allowed to publish posts in this post type' )); |
| 639 | | break; |
| 640 | | default: |
| 641 | | $post_data['post_status'] = 'draft'; |
| 642 | | break; |
| 643 | | } |
| 644 | | |
| | 650 | $post_data['post_author'] = absint( $post_data['post_author'] ); |
| 645 | 651 | if ( ! empty( $post_data['post_password'] ) && ! current_user_can( $post_type->cap->publish_posts ) ) |
| 646 | 652 | return new IXR_Error( 401, __( 'Sorry, you are not allowed to create password protected posts in this post type' ) ); |
| 647 | 653 | |
| … |
… |
|
| 852 | 858 | |
| 853 | 859 | do_action( 'xmlrpc_call', 'wp.editPost' ); |
| 854 | 860 | |
| 855 | | // User Capabilities are checked in _wp_insertPost. |
| 856 | | |
| 857 | 861 | $post = get_post( $post_id, ARRAY_A ); |
| 858 | | |
| 859 | 862 | if ( empty( $post["ID"] ) ) |
| 860 | 863 | return new IXR_Error( 404, __( 'Invalid post ID.' ) ); |
| 861 | 864 | |
| … |
… |
|
| 872 | 875 | $this->escape( $post ); |
| 873 | 876 | $merged_content_struct = array_merge( $post, $content_struct ); |
| 874 | 877 | |
| | 878 | $post_type = get_post_type_object( $merged_content_struct['post_type'] ); |
| | 879 | if( ! ( (bool) $post_type ) ) |
| | 880 | return new IXR_Error( 403, __( 'Invalid post type' ) ); |
| | 881 | |
| | 882 | if( ! current_user_can( $post_type->cap->edit_post, $post_id ) ) |
| | 883 | return new IXR_Error( 401, __( 'Sorry, you are not allowed to post on this site.' ) ); |
| | 884 | |
| | 885 | switch ( $merged_content_struct['post_status'] ) { |
| | 886 | case 'draft': |
| | 887 | case 'pending': |
| | 888 | break; |
| | 889 | case 'private': |
| | 890 | if( ! current_user_can( $post_type->cap->publish_post, $post_id ) ) |
| | 891 | return new IXR_Error( 401, __( 'Sorry, you are not allowed to create private posts in this post type' )); |
| | 892 | break; |
| | 893 | case 'publish': |
| | 894 | case 'future': |
| | 895 | if( ! current_user_can( $post_type->cap->publish_post, $post_id ) ) |
| | 896 | return new IXR_Error( 401, __( 'Sorry, you are not allowed to publish posts in this post type' )); |
| | 897 | break; |
| | 898 | default: |
| | 899 | $post_data['post_status'] = 'draft'; |
| | 900 | break; |
| | 901 | } |
| | 902 | |
| | 903 | if ( ! empty( $merged_content_struct['post_password'] ) && ! current_user_can( $post_type->cap->publish_post, $post_id ) ) |
| | 904 | return new IXR_Error( 401, __( 'Sorry, you are not allowed to create password protected posts in this post type' ) ); |
| | 905 | |
| 875 | 906 | $retval = $this->_wp_insertPost( $user, $merged_content_struct ); |
| 876 | 907 | if ( $retval instanceof IXR_Error ) |
| 877 | 908 | return $retval; |