+case 'trash':
+ $post_id = isset($_GET['post']) ? intval($_GET['post']) : intval($_POST['post_ID']);
+ check_admin_referer('trash-post_' . $post_id);
+
+ $post = & get_post($post_id);
+
+ if ( !current_user_can('delete_post', $post_id) )
+ wp_die( __('You are not allowed to move this post to the trash.') );
+
+ if ( ! wp_trash_post($post_id) )
+ wp_die( __('Error in moving to trash...') );
+
+ wp_redirect( add_query_arg( array('trashed' => 1, 'ids' => $post_id), $sendback ) );
+ exit();
+ break;
+
+case 'untrash':
+ $post_id = isset($_GET['post']) ? intval($_GET['post']) : intval($_POST['post_ID']);
+ check_admin_referer('untrash-post_' . $post_id);
+
+ $post = & get_post($post_id);
+
+ if ( !current_user_can('delete_post', $post_id) )
+ wp_die( __('You are not allowed to move this post out of the trash.') );
+
+ if ( ! wp_untrash_post($post_id) )
+ wp_die( __('Error in restoring from trash...') );
+
+ wp_redirect( add_query_arg('untrashed', 1, $sendback) );
+ exit();
+ break;
+