<!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>[13609] trunk/wp-admin: Update ms-sites UI.</title>
</head>
<body>
<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/13609">13609</a></dd>
<dt>Author</dt> <dd>ryan</dd>
<dt>Date</dt> <dd>2010-03-06 18:31:10 +0000 (Sat, 06 Mar 2010)</dd>
</dl>
<h3>Log Message</h3>
<pre>Update ms-sites UI. Props ocean90. see <a href="http://trac.wordpress.org/ticket/12460">#12460</a></pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadminincludesmiscphp">trunk/wp-admin/includes/misc.php</a></li>
<li><a href="#trunkwpadminincludestemplatephp">trunk/wp-admin/includes/template.php</a></li>
<li><a href="#trunkwpadminmseditphp">trunk/wp-admin/ms-edit.php</a></li>
<li><a href="#trunkwpadminmssitesphp">trunk/wp-admin/ms-sites.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadminincludesmiscphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/misc.php (13608 => 13609)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/misc.php        2010-03-06 18:20:11 UTC (rev 13608)
+++ trunk/wp-admin/includes/misc.php        2010-03-06 18:31:10 UTC (rev 13609)
</span><span class="lines">@@ -410,6 +410,8 @@
</span><span class="cx">
</span><span class="cx">                 switch ( $map_option ) {
</span><span class="cx">                         case 'edit_per_page':
</span><ins>+                        case 'ms_sites_per_page':
+                        case 'ms_users_per_page':
</ins><span class="cx">                         case 'edit_comments_per_page':
</span><span class="cx">                         case 'upload_per_page':
</span><span class="cx">                         case 'categories_per_page':
</span></span></pre></div>
<a id="trunkwpadminincludestemplatephp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/template.php (13608 => 13609)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/template.php        2010-03-06 18:20:11 UTC (rev 13608)
+++ trunk/wp-admin/includes/template.php        2010-03-06 18:31:10 UTC (rev 13609)
</span><span class="lines">@@ -3767,6 +3767,12 @@
</span><span class="cx">                 case 'edit-pages':
</span><span class="cx">                         $per_page_label = __('Pages per page:');
</span><span class="cx">                         break;
</span><ins>+                case 'ms-sites':
+                        $per_page_label = __('Sites per page:');
+                        break;
+                case 'ms-users':
+                        $per_page_label = __('Users per page:');
+                        break;
</ins><span class="cx">                 case 'edit-comments':
</span><span class="cx">                         $per_page_label = __('Comments per page:');
</span><span class="cx">                         break;
</span></span></pre></div>
<a id="trunkwpadminmseditphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/ms-edit.php (13608 => 13609)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/ms-edit.php        2010-03-06 18:20:11 UTC (rev 13608)
+++ trunk/wp-admin/ms-edit.php        2010-03-06 18:31:10 UTC (rev 13609)
</span><span class="lines">@@ -221,6 +221,9 @@
</span><span class="cx">                 // rewrite rules can't be flushed during switch to blog
</span><span class="cx">                 delete_option( 'rewrite_rules' );
</span><span class="cx">
</span><ins>+                // update blogs count
+                delete_site_transient( "blog_count" );
+
</ins><span class="cx">                 // update blogs table
</span><span class="cx">                 $blog_data = stripslashes_deep($_POST[ 'blog' ]);
</span><span class="cx">                 update_blog_details($id, $blog_data);
</span><span class="lines">@@ -292,35 +295,52 @@
</span><span class="cx">
</span><span class="cx">                 if ( $id != '0' && $id != $current_site->blog_id )
</span><span class="cx">                         wpmu_delete_blog( $id, true );
</span><del>-
</del><ins>+        
</ins><span class="cx">                 wp_redirect( add_query_arg( array('updated' => 'true', 'action' => 'delete'), $_POST[ 'ref' ] ) );
</span><span class="cx">                 exit();
</span><span class="cx">         break;
</span><span class="cx">
</span><span class="cx">         case "allblogs":
</span><del>-                check_admin_referer('allblogs');
</del><ins>+                if ( isset($_POST['doaction']) || isset($_POST['doaction2']) ) {
+                        check_admin_referer('bulk-sites');
+
</ins><span class="cx">                 if ( ! current_user_can( 'manage_sites' ) )
</span><span class="cx">                         wp_die( __('You do not have permission to access this page.') );
</span><span class="cx">
</span><ins>+                if ( $_GET['action'] != -1 || $_POST['action2'] != -1 )
+                        $doaction = $doaction = ($_POST['action'] != -1) ? $_POST['action'] : $_POST['action2'];
+
+
</ins><span class="cx">                 foreach ( (array) $_POST[ 'allblogs' ] as $key => $val ) {
</span><span class="cx">                         if ( $val != '0' && $val != $current_site->blog_id ) {
</span><del>-                                if ( isset($_POST['allblog_delete']) ) {
-                                        $blogfunction = 'all_delete';
-                                        wpmu_delete_blog( $val, true );
-                                } elseif ( isset($_POST['allblog_spam']) ) {
-                                        $blogfunction = 'all_spam';
-                                        update_blog_status( $val, "spam", '1', 0 );
-                                        set_time_limit(60);
-                                } elseif ( isset($_POST['allblog_notspam']) ) {
-                                        $blogfunction = 'all_notspam';
-                                        update_blog_status( $val, "spam", '0', 0 );
-                                        set_time_limit(60);
</del><ins>+                                switch ( $doaction ) {
+                                        case 'delete':
+                                                $blogfunction = 'all_delete';
+                                                wpmu_delete_blog( $val, true );
+                                                break;
+                                        case 'spam':
+                                                $blogfunction = 'all_spam';
+                                                update_blog_status( $val, "spam", '1', 0 );
+                                                set_time_limit(60);
+                                                break;
+                                        case 'notspam':
+                                                $blogfunction = 'all_notspam';
+                                                update_blog_status( $val, "spam", '0', 0 );
+                                                set_time_limit(60);
+                                                break;
</ins><span class="cx">                                 }
</span><del>-                        }
-                }
</del><ins>+                        } else {
+                                wp_die( __('You are not allowed to change one of this sites.') );
+                                exit();
+                        };
+                };
</ins><span class="cx">
</span><span class="cx">                 wp_redirect( add_query_arg( array('updated' => 'true', 'action' => $blogfunction), $_SERVER['HTTP_REFERER'] ) );
</span><span class="cx">                 exit();
</span><ins>+
+                } else {
+                        wp_redirect( admin_url("ms-sites.php") );
+                }
</ins><span class="cx">         break;
</span><span class="cx">
</span><span class="cx">         case "archiveblog":
</span><span class="lines">@@ -397,7 +417,6 @@
</span><span class="cx">         case "unmature":
</span><span class="cx">                 update_blog_status( $id, 'mature', '0' );
</span><span class="cx">                 do_action( 'unmature_blog', $id );
</span><del>-
</del><span class="cx">                 wp_redirect( add_query_arg( array('updated' => 'true', 'action' => 'umature'), $_POST['ref'] ) );
</span><span class="cx">                 exit();
</span><span class="cx">         break;
</span></span></pre></div>
<a id="trunkwpadminmssitesphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/ms-sites.php (13608 => 13609)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/ms-sites.php        2010-03-06 18:20:11 UTC (rev 13608)
+++ trunk/wp-admin/ms-sites.php        2010-03-06 18:31:10 UTC (rev 13609)
</span><span class="lines">@@ -156,7 +156,7 @@
</span><span class="cx">                                                 <p class="submit" style="margin:-15px 0 -5px 230px;"><input type="submit" name="Submit" value="<?php esc_attr_e('Update Options') ?>" /></p>
</span><span class="cx">                         </div></div>
</span><span class="cx">
</span><del>-                        <div id="blogedit_blogoptions" class="postbox " >
</del><ins>+                        <div id="blogedit_blogoptions" class="postbox" >
</ins><span class="cx">                         <h3 class='hndle'><span><?php printf( __('Site options (%soptions)'), $blog_prefix ); ?></span></h3>
</span><span class="cx">                         <div class="inside">
</span><span class="cx">                                 <table class="form-table">
</span><span class="lines">@@ -178,7 +178,7 @@
</span><span class="cx">                                                                 ?>
</span><span class="cx">                                                                         <tr class="form-field">
</span><span class="cx">                                                                                 <th scope="row"><?php echo ucwords( str_replace( "_", " ", $option->option_name ) ) ?></th>
</span><del>-                                                                                <td><textarea rows="5" cols="40" name="option[<?php echo esc_attr($option->option_name) ?>]" type="text" id="<?php echo esc_attr($option->option_name) ?>"<?php echo $disabled ?>><?php echo esc_html( $option->option_value ) ?></textarea></td>
</del><ins>+                                                                                <td><textarea rows="5" cols="40" name="option[<?php echo esc_attr($option->option_name) ?>]" id="<?php echo esc_attr($option->option_name) ?>"<?php echo $disabled ?>><?php echo esc_html( $option->option_value ) ?></textarea></td>
</ins><span class="cx">                                                                         </tr>
</span><span class="cx">                                                                 <?php
</span><span class="cx">                                                                 } else {
</span><span class="lines">@@ -311,7 +311,7 @@
</span><span class="cx">                         <div class="inside">
</span><span class="cx">                                 <table class="form-table">
</span><span class="cx">                                                 <?php do_action( 'wpmueditblogaction', $id ); ?>
</span><del>-                                        </table>
</del><ins>+                                </table>
</ins><span class="cx">                                 <p class="submit" style="margin:-15px 0 -5px 230px;"><input type="submit" name="Submit" value="<?php esc_attr_e('Update Options') ?>" /></p>
</span><span class="cx">                         </div></div>
</span><span class="cx">
</span><span class="lines">@@ -326,27 +326,46 @@
</span><span class="cx">         // List blogs
</span><span class="cx">         case 'list':
</span><span class="cx">         default:
</span><del>-                $apage = ( isset($_GET['apage'] ) && intval( $_GET['apage'] ) ) ? absint( $_GET['apage'] ) : 1;
-                $num = ( isset($_GET['num'] ) && intval( $_GET['num'] ) ) ? absint( $_GET['num'] ) : 15;
-                $s = isset($_GET['s']) ? esc_attr( trim( $_GET[ 's' ] ) ) : '';
-                $like_s = like_escape($s);
</del><ins>+                $pagenum = isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 0;
+                if ( empty($pagenum) )
+                        $pagenum = 1;
</ins><span class="cx">
</span><ins>+                $per_page = (int) get_user_option( 'ms_sites_per_page' );
+                if ( empty( $per_page ) || $per_page < 1 )
+                        $per_page = 15;
+
+                $per_page = apply_filters( 'ms_sites_per_page', $per_page );
+
+                $s = isset($_GET['s']) ? stripslashes( trim( $_GET[ 's' ] ) ) : '';
+                $like_s = esc_sql( like_escape( $s ) );
+
</ins><span class="cx">                 $query = "SELECT * FROM {$wpdb->blogs} WHERE site_id = '{$wpdb->siteid}' ";
</span><span class="cx">
</span><del>-                if ( isset($_GET['blog_name']) ) {
-                        $query .= " AND ( {$wpdb->blogs}.domain LIKE '%{$like_s}%' OR {$wpdb->blogs}.path LIKE '%{$like_s}%' ) ";
-                } elseif ( isset($_GET['blog_id']) ) {
-                        $query .= " AND blog_id = '". absint( $_GET['blog_id'] )."' ";
-                } elseif ( isset($_GET['blog_ip']) ) {
-                        $query = "SELECT *
-                                FROM {$wpdb->blogs}, {$wpdb->registration_log}
-                                WHERE site_id = '{$wpdb->siteid}'
-                                AND {$wpdb->blogs}.blog_id = {$wpdb->registration_log}.blog_id
-                                AND {$wpdb->registration_log}.IP LIKE ('%{$like_s}%')";
</del><ins>+                if ( isset( $_GET['blogstatus'] ) ) {
+                        if ( 'deleted' == $_GET['blogstatus'] ) {
+                                $query .= " AND {$wpdb->blogs}.deleted = '1' ";
+                        } elseif ( 'archived' == $_GET['blogstatus'] ) {
+                                $query .= " AND {$wpdb->blogs}.archived = '1' ";
+                        } elseif ( 'spam' == $_GET['blogstatus'] ) {
+                                $query .= " AND {$wpdb->blogs}.spam = '1' ";
+                        }
</ins><span class="cx">                 }
</span><span class="cx">
</span><ins>+                if ( isset( $_GET['searchaction'] ) ) {
+                        if ( 'name' == $_GET['searchaction'] ) {
+                                $query .= " AND ( {$wpdb->blogs}.domain LIKE '%{$like_s}%' OR {$wpdb->blogs}.path LIKE '%{$like_s}%' ) ";
+                        } elseif ( 'id' == $_GET['searchaction'] ) {
+                                $query .= " AND {$wpdb->blogs}.blog_id = '{$like_s}' ";
+                        } elseif ( 'ip' == $_GET['searchaction'] ) {
+                                $query = "SELECT *
+                                        FROM {$wpdb->blogs}, {$wpdb->registration_log}
+                                        WHERE site_id = '{$wpdb->siteid}'
+                                        AND {$wpdb->blogs}.blog_id = {$wpdb->registration_log}.blog_id
+                                        AND {$wpdb->registration_log}.IP LIKE ('%{$like_s}%')";
+                        }
+                }
+
</ins><span class="cx">                 $order_by = isset( $_GET['sortby'] ) ? $_GET['sortby'] : 'id';
</span><del>-
</del><span class="cx">                 if ( $order_by == 'registered' ) {
</span><span class="cx">                         $query .= ' ORDER BY registered ';
</span><span class="cx">                 } elseif ( $order_by == 'lastupdated' ) {
</span><span class="lines">@@ -355,67 +374,120 @@
</span><span class="cx">                         $query .= ' ORDER BY domain ';
</span><span class="cx">                 } else {
</span><span class="cx">                         $order_by = 'id';
</span><del>-                        $query .= ' ORDER BY ' . $wpdb->blogs . '.blog_id ';
</del><ins>+                        $query .= " ORDER BY {$wpdb->blogs}.blog_id ";
</ins><span class="cx">                 }
</span><span class="cx">
</span><del>-                $order = isset($_GET['order']) ? $_GET['order'] : 'ASC';
-                $order = ( 'DESC' == $order ) ? 'DESC' : 'ASC';
</del><ins>+                $order = ( isset( $_GET['order'] ) && 'DESC' == $_GET['order'] ) ? "DESC" : "ASC";
</ins><span class="cx">                 $query .= $order;
</span><span class="cx">
</span><del>-                if ( !empty($s) )
-                        $total = $wpdb->get_var( str_replace('SELECT *', 'SELECT COUNT(blog_id)', $query) );
-                else
-                        $total = $wpdb->get_var( "SELECT COUNT(blog_id) FROM {$wpdb->blogs} WHERE site_id = '{$wpdb->siteid}' ");
</del><ins>+                $total = $wpdb->get_var( str_replace('SELECT *', 'SELECT COUNT(blog_id)', $query) );
</ins><span class="cx">
</span><del>-                $query .= " LIMIT " . intval( ( $apage - 1 ) * $num) . ", " . intval( $num );
</del><ins>+                $query .= " LIMIT " . intval( ( $pagenum - 1 ) * $per_page) . ", " . intval( $per_page );
</ins><span class="cx">                 $blog_list = $wpdb->get_results( $query, ARRAY_A );
</span><span class="cx">
</span><del>-                // Pagination
-                $url2 = "&amp;order=" . $order . "&amp;sortby=" . $order_by . "&amp;s=";
-                if ( !empty($_GET[ 'blog_ip' ]) )
-                        $url2 .= "&amp;ip_address=" . urlencode( $s );
</del><ins>+                $num_pages = ceil($total / $per_page);
+                $page_links = paginate_links( array(
+                        'base' => add_query_arg( 'paged', '%#%' ),
+                        'format' => '',
+                        'prev_text' => __('&laquo;'),
+                        'next_text' => __('&raquo;'),
+                        'total' => $num_pages,
+                        'current' => $pagenum
+                ));
+
+                if ( empty($_GET['mode']) )
+                        $mode = 'list';
</ins><span class="cx">                 else
</span><del>-                        $url2 .= $s . "&amp;ip_address=" . urlencode( $s );
</del><ins>+                        $mode = esc_attr( $_GET['mode'] );
</ins><span class="cx">
</span><del>-                $blog_navigation = paginate_links( array(
-                        'base' => add_query_arg( 'apage', '%#%' ).$url2,
-                        'format' => '',
-                        'total' => ceil($total / $num),
-                        'current' => $apage
-                ));
</del><ins>+                // for subsubsub and $blog_list
+                $status_list = array( 'archived' => array( 'site-archived', __('Archived') ), 'spam' => array( 'site-spammed', __('Spam') ), 'deleted' => array( 'site-deleted', __('Deleted') ) );
</ins><span class="cx">                 ?>
</span><span class="cx">
</span><del>-                <div class="wrap" style="position:relative;">
</del><ins>+                <div class="wrap">
</ins><span class="cx">                 <?php screen_icon(); ?>
</span><del>-                <h2><?php _e('Sites') ?></h2>
</del><ins>+                <h2><?php _e('Sites') ?>
+                <a href="#form-add-site" class="button add-new-h2"><?php echo esc_html_x('Add New', 'sites'); ?></a>
+                <?php
+                if ( isset($_GET['s']) && $_GET['s'] )
+                printf( '<span class="subtitle">' . __('Search results for &#8220;%s&#8221;') . '</span>', esc_html( $s ) );
+                ?>
+                </h2>
</ins><span class="cx">
</span><ins>+                <ul class="subsubsub">
+                <?php
+                $status_links = array();
+                $status_class = '';
+                $count = get_blog_count();
+                
+                if ( empty($_GET['blogstatus']) || $_GET['blogstatus'] == 'all' )
+                                $status_class = ' class="current"';
+
+                $status_links[] = "<li><a href='ms-sites.php?blogstatus=all'$status_class>" . sprintf( __( 'All <span class="count">(%s)</span>' ), number_format_i18n( $count->all ) ) . '</a>';
+
+                foreach ( $status_list as $status => $col ) {
+                        $status_class = '';
+
+                        if ( empty( $count->$status ) )
+                                continue;
+
+                        if ( isset( $_GET['blogstatus'] ) && ( $_GET['blogstatus'] == $status ) )
+                                $status_class = ' class="current"';
+
+                        $status_links[] = "<li><a href='ms-sites.php?blogstatus=$status'$status_class>" . sprintf( $col[1] . ' <span class="count">(%s)</span>' , number_format_i18n( $count->$status ) ) . '</a>';
+                };
+
+                echo implode( " |</li>\n", $status_links ) . '</li>';
+                unset( $status_links );
+                ?>
+                </ul>
+
</ins><span class="cx">                 <form action="ms-sites.php" method="get" id="ms-search">
</span><del>-                        <input type="hidden" name="action" value="blogs" />
-                        <input type="text" name="s" value="<?php echo($s); ?>" size="17" />
-                        <input type="submit" class="button" name="blog_name" value="<?php esc_attr_e('Search blogs by name') ?>" />
-                        <input type="submit" class="button" name="blog_id" value="<?php esc_attr_e('by blog ID') ?>" />
-                        <input type="submit" class="button" name="blog_ip" value="<?php esc_attr_e('by IP address') ?>" />
</del><ins>+                <p class="search-box">
+                <input type="hidden" name="action" value="blogs" />
+                <input type="text" name="s" value="<?php esc_attr_e( $s ); ?>" />
+                <input type="submit" class="button" value="<?php esc_attr_e('Search Site by') ?>" />
+                <select name="searchaction">
+                        <option value="name" selected="selected"><?php _e('Name'); ?></option>
+                        <option value="id"><?php _e('ID'); ?></option>
+                        <option value="ip"><?php _e('IP address'); ?></option>
+                </select>
+                </p>
</ins><span class="cx">                 </form>
</span><span class="cx">
</span><del>-                <form id="form-blog-list" action="ms-edit.php?action=allblogs" method="post">
-
</del><ins>+                <form id="form-site-list" action="ms-edit.php?action=allblogs" method="post">
+                <input type="hidden" name="mode" value="<?php echo esc_attr($mode); ?>" />
</ins><span class="cx">                 <div class="tablenav">
</span><del>-                        <?php if ( $blog_navigation ) echo "<div class='tablenav-pages'>$blog_navigation</div>"; ?>
</del><ins>+                <div class="alignleft actions">
+                        <select name="action">
+                                <option value="-1" selected="selected"><?php _e('Bulk Actions'); ?></option>
+                                <option value="delete"><?php _e('Delete'); ?></option>
+                                <option value="spam"><?php _e('Mark as Spam'); ?></option>
+                                <option value="notspam"><?php _e('Not Spam'); ?></option>
+                        </select>
+                        <input type="submit" value="<?php esc_attr_e('Apply'); ?>" name="doaction" id="doaction" class="button-secondary action" />
+                        <?php wp_nonce_field('bulk-sites'); ?>
+                </div>
</ins><span class="cx">
</span><del>-                        <div class="alignleft">
-                                <input type="submit" value="<?php esc_attr_e('Delete') ?>" name="allblog_delete" class="button-secondary delete" />
-                                <input type="submit" value="<?php esc_attr_e('Mark as Spam') ?>" name="allblog_spam" class="button-secondary" />
-                                <input type="submit" value="<?php esc_attr_e('Not Spam') ?>" name="allblog_notspam" class="button-secondary" />
-                                <?php wp_nonce_field( 'allblogs' ); ?>
-                                <br class="clear" />
-                        </div>
</del><ins>+                <?php if ( $page_links ) { ?>
+                <div class="tablenav-pages">
+                <?php $page_links_text = sprintf( '<span class="displaying-num">' . __( 'Displaying %s&#8211;%s of %s' ) . '</span>%s',
+                number_format_i18n( ( $pagenum - 1 ) * $per_page + 1 ),
+                number_format_i18n( min( $pagenum * $per_page, $num_pages ) ),
+                number_format_i18n( $num_pages ),
+                $page_links
+                ); echo $page_links_text; ?>
</ins><span class="cx">                 </div>
</span><ins>+                <?php } ?>
+                
+                <div class="view-switch">
+                        <a href="<?php echo esc_url(add_query_arg('mode', 'list', $_SERVER['REQUEST_URI'])) ?>"><img <?php if ( 'list' == $mode ) echo 'class="current"'; ?> id="view-switch-list" src="<?php echo esc_url( includes_url( 'images/blank.gif' ) ); ?>" width="20" height="20" title="<?php _e('List View') ?>" alt="<?php _e('List View') ?>" /></a>
+                        <a href="<?php echo esc_url(add_query_arg('mode', 'excerpt', $_SERVER['REQUEST_URI'])) ?>"><img <?php if ( 'excerpt' == $mode ) echo 'class="current"'; ?> id="view-switch-excerpt" src="<?php echo esc_url( includes_url( 'images/blank.gif' ) ); ?>" width="20" height="20" title="<?php _e('Excerpt View') ?>" alt="<?php _e('Excerpt View') ?>" /></a>
+                </div>
</ins><span class="cx">
</span><del>-                <br class="clear" />
</del><ins>+                </div>
</ins><span class="cx">
</span><del>-                <?php if ( isset($_GET['s']) && !empty($_GET['s']) ) : ?>
-                        <p><a href="ms-users.php?action=users&s=<?php echo urlencode( stripslashes( $s ) ) ?>"><?php _e('Search Users:') ?> <strong><?php echo stripslashes( $s ); ?></strong></a></p>
-                <?php endif; ?>
</del><ins>+                <div class="clear"></div>
</ins><span class="cx">
</span><span class="cx">                 <?php
</span><span class="cx">                 // define the columns to display, the syntax is 'internal name' => 'display name'
</span><span class="lines">@@ -432,35 +504,55 @@
</span><span class="cx">                         $posts_columns['plugins'] = __('Actions');
</span><span class="cx">
</span><span class="cx">                 $posts_columns = apply_filters('wpmu_blogs_columns', $posts_columns);
</span><del>-
-                $sortby_url = "s=";
-                if ( !empty($_GET[ 'blog_ip' ]) )
-                        $sortby_url .= "&ip_address=" . urlencode( $s );
-                else
-                        $sortby_url .= urlencode( $s ) . "&ip_address=" . urlencode( $s );
</del><span class="cx">                 ?>
</span><span class="cx">
</span><del>-                <table width="100%" cellpadding="3" cellspacing="3" class="widefat">
</del><ins>+                <table class="widefat">
</ins><span class="cx">                         <thead>
</span><span class="cx">                                 <tr>
</span><del>-                                <th scope="col" class="check-column"></th>
-                                <?php foreach($posts_columns as $column_id => $column_display_name) {
-                                        $column_link = "<a href='ms-sites.php?{$sortby_url}&amp;sortby={$column_id}&amp;";
-                                        if ( $order_by == $column_id ) {
-                                                $column_link .= ($order_by == 'DESC') ? 'order=ASC&amp;' : 'order=DESC&amp;';
-                                        }
-                                        $column_link .= "apage={$apage}'>{$column_display_name}</a>";
</del><ins>+                                <th style="" class="manage-column column-cb check-column" id="cb" scope="col">
+                                        <input type="checkbox" />
+                                </th>
+                                <?php
+                                foreach($posts_columns as $column_id => $column_display_name) {
+                                        $column_link = "<a href='";
+                                        $order2 = '';
+                                        if ( $order_by == $column_id )
+                                                $order2 = ($order == 'DESC') ? 'ASC' : 'DESC';
</ins><span class="cx">
</span><ins>+                                        $column_link .= esc_url(add_query_arg( array('order' => $order2, 'paged' => $pagenum, 'sortby' => $column_id ), $_SERVER['REQUEST_URI'] ) );
+                                        $column_link .= "'>{$column_display_name}</a>";
</ins><span class="cx">                                         $col_url = ($column_id == 'users' || $column_id == 'plugins') ? $column_display_name : $column_link;
</span><del>-                                        ?>
-                                        <th scope="col"><?php echo $col_url ?></th>
</del><ins>+                                ?>
+                                <th scope="col">
+                                        <?php echo $col_url ?>
+                                </th>
</ins><span class="cx">                                 <?php } ?>
</span><span class="cx">                                 </tr>
</span><span class="cx">                         </thead>
</span><ins>+                        <tfoot>
+                                <tr>
+                                <th class="manage-column column-cb check-column" id="cb" scope="col">
+                                        <input type="checkbox" />
+                                </th>
+                                <?php foreach($posts_columns as $column_id => $column_display_name) {
+                                        $column_link = "<a href='";
+                                        $order2 = '';
+                                        if ( $order_by == $column_id )
+                                                $order2 = ($order == 'DESC') ? 'ASC' : 'DESC';
+                                                
+                                        $column_link .= esc_url(add_query_arg( array('order' => $order2, 'paged' => $pagenum, 'sortby' => $column_id ), remove_query_arg( array('action', 'updated'), $_SERVER['REQUEST_URI'] ) ) );
+                                        $column_link .= "'>{$column_display_name}</a>";
+                                        $col_url = ($column_id == 'users' || $column_id == 'plugins') ? $column_display_name : $column_link;
+                                ?>
+                                <th scope="col">
+                                        <?php echo $col_url ?>
+                                </th>
+                                <?php } ?>
+                                </tr>
+                        </tfoot>
</ins><span class="cx">                         <tbody id="the-list">
</span><span class="cx">                         <?php
</span><span class="cx">                         if ( $blog_list ) {
</span><del>-                                $status_list = array( 'archived' => array( 'site-archived', __('Archived') ), 'spam' => array( 'site-spammed', __('Spam') ), 'deleted' => array( 'site-deleted', __('Deleted') ) );
</del><span class="cx">                                 $class = '';
</span><span class="cx">                                 foreach ( $blog_list as $blog ) {
</span><span class="cx">                                         $class = ('alternate' == $class) ? '' : 'alternate';
</span><span class="lines">@@ -500,10 +592,12 @@
</span><span class="cx">                                                         break;
</span><span class="cx">
</span><span class="cx">                                                         case 'blogname': ?>
</span><del>-                                                                <td valign="top">
</del><ins>+                                                                <td class="column-title">
</ins><span class="cx">                                                                         <a href="ms-sites.php?action=editblog&amp;id=<?php echo $blog['blog_id'] ?>" class="edit"><?php echo $blogname; echo $blog_state?></a>
</span><del>-                                                                        <br/>
</del><span class="cx">                                                                         <?php
</span><ins>+                                                                        if ( 'list' != $mode )
+                                                                                echo '<p>' . get_blog_option( $blog['blog_id'], 'blogname' ) . '- <em>' . get_blog_option( $blog['blog_id'], 'blogdescription ' ) . '</em></p>';
+
</ins><span class="cx">                                                                         $actions        = array();
</span><span class="cx">                                                                         $actions[]        = '<a href="ms-sites.php?action=editblog&amp;id=' . $blog['blog_id'] . '" class="edit">' . __('Edit') . '</a>';
</span><span class="cx">                                                                         $actions[]        = "<a href='" . get_admin_url($blog['blog_id']) . "' class='edit'>" . __('Backend') . '</a>';
</span><span class="lines">@@ -539,17 +633,21 @@
</span><span class="cx">
</span><span class="cx">                                                         case 'lastupdated': ?>
</span><span class="cx">                                                                 <td valign="top">
</span><del>-                                                                        <?php echo ( $blog['last_updated'] == '0000-00-00 00:00:00' ) ? __("Never") : mysql2date(__('Y-m-d \<\b\r \/\> g:i:s a'), $blog['last_updated']); ?>
-                                                                </td>
</del><ins>+                                                                        <?php
+                                                                        if ( 'list' == $mode )
+                                                                                $date = 'Y/m/d';
+                                                                        else
+                                                                                $date = 'Y/m/d \<\b\r \/\> g:i:s a';
+                                                                        echo ( $blog['last_updated'] == '0000-00-00 00:00:00' ) ? __("Never") : mysql2date( __( $date ), $blog['last_updated'] ); ?>
+                                                                </td>
</ins><span class="cx">                                                         <?php
</span><span class="cx">                                                         break;
</span><del>-                                                        case 'registered': ?>
</del><ins>+                                                case 'registered': ?>
</ins><span class="cx">                                                                 <td valign="top">
</span><del>-                                                                        <?php echo mysql2date(__('Y-m-d \<\b\r \/\> g:i:s a'), $blog['registered']); ?>
</del><ins>+                                                                <?php echo mysql2date(__( $date ), $blog['registered'] ); ?>
</ins><span class="cx">                                                                 </td>
</span><del>-                                                        <?php
-                                                        break;
-
</del><ins>+                                                <?php
+                                                break;
</ins><span class="cx">                                                         case 'users': ?>
</span><span class="cx">                                                                 <td valign="top">
</span><span class="cx">                                                                         <?php
</span><span class="lines">@@ -560,8 +658,12 @@
</span><span class="cx">                                                                                         $blogusers = array_slice( $blogusers, 0, 5 );
</span><span class="cx">                                                                                         $blogusers_warning = __( 'Only showing first 5 users.' ) . ' <a href="' . get_admin_url($blog['blog_id'], 'users.php') . '">' . __( 'More' ) . '</a>';
</span><span class="cx">                                                                                 }
</span><del>-                                                                                foreach ( $blogusers as $key => $val )
-                                                                                        echo '<a href="user-edit.php?user_id=' . $val->user_id . '">' . $val->user_login . '</a> ('.$val->user_email.')<br />';
</del><ins>+                                                                                foreach ( $blogusers as $key => $val ) {
+                                                                                        echo '<a href="user-edit.php?user_id=' . $val->user_id . '">' . $val->user_login . '</a> ';
+                                                                                        if ( 'list' != $mode )
+                                                                                                echo '(' . $val->user_email . ')';
+                                                                                        echo '<br />';
+                                                                                }
</ins><span class="cx">                                                                                 if ( $blogusers_warning != '' )
</span><span class="cx">                                                                                         echo '<strong>' . $blogusers_warning . '</strong><br />';
</span><span class="cx">                                                                         }
</span><span class="lines">@@ -592,7 +694,7 @@
</span><span class="cx">                                         <?php
</span><span class="cx">                                 }
</span><span class="cx">                         } else { ?>
</span><del>-                                <tr style='background-color: <?php echo $bgcolor; ?>'>
</del><ins>+                                <tr>
</ins><span class="cx">                                         <td colspan="8"><?php _e('No blogs found.') ?></td>
</span><span class="cx">                                 </tr>
</span><span class="cx">                         <?php
</span><span class="lines">@@ -601,34 +703,52 @@
</span><span class="cx">
</span><span class="cx">                         </tbody>
</span><span class="cx">                 </table>
</span><ins>+                <div class="tablenav">
+                        <?php
+                        if ( $page_links )
+                                echo "<div class='tablenav-pages'>$page_links_text</div>";
+                        ?>
+
+                        <div class="alignleft actions">
+                        <select name="action2">
+                                <option value="-1" selected="selected"><?php _e('Bulk Actions'); ?></option>
+                                <option value="delete"><?php _e('Delete'); ?></option>
+                                <option value="spam"><?php _e('Mark as Spam'); ?></option>
+                                <option value="notspam"><?php _e('Not Spam'); ?></option>
+                        </select>
+                        <input type="submit" value="<?php esc_attr_e('Apply'); ?>" name="doaction2" id="doaction2" class="button-secondary action" />
+                        </div>
+                        <br class="clear" />
+                </div>
+
</ins><span class="cx">                 </form>
</span><span class="cx">                 </div>
</span><span class="cx">
</span><span class="cx">                 <div class="wrap">
</span><del>-                        <a name="form-add-blog"></a>
</del><ins>+                        <a name="form-add-site"></a>
</ins><span class="cx">                         <h2><?php _e('Add Site') ?></h2>
</span><span class="cx">                         <form method="post" action="ms-edit.php?action=addblog">
</span><span class="cx">                                 <?php wp_nonce_field('add-blog') ?>
</span><span class="cx">                                 <table class="form-table">
</span><span class="cx">                                         <tr class="form-field form-required">
</span><del>-                                                <th style="text-align:center;" scope='row'><?php _e('Site Address') ?></th>
</del><ins>+                                                <th scope='row'><?php _e('Site Address') ?></th>
</ins><span class="cx">                                                 <td>
</span><span class="cx">                                                 <?php if ( is_subdomain_install() ) { ?>
</span><del>-                                                        <input name="blog[domain]" type="text" title="<?php _e('Domain') ?>"/>.<?php echo $current_site->domain;?>
</del><ins>+                                                        <input name="blog[domain]" type="text" class="regular-text" title="<?php _e('Domain') ?>"/>.<?php echo $current_site->domain;?>
</ins><span class="cx">                                                 <?php } else {
</span><del>-                                                        echo $current_site->domain . $current_site->path ?><input name="blog[domain]" type="text" title="<?php _e('Domain') ?>"/>
</del><ins>+                                                        echo $current_site->domain . $current_site->path ?><input name="blog[domain]" class="regular-text" type="text" title="<?php _e('Domain') ?>"/>
</ins><span class="cx">                                                 <?php }
</span><span class="cx">                                                 echo "<p>" . __( 'Only the characters a-z and 0-9 recommended.' ) . "</p>";
</span><span class="cx">                                                 ?>
</span><span class="cx">                                                 </td>
</span><span class="cx">                                         </tr>
</span><span class="cx">                                         <tr class="form-field form-required">
</span><del>-                                                <th style="text-align:center;" scope='row'><?php _e('Site Title') ?></th>
-                                                <td><input name="blog[title]" type="text" size="20" title="<?php _e('Title') ?>"/></td>
</del><ins>+                                                <th scope='row'><?php _e('Site Title') ?></th>
+                                                <td><input name="blog[title]" type="text" class="regular-text" title="<?php _e('Title') ?>"/></td>
</ins><span class="cx">                                         </tr>
</span><span class="cx">                                         <tr class="form-field form-required">
</span><del>-                                                <th style="text-align:center;" scope='row'><?php _e('Admin Email') ?></th>
-                                                <td><input name="blog[email]" type="text" size="20" title="<?php _e('Email') ?>"/></td>
</del><ins>+                                                <th scope='row'><?php _e('Admin Email') ?></th>
+                                                <td><input name="blog[email]" type="text" class="regular-text" title="<?php _e('Email') ?>"/></td>
</ins><span class="cx">                                         </tr>
</span><span class="cx">                                         <tr class="form-field">
</span><span class="cx">                                                 <td colspan='2'><?php _e('A new user will be created if the above email address is not in the database.') ?><br /><?php _e('The username and password will be mailed to this email address.') ?></td>
</span></span></pre>
</div>
</div>
</body>
</html>