X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/baca9ce86a38dc54c4574890ee2d352fd81f78b2..61343b82c4f0da4c68e4c6373daafff4a81efdd1:/wp-admin/edit.php?ds=sidebyside diff --git a/wp-admin/edit.php b/wp-admin/edit.php index 9eae3cf3..65fd0342 100644 --- a/wp-admin/edit.php +++ b/wp-admin/edit.php @@ -48,7 +48,7 @@ $doaction = $wp_list_table->current_action(); if ( $doaction ) { check_admin_referer('bulk-posts'); - $sendback = remove_query_arg( array('trashed', 'untrashed', 'deleted', 'ids'), wp_get_referer() ); + $sendback = remove_query_arg( array('trashed', 'untrashed', 'deleted', 'locked', 'ids'), wp_get_referer() ); if ( ! $sendback ) $sendback = admin_url( $parent_file ); $sendback = add_query_arg( 'paged', $pagenum, $sendback ); @@ -75,22 +75,29 @@ if ( $doaction ) { switch ( $doaction ) { case 'trash': - $trashed = 0; + $trashed = $locked = 0; + foreach( (array) $post_ids as $post_id ) { - if ( !current_user_can($post_type_object->cap->delete_post, $post_id) ) + if ( !current_user_can( 'delete_post', $post_id) ) wp_die( __('You are not allowed to move this item to the Trash.') ); + if ( wp_check_post_lock( $post_id ) ) { + $locked++; + continue; + } + if ( !wp_trash_post($post_id) ) wp_die( __('Error in moving to Trash.') ); $trashed++; } - $sendback = add_query_arg( array('trashed' => $trashed, 'ids' => join(',', $post_ids) ), $sendback ); + + $sendback = add_query_arg( array('trashed' => $trashed, 'ids' => join(',', $post_ids), 'locked' => $locked ), $sendback ); break; case 'untrash': $untrashed = 0; foreach( (array) $post_ids as $post_id ) { - if ( !current_user_can($post_type_object->cap->delete_post, $post_id) ) + if ( !current_user_can( 'delete_post', $post_id) ) wp_die( __('You are not allowed to restore this item from the Trash.') ); if ( !wp_untrash_post($post_id) ) @@ -105,15 +112,15 @@ if ( $doaction ) { foreach( (array) $post_ids as $post_id ) { $post_del = get_post($post_id); - if ( !current_user_can($post_type_object->cap->delete_post, $post_id) ) + if ( !current_user_can( 'delete_post', $post_id ) ) wp_die( __('You are not allowed to delete this item.') ); if ( $post_del->post_type == 'attachment' ) { if ( ! wp_delete_attachment($post_id) ) - wp_die( __('Error in deleting...') ); + wp_die( __('Error in deleting.') ); } else { if ( !wp_delete_post($post_id) ) - wp_die( __('Error in deleting...') ); + wp_die( __('Error in deleting.') ); } $deleted++; } @@ -138,7 +145,7 @@ if ( $doaction ) { wp_redirect($sendback); exit(); } elseif ( ! empty($_REQUEST['_wp_http_referer']) ) { - wp_redirect( remove_query_arg( array('_wp_http_referer', '_wpnonce'), stripslashes($_SERVER['REQUEST_URI']) ) ); + wp_redirect( remove_query_arg( array('_wp_http_referer', '_wpnonce'), wp_unslash($_SERVER['REQUEST_URI']) ) ); exit; }