<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><style type="text/css"><!--
#msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fc0 solid; padding: 6px; }
#msg ul, pre { overflow: auto; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<title>[17277] trunk/wp-admin: Revert [17275] and [17276].</title>
</head>
<body>
<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/17277">17277</a></dd>
<dt>Author</dt> <dd>nacin</dd>
<dt>Date</dt> <dd>2011-01-13 00:50:35 +0000 (Thu, 13 Jan 2011)</dd>
</dl>
<h3>Log Message</h3>
<pre>Revert <a href="http://trac.wordpress.org/changeset/17275">[17275]</a> and <a href="http://trac.wordpress.org/changeset/17276">[17276]</a>. The rabbit hole is too deep. see <a href="http://trac.wordpress.org/ticket/16166">#16166</a>.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadmineditphp">trunk/wp-admin/edit.php</a></li>
<li><a href="#trunkwpadminincludesclasswppostslisttablephp">trunk/wp-admin/includes/class-wp-posts-list-table.php</a></li>
<li><a href="#trunkwpadminusersphp">trunk/wp-admin/users.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadmineditphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/edit.php (17276 => 17277)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/edit.php        2011-01-13 00:34:18 UTC (rev 17276)
+++ trunk/wp-admin/edit.php        2011-01-13 00:50:35 UTC (rev 17277)
</span><span class="lines">@@ -38,7 +38,93 @@
</span><span class="cx"> $doaction = $wp_list_table->current_action();
</span><span class="cx">
</span><span class="cx"> if ( $doaction ) {
</span><del>-        $wp_list_table->do_bulk_actions( $doaction );
</del><ins>+        check_admin_referer('bulk-posts');
+
+        $sendback = remove_query_arg( array('trashed', 'untrashed', 'deleted', 'ids'), wp_get_referer() );
+        $sendback = $wp_list_table->add_query_args( $sendback );
+        if ( strpos($sendback, 'post.php') !== false )
+                $sendback = admin_url($post_new_file);
+
+        if ( 'delete_all' == $doaction ) {
+                $post_status = preg_replace('/[^a-z0-9_-]+/i', '', $_REQUEST['post_status']);
+                if ( get_post_status_object($post_status) ) // Check the post status exists first
+                        $post_ids = $wpdb->get_col( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_type=%s AND post_status = %s", $post_type, $post_status ) );
+                $doaction = 'delete';
+        } elseif ( isset( $_REQUEST['media'] ) ) {
+                $post_ids = $_REQUEST['media'];
+        } elseif ( isset( $_REQUEST['ids'] ) ) {
+                $post_ids = explode( ',', $_REQUEST['ids'] );
+        } elseif ( !empty( $_REQUEST['post'] ) ) {
+                $post_ids = array_map('intval', $_REQUEST['post']);
+        }
+
+        if ( !isset( $post_ids ) ) {
+                wp_redirect( admin_url("edit.php?post_type=$post_type") );
+                exit;
+        }
+
+        switch ( $doaction ) {
+                case 'trash':
+                        $trashed = 0;
+                        foreach( (array) $post_ids as $post_id ) {
+                                if ( !current_user_can($post_type_object->cap->delete_post, $post_id) )
+                                        wp_die( __('You are not allowed to move this item to the Trash.') );
+
+                                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 );
+                        break;
+                case 'untrash':
+                        $untrashed = 0;
+                        foreach( (array) $post_ids as $post_id ) {
+                                if ( !current_user_can($post_type_object->cap->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( __('Error in restoring from Trash.') );
+
+                                $untrashed++;
+                        }
+                        $sendback = add_query_arg('untrashed', $untrashed, $sendback);
+                        break;
+                case 'delete':
+                        $deleted = 0;
+                        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) )
+                                        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...') );
+                                } else {
+                                        if ( !wp_delete_post($post_id) )
+                                                wp_die( __('Error in deleting...') );
+                                }
+                                $deleted++;
+                        }
+                        $sendback = add_query_arg('deleted', $deleted, $sendback);
+                        break;
+                case 'edit':
+                        $done = bulk_edit_posts($_REQUEST);
+
+                        if ( is_array($done) ) {
+                                $done['updated'] = count( $done['updated'] );
+                                $done['skipped'] = count( $done['skipped'] );
+                                $done['locked'] = count( $done['locked'] );
+                                $sendback = add_query_arg( $done, $sendback );
+                        }
+                        break;
+        }
+
+        $sendback = remove_query_arg( array('action', 'action2', 'tags_input', 'post_author', 'comment_status', 'ping_status', '_status', 'post', 'bulk_edit', 'post_view'), $sendback );
+
+        wp_redirect($sendback);
+        exit();
</ins><span class="cx"> } elseif ( ! empty($_REQUEST['_wp_http_referer']) ) {
</span><span class="cx">          wp_redirect( remove_query_arg( array('_wp_http_referer', '_wpnonce'), stripslashes($_SERVER['REQUEST_URI']) ) );
</span><span class="cx">          exit;
</span></span></pre></div>
<a id="trunkwpadminincludesclasswppostslisttablephp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/class-wp-posts-list-table.php (17276 => 17277)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/class-wp-posts-list-table.php        2011-01-13 00:34:18 UTC (rev 17276)
+++ trunk/wp-admin/includes/class-wp-posts-list-table.php        2011-01-13 00:50:35 UTC (rev 17277)
</span><span class="lines">@@ -1013,105 +1013,6 @@
</span><span class="cx">                 </tbody></table></form>
</span><span class="cx"> <?php
</span><span class="cx">         }
</span><del>-
-        function do_bulk_actions( $doaction = null ) {
-                if ( null === $doaction )
-                        $doaction = $this->current_action();
-
-                if ( ! $doaction )
-                        return;
-
-                check_admin_referer('bulk-posts');
-
-                $sendback = remove_query_arg( array('trashed', 'untrashed', 'deleted', 'ids'), wp_get_referer() );
-                if ( strpos($sendback, 'post.php') !== false )
-                        $sendback = admin_url($post_new_file);
-
-                if ( 'delete_all' == $doaction ) {
-                        $post_status = preg_replace('/[^a-z0-9_-]+/i', '', $_REQUEST['post_status']);
-                        if ( get_post_status_object($post_status) ) // Check the post status exists first
-                                $post_ids = $wpdb->get_col( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_type=%s AND post_status = %s", $post_type, $post_status ) );
-                        $doaction = 'delete';
-                } elseif ( isset( $_REQUEST['media'] ) ) {
-                        $post_ids = $_REQUEST['media'];
-                } elseif ( isset( $_REQUEST['ids'] ) ) {
-                        $post_ids = explode( ',', $_REQUEST['ids'] );
-                } elseif ( !empty( $_REQUEST['post'] ) ) {
-                        $post_ids = array_map('intval', $_REQUEST['post']);
-                }
-
-                if ( !isset( $post_ids ) ) {
-                        wp_redirect( admin_url("edit.php?post_type=$post_type") );
-                        exit;
-                }
-
-                switch ( $doaction ) {
-                        case 'trash':
-                                $trashed = 0;
-                                foreach( (array) $post_ids as $post_id ) {
-                                        if ( !current_user_can($post_type_object->cap->delete_post, $post_id) )
-                                                wp_die( __('You are not allowed to move this item to the Trash.') );
-
-                                        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 );
-                                break;
-                        case 'untrash':
-                                $untrashed = 0;
-                                foreach( (array) $post_ids as $post_id ) {
-                                        if ( !current_user_can($post_type_object->cap->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( __('Error in restoring from Trash.') );
-
-                                        $untrashed++;
-                                }
-                                $sendback = add_query_arg('untrashed', $untrashed, $sendback);
-                                break;
-                        case 'delete':
-                                $deleted = 0;
-                                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) )
-                                                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...') );
-                                        } else {
-                                                if ( !wp_delete_post($post_id) )
-                                                        wp_die( __('Error in deleting...') );
-                                        }
-                                        $deleted++;
-                                }
-                                $sendback = add_query_arg('deleted', $deleted, $sendback);
-                                break;
-                        case 'edit':
-                                $done = bulk_edit_posts($_REQUEST);
-
-                                if ( is_array($done) ) {
-                                        $done['updated'] = count( $done['updated'] );
-                                        $done['skipped'] = count( $done['skipped'] );
-                                        $done['locked'] = count( $done['locked'] );
-                                        $sendback = add_query_arg( $done, $sendback );
-                                }
-                                break;
-                        default :
-                                $sendback = apply_filters( "bulk_actions-posts-$doaction", $sendback, $doaction );
-                                break;
-                }
-
-                $sendback = remove_query_arg( array( 'action', 'action2', 'tags_input', 'post_author', 'comment_status', 'ping_status', '_status', 'post', 'bulk_edit', 'post_view' ), $sendback );
-                $sendback = $this->add_query_args( $sendback );
-                wp_redirect( $sendback );
-                exit();
-        }
-
</del><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> ?>
</span></span></pre></div>
<a id="trunkwpadminusersphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/users.php (17276 => 17277)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/users.php        2011-01-13 00:34:18 UTC (rev 17276)
+++ trunk/wp-admin/users.php        2011-01-13 00:50:35 UTC (rev 17277)
</span><span class="lines">@@ -42,16 +42,16 @@
</span><span class="cx">
</span><span class="cx"> $update = '';
</span><span class="cx">
</span><del>-if ( $doaction = $wp_list_table->current_action() ) {
</del><ins>+switch ( $wp_list_table->current_action() ) {
</ins><span class="cx">
</span><del>-switch ( $doaction ) {
-
</del><span class="cx"> /* Bulk Dropdown menu Role changes */
</span><span class="cx"> case 'promote':
</span><span class="cx">         check_admin_referer('bulk-users');
</span><span class="cx">
</span><del>-        if ( empty($_REQUEST['users']) )
-                break;
</del><ins>+        if ( empty($_REQUEST['users']) ) {
+                wp_redirect($redirect);
+                exit();
+        }
</ins><span class="cx">
</span><span class="cx">         $editable_roles = get_editable_roles();
</span><span class="cx">         if ( empty( $editable_roles[$_REQUEST['new_role']] ) )
</span><span class="lines">@@ -65,7 +65,7 @@
</span><span class="cx">                 if ( ! current_user_can('promote_user', $id) )
</span><span class="cx">                         wp_die(__('You can&#8217;t edit that user.'));
</span><span class="cx">                 // The new role of the current user must also have promote_users caps
</span><del>-                if ( $id == $current_user->ID && ! current_user_can('promote_users') ) {
</del><ins>+                if ( $id == $current_user->ID && !$wp_roles->role_objects[$_REQUEST['new_role']]->has_cap('promote_users') ) {
</ins><span class="cx">                         $update = 'err_admin_role';
</span><span class="cx">                         continue;
</span><span class="cx">                 }
</span><span class="lines">@@ -78,7 +78,8 @@
</span><span class="cx">                 $user->set_role($_REQUEST['new_role']);
</span><span class="cx">         }
</span><span class="cx">
</span><del>-        $redirect = add_query_arg( 'update', $update, $redirect );
</del><ins>+        wp_redirect(add_query_arg('update', $update, $redirect));
+        exit();
</ins><span class="cx">
</span><span class="cx"> break;
</span><span class="cx">
</span><span class="lines">@@ -88,8 +89,10 @@
</span><span class="cx">
</span><span class="cx">         check_admin_referer('delete-users');
</span><span class="cx">
</span><del>-        if ( empty($_REQUEST['users']) )
-                break;
</del><ins>+        if ( empty($_REQUEST['users']) ) {
+                wp_redirect($redirect);
+                exit();
+        }
</ins><span class="cx">
</span><span class="cx">         if ( ! current_user_can( 'delete_users' ) )
</span><span class="cx">                 wp_die(__('You can&#8217;t delete users.'));
</span><span class="lines">@@ -122,6 +125,8 @@
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         $redirect = add_query_arg( array('delete_count' => $delete_count, 'update' => $update), $redirect);
</span><ins>+        wp_redirect($redirect);
+        exit();
</ins><span class="cx">
</span><span class="cx"> break;
</span><span class="cx">
</span><span class="lines">@@ -131,8 +136,10 @@
</span><span class="cx">
</span><span class="cx">         check_admin_referer('bulk-users');
</span><span class="cx">
</span><del>-        if ( empty($_REQUEST['users']) && empty($_REQUEST['user']) )
-                break;
</del><ins>+        if ( empty($_REQUEST['users']) && empty($_REQUEST['user']) ) {
+                wp_redirect($redirect);
+                exit();
+        }
</ins><span class="cx">
</span><span class="cx">         if ( ! current_user_can( 'delete_users' ) )
</span><span class="cx">                 $errors = new WP_Error( 'edit_users', __( 'You can&#8217;t delete users.' ) );
</span><span class="lines">@@ -142,8 +149,6 @@
</span><span class="cx">         else
</span><span class="cx">                 $userids = $_REQUEST['users'];
</span><span class="cx">
</span><del>-        $redirect = false;
-
</del><span class="cx">         include ('admin-header.php');
</span><span class="cx"> ?>
</span><span class="cx"> <form action="" method="post" name="updateusers" id="updateusers">
</span><span class="lines">@@ -186,15 +191,16 @@
</span><span class="cx"> </div>
</span><span class="cx"> </form>
</span><span class="cx"> <?php
</span><del>-include('./admin-footer.php');
</del><span class="cx">
</span><span class="cx"> break;
</span><span class="cx">
</span><span class="cx"> case 'doremove':
</span><span class="cx">         check_admin_referer('remove-users');
</span><span class="cx">
</span><del>-        if ( empty($_REQUEST['users']) )
-                break;
</del><ins>+        if ( empty($_REQUEST['users']) ) {
+                wp_redirect($redirect);
+                exit;
+        }
</ins><span class="cx">
</span><span class="cx">         if ( !current_user_can('remove_users') )
</span><span class="cx">                 die(__('You can&#8217;t remove users.'));
</span><span class="lines">@@ -216,6 +222,8 @@
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         $redirect = add_query_arg( array('update' => $update), $redirect);
</span><ins>+        wp_redirect($redirect);
+        exit;
</ins><span class="cx">
</span><span class="cx"> break;
</span><span class="cx">
</span><span class="lines">@@ -223,8 +231,10 @@
</span><span class="cx">
</span><span class="cx">         check_admin_referer('bulk-users');
</span><span class="cx">
</span><del>-        if ( empty($_REQUEST['users']) && empty($_REQUEST['user']) )
-                break;
</del><ins>+        if ( empty($_REQUEST['users']) && empty($_REQUEST['user']) ) {
+                wp_redirect($redirect);
+                exit();
+        }
</ins><span class="cx">
</span><span class="cx">         if ( !current_user_can('remove_users') )
</span><span class="cx">                 $error = new WP_Error('edit_users', __('You can&#8217;t remove users.'));
</span><span class="lines">@@ -234,8 +244,6 @@
</span><span class="cx">         else
</span><span class="cx">                 $userids = $_REQUEST['users'];
</span><span class="cx">
</span><del>-        $redirect = false;
-
</del><span class="cx">         include ('admin-header.php');
</span><span class="cx"> ?>
</span><span class="cx"> <form action="" method="post" name="updateusers" id="updateusers">
</span><span class="lines">@@ -271,23 +279,15 @@
</span><span class="cx"> </div>
</span><span class="cx"> </form>
</span><span class="cx"> <?php
</span><del>-include('./admin-footer.php');
</del><span class="cx">
</span><span class="cx"> break;
</span><span class="cx">
</span><span class="cx"> default:
</span><span class="cx">
</span><del>-} // end of the $doaction switch
-
-        if ( $redirect )
-                wp_redirect( $redirect );
-        exit();
-
-} // end of the $doaction if
-elseif ( !empty($_GET['_wp_http_referer']) ) {
</del><ins>+        if ( !empty($_GET['_wp_http_referer']) ) {
</ins><span class="cx">                 wp_redirect(remove_query_arg(array('_wp_http_referer', '_wpnonce'), stripslashes($_SERVER['REQUEST_URI'])));
</span><span class="cx">                 exit;
</span><del>-}
</del><ins>+        }
</ins><span class="cx">
</span><span class="cx">         $wp_list_table->prepare_items();
</span><span class="cx">
</span><span class="lines">@@ -378,5 +378,8 @@
</span><span class="cx"> <br class="clear" />
</span><span class="cx"> </div>
</span><span class="cx"> <?php
</span><ins>+break;
</ins><span class="cx">
</span><ins>+} // end of the $doaction switch
+
</ins><span class="cx"> include('./admin-footer.php');
</span></span></pre>
</div>
</div>
</body>
</html>