Code Duplication    Length = 6-7 lines in 2 locations

src/wp-admin/includes/post.php 1 location

@@ 211-216 (lines=6) @@
208
	}
209
210
	$ptype = get_post_type_object($post_data['post_type']);
211
	if ( !current_user_can( 'edit_post', $post_ID ) ) {
212
		if ( 'page' == $post_data['post_type'] )
213
			wp_die( __('Sorry, you are not allowed to edit this page.' ));
214
		else
215
			wp_die( __('Sorry, you are not allowed to edit this post.' ));
216
	}
217
218
	if ( post_type_supports( $ptype->name, 'revisions' ) ) {
219
		$revisions = wp_get_post_revisions( $post_ID, array( 'order' => 'ASC', 'posts_per_page' => 1 ) );

src/wp-admin/includes/ajax-actions.php 1 location

@@ 1665-1671 (lines=7) @@
1662
	if ( ! isset($_POST['post_ID']) || ! ( $post_ID = (int) $_POST['post_ID'] ) )
1663
		wp_die();
1664
1665
	if ( 'page' == $_POST['post_type'] ) {
1666
		if ( ! current_user_can( 'edit_page', $post_ID ) )
1667
			wp_die( __( 'Sorry, you are not allowed to edit this page.' ) );
1668
	} else {
1669
		if ( ! current_user_can( 'edit_post', $post_ID ) )
1670
			wp_die( __( 'Sorry, you are not allowed to edit this post.' ) );
1671
	}
1672
1673
	if ( $last = wp_check_post_lock( $post_ID ) ) {
1674
		$last_user = get_userdata( $last );