<!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>[15496] trunk: Introduce WP_List_Table::check_permissions()
  and WP_List_Table::prepare_items().</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/15496">15496</a></dd>
<dt>Author</dt> <dd>scribu</dd>
<dt>Date</dt> <dd>2010-08-12 23:21:05 +0000 (Thu, 12 Aug 2010)</dd>
</dl>

<h3>Log Message</h3>
<pre>Introduce WP_List_Table::check_permissions() and WP_List_Table::prepare_items(). Fixes <a href="http://trac.wordpress.org/ticket/14596">#14596</a>; See <a href="http://trac.wordpress.org/ticket/14579">#14579</a></pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadminadminajaxphp">trunk/wp-admin/admin-ajax.php</a></li>
<li><a href="#trunkwpadmineditcommentsphp">trunk/wp-admin/edit-comments.php</a></li>
<li><a href="#trunkwpadminedittagsphp">trunk/wp-admin/edit-tags.php</a></li>
<li><a href="#trunkwpadmineditphp">trunk/wp-admin/edit.php</a></li>
<li><a href="#trunkwpadminincludesdefaultlisttablesphp">trunk/wp-admin/includes/default-list-tables.php</a></li>
<li><a href="#trunkwpadminincludeslisttablephp">trunk/wp-admin/includes/list-table.php</a></li>
<li><a href="#trunkwpadminlinkmanagerphp">trunk/wp-admin/link-manager.php</a></li>
<li><a href="#trunkwpadminnetworksitesphp">trunk/wp-admin/network/sites.php</a></li>
<li><a href="#trunkwpadminnetworkusersphp">trunk/wp-admin/network/users.php</a></li>
<li><a href="#trunkwpadminplugininstallphp">trunk/wp-admin/plugin-install.php</a></li>
<li><a href="#trunkwpadminpluginsphp">trunk/wp-admin/plugins.php</a></li>
<li><a href="#trunkwpadminthemeinstallphp">trunk/wp-admin/theme-install.php</a></li>
<li><a href="#trunkwpadminthemesphp">trunk/wp-admin/themes.php</a></li>
<li><a href="#trunkwpadminuploadphp">trunk/wp-admin/upload.php</a></li>
<li><a href="#trunkwpadminusersphp">trunk/wp-admin/users.php</a></li>
<li><a href="#trunkwpincludesfunctionsphp">trunk/wp-includes/functions.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadminadminajaxphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/admin-ajax.php (15495 => 15496)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/admin-ajax.php        2010-08-12 00:45:40 UTC (rev 15495)
+++ trunk/wp-admin/admin-ajax.php        2010-08-12 23:21:05 UTC (rev 15496)
</span><span class="lines">@@ -558,7 +558,7 @@
</span><span class="cx">                 set_current_screen($_POST['screen']);
</span><span class="cx"> 
</span><span class="cx">         require_once( './includes/default-list-tables.php' );
</span><del>-        $table = new WP_Terms_Table( 'ajax' );
</del><ins>+        $table = new WP_Terms_Table();
</ins><span class="cx"> 
</span><span class="cx">         $level = 0;
</span><span class="cx">         $tag_full_name = false;
</span><span class="lines">@@ -626,7 +626,7 @@
</span><span class="cx">                 die('-1');
</span><span class="cx"> 
</span><span class="cx">         require_once( './includes/default-list-tables.php' );
</span><del>-        $table = new WP_Comments_Table( 'ajax' );
</del><ins>+        $table = new WP_Comments_Table();
</ins><span class="cx"> 
</span><span class="cx">         global $comments;
</span><span class="cx"> 
</span><span class="lines">@@ -659,7 +659,7 @@
</span><span class="cx">                 die('-1');
</span><span class="cx"> 
</span><span class="cx">         require_once( './includes/default-list-tables.php' );
</span><del>-        $table = new WP_Comments_Table( 'ajax' );
</del><ins>+        $table = new WP_Comments_Table();
</ins><span class="cx"> 
</span><span class="cx">         global $comments;
</span><span class="cx"> 
</span><span class="lines">@@ -685,7 +685,7 @@
</span><span class="cx">         check_ajax_referer( $action, '_ajax_nonce-replyto-comment' );
</span><span class="cx"> 
</span><span class="cx">         require_once( './includes/default-list-tables.php' );
</span><del>-        $table = new WP_Comments_Table( 'ajax' );
</del><ins>+        $table = new WP_Comments_Table();
</ins><span class="cx"> 
</span><span class="cx">         $comment_post_ID = (int) $_POST['comment_post_ID'];
</span><span class="cx">         if ( !current_user_can( 'edit_post', $comment_post_ID ) )
</span><span class="lines">@@ -776,7 +776,7 @@
</span><span class="cx">                 add_filter( 'comment_author', 'floated_admin_avatar' );
</span><span class="cx"> 
</span><span class="cx">         require_once( './includes/default-list-tables.php' );
</span><del>-        $table = new WP_Comments_Table( 'ajax' );
</del><ins>+        $table = new WP_Comments_Table();
</ins><span class="cx"> 
</span><span class="cx">         ob_start();
</span><span class="cx">                 $table-&gt;single_row( $comment_id, $mode, $comments_listing, $checkbox );
</span><span class="lines">@@ -925,7 +925,7 @@
</span><span class="cx">         $user_object = new WP_User( $user_id );
</span><span class="cx"> 
</span><span class="cx">         require_once( './includes/default-list-tables.php' );
</span><del>-        $table = new WP_Users_Table( 'ajax' );
</del><ins>+        $table = new WP_Users_Table();
</ins><span class="cx"> 
</span><span class="cx">         $x = new WP_Ajax_Response( array(
</span><span class="cx">                 'what' =&gt; 'user',
</span><span class="lines">@@ -1218,7 +1218,7 @@
</span><span class="cx">         edit_post();
</span><span class="cx"> 
</span><span class="cx">         require_once( './includes/default-list-tables.php' );
</span><del>-        $table = new WP_Posts_Table( 'ajax' );
</del><ins>+        $table = new WP_Posts_Table();
</ins><span class="cx"> 
</span><span class="cx">         $mode = $_POST['post_view'];
</span><span class="cx">         $table-&gt;display_rows( array( get_post( $_POST['post_ID'] ) ) );
</span><span class="lines">@@ -1228,19 +1228,14 @@
</span><span class="cx"> case 'inline-save-tax':
</span><span class="cx">         check_ajax_referer( 'taxinlineeditnonce', '_inline_edit' );
</span><span class="cx"> 
</span><del>-        $taxonomy = !empty($_POST['taxonomy']) ? $_POST['taxonomy'] : false;
-        if ( ! $taxonomy )
-                die( __('Cheatin&amp;#8217; uh?') );
-        $tax = get_taxonomy($taxonomy);
</del><ins>+        require_once( './includes/default-list-tables.php' );
+        $table = new WP_Terms_Table();
</ins><span class="cx"> 
</span><del>-        if ( ! current_user_can( $tax-&gt;cap-&gt;edit_terms ) )
-                die( __('Cheatin&amp;#8217; uh?') );
</del><ins>+        $table-&gt;check_permissions('edit');
</ins><span class="cx"> 
</span><span class="cx">         if ( ! isset($_POST['tax_ID']) || ! ( $id = (int) $_POST['tax_ID'] ) )
</span><span class="cx">                 die(-1);
</span><span class="cx"> 
</span><del>-        $taxonomy = !empty($_POST['taxonomy']) ? $_POST['taxonomy'] : 'post_tag';
-
</del><span class="cx">         $tag = get_term( $id, $taxonomy );
</span><span class="cx">         $_POST['description'] = $tag-&gt;description;
</span><span class="cx"> 
</span><span class="lines">@@ -1253,11 +1248,6 @@
</span><span class="cx">                         die( __('Item not updated.') );
</span><span class="cx">                 }
</span><span class="cx"> 
</span><del>-                set_current_screen( 'edit-' . $taxonomy );
-
-                require_once( './includes/default-list-tables.php' );
-                $table = new WP_Terms_Table( 'ajax' );
-
</del><span class="cx">                 echo $table-&gt;single_row( $tag, 0, $taxonomy );
</span><span class="cx">         } else {
</span><span class="cx">                 if ( is_wp_error($updated) &amp;&amp; $updated-&gt;get_error_message() )
</span></span></pre></div>
<a id="trunkwpadmineditcommentsphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/edit-comments.php (15495 => 15496)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/edit-comments.php        2010-08-12 00:45:40 UTC (rev 15495)
+++ trunk/wp-admin/edit-comments.php        2010-08-12 23:21:05 UTC (rev 15496)
</span><span class="lines">@@ -9,9 +9,11 @@
</span><span class="cx"> /** WordPress Administration Bootstrap */
</span><span class="cx"> require_once('./admin.php');
</span><span class="cx"> 
</span><del>-if ( !current_user_can('edit_posts') )
-        wp_die(__('Cheatin&amp;#8217; uh?'));
</del><ins>+require_once( './includes/default-list-tables.php' );
</ins><span class="cx"> 
</span><ins>+$table = new WP_Comments_Table;
+$table-&gt;check_permissions();
+
</ins><span class="cx"> if ( isset( $_REQUEST['doaction'] ) ||  isset( $_REQUEST['doaction2'] ) || isset( $_REQUEST['delete_all'] ) || isset( $_REQUEST['delete_all2'] ) ) {
</span><span class="cx">         check_admin_referer( 'bulk-comments' );
</span><span class="cx"> 
</span><span class="lines">@@ -95,10 +97,8 @@
</span><span class="cx">          exit;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-require_once( './includes/default-list-tables.php' );
</del><ins>+$table-&gt;prepare_items();
</ins><span class="cx"> 
</span><del>-$table = new WP_Comments_Table;
-
</del><span class="cx"> wp_enqueue_script('admin-comments');
</span><span class="cx"> enqueue_comment_hotkeys_js();
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkwpadminedittagsphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/edit-tags.php (15495 => 15496)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/edit-tags.php        2010-08-12 00:45:40 UTC (rev 15495)
+++ trunk/wp-admin/edit-tags.php        2010-08-12 23:21:05 UTC (rev 15496)
</span><span class="lines">@@ -12,6 +12,7 @@
</span><span class="cx"> require_once( './includes/default-list-tables.php' );
</span><span class="cx"> 
</span><span class="cx"> $table = new WP_Terms_Table;
</span><ins>+$table-&gt;check_permissions();
</ins><span class="cx"> 
</span><span class="cx"> $title = $tax-&gt;labels-&gt;name;
</span><span class="cx"> 
</span><span class="lines">@@ -151,6 +152,8 @@
</span><span class="cx">          exit;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+$table-&gt;prepare_items();
+
</ins><span class="cx"> wp_enqueue_script('admin-tags');
</span><span class="cx"> if ( current_user_can($tax-&gt;cap-&gt;edit_terms) )
</span><span class="cx">         wp_enqueue_script('inline-edit-tax');
</span></span></pre></div>
<a id="trunkwpadmineditphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/edit.php (15495 => 15496)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/edit.php        2010-08-12 00:45:40 UTC (rev 15495)
+++ trunk/wp-admin/edit.php        2010-08-12 23:21:05 UTC (rev 15496)
</span><span class="lines">@@ -12,6 +12,7 @@
</span><span class="cx"> require_once( './includes/default-list-tables.php' );
</span><span class="cx"> 
</span><span class="cx"> $table = new WP_Posts_Table;
</span><ins>+$table-&gt;check_permissions();
</ins><span class="cx"> 
</span><span class="cx"> // Back-compat for viewing comments of an entry
</span><span class="cx"> if ( $_redirect = intval( max( @$_REQUEST['p'], @$_REQUEST['attachment_id'], @$_REQUEST['page_id'] ) ) ) {
</span><span class="lines">@@ -118,6 +119,8 @@
</span><span class="cx">         $post_new_file = 'post-new.php';
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+$table-&gt;prepare_items();
+
</ins><span class="cx"> wp_enqueue_script('inline-edit-post');
</span><span class="cx"> 
</span><span class="cx"> $title = $post_type_object-&gt;labels-&gt;name;
</span></span></pre></div>
<a id="trunkwpadminincludesdefaultlisttablesphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/default-list-tables.php (15495 => 15496)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/default-list-tables.php        2010-08-12 00:45:40 UTC (rev 15495)
+++ trunk/wp-admin/includes/default-list-tables.php        2010-08-12 23:21:05 UTC (rev 15496)
</span><span class="lines">@@ -22,8 +22,8 @@
</span><span class="cx">          */
</span><span class="cx">         var $_hierarchical_display;
</span><span class="cx"> 
</span><del>-        function WP_Posts_Table( $context = 'normal' ) {
-                global $post_type_object, $post_type, $avail_post_stati, $wp_query, $per_page, $mode, $current_screen;
</del><ins>+        function WP_Posts_Table() {
+                global $post_type_object, $post_type, $current_screen;
</ins><span class="cx"> 
</span><span class="cx">                 if ( !isset( $_REQUEST['post_type'] ) )
</span><span class="cx">                         $post_type = 'post';
</span><span class="lines">@@ -35,17 +35,22 @@
</span><span class="cx"> 
</span><span class="cx">                 $post_type_object = get_post_type_object( $post_type );
</span><span class="cx"> 
</span><del>-                if ( !current_user_can( $post_type_object-&gt;cap-&gt;edit_posts ) )
-                        wp_die( __( 'Cheatin&amp;#8217; uh?' ) );
-
</del><span class="cx">                 parent::WP_List_Table( array(
</span><span class="cx">                         'screen' =&gt; $current_screen,
</span><span class="cx">                         'plural' =&gt; 'posts',
</span><span class="cx">                 ) );
</span><ins>+        }
</ins><span class="cx"> 
</span><del>-                if ( 'normal' != $context )
-                        return;
</del><ins>+        function check_permissions() {
+                global $post_type_object;
</ins><span class="cx"> 
</span><ins>+                if ( !current_user_can( $post_type_object-&gt;cap-&gt;edit_posts ) )
+                        wp_die( __( 'Cheatin&amp;#8217; uh?' ) );
+        }
+
+        function prepare_items() {
+                global $post_type_object, $post_type, $avail_post_stati, $wp_query, $per_page, $mode;
+
</ins><span class="cx">                 $avail_post_stati = wp_edit_posts_query();
</span><span class="cx"> 
</span><span class="cx">                 $this-&gt;_hierarchical_display = ( $post_type_object-&gt;hierarchical &amp;&amp; 0 === strpos( get_query_var( 'orderby' ), 'menu_order' ) );
</span><span class="lines">@@ -1072,35 +1077,25 @@
</span><span class="cx"> 
</span><span class="cx"> class WP_Media_Table extends WP_List_Table {
</span><span class="cx"> 
</span><del>-        function WP_Media_Table( $context = 'normal' ) {
-                global $wpdb, $wp_query, $detached, $post_mime_types, $avail_post_mime_types;
</del><ins>+        function WP_Media_Table() {
+                global $detached;
</ins><span class="cx"> 
</span><del>-                if ( isset( $_REQUEST['find_detached'] ) ) {
-                        if ( !current_user_can( 'edit_posts' ) )
-                                wp_die( __( 'You are not allowed to scan for lost attachments.' ) );
</del><ins>+                $detached = isset( $_REQUEST['detached'] ) || isset( $_REQUEST['find_detached'] );
</ins><span class="cx"> 
</span><del>-                        $lost = $wpdb-&gt;get_col( &quot;
-                                SELECT ID FROM $wpdb-&gt;posts
-                                WHERE post_type = 'attachment' AND post_parent &gt; '0'
-                                AND post_parent NOT IN (
-                                        SELECT ID FROM $wpdb-&gt;posts
-                                        WHERE post_type NOT IN ( 'attachment', '&quot; . join( &quot;', '&quot;, get_post_types( array( 'public' =&gt; false ) ) ) . &quot;' )
-                                )
-                        &quot; );
-
-                        $_REQUEST['detached'] = 1;
-                }
-
-                $detached = isset( $_REQUEST['detached'] );
-
</del><span class="cx">                 parent::WP_List_Table( array(
</span><span class="cx">                         'screen' =&gt; $detached ? 'upload-detached' : 'upload',
</span><span class="cx">                         'plural' =&gt; 'media'
</span><span class="cx">                 ) );
</span><ins>+        }
</ins><span class="cx"> 
</span><del>-                if ( 'normal' != $context )
-                        return;
</del><ins>+        function check_permissions() {
+                if ( !current_user_can('upload_files') )
+                        wp_die( __( 'You do not have permission to upload files.' ) );
+        }                
</ins><span class="cx"> 
</span><ins>+        function prepare_items() {
+                global $lost, $wpdb, $wp_query, $post_mime_types, $avail_post_mime_types;
+
</ins><span class="cx">                 $q = $_REQUEST;
</span><span class="cx"> 
</span><span class="cx">                 if ( !empty( $lost ) )
</span><span class="lines">@@ -1357,7 +1352,7 @@
</span><span class="cx"> &lt;?php
</span><span class="cx">                 } else {
</span><span class="cx"> ?&gt;
</span><del>-                        &lt;td &lt;?php echo $attributes ?&gt;&gt;&lt;?php _e( '( Unattached )' ); ?&gt;&lt;br /&gt;
</del><ins>+                        &lt;td &lt;?php echo $attributes ?&gt;&gt;&lt;?php _e( '(Unattached)' ); ?&gt;&lt;br /&gt;
</ins><span class="cx">                         &lt;a class=&quot;hide-if-no-js&quot; onclick=&quot;findPosts.open( 'media[]','&lt;?php echo $post-&gt;ID ?&gt;' );return false;&quot; href=&quot;#the-list&quot;&gt;&lt;?php _e( 'Attach' ); ?&gt;&lt;/a&gt;&lt;/td&gt;
</span><span class="cx"> &lt;?php
</span><span class="cx">                 }
</span><span class="lines">@@ -1502,20 +1497,11 @@
</span><span class="cx"> 
</span><span class="cx">         var $callback_args;
</span><span class="cx"> 
</span><del>-        function WP_Terms_Table( $context = 'normal' ) {
</del><ins>+        function WP_Terms_Table() {
</ins><span class="cx">                 global $post_type, $taxonomy, $tax, $current_screen;
</span><span class="cx"> 
</span><del>-                parent::WP_List_Table( array(
-                        'screen' =&gt; $current_screen,
-                        'plural' =&gt; 'tags',
-                        'singular' =&gt; 'tag',
-                ) );
</del><ins>+                wp_reset_vars( array( 'action', 'taxonomy', 'post_type' ) );
</ins><span class="cx"> 
</span><del>-                if ( 'normal' != $context )
-                        return;
-
-                wp_reset_vars( array( 'action', 'tag', 'taxonomy', 'post_type' ) );
-
</del><span class="cx">                 if ( empty( $taxonomy ) )
</span><span class="cx">                         $taxonomy = 'post_tag';
</span><span class="cx"> 
</span><span class="lines">@@ -1524,12 +1510,31 @@
</span><span class="cx"> 
</span><span class="cx">                 $tax = get_taxonomy( $taxonomy );
</span><span class="cx"> 
</span><del>-                if ( ! current_user_can( $tax-&gt;cap-&gt;manage_terms ) )
-                        wp_die( __( 'Cheatin&amp;#8217; uh?' ) );
-
</del><span class="cx">                 if ( empty( $post_type ) || !in_array( $post_type, get_post_types( array( 'public' =&gt; true ) ) ) )
</span><span class="cx">                         $post_type = 'post';
</span><span class="cx"> 
</span><ins>+                if ( !isset( $current_screen ) )
+                        set_current_screen( 'edit-' . $taxonomy );
+
+                parent::WP_List_Table( array(
+                        'screen' =&gt; $current_screen,
+                        'plural' =&gt; 'tags',
+                        'singular' =&gt; 'tag',
+                ) );
+        }
+
+        function check_permissions( $type = 'manage' ) {
+                global $tax;
+
+                $cap = 'manage' == $type ? $tax-&gt;cap-&gt;manage_terms : $tax-&gt;cap-&gt;edit_terms;
+
+                if ( !current_user_can( $tax-&gt;cap-&gt;manage_terms ) )
+                        wp_die( __( 'Cheatin&amp;#8217; uh?' ) );
+        }
+
+        function prepare_items() {
+                global $taxonomy;
+
</ins><span class="cx">                 $tags_per_page = (int) get_user_option( 'edit_' .  $taxonomy . '_per_page' );
</span><span class="cx"> 
</span><span class="cx">                 if ( empty( $tags_per_page ) || $tags_per_page &lt; 1 )
</span><span class="lines">@@ -1851,17 +1856,21 @@
</span><span class="cx"> 
</span><span class="cx"> class WP_Users_Table extends WP_List_Table {
</span><span class="cx"> 
</span><del>-        function WP_Users_Table( $context = 'normal' ) {
</del><ins>+        function WP_Users_Table() {
</ins><span class="cx">                 global $role, $usersearch;
</span><span class="cx"> 
</span><span class="cx">                 parent::WP_List_Table( array(
</span><span class="cx">                         'screen' =&gt; 'users',
</span><span class="cx">                         'plural' =&gt; 'users'
</span><span class="cx">                 ) );
</span><ins>+        }
</ins><span class="cx"> 
</span><del>-                if ( 'normal' != $context )
-                        return;
</del><ins>+        function check_permissions() {
+                if ( !current_user_can('list_users') )
+                        wp_die(__('Cheatin&amp;#8217; uh?'));
+        }
</ins><span class="cx"> 
</span><ins>+        function prepare_items() {
</ins><span class="cx">                 $usersearch = isset( $_REQUEST['s'] ) ? $_REQUEST['s'] : '';
</span><span class="cx"> 
</span><span class="cx">                 $role = isset( $_REQUEST['role'] ) ? $_REQUEST['role'] : '';
</span><span class="lines">@@ -2089,21 +2098,25 @@
</span><span class="cx"> 
</span><span class="cx"> class WP_Comments_Table extends WP_List_Table {
</span><span class="cx"> 
</span><del>-        function WP_Comments_Table( $context = 'normal' ) {
-                global $comments, $extra_comments, $total_comments, $post_id, $comment_status, $mode;
-
-                $mode = ( empty( $_REQUEST['mode'] ) ) ? 'detail' : $_REQUEST['mode'];
-
</del><ins>+        function WP_Comments_Table() {
</ins><span class="cx">                 parent::WP_List_Table( array(
</span><span class="cx">                         'screen' =&gt; 'edit-comments',
</span><span class="cx">                         'plural' =&gt; 'comments'
</span><span class="cx">                 ) );
</span><ins>+        }
</ins><span class="cx"> 
</span><del>-                if ( 'normal' != $context )
-                        return;
</del><ins>+        function check_permissions() {
+                if ( !current_user_can('edit_posts') )
+                        wp_die(__('Cheatin&amp;#8217; uh?'));
+        }
</ins><span class="cx"> 
</span><ins>+        function prepare_items() {
+                global $comments, $extra_comments, $total_comments, $post_id, $comment_status, $mode;
+
</ins><span class="cx">                 $post_id = isset( $_REQUEST['post_ID'] ) ? absint( $_REQUEST['post_ID'] ) : 0;
</span><span class="cx"> 
</span><ins>+                $mode = ( empty( $_REQUEST['mode'] ) ) ? 'detail' : $_REQUEST['mode'];
+
</ins><span class="cx">                 $comment_status = isset( $_REQUEST['comment_status'] ) ? $_REQUEST['comment_status'] : 'all';
</span><span class="cx">                 if ( !in_array( $comment_status, array( 'all', 'moderated', 'approved', 'spam', 'trash' ) ) )
</span><span class="cx">                         $comment_status = 'all';
</span><span class="lines">@@ -2508,6 +2521,18 @@
</span><span class="cx"> class WP_Links_Table extends WP_List_Table {
</span><span class="cx"> 
</span><span class="cx">         function WP_Links_Table() {
</span><ins>+                parent::WP_List_Table( array(
+                        'screen' =&gt; 'link-manager',
+                        'plural' =&gt; 'bookmarks',
+                ) );
+        }
+
+        function check_permissions() {
+                if ( ! current_user_can( 'manage_links' ) )
+                        wp_die( __( 'You do not have sufficient permissions to edit the links for this site.' ) );
+        }
+
+        function prepare_items() {
</ins><span class="cx">                 global $cat_id, $s, $orderby, $order;
</span><span class="cx"> 
</span><span class="cx">                 wp_reset_vars( array( 'action', 'cat_id', 'linkurl', 'name', 'image', 'description', 'visible', 'target', 'category', 'link_id', 'submit', 'orderby', 'order', 'links_show_cat_id', 'rating', 'rel', 'notes', 'linkcheck[]', 's' ) );
</span><span class="lines">@@ -2524,13 +2549,8 @@
</span><span class="cx">                         $args['order'] = $order;
</span><span class="cx"> 
</span><span class="cx">                 $this-&gt;items = get_bookmarks( $args );
</span><ins>+        }                
</ins><span class="cx"> 
</span><del>-                parent::WP_List_Table( array(
-                        'screen' =&gt; 'link-manager',
-                        'plural' =&gt; 'bookmarks',
-                ) );
-        }
-
</del><span class="cx">         function no_items() {
</span><span class="cx">                 _e( 'No links found.' );
</span><span class="cx">         }
</span><span class="lines">@@ -2690,15 +2710,22 @@
</span><span class="cx"> class WP_Sites_Table extends WP_List_Table {
</span><span class="cx"> 
</span><span class="cx">         function WP_Sites_Table() {
</span><ins>+                parent::WP_List_Table( array(
+                        'screen' =&gt; 'ms-sites',
+                        'plural' =&gt; 'sites',
+                ) );
+        }
+
+        function check_permissions() {                
+                if ( ! current_user_can( 'manage_sites' ) )
+                        wp_die( __( 'You do not have permission to access this page.' ) );
+        }
+
+        function prepare_items() {
</ins><span class="cx">                 global $s, $mode, $wpdb;
</span><span class="cx"> 
</span><span class="cx">                 $mode = ( empty( $_REQUEST['mode'] ) ) ? 'list' : $_REQUEST['mode'];
</span><span class="cx"> 
</span><del>-                parent::WP_List_Table( array(
-                        'callback' =&gt; 'site_rows',
-                        'screen' =&gt; 'ms-sites',
-                ) );
-
</del><span class="cx">                 $pagenum = $this-&gt;get_pagenum();
</span><span class="cx"> 
</span><span class="cx">                 $per_page = (int) get_user_option( 'ms_sites_per_page' );
</span><span class="lines">@@ -2978,14 +3005,24 @@
</span><span class="cx"> class WP_MS_Users_Table extends WP_List_Table {
</span><span class="cx"> 
</span><span class="cx">         function WP_MS_Users_Table() {
</span><ins>+                parent::WP_List_Table( array(
+                        'screen' =&gt; 'ms-users',
+                ) );
+        }
+
+        function check_permissions() {                        
+                if ( !is_multisite() )
+                        wp_die( __( 'Multisite support is not enabled.' ) );
+        
+                if ( ! current_user_can( 'manage_network_users' ) )
+                        wp_die( __( 'You do not have permission to access this page.' ) );
+        }
+
+        function prepare_items() {
</ins><span class="cx">                 global $s, $mode, $wpdb;
</span><span class="cx"> 
</span><span class="cx">                 $mode = ( empty( $_REQUEST['mode'] ) ) ? 'list' : $_REQUEST['mode'];
</span><span class="cx"> 
</span><del>-                parent::WP_List_Table( array(
-                        'screen' =&gt; 'ms-users',
-                ) );
-
</del><span class="cx">                 $pagenum = $this-&gt;get_pagenum();
</span><span class="cx"> 
</span><span class="cx">                 $per_page = (int) get_user_option( 'ms_users_per_page' );
</span><span class="lines">@@ -3201,24 +3238,31 @@
</span><span class="cx"> class WP_Plugins_Table extends WP_List_Table {
</span><span class="cx"> 
</span><span class="cx">         function WP_Plugins_Table() {
</span><del>-                global $status, $plugins, $totals, $page, $orderby, $order, $s;
-
</del><span class="cx">                 parent::WP_List_Table( array(
</span><span class="cx">                         'screen' =&gt; 'plugins',
</span><span class="cx">                         'plural' =&gt; 'plugins',
</span><span class="cx">                 ) );
</span><ins>+        }
</ins><span class="cx"> 
</span><ins>+        function check_permissions() {
+                if ( is_multisite() ) {
+                        $menu_perms = get_site_option( 'menu_items', array() );
+
+                        if ( empty( $menu_perms['plugins'] ) ) {
+                                if ( !is_super_admin() )
+                                        wp_die( __( 'Cheatin&amp;#8217; uh?' ) );
+                        }
+                }
+
+                if ( !current_user_can('activate_plugins') )
+                        wp_die( __( 'You do not have sufficient permissions to manage plugins for this site.' ) );
+        }
+
+        function prepare_items() {
+                global $status, $plugins, $totals, $page, $orderby, $order, $s;
+
</ins><span class="cx">                 wp_reset_vars( array( 'orderby', 'order', 's' ) );
</span><span class="cx"> 
</span><del>-                $default_status = get_user_option( 'plugins_last_view' );
-                if ( empty( $default_status ) )
-                        $default_status = 'all';
-                $status = isset( $_REQUEST['plugin_status'] ) ? $_REQUEST['plugin_status'] : $default_status;
-                if ( !in_array( $status, array( 'all', 'active', 'inactive', 'recently_activated', 'upgrade', 'network', 'mustuse', 'dropins', 'search' ) ) )
-                        $status = 'all';
-                if ( $status != $default_status &amp;&amp; 'search' != $status )
-                        update_user_meta( get_current_user_id(), 'plugins_last_view', $status );
-
</del><span class="cx">                 $page = $this-&gt;get_pagenum();
</span><span class="cx"> 
</span><span class="cx">                 $plugins = array(
</span><span class="lines">@@ -3538,14 +3582,21 @@
</span><span class="cx"> class WP_Plugin_Install_Table extends WP_List_Table {
</span><span class="cx"> 
</span><span class="cx">         function WP_Plugin_Install_Table() {
</span><ins>+                parent::WP_List_Table( array(
+                        'screen' =&gt; 'plugin-install',
+                ) );
+        }
+
+        function check_permissions() {
+                if ( ! current_user_can('install_plugins') )
+                        wp_die(__('You do not have sufficient permissions to install plugins on this site.'));                
+        }
+
+        function prepare_items() {
</ins><span class="cx">                 include( ABSPATH . 'wp-admin/includes/plugin-install.php' );
</span><span class="cx"> 
</span><span class="cx">                 global $tabs, $tab, $paged, $type, $term;
</span><span class="cx"> 
</span><del>-                parent::WP_List_Table( array(
-                        'screen' =&gt; 'plugin-install',
-                ) );
-
</del><span class="cx">                 wp_reset_vars( array( 'tab' ) );
</span><span class="cx"> 
</span><span class="cx">                 $paged = $this-&gt;get_pagenum();
</span><span class="lines">@@ -3743,6 +3794,17 @@
</span><span class="cx"> class WP_Themes_Table extends WP_List_Table {
</span><span class="cx"> 
</span><span class="cx">         function WP_Themes_Table() {
</span><ins>+                parent::__construct( array(
+                        'screen' =&gt; 'themes',
+                ) );
+        }
+
+        function check_permissions() {
+                if ( !current_user_can('switch_themes') &amp;&amp; !current_user_can('edit_theme_options') )
+                        wp_die( __( 'Cheatin&amp;#8217; uh?' ) );
+        }
+        
+        function prepare_items() {
</ins><span class="cx">                 global $ct;
</span><span class="cx"> 
</span><span class="cx">                 $ct = current_theme_info();
</span><span class="lines">@@ -3758,10 +3820,6 @@
</span><span class="cx"> 
</span><span class="cx">                 $this-&gt;items = array_slice( $themes, $start, $per_page );
</span><span class="cx"> 
</span><del>-                parent::__construct( array(
-                        'screen' =&gt; 'themes',
-                ) );
-
</del><span class="cx">                 $this-&gt;set_pagination_args( array(
</span><span class="cx">                         'query_var' =&gt; 'pagenum',
</span><span class="cx">                         'total_items' =&gt; count( $themes ),
</span><span class="lines">@@ -3885,14 +3943,21 @@
</span><span class="cx"> class WP_Theme_Install_Table extends WP_List_Table {
</span><span class="cx"> 
</span><span class="cx">         function WP_Theme_Install_Table() {
</span><del>-                include( ABSPATH . 'wp-admin/includes/theme-install.php' );
-
-                global $tabs, $tab, $paged, $type, $term, $theme_field_defaults;
-
</del><span class="cx">                 parent::WP_List_Table( array(
</span><span class="cx">                         'screen' =&gt; 'theme-install',
</span><span class="cx">                 ) );
</span><ins>+        }
</ins><span class="cx"> 
</span><ins>+        function check_permissions() {
+                if ( ! current_user_can('install_themes') )
+                        wp_die( __( 'You do not have sufficient permissions to install themes on this site.' ) );
+        }
+
+        function prepare_items() {
+                include( ABSPATH . 'wp-admin/includes/theme-install.php' );
+
+                global $tabs, $tab, $paged, $type, $term, $theme_field_defaults;                
+                
</ins><span class="cx">                 wp_reset_vars( array( 'tab' ) );
</span><span class="cx"> 
</span><span class="cx">                 $paged = $this-&gt;get_pagenum();
</span></span></pre></div>
<a id="trunkwpadminincludeslisttablephp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/list-table.php (15495 => 15496)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/list-table.php        2010-08-12 00:45:40 UTC (rev 15495)
+++ trunk/wp-admin/includes/list-table.php        2010-08-12 23:21:05 UTC (rev 15496)
</span><span class="lines">@@ -94,6 +94,28 @@
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         /**
</span><ins>+         * Checks the current user's permissions
+         * @uses wp_die()
+         *
+         * @since 3.1.0
+         * @access public
+         */
+        function check_permissions() {
+                die( 'function WP_List_Table::check_permissions() must be over-ridden in a sub-class.' );
+        }
+
+        /**
+         * Prepares the list of items for displaying.
+         * @uses WP_List_Table::set_pagination_args()
+         *
+         * @since 3.1.0
+         * @access public
+         */
+        function prepare_items() {
+                die( 'function WP_List_Table::prepare_items() must be over-ridden in a sub-class.' );
+        }
+
+        /**
</ins><span class="cx">          * An internal method that sets all the necessary pagination arguments
</span><span class="cx">          *
</span><span class="cx">          * @param array $args An associative array with information about the pagination
</span><span class="lines">@@ -568,6 +590,9 @@
</span><span class="cx">          * @access public
</span><span class="cx">          */
</span><span class="cx">         function ajax_response() {
</span><ins>+                $this-&gt;check_permissions();
+                $this-&gt;prepare_items();
+
</ins><span class="cx">                 extract( $this-&gt;_args );
</span><span class="cx">                 extract( $this-&gt;_pagination_args );
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkwpadminlinkmanagerphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/link-manager.php (15495 => 15496)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/link-manager.php        2010-08-12 00:45:40 UTC (rev 15495)
+++ trunk/wp-admin/link-manager.php        2010-08-12 23:21:05 UTC (rev 15496)
</span><span class="lines">@@ -9,15 +9,17 @@
</span><span class="cx"> /** Load WordPress Administration Bootstrap */
</span><span class="cx"> require_once ('admin.php');
</span><span class="cx"> 
</span><ins>+require_once( './includes/default-list-tables.php' );
+
+$table = new WP_Links_Table;
+$table-&gt;check_permissions();
+
</ins><span class="cx"> // Handle bulk deletes
</span><span class="cx"> if ( isset( $_REQUEST['action'] ) &amp;&amp; isset( $_REQUEST['linkcheck'] ) ) {
</span><span class="cx">         check_admin_referer( 'bulk-bookmarks' );
</span><span class="cx"> 
</span><span class="cx">         $doaction = $_REQUEST['action'] ? $_REQUEST['action'] : $_REQUEST['action2'];
</span><span class="cx"> 
</span><del>-        if ( ! current_user_can( 'manage_links' ) )
-                wp_die( __( 'You do not have sufficient permissions to edit the links for this site.' ) );
-
</del><span class="cx">         if ( 'delete' == $doaction ) {
</span><span class="cx">                 $bulklinks = (array) $_REQUEST['linkcheck'];
</span><span class="cx">                 foreach ( $bulklinks as $link_id ) {
</span><span class="lines">@@ -33,10 +35,8 @@
</span><span class="cx">          exit;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-require_once( './includes/default-list-tables.php' );
</del><ins>+$table-&gt;prepare_items();
</ins><span class="cx"> 
</span><del>-$table = new WP_Links_Table;
-
</del><span class="cx"> $title = __('Links');
</span><span class="cx"> $this_file = $parent_file = 'link-manager.php';
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkwpadminnetworksitesphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/network/sites.php (15495 => 15496)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/network/sites.php        2010-08-12 00:45:40 UTC (rev 15495)
+++ trunk/wp-admin/network/sites.php        2010-08-12 23:21:05 UTC (rev 15496)
</span><span class="lines">@@ -12,9 +12,11 @@
</span><span class="cx"> if ( ! is_multisite() )
</span><span class="cx">         wp_die( __( 'Multisite support is not enabled.' ) );
</span><span class="cx"> 
</span><del>-if ( ! current_user_can( 'manage_sites' ) )
-        wp_die( __( 'You do not have permission to access this page.' ) );
</del><ins>+require_once( '../includes/default-list-tables.php' );
</ins><span class="cx"> 
</span><ins>+$table = new WP_Sites_Table;
+$table-&gt;check_permissions();
+
</ins><span class="cx"> $title = __( 'Sites' );
</span><span class="cx"> $parent_file = 'sites.php';
</span><span class="cx"> 
</span><span class="lines">@@ -348,10 +350,8 @@
</span><span class="cx">         // List sites
</span><span class="cx">         case 'list':
</span><span class="cx">         default:
</span><del>-                require_once( '../includes/default-list-tables.php' );
</del><ins>+                $table-&gt;prepare_items();
</ins><span class="cx"> 
</span><del>-                $table = new WP_Sites_Table;
-
</del><span class="cx">                 require_once( '../admin-header.php' );
</span><span class="cx">                 ?&gt;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkwpadminnetworkusersphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/network/users.php (15495 => 15496)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/network/users.php        2010-08-12 00:45:40 UTC (rev 15495)
+++ trunk/wp-admin/network/users.php        2010-08-12 23:21:05 UTC (rev 15496)
</span><span class="lines">@@ -9,11 +9,11 @@
</span><span class="cx"> 
</span><span class="cx"> require_once( './admin.php' );
</span><span class="cx"> 
</span><del>-if ( !is_multisite() )
-        wp_die( __( 'Multisite support is not enabled.' ) );
</del><ins>+require_once( '../includes/default-list-tables.php' );
</ins><span class="cx"> 
</span><del>-if ( ! current_user_can( 'manage_network_users' ) )
-        wp_die( __( 'You do not have permission to access this page.' ) );
</del><ins>+$table = new WP_MS_Users_Table;
+$table-&gt;check_permissions();
+$table-&gt;prepare_items();
</ins><span class="cx"> 
</span><span class="cx"> $title = __( 'Users' );
</span><span class="cx"> $parent_file = 'users.php';
</span><span class="lines">@@ -32,10 +32,6 @@
</span><span class="cx">         '&lt;p&gt;' . __('&lt;a href=&quot;http://wordpress.org/support/&quot; target=&quot;_blank&quot;&gt;Support Forums&lt;/a&gt;') . '&lt;/p&gt;'
</span><span class="cx"> );
</span><span class="cx"> 
</span><del>-require_once( '../includes/default-list-tables.php' );
-
-$table = new WP_MS_Users_Table;
-
</del><span class="cx"> require_once( '../admin-header.php' );
</span><span class="cx"> 
</span><span class="cx"> if ( isset( $_REQUEST['updated'] ) &amp;&amp; $_REQUEST['updated'] == 'true' &amp;&amp; ! empty( $_REQUEST['action'] ) ) {
</span></span></pre></div>
<a id="trunkwpadminplugininstallphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/plugin-install.php (15495 => 15496)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/plugin-install.php        2010-08-12 00:45:40 UTC (rev 15495)
+++ trunk/wp-admin/plugin-install.php        2010-08-12 23:21:05 UTC (rev 15496)
</span><span class="lines">@@ -9,12 +9,11 @@
</span><span class="cx"> /** WordPress Administration Bootstrap */
</span><span class="cx"> require_once('./admin.php');
</span><span class="cx"> 
</span><del>-if ( ! current_user_can('install_plugins') )
-        wp_die(__('You do not have sufficient permissions to install plugins on this site.'));
-
</del><span class="cx"> require_once( './includes/default-list-tables.php' );
</span><span class="cx"> 
</span><span class="cx"> $table = new WP_Plugin_Install_Table;
</span><ins>+$table-&gt;check_permissions();
+$table-&gt;prepare_items();
</ins><span class="cx"> 
</span><span class="cx"> $title = __('Install Plugins');
</span><span class="cx"> $parent_file = 'plugins.php';
</span></span></pre></div>
<a id="trunkwpadminpluginsphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/plugins.php (15495 => 15496)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/plugins.php        2010-08-12 00:45:40 UTC (rev 15495)
+++ trunk/wp-admin/plugins.php        2010-08-12 23:21:05 UTC (rev 15496)
</span><span class="lines">@@ -8,18 +8,12 @@
</span><span class="cx"> 
</span><span class="cx"> /** WordPress Administration Bootstrap */
</span><span class="cx"> require_once('./admin.php');
</span><del>-if ( is_multisite() ) {
-        $menu_perms = get_site_option( 'menu_items', array() );
-                
-        if ( empty( $menu_perms['plugins'] ) ) { 
-                if ( ! is_super_admin() )
-                        wp_die( __( 'Cheatin&amp;#8217; uh?' ) );
-        }
-}
</del><span class="cx"> 
</span><del>-if ( ! current_user_can( 'activate_plugins' ) )
-        wp_die( __( 'You do not have sufficient permissions to manage plugins for this site.' ) );
</del><ins>+require_once( ABSPATH . 'wp-admin/includes/default-list-tables.php' );
</ins><span class="cx"> 
</span><ins>+$table = new WP_Plugins_Table;
+$table-&gt;check_permissions();
+
</ins><span class="cx"> if ( isset($_POST['clear-recent-list']) )
</span><span class="cx">         $action = 'clear-recent-list';
</span><span class="cx"> elseif ( !empty($_REQUEST['action']) )
</span><span class="lines">@@ -299,9 +293,16 @@
</span><span class="cx">         }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-require_once( ABSPATH . 'wp-admin/includes/default-list-tables.php' );
</del><ins>+$default_status = get_user_option( 'plugins_last_view' );
+if ( empty( $default_status ) )
+        $default_status = 'all';
+$status = isset( $_REQUEST['plugin_status'] ) ? $_REQUEST['plugin_status'] : $default_status;
+if ( !in_array( $status, array( 'all', 'active', 'inactive', 'recently_activated', 'upgrade', 'network', 'mustuse', 'dropins', 'search' ) ) )
+        $status = 'all';
+if ( $status != $default_status &amp;&amp; 'search' != $status )
+        update_user_meta( get_current_user_id(), 'plugins_last_view', $status );
</ins><span class="cx"> 
</span><del>-$table = new WP_Plugins_Table;
</del><ins>+$table-&gt;prepare_items();
</ins><span class="cx"> 
</span><span class="cx"> wp_enqueue_script('plugin-install');
</span><span class="cx"> add_thickbox();
</span></span></pre></div>
<a id="trunkwpadminthemeinstallphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/theme-install.php (15495 => 15496)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/theme-install.php        2010-08-12 00:45:40 UTC (rev 15495)
+++ trunk/wp-admin/theme-install.php        2010-08-12 23:21:05 UTC (rev 15496)
</span><span class="lines">@@ -9,12 +9,11 @@
</span><span class="cx"> /** WordPress Administration Bootstrap */
</span><span class="cx"> require_once('./admin.php');
</span><span class="cx"> 
</span><del>-if ( ! current_user_can('install_themes') )
-        wp_die(__('You do not have sufficient permissions to install themes on this site.'));
-
</del><span class="cx"> require_once( './includes/default-list-tables.php' );
</span><span class="cx"> 
</span><span class="cx"> $table = new WP_Theme_Install_Table;
</span><ins>+$table-&gt;check_permissions();
+$table-&gt;prepare_items();
</ins><span class="cx"> 
</span><span class="cx"> $title = __('Install Themes');
</span><span class="cx"> $parent_file = 'themes.php';
</span></span></pre></div>
<a id="trunkwpadminthemesphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/themes.php (15495 => 15496)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/themes.php        2010-08-12 00:45:40 UTC (rev 15495)
+++ trunk/wp-admin/themes.php        2010-08-12 23:21:05 UTC (rev 15496)
</span><span class="lines">@@ -9,9 +9,11 @@
</span><span class="cx"> /** WordPress Administration Bootstrap */
</span><span class="cx"> require_once('./admin.php');
</span><span class="cx"> 
</span><del>-if ( !current_user_can('switch_themes') &amp;&amp; !current_user_can('edit_theme_options') )
-        wp_die( __( 'Cheatin&amp;#8217; uh?' ) );
</del><ins>+require_once( './includes/default-list-tables.php' );
</ins><span class="cx"> 
</span><ins>+$table = new WP_Themes_Table;
+$table-&gt;check_permissions();
+
</ins><span class="cx"> if ( current_user_can('switch_themes') &amp;&amp; isset($_GET['action']) ) {
</span><span class="cx">         if ( 'activate' == $_GET['action'] ) {
</span><span class="cx">                 check_admin_referer('switch-theme_' . $_GET['template']);
</span><span class="lines">@@ -28,10 +30,8 @@
</span><span class="cx">         }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-require_once( './includes/default-list-tables.php' );
</del><ins>+$table-&gt;prepare_items();
</ins><span class="cx"> 
</span><del>-$table = new WP_Themes_Table;
-
</del><span class="cx"> $title = __('Manage Themes');
</span><span class="cx"> $parent_file = 'themes.php';
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkwpadminuploadphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/upload.php (15495 => 15496)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/upload.php        2010-08-12 00:45:40 UTC (rev 15495)
+++ trunk/wp-admin/upload.php        2010-08-12 23:21:05 UTC (rev 15496)
</span><span class="lines">@@ -9,11 +9,30 @@
</span><span class="cx"> /** WordPress Administration Bootstrap */
</span><span class="cx"> require_once( './admin.php' );
</span><span class="cx"> 
</span><del>-if ( !current_user_can('upload_files') )
-        wp_die(__('You do not have permission to upload files.'));
</del><ins>+require_once( './includes/default-list-tables.php' );
</ins><span class="cx"> 
</span><ins>+$table = new WP_Media_Table;
+$table-&gt;check_permissions();
+
</ins><span class="cx"> // Handle bulk actions
</span><del>-if ( isset( $_REQUEST['found_post_id'] ) &amp;&amp; isset( $_REQUEST['media'] ) ) {
</del><ins>+if ( isset($_REQUEST['find_detached']) ) {
+        check_admin_referer('bulk-media');
+
+        if ( !current_user_can('edit_posts') )
+                wp_die( __('You are not allowed to scan for lost attachments.') );
+
+        $lost = $wpdb-&gt;get_col( &quot;
+                SELECT ID FROM $wpdb-&gt;posts
+                WHERE post_type = 'attachment' AND post_parent &gt; '0'
+                AND post_parent NOT IN (
+                        SELECT ID FROM $wpdb-&gt;posts
+                        WHERE post_type NOT IN ( 'attachment', '&quot; . join( &quot;', '&quot;, get_post_types( array( 'public' =&gt; false ) ) ) . &quot;' )
+                )
+        &quot; );
+
+        $_REQUEST['detached'] = 1;
+
+} elseif ( isset( $_REQUEST['found_post_id'] ) &amp;&amp; isset( $_REQUEST['media'] ) ) {
</ins><span class="cx">         check_admin_referer( 'bulk-media' );
</span><span class="cx"> 
</span><span class="cx">         $parent_id = (int) $_REQUEST['found_post_id'];
</span><span class="lines">@@ -111,10 +130,8 @@
</span><span class="cx">          exit;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-require_once( './includes/default-list-tables.php' );
</del><ins>+$table-&gt;prepare_items();
</ins><span class="cx"> 
</span><del>-$table = new WP_Media_Table;
-
</del><span class="cx"> $title = __('Media Library');
</span><span class="cx"> $parent_file = 'upload.php';
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkwpadminusersphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/users.php (15495 => 15496)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/users.php        2010-08-12 00:45:40 UTC (rev 15495)
+++ trunk/wp-admin/users.php        2010-08-12 23:21:05 UTC (rev 15496)
</span><span class="lines">@@ -12,9 +12,11 @@
</span><span class="cx"> /** WordPress Registration API */
</span><span class="cx"> require_once( ABSPATH . WPINC . '/registration.php');
</span><span class="cx"> 
</span><del>-if ( !current_user_can('list_users') )
-        wp_die(__('Cheatin&amp;#8217; uh?'));
</del><ins>+require_once( './includes/default-list-tables.php' );
</ins><span class="cx"> 
</span><ins>+$table = new WP_Users_Table;
+$table-&gt;check_permissions();
+
</ins><span class="cx"> $title = __('Users');
</span><span class="cx"> $parent_file = 'users.php';
</span><span class="cx"> 
</span><span class="lines">@@ -306,10 +308,8 @@
</span><span class="cx">                 exit;
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        require_once( './includes/default-list-tables.php' );
</del><ins>+        $table-&gt;prepare_items();
</ins><span class="cx"> 
</span><del>-        $table = new WP_Users_Table;
-
</del><span class="cx">         include('./admin-header.php');
</span><span class="cx"> 
</span><span class="cx">         $messages = array();
</span></span></pre></div>
<a id="trunkwpincludesfunctionsphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/functions.php (15495 => 15496)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/functions.php        2010-08-12 00:45:40 UTC (rev 15495)
+++ trunk/wp-includes/functions.php        2010-08-12 23:21:05 UTC (rev 15496)
</span><span class="lines">@@ -2656,9 +2656,12 @@
</span><span class="cx">  * @param string|array $args Optional arguements to control behaviour.
</span><span class="cx">  */
</span><span class="cx"> function wp_die( $message, $title = '', $args = array() ) {
</span><ins>+        if ( defined( 'DOING_AJAX' ) &amp;&amp; DOING_AJAX )
+                die('-1');
+
</ins><span class="cx">         if ( function_exists( 'apply_filters' ) ) {
</span><span class="cx">                 $function = apply_filters( 'wp_die_handler', '_default_wp_die_handler');
</span><del>-        }else {
</del><ins>+        } else {
</ins><span class="cx">                 $function = '_default_wp_die_handler';
</span><span class="cx">         }
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>