# This patch file was generated by NetBeans IDE
# Following Index: paths are relative to: C:\xampp\htdocs\wordtrunk\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.
|
|
|
621 | 621 | if( ! ( (bool) $post_type ) ) |
622 | 622 | return new IXR_Error( 403, __( 'Invalid post type' ) ); |
623 | 623 | |
| 624 | $update = false; |
| 625 | if ( !empty( $post_data['ID'] ) ) |
| 626 | $update = true; |
| 627 | if( $update ) { |
| 628 | |
| 629 | if( ! current_user_can( $post_type->cap->edit_post, $post_data['ID'] ) ) |
| 630 | return new IXR_Error( 401, __( 'Sorry, you are not allowed to edit this post.' ) ); |
| 631 | |
| 632 | switch ( $post_data['post_status'] ) { |
| 633 | case 'draft': |
| 634 | case 'pending': |
| 635 | break; |
| 636 | case 'private': |
| 637 | if( ! current_user_can( $post_type->cap->publish_post, $post_data['ID'] ) ) |
| 638 | return new IXR_Error( 401, __( 'Sorry, you are not allowed set this post as private.' )); |
| 639 | break; |
| 640 | case 'publish': |
| 641 | case 'future': |
| 642 | if( ! current_user_can( $post_type->cap->publish_post, $post_data['ID'] ) ) |
| 643 | return new IXR_Error( 401, __( 'Sorry, you are not allowed to publish this post.' )); |
| 644 | break; |
| 645 | default: |
| 646 | $post_data['post_status'] = 'draft'; |
| 647 | break; |
| 648 | } |
| 649 | |
| 650 | if ( ! empty( $post_data['post_password'] ) && ! current_user_can( $post_type->cap->publish_post, $post_data['ID'] ) ) |
| 651 | return new IXR_Error( 401, __( 'Sorry, you are not allowed to set password to this post' ) ); |
| 652 | |
| 653 | } else { |
| 654 | |
624 | 655 | 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.' ) ); |
| 656 | return new IXR_Error( 401, __( 'Sorry, you are not allowed to post in this post type.' ) ); |
626 | 657 | |
627 | 658 | switch ( $post_data['post_status'] ) { |
628 | 659 | case 'draft': |
… |
… |
|
645 | 676 | if ( ! empty( $post_data['post_password'] ) && ! current_user_can( $post_type->cap->publish_posts ) ) |
646 | 677 | return new IXR_Error( 401, __( 'Sorry, you are not allowed to create password protected posts in this post type' ) ); |
647 | 678 | |
| 679 | } |
648 | 680 | |
649 | 681 | $post_data['post_author'] = absint( $post_data['post_author'] ); |
650 | 682 | if( ! empty( $post_data['post_author'] ) && $post_data['post_author'] != $user->ID ) { |