]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-admin/edit.php
Wordpress 3.6
[autoinstalls/wordpress.git] / wp-admin / edit.php
index 9eae3cf395fd1158114c83aa9d6d12ba60b45c66..65fd03426aa4b5fbbf8c23c5a393008df7701fdf 100644 (file)
@@ -48,7 +48,7 @@ $doaction = $wp_list_table->current_action();
 if ( $doaction ) {
        check_admin_referer('bulk-posts');
 
 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 );
        if ( ! $sendback )
                $sendback = admin_url( $parent_file );
        $sendback = add_query_arg( 'paged', $pagenum, $sendback );
@@ -75,22 +75,29 @@ if ( $doaction ) {
 
        switch ( $doaction ) {
                case 'trash':
 
        switch ( $doaction ) {
                case 'trash':
-                       $trashed = 0;
+                       $trashed = $locked = 0;
+
                        foreach( (array) $post_ids as $post_id ) {
                        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.') );
 
                                        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++;
                        }
                                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 ) {
                        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) )
                                        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);
 
                        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( __('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) )
                                } else {
                                        if ( !wp_delete_post($post_id) )
-                                               wp_die( __('Error in deleting...') );
+                                               wp_die( __('Error in deleting.') );
                                }
                                $deleted++;
                        }
                                }
                                $deleted++;
                        }
@@ -138,7 +145,7 @@ if ( $doaction ) {
        wp_redirect($sendback);
        exit();
 } elseif ( ! empty($_REQUEST['_wp_http_referer']) ) {
        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;
 }
 
         exit;
 }