<!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>[13918] trunk/wp-admin: Huge MS refactoring and code cleanup.</title>
</head>
<body>
<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/13918">13918</a></dd>
<dt>Author</dt> <dd>markjaquith</dd>
<dt>Date</dt> <dd>2010-04-01 21:21:27 +0000 (Thu, 01 Apr 2010)</dd>
</dl>
<h3>Log Message</h3>
<pre>Huge MS refactoring and code cleanup. see <a href="http://trac.wordpress.org/ticket/12460">#12460</a>. props ocean90.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadmincssmsdevcss">trunk/wp-admin/css/ms.dev.css</a></li>
<li><a href="#trunkwpadminincludesmsphp">trunk/wp-admin/includes/ms.php</a></li>
<li><a href="#trunkwpadminmsdeletesitephp">trunk/wp-admin/ms-delete-site.php</a></li>
<li><a href="#trunkwpadminmseditphp">trunk/wp-admin/ms-edit.php</a></li>
<li><a href="#trunkwpadminmsoptionsphp">trunk/wp-admin/ms-options.php</a></li>
<li><a href="#trunkwpadminmssitesphp">trunk/wp-admin/ms-sites.php</a></li>
<li><a href="#trunkwpadminmsthemesphp">trunk/wp-admin/ms-themes.php</a></li>
<li><a href="#trunkwpadminmsusersphp">trunk/wp-admin/ms-users.php</a></li>
<li><a href="#trunkwpadminmysitesphp">trunk/wp-admin/my-sites.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadmincssmsdevcss"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/css/ms.dev.css (13917 => 13918)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/css/ms.dev.css        2010-04-01 20:32:17 UTC (rev 13917)
+++ trunk/wp-admin/css/ms.dev.css        2010-04-01 21:21:27 UTC (rev 13918)
</span><span class="lines">@@ -1,45 +1,3 @@
</span><del>-/* Blog Switcher */
-
-#all-my-blogs-tab a.current {
-        position: relative;
-        padding-bottom: 10px;
-}
-
-#all-my-blogs {
-        position: absolute;
-        top: 30px;
-        left: 0;
-        right: 0;
-        _width: 100%; /* IE6 Hack */
-        margin: 4px 7px;
-        padding: 6px 10px;
-        font-size: 12px;
-}
-
-#all-my-blogs * {
-        margin: 0;
-}
-
-form#all-my-blogs p, form#all-my-blogs p * {
-        vertical-align: middle;
-}
-
-#all-my-blogs a {
-        font-size: 10px;
-        text-decoration: underline;
-        margin: 0 14px;
-}
-
-#all-my-blogs a:hover, #all-my-blogs a:active {
-        text-decoration: none;
-}
-
-form#wpmu-search {
-        position:absolute;
-        right:0;
-        top:0;
-}
-
</del><span class="cx"> /* Site Admin Menu */
</span><span class="cx"> #adminmenu .menu-icon-site div.wp-menu-image {
</span><span class="cx">         background: transparent url('../images/site-admin.png') no-repeat scroll 0px -33px;
</span><span class="lines">@@ -49,7 +7,7 @@
</span><span class="cx">         background: transparent url('../images/site-admin.png') no-repeat scroll 0px -1px;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-/* Dashboard: MU Specific Data */
</del><ins>+/* Dashboard: MS Specific Data */
</ins><span class="cx"> #dashboard_right_now p.musub {
</span><span class="cx">         margin-top: 12px;
</span><span class="cx">         border-top: 1px solid #ececec;
</span><span class="lines">@@ -59,12 +17,32 @@
</span><span class="cx"> #dashboard_right_now td.b a.musublink {
</span><span class="cx">         font-size: 16px;
</span><span class="cx"> }
</span><ins>+
+#dashboard_right_now div.musubtable {
+        border-top: none;
+}
+
+/* No drag and drop on ms-sites.php */
+.ms-sites-php .postbox h3 {
+        cursor: auto;
+}
+
+.ms-sites-php .postbox .description {
+        margin:10px 0 0px;
+        padding:0px 10px 10px;
+        border-bottom:1px solid #DFDFDF;
+}
+
+/* Background Color for Site Status */
</ins><span class="cx"> tr.site-deleted {
</span><del>-        background:#f55;
</del><ins>+        background: #ff8573;
</ins><span class="cx"> }
</span><span class="cx"> tr.site-spammed {
</span><del>-        background:#faa;
</del><ins>+        background: #faa;
</ins><span class="cx"> }
</span><span class="cx"> tr.site-archived {
</span><del>-        background:#fee;
</del><ins>+        background:#ffebe8;
</ins><span class="cx"> }
</span><ins>+tr.site-mature {
+        background: #fecac2;
+}
</ins></span></pre></div>
<a id="trunkwpadminincludesmsphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/ms.php (13917 => 13918)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/ms.php        2010-04-01 20:32:17 UTC (rev 13917)
+++ trunk/wp-admin/includes/ms.php        2010-04-01 21:21:27 UTC (rev 13918)
</span><span class="lines">@@ -27,7 +27,7 @@
</span><span class="cx">         if ( $file_size > ( 1024 * get_site_option( 'fileupload_maxk', 1500 ) ) )
</span><span class="cx">                 $file['error'] = sprintf(__('This file is too big. Files must be less than %1$s Kb in size.'), get_site_option( 'fileupload_maxk', 1500 ) );
</span><span class="cx">         if ( upload_is_user_over_quota( false ) ) {
</span><del>-                $file['error'] = __('You have used your space quota. Please delete files before uploading.');
</del><ins>+                $file['error'] = __( 'You have used your space quota. Please delete files before uploading.' );
</ins><span class="cx">         }
</span><span class="cx">         if ( $file['error'] != '0' )
</span><span class="cx">                 wp_die( $file['error'] . ' <a href="javascript:history.go(-1)">' . __( 'Back' ) . '</a>' );
</span><span class="lines">@@ -45,74 +45,77 @@
</span><span class="cx"> * @param bool $drop True if blog's table should be dropped. Default is false.
</span><span class="cx"> * @return void
</span><span class="cx"> */
</span><del>-function wpmu_delete_blog($blog_id, $drop = false) {
</del><ins>+function wpmu_delete_blog( $blog_id, $drop = false ) {
</ins><span class="cx">         global $wpdb;
</span><span class="cx">
</span><del>-        $switched = false;
</del><ins>+        $switch = false;
</ins><span class="cx">         if ( $blog_id != $wpdb->blogid ) {
</span><span class="cx">                 $switch = true;
</span><del>-                switch_to_blog($blog_id);
</del><ins>+                switch_to_blog( $blog_id );
</ins><span class="cx">         }
</span><span class="cx">
</span><del>-        do_action('delete_blog', $blog_id, $drop);
</del><ins>+        $blog_prefix = $wpdb->get_blog_prefix( $blog_id );
</ins><span class="cx">
</span><del>-        $users = get_users_of_blog($blog_id);
</del><ins>+        do_action( 'delete_blog', $blog_id, $drop );
</ins><span class="cx">
</span><ins>+        $users = get_users_of_blog( $blog_id );
+
</ins><span class="cx">         // Remove users from this blog.
</span><del>-        if ( !empty($users) ) {
-                foreach ($users as $user) {
-                        remove_user_from_blog($user->user_id, $blog_id);
</del><ins>+        if ( ! empty( $users ) ) {
+                foreach ( $users as $user ) {
+                        remove_user_from_blog( $user->user_id, $blog_id) ;
</ins><span class="cx">                 }
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         update_blog_status( $blog_id, 'deleted', 1 );
</span><span class="cx">
</span><span class="cx">         if ( $drop ) {
</span><del>-                $drop_tables = $wpdb->get_results("show tables LIKE '". $wpdb->base_prefix . $blog_id . "\_%'", ARRAY_A);
</del><ins>+                $drop_tables = $wpdb->get_results( "SHOW TABLES LIKE '{$blog_prefix}%'", ARRAY_A );
</ins><span class="cx">                 $drop_tables = apply_filters( 'wpmu_drop_tables', $drop_tables );
</span><span class="cx">
</span><span class="cx">                 reset( $drop_tables );
</span><span class="cx">                 foreach ( (array) $drop_tables as $drop_table) {
</span><span class="cx">                         $wpdb->query( "DROP TABLE IF EXISTS ". current( $drop_table ) ."" );
</span><span class="cx">                 }
</span><del>-                $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->blogs WHERE blog_id = %d", $blog_id) );
</del><ins>+                $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->blogs WHERE blog_id = %d", $blog_id ) );
</ins><span class="cx">                 $dir = apply_filters( 'wpmu_delete_blog_upload_dir', WP_CONTENT_DIR . "/blogs.dir/{$blog_id}/files/", $blog_id );
</span><del>-                $dir = rtrim($dir, DIRECTORY_SEPARATOR);
</del><ins>+                $dir = rtrim( $dir, DIRECTORY_SEPARATOR );
</ins><span class="cx">                 $top_dir = $dir;
</span><span class="cx">                 $stack = array($dir);
</span><span class="cx">                 $index = 0;
</span><span class="cx">
</span><del>-                while ( $index < count($stack) ) {
</del><ins>+                while ( $index < count( $stack ) ) {
</ins><span class="cx">                         # Get indexed directory from stack
</span><span class="cx">                         $dir = $stack[$index];
</span><span class="cx">
</span><del>-                        $dh = @ opendir($dir);
</del><ins>+                        $dh = @opendir( $dir );
</ins><span class="cx">                         if ( $dh ) {
</span><del>-                                while ( ($file = @ readdir($dh)) !== false ) {
-                                        if ($file == '.' or $file == '..')
</del><ins>+                                while ( ( $file = @readdir( $dh ) ) !== false ) {
+                                        if ( $file == '.' || $file == '..' )
</ins><span class="cx">                                                 continue;
</span><span class="cx">
</span><del>-                                        if (@ is_dir($dir . DIRECTORY_SEPARATOR . $file))
</del><ins>+                                        if ( @is_dir( $dir . DIRECTORY_SEPARATOR . $file ) )
</ins><span class="cx">                                                 $stack[] = $dir . DIRECTORY_SEPARATOR . $file;
</span><del>-                                        else if (@ is_file($dir . DIRECTORY_SEPARATOR . $file))
-                                                @ unlink($dir . DIRECTORY_SEPARATOR . $file);
</del><ins>+                                        else if ( @is_file( $dir . DIRECTORY_SEPARATOR . $file ) )
+                                                @unlink( $dir . DIRECTORY_SEPARATOR . $file );
</ins><span class="cx">                                 }
</span><span class="cx">                         }
</span><span class="cx">                         $index++;
</span><span class="cx">                 }
</span><span class="cx">
</span><del>-                $stack = array_reverse($stack); // Last added dirs are deepest
</del><ins>+                $stack = array_reverse( $stack ); // Last added dirs are deepest
</ins><span class="cx">                 foreach( (array) $stack as $dir ) {
</span><span class="cx">                         if ( $dir != $top_dir)
</span><del>-                        @rmdir($dir);
</del><ins>+                        @rmdir( $dir );
</ins><span class="cx">                 }
</span><span class="cx">         }
</span><del>-        $wpdb->query( $wpdb->prepare("DELETE FROM {$wpdb->usermeta} WHERE meta_key = %s", 'wp_{$blog_id}_autosave_draft_ids') );
-        $blogs = get_site_option( "blog_list" );
</del><ins>+
+        $wpdb->query( "DELETE FROM {$wpdb->usermeta} WHERE meta_key = '{$blog_prefix}autosave_draft_ids'" );
+        $blogs = get_site_option( 'blog_list' );
</ins><span class="cx">         if ( is_array( $blogs ) ) {
</span><span class="cx">                 foreach ( $blogs as $n => $blog ) {
</span><del>-                        if ( $blog[ 'blog_id' ] == $blog_id )
-                                unset( $blogs[ $n ] );
</del><ins>+                        if ( $blog['blog_id'] == $blog_id )
+                                unset( $blogs[$n] );
</ins><span class="cx">                 }
</span><span class="cx">                 update_site_option( 'blog_list', $blogs );
</span><span class="cx">         }
</span><span class="lines">@@ -122,44 +125,44 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // @todo Merge with wp_delete_user() ?
</span><del>-function wpmu_delete_user($id) {
</del><ins>+function wpmu_delete_user( $id ) {
</ins><span class="cx">         global $wpdb;
</span><span class="cx">
</span><span class="cx">         $id = (int) $id;
</span><span class="cx">
</span><del>-        do_action('wpmu_delete_user', $id);
</del><ins>+        do_action( 'wpmu_delete_user', $id );
</ins><span class="cx">
</span><del>-        $blogs = get_blogs_of_user($id);
</del><ins>+        $blogs = get_blogs_of_user( $id );
</ins><span class="cx">
</span><del>-        if ( ! empty($blogs) ) {
-                foreach ($blogs as $blog) {
-                        switch_to_blog($blog->userblog_id);
-                        remove_user_from_blog($id, $blog->userblog_id);
</del><ins>+        if ( ! empty( $blogs ) ) {
+                foreach ( $blogs as $blog ) {
+                        switch_to_blog( $blog->userblog_id );
+                        remove_user_from_blog( $id, $blog->userblog_id );
</ins><span class="cx">
</span><del>-                        $post_ids = $wpdb->get_col( $wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_author = %d", $id ) );
</del><ins>+                        $post_ids = $wpdb->get_col( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_author = %d", $id ) );
</ins><span class="cx">                         foreach ( (array) $post_ids as $post_id ) {
</span><del>-                                wp_delete_post($post_id);
</del><ins>+                                wp_delete_post( $post_id );
</ins><span class="cx">                         }
</span><span class="cx">
</span><span class="cx">                         // Clean links
</span><del>-                        $link_ids = $wpdb->get_col( $wpdb->prepare("SELECT link_id FROM $wpdb->links WHERE link_owner = %d", $id) );
</del><ins>+                        $link_ids = $wpdb->get_col( $wpdb->prepare( "SELECT link_id FROM $wpdb->links WHERE link_owner = %d", $id ) );
</ins><span class="cx">
</span><span class="cx">                         if ( $link_ids ) {
</span><span class="cx">                                 foreach ( $link_ids as $link_id )
</span><del>-                                        wp_delete_link($link_id);
</del><ins>+                                        wp_delete_link( $link_id );
</ins><span class="cx">                         }
</span><span class="cx">
</span><span class="cx">                         restore_current_blog();
</span><span class="cx">                 }
</span><span class="cx">         }
</span><span class="cx">
</span><del>-        $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->users WHERE ID = %d", $id) );
-        $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->usermeta WHERE user_id = %d", $id) );
</del><ins>+        $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->users WHERE ID = %d", $id ) );
+        $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->usermeta WHERE user_id = %d", $id ) );
</ins><span class="cx">
</span><del>-        clean_user_cache($id);
</del><ins>+        clean_user_cache( $id );
</ins><span class="cx">
</span><span class="cx">         // allow for commit transaction
</span><del>-        do_action('deleted_user', $id);
</del><ins>+        do_action( 'deleted_user', $id );
</ins><span class="cx">
</span><span class="cx">         return true;
</span><span class="cx"> }
</span><span class="lines">@@ -169,14 +172,14 @@
</span><span class="cx">         if ( !is_array( $users ) )
</span><span class="cx">                 return false;
</span><span class="cx">
</span><del>- screen_icon('tools');
</del><ins>+ screen_icon();
</ins><span class="cx"> ?>
</span><del>-        <h2><?php esc_html_e('Users'); ?></h2>
-        <p><?php _e( 'Transfer posts before deleting users:' ); ?></p>
-        <form action="ms-edit.php?action=allusers" method="post">
-        <input type="hidden" name="alluser_transfer_delete" />
</del><ins>+        <h2><?php esc_html_e( 'Users' ); ?></h2>
+        <p><?php _e( 'Transfer or delete posts and links before deleting users.' ); ?></p>
+        <form action="ms-edit.php?action=dodelete" method="post">
+        <input type="hidden" name="dodelete" />
</ins><span class="cx"> <?php
</span><del>-        wp_nonce_field( 'allusers' );
</del><ins>+        wp_nonce_field( 'ms-users-delete' );
</ins><span class="cx">         $site_admins = get_site_option( 'site_admins', array( 'admin' ) );
</span><span class="cx">         $admin_out = "<option value='$current_user->ID'>$current_user->user_login</option>";
</span><span class="cx">
</span><span class="lines">@@ -191,29 +194,40 @@
</span><span class="cx">                         $blogs = get_blogs_of_user( $val, true );
</span><span class="cx">
</span><span class="cx">                         if ( !empty( $blogs ) ) {
</span><del>-                                echo '<p><strong>' . sprintf( __( 'Sites from %s:' ), $delete_user->user_login ) . '</strong></p>';
</del><ins>+                                ?>
+                                <br /><fieldset><p><legend><?php printf( __( "What should be done with posts and links owned by <em>%s</em>?" ), $delete_user->user_login ); ?></legend></p>
+                                <?php
</ins><span class="cx">                                 foreach ( (array) $blogs as $key => $details ) {
</span><span class="cx">                                         $blog_users = get_users_of_blog( $details->userblog_id );
</span><span class="cx">                                         if ( is_array( $blog_users ) && !empty( $blog_users ) ) {
</span><del>-                                                echo "<p><a href='http://{$details->domain}{$details->path}'>{$details->blogname}</a> ";
-                                                echo "<select name='blog[$val][{$key}]'>";
-                                                $out = '';
</del><ins>+                                                $user_site = "<a href='" . esc_url( get_home_url( $details->userblog_id ) ) . "'>{$details->blogname}</a>";
+                                                $user_dropdown = "<select name='blog[$val][{$key}]'>";
+                                                $user_list = '';
</ins><span class="cx">                                                 foreach ( $blog_users as $user ) {
</span><span class="cx">                                                         if ( $user->user_id != $val && !in_array( $user->user_id, $allusers ) )
</span><del>-                                                                $out .= "<option value='{$user->user_id}'>{$user->user_login}</option>";
</del><ins>+                                                                $user_list .= "<option value='{$user->user_id}'>{$user->user_login}</option>";
</ins><span class="cx">                                                 }
</span><del>-                                                if ( $out == '' )
-                                                        $out = $admin_out;
-                                                echo $out;
-                                                echo "</select>\n";
</del><ins>+                                                if ( '' == $user_list )
+                                                        $user_list = $admin_out;
+                                                $user_dropdown .= $user_list;
+                                                $user_dropdown .= "</select>\n";
+                                                ?>
+                                                <ul style="list-style:none;">
+                                                        <li><?php printf( __( 'Site: %s' ), $user_site ); ?></li>
+                                                        <li><label><input type="radio" id="delete_option0" name="delete[<?php echo $details->userblog_id . '][' . $delete_user->ID ?>]" value="delete" checked="checked" />
+                                                        <?php _e( 'Delete all posts and links.' ); ?></label></li>
+                                                        <li><label><input type="radio" id="delete_option1" name="delete[<?php echo $details->userblog_id . '][' . $delete_user->ID ?>]" value="reassign" />
+                                                        <?php echo __( 'Attribute all posts and links to:' ) . '</label>' . $user_dropdown; ?></li>
+                                                </ul>
+                                                <?php
</ins><span class="cx">                                         }
</span><span class="cx">                                 }
</span><ins>+                                echo "</fieldset>";
</ins><span class="cx">                         }
</span><span class="cx">                 }
</span><span class="cx">         }
</span><span class="cx">         ?>
</span><del>- <br class="clear" />
- <input type="submit" class="button-secondary delete" value="<?php _e( 'Delete user and transfer posts' ); ?> " />
</del><ins>+        <p class="submit"><input type="submit" class="button-secondary delete" value="<?php esc_attr_e( 'Confirm Deletion' ); ?>" /></p>
</ins><span class="cx">         </form>
</span><span class="cx"> <?php
</span><span class="cx">         return true;
</span><span class="lines">@@ -225,20 +239,20 @@
</span><span class="cx">         if ( $blog_id != 0 )
</span><span class="cx">                 switch_to_blog( $blog_id );
</span><span class="cx">
</span><del>-        $blog_allowed_themes = get_option( "allowedthemes" );
</del><ins>+        $blog_allowed_themes = get_option( 'allowedthemes' );
</ins><span class="cx">         if ( !is_array( $blog_allowed_themes ) || empty( $blog_allowed_themes ) ) { // convert old allowed_themes to new allowedthemes
</span><del>-                $blog_allowed_themes = get_option( "allowed_themes" );
</del><ins>+                $blog_allowed_themes = get_option( 'allowed_themes' );
</ins><span class="cx">
</span><span class="cx">                 if ( is_array( $blog_allowed_themes ) ) {
</span><span class="cx">                         foreach( (array) $themes as $key => $theme ) {
</span><del>-                                $theme_key = esc_html( $theme[ 'Stylesheet' ] );
-                                if ( isset( $blog_allowed_themes[ $key ] ) == true ) {
-                                        $blog_allowedthemes[ $theme_key ] = 1;
</del><ins>+                                $theme_key = esc_html( $theme['Stylesheet'] );
+                                if ( isset( $blog_allowed_themes[$key] ) == true ) {
+                                        $blog_allowedthemes[$theme_key] = 1;
</ins><span class="cx">                                 }
</span><span class="cx">                         }
</span><span class="cx">                         $blog_allowed_themes = $blog_allowedthemes;
</span><del>-                        add_option( "allowedthemes", $blog_allowed_themes );
-                        delete_option( "allowed_themes" );
</del><ins>+                        add_option( 'allowedthemes', $blog_allowed_themes );
+                        delete_option( 'allowed_themes' );
</ins><span class="cx">                 }
</span><span class="cx">         }
</span><span class="cx">
</span><span class="lines">@@ -248,18 +262,18 @@
</span><span class="cx">         return $blog_allowed_themes;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-function update_option_new_admin_email($old_value, $value) {
</del><ins>+function update_option_new_admin_email( $old_value, $value ) {
</ins><span class="cx">         if ( $value == get_option( 'admin_email' ) || !is_email( $value ) )
</span><span class="cx">                 return;
</span><span class="cx">
</span><span class="cx">         $hash = md5( $value. time() .mt_rand() );
</span><span class="cx">         $new_admin_email = array(
</span><del>-                "hash" => $hash,
-                "newemail" => $value
</del><ins>+                'hash' => $hash,
+                'newemail' => $value
</ins><span class="cx">         );
</span><span class="cx">         update_option( 'adminhash', $new_admin_email );
</span><span class="cx">
</span><del>-        $content = apply_filters( 'new_admin_email_content', __("Dear user,
</del><ins>+        $content = apply_filters( 'new_admin_email_content', __( "Dear user,
</ins><span class="cx">
</span><span class="cx"> You recently requested to have the administration email address on
</span><span class="cx"> your site changed.
</span><span class="lines">@@ -273,45 +287,45 @@
</span><span class="cx">
</span><span class="cx"> Regards,
</span><span class="cx"> All at ###SITENAME###
</span><del>-###SITEURL###"), $new_admin_email );
</del><ins>+###SITEURL### "), $new_admin_email );
</ins><span class="cx">
</span><del>-        $content = str_replace('###ADMIN_URL###', esc_url(admin_url('options.php?adminhash='.$hash)), $content);
-        $content = str_replace('###EMAIL###', $value, $content);
-        $content = str_replace('###SITENAME###', get_site_option( 'site_name' ), $content);
-        $content = str_replace('###SITEURL###', network_home_url(), $content);
</del><ins>+        $content = str_replace( '###ADMIN_URL###', esc_url( admin_url( 'options.php?adminhash='.$hash ) ), $content );
+        $content = str_replace( '###EMAIL###', $value, $content );
+        $content = str_replace( '###SITENAME###', get_site_option( 'site_name' ), $content );
+        $content = str_replace( '###SITEURL###', network_home_url(), $content );
</ins><span class="cx">
</span><del>-        wp_mail( $value, sprintf(__('[%s] New Admin Email Address'), get_option('blogname')), $content );
</del><ins>+        wp_mail( $value, sprintf( __( '[%s] New Admin Email Address' ), get_option( 'blogname' ) ), $content );
</ins><span class="cx"> }
</span><del>-add_action('update_option_new_admin_email', 'update_option_new_admin_email', 10, 2);
</del><ins>+add_action( 'update_option_new_admin_email', 'update_option_new_admin_email', 10, 2 );
</ins><span class="cx">
</span><span class="cx"> function send_confirmation_on_profile_email() {
</span><span class="cx">         global $errors, $wpdb, $current_user;
</span><span class="cx">         if ( ! is_object($errors) )
</span><span class="cx">                 $errors = new WP_Error();
</span><span class="cx">
</span><del>-        if ( $current_user->id != $_POST[ 'user_id' ] )
</del><ins>+        if ( $current_user->id != $_POST['user_id'] )
</ins><span class="cx">                 return false;
</span><span class="cx">
</span><del>-        if ( $current_user->user_email != $_POST[ 'email' ] ) {
-                if ( !is_email( $_POST[ 'email' ] ) ) {
</del><ins>+        if ( $current_user->user_email != $_POST['email'] ) {
+                if ( !is_email( $_POST['email'] ) ) {
</ins><span class="cx">                         $errors->add( 'user_email', __( "<strong>ERROR</strong>: The e-mail address isn't correct." ), array( 'form-field' => 'email' ) );
</span><span class="cx">                         return;
</span><span class="cx">                 }
</span><span class="cx">
</span><del>-                if ( $wpdb->get_var( $wpdb->prepare( "SELECT user_email FROM {$wpdb->users} WHERE user_email=%s", $_POST[ 'email' ] ) ) ) {
</del><ins>+                if ( $wpdb->get_var( $wpdb->prepare( "SELECT user_email FROM {$wpdb->users} WHERE user_email=%s", $_POST['email'] ) ) ) {
</ins><span class="cx">                         $errors->add( 'user_email', __( "<strong>ERROR</strong>: The e-mail address is already used." ), array( 'form-field' => 'email' ) );
</span><span class="cx">                         delete_option( $current_user->ID . '_new_email' );
</span><span class="cx">                         return;
</span><span class="cx">                 }
</span><span class="cx">
</span><del>-                $hash = md5( $_POST[ 'email' ] . time() . mt_rand() );
</del><ins>+                $hash = md5( $_POST['email'] . time() . mt_rand() );
</ins><span class="cx">                 $new_user_email = array(
</span><del>-                                "hash" => $hash,
-                                "newemail" => $_POST[ 'email' ]
</del><ins>+                                'hash' => $hash,
+                                'newemail' => $_POST['email']
</ins><span class="cx">                                 );
</span><span class="cx">                 update_option( $current_user->ID . '_new_email', $new_user_email );
</span><span class="cx">
</span><del>-                $content = apply_filters( 'new_user_email_content', __("Dear user,
</del><ins>+                $content = apply_filters( 'new_user_email_content', __( "Dear user,
</ins><span class="cx">
</span><span class="cx"> You recently requested to have the email address on your account changed.
</span><span class="cx"> If this is correct, please click on the following link to change it:
</span><span class="lines">@@ -324,23 +338,23 @@
</span><span class="cx">
</span><span class="cx"> Regards,
</span><span class="cx"> All at ###SITENAME###
</span><del>-###SITEURL###"), $new_user_email );
</del><ins>+###SITEURL###" ), $new_user_email );
</ins><span class="cx">
</span><del>-                $content = str_replace('###ADMIN_URL###', esc_url(admin_url('profile.php?newuseremail='.$hash)), $content);
-                $content = str_replace('###EMAIL###', $_POST[ 'email' ], $content);
-                $content = str_replace('###SITENAME###', get_site_option( 'site_name' ), $content);
-                $content = str_replace('###SITEURL###', network_home_url(), $content);
</del><ins>+                $content = str_replace( '###ADMIN_URL###', esc_url( admin_url( 'profile.php?newuseremail='.$hash ) ), $content );
+                $content = str_replace( '###EMAIL###', $_POST['email'], $content);
+                $content = str_replace( '###SITENAME###', get_site_option( 'site_name' ), $content );
+                $content = str_replace( '###SITEURL###', network_home_url(), $content );
</ins><span class="cx">
</span><del>-                wp_mail( $_POST[ 'email' ], sprintf(__('[%s] New Email Address'), get_option('blogname')), $content );
-                $_POST[ 'email' ] = $current_user->user_email;
</del><ins>+                wp_mail( $_POST['email'], sprintf( __( '[%s] New Email Address' ), get_option( 'blogname' ) ), $content );
+                $_POST['email'] = $current_user->user_email;
</ins><span class="cx">         }
</span><span class="cx"> }
</span><span class="cx"> add_action( 'personal_options_update', 'send_confirmation_on_profile_email' );
</span><span class="cx">
</span><span class="cx"> function new_user_email_admin_notice() {
</span><span class="cx">         global $current_user;
</span><del>-        if ( strpos( $_SERVER['PHP_SELF'], 'profile.php' ) && isset( $_GET[ 'updated' ] ) && $email = get_option( $current_user->ID . '_new_email' ) )
-                echo "<div id='update-nag'>" . sprintf( __( "Your email address has not been updated yet. Please check your inbox at %s for a confirmation email." ), $email[ 'newemail' ] ) . "</div>";
</del><ins>+        if ( strpos( $_SERVER['PHP_SELF'], 'profile.php' ) && isset( $_GET['updated'] ) && $email = get_option( $current_user->ID . '_new_email' ) )
+                echo "<div id='update-nag'>" . sprintf( __( "Your email address has not been updated yet. Please check your inbox at %s for a confirmation email." ), $email['newemail'] ) . "</div>";
</ins><span class="cx"> }
</span><span class="cx"> add_action( 'admin_notices', 'new_user_email_admin_notice' );
</span><span class="cx">
</span><span class="lines">@@ -348,12 +362,12 @@
</span><span class="cx">         $themes = get_themes();
</span><span class="cx">         $allowed_themes = get_site_option( 'allowedthemes' );
</span><span class="cx">         if ( !is_array( $allowed_themes ) || empty( $allowed_themes ) ) {
</span><del>-                $allowed_themes = get_site_option( "allowed_themes" ); // convert old allowed_themes format
</del><ins>+                $allowed_themes = get_site_option( 'allowed_themes' ); // convert old allowed_themes format
</ins><span class="cx">                 if ( !is_array( $allowed_themes ) ) {
</span><span class="cx">                         $allowed_themes = array();
</span><span class="cx">                 } else {
</span><span class="cx">                         foreach( (array) $themes as $key => $theme ) {
</span><del>-                                $theme_key = esc_html( $theme[ 'Stylesheet' ] );
</del><ins>+                                $theme_key = esc_html( $theme['Stylesheet'] );
</ins><span class="cx">                                 if ( isset( $allowed_themes[ $key ] ) == true ) {
</span><span class="cx">                                         $allowedthemes[ $theme_key ] = 1;
</span><span class="cx">                                 }
</span><span class="lines">@@ -376,25 +390,25 @@
</span><span class="cx">         $space_allowed = get_space_allowed();
</span><span class="cx">
</span><span class="cx">         $dir_name = trailingslashit( BLOGUPLOADDIR );
</span><del>-        if ( !(is_dir($dir_name) && is_readable($dir_name)) )
</del><ins>+        if ( !( is_dir( $dir_name) && is_readable( $dir_name ) ) )
</ins><span class="cx">                 return true;
</span><span class="cx">
</span><del>-         $dir = dir($dir_name);
</del><ins>+         $dir = dir( $dir_name );
</ins><span class="cx">         $size = 0;
</span><span class="cx">
</span><span class="cx">         while ( $file = $dir->read() ) {
</span><span class="cx">                 if ( $file != '.' && $file != '..' ) {
</span><span class="cx">                         if ( is_dir( $dir_name . $file) ) {
</span><del>-                                $size += get_dirsize($dir_name . $file);
</del><ins>+                                $size += get_dirsize( $dir_name . $file );
</ins><span class="cx">                         } else {
</span><del>-                                $size += filesize($dir_name . $file);
</del><ins>+                                $size += filesize( $dir_name . $file );
</ins><span class="cx">                         }
</span><span class="cx">                 }
</span><span class="cx">         }
</span><span class="cx">         $dir->close();
</span><span class="cx">         $size = $size / 1024 / 1024;
</span><span class="cx">
</span><del>-        if ( ($space_allowed - $size) <= 0 )
</del><ins>+        if ( ( $space_allowed - $size ) <= 0 )
</ins><span class="cx">                 return false;
</span><span class="cx">
</span><span class="cx">         return true;
</span><span class="lines">@@ -406,10 +420,10 @@
</span><span class="cx"> * @return int Quota
</span><span class="cx"> */
</span><span class="cx"> function get_space_allowed() {
</span><del>-        $space_allowed = get_option('blog_upload_space');
</del><ins>+        $space_allowed = get_option( 'blog_upload_space' );
</ins><span class="cx">         if ( $space_allowed == false )
</span><del>-                $space_allowed = get_site_option('blog_upload_space');
-        if ( empty($space_allowed) || !is_numeric($space_allowed) )
</del><ins>+                $space_allowed = get_site_option( 'blog_upload_space' );
+        if ( empty( $space_allowed ) || !is_numeric( $space_allowed ) )
</ins><span class="cx">                 $space_allowed = 50;
</span><span class="cx">
</span><span class="cx">         return $space_allowed;
</span><span class="lines">@@ -417,7 +431,7 @@
</span><span class="cx">
</span><span class="cx"> function display_space_usage() {
</span><span class="cx">         $space = get_space_allowed();
</span><del>-        $used = get_dirsize( BLOGUPLOADDIR )/1024/1024;
</del><ins>+        $used = get_dirsize( BLOGUPLOADDIR ) / 1024 / 1024;
</ins><span class="cx">
</span><span class="cx">         if ( $used > $space )
</span><span class="cx">                 $percentused = '100';
</span><span class="lines">@@ -426,12 +440,12 @@
</span><span class="cx">
</span><span class="cx">         if ( $space > 1000 ) {
</span><span class="cx">                 $space = number_format( $space / 1024 );
</span><del>-                $space .= __('GB');
</del><ins>+                $space .= __( 'GB' );
</ins><span class="cx">         } else {
</span><del>-                $space .= __('MB');
</del><ins>+                $space .= __( 'MB' );
</ins><span class="cx">         }
</span><span class="cx">         ?>
</span><del>-        <strong><?php printf(__('Used: %1s%% of %2s'), number_format($percentused), $space );?></strong>
</del><ins>+        <strong><?php printf( __( 'Used: %1s%% of %2s' ), number_format( $percentused ), $space );?></strong>
</ins><span class="cx">         <?php
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -441,47 +455,54 @@
</span><span class="cx">                 return true;
</span><span class="cx">
</span><span class="cx">         $quota = get_space_allowed();
</span><del>-        $used = get_dirsize( BLOGUPLOADDIR )/1024/1024;
</del><ins>+        $used = get_dirsize( BLOGUPLOADDIR ) / 1024 / 1024;
</ins><span class="cx">
</span><span class="cx">         if ( $used > $quota )
</span><span class="cx">                 $percentused = '100';
</span><span class="cx">         else
</span><span class="cx">                 $percentused = ( $used / $quota ) * 100;
</span><del>-        $used_color = ( $percentused < 70 ) ? ( ( $percentused >= 40 ) ? 'waiting' : 'approved') : 'spam';
</del><ins>+        $used_color = ( $percentused < 70 ) ? ( ( $percentused >= 40 ) ? 'waiting' : 'approved' ) : 'spam';
</ins><span class="cx">         $used = round( $used, 2 );
</span><span class="cx">         $percentused = number_format( $percentused );
</span><span class="cx">
</span><span class="cx">         ?>
</span><del>-        <p class="sub musub"><?php _e('Storage Space'); ?></p>
-        <div class="table">
</del><ins>+        <p class="sub musub"><?php _e( 'Storage Space' ); ?></p>
+        <div class="table table_content musubtable">
</ins><span class="cx">         <table>
</span><span class="cx">                 <tr class="first">
</span><del>-                        <td class="first b b-posts"><?php printf( __( '<a href="upload.php" title="Manage Uploads" class="musublink">%sMB</a>' ), $quota ); ?></td>
-                        <td class="t posts"><?php _e('Space Allowed'); ?></td>
-                        <td class="b b-comments"><?php printf( __( '<a href="upload.php" title="Manage Uploads" class="musublink">%1sMB (%2$s%%)</a>' ), $used, $percentused ); ?></td>
-                        <td class="last t comments <?php echo $used_color;?>"><?php _e('Space Used');?></td>
</del><ins>+                        <td class="first b b-posts"><?php printf( __( '<a href="' . esc_url( admin_url( 'upload.php' ) ) . '" title="Manage Uploads" class="musublink">%sMB</a>' ), $quota ); ?></td>
+                        <td class="t posts"><?php _e( 'Space Allowed' ); ?></td>
</ins><span class="cx">                 </tr>
</span><span class="cx">         </table>
</span><span class="cx">         </div>
</span><ins>+        <div class="table table_discussion musubtable">
+        <table>
+                <tr class="first">
+                        <td class="b b-comments"><?php printf( __( '<a href="' . esc_url( admin_url( 'upload.php' ) ) . '" title="Manage Uploads" class="musublink">%1sMB (%2$s%%)</a>' ), $used, $percentused ); ?></td>
+                        <td class="last t comments <?php echo $used_color;?>"><?php _e( 'Space Used' );?></td>
+                </tr>
+        </table>
+        </div>
+        <br class="clear" />
</ins><span class="cx">         <?php
</span><span class="cx"> }
</span><del>-if ( current_user_can('edit_posts') )
-        add_action('activity_box_end', 'dashboard_quota');
</del><ins>+if ( current_user_can( 'edit_posts' ) )
+        add_action( 'activity_box_end', 'dashboard_quota' );
</ins><span class="cx">
</span><span class="cx"> // Edit blog upload space setting on Edit Blog page
</span><span class="cx"> function upload_space_setting( $id ) {
</span><del>-        $quota = get_blog_option($id, "blog_upload_space");
</del><ins>+        $quota = get_blog_option( $id, 'blog_upload_space' );
</ins><span class="cx">         if ( !$quota )
</span><span class="cx">                 $quota = '';
</span><span class="cx">
</span><span class="cx">         ?>
</span><span class="cx">         <tr>
</span><del>-                <th><?php _e('Site Upload Space Quota'); ?></th>
-                <td><input type="text" size="3" name="option[blog_upload_space]" value="<?php echo $quota; ?>" /><?php _e('MB (Leave blank for network default)'); ?></td>
</del><ins>+                <th><?php _e( 'Site Upload Space Quota '); ?></th>
+                <td><input type="text" size="3" name="option[blog_upload_space]" value="<?php echo $quota; ?>" /> <?php _e( 'MB (Leave blank for network default)' ); ?></td>
</ins><span class="cx">         </tr>
</span><span class="cx">         <?php
</span><span class="cx"> }
</span><del>-add_action('wpmueditblogaction', 'upload_space_setting');
</del><ins>+add_action( 'wpmueditblogaction', 'upload_space_setting' );
</ins><span class="cx">
</span><span class="cx"> function update_user_status( $id, $pref, $value, $refresh = 1 ) {
</span><span class="cx">         global $wpdb;
</span><span class="lines">@@ -489,34 +510,44 @@
</span><span class="cx">         $wpdb->update( $wpdb->users, array( $pref => $value ), array( 'ID' => $id ) );
</span><span class="cx">
</span><span class="cx">         if ( $refresh == 1 )
</span><del>-                refresh_user_details($id);
</del><ins>+                refresh_user_details( $id );
</ins><span class="cx">
</span><span class="cx">         if ( $pref == 'spam' ) {
</span><span class="cx">                 if ( $value == 1 )
</span><del>-                        do_action( "make_spam_user", $id );
</del><ins>+                        do_action( 'make_spam_user', $id );
</ins><span class="cx">                 else
</span><del>-                        do_action( "make_ham_user", $id );
</del><ins>+                        do_action( 'make_ham_user', $id );
</ins><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         return $value;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-function refresh_user_details($id) {
</del><ins>+function refresh_user_details( $id ) {
</ins><span class="cx">         $id = (int) $id;
</span><span class="cx">
</span><span class="cx">         if ( !$user = get_userdata( $id ) )
</span><span class="cx">                 return false;
</span><span class="cx">
</span><del>-        clean_user_cache($id);
</del><ins>+        clean_user_cache( $id );
</ins><span class="cx">
</span><span class="cx">         return $id;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> function format_code_lang( $code = '' ) {
</span><del>-        $code = strtolower(substr($code, 0, 2));
-        $lang_codes = array('aa' => 'Afar', 'ab' => 'Abkhazian', 'af' => 'Afrikaans', 'ak' => 'Akan', 'sq' => 'Albanian', 'am' => 'Amharic', 'ar' => 'Arabic', 'an' => 'Aragonese', 'hy' => 'Armenian', 'as' => 'Assamese', 'av' => 'Avaric', 'ae' => 'Avestan', 'ay' => 'Aymara', 'az' => 'Azerbaijani', 'ba' => 'Bashkir', 'bm' => 'Bambara', 'eu' => 'Basque', 'be' => 'Belarusian', 'bn' => 'Bengali', 'bh' => 'Bihari', 'bi' => 'Bislama', 'bs' => 'Bosnian', 'br' => 'Breton', 'bg' => 'Bulgarian', 'my' => 'Burmese', 'ca' => 'Catalan; Valencian', 'ch' => 'Chamorro', 'ce' => 'Chechen', 'zh' => 'Chinese', 'cu' => 'Church Slavic; Old Slavonic; Church Slavonic; Old Bulgarian; Old Church Slavonic', 'cv' => 'Chuvash', 'kw' => 'Cornish', 'co' => 'Corsican', 'cr' => 'Cree', 'cs' => 'Czech', 'da' => 'Danish', 'dv' => 'Divehi; Dhivehi; Maldivian', 'nl' => 'Dutch; Flemish', 'dz' => 'Dzongkha', 'en' => 'English', 'eo' => 'Esperanto', 'et' => 'Estonian', 'ee' => 'Ewe', 'fo' => 'Faroese', 'fj' => 'Fijian', 'fi' => 'Finnish', 'fr' => 'French', 'fy' => 'Western Frisian', 'ff' => 'Fulah', 'ka' => 'Georgian', 'de' => 'German', 'gd' => 'Gaelic; Scottish Gaelic', 'ga' => 'Irish', 'gl' => 'Galician', 'gv' => 'Manx', 'el' => 'Greek, Modern', 'gn' => 'Guarani', 'gu' => 'Gujarati', 'ht' => 'Haitian; Haitian Creole', 'ha' => 'Hausa', 'he' => 'Hebrew', 'hz' => 'Herero', 'hi' => 'Hindi', 'ho' => 'Hiri Motu', 'hu' => 'Hungarian', 'ig' => 'Igbo', 'is' => 'Icelandic', 'io' => 'Ido', 'ii' => 'Sichuan Yi', 'iu' => 'Inuktitut', 'ie' => 'Interlingue', 'ia' => 'Interlingua (International Auxiliary Language Association)', 'id' => 'Indonesian', 'ik' => 'Inupiaq', 'it' => 'Italian', 'jv' => 'Javanese', 'ja' => 'Japanese', 'kl' => 'Kalaallisut; Greenlandic', 'kn' => 'Kannada', 'ks' => 'Kashmiri', 'kr' => 'Kanuri', 'kk' => 'Kazakh', 'km' => 'Central Khmer', 'ki' => 'Kikuyu; Gikuyu', 'rw' => 'Kinyarwanda', 'ky' => 'Kirghiz; Kyrgyz', 'kv' => 'Komi', 'kg' => 'Kongo', 'ko' => 'Korean', 'kj' => 'Kuanyama; Kwanyama', 'ku' => 'Kurdish', 'lo' => 'Lao', 'la' => 'Latin', 'lv' => 'Latvian', 'li' => 'Limburgan; Limburger; Limburgish', 'ln' => 'Lingala', 'lt' => 'Lithuanian', 'lb' => 'Luxembourgish; Letzeburgesch', 'lu' => 'Luba-Katanga', 'lg' => 'Ganda', 'mk' => 'Macedonian', 'mh' => 'Marshallese', 'ml' => 'Malayalam', 'mi' => 'Maori', 'mr' => 'Marathi', 'ms' => 'Malay', 'mg' => 'Malagasy', 'mt' => 'Maltese', 'mo' => 'Moldavian', 'mn' => 'Mongolian', 'na' => 'Nauru', 'nv' => 'Navajo; Navaho', 'nr' => 'Ndebele, South; South Ndebele', 'nd' => 'Ndebele, North; North Ndebele', 'ng' => 'Ndonga', 'ne' => 'Nepali', 'nn' => 'Norwegian Nynorsk; Nynorsk, Norwegian', 'nb' => 'BokmÃ¥l, Norwegian, Norwegian BokmÃ¥l', 'no' => 'Norwegian', 'ny' => 'Chichewa; Chewa; Nyanja', 'oc' => 'Occitan, Provençal', 'oj' => 'Ojibwa', 'or' => 'Oriya', 'om' => 'Oromo', 'os' => 'Ossetian; Ossetic', 'pa' => 'Panjabi; Punjabi', 'fa' => 'Persian', 'pi' => 'Pali', 'pl' => 'Polish', 'pt' => 'Portuguese', 'ps' => 'Pushto', 'qu' => 'Quechua', 'rm' => 'Romansh', 'ro' => 'Romanian', 'rn' => 'Rundi', 'ru' => 'Russian', 'sg' => 'Sango', 'sa' => 'Sanskrit', 'sr' => 'Serbian', 'hr' => 'Croatian', 'si' => 'Sinhala; Sinhalese', 'sk' => 'Slovak', 'sl' => 'Slovenian', 'se' => 'Northern Sami', 'sm' => 'Samoan', 'sn' => 'Shona', 'sd' => 'Sindhi', 'so' => 'Somali', 'st' => 'Sotho, Southern', 'es' => 'Spanish; Castilian', 'sc' => 'Sardinian', 'ss' => 'Swati', 'su' => 'Sundanese', 'sw' => 'Swahili', 'sv' => 'Swedish', 'ty' => 'Tahitian', 'ta' => 'Tamil', 'tt' => 'Tatar', 'te' => 'Telugu', 'tg' => 'Tajik', 'tl' => 'Tagalog', 'th' => 'Thai', 'bo' => 'Tibetan', 'ti' => 'Tigrinya', 'to' => 'Tonga (Tonga Islands)', 'tn' => 'Tswana', 'ts' => 'Tsonga', 'tk' => 'Turkmen', 'tr' => 'Turkish', 'tw' => 'Twi', 'ug' => 'Uighur; Uyghur', 'uk' => 'Ukrainian', 'ur' => 'Urdu', 'uz' => 'Uzbek', 've' => 'Venda', 'vi' => 'Vietnamese', 'vo' => 'Volapük', 'cy' => 'Welsh', 'wa' => 'Walloon'
-, 'wo' => 'Wolof', 'xh' => 'Xhosa', 'yi' => 'Yiddish', 'yo' => 'Yoruba', 'za' => 'Zhuang; Chuang', 'zu' => 'Zulu');
-        $lang_codes = apply_filters('lang_codes', $lang_codes, $code);
</del><ins>+        $code = strtolower( substr( $code, 0, 2 ) );
+        $lang_codes = array(
+                'aa' => 'Afar', 'ab' => 'Abkhazian', 'af' => 'Afrikaans', 'ak' => 'Akan', 'sq' => 'Albanian', 'am' => 'Amharic', 'ar' => 'Arabic', 'an' => 'Aragonese', 'hy' => 'Armenian', 'as' => 'Assamese', 'av' => 'Avaric', 'ae' => 'Avestan', 'ay' => 'Aymara', 'az' => 'Azerbaijani', 'ba' => 'Bashkir', 'bm' => 'Bambara', 'eu' => 'Basque', 'be' => 'Belarusian', 'bn' => 'Bengali',
+                'bh' => 'Bihari', 'bi' => 'Bislama', 'bs' => 'Bosnian', 'br' => 'Breton', 'bg' => 'Bulgarian', 'my' => 'Burmese', 'ca' => 'Catalan; Valencian', 'ch' => 'Chamorro', 'ce' => 'Chechen', 'zh' => 'Chinese', 'cu' => 'Church Slavic; Old Slavonic; Church Slavonic; Old Bulgarian; Old Church Slavonic', 'cv' => 'Chuvash', 'kw' => 'Cornish', 'co' => 'Corsican', 'cr' => 'Cree',
+                'cs' => 'Czech', 'da' => 'Danish', 'dv' => 'Divehi; Dhivehi; Maldivian', 'nl' => 'Dutch; Flemish', 'dz' => 'Dzongkha', 'en' => 'English', 'eo' => 'Esperanto', 'et' => 'Estonian', 'ee' => 'Ewe', 'fo' => 'Faroese', 'fj' => 'Fijjian', 'fi' => 'Finnish', 'fr' => 'French', 'fy' => 'Western Frisian', 'ff' => 'Fulah', 'ka' => 'Georgian', 'de' => 'German', 'gd' => 'Gaelic; Scottish Gaelic',
+                'ga' => 'Irish', 'gl' => 'Galician', 'gv' => 'Manx', 'el' => 'Greek, Modern', 'gn' => 'Guarani', 'gu' => 'Gujarati', 'ht' => 'Haitian; Haitian Creole', 'ha' => 'Hausa', 'he' => 'Hebrew', 'hz' => 'Herero', 'hi' => 'Hindi', 'ho' => 'Hiri Motu', 'hu' => 'Hungarian', 'ig' => 'Igbo', 'is' => 'Icelandic', 'io' => 'Ido', 'ii' => 'Sichuan Yi', 'iu' => 'Inuktitut', 'ie' => 'Interlingue',
+                'ia' => 'Interlingua (International Auxiliary Language Association)', 'id' => 'Indonesian', 'ik' => 'Inupiaq', 'it' => 'Italian', 'jv' => 'Javanese', 'ja' => 'Japanese', 'kl' => 'Kalaallisut; Greenlandic', 'kn' => 'Kannada', 'ks' => 'Kashmiri', 'kr' => 'Kanuri', 'kk' => 'Kazakh', 'km' => 'Central Khmer', 'ki' => 'Kikuyu; Gikuyu', 'rw' => 'Kinyarwanda', 'ky' => 'Kirghiz; Kyrgyz',
+                'kv' => 'Komi', 'kg' => 'Kongo', 'ko' => 'Korean', 'kj' => 'Kuanyama; Kwanyama', 'ku' => 'Kurdish', 'lo' => 'Lao', 'la' => 'Latin', 'lv' => 'Latvian', 'li' => 'Limburgan; Limburger; Limburgish', 'ln' => 'Lingala', 'lt' => 'Lithuanian', 'lb' => 'Luxembourgish; Letzeburgesch', 'lu' => 'Luba-Katanga', 'lg' => 'Ganda', 'mk' => 'Macedonian', 'mh' => 'Marshallese', 'ml' => 'Malayalam',
+                'mi' => 'Maori', 'mr' => 'Marathi', 'ms' => 'Malay', 'mg' => 'Malagasy', 'mt' => 'Maltese', 'mo' => 'Moldavian', 'mn' => 'Mongolian', 'na' => 'Nauru', 'nv' => 'Navajo; Navaho', 'nr' => 'Ndebele, South; South Ndebele', 'nd' => 'Ndebele, North; North Ndebele', 'ng' => 'Ndonga', 'ne' => 'Nepali', 'nn' => 'Norwegian Nynorsk; Nynorsk, Norwegian', 'nb' => 'BokmÃ¥l, Norwegian, Norwegian BokmÃ¥l',
+                'no' => 'Norwegian', 'ny' => 'Chichewa; Chewa; Nyanja', 'oc' => 'Occitan, Provençal', 'oj' => 'Ojibwa', 'or' => 'Oriya', 'om' => 'Oromo', 'os' => 'Ossetian; Ossetic', 'pa' => 'Panjabi; Punjabi', 'fa' => 'Persian', 'pi' => 'Pali', 'pl' => 'Polish', 'pt' => 'Portuguese', 'ps' => 'Pushto', 'qu' => 'Quechua', 'rm' => 'Romansh', 'ro' => 'Romanian', 'rn' => 'Rundi', 'ru' => 'Russian',
+                'sg' => 'Sango', 'sa' => 'Sanskrit', 'sr' => 'Serbian', 'hr' => 'Croatian', 'si' => 'Sinhala; Sinhalese', 'sk' => 'Slovak', 'sl' => 'Slovenian', 'se' => 'Northern Sami', 'sm' => 'Samoan', 'sn' => 'Shona', 'sd' => 'Sindhi', 'so' => 'Somali', 'st' => 'Sotho, Southern', 'es' => 'Spanish; Castilian', 'sc' => 'Sardinian', 'ss' => 'Swati', 'su' => 'Sundanese', 'sw' => 'Swahili',
+                'sv' => 'Swedish', 'ty' => 'Tahitian', 'ta' => 'Tamil', 'tt' => 'Tatar', 'te' => 'Telugu', 'tg' => 'Tajik', 'tl' => 'Tagalog', 'th' => 'Thai', 'bo' => 'Tibetan', 'ti' => 'Tigrinya', 'to' => 'Tonga (Tonga Islands)', 'tn' => 'Tswana', 'ts' => 'Tsonga', 'tk' => 'Turkmen', 'tr' => 'Turkish', 'tw' => 'Twi', 'ug' => 'Uighur; Uyghur', 'uk' => 'Ukrainian', 'ur' => 'Urdu', 'uz' => 'Uzbek',
+                've' => 'Venda', 'vi' => 'Vietnamese', 'vo' => 'Volapük', 'cy' => 'Welsh','wa' => 'Walloon','wo' => 'Wolof', 'xh' => 'Xhosa', 'yi' => 'Yiddish', 'yo' => 'Yoruba', 'za' => 'Zhuang; Chuang', 'zu' => 'Zulu' );
+        $lang_codes = apply_filters( 'lang_codes', $lang_codes, $code );
</ins><span class="cx">         return strtr( $code, $lang_codes );
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -525,7 +556,7 @@
</span><span class="cx">                 if ( is_object( $term ) ) {
</span><span class="cx">                         $term->slug = sanitize_title( $term->name );
</span><span class="cx">                 } else {
</span><del>-                        $term[ 'slug' ] = sanitize_title( $term[ 'name' ] );
</del><ins>+                        $term['slug'] = sanitize_title( $term['name'] );
</ins><span class="cx">                 }
</span><span class="cx">         }
</span><span class="cx">         return $term;
</span><span class="lines">@@ -535,8 +566,8 @@
</span><span class="cx"> function redirect_user_to_blog() {
</span><span class="cx">         global $current_user;
</span><span class="cx">         $c = 0;
</span><del>-        if ( isset( $_GET[ 'c' ] ) )
-                $c = (int)$_GET[ 'c' ];
</del><ins>+        if ( isset( $_GET['c'] ) )
+                $c = (int) $_GET['c'];
</ins><span class="cx">
</span><span class="cx">         if ( $c >= 5 ) {
</span><span class="cx">                 wp_die( __( "You don&#8217;t have permission to view this site. Please contact the system administrator." ) );
</span><span class="lines">@@ -546,7 +577,7 @@
</span><span class="cx">         $blog = get_active_blog_for_user( $current_user->ID );
</span><span class="cx">         $dashboard_blog = get_dashboard_blog();
</span><span class="cx">         if ( is_object( $blog ) ) {
</span><del>-                wp_redirect( get_admin_url($blog->blog_id, '?c=' . $c) ); // redirect and count to 5, "just in case"
</del><ins>+                wp_redirect( get_admin_url( $blog->blog_id, '?c=' . $c ) ); // redirect and count to 5, "just in case"
</ins><span class="cx">                 exit;
</span><span class="cx">         }
</span><span class="cx">
</span><span class="lines">@@ -564,8 +595,7 @@
</span><span class="cx">                         }
</span><span class="cx">                 }
</span><span class="cx">                 $blog = get_blog_details( get_user_meta( $current_user->ID, 'primary_blog', true ) );
</span><del>-                $protocol = ( is_ssl() ? 'https://' : 'http://' );
-                wp_redirect( $protocol . $blog->domain . $blog->path . 'wp-admin/?c=' . $c ); // redirect and count to 5, "just in case"
</del><ins>+                        wp_redirect( get_admin_url( $blog->blog_id, '?c=' . $c ) );
</ins><span class="cx">                 exit;
</span><span class="cx">         }
</span><span class="cx">         wp_die( __( 'You do not have sufficient permissions to access this page.' ) );
</span><span class="lines">@@ -589,28 +619,27 @@
</span><span class="cx">
</span><span class="cx">                 if ( $code_lang == 'en_US' ) { // American English
</span><span class="cx">                         $flag = true;
</span><del>-                        $ae = __('American English');
-                        $output[$ae] = '<option value="'.$code_lang.'"'.(($current == $code_lang) ? ' selected="selected"' : '').'> '.$ae.'</option>';
</del><ins>+                        $ae = __( 'American English' );
+                        $output[$ae] = '<option value="' . esc_attr( $code_lang ) . '"' . selected( $current, $code_lang ) . '> ' . $ae . '</option>';
</ins><span class="cx">                 } elseif ( $code_lang == 'en_GB' ) { // British English
</span><span class="cx">                         $flag = true;
</span><del>-                        $be = __('British English');
-                        $output[$be] = '<option value="'.$code_lang.'"'.(($current == $code_lang) ? ' selected="selected"' : '').'> '.$be.'</option>';
</del><ins>+                        $be = __( 'British English' );
+                        $output[$be] = '<option value="' . esc_attr( $code_lang ) . '"' . selected( $current, $code_lang ) . '> ' . $be . '</option>';
</ins><span class="cx">                 } else {
</span><del>-                        $translated = format_code_lang($code_lang);
-                        $output[$translated] = '<option value="'.$code_lang.'"'.(($current == $code_lang) ? ' selected="selected"' : '').'> '.$translated.'</option>';
</del><ins>+                        $translated = format_code_lang( $code_lang );
+                        $output[$translated] = '<option value="' . esc_attr( $code_lang ) . '"' . selected( $current, $code_lang ) . '> ' . esc_html ( $translated ) . '</option>';
</ins><span class="cx">                 }
</span><span class="cx">
</span><span class="cx">         }
</span><span class="cx">
</span><del>-        if ( $flag === false ) { // WordPress english
-                $output[] = '<option value=""'.((empty($current)) ? ' selected="selected"' : '').'>'.__('English')."</option>";
-        }
</del><ins>+        if ( $flag === false ) // WordPress english
+                $output[] = '<option value=""' . selected( $current, '' ) . '>' . __( 'English' ) . "</option>";
</ins><span class="cx">
</span><span class="cx">         // Order by name
</span><del>-        uksort($output, 'strnatcasecmp');
</del><ins>+        uksort( $output, 'strnatcasecmp' );
</ins><span class="cx">
</span><del>-        $output = apply_filters('mu_dropdown_languages', $output, $lang_files, $current);
-        echo implode("\n\t", $output);
</del><ins>+        $output = apply_filters( 'mu_dropdown_languages', $output, $lang_files, $current );
+        echo implode( "\n\t", $output );
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /* Warn the admin if SECRET SALT information is missing from wp-config.php */
</span><span class="lines">@@ -637,8 +666,8 @@
</span><span class="cx">         if ( $current_screen->id != 'dashboard' )
</span><span class="cx">                 return;
</span><span class="cx">
</span><del>-        if ( !empty( $_GET[ 'feed_dismiss' ] ) )
-                update_user_option( $current_user->id, 'admin_feed_dismiss', $_GET[ 'feed_dismiss' ], true );
</del><ins>+        if ( !empty( $_GET['feed_dismiss'] ) )
+                update_user_option( $current_user->id, 'admin_feed_dismiss', $_GET['feed_dismiss'], true );
</ins><span class="cx">
</span><span class="cx">         $url = get_site_option( 'admin_notice_feed' );
</span><span class="cx">         if ( empty( $url ) )
</span><span class="lines">@@ -666,28 +695,28 @@
</span><span class="cx">         if ( !is_super_admin() )
</span><span class="cx">                 return false;
</span><span class="cx">         if ( get_site_option( 'wpmu_upgrade_site' ) != $wp_db_version )
</span><del>-                echo "<div id='update-nag'>" . __( 'Thank you for Updating! Please visit the <a href="ms-upgrade-network.php">Update Network</a> page to update all your sites.' ) . "</div>";
</del><ins>+                echo "<div id='update-nag'>" . sprintf( __( 'Thank you for Updating! Please visit the <a href="%s">Update Network</a> page to update all your sites.' ), esc_url( admin_url( 'ms-upgrade-network.php' ) ) ) . "</div>";
</ins><span class="cx"> }
</span><span class="cx"> add_action( 'admin_notices', 'site_admin_notice' );
</span><span class="cx">
</span><span class="cx"> function avoid_blog_page_permalink_collision( $data, $postarr ) {
</span><span class="cx">         if ( is_subdomain_install() )
</span><span class="cx">                 return $data;
</span><del>-        if ( $data[ 'post_type' ] != 'page' )
</del><ins>+        if ( $data['post_type'] != 'page' )
</ins><span class="cx">                 return $data;
</span><del>-        if ( !isset( $data[ 'post_name' ] ) || $data[ 'post_name' ] == '' )
</del><ins>+        if ( !isset( $data['post_name'] ) || $data['post_name'] == '' )
</ins><span class="cx">                 return $data;
</span><span class="cx">         if ( !is_main_site() )
</span><span class="cx">                 return $data;
</span><span class="cx">
</span><del>-        $post_name = $data[ 'post_name' ];
</del><ins>+        $post_name = $data['post_name'];
</ins><span class="cx">         $c = 0;
</span><span class="cx">         while( $c < 10 && get_id_from_blogname( $post_name ) ) {
</span><span class="cx">                 $post_name .= mt_rand( 1, 10 );
</span><span class="cx">                 $c ++;
</span><span class="cx">         }
</span><del>-        if ( $post_name != $data[ 'post_name' ] ) {
-                $data[ 'post_name' ] = $post_name;
</del><ins>+        if ( $post_name != $data['post_name'] ) {
+                $data['post_name'] = $post_name;
</ins><span class="cx">         }
</span><span class="cx">         return $data;
</span><span class="cx"> }
</span><span class="lines">@@ -699,11 +728,11 @@
</span><span class="cx">         <table class="form-table">
</span><span class="cx">         <tr>
</span><span class="cx">         <?php /* translators: My sites label */ ?>
</span><del>-                <th scope="row"><?php _e('Primary Site'); ?></th>
</del><ins>+                <th scope="row"><?php _e( 'Primary Site' ); ?></th>
</ins><span class="cx">                 <td>
</span><span class="cx">                 <?php
</span><span class="cx">                 $all_blogs = get_blogs_of_user( $current_user->ID );
</span><del>-                $primary_blog = get_user_meta($current_user->ID, 'primary_blog', true);
</del><ins>+                $primary_blog = get_user_meta( $current_user->ID, 'primary_blog', true );
</ins><span class="cx">                 if ( count( $all_blogs ) > 1 ) {
</span><span class="cx">                         $found = false;
</span><span class="cx">                         ?>
</span><span class="lines">@@ -711,7 +740,7 @@
</span><span class="cx">                                 <?php foreach( (array) $all_blogs as $blog ) {
</span><span class="cx">                                         if ( $primary_blog == $blog->userblog_id )
</span><span class="cx">                                                 $found = true;
</span><del>-                                        ?><option value='<?php echo $blog->userblog_id ?>'<?php if ( $primary_blog == $blog->userblog_id ) echo ' selected="selected"' ?>><?php echo get_home_url($blog->userblog_id) ?></option><?php
</del><ins>+                                        ?><option value="<?php echo $blog->userblog_id ?>"<?php selected( $primary_blog, $blog->userblog_id ); ?>><?php echo esc_url( get_home_url( $blog->userblog_id ) ) ?></option><?php
</ins><span class="cx">                                 } ?>
</span><span class="cx">                         </select>
</span><span class="cx">                         <?php
</span><span class="lines">@@ -738,8 +767,8 @@
</span><span class="cx">         if ( ! is_super_admin() )
</span><span class="cx">                 return;
</span><span class="cx">         $mu_media_buttons = get_site_option( 'mu_media_buttons', array() );
</span><del>-        if ( empty($mu_media_buttons[ 'image' ]) && current_theme_supports( 'post-thumbnails' ) ) {
-                echo "<div id='update-nag'>" . sprintf( __( "Warning! The current theme supports post thumbnails. You must enable image uploads on <a href='%s'>the options page</a> for it to work." ), admin_url( 'ms-options.php' ) ) . "</div>";
</del><ins>+        if ( empty($mu_media_buttons['image']) && current_theme_supports( 'post-thumbnails' ) ) {
+                echo "<div id='update-nag'>" . sprintf( __( "Warning! The current theme supports post thumbnails. You must enable image uploads on <a href='%s'>the options page</a> for it to work." ), esc_url( admin_url( 'ms-options.php' ) ) ) . "</div>";
</ins><span class="cx">         }
</span><span class="cx"> }
</span><span class="cx"> add_action( 'admin_notices', 'show_post_thumbnail_warning' );
</span><span class="lines">@@ -760,7 +789,7 @@
</span><span class="cx"> * @return none
</span><span class="cx"> */
</span><span class="cx"> function _admin_notice_multisite_activate_plugins_page() {
</span><del>-        $message = sprintf( __( 'The plugins page is not visible to normal users. It must be activated first. %s' ), '<a href="ms-options.php#menu">' . __( 'Activate' ) . '</a>' );
</del><ins>+        $message = sprintf( __( 'The plugins page is not visible to normal users. It must be activated first. %s' ), '<a href="' . esc_url( admin_url( 'ms-options.php#menu' ) ) . '">' . __( 'Activate' ) . '</a>' );
</ins><span class="cx">         echo "<div class='error'><p>$message</p></div>";
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkwpadminmsdeletesitephp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/ms-delete-site.php (13917 => 13918)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/ms-delete-site.php        2010-04-01 20:32:17 UTC (rev 13917)
+++ trunk/wp-admin/ms-delete-site.php        2010-04-01 21:21:27 UTC (rev 13918)
</span><span class="lines">@@ -1,67 +1,74 @@
</span><span class="cx"> <?php
</span><del>-require_once('admin.php');
</del><ins>+require_once( './admin.php' );
</ins><span class="cx">
</span><span class="cx"> if ( !is_multisite() )
</span><del>-        wp_die( __('Multisite support is not enabled.') );
</del><ins>+        wp_die( __( 'Multisite support is not enabled.' ) );
</ins><span class="cx">
</span><span class="cx"> // @todo Create a delete blog cap.
</span><del>-if ( ! current_user_can('manage_options') )
-        wp_die(__('You do not have sufficient permissions to delete this blog.'));
</del><ins>+if ( ! current_user_can( 'manage_options' ) )
+        wp_die(__( 'You do not have sufficient permissions to delete this site.'));
+        
+if ( isset( $_GET['h'] ) && $_GET['h'] != '' && get_option( 'delete_blog_hash' ) != false ) {
+        if ( get_option( 'delete_blog_hash' ) == $_GET['h'] ) {
+                wpmu_delete_blog( $wpdb->blogid );
+                wp_die( sprintf( __( 'Thank you for using %s, your site has been deleted. Happy trails to you until we meet again.' ), $current_site->site_name ) );
+        } else {
+                wp_die( __( "I'm sorry, the link you clicked is stale. Please select another option." ) );
+        }
+}
</ins><span class="cx">
</span><del>-$action = isset($_POST['action']) ? $_POST['action'] : 'splash';
</del><ins>+$action = isset( $_POST['action'] ) ? $_POST['action'] : 'splash';
</ins><span class="cx">
</span><del>-$title = __('Delete Blog');
</del><ins>+$title = __( 'Delete Site' );
</ins><span class="cx"> $parent_file = 'tools.php';
</span><del>-require_once('admin-header.php');
</del><ins>+require_once( './admin-header.php' );
</ins><span class="cx">
</span><span class="cx"> echo '<div class="wrap">';
</span><span class="cx"> screen_icon();
</span><del>-echo '<h2>'. esc_html($title) .'</h2>';
</del><ins>+echo '<h2>' . esc_html( $title ) . '</h2>';
</ins><span class="cx">
</span><del>-if ( isset($_POST['action']) && $_POST['action'] == "deleteblog" && isset($_POST['confirmdelete']) && $_POST['confirmdelete'] == '1' ) {
-        $hash = wp_generate_password(20, false);
-        update_option( "delete_blog_hash", $hash );
-        $url_delete = admin_url('ms-delete-site.php?h=' . $hash);
-        $msg = __("Dear User,
-You recently clicked the 'Delete Blog' link on your blog and filled in a
</del><ins>+if ( isset( $_POST['action'] ) && $_POST['action'] == 'deleteblog' && isset( $_POST['confirmdelete'] ) && $_POST['confirmdelete'] == '1' ) {
+        $hash = wp_generate_password( 20, false );
+        update_option( 'delete_blog_hash', $hash );
+
+        $url_delete = esc_url( admin_url( 'ms-delete-site.php?h=' . $hash ) );
+
+        $content = apply_filters( 'delete_site_email_content', __( "Dear User,
+You recently clicked the 'Delete Site' link on your site and filled in a
</ins><span class="cx"> form on that page.
</span><del>-If you really want to delete your blog, click the link below. You will not
</del><ins>+If you really want to delete your site, click the link below. You will not
</ins><span class="cx"> be asked to confirm again so only click this link if you are absolutely certain:
</span><del>-URL_DELETE
</del><ins>+###URL_DELETE###
</ins><span class="cx">
</span><del>-If you delete your blog, please consider opening a new blog here
-some time in the future! (But remember your current blog and username
</del><ins>+If you delete your site, please consider opening a new site here
+some time in the future! (But remember your current site and username
</ins><span class="cx"> are gone forever.)
</span><span class="cx">
</span><span class="cx"> Thanks for using the site,
</span><span class="cx"> Webmaster
</span><del>-SITE_NAME
-");
-        $msg = str_replace( "URL_DELETE", $url_delete, $msg );
-        $msg = str_replace( "SITE_NAME", $current_site->site_name, $msg );
-        wp_mail( get_option( "admin_email" ), "[ " . get_option( "blogname" ) . " ] ".__("Delete My Blog"), $msg );
</del><ins>+###SITE_NAME###" ) );
+
+        $content = str_replace( '###URL_DELETE###', $url_delete, $content );
+        $content = str_replace( '###SITE_NAME###', $current_site->site_name, $content );
+
+        wp_mail( get_option( 'admin_email' ), "[ " . get_option( 'blogname' ) . " ] ".__( 'Delete My Site' ), $content );
</ins><span class="cx">         ?>
</span><del>-        <p><?php _e('Thank you. Please check your email for a link to confirm your action. Your blog will not be deleted until this link is clicked.') ?></p>
</del><ins>+
+        <p><?php _e( 'Thank you. Please check your email for a link to confirm your action. Your site will not be deleted until this link is clicked. ') ?></p>
+
+<?php } else {
+        ?>
+        <p><?php printf( __( 'If you do not want to use your %s site any more, you can delete it using the form below. When you click <strong>Delete My Site Permanently</strong> you will be sent an email with a link in it. Click on this link to delete your site.'), $current_site->site_name); ?></p>
+        <p><?php _e( 'Remember, once deleted your site cannot be restored.' ) ?></p>
+
+        <form method="post" name="deletedirect">
+                <input type="hidden" name="action" value="deleteblog" />
+                <p><input id="confirmdelete" type="checkbox" name="confirmdelete" value="1" /> <label for="confirmdelete"><strong><?php printf( __( "I'm sure I want to permanently disable my site, and I am aware I can never get it back or use %s again." ), is_subdomain_install() ? $current_blog->domain : $current_site->domain . $current_site->path ); ?></strong></label></p>
+                <p class="submit"><input type="submit" value="<?php esc_attr_e( 'Delete My Site Permanently' ) ?>" /></p>
+        </form>
</ins><span class="cx">         <?php
</span><del>-} elseif ( isset( $_GET['h'] ) && $_GET['h'] != '' && get_option('delete_blog_hash') != false ) {
-        if ( get_option('delete_blog_hash') == $_GET['h'] ) {
-                wpmu_delete_blog( $wpdb->blogid );
-                echo "<p>" . sprintf(__('Thank you for using %s, your blog has been deleted. Happy trails to you until we meet again.'), $current_site->site_name) . "</p>";
-        } else {
-                echo "<p>" . __("I'm sorry, the link you clicked is stale. Please select another option.") . "</p>";
-        }
-} else {
-?>
-<p><?php printf(__('If you do not want to use your %s blog any more, you can delete it using the form below. When you click <strong>Delete My Blog</strong> you will be sent an email with a link in it. Click on this link to delete your blog.'), $current_site->site_name); ?></p>
-<p><?php _e('Remember, once deleted your blog cannot be restored.') ?></p>
-<form method='post' name='deletedirect'>
-<input type='hidden' name='action' value='deleteblog' />
-<p><input id='confirmdelete' type='checkbox' name='confirmdelete' value='1' /> <label for='confirmdelete'><strong><?php printf( __("I'm sure I want to permanently disable my blog, and I am aware I can never get it back or use %s again."), $current_blog->domain); ?></strong></label></p>
-<p class="submit"><input type='submit' value='<?php esc_attr_e('Delete My Blog Permanently') ?>' /></p>
-</form>
-<?php
</del><span class="cx"> }
</span><span class="cx"> echo '</div>';
</span><span class="cx">
</span><del>-include('admin-footer.php');
-?>
</del><span class="cx">\ No newline at end of file
</span><ins>+include( './admin-footer.php' );
+?>
</ins></span></pre></div>
<a id="trunkwpadminmseditphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/ms-edit.php (13917 => 13918)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/ms-edit.php        2010-04-01 20:32:17 UTC (rev 13917)
+++ trunk/wp-admin/ms-edit.php        2010-04-01 21:21:27 UTC (rev 13918)
</span><span class="lines">@@ -1,33 +1,30 @@
</span><span class="cx"> <?php
</span><del>-require_once('admin.php');
</del><ins>+require_once( './admin.php' );
</ins><span class="cx">
</span><span class="cx"> if ( !is_multisite() )
</span><del>-        wp_die( __('Multisite support is not enabled.') );
</del><ins>+        wp_die( __( 'Multisite support is not enabled.' ) );
</ins><span class="cx">
</span><del>-do_action('wpmuadminedit', '');
</del><ins>+do_action( 'wpmuadminedit' , '');
</ins><span class="cx">
</span><del>-if ( isset($_GET[ 'id' ]) )
-        $id = intval( $_GET[ 'id' ] );
-elseif ( isset($_POST[ 'id' ]) )
-        $id = intval( $_POST[ 'id' ] );
</del><ins>+if ( isset( $_GET['id' ]) )
+        $id = intval( $_GET['id'] );
+elseif ( isset( $_POST['id'] ) )
+        $id = intval( $_POST['id'] );
</ins><span class="cx">
</span><del>-if ( isset( $_POST['ref'] ) == false && !empty($_SERVER['HTTP_REFERER']) )
-        $_POST['ref'] = $_SERVER['HTTP_REFERER'];
-
</del><span class="cx"> switch ( $_GET['action'] ) {
</span><del>-        case "siteoptions":
-                check_admin_referer('siteoptions');
</del><ins>+        case 'siteoptions':
+                check_admin_referer( 'siteoptions' );
</ins><span class="cx">                 if ( ! current_user_can( 'manage_network_options' ) )
</span><del>-                        wp_die( __('You do not have permission to access this page.') );
</del><ins>+                        wp_die( __( 'You do not have permission to access this page.' ) );
</ins><span class="cx">
</span><span class="cx">                 if ( empty( $_POST ) )
</span><del>-                        wp_die( __("You probably need to go back to the <a href='ms-options.php'>options page</a>") );
</del><ins>+                        wp_die( sprintf( __( 'You probably need to go back to the <a href="%s">options page</a>.', esc_url( admin_url( 'ms-options.php' ) ) ) ) );
</ins><span class="cx">
</span><del>-                if ( isset($_POST['WPLANG']) && ( '' === $_POST['WPLANG'] || in_array($_POST['WPLANG'], get_available_languages()) ) )
-                        update_site_option( "WPLANG", $_POST['WPLANG'] );
</del><ins>+                if ( isset($_POST['WPLANG']) && ( '' === $_POST['WPLANG'] || in_array( $_POST['WPLANG'], get_available_languages() ) ) )
+                        update_site_option( 'WPLANG', $_POST['WPLANG'] );
</ins><span class="cx">
</span><span class="cx">                 if ( is_email( $_POST['admin_email'] ) )
</span><del>-                        update_site_option( "admin_email", $_POST['admin_email'] );
</del><ins>+                        update_site_option( 'admin_email', $_POST['admin_email'] );
</ins><span class="cx">
</span><span class="cx">                 $illegal_names = split( ' ', $_POST['illegal_names'] );
</span><span class="cx">                 foreach ( (array) $illegal_names as $name ) {
</span><span class="lines">@@ -35,10 +32,10 @@
</span><span class="cx">                         if ( $name != '' )
</span><span class="cx">                                 $names[] = trim( $name );
</span><span class="cx">                 }
</span><del>-                update_site_option( "illegal_names", $names );
</del><ins>+                update_site_option( 'illegal_names', $names );
</ins><span class="cx">
</span><span class="cx">                 if ( $_POST['limited_email_domains'] != '' ) {
</span><del>-                        $limited_email_domains = str_replace( ' ', "\n", $_POST[ 'limited_email_domains' ] );
</del><ins>+                        $limited_email_domains = str_replace( ' ', "\n", $_POST['limited_email_domains'] );
</ins><span class="cx">                         $limited_email_domains = split( "\n", stripslashes( $limited_email_domains ) );
</span><span class="cx">                         $limited_email = array();
</span><span class="cx">                         foreach ( (array) $limited_email_domains as $domain ) {
</span><span class="lines">@@ -46,31 +43,31 @@
</span><span class="cx">                                 if ( ! preg_match( '/(--|\.\.)/', $domain ) && preg_match( '|^([a-zA-Z0-9-\.])+$|', $domain ) )
</span><span class="cx">                                         $limited_email[] = trim( $domain );
</span><span class="cx">                         }
</span><del>-                        update_site_option( "limited_email_domains", $limited_email );
</del><ins>+                        update_site_option( 'limited_email_domains', $limited_email );
</ins><span class="cx">                 } else {
</span><del>-                        update_site_option( "limited_email_domains", '' );
</del><ins>+                        update_site_option( 'limited_email_domains', '' );
</ins><span class="cx">                 }
</span><span class="cx">
</span><span class="cx">                 if ( $_POST['banned_email_domains'] != '' ) {
</span><del>-                        $banned_email_domains = split( "\n", stripslashes( $_POST[ 'banned_email_domains' ] ) );
</del><ins>+                        $banned_email_domains = split( "\n", stripslashes( $_POST['banned_email_domains'] ) );
</ins><span class="cx">                         $banned = array();
</span><span class="cx">                         foreach ( (array) $banned_email_domains as $domain ) {
</span><span class="cx">                                 $domain = trim( $domain );
</span><span class="cx">                                 if ( ! preg_match( '/(--|\.\.)/', $domain ) && preg_match( '|^([a-zA-Z0-9-\.])+$|', $domain ) )
</span><span class="cx">                                         $banned[] = trim( $domain );
</span><span class="cx">                         }
</span><del>-                        update_site_option( "banned_email_domains", $banned );
</del><ins>+                        update_site_option( 'banned_email_domains', $banned );
</ins><span class="cx">                 } else {
</span><del>-                        update_site_option( "banned_email_domains", '' );
</del><ins>+                        update_site_option( 'banned_email_domains', '' );
</ins><span class="cx">                 }
</span><del>-                update_site_option( 'default_user_role', $_POST[ 'default_user_role' ] );
-                if ( trim( $_POST[ 'dashboard_blog_orig' ] ) == '' )
-                        $_POST[ 'dashboard_blog_orig' ] = $current_site->blog_id;
-                if ( trim( $_POST[ 'dashboard_blog' ] ) == '' ) {
-                        $_POST[ 'dashboard_blog' ] = $current_site->blog_id;
</del><ins>+                update_site_option( 'default_user_role', $_POST['default_user_role'] );
+                if ( trim( $_POST['dashboard_blog_orig'] ) == '' )
+                        $_POST['dashboard_blog_orig'] = $current_site->blog_id;
+                if ( trim( $_POST['dashboard_blog'] ) == '' ) {
+                        $_POST['dashboard_blog'] = $current_site->blog_id;
</ins><span class="cx">                         $dashboard_blog_id = $current_site->blog_id;
</span><span class="cx">                 } else {
</span><del>-                        $dashboard_blog = untrailingslashit( sanitize_user( str_replace( '.', '', str_replace( $current_site->domain . $current_site->path, '', $_POST[ 'dashboard_blog' ] ) ) ) );
</del><ins>+                        $dashboard_blog = untrailingslashit( sanitize_user( str_replace( '.', '', str_replace( $current_site->domain . $current_site->path, '', $_POST['dashboard_blog'] ) ) ) );
</ins><span class="cx">                         $blog_details = get_blog_details( $dashboard_blog );
</span><span class="cx">                         if ( false === $blog_details ) {
</span><span class="cx">                                 if ( is_numeric( $dashboard_blog ) )
</span><span class="lines">@@ -83,7 +80,7 @@
</span><span class="cx">                                         $path = trailingslashit( $current_site->path . $dashboard_blog );
</span><span class="cx">                                 }
</span><span class="cx">                                 $wpdb->hide_errors();
</span><del>-                                $dashboard_blog_id = wpmu_create_blog( $domain, $path, __( 'My Dashboard' ), $current_user->id , array( "public" => 0 ), $current_site->id );
</del><ins>+                                $dashboard_blog_id = wpmu_create_blog( $domain, $path, __( 'My Dashboard' ), $current_user->id , array( 'public' => 0 ), $current_site->id );
</ins><span class="cx">                                 $wpdb->show_errors();
</span><span class="cx">                         } else {
</span><span class="cx">                                 $dashboard_blog_id = $blog_details->blog_id;
</span><span class="lines">@@ -91,7 +88,7 @@
</span><span class="cx">                 }
</span><span class="cx">                 if ( is_wp_error( $dashboard_blog_id ) )
</span><span class="cx">                         wp_die( __( 'Problem creating dashboard blog: ' ) . $dashboard_blog_id->get_error_message() );
</span><del>-                if ( $_POST[ 'dashboard_blog_orig' ] != $_POST[ 'dashboard_blog' ] ) {
</del><ins>+                if ( $_POST['dashboard_blog_orig'] != $_POST['dashboard_blog'] ) {
</ins><span class="cx">                         $users = get_users_of_blog( get_site_option( 'dashboard_blog' ) );
</span><span class="cx">                         $move_users = array();
</span><span class="cx">                         foreach ( (array)$users as $user ) {
</span><span class="lines">@@ -106,60 +103,60 @@
</span><span class="cx">                                 }
</span><span class="cx">                         }
</span><span class="cx">                 }
</span><del>-                update_site_option( "dashboard_blog", $dashboard_blog_id );
</del><ins>+                update_site_option( 'dashboard_blog', $dashboard_blog_id );
</ins><span class="cx">                 // global terms
</span><del>-                if ( !global_terms_enabled() && ! empty( $_POST[ 'global_terms_enabled' ] ) ) {
</del><ins>+                if ( !global_terms_enabled() && ! empty( $_POST['global_terms_enabled'] ) ) {
</ins><span class="cx">                         require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
</span><span class="cx">                         // create global terms table
</span><span class="cx">                         install_global_terms();
</span><span class="cx">                 }
</span><span class="cx">                 $options = array( 'registrationnotification', 'registration', 'add_new_users', 'menu_items', 'mu_media_buttons', 'upload_space_check_disabled', 'blog_upload_space', 'upload_filetypes', 'site_name', 'first_post', 'first_page', 'first_comment', 'first_comment_url', 'first_comment_author', 'welcome_email', 'welcome_user_email', 'fileupload_maxk', 'admin_notice_feed', 'global_terms_enabled' );
</span><del>-                $checked_options = array('mu_media_buttons' => array(), 'menu_items' => array(), 'registrationnotification' => 'no', 'upload_space_check_disabled' => 1 );
</del><ins>+                $checked_options = array( 'mu_media_buttons' => array(), 'menu_items' => array(), 'registrationnotification' => 'no', 'upload_space_check_disabled' => 1 );
</ins><span class="cx">                 foreach ( $checked_options as $option_name => $option_unchecked_value ) {
</span><del>-                        if ( ! isset($_POST[ $option_name ]) )
-                                $_POST[ $option_name ] = $option_unchecked_value;
</del><ins>+                        if ( ! isset( $_POST[$option_name] ) )
+                                $_POST[$option_name] = $option_unchecked_value;
</ins><span class="cx">                 }
</span><span class="cx">                 foreach ( $options as $option_name ) {
</span><del>-                        if ( ! isset($_POST[ $option_name ]) )
</del><ins>+                        if ( ! isset($_POST[$option_name]) )
</ins><span class="cx">                                 continue;
</span><del>-                        $value = stripslashes_deep( $_POST[ $option_name ] );
</del><ins>+                        $value = stripslashes_deep( $_POST[$option_name] );
</ins><span class="cx">                         update_site_option( $option_name, $value );
</span><span class="cx">                 }
</span><span class="cx">
</span><span class="cx">                 // Update more options here
</span><span class="cx">                 do_action( 'update_wpmu_options' );
</span><span class="cx">
</span><del>-                wp_redirect( add_query_arg( "updated", "true", 'ms-options.php' ) );
</del><ins>+                wp_redirect( add_query_arg( 'updated', 'true', admin_url( 'ms-options.php' ) ) );
</ins><span class="cx">                 exit();
</span><span class="cx">         break;
</span><del>-        case "addblog":
-                check_admin_referer('add-blog');
</del><ins>+        case 'addblog':
+                check_admin_referer( 'add-blog' );
</ins><span class="cx">
</span><span class="cx">                 if ( ! current_user_can( 'manage_sites' ) )
</span><del>-                        wp_die( __('You do not have permission to access this page.') );
</del><ins>+                        wp_die( __( 'You do not have permission to access this page.' ) );
</ins><span class="cx">
</span><del>-                if ( is_array( $_POST[ 'blog' ] ) == false )
-                        wp_die( "Can't create an empty site." );
</del><ins>+                if ( is_array( $_POST['blog'] ) == false )
+                        wp_die( __( "Can't create an empty site." ) );
</ins><span class="cx">                 $blog = $_POST['blog'];
</span><span class="cx">                 $domain = '';
</span><del>-                if ( ! preg_match( '/(--)/', $blog[ 'domain' ] ) && preg_match( '|^([a-zA-Z0-9-])+$|', $blog[ 'domain' ] ) )
-                        $domain = strtolower( $blog[ 'domain' ] );
-                $email = sanitize_email( $blog[ 'email' ] );
-                $title = $blog[ 'title' ];
</del><ins>+                if ( ! preg_match( '/(--)/', $blog['domain'] ) && preg_match( '|^([a-zA-Z0-9-])+$|', $blog['domain'] ) )
+                        $domain = strtolower( $blog['domain'] );
+                $email = sanitize_email( $blog['email'] );
+                $title = $blog['title'];
</ins><span class="cx">
</span><span class="cx">                 if ( empty( $domain ) )
</span><span class="cx">                         wp_die( __( 'Missing or invalid site address.' ) );
</span><span class="cx">                 if ( empty( $email ) )
</span><span class="cx">                         wp_die( __( 'Missing email address.' ) );
</span><span class="cx">                 if ( !is_email( $email ) )
</span><del>-                        wp_die( __( 'Invalid email address' ) );
</del><ins>+                        wp_die( __( 'Invalid email address.' ) );
</ins><span class="cx">
</span><span class="cx">                 if ( is_subdomain_install() ) {
</span><del>-                        $newdomain = $domain.".".$current_site->domain;
</del><ins>+                        $newdomain = $domain . '.' . $current_site->domain;
</ins><span class="cx">                         $path = $base;
</span><span class="cx">                 } else {
</span><span class="cx">                         $newdomain = $current_site->domain;
</span><del>-                        $path = $base.$domain.'/';
</del><ins>+                        $path = $base . $domain . '/';
</ins><span class="cx">                 }
</span><span class="cx">
</span><span class="cx">                 $password = 'N/A';
</span><span class="lines">@@ -168,46 +165,52 @@
</span><span class="cx">                         $password = wp_generate_password();
</span><span class="cx">                         $user_id = wpmu_create_user( $domain, $password, $email );
</span><span class="cx">                         if ( false == $user_id )
</span><del>-                                wp_die( __('There was an error creating the user') );
</del><ins>+                                wp_die( __( 'There was an error creating the user.' ) );
</ins><span class="cx">                         else
</span><del>-                                wp_new_user_notification($user_id, $password);
</del><ins>+                                wp_new_user_notification( $user_id, $password );
</ins><span class="cx">                 }
</span><span class="cx">
</span><span class="cx">                 $wpdb->hide_errors();
</span><del>-                $id = wpmu_create_blog($newdomain, $path, $title, $user_id , array( "public" => 1 ), $current_site->id);
</del><ins>+                $id = wpmu_create_blog( $newdomain, $path, $title, $user_id , array( 'public' => 1 ), $current_site->id );
</ins><span class="cx">                 $wpdb->show_errors();
</span><del>-                if ( !is_wp_error($id) ) {
</del><ins>+                if ( !is_wp_error( $id ) ) {
</ins><span class="cx">                         $dashboard_blog = get_dashboard_blog();
</span><span class="cx">                         if ( get_user_option( 'primary_blog', $user_id ) == $dashboard_blog->blog_id )
</span><span class="cx">                                 update_user_option( $user_id, 'primary_blog', $id, true );
</span><del>-                        $content_mail = sprintf( __( "New site created by %1s\n\nAddress: http://%2s\nName: %3s"), $current_user->user_login , $newdomain.$path, stripslashes( $title ) );
-                        wp_mail( get_site_option('admin_email'), sprintf(__('[%s] New Site Created'), $current_site->site_name), $content_mail, 'From: "Site Admin" <' . get_site_option( 'admin_email' ) . '>' );
-                        wpmu_welcome_notification( $id, $user_id, $password, $title, array( "public" => 1 ) );
-                        wp_redirect( add_query_arg( array('updated' => 'true', 'action' => 'add-blog'), $_SERVER['HTTP_REFERER'] ) );
</del><ins>+                        $content_mail = sprintf( __( "New site created by %1s\n\nAddress: http://%2s\nName: %3s"), $current_user->user_login , $newdomain . $path, stripslashes( $title ) );
+                        wp_mail( get_site_option('admin_email'), sprintf( __( '[%s] New Site Created' ), $current_site->site_name ), $content_mail, 'From: "Site Admin" <' . get_site_option( 'admin_email' ) . '>' );
+                        wpmu_welcome_notification( $id, $user_id, $password, $title, array( 'public' => 1 ) );
+                        wp_redirect( add_query_arg( array( 'updated' => 'true', 'action' => 'add-blog' ), wp_get_referer() ) );
</ins><span class="cx">                         exit();
</span><span class="cx">                 } else {
</span><span class="cx">                         wp_die( $id->get_error_message() );
</span><span class="cx">                 }
</span><span class="cx">         break;
</span><span class="cx">
</span><del>-        case "updateblog":
-                check_admin_referer('editblog');
</del><ins>+        case 'updateblog':
+                check_admin_referer( 'editblog' );
</ins><span class="cx">                 if ( ! current_user_can( 'manage_sites' ) )
</span><del>-                        wp_die( __('You do not have permission to access this page.') );
</del><ins>+                        wp_die( __( 'You do not have permission to access this page.' ) );
</ins><span class="cx">
</span><span class="cx">                 if ( empty( $_POST ) )
</span><del>-                        wp_die( __('You probably need to go back to the <a href="ms-sites.php">sites page</a>') );
</del><ins>+                        wp_die( sprintf( __( 'You probably need to go back to the <a href="%s">sites page</a>', esc_url( admin_url( 'ms-sites.php' ) ) ) ) );
</ins><span class="cx">
</span><ins>+                switch_to_blog( $id );
+
</ins><span class="cx">                 // themes
</span><del>-                if ( isset($_POST[ 'theme' ]) && is_array( $_POST[ 'theme' ] ) )
-                        $_POST[ 'option' ][ 'allowedthemes' ] = $_POST[ 'theme' ];
-                else
-                        $_POST[ 'option' ][ 'allowedthemes' ] = '';
</del><ins>+                $allowedthemes = array();
+                if ( isset($_POST['theme']) && is_array( $_POST['theme'] ) ) {
+                        foreach ( $_POST['theme'] as $theme => $val ) {
+                                if ( 'on' == $val )
+                                        $allowedthemes[$theme] = true;
+                        }
+                }
+                update_option( 'allowedthemes', $allowedthemes );
</ins><span class="cx">
</span><del>-                switch_to_blog( $id );
-                if ( is_array( $_POST[ 'option' ] ) ) {
</del><ins>+                // options
+                if ( is_array( $_POST['option'] ) ) {
</ins><span class="cx">                         $c = 1;
</span><del>-                        $count = count( $_POST[ 'option' ] );
</del><ins>+                        $count = count( $_POST['option'] );
</ins><span class="cx">                         foreach ( (array) $_POST['option'] as $key => $val ) {
</span><span class="cx">                                 if ( $key === 0 || is_array( $val ) )
</span><span class="cx">                                         continue; // Avoids "0 is a protected WP option and may not be modified" error when edit blog options
</span><span class="lines">@@ -219,10 +222,11 @@
</span><span class="cx">                         }
</span><span class="cx">                 }
</span><span class="cx">
</span><ins>+                // home and siteurl
</ins><span class="cx">                 if ( isset( $_POST['update_home_url'] ) && $_POST['update_home_url'] == 'update' ) {
</span><del>-                        $blog_address = get_blogaddress_by_domain($_POST['blog']['domain'], $_POST['blog']['path']);
</del><ins>+                        $blog_address = get_blogaddress_by_domain( $_POST['blog']['domain'], $_POST['blog']['path'] );
</ins><span class="cx">                         if ( get_option( 'siteurl' ) != $blog_address )
</span><del>-                                update_option( 'siteurl', $blog_address);
</del><ins>+                                update_option( 'siteurl', $blog_address );
</ins><span class="cx">
</span><span class="cx">                         if ( get_option( 'home' ) != $blog_address )
</span><span class="cx">                                 update_option( 'home', $blog_address );
</span><span class="lines">@@ -231,210 +235,216 @@
</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><del>-                // update blogs count
-                delete_site_transient( "blog_count" );
-
</del><span class="cx">                 // update blogs table
</span><del>-                $blog_data = stripslashes_deep($_POST[ 'blog' ]);
-                update_blog_details($id, $blog_data);
</del><ins>+                $blog_data = stripslashes_deep( $_POST['blog'] );
+                update_blog_details( $id, $blog_data );
</ins><span class="cx">
</span><span class="cx">                 // get blog prefix
</span><span class="cx">                 $blog_prefix = $wpdb->get_blog_prefix( $id );
</span><span class="cx">
</span><span class="cx">                 // user roles
</span><del>-                if ( isset( $_POST[ 'role' ] ) && is_array( $_POST[ 'role' ] ) == true ) {
-                        $newroles = $_POST[ 'role' ];
</del><ins>+                if ( isset( $_POST['role'] ) && is_array( $_POST['role'] ) == true ) {
+                        $newroles = $_POST['role'];
+
</ins><span class="cx">                         reset( $newroles );
</span><span class="cx">                         foreach ( (array) $newroles as $userid => $role ) {
</span><del>-                                $user = new WP_User($userid);
</del><ins>+                                $user = new WP_User( $userid );
</ins><span class="cx">                                 if ( ! $user )
</span><span class="cx">                                         continue;
</span><del>-                                $user->for_blog($id);
-                                $user->set_role($role);
</del><ins>+                                $user->for_blog( $id );
+                                $user->set_role( $role );
</ins><span class="cx">                         }
</span><span class="cx">                 }
</span><span class="cx">
</span><span class="cx">                 // remove user
</span><del>-                if ( isset( $_POST[ 'blogusers' ] ) && is_array( $_POST[ 'blogusers' ] ) ) {
-                        reset( $_POST[ 'blogusers' ] );
-                        foreach ( (array) $_POST[ 'blogusers' ] as $key => $val )
</del><ins>+                if ( isset( $_POST['blogusers'] ) && is_array( $_POST['blogusers'] ) ) {
+                        reset( $_POST['blogusers'] );
+                        foreach ( (array) $_POST['blogusers'] as $key => $val )
</ins><span class="cx">                                 remove_user_from_blog( $key, $id );
</span><span class="cx">                 }
</span><span class="cx">
</span><span class="cx">                 // change password
</span><del>-                if ( isset( $_POST[ 'user_password' ] ) && is_array( $_POST[ 'user_password' ] ) ) {
-                        reset( $_POST[ 'user_password' ] );
-                        $newroles = $_POST[ 'role' ];
-                        foreach ( (array) $_POST[ 'user_password' ] as $userid => $pass ) {
-                                unset( $_POST[ 'role' ] );
-                                $_POST[ 'role' ] = $newroles[ $userid ];
</del><ins>+                if ( isset( $_POST['user_password'] ) && is_array( $_POST['user_password'] ) ) {
+                        reset( $_POST['user_password'] );
+                        $newroles = $_POST['role'];
+                        foreach ( (array) $_POST['user_password'] as $userid => $pass ) {
+                                unset( $_POST['role'] );
+                                $_POST['role'] = $newroles[ $userid ];
</ins><span class="cx">                                 if ( $pass != '' ) {
</span><span class="cx">                                         $cap = $wpdb->get_var( "SELECT meta_value FROM {$wpdb->usermeta} WHERE user_id = '{$userid}' AND meta_key = '{$blog_prefix}capabilities' AND meta_value = 'a:0:{}'" );
</span><span class="cx">                                         $userdata = get_userdata($userid);
</span><del>-                                        $_POST[ 'pass1' ] = $_POST[ 'pass2' ] = $pass;
-                                        $_POST[ 'email' ] = $userdata->user_email;
-                                        $_POST[ 'rich_editing' ] = $userdata->rich_editing;
</del><ins>+                                        $_POST['pass1'] = $_POST['pass2'] = $pass;
+                                        $_POST['email'] = $userdata->user_email;
+                                        $_POST['rich_editing'] = $userdata->rich_editing;
</ins><span class="cx">                                         edit_user( $userid );
</span><span class="cx">                                         if ( $cap == null )
</span><span class="cx">                                                 $wpdb->query( "DELETE FROM {$wpdb->usermeta} WHERE user_id = '{$userid}' AND meta_key = '{$blog_prefix}capabilities' AND meta_value = 'a:0:{}'" );
</span><span class="cx">                                 }
</span><span class="cx">                         }
</span><del>-                        unset( $_POST[ 'role' ] );
-                        $_POST[ 'role' ] = $newroles;
</del><ins>+                        unset( $_POST['role'] );
+                        $_POST['role'] = $newroles;
</ins><span class="cx">                 }
</span><span class="cx">
</span><del>-                // add user?
-                if ( isset( $_POST[ 'user_password' ] ) && !empty( $_POST[ 'newuser' ] ) ) {
-                        $newuser = $_POST[ 'newuser' ];
</del><ins>+                // add user
+                if ( !empty( $_POST['newuser'] ) ) {
+                        $newuser = $_POST['newuser'];
</ins><span class="cx">                         $userid = $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM " . $wpdb->users . " WHERE user_login = %s", $newuser ) );
</span><span class="cx">                         if ( $userid ) {
</span><del>-                                $user = $wpdb->get_var( "SELECT user_id FROM " . $wpdb->usermeta . " WHERE user_id='$userid' AND meta_key='wp_" . $id . "_capabilities'" );
</del><ins>+                                $user = $wpdb->get_var( "SELECT user_id FROM " . $wpdb->usermeta . " WHERE user_id='$userid' AND meta_key='{$blog_prefix}capabilities'" );
</ins><span class="cx">                                 if ( $user == false )
</span><del>-                                        add_user_to_blog($id, $userid, $_POST[ 'new_role' ]);
</del><ins>+                                        add_user_to_blog( $id, $userid, $_POST['new_role'] );
</ins><span class="cx">                         }
</span><span class="cx">                 }
</span><span class="cx">                 do_action( 'wpmu_update_blog_options' );
</span><span class="cx">                 restore_current_blog();
</span><del>-                wpmu_admin_do_redirect( "ms-sites.php?action=editblog&updated=true&id=".$id );
</del><ins>+                wp_redirect( add_query_arg( array( 'updated' => 'true', 'action' => 'editblog', 'id' => $id ), wp_get_referer() ) );
</ins><span class="cx">         break;
</span><span class="cx">
</span><del>-        case "deleteblog":
</del><ins>+        case 'deleteblog':
</ins><span class="cx">                 check_admin_referer('deleteblog');
</span><span class="cx">                 if ( ! current_user_can( 'manage_sites' ) )
</span><del>-                        wp_die( __('You do not have permission to access this page.') );
</del><ins>+                        wp_die( __( 'You do not have permission to access this page.' ) );
</ins><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><span class="cx">
</span><del>-                wp_redirect( add_query_arg( array('updated' => 'true', 'action' => 'delete'), $_POST[ 'ref' ] ) );
</del><ins>+                wp_redirect( add_query_arg( array( 'updated' => 'true', 'action' => 'delete' ), wp_get_referer() ) );
</ins><span class="cx">                 exit();
</span><span class="cx">         break;
</span><span class="cx">
</span><del>-        case "allblogs":
-                if ( isset($_POST['doaction']) || isset($_POST['doaction2']) ) {
-                        check_admin_referer('bulk-sites');
</del><ins>+        case 'allblogs':
+                if ( isset( $_POST['doaction']) || isset($_POST['doaction2'] ) ) {
+                        check_admin_referer( 'bulk-ms-sites' );
</ins><span class="cx">
</span><del>-                if ( ! current_user_can( 'manage_sites' ) )
-                        wp_die( __('You do not have permission to access this page.') );
</del><ins>+                        if ( ! current_user_can( 'manage_sites' ) )
+                                wp_die( __( 'You do not have permission to access this page.' ) );
+        
+                        if ( $_GET['action'] != -1 || $_POST['action2'] != -1 )
+                                $doaction = $_POST['action'] != -1 ? $_POST['action'] : $_POST['action2'];
</ins><span class="cx">
</span><del>-                if ( $_GET['action'] != -1 || $_POST['action2'] != -1 )
-                        $doaction = $doaction = ($_POST['action'] != -1) ? $_POST['action'] : $_POST['action2'];
</del><span class="cx">
</span><ins>+                        foreach ( (array) $_POST['allblogs'] as $key => $val ) {
+                                if ( $val != '0' && $val != $current_site->blog_id ) {
+                                        switch ( $doaction ) {
+                                                case 'delete':
+                                                        $blogfunction = 'all_delete';
+                                                        wpmu_delete_blog( $val, true );
+                                                break;
</ins><span class="cx">
</span><del>-                foreach ( (array) $_POST[ 'allblogs' ] as $key => $val ) {
-                        if ( $val != '0' && $val != $current_site->blog_id ) {
-                                switch ( $doaction ) {
-                                        case 'delete':
-                                                $blogfunction = 'all_delete';
-                                                wpmu_delete_blog( $val, true );
</del><ins>+                                                case 'spam':
+                                                        $blogfunction = 'all_spam';
+                                                        update_blog_status( $val, 'spam', '1', 0 );
+                                                        set_time_limit( 60 );
</ins><span class="cx">                                                 break;
</span><del>-                                        case 'spam':
-                                                $blogfunction = 'all_spam';
-                                                update_blog_status( $val, "spam", '1', 0 );
-                                                set_time_limit(60);
</del><ins>+
+                                                case 'notspam':
+                                                        $blogfunction = 'all_notspam';
+                                                        update_blog_status( $val, 'spam', '0', 0 );
+                                                        set_time_limit( 60 );
</ins><span class="cx">                                                 break;
</span><del>-                                        case 'notspam':
-                                                $blogfunction = 'all_notspam';
-                                                update_blog_status( $val, "spam", '0', 0 );
-                                                set_time_limit(60);
-                                                break;
</del><ins>+                                        }
+                                } else {
+                                        wp_die( __( 'You are not allowed to change the current site.' ) );
</ins><span class="cx">                                 }
</span><del>-                        } else {
-                                wp_die( __('You are not allowed to change one of these sites.') );
-                                exit();
-                        };
-                };
</del><ins>+                        }
</ins><span class="cx">
</span><del>-                wp_redirect( add_query_arg( array('updated' => 'true', 'action' => $blogfunction), $_SERVER['HTTP_REFERER'] ) );
-                exit();
-
</del><ins>+                        wp_redirect( add_query_arg( array( 'updated' => 'true', 'action' => $blogfunction ), wp_get_referer() ) );
+                        exit();
</ins><span class="cx">                 } else {
</span><del>-                        wp_redirect( admin_url("ms-sites.php") );
</del><ins>+                        wp_redirect( admin_url( 'ms-sites.php' ) );
</ins><span class="cx">                 }
</span><span class="cx">         break;
</span><span class="cx">
</span><del>-        case "archiveblog":
-                check_admin_referer('archiveblog');
</del><ins>+        case 'archiveblog':
+                check_admin_referer( 'archiveblog' );
</ins><span class="cx">                 if ( ! current_user_can( 'manage_sites' ) )
</span><del>-                        wp_die( __('You do not have permission to access this page.') );
</del><ins>+                        wp_die( __( 'You do not have permission to access this page.' ) );
</ins><span class="cx">
</span><del>-                update_blog_status( $id, "archived", '1' );
-                do_action( "archive_blog", $id );
-                wp_redirect( add_query_arg( array('updated' => 'true', 'action' => 'archive'), $_POST['ref'] ) );
</del><ins>+                update_blog_status( $id, 'archived', '1' );
+                do_action( 'archive_blog', $id );
+                wp_redirect( add_query_arg( array( 'updated' => 'true', 'action' => 'archive' ), wp_get_referer() ) );
</ins><span class="cx">                 exit();
</span><span class="cx">         break;
</span><span class="cx">
</span><del>-        case "unarchiveblog":
-                check_admin_referer('unarchiveblog');
</del><ins>+        case 'unarchiveblog':
+                check_admin_referer( 'unarchiveblog' );
</ins><span class="cx">                 if ( ! current_user_can( 'manage_sites' ) )
</span><del>-                        wp_die( __('You do not have permission to access this page.') );
</del><ins>+                        wp_die( __( 'You do not have permission to access this page.' ) );
</ins><span class="cx">
</span><del>-                do_action( "unarchive_blog", $id );
-                update_blog_status( $id, "archived", '0' );
-                wp_redirect( add_query_arg( array('updated' => 'true', 'action' => 'unarchive'), $_POST['ref'] ) );
</del><ins>+                do_action( 'unarchive_blog', $id );
+                update_blog_status( $id, 'archived', '0' );
+                wp_redirect( add_query_arg( array( 'updated' => 'true', 'action' => 'unarchive' ), wp_get_referer() ) );
</ins><span class="cx">                 exit();
</span><span class="cx">         break;
</span><span class="cx">
</span><del>-        case "activateblog":
-                check_admin_referer('activateblog');
</del><ins>+        case 'activateblog':
+                check_admin_referer( 'activateblog' );
</ins><span class="cx">                 if ( ! current_user_can( 'manage_sites' ) )
</span><del>-                        wp_die( __('You do not have permission to access this page.') );
</del><ins>+                        wp_die( __( 'You do not have permission to access this page.' ) );
</ins><span class="cx">
</span><del>-                update_blog_status( $id, "deleted", '0' );
-                do_action( "activate_blog", $id );
-                wp_redirect( add_query_arg( "updated", array('updated' => 'true', 'action' => 'activate'), $_POST['ref'] ) );
</del><ins>+                update_blog_status( $id, 'deleted', '0' );
+                do_action( 'activate_blog', $id );
+                wp_redirect( add_query_arg( array( 'updated' => 'true', 'action' => 'activate' ), wp_get_referer() ) );
</ins><span class="cx">                 exit();
</span><span class="cx">         break;
</span><span class="cx">
</span><del>-        case "deactivateblog":
-                check_admin_referer('deactivateblog');
</del><ins>+        case 'deactivateblog':
+                check_admin_referer( 'deactivateblog' );
</ins><span class="cx">                 if ( ! current_user_can( 'manage_sites' ) )
</span><del>-                        wp_die( __('You do not have permission to access this page.') );
</del><ins>+                        wp_die( __( 'You do not have permission to access this page.' ) );
</ins><span class="cx">
</span><del>-                do_action( "deactivate_blog", $id );
-                update_blog_status( $id, "deleted", '1' );
-                wp_redirect( add_query_arg( array('updated' => 'true', 'action' => 'deactivate'), $_POST['ref'] ) );
</del><ins>+                do_action( 'deactivate_blog', $id );
+                update_blog_status( $id, 'deleted', '1' );
+                wp_redirect( add_query_arg( array( 'updated' => 'true', 'action' => 'deactivate' ), wp_get_referer() ) );
</ins><span class="cx">                 exit();
</span><span class="cx">         break;
</span><span class="cx">
</span><del>-        case "unspamblog":
-                check_admin_referer('unspamblog');
</del><ins>+        case 'unspamblog':
+                check_admin_referer( 'unspamblog' );
</ins><span class="cx">                 if ( ! current_user_can( 'manage_sites' ) )
</span><del>-                        wp_die( __('You do not have permission to access this page.') );
</del><ins>+                        wp_die( __( 'You do not have permission to access this page.' ) );
</ins><span class="cx">
</span><del>-                update_blog_status( $id, "spam", '0' );
-                wp_redirect( add_query_arg( array('updated' => 'true', 'action' => 'unspam'), $_POST['ref'] ) );
</del><ins>+                update_blog_status( $id, 'spam', '0' );
+                wp_redirect( add_query_arg( array( 'updated' => 'true', 'action' => 'unspam' ), wp_get_referer() ) );
</ins><span class="cx">                 exit();
</span><span class="cx">         break;
</span><span class="cx">
</span><del>-        case "spamblog":
-                check_admin_referer('spamblog');
</del><ins>+        case 'spamblog':
+                check_admin_referer( 'spamblog' );
</ins><span class="cx">                 if ( ! current_user_can( 'manage_sites' ) )
</span><del>-                        wp_die( __('You do not have permission to access this page.') );
</del><ins>+                        wp_die( __( 'You do not have permission to access this page.' ) );
</ins><span class="cx">
</span><del>-                update_blog_status( $id, "spam", '1' );
-                wp_redirect( add_query_arg( array('updated' => 'true', 'action' => 'spam'), $_POST['ref'] ) );
</del><ins>+                update_blog_status( $id, 'spam', '1' );
+                wp_redirect( add_query_arg( array( 'updated' => 'true', 'action' => 'spam' ), wp_get_referer() ) );
</ins><span class="cx">                 exit();
</span><span class="cx">         break;
</span><span class="cx">
</span><del>-        case "mature":
</del><ins>+        case 'matureblog':
+                check_admin_referer( 'matureblog' );
+                if ( ! current_user_can( 'manage_sites' ) )
+                        wp_die( __( 'You do not have permission to access this page.' ) );
+
</ins><span class="cx">                 update_blog_status( $id, 'mature', '1' );
</span><span class="cx">                 do_action( 'mature_blog', $id );
</span><del>-                wp_redirect( add_query_arg( array('updated' => 'true', 'action' => 'mature'), $_POST['ref'] ) );
</del><ins>+                wp_redirect( add_query_arg( array( 'updated' => 'true', 'action' => 'mature' ), wp_get_referer() ) );
</ins><span class="cx">                 exit();
</span><span class="cx">         break;
</span><span class="cx">
</span><del>-        case "unmature":
</del><ins>+        case 'unmatureblog':
+                check_admin_referer( 'unmatureblog' );
+                if ( ! current_user_can( 'manage_sites' ) )
+                        wp_die( __( 'You do not have permission to access this page.' ) );
+
</ins><span class="cx">                 update_blog_status( $id, 'mature', '0' );
</span><span class="cx">                 do_action( 'unmature_blog', $id );
</span><del>-                wp_redirect( add_query_arg( array('updated' => 'true', 'action' => 'umature'), $_POST['ref'] ) );
</del><ins>+                wp_redirect( add_query_arg( array( 'updated' => 'true', 'action' => 'unmature' ), wp_get_referer() ) );
</ins><span class="cx">                 exit();
</span><span class="cx">         break;
</span><span class="cx">
</span><span class="cx">         // Themes
</span><del>- case "updatethemes":
</del><ins>+ case 'updatethemes':
</ins><span class="cx">         if ( ! current_user_can( 'manage_network_themes' ) )
</span><del>-                wp_die( __('You do not have permission to access this page.') );
</del><ins>+                wp_die( __( 'You do not have permission to access this page.' ) );
</ins><span class="cx">
</span><span class="cx">         if ( is_array( $_POST['theme'] ) ) {
</span><span class="cx">                         $themes = get_themes();
</span><span class="lines">@@ -445,174 +455,217 @@
</span><span class="cx">                         }
</span><span class="cx">                         update_site_option( 'allowedthemes', $allowed_themes );
</span><span class="cx">                 }
</span><del>-                wp_redirect( add_query_arg( array('updated' => 'true', 'action' => 'themes'), $_SERVER['HTTP_REFERER'] ) );
</del><ins>+                wp_redirect( add_query_arg( array( 'updated' => 'true', 'action' => 'themes' ), wp_get_referer() ) );
</ins><span class="cx">                 exit();
</span><span class="cx">         break;
</span><span class="cx">
</span><span class="cx">         // Common
</span><del>-        case "confirm":
-                $referrer = ( isset($_GET['ref']) ) ? stripslashes($_GET['ref']) : $_SERVER['HTTP_REFERER'];
-                $referrer = esc_url($referrer);
</del><ins>+        case 'confirm':
</ins><span class="cx">                 if ( !headers_sent() ) {
</span><span class="cx">                         nocache_headers();
</span><span class="cx">                         header( 'Content-Type: text/html; charset=utf-8' );
</span><span class="cx">                 }
</span><ins>+                if ( $current_site->blog_id == $id )        
+                        wp_die( __( 'You are not allowed to change the current site.' ) );
</ins><span class="cx">                 ?>
</span><span class="cx">                 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
</span><del>-                <html xmlns="http://www.w3.org/1999/xhtml" <?php if ( function_exists('language_attributes') ) language_attributes(); ?>>
</del><ins>+                <html xmlns="http://www.w3.org/1999/xhtml" <?php if ( function_exists( 'language_attributes' ) ) language_attributes(); ?>>
</ins><span class="cx">                         <head>
</span><del>-                                <title><?php _e("WordPress &rsaquo; Confirm your action"); ?></title>
</del><ins>+                                <title><?php _e( 'WordPress &rsaquo; Confirm your action' ); ?></title>
</ins><span class="cx">
</span><span class="cx">                                 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</span><span class="cx">                                 <?php wp_admin_css( 'install', true ); ?>
</span><span class="cx">                         </head>
</span><span class="cx">                         <body id="error-page">
</span><del>-                                <h1 id="logo"><img alt="WordPress" src="<?php echo esc_url( admin_url( 'images/wordpress-logo.png' ) ); ?>" /></h1>
-                                <form action='ms-edit.php?action=<?php echo esc_attr( $_GET[ 'action2' ] ) ?>' method='post'>
-                                        <input type='hidden' name='action' value='<?php echo esc_attr( $_GET['action2'] ) ?>' />
-                                        <input type='hidden' name='id' value='<?php echo esc_attr( $id ); ?>' />
-                                        <input type='hidden' name='ref' value='<?php echo $referrer; ?>' />
-                                        <?php wp_nonce_field( $_GET['action2'] ) ?>
-                                        <p><?php echo esc_html( stripslashes($_GET['msg']) ); ?></p>
-                                        <p class="submit"><input class="button" type='submit' value='<?php _e("Confirm"); ?>' /></p>
</del><ins>+                                <h1 id="logo"><img alt="WordPress" src="<?php echo esc_attr( admin_url( 'images/wordpress-logo.png' ) ); ?>" /></h1>
+                                <form action="ms-edit.php?action=<?php echo esc_attr( $_GET['action2'] ) ?>" method="post">
+                                        <input type="hidden" name="action" value="<?php echo esc_attr( $_GET['action2'] ) ?>" />
+                                        <input type="hidden" name="id" value="<?php echo esc_attr( $id ); ?>" />
+                                        <input type="hidden" name="_wp_http_referer" value="<?php echo esc_attr( wp_get_referer() ); ?>" />
+                                        <?php wp_nonce_field( $_GET['action2'], '_wpnonce', false ); ?>
+                                        <p><?php esc_html_e( stripslashes( $_GET['msg'] ) ); ?></p>
+                                        <p class="submit"><input class="button" type="submit" value="<?php _e( 'Confirm' ); ?>" /></p>
</ins><span class="cx">                                 </form>
</span><span class="cx">                         </body>
</span><span class="cx">                 </html>
</span><span class="cx">                 <?php
</span><span class="cx">         break;
</span><span class="cx">
</span><del>-        // Users (not used any more)
-        case "deleteuser":
-                check_admin_referer('deleteuser');
-                if ( $id != '0' && $id != '1' )
-                        wpmu_delete_user($id);
</del><ins>+        // Users
+        case 'deleteuser':
+                if ( ! current_user_can( 'manage_network_users' ) )
+                        wp_die( __( 'You do not have permission to access this page.' ) );
</ins><span class="cx">
</span><del>-                wp_redirect( add_query_arg( array('updated' => 'true', 'action' => 'delete'), $_POST['ref'] ) );
-                exit();
</del><ins>+                check_admin_referer( 'deleteuser' );
+
+                if ( $id != '0' && $id != '1' ) {
+                        $_POST['allusers'] = array( $id ); // confirm_delete_users() can only handle with arrays
+                        $title = __( 'Users' );
+                        $parent_file = 'ms-admin.php';
+                        require_once( 'admin-header.php' );
+                        echo '<div class="wrap">';
+                        confirm_delete_users( $_POST['allusers'] );
+                        echo '</div>';
+ require_once( 'admin-footer.php' );
+ exit();
+                } else {
+                        wp_redirect( admin_url( 'ms-users.php' ) );        
+                }
</ins><span class="cx">         break;
</span><span class="cx">
</span><del>-        case "allusers":
-                check_admin_referer('allusers');
</del><ins>+        case 'allusers':
</ins><span class="cx">                 if ( ! current_user_can( 'manage_network_users' ) )
</span><del>-                        wp_die( __('You do not have permission to access this page.') );
</del><ins>+                        wp_die( __( 'You do not have permission to access this page.' ) );
</ins><span class="cx">
</span><del>-                if ( isset($_POST['alluser_delete']) ) {
-                        require_once('admin-header.php');
-                        echo '<div class="wrap" style="position:relative;">';
-                        confirm_delete_users( $_POST['allusers'] );
-                        echo '</div>';
- require_once('admin-footer.php');
-                } elseif ( isset( $_POST[ 'alluser_transfer_delete' ] ) ) {
-                        if ( is_array( $_POST[ 'blog' ] ) && !empty( $_POST[ 'blog' ] ) ) {
-                                foreach ( $_POST[ 'blog' ] as $id => $users ) {
-                                        foreach ( $users as $blogid => $user_id ) {
-                                                remove_user_from_blog( $id, $blogid, $user_id );
-                                        }
-                                }
-                        }
-                        if ( is_array( $_POST[ 'user' ] ) && !empty( $_POST[ 'user' ] ) )
-                                foreach( $_POST[ 'user' ] as $id )
-                                        wpmu_delete_user( $id );
</del><ins>+                if ( isset( $_POST['doaction']) || isset($_POST['doaction2'] ) ) {
+                        check_admin_referer( 'bulk-ms-users' );
</ins><span class="cx">
</span><del>-                        wp_redirect( add_query_arg( array('updated' => 'true', 'action' => 'all_delete'), 'ms-users.php' ) );
-                } elseif ( isset( $_POST[ 'add_superadmin' ] ) ) {
-                        $super_admins = get_site_option( 'site_admins', array( 'admin' ) );
-                        $mainblog_id = $wpdb->get_var( "SELECT blog_id FROM {$wpdb->blogs} WHERE domain='{$current_site->domain}' AND path='{$current_site->path}'" );
</del><ins>+                        if ( $_GET['action'] != -1 || $_POST['action2'] != -1 )
+                                $doaction = $_POST['action'] != -1 ? $_POST['action'] : $_POST['action2'];
+
</ins><span class="cx">                         foreach ( (array) $_POST['allusers'] as $key => $val ) {
</span><del>-                                if ( $val == '' || $val == '0' )
-                                        continue;
-                                $user = new WP_User( $val );
-                                if ( in_array( $user->user_login, $super_admins ) )
-                                        continue;
-                                if ( $mainblog_id )
-                                        add_user_to_blog( $mainblog_id, $user->ID, 'administrator' );
-                                $super_admins[] = $user->user_login;
-                        }
-                        update_site_option( 'site_admins' , $super_admins );
</del><ins>+                                if ( $val != '' || $val != '0' ) {
+                                        switch ( $doaction ) {
+                                                case 'delete':
+                                                        $title = __( 'Users' );
+                                                        $parent_file = 'ms-admin.php';
+                                                        require_once( 'admin-header.php' );
+                                                        echo '<div class="wrap">';
+                                                        confirm_delete_users( $_POST['allusers'] );
+                                                        echo '</div>';
+                                 require_once( 'admin-footer.php' );
+                                 exit();
+                                         break;
</ins><span class="cx">
</span><del>-                        wp_redirect( add_query_arg( array( 'updated' => 'true', 'action' => 'add_superadmin' ), $_SERVER['HTTP_REFERER'] ) );
-                } elseif ( isset( $_POST[ 'remove_superadmin' ] ) ) {
-                        $super_admins = get_site_option( 'site_admins', array( 'admin' ) );
-                        $admin_email = get_site_option( 'admin_email' );
-                        foreach ( (array) $_POST['allusers'] as $key => $val ) {
-                                if ( $val == '' || $val == '0' )
-                                        continue;
-                                $user = new WP_User( $val );
-                                if ( $user->ID == $current_user->ID || $user->user_email == $admin_email )
-                                        continue;
-                                foreach ( $super_admins as $key => $username ) {
-                                        if ( $username == $user->user_login ) {
-                                                unset( $super_admins[ $key ] );
</del><ins>+                                                case 'superadmin':
+                                                        $userfunction = 'add_superadmin';
+                                                        $super_admins = get_site_option( 'site_admins', array( 'admin' ) );
+
+                                                        $user = new WP_User( $val );
+                                                        if ( ! in_array( $user->user_login, $super_admins ) ) {
+                                                                if ( $current_site->blog_id )
+                                                                        add_user_to_blog( $current_site->blog_id, $user->ID, 'administrator' );
+
+                                                                $super_admins[] = $user->user_login;
+                                                                update_site_option( 'site_admins' , $super_admins );
+                                                        }
</ins><span class="cx">                                                 break;
</span><del>-                                        }
-                                }
</del><ins>+
+                                                case 'notsuperadmin':
+                                                        $userfunction = 'remove_superadmin';
+                                                        $super_admins = get_site_option( 'site_admins', array( 'admin' ) );
+                                                        $admin_email = get_site_option( 'admin_email' );
+                                                        
+                                                        $user = new WP_User( $val );
+                                                        if ( $user->ID != $current_user->ID || $user->user_email != $admin_email ) {
+                                                                foreach ( $super_admins as $key => $username ) {
+                                                                        if ( $username == $user->user_login ) {
+                                                                                unset( $super_admins[$key] );
+                                                                                break;
+                                                                        }
+                                                                }
+                                                        }
+
+                                                        update_site_option( 'site_admins' , $super_admins );
+                                                break;
+
+                                                case 'spam':
+                                                        $user = new WP_User( $val );
+                                                        if ( in_array( $user->user_login, get_site_option( 'site_admins', array( 'admin' ) ) ) )
+                                                                wp_die( sprintf( __( 'Warning! User cannot be modified. The user %s is a network admnistrator.' ), esc_html( $user->user_login ) ) );
+
+                                                        $userfunction = 'all_spam';
+                                                        $blogs = get_blogs_of_user( $val, true );
+                                                        foreach ( (array) $blogs as $key => $details ) {
+                                                                if ( $details->userblog_id != $current_site->blog_id ) // main blog not a spam !
+                                                                        update_blog_status( $details->userblog_id, 'spam', '1' );
+                                                        }
+                                                        update_user_status( $val, 'spam', '1', 1 );
+                                                break;
+
+                                                case 'notspam':
+                                                        $userfunction = 'all_notspam';
+                                                        $blogs = get_blogs_of_user( $val, true );
+                                                        foreach ( (array) $blogs as $key => $details )
+                                                                update_blog_status( $details->userblog_id, 'spam', '0' );
+
+                                                        update_user_status( $val, 'spam', '0', 1 );
+                                                break;
+                                        }                
+                                }                        
</ins><span class="cx">                         }
</span><del>-                        update_site_option( 'site_admins' , $super_admins );
</del><span class="cx">
</span><del>-                        wp_redirect( add_query_arg( array( 'updated' => 'true', 'action' => 'remove_superadmin' ), $_SERVER['HTTP_REFERER'] ) );
</del><ins>+                        wp_redirect( add_query_arg( array( 'updated' => 'true', 'action' => $userfunction ), wp_get_referer() ) );
+                        exit();
</ins><span class="cx">                 } else {
</span><del>-                        foreach ( (array) $_POST['allusers'] as $key => $val ) {
-                                if ( $val == '' || $val == '0' )
-                                        continue;
-                                $user = new WP_User( $val );
-                                if ( in_array( $user->user_login, get_site_option( 'site_admins', array( 'admin' ) ) ) )
-                                        wp_die( sprintf( __( 'Warning! User cannot be modified. The user %s is a network admnistrator.' ), $user->user_login ) );
-                                if ( isset($_POST['alluser_spam']) ) {
-                                        $userfunction = 'all_spam';
-                                        $blogs = get_blogs_of_user( $val, true );
-                                        foreach ( (array) $blogs as $key => $details ) {
-                                                if ( $details->userblog_id == $current_site->blog_id ) { continue; } // main blog not a spam !
-                                                update_blog_status( $details->userblog_id, "spam", '1' );
-                                        }
-                                        update_user_status( $val, "spam", '1', 1 );
-                                } elseif ( isset($_POST['alluser_notspam']) ) {
-                                        $userfunction = 'all_notspam';
-                                        $blogs = get_blogs_of_user( $val, true );
-                                        foreach ( (array) $blogs as $key => $details ) {
-                                                update_blog_status( $details->userblog_id, "spam", '0' );
-                                        }
-                                        update_user_status( $val, "spam", '0', 1 );
</del><ins>+                        wp_redirect( admin_url( 'ms-users.php' ) );
+                }
+        break;
+
+        case 'dodelete':
+                check_admin_referer( 'ms-users-delete' );
+                if ( ! current_user_can( 'manage_network_users' ) )
+                        wp_die( __( 'You do not have permission to access this page.' ) );
+
+                if ( is_array( $_POST['blog'] ) && ! empty( $_POST['blog'] ) ) {
+                        foreach ( $_POST['blog'] as $id => $users ) {
+                                foreach ( $users as $blogid => $user_id ) {
+                                        if ( ! empty( $_POST['delete'] ) && 'reassign' == $_POST['delete'][$blogid][$id] )
+                                                remove_user_from_blog( $id, $blogid, $user_id );
+                                        else
+                                                remove_user_from_blog( $id, $blogid );
</ins><span class="cx">                                 }
</span><span class="cx">                         }
</span><del>-                        wp_redirect( add_query_arg( array('updated' => 'true', 'action' => $userfunction), $_SERVER['HTTP_REFERER'] ) );
</del><span class="cx">                 }
</span><del>-                exit();
</del><ins>+                $i = 0;
+                if ( is_array( $_POST['user'] ) && ! empty( $_POST['user'] ) )
+                        foreach( $_POST['user'] as $id ) {
+                                wpmu_delete_user( $id );
+                                $i++;        
+                        }
+
+                if ( $i == 1 )
+                        $deletefunction = 'delete';
+                else
+                        $deletefunction = 'all_delete';
+
+                wp_redirect( add_query_arg( array( 'updated' => 'true', 'action' => $deletefunction ), admin_url( 'ms-users.php' ) ) );
</ins><span class="cx">         break;
</span><span class="cx">
</span><del>-        case "adduser":
-                check_admin_referer('add-user');
</del><ins>+        case 'adduser':
+                check_admin_referer( 'add-user' );
</ins><span class="cx">                 if ( ! current_user_can( 'manage_network_users' ) )
</span><del>-                        wp_die( __('You do not have permission to access this page.') );
</del><ins>+                        wp_die( __( 'You do not have permission to access this page.' ) );
</ins><span class="cx">
</span><del>-                if ( is_array( $_POST[ 'user' ] ) == false )
-                        wp_die( __( "Cannot create an empty user." ) );
</del><ins>+                if ( is_array( $_POST['user'] ) == false )
+                        wp_die( __( 'Cannot create an empty user.' ) );
</ins><span class="cx">                 $user = $_POST['user'];
</span><span class="cx">                 if ( empty($user['username']) && empty($user['email']) )
</span><del>-                        wp_die( __('Missing username and email.') );
</del><ins>+                        wp_die( __( 'Missing username and email.' ) );
</ins><span class="cx">                 elseif ( empty($user['username']) )
</span><del>-                        wp_die( __('Missing username.') );
</del><ins>+                        wp_die( __( 'Missing username.' ) );
</ins><span class="cx">                 elseif ( empty($user['email']) )
</span><del>-                        wp_die( __('Missing email.') );
</del><ins>+                        wp_die( __( 'Missing email.' ) );
</ins><span class="cx">
</span><span class="cx">                 $password = wp_generate_password();
</span><del>-                $user_id = wpmu_create_user(esc_html( strtolower( $user['username'] ) ), $password, esc_html( $user['email'] ) );
</del><ins>+                $user_id = wpmu_create_user( esc_html( strtolower( $user['username'] ) ), $password, esc_html( $user['email'] ) );
</ins><span class="cx">
</span><span class="cx">                 if ( false == $user_id )
</span><del>-                         wp_die( __('Duplicated username or email address.') );
</del><ins>+                         wp_die( __( 'Duplicated username or email address.' ) );
</ins><span class="cx">                 else
</span><del>-                        wp_new_user_notification($user_id, $password);
</del><ins>+                        wp_new_user_notification( $user_id, $password );
</ins><span class="cx">
</span><span class="cx">                 if ( get_site_option( 'dashboard_blog' ) == false )
</span><span class="cx">                         add_user_to_blog( $current_site->blog_id, $user_id, get_site_option( 'default_user_role', 'subscriber' ) );
</span><span class="cx">                 else
</span><span class="cx">                         add_user_to_blog( get_site_option( 'dashboard_blog' ), $user_id, get_site_option( 'default_user_role', 'subscriber' ) );
</span><span class="cx">
</span><del>-                wp_redirect( add_query_arg( array('updated' => 'true', 'action' => 'add'), $_SERVER['HTTP_REFERER'] ) );
</del><ins>+                wp_redirect( add_query_arg( array( 'updated' => 'true', 'action' => 'add' ), wp_get_referer() ) );
</ins><span class="cx">                 exit();
</span><span class="cx">         break;
</span><span class="cx">
</span><span class="cx">         default:
</span><del>-                wpmu_admin_do_redirect( "ms-admin.php" );
</del><ins>+                wp_redirect( admin_url( 'ms-admin.php' ) );
</ins><span class="cx">         break;
</span><span class="cx"> }
</span><span class="cx"> ?>
</span></span></pre></div>
<a id="trunkwpadminmsoptionsphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/ms-options.php (13917 => 13918)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/ms-options.php        2010-04-01 20:32:17 UTC (rev 13917)
+++ trunk/wp-admin/ms-options.php        2010-04-01 21:21:27 UTC (rev 13918)
</span><span class="lines">@@ -1,42 +1,42 @@
</span><span class="cx"> <?php
</span><del>-require_once('admin.php');
</del><ins>+require_once( './admin.php' );
</ins><span class="cx">
</span><span class="cx"> if ( !is_multisite() )
</span><del>-        wp_die( __('Multisite support is not enabled.') );
</del><ins>+        wp_die( __( 'Multisite support is not enabled.' ) );
</ins><span class="cx">
</span><del>-$title = __('Network Options');
</del><ins>+$title = __( 'Network Options' );
</ins><span class="cx"> $parent_file = 'ms-admin.php';
</span><span class="cx">
</span><del>-include('admin-header.php');
</del><ins>+include( './admin-header.php' );
</ins><span class="cx">
</span><span class="cx"> if ( ! current_user_can( 'manage_network_options' ) )
</span><del>- wp_die( __('You do not have permission to access this page.') );
</del><ins>+ wp_die( __( 'You do not have permission to access this page.' ) );
</ins><span class="cx">
</span><span class="cx"> if (isset($_GET['updated'])) {
</span><span class="cx">         ?>
</span><del>-        <div id="message" class="updated fade"><p><?php _e('Options saved.') ?></p></div>
</del><ins>+        <div id="message" class="updated fade"><p><?php _e( 'Options saved.' ) ?></p></div>
</ins><span class="cx">         <?php
</span><span class="cx"> }
</span><span class="cx"> ?>
</span><span class="cx">
</span><span class="cx"> <div class="wrap">
</span><span class="cx">         <?php screen_icon(); ?>
</span><del>-        <h2><?php _e('Network Options') ?></h2>
</del><ins>+        <h2><?php _e( 'Network Options' ) ?></h2>
</ins><span class="cx">         <form method="post" action="ms-edit.php?action=siteoptions">
</span><del>-                <?php wp_nonce_field( "siteoptions" ); ?>
-                <h3><?php _e('Operational Settings'); ?></h3>
</del><ins>+                <?php wp_nonce_field( 'siteoptions' ); ?>
+                <h3><?php _e( 'Operational Settings' ); ?></h3>
</ins><span class="cx">                 <table class="form-table">
</span><span class="cx">                         <tr valign="top">
</span><del>-                                <th scope="row"><label for="site_name"><?php _e('Network Name') ?></label></th>
</del><ins>+                                <th scope="row"><label for="site_name"><?php _e( 'Network Name' ) ?></label></th>
</ins><span class="cx">                                 <td>
</span><del>-                                        <input name="site_name" type="text" id="site_name" class="regular-text" value="<?php echo esc_attr($current_site->site_name) ?>" />
</del><ins>+                                        <input name="site_name" type="text" id="site_name" class="regular-text" value="<?php echo esc_attr( $current_site->site_name ) ?>" />
</ins><span class="cx">                                         <br />
</span><del>-                                        <?php _e('What you would like to call this website.') ?>
</del><ins>+                                        <?php _e( 'What you would like to call this website.' ) ?>
</ins><span class="cx">                                 </td>
</span><span class="cx">                         </tr>
</span><span class="cx">
</span><span class="cx">                         <tr valign="top">
</span><del>-                                <th scope="row"><label for="admin_email"><?php _e('Network Admin Email') ?></label></th>
</del><ins>+                                <th scope="row"><label for="admin_email"><?php _e( 'Network Admin Email' ) ?></label></th>
</ins><span class="cx">                                 <td>
</span><span class="cx">                                         <input name="admin_email" type="text" id="admin_email" class="regular-text" value="<?php echo esc_attr( get_site_option('admin_email') ) ?>" />
</span><span class="cx">                                         <br />
</span><span class="lines">@@ -45,16 +45,16 @@
</span><span class="cx">                         </tr>
</span><span class="cx">
</span><span class="cx">                         <tr valign="top">
</span><del>-                                <th scope="row"><?php _e('Global Terms') ?></th>
</del><ins>+                                <th scope="row"><?php _e( 'Global Terms' ) ?></th>
</ins><span class="cx">                                 <td>
</span><del>-                                <label><input type='radio' id="global_terms_enabled" name="global_terms_enabled" value='1'<?php checked( get_site_option( 'global_terms_enabled' ), 1 ) ?>/> <?php _e( 'Maintain a global list of terms from all sites across the network.' ); ?></label><br />
-                                <label><input type='radio' id="global_terms_enabled" name="global_terms_enabled" value='0'<?php checked( get_site_option( 'global_terms_enabled' ), 0 ) ?>/> <?php _e( 'Disabled' ); ?></label></td>
</del><ins>+                                <label><input type="radio" id="global_terms_enabled" name="global_terms_enabled" value="1"<?php checked( get_site_option( 'global_terms_enabled' ), 1 ) ?>/> <?php _e( 'Maintain a global list of terms from all sites across the network.' ); ?></label><br />
+                                <label><input type="radio" id="global_terms_enabled" name="global_terms_enabled" value="0"<?php checked( get_site_option( 'global_terms_enabled' ), 0 ) ?>/> <?php _e( 'Disabled' ); ?></label></td>
</ins><span class="cx">                         </tr>
</span><span class="cx">                 </table>
</span><del>-                <h3><?php _e('Dashboard Settings'); ?></h3>
</del><ins>+                <h3><?php _e( 'Dashboard Settings' ); ?></h3>
</ins><span class="cx">                 <table class="form-table">
</span><span class="cx">                         <tr valign="top">
</span><del>-                                <th scope="row"><label for="dashboard_blog"><?php _e('Dashboard Site') ?></label></th>
</del><ins>+                                <th scope="row"><label for="dashboard_blog"><?php _e( 'Dashboard Site' ) ?></label></th>
</ins><span class="cx">                                 <td>
</span><span class="cx">                                         <?php
</span><span class="cx">                                         if ( $dashboard_blog = get_site_option( 'dashboard_blog' ) ) {
</span><span class="lines">@@ -63,14 +63,14 @@
</span><span class="cx">                                         } else {
</span><span class="cx">                                                 $blogname = '';
</span><span class="cx">                                         }?>
</span><del>-                                        <input name="dashboard_blog_orig" type="hidden" id="dashboard_blog_orig" value="<?php echo esc_attr($blogname); ?>" />
-                                        <input name="dashboard_blog" type="text" id="dashboard_blog" value="<?php echo esc_attr($blogname); ?>" class="regular-text" />
</del><ins>+                                        <input name="dashboard_blog_orig" type="hidden" id="dashboard_blog_orig" value="<?php echo esc_attr( $blogname ); ?>" />
+                                        <input name="dashboard_blog" type="text" id="dashboard_blog" value="<?php echo esc_attr( $blogname ); ?>" class="regular-text" />
</ins><span class="cx">                                         <br />
</span><span class="cx">                                         <?php _e( "Site path ('dashboard', 'control', 'manager', etc) or blog id.<br />New users are added to this site as the user role defined below if they don't have a site. Leave blank for the main site. Users with the subscriber role on old site will be moved to the new site if changed. The new site will be created if it does not exist." ); ?>
</span><span class="cx">                                 </td>
</span><span class="cx">                         </tr>
</span><span class="cx">                         <tr valign="top">
</span><del>-                                <th scope="row"><label for="default_user_role"><?php _e('Dashboard User Default Role') ?></label></th>
</del><ins>+                                <th scope="row"><label for="default_user_role"><?php _e( 'Dashboard User Default Role' ) ?></label></th>
</ins><span class="cx">                                 <td>
</span><span class="cx">                                         <select name="default_user_role" id="default_user_role"><?php
</span><span class="cx">                                         wp_dropdown_roles( get_site_option( 'default_user_role', 'subscriber' ) );
</span><span class="lines">@@ -81,75 +81,77 @@
</span><span class="cx">                                 </td>
</span><span class="cx">                         </tr>
</span><span class="cx">                         <tr valign="top">
</span><del>-                                <th scope="row"><label for="admin_notice_feed"><?php _e('Admin Notice Feed') ?></label></th>
</del><ins>+                                <th scope="row"><label for="admin_notice_feed"><?php _e( 'Admin Notice Feed' ) ?></label></th>
</ins><span class="cx">                                 <td><input name="admin_notice_feed" class="large-text" type="text" id="admin_notice_feed" value="<?php echo esc_attr( get_site_option( 'admin_notice_feed' ) ) ?>" size="80" /><br />
</span><span class="cx">                                 <?php _e( 'Display the latest post from this RSS or Atom feed on all site dashboards. Leave blank to disable.' ); ?><br />
</span><del>-                                <?php if ( get_site_option( 'admin_notice_feed' ) != network_home_url('feed/', 'http') )
-                                        echo __( "A good one to use would be the feed from your main site: " ) . network_home_url('feed/'); ?></td>
</del><ins>+                                
+                                <?php if ( get_site_option( 'admin_notice_feed' ) != get_home_url( $current_site->id, 'feed/' ) )
+                                        echo __( 'A good one to use would be the feed from your main site: ' ) . esc_url( get_home_url( $current_site->id, 'feed/' ) ) ?></td>
</ins><span class="cx">                         </tr>
</span><span class="cx">                 </table>
</span><del>-                <h3><?php _e('Registration Settings'); ?></h3>
</del><ins>+                <h3><?php _e( 'Registration Settings' ); ?></h3>
</ins><span class="cx">                 <table class="form-table">
</span><span class="cx">                         <tr valign="top">
</span><del>-                                <th scope="row"><?php _e('Allow new registrations') ?></th>
</del><ins>+                                <th scope="row"><?php _e( 'Allow new registrations' ) ?></th>
</ins><span class="cx">                                 <?php
</span><del>-                                if ( !get_site_option('registration') )
</del><ins>+                                if ( !get_site_option( 'registration' ) )
</ins><span class="cx">                                         update_site_option( 'registration', 'none' );
</span><ins>+                                $reg = get_site_option( 'registration' );
</ins><span class="cx">                                 ?>
</span><span class="cx">                                 <td>
</span><del>-                                        <label><input name="registration" type="radio" id="registration1" value='none'<?php checked( get_site_option('registration'), 'none') ?> /> <?php _e('Registration is disabled.'); ?></label><br />
-                                        <label><input name="registration" type="radio" id="registration2" value='user'<?php checked( get_site_option('registration'), 'user') ?> /> <?php _e('User accounts may be registered.'); ?></label><br />
-                                        <label><input name="registration" type="radio" id="registration3" value='blog'<?php checked( get_site_option('registration'), 'blog') ?> /> <?php _e('Logged in users may register new sites.'); ?></label><br />
-                                        <label><input name="registration" type="radio" id="registration4" value='all'<?php checked( get_site_option('registration'), 'all') ?> /> <?php _e('Both sites and user accounts can be registered.'); ?></label><br />
-                                        <p><?php _e('Disable or enable registration and who or what can be registered. (Default is disabled.)'); ?></p>
</del><ins>+                                        <label><input name="registration" type="radio" id="registration1" value="none"<?php checked( $reg, 'none') ?> /> <?php _e( 'Registration is disabled.' ); ?></label><br />
+                                        <label><input name="registration" type="radio" id="registration2" value="user"<?php checked( $reg, 'user') ?> /> <?php _e( 'User accounts may be registered.' ); ?></label><br />
+                                        <label><input name="registration" type="radio" id="registration3" value="blog"<?php checked( $reg, 'blog') ?> /> <?php _e( 'Logged in users may register new sites.' ); ?></label><br />
+                                        <label><input name="registration" type="radio" id="registration4" value="all"<?php checked( $reg, 'all') ?> /> <?php _e( 'Both sites and user accounts can be registered.' ); ?></label><br />
+                                        <p><?php _e( 'Disable or enable registration and who or what can be registered. (Default is disabled.)' ); ?></p>
</ins><span class="cx">                                         <?php if ( is_subdomain_install() ) {
</span><del>-                                                echo '<p>' . __('If registration is disabled, please set <code>NOBLOGREDIRECT</code> in <code>wp-config.php</code> to a url you will redirect visitors to if they visit a non-existent site.') . '</p>';
</del><ins>+                                                echo '<p>' . __( 'If registration is disabled, please set <code>NOBLOGREDIRECT</code> in <code>wp-config.php</code> to a url you will redirect visitors to if they visit a non-existent site.' ) . '</p>';
</ins><span class="cx">                                         } ?>
</span><span class="cx">                                 </td>
</span><span class="cx">                         </tr>
</span><span class="cx">
</span><span class="cx">                         <tr valign="top">
</span><del>-                                <th scope="row"><?php _e('Registration notification') ?></th>
</del><ins>+                                <th scope="row"><?php _e( 'Registration notification' ) ?></th>
</ins><span class="cx">                                 <?php
</span><del>-                                if ( !get_site_option('registrationnotification') )
</del><ins>+                                if ( !get_site_option( 'registrationnotification' ) )
</ins><span class="cx">                                         update_site_option( 'registrationnotification', 'yes' );
</span><span class="cx">                                 ?>
</span><span class="cx">                                 <td>
</span><del>-                                        <label><input name="registrationnotification" type="checkbox" id="registrationnotification" value='yes'<?php checked( get_site_option('registrationnotification'), 'yes' ) ?> /> <?php _e('Send the network admin an email notification every time someone registers a site or user account.') ?></label>
</del><ins>+                                        <label><input name="registrationnotification" type="checkbox" id="registrationnotification" value="yes"<?php checked( get_site_option( 'registrationnotification' ), 'yes' ) ?> /> <?php _e( 'Send the network admin an email notification every time someone registers a site or user account.' ) ?></label>
</ins><span class="cx">                                 </td>
</span><span class="cx">                         </tr>
</span><span class="cx">
</span><span class="cx">                         <tr valign="top" id="addnewusers">
</span><del>-                                <th scope="row"><?php _e('Add New Users') ?></th>
</del><ins>+                                <th scope="row"><?php _e( 'Add New Users' ) ?></th>
</ins><span class="cx">                                 <td>
</span><del>-                                        <label><input name="add_new_users" type="checkbox" id="add_new_users" value='1'<?php checked( get_site_option('add_new_users') ) ?> /> <?php _e('Allow site administrators to add new users to their site via the "Users->Add New" page.'); ?></label>
</del><ins>+                                        <label><input name="add_new_users" type="checkbox" id="add_new_users" value="1"<?php checked( get_site_option( 'add_new_users' ) ) ?> /> <?php _e( 'Allow site administrators to add new users to their site via the "Users->Add New" page.' ); ?></label>
</ins><span class="cx">                                 </td>
</span><span class="cx">                         </tr>
</span><span class="cx">
</span><span class="cx">                         <tr valign="top">
</span><del>-                                <th scope="row"><label for="illegal_names"><?php _e('Banned Names') ?></label></th>
</del><ins>+                                <th scope="row"><label for="illegal_names"><?php _e( 'Banned Names' ) ?></label></th>
</ins><span class="cx">                                 <td>
</span><del>-                                        <input name="illegal_names" type="text" id="illegal_names" class="large-text" value="<?php echo esc_attr( implode( " ", get_site_option('illegal_names') ) ); ?>" size="45" />
</del><ins>+                                        <input name="illegal_names" type="text" id="illegal_names" class="large-text" value="<?php echo esc_attr( implode( " ", get_site_option( 'illegal_names' ) ) ); ?>" size="45" />
</ins><span class="cx">                                         <br />
</span><del>-                                        <?php _e('Users are not allowed to register these sites. Separate names by spaces.') ?>
</del><ins>+                                        <?php _e( 'Users are not allowed to register these sites. Separate names by spaces.' ) ?>
</ins><span class="cx">                                 </td>
</span><span class="cx">                         </tr>
</span><span class="cx">
</span><span class="cx">                         <tr valign="top">
</span><del>-                                <th scope="row"><label for="limited_email_domains"><?php _e('Limited Email Registrations') ?></label></th>
</del><ins>+                                <th scope="row"><label for="limited_email_domains"><?php _e( 'Limited Email Registrations' ) ?></label></th>
</ins><span class="cx">                                 <td>
</span><del>-                                        <?php $limited_email_domains = get_site_option('limited_email_domains');
</del><ins>+                                        <?php $limited_email_domains = get_site_option( 'limited_email_domains' );
</ins><span class="cx">                                         $limited_email_domains = str_replace( ' ', "\n", $limited_email_domains ); ?>
</span><del>-                                        <textarea name="limited_email_domains" id="limited_email_domains" cols='45' rows='5'><?php echo wp_htmledit_pre( $limited_email_domains == '' ? '' : implode( "\n", (array) $limited_email_domains ) ); ?></textarea>
</del><ins>+                                        <textarea name="limited_email_domains" id="limited_email_domains" cols="45" rows="5"><?php echo wp_htmledit_pre( $limited_email_domains == '' ? '' : implode( "\n", (array) $limited_email_domains ) ); ?></textarea>
</ins><span class="cx">                                         <br />
</span><del>-                                        <?php _e('If you want to limit site registrations to certain domains. Enter one domain per line.') ?>
</del><ins>+                                        <?php _e( 'If you want to limit site registrations to certain domains. Enter one domain per line.' ) ?>
</ins><span class="cx">                                 </td>
</span><span class="cx">                         </tr>
</span><span class="cx">
</span><span class="cx">                         <tr valign="top">
</span><span class="cx">                                 <th scope="row"><label for="banned_email_domains"><?php _e('Banned Email Domains') ?></label></th>
</span><span class="cx">                                 <td>
</span><del>-                                        <textarea name="banned_email_domains" id="banned_email_domains" cols='45' rows='5'><?php echo wp_htmledit_pre( get_site_option('banned_email_domains') == '' ? '' : implode( "\n", (array) get_site_option('banned_email_domains') ) ); ?></textarea>
</del><ins>+                                        <textarea name="banned_email_domains" id="banned_email_domains" cols="45" rows="5"><?php echo wp_htmledit_pre( get_site_option( 'banned_email_domains' ) == '' ? '' : implode( "\n", (array) get_site_option( 'banned_email_domains' ) ) ); ?></textarea>
</ins><span class="cx">                                         <br />
</span><span class="cx">                                         <?php _e('If you want to ban domains from site registrations. Enter one domain per line.') ?>
</span><span class="cx">                                 </td>
</span><span class="lines">@@ -160,105 +162,105 @@
</span><span class="cx">                 <table class="form-table">
</span><span class="cx">
</span><span class="cx">                         <tr valign="top">
</span><del>-                                <th scope="row"><label for="welcome_email"><?php _e('Welcome Email') ?></label></th>
</del><ins>+                                <th scope="row"><label for="welcome_email"><?php _e( 'Welcome Email' ) ?></label></th>
</ins><span class="cx">                                 <td>
</span><del>-                                        <textarea name="welcome_email" id="welcome_email" rows='5' cols='45' class="large-text"><?php echo stripslashes( get_site_option('welcome_email') ) ?></textarea>
</del><ins>+                                        <textarea name="welcome_email" id="welcome_email" rows="5" cols="45" class="large-text"><?php echo stripslashes( get_site_option( 'welcome_email' ) ) ?></textarea>
</ins><span class="cx">                                         <br />
</span><del>-                                        <?php _e('The welcome email sent to new site owners.') ?>
</del><ins>+                                        <?php _e( 'The welcome email sent to new site owners.' ) ?>
</ins><span class="cx">                                 </td>
</span><span class="cx">                         </tr>
</span><span class="cx">                         <tr valign="top">
</span><del>-                                <th scope="row"><label for="welcome_user_email"><?php _e('Welcome User Email') ?></label></th>
</del><ins>+                                <th scope="row"><label for="welcome_user_email"><?php _e( 'Welcome User Email' ) ?></label></th>
</ins><span class="cx">                                 <td>
</span><del>-                                         <textarea name="welcome_user_email" id="welcome_user_email" rows='5' cols='45' class="large-text"><?php echo stripslashes( get_site_option('welcome_user_email') ) ?></textarea>
</del><ins>+                                 <textarea name="welcome_user_email" id="welcome_user_email" rows="5" cols="45" class="large-text"><?php echo stripslashes( get_site_option( 'welcome_user_email' ) ) ?></textarea>
</ins><span class="cx">                                         <br />
</span><del>-                                        <?php _e('The welcome email sent to new users.') ?>
</del><ins>+                                        <?php _e( 'The welcome email sent to new users.' ) ?>
</ins><span class="cx">                                 </td>
</span><span class="cx">                         </tr>
</span><span class="cx">                         <tr valign="top">
</span><del>-                                <th scope="row"><label for="first_post"><?php _e('First Post') ?></label></th>
</del><ins>+                                <th scope="row"><label for="first_post"><?php _e( 'First Post' ) ?></label></th>
</ins><span class="cx">                                 <td>
</span><del>-                                        <textarea name="first_post" id="first_post" rows='5' cols='45' class="large-text"><?php echo stripslashes( get_site_option('first_post') ) ?></textarea>
</del><ins>+                                        <textarea name="first_post" id="first_post" rows="5" cols="45" class="large-text"><?php echo stripslashes( get_site_option( 'first_post' ) ) ?></textarea>
</ins><span class="cx">                                         <br />
</span><del>-                                        <?php _e('The first post on a new site.') ?>
</del><ins>+                                        <?php _e( 'The first post on a new site.' ) ?>
</ins><span class="cx">                                 </td>
</span><span class="cx">                         </tr>
</span><span class="cx">                         <tr valign="top">
</span><del>-                                <th scope="row"><label for="first_page"><?php _e('First Page') ?></label></th>
</del><ins>+                                <th scope="row"><label for="first_page"><?php _e( 'First Page' ) ?></label></th>
</ins><span class="cx">                                 <td>
</span><del>-                                        <textarea name="first_page" id="first_page" rows='5' cols='45' class="large-text"><?php echo stripslashes( get_site_option('first_page') ) ?></textarea>
</del><ins>+                                        <textarea name="first_page" id="first_page" rows="5" cols="45" class="large-text"><?php echo stripslashes( get_site_option('first_page') ) ?></textarea>
</ins><span class="cx">                                         <br />
</span><del>-                                        <?php _e('The first page on a new site.') ?>
</del><ins>+                                        <?php _e( 'The first page on a new site.' ) ?>
</ins><span class="cx">                                 </td>
</span><span class="cx">                         </tr>
</span><span class="cx">                         <tr valign="top">
</span><del>-                                <th scope="row"><label for="first_comment"><?php _e('First Comment') ?></label></th>
</del><ins>+                                <th scope="row"><label for="first_comment"><?php _e( 'First Comment' ) ?></label></th>
</ins><span class="cx">                                 <td>
</span><del>-                                        <textarea name="first_comment" id="first_comment" rows='5' cols='45' class="large-text"><?php echo stripslashes( get_site_option('first_comment') ) ?></textarea>
</del><ins>+                                        <textarea name="first_comment" id="first_comment" rows="5" cols="45" class="large-text"><?php echo stripslashes( get_site_option('first_comment') ) ?></textarea>
</ins><span class="cx">                                         <br />
</span><del>-                                        <?php _e('The first comment on a new site.') ?>
</del><ins>+                                        <?php _e( 'The first comment on a new site.' ) ?>
</ins><span class="cx">                                 </td>
</span><span class="cx">                         </tr>
</span><span class="cx">                         <tr valign="top">
</span><del>-                                <th scope="row"><label for="first_comment_author"><?php _e('First Comment Author') ?></label></th>
</del><ins>+                                <th scope="row"><label for="first_comment_author"><?php _e( 'First Comment Author' ) ?></label></th>
</ins><span class="cx">                                 <td>
</span><del>-                                        <input type="text" size='40' name="first_comment_author" id="first_comment_author" value="<?php echo get_site_option('first_comment_author') ?>" />
</del><ins>+                                        <input type="text" size="40" name="first_comment_author" id="first_comment_author" value="<?php echo get_site_option('first_comment_author') ?>" />
</ins><span class="cx">                                         <br />
</span><del>-                                        <?php _e('The author of the first comment on a new site.') ?>
</del><ins>+                                        <?php _e( 'The author of the first comment on a new site.' ) ?>
</ins><span class="cx">                                 </td>
</span><span class="cx">                         </tr>
</span><span class="cx">                         <tr valign="top">
</span><del>-                                <th scope="row"><label for="first_comment_url"><?php _e('First Comment URL') ?></label></th>
</del><ins>+                                <th scope="row"><label for="first_comment_url"><?php _e( 'First Comment URL' ) ?></label></th>
</ins><span class="cx">                                 <td>
</span><del>-                                        <input type="text" size='40' name="first_comment_url" id="first_comment_url" value="<?php echo esc_attr(get_site_option('first_comment_url')) ?>" />
</del><ins>+                                        <input type="text" size="40" name="first_comment_url" id="first_comment_url" value="<?php echo esc_attr( get_site_option( 'first_comment_url' ) ) ?>" />
</ins><span class="cx">                                         <br />
</span><del>-                                        <?php _e('The URL for the first comment on a new site.') ?>
</del><ins>+                                        <?php _e( 'The URL for the first comment on a new site.' ) ?>
</ins><span class="cx">                                 </td>
</span><span class="cx">                         </tr>
</span><span class="cx">                 </table>
</span><del>-                <h3><?php _e('Upload Settings'); ?></h3>
</del><ins>+                <h3><?php _e( 'Upload Settings' ); ?></h3>
</ins><span class="cx">                 <table class="form-table">
</span><span class="cx">                         <tr valign="top">
</span><del>-                                <th scope="row"><?php _e('Media upload buttons') ?></th>
</del><ins>+                                <th scope="row"><?php _e( 'Media upload buttons' ) ?></th>
</ins><span class="cx">                                 <?php $mu_media_buttons = get_site_option( 'mu_media_buttons', array() ); ?>
</span><del>-                                <td><label><input type='checkbox' id="mu_media_buttons_image" name="mu_media_buttons[image]" value='1'<?php checked( !empty($mu_media_buttons[ 'image' ]) ) ?>/> <?php _e( 'Images' ); ?></label><br />
-                                <label><input type='checkbox' id="mu_media_buttons_video" name="mu_media_buttons[video]" value='1'<?php checked( !empty($mu_media_buttons[ 'video' ]) ) ?>/> <?php _e( 'Videos' ); ?></label><br />
-                                <label><input type='checkbox' id="mu_media_buttons_audio" name="mu_media_buttons[audio]" value='1'<?php checked( !empty($mu_media_buttons[ 'audio' ]) ) ?>/> <?php _e( 'Music' ); ?></label><br />
</del><ins>+                                <td><label><input type="checkbox" id="mu_media_buttons_image" name="mu_media_buttons[image]" value="1"<?php checked( ! empty( $mu_media_buttons['image'] ) ) ?>/> <?php _e( 'Images' ); ?></label><br />
+                                <label><input type="checkbox" id="mu_media_buttons_video" name="mu_media_buttons[video]" value="1"<?php checked( ! empty( $mu_media_buttons['video'] ) ) ?>/> <?php _e( 'Videos' ); ?></label><br />
+                                <label><input type="checkbox" id="mu_media_buttons_audio" name="mu_media_buttons[audio]" value="1"<?php checked( ! empty( $mu_media_buttons['audio'] ) ) ?>/> <?php _e( 'Music' ); ?></label><br />
</ins><span class="cx">                                 <?php _e( 'The media upload buttons to display on the "Write Post" page. Make sure you update the allowed upload file types below as well.' ); ?></td>
</span><span class="cx">                         </tr>
</span><span class="cx">
</span><span class="cx">                         <tr valign="top">
</span><del>-                                <th scope="row"><?php _e('Site upload space') ?></th>
</del><ins>+                                <th scope="row"><?php _e( 'Site upload space' ) ?></th>
</ins><span class="cx">                                 <td>
</span><del>-                                <label><input type='checkbox' id="upload_space_check_disabled" name="upload_space_check_disabled" value='0'<?php checked( get_site_option( 'upload_space_check_disabled' ), 0 ) ?>/> <?php printf( __( 'Limit total size of files uploaded to %s MB' ), '<input name="blog_upload_space" type="text" id="blog_upload_space" value="' . esc_attr( get_site_option('blog_upload_space', 10) ) . '" size="3" />' ); ?></label><br />
</del><ins>+                                <label><input type="checkbox" id="upload_space_check_disabled" name="upload_space_check_disabled" value="0"<?php checked( get_site_option( 'upload_space_check_disabled' ), 0 ) ?>/> <?php printf( __( 'Limit total size of files uploaded to %s MB' ), '<input name="blog_upload_space" type="text" id="blog_upload_space" value="' . esc_attr( get_site_option('blog_upload_space', 10) ) . '" size="3" />' ); ?></label><br />
</ins><span class="cx">                         </tr>
</span><span class="cx">
</span><span class="cx">                         <tr valign="top">
</span><del>-                                <th scope="row"><label for="upload_filetypes"><?php _e('Upload file types') ?></label></th>
</del><ins>+                                <th scope="row"><label for="upload_filetypes"><?php _e( 'Upload file types' ) ?></label></th>
</ins><span class="cx">                                 <td><input name="upload_filetypes" type="text" id="upload_filetypes" class="large-text" value="<?php echo esc_attr( get_site_option('upload_filetypes', 'jpg jpeg png gif') ) ?>" size="45" /></td>
</span><span class="cx">                         </tr>
</span><span class="cx">
</span><span class="cx">                         <tr valign="top">
</span><del>-                                <th scope="row"><label for="fileupload_maxk"><?php _e('Max upload file size') ?></label></th>
-                                <td><?php printf( _x( '%s KB', 'File size in kilobytes' ), '<input name="fileupload_maxk" type="text" id="fileupload_maxk" value="' . esc_attr( get_site_option('fileupload_maxk', 300 ) ) . '" size="5" />' ); ?></td>
</del><ins>+                                <th scope="row"><label for="fileupload_maxk"><?php _e( 'Max upload file size' ) ?></label></th>
+                                <td><?php printf( _x( '%s KB', 'File size in kilobytes' ), '<input name="fileupload_maxk" type="text" id="fileupload_maxk" value="' . esc_attr( get_site_option( 'fileupload_maxk', 300 ) ) . '" size="5" />' ); ?></td>
</ins><span class="cx">                         </tr>
</span><span class="cx">                 </table>
</span><span class="cx">
</span><span class="cx"> <?php
</span><span class="cx">                 $languages = get_available_languages();
</span><span class="cx">                 if ( ! empty( $languages ) ) {
</span><del>-                        $lang = get_site_option('WPLANG');
</del><ins>+                        $lang = get_site_option( 'WPLANG' );
</ins><span class="cx"> ?>
</span><del>-                <h3><?php _e('Network Wide Settings'); ?></h3>
</del><ins>+                <h3><?php _e( 'Network Wide Settings' ); ?></h3>
</ins><span class="cx">                 <div class="updated inline"><p><strong><?php _e( 'Notice:' ); ?></strong> <?php _e( 'These settings may be overridden by site owners.' ); ?></p></div>
</span><span class="cx">                 <table class="form-table">
</span><span class="cx">                         <?php
</span><span class="cx">                                 ?>
</span><span class="cx">                                 <tr valign="top">
</span><del>-                                        <th><label for="WPLANG"><?php _e('Default Language') ?></label></th>
</del><ins>+                                        <th><label for="WPLANG"><?php _e( 'Default Language' ) ?></label></th>
</ins><span class="cx">                                         <td>
</span><span class="cx">                                                 <select name="WPLANG" id="WPLANG">
</span><del>-                                                        <?php mu_dropdown_languages( $languages, get_site_option('WPLANG') ); ?>
</del><ins>+                                                        <?php mu_dropdown_languages( $languages, get_site_option( 'WPLANG' ) ); ?>
</ins><span class="cx">                                                 </select>
</span><span class="cx">                                         </td>
</span><span class="cx">                                 </tr>
</span><span class="lines">@@ -267,7 +269,7 @@
</span><span class="cx">                 } // languages
</span><span class="cx"> ?>
</span><span class="cx">
</span><del>-                <h3><?php _e('Menu Settings'); ?></h3>
</del><ins>+                <h3><?php _e( 'Menu Settings' ); ?></h3>
</ins><span class="cx">                 <table id="menu" class="form-table">
</span><span class="cx">                         <tr valign="top">
</span><span class="cx">                                 <th scope="row"><?php _e( 'Enable administration menus' ); ?></th>
</span><span class="lines">@@ -276,7 +278,7 @@
</span><span class="cx">                         $menu_perms = get_site_option( 'menu_items' );
</span><span class="cx">                         $menu_items = apply_filters( 'mu_menu_items', array( 'plugins' => __( 'Plugins' ) ) );
</span><span class="cx">                         foreach ( (array) $menu_items as $key => $val ) {
</span><del>-                                echo "<label><input type='checkbox' name='menu_items[" . $key . "]' value='1'" . ( isset( $menu_perms[ $key ] ) ? checked( $menu_perms[ $key ], '1', false ) : '' ) . " /> " . esc_html( $val ) . "</label><br/>";
</del><ins>+                                echo "<label><input type='checkbox' name='menu_items[" . $key . "]' value='1'" . ( isset( $menu_perms[$key] ) ? checked( $menu_perms[$key], '1', false ) : '' ) . " /> " . esc_html( $val ) . "</label><br/>";
</ins><span class="cx">                         }
</span><span class="cx">                         ?>
</span><span class="cx">                                 </td>
</span><span class="lines">@@ -285,8 +287,8 @@
</span><span class="cx">
</span><span class="cx">                 <?php do_action( 'wpmu_options' ); // Add more options here ?>
</span><span class="cx">
</span><del>-                <p class="submit"><input type="submit" class="button-primary" name="Submit" value="<?php esc_attr_e('Save Changes') ?>" /></p>
</del><ins>+                <p class="submit"><input type="submit" class="button-primary" name="Submit" value="<?php esc_attr_e( 'Save Changes' ) ?>" /></p>
</ins><span class="cx">         </form>
</span><span class="cx"> </div>
</span><span class="cx">
</span><del>-<?php include('./admin-footer.php'); ?>
</del><ins>+<?php include( './admin-footer.php' ); ?>
</ins></span></pre></div>
<a id="trunkwpadminmssitesphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/ms-sites.php (13917 => 13918)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/ms-sites.php        2010-04-01 20:32:17 UTC (rev 13917)
+++ trunk/wp-admin/ms-sites.php        2010-04-01 21:21:27 UTC (rev 13918)
</span><span class="lines">@@ -1,68 +1,67 @@
</span><span class="cx"> <?php
</span><del>-require_once('admin.php');
</del><ins>+require_once( './admin.php' );
</ins><span class="cx">
</span><span class="cx"> if ( !is_multisite() )
</span><del>-        wp_die( __('Multisite support is not enabled.') );
</del><ins>+        wp_die( __( 'Multisite support is not enabled.' ) );
</ins><span class="cx">
</span><del>-$title = __('Sites');
</del><ins>+$title = __( 'Sites' );
</ins><span class="cx"> $parent_file = 'ms-admin.php';
</span><span class="cx">
</span><span class="cx"> wp_enqueue_script( 'admin-forms' );
</span><span class="cx">
</span><del>-require_once('admin-header.php');
</del><ins>+require_once( './admin-header.php' );
</ins><span class="cx">
</span><span class="cx"> if ( ! current_user_can( 'manage_sites' ) )
</span><del>-        wp_die( __('You do not have permission to access this page.') );
</del><ins>+        wp_die( __( 'You do not have permission to access this page.' ) );
</ins><span class="cx">
</span><del>-$id = isset($_GET['id']) ? intval( $_GET['id'] ) : 0;
-$protocol = is_ssl() ? 'https://' : 'http://';
</del><ins>+$id = isset( $_GET['id'] ) ? intval( $_GET['id'] ) : 0;
</ins><span class="cx">
</span><del>-if ( isset($_GET['updated']) && $_GET['updated'] == 'true' ) {
</del><ins>+if ( isset( $_GET['updated'] ) && $_GET['updated'] == 'true' && ! empty( $_GET['action'] ) ) {
</ins><span class="cx">         ?>
</span><span class="cx">         <div id="message" class="updated fade"><p>
</span><span class="cx">                 <?php
</span><del>-                switch ($_GET['action']) {
</del><ins>+                switch ( $_GET['action'] ) {
</ins><span class="cx">                         case 'all_notspam':
</span><del>-                                _e('Sites mark as not spam !');
</del><ins>+                                _e( 'Sites mark as not spam.' );
</ins><span class="cx">                         break;
</span><span class="cx">                         case 'all_spam':
</span><del>-                                _e('Sites mark as spam !');
</del><ins>+                                _e( 'Sites mark as spam.' );
</ins><span class="cx">                         break;
</span><span class="cx">                         case 'all_delete':
</span><del>-                                _e('Sites deleted !');
</del><ins>+                                _e( 'Sites deleted.' );
</ins><span class="cx">                         break;
</span><span class="cx">                         case 'delete':
</span><del>-                                _e('Site deleted !');
</del><ins>+                                _e( 'Site deleted.' );
</ins><span class="cx">                         break;
</span><span class="cx">                         case 'add-blog':
</span><del>-                                _e('Site added !');
</del><ins>+                                _e( 'Site added.' );
</ins><span class="cx">                         break;
</span><span class="cx">                         case 'archive':
</span><del>-                                _e('Site archived !');
</del><ins>+                                _e( 'Site archived.' );
</ins><span class="cx">                         break;
</span><span class="cx">                         case 'unarchive':
</span><del>-                                _e('Site unarchived !');
</del><ins>+                                _e( 'Site unarchived.' );
</ins><span class="cx">                         break;
</span><span class="cx">                         case 'activate':
</span><del>-                                _e('Site activated !');
</del><ins>+                                _e( 'Site activated.' );
</ins><span class="cx">                         break;
</span><span class="cx">                         case 'deactivate':
</span><del>-                                _e('Site deactivated !');
</del><ins>+                                _e( 'Site deactivated.' );
</ins><span class="cx">                         break;
</span><span class="cx">                         case 'unspam':
</span><del>-                                _e('Site mark as not spam !');
</del><ins>+                                _e( 'Site mark as not spam.' );
</ins><span class="cx">                         break;
</span><span class="cx">                         case 'spam':
</span><del>-                                _e('Site mark as spam !');
</del><ins>+                                _e( 'Site mark as spam.' );
</ins><span class="cx">                         break;
</span><del>-                        case 'umature':
-                                _e('Site mark as not mature !');
</del><ins>+                        case 'unmature':
+                                _e( 'Site mark as not mature.' );
</ins><span class="cx">                         break;
</span><span class="cx">                         case 'mature':
</span><del>-                                _e('Site mark as mature !');
</del><ins>+                                _e( 'Site mark as mature.' );
</ins><span class="cx">                         break;
</span><span class="cx">                         default:
</span><del>-                                _e('Options saved !');
</del><ins>+                                _e( 'Settings saved.' );
</ins><span class="cx">                         break;
</span><span class="cx">                 }
</span><span class="cx">                 ?>
</span><span class="lines">@@ -70,251 +69,258 @@
</span><span class="cx">         <?php
</span><span class="cx"> }
</span><span class="cx">
</span><del>-$action = isset($_GET['action']) ? $_GET['action'] : 'list';
</del><ins>+$action = isset( $_GET['action'] ) ? $_GET['action'] : 'list';
</ins><span class="cx">
</span><span class="cx"> switch ( $action ) {
</span><del>-        // Edit blog
-        case "editblog":
</del><ins>+        // Edit site
+        case 'editblog':
</ins><span class="cx">                 $blog_prefix = $wpdb->get_blog_prefix( $id );
</span><span class="cx">                 $options = $wpdb->get_results( "SELECT * FROM {$blog_prefix}options WHERE option_name NOT LIKE '\_%' AND option_name NOT LIKE '%user_roles'" );
</span><del>-                $details = get_blog_details($id);
</del><ins>+                $details = get_blog_details( $id );
</ins><span class="cx">                 $editblog_roles = get_blog_option( $id, "{$blog_prefix}user_roles" );
</span><span class="cx">                 $is_main_site = is_main_site( $id );
</span><span class="cx">                 ?>
</span><span class="cx">                 <div class="wrap">
</span><span class="cx">                 <?php screen_icon(); ?>
</span><del>-                <h2><?php _e('Edit Site'); ?> - <a href='<?php echo get_home_url($id); ?>'><?php echo get_home_url($id); ?></a></h2>
</del><ins>+                <h2><?php _e( 'Edit Site' ); ?> - <a href="<?php echo esc_url( get_home_url( $id ) ); ?>"><?php echo esc_url( get_home_url( $id ) ); ?></a></h2>
</ins><span class="cx">                 <form method="post" action="ms-edit.php?action=updateblog">
</span><del>-                        <?php wp_nonce_field('editblog'); ?>
-                        <input type="hidden" name="id" value="<?php echo esc_attr($id) ?>" />
-                        <div class='metabox-holder' style='width:49%;float:left;'>
-                        <div id="blogedit_bloginfo" class="postbox " >
-                        <h3 class='hndle'><span><?php _e('Site info (wp_blogs)'); ?></span></h3>
-                        <div class="inside">
-                                <table class="form-table">
-                                                        <tr class="form-field form-required">
-                                                                <th scope="row"><?php _e('Domain') ?></th>
-<?php if ( $is_main_site ) { ?>
-                                                                <td>http://<?php echo esc_attr($details->domain) ?></td>
-<?php } else { ?>
-                                                                <td>http://<input name="blog[domain]" type="text" id="domain" value="<?php echo esc_attr($details->domain) ?>" size="33" /></td>
-<?php } ?>
-                                                        </tr>
-                                                        <tr class="form-field form-required">
-                                                                <th scope="row"><?php _e('Path') ?></th>
-<?php if ( $is_main_site ) { ?>
-                                                                <td><?php echo esc_attr($details->path) ?></td>
-<?php } else { ?>
-                                                                <td><input name="blog[path]" type="text" id="path" value="<?php echo esc_attr($details->path) ?>" size="40" style='margin-bottom:5px;' />
-                                                                <br /><input type='checkbox' style='width:20px;' name='update_home_url' value='update' <?php if ( get_blog_option( $id, 'siteurl' ) == untrailingslashit( get_blogaddress_by_id($id) ) || get_blog_option( $id, 'home' ) == untrailingslashit( get_blogaddress_by_id($id) ) ) echo 'checked="checked"'; ?> /> <?php _e( "Update 'siteurl' and 'home' as well." ); ?></td>
-<?php } ?>
-                                                        </tr>
-                                                        <tr class="form-field">
-                                                                <th scope="row"><?php _e('Registered') ?></th>
-                                                                <td><input name="blog[registered]" type="text" id="blog_registered" value="<?php echo esc_attr($details->registered) ?>" size="40" /></td>
-                                                        </tr>
-                                                        <tr class="form-field">
-                                                                <th scope="row"><?php _e('Last Updated') ?></th>
-                                                                <td><input name="blog[last_updated]" type="text" id="blog_last_updated" value="<?php echo esc_attr($details->last_updated) ?>" size="40" /></td>
-                                                        </tr>
-                                                        <tr class="form-field">
-                                                                <th scope="row"><?php _e('Public') ?></th>
-                                                                <td>
-                                                                        <input type='radio' style='width:20px;' name='blog[public]' value='1' <?php if ( $details->public == '1' ) echo 'checked="checked"'; ?> /> <?php _e('Yes') ?>
-                                                                        <input type='radio' style='width:20px;' name='blog[public]' value='0' <?php if ( $details->public == '0' ) echo 'checked="checked"'; ?> /> <?php _e('No') ?>
-                                                                </td>
-                                                        </tr>
-                                                        <tr class="form-field">
-                                                                <th scope="row"><?php _e( 'Archived' ); ?></th>
-                                                                <td>
-                                                                        <input type='radio' style='width:20px;' name='blog[archived]' value='1' <?php if ( $details->archived == '1' ) echo 'checked="checked"'; ?> /> <?php _e('Yes') ?>
-                                                                        <input type='radio' style='width:20px;' name='blog[archived]' value='0' <?php if ( $details->archived == '0' ) echo 'checked="checked"'; ?> /> <?php _e('No') ?>
-                                                                </td>
-                                                        </tr>
-                                                        <tr class="form-field">
-                                                                <th scope="row"><?php _e( 'Mature' ); ?></th>
-                                                                <td>
-                                                                        <input type='radio' style='width:20px;' name='blog[mature]' value='1' <?php if ( $details->mature == '1' ) echo 'checked="checked"'; ?> /> <?php _e('Yes') ?>
-                                                                        <input type='radio' style='width:20px;' name='blog[mature]' value='0' <?php if ( $details->mature == '0' ) echo 'checked="checked"'; ?> /> <?php _e('No') ?>
-                                                                </td>
-                                                        </tr>
-                                                        <tr class="form-field">
-                                                                <th scope="row"><?php _e( 'Spam' ); ?></th>
-                                                                <td>
-                                                                        <input type='radio' style='width:20px;' name='blog[spam]' value='1' <?php if ( $details->spam == '1' ) echo 'checked="checked"'; ?> /> <?php _e('Yes') ?>
-                                                                        <input type='radio' style='width:20px;' name='blog[spam]' value='0' <?php if ( $details->spam == '0' ) echo 'checked="checked"'; ?> /> <?php _e('No') ?>
-                                                                </td>
-                                                        </tr>
-                                                        <tr class="form-field">
-                                                                <th scope="row"><?php _e( 'Deleted' ); ?></th>
-                                                                <td>
-                                                                        <input type='radio' style='width:20px;' name='blog[deleted]' value='1' <?php if ( $details->deleted == '1' ) echo 'checked="checked"'; ?> /> <?php _e('Yes') ?>
-                                                                        <input type='radio' style='width:20px;' name='blog[deleted]' value='0' <?php if ( $details->deleted == '0' ) echo 'checked="checked"'; ?> /> <?php _e('No') ?>
-                                                                </td>
-                                                        </tr>
-                                                </table>
-                                                <p class="submit" style="margin:-15px 0 -5px 230px;"><input type="submit" name="Submit" value="<?php esc_attr_e('Update Options') ?>" /></p>
-                        </div></div>
-
-                        <div id="blogedit_blogoptions" class="postbox" >
-                        <h3 class='hndle'><span><?php printf( __('Site options (%soptions)'), $blog_prefix ); ?></span></h3>
-                        <div class="inside">
-                                <table class="form-table">
</del><ins>+                        <?php wp_nonce_field( 'editblog' ); ?>
+                        <input type="hidden" name="id" value="<?php echo esc_attr( $id ) ?>" />
+                        <div class="metabox-holder" style="width:49%;float:left;">
+                                <div id="blogedit_bloginfo" class="postbox">
+                                <h3 class="hndle"><span><?php _e( 'Site info (wp_blogs)' ); ?></span></h3>
+                                <div class="inside">
+                                        <table class="form-table">
+                                                <tr class="form-field form-required">
+                                                        <th scope="row"><?php _e( 'Domain' ) ?></th>
</ins><span class="cx">                                                         <?php
</span><del>-                                                        $editblog_default_role = 'subscriber';
-                                                        foreach ( $options as $option ) {
-                                                                if ( $option->option_name == 'default_role' )
-                                                                        $editblog_default_role = $option->option_value;
-                                                                $disabled = false;
-                                                                if ( is_serialized($option->option_value) ) {
-                                                                        if ( is_serialized_string($option->option_value) ) {
-                                                                                $option->option_value = esc_html(maybe_unserialize($option->option_value), 'single');
-                                                                        } else {
-                                                                                $option->option_value = "SERIALIZED DATA";
-                                                                                $disabled = true;
-                                                                        }
-                                                                }
-                                                                if ( stristr($option->option_value, "\r") || stristr($option->option_value, "\n") || stristr($option->option_value, "\r\n") ) {
-                                                                ?>
-                                                                        <tr class="form-field">
-                                                                                <th scope="row"><?php echo ucwords( str_replace( "_", " ", $option->option_name ) ) ?></th>
-                                                                                <td><textarea rows="5" cols="40" name="option[<?php echo esc_attr($option->option_name) ?>]" id="<?php echo esc_attr($option->option_name) ?>"<?php disabled( $disabled ) ?>><?php echo esc_html( $option->option_value ) ?></textarea></td>
-                                                                        </tr>
-                                                                <?php
</del><ins>+                                                        $protocol = is_ssl() ? 'https://' : 'http://';
+                                                        if ( $is_main_site ) { ?>
+                                                        <td><code><?php echo $protocol; echo esc_attr( $details->domain ) ?></code></td>
+                                                        <?php } else { ?>
+                                                        <td><?php echo $protocol; ?><input name="blog[domain]" type="text" id="domain" value="<?php echo esc_attr( $details->domain ) ?>" size="33" /></td>
+                                                        <?php } ?>
+                                                </tr>
+                                                <tr class="form-field form-required">
+                                                        <th scope="row"><?php _e( 'Path' ) ?></th>
+                                                        <?php if ( $is_main_site ) { ?>
+                                                        <td><code><?php echo esc_attr( $details->path ) ?></code></td>
+                                                        <?php } else { ?>
+                                                        <td><input name="blog[path]" type="text" id="path" value="<?php echo esc_attr( $details->path ) ?>" size="40" style='margin-bottom:5px;' />
+                                                        <br /><input type="checkbox" style="width:20px;" name="update_home_url" value="update" <?php if ( get_blog_option( $id, 'siteurl' ) == untrailingslashit( get_blogaddress_by_id ($id ) ) || get_blog_option( $id, 'home' ) == untrailingslashit( get_blogaddress_by_id( $id ) ) ) echo 'checked="checked"'; ?> /> <?php _e( 'Update <code>siteurl</code> and <code>home</code> as well.' ); ?></td>
+                                                        <?php } ?>
+                                                </tr>
+                                                <tr class="form-field">
+                                                        <th scope="row"><?php _e( 'Registered') ?></th>
+                                                        <td><input name="blog[registered]" type="text" id="blog_registered" value="<?php echo esc_attr( $details->registered ) ?>" size="40" /></td>
+                                                </tr>
+                                                <tr class="form-field">
+                                                        <th scope="row"><?php _e('Last Updated') ?></th>
+                                                        <td><input name="blog[last_updated]" type="text" id="blog_last_updated" value="<?php echo esc_attr( $details->last_updated ) ?>" size="40" /></td>
+                                                </tr>
+                                                <tr class="form-field">
+                                                        <th scope="row"><?php _e('Public') ?></th>
+                                                        <td>
+                                                                <label><input type="radio" style="width:20px;" name="blog[public]" value="1" <?php checked( $details->public, 1 ); ?> /> <?php _e( 'Yes' ) ?></label>
+                                                                <label><input type="radio" style="width:20px;" name="blog[public]" value="0" <?php checked( $details->public, 0 ); ?> /> <?php _e( 'No' ) ?></label>
+                                                        </td>
+                                                </tr>
+                                                <tr class="form-field">
+                                                        <th scope="row"><?php _e( 'Archived' ); ?></th>
+                                                        <td>
+                                                                <label><input type="radio" style="width:20px;" name="blog[archived]" value="1" <?php checked( $details->archived, 1 ); ?> /> <?php _e( 'Yes' ) ?></label>
+                                                                <label><input type="radio" style="width:20px;" name="blog[archived]" value="0" <?php checked( $details->archived, 0 ); ?> /> <?php _e( 'No' ) ?></label>
+                                                        </td>
+                                                </tr>
+                                                <tr class="form-field">
+                                                        <th scope="row"><?php _e( 'Mature' ); ?></th>
+                                                        <td>
+                                                                <label><input type="radio" style="width:20px;" name="blog[mature]" value="1" <?php checked( $details->mature, 1 ); ?> /> <?php _e( 'Yes' ) ?></label>
+                                                                <label><input type="radio" style="width:20px;" name="blog[mature]" value="0" <?php checked( $details->mature, 0); ?> /> <?php _e( 'No' ) ?></label>
+                                                        </td>
+                                                </tr>
+                                                <tr class="form-field">
+                                                        <th scope="row"><?php _e( 'Spam' ); ?></th>
+                                                        <td>
+                                                                <label><input type="radio" style="width:20px;" name="blog[spam]" value="1" <?php checked( $details->spam, 1 ); ?> /> <?php _e( 'Yes' ) ?></label>
+                                                                <label><input type="radio" style="width:20px;" name="blog[spam]" value="0" <?php checked( $details->spam, 0 ); ?> /> <?php _e( 'No' ) ?></label>
+                                                        </td>
+                                                </tr>
+                                                <tr class="form-field">
+                                                        <th scope="row"><?php _e( 'Deleted' ); ?></th>
+                                                        <td>
+                                                                <label><input type="radio" style="width:20px;" name="blog[deleted]" value="1" <?php checked( $details->deleted, 1 ); ?> /> <?php _e( 'Yes' ) ?></label>
+                                                                <label><input type="radio" style="width:20px;" name="blog[deleted]" value="0" <?php checked( $details->deleted, 0 ); ?> /> <?php _e( 'No' ) ?></label>
+                                                        </td>
+                                                </tr>
+                                        </table>
+                                        <p class="submit" style="text-align:center;"><input type="submit" name="Submit" value="<?php esc_attr_e( 'Update Options' ) ?>" /></p>
+                                </div>
+                                </div>
+
+                                <div id="blogedit_blogoptions" class="postbox" >
+                                <h3 class="hndle"><span><?php printf( __( 'Site options (%soptions)' ), $blog_prefix ); ?></span></h3>
+                                <div class="inside">
+                                        <table class="form-table">
+                                                <?php
+                                                $editblog_default_role = 'subscriber';
+                                                foreach ( $options as $option ) {
+                                                        if ( $option->option_name == 'default_role' )
+                                                                $editblog_default_role = $option->option_value;
+                                                        $disabled = false;
+                                                        $class = 'all-options';
+                                                        if ( is_serialized( $option->option_value ) ) {
+                                                                if ( is_serialized_string( $option->option_value ) ) {
+                                                                        $option->option_value = esc_html( maybe_unserialize( $option->option_value ), 'single' );
</ins><span class="cx">                                                                 } else {
</span><del>-                                                                ?>
-                                                                        <tr class="form-field">
-                                                                                <th scope="row"><?php echo ucwords( str_replace( "_", " ", $option->option_name ) ) ?></th>
-<?php if ( $is_main_site && in_array( $option->option_name, array( 'siteurl', 'home' ) ) ) { ?>
-                                                                                <td><?php echo esc_attr( $option->option_value ) ?></td>
-<?php } else { ?>
-                                                                                <td><input name="option[<?php echo esc_attr($option->option_name) ?>]" type="text" id="<?php echo esc_attr($option->option_name) ?>" value="<?php echo esc_attr( $option->option_value ) ?>" size="40" <?php disabled( $disabled ) ?> /></td>
-<?php } ?>
-                                                                        </tr>
-                                                                <?php
</del><ins>+                                                                        $option->option_value = 'SERIALIZED DATA';
+                                                                        $disabled = true;
+                                                                        $class = 'all-options disabled';
</ins><span class="cx">                                                                 }
</span><del>-                                                        } // End foreach
</del><ins>+                                                        }
+                                                        if ( strpos( $option->option_value, "\n" ) !== false ) {
</ins><span class="cx">                                                         ?>
</span><del>-                                                </table>
-                                                <p class="submit" style="margin:-15px 0 -5px 230px;"><input type="submit" name="Submit" value="<?php esc_attr_e('Update Options') ?>" /></p>
-                        </div></div>
</del><ins>+                                                                <tr class="form-field">
+                                                                        <th scope="row"><?php echo ucwords( str_replace( "_", " ", $option->option_name ) ) ?></th>
+                                                                        <td><textarea class="<?php echo $class; ?>" rows="5" cols="40" name="option[<?php echo esc_attr( $option->option_name ) ?>]" id="<?php echo esc_attr( $option->option_name ) ?>"<?php disabled( $disabled ) ?>><?php wp_htmledit_pre( $option->option_value ) ?></textarea></td>
+                                                                </tr>
+                                                        <?php
+                                                        } else {
+                                                        ?>
+                                                                <tr class="form-field">
+                                                                        <th scope="row"><?php esc_html_e( ucwords( str_replace( "_", " ", $option->option_name ) ) ); ?></th>
+                                                                        <?php if ( $is_main_site && in_array( $option->option_name, array( 'siteurl', 'home' ) ) ) { ?>
+                                                                        <td><code><?php esc_html_e( $option->option_value ) ?></code></td>
+                                                                        <?php } else { ?>
+                                                                        <td><input class="<?php echo $class; ?>" name="option[<?php echo esc_attr( $option->option_name ) ?>]" type="text" id="<?php echo esc_attr( $option->option_name ) ?>" value="<?php echo esc_attr( $option->option_value ) ?>" size="40" <?php disabled( $disabled ) ?> /></td>
+                                                                        <?php } ?>
+                                                                </tr>
+                                                        <?php
+                                                        }
+                                                } // End foreach
+                                                ?>
+                                        </table>
+                                        <p class="submit" style="text-align:center;"><input type="submit" name="Submit" value="<?php esc_attr_e( 'Update Options' ) ?>" /></p>
+                                </div>
+                                </div>
</ins><span class="cx">                         </div>
</span><span class="cx">
</span><del>-                        <div class='metabox-holder' style='width:49%;float:right;'>
-                        <?php
-                                        // Blog Themes
-                                        $themes = get_themes();
-                                        $blog_allowed_themes = wpmu_get_blog_allowedthemes( $id );
-                                        $allowed_themes = get_site_option( "allowedthemes" );
-                                        if ( ! $allowed_themes )
-                                                $allowed_themes = array_keys( $themes );
-                                        $out = '';
-                                        foreach ( $themes as $key => $theme ) {
-                                                $theme_key = esc_html( $theme['Stylesheet'] );
-                                                if ( ! isset($allowed_themes[$theme_key] ) ) {
-                                                        $checked = ( isset($blog_allowed_themes[ $theme_key ]) ) ? 'checked="checked"' : '';
-                                                        $out .= '<tr class="form-field form-required">
-                                                                        <th title="' . esc_attr( $theme["Description"] ).'" scope="row">' . esc_html($key) . '</th>
-                                                                        <td><input name="theme[' . esc_attr($theme_key) . ']" type="checkbox" style="width:20px;" value="on" '.$checked.'/>' . __( 'Active' ) . '</td>
-                                                                </tr>';
-                                                }
-                                        }
</del><ins>+                        <div class="metabox-holder" style="width:49%;float:right;">
+                                <?php
+                                // Site Themes
+                                $themes = get_themes();
+                                $blog_allowed_themes = wpmu_get_blog_allowedthemes( $id );
+                                $allowed_themes = get_site_option( 'allowedthemes' );
</ins><span class="cx">
</span><del>-                                        if ( $out != '' ) {
-                        ?>
-                        <div id="blogedit_blogthemes" class="postbox">
-                        <h3 class='hndle'><span><?php esc_html_e('Site Themes'); ?></span></h3>
-                        <div class="inside">
-                                <table class="form-table">
-                                        <tr><th style="font-weight:bold;"><?php esc_html_e('Theme'); ?></th></tr>
-                                        <?php echo $out; ?>
-                                </table>
-                                <p class="submit" style="margin:-15px 0 -5px 230px;"><input type="submit" name="Submit" value="<?php esc_attr_e('Update Options') ?>" /></p>
-                        </div></div>
-                        <?php } ?>
</del><ins>+                                if ( ! $allowed_themes )
+                                        $allowed_themes = array_keys( $themes );
</ins><span class="cx">
</span><del>-                        <?php
-                                        // Blog users
-                                        $blogusers = get_users_of_blog( $id );
-                                        if ( is_array( $blogusers ) ) {
-                                                echo '<div id="blogedit_blogusers" class="postbox"><h3 class="hndle"><span>' . __('Site Users') . '</span></h3><div class="inside">';
-                                                echo '<table class="form-table">';
-                                                echo "<tr><th>" . __('User') . "</th><th>" . __('Role') . "</th><th>" . __('Password') . "</th><th>" . __('Remove') . "</th></tr>";
-                                                reset($blogusers);
-                                                foreach ( (array) $blogusers as $key => $val ) {
-                                                        if ( isset( $val->meta_value ) && ! $val->meta_value )
-                                                                continue;
-                                                        $t = @unserialize( $val->meta_value );
-                                                        if ( is_array( $t ) ) {
-                                                                reset( $t );
-                                                                $existing_role = key( $t );
-                                                        }
-                                                        echo '<tr><td><a href="user-edit.php?user_id=' . $val->user_id . '">' . $val->user_login . '</a></td>';
-                                                        if ( $val->user_id != $current_user->data->ID ) {
-                                                                ?>
-                                                                <td>
-                                                                        <select name="role[<?php echo $val->user_id ?>]" id="new_role"><?php
-                                                                                foreach ( $editblog_roles as $role => $role_assoc ){
-                                                                                        $name = translate_user_role($role_assoc['name']);
-                                                                                        $selected = ( $role == $existing_role ) ? 'selected="selected"' : '';
-                                                                                        echo "<option {$selected} value=\"" . esc_attr($role) . "\">{$name}</option>";
-                                                                                }
-                                                                                ?>
-                                                                        </select>
-                                                                </td>
-                                                                <td>
-                                                                                <input type='text' name='user_password[<?php echo esc_attr($val->user_id) ?>]' />
-                                                                </td>
-                                                                <?php
-                                                                echo '<td><input title="' . __('Click to remove user') . '" type="checkbox" name="blogusers[' . esc_attr($val->user_id) . ']" /></td>';
-                                                        } else {
-                                                                echo "<td><strong>" . __ ('N/A') . "</strong></td><td><strong>" . __ ('N/A') . "</strong></td><td><strong>" . __('N/A') . "</strong></td>";
-                                                        }
-                                                        echo '</tr>';
-                                                }
-                                                echo "</table>";
-                                                echo '<p class="submit" style="margin:-15px 0 -5px 230px;"><input type="submit" name="Submit" value="' . esc_attr__('Update Options') . '" /></p>';
-                                                echo "</div></div>";
</del><ins>+                                $out = '';
+                                foreach ( $themes as $key => $theme ) {
+                                        $theme_key = esc_html( $theme['Stylesheet'] );
+                                        if ( ! isset( $allowed_themes[$theme_key] ) ) {
+                                                $checked = isset( $blog_allowed_themes[ $theme_key ] ) ? 'checked="checked"' : '';
+                                                $out .= '<tr class="form-field form-required">
+                                                                <th title="' . esc_attr( $theme["Description"] ).'" scope="row">' . esc_html( $key ) . '</th>
+                                                                <td><label><input name="theme[' . esc_attr( $theme_key ) . ']" type="checkbox" style="width:20px;" value="on" '.$checked.'/> ' . __( 'Active' ) . '</label></td>
+                                                        </tr>';
</ins><span class="cx">                                         }
</span><del>-                        ?>
</del><ins>+                                }
</ins><span class="cx">
</span><del>-                        <div id="blogedit_blogadduser" class="postbox">
-                        <h3 class='hndle'><span><?php _e('Add a new user'); ?></span></h3>
-                        <div class="inside">
-                                <p style="margin:10px 0 0px;padding:0px 10px 10px;border-bottom:1px solid #DFDFDF;"><?php _e('Enter the username of an existing user and hit <em>Update Options</em> to add the user.') ?></p>
-                                <table class="form-table">
-                                                <tr>
-                                                        <th scope="row"><?php _e('User&nbsp;Login:') ?></th>
-                                                        <td><input type="text" name="newuser" id="newuser" /></td>
-                                                </tr>
-                                                <tr>
-                                                        <th scope="row"><?php _e('Role:') ?></th>
</del><ins>+                                if ( $out != '' ) {
+                                ?>
+                                <div id="blogedit_blogthemes" class="postbox">
+                                <h3 class="hndle"><span><?php esc_html_e( 'Site Themes' ); ?></span></h3>
+                                <div class="inside">
+                                        <p class="description"><?php _e( 'Activate the themename of an existing theme and hit "Update Options" to allow the theme for this site.' ) ?></p>
+                                        <table class="form-table">
+                                                <?php echo $out; ?>
+                                        </table>
+                                        <p class="submit" style="text-align:center;"><input type="submit" name="Submit" value="<?php esc_attr_e( 'Update Options' ) ?>" /></p>
+                                </div></div>
+                                <?php }
+
+                                // Site users
+                                $blogusers = get_users_of_blog( $id );
+                                if ( is_array( $blogusers ) ) {
+                                        echo '<div id="blogedit_blogusers" class="postbox"><h3 class="hndle"><span>' . __( 'Site Users' ) . '</span></h3><div class="inside">';
+                                        echo '<table class="form-table">';
+                                        echo "<tr><th>" . __( 'User' ) . "</th><th>" . __( 'Role' ) . "</th><th>" . __( 'Password' ) . "</th><th>" . __( 'Remove' ) . "</th></tr>";
+                                        reset( $blogusers );
+                                        foreach ( (array) $blogusers as $key => $val ) {
+                                                if ( isset( $val->meta_value ) && ! $val->meta_value )
+                                                        continue;
+                                                $t = @unserialize( $val->meta_value );
+                                                if ( is_array( $t ) ) {
+                                                        reset( $t );
+                                                        $existing_role = key( $t );
+                                                }
+                                                echo '<tr><td><a href="user-edit.php?user_id=' . $val->user_id . '">' . $val->user_login . '</a></td>';
+                                                if ( $val->user_id != $current_user->data->ID ) {
+                                                        ?>
</ins><span class="cx">                                                         <td>
</span><del>-                                                                <select name="new_role" id="new_role">
-                                                                <?php
-                                                                reset( $editblog_roles );
-                                                                foreach ( $editblog_roles as $role => $role_assoc ){
-                                                                        $name = translate_user_role( $role_assoc['name'] );
-                                                                        $selected = ( $role == $editblog_default_role ) ? 'selected="selected"' : '';
-                                                                        echo "<option {$selected} value=\"" . esc_attr($role) . "\">{$name}</option>";
-                                                                }
-                                                                ?>
</del><ins>+                                                                <select name="role[<?php echo $val->user_id ?>]" id="new_role"><?php
+                                                                        foreach ( $editblog_roles as $role => $role_assoc ){
+                                                                                $name = translate_user_role( $role_assoc['name'] );
+                                                                                echo '<option ' . selected( $role, $existing_role ) . ' value="' . esc_attr( $role ) . '">' . esc_html( $name ) . '</option>';
+                                                                        }
+                                                                        ?>
</ins><span class="cx">                                                                 </select>
</span><span class="cx">                                                         </td>
</span><del>-                                                </tr>
-                                        </table>
-                                <p class="submit" style="margin:-15px 0 -5px 230px;"><input type="submit" name="Submit" value="<?php esc_attr_e('Update Options') ?>" /></p>
-                        </div></div>
</del><ins>+                                                        <td>
+                                                                <input type="text" name="user_password[<?php echo esc_attr( $val->user_id ) ?>]" />
+                                                        </td>
+                                                        <?php
+                                                        echo '<td><input title="' . __( 'Click to remove user' ) . '" type="checkbox" name="blogusers[' . esc_attr( $val->user_id ) . ']" /></td>';
+                                                } else {
+                                                        echo "<td><strong>" . __ ( 'N/A' ) . "</strong></td><td><strong>" . __ ( 'N/A' ) . "</strong></td><td><strong>" . __( 'N/A' ) . "</strong></td>";
+                                                }
+                                                echo '</tr>';
+                                        }
+                                        echo "</table>";
+                                        echo '<p class="submit" style="text-align:center;"><input type="submit" name="Submit" value="' . esc_attr__( 'Update Options' ) . '" /></p>';
+                                        echo "</div></div>";
+                                }
+                                ?>
</ins><span class="cx">
</span><del>-                        <div id="blogedit_miscoptions" class="postbox">
-                        <h3 class='hndle'><span><?php _e('Misc Site Actions') ?></span></h3>
-                        <div class="inside">
-                                <table class="form-table">
-                                                <?php do_action( 'wpmueditblogaction', $id ); ?>
-                                </table>
-                                <p class="submit" style="margin:-15px 0 -5px 230px;"><input type="submit" name="Submit" value="<?php esc_attr_e('Update Options') ?>" /></p>
-                        </div></div>
</del><ins>+                                <div id="blogedit_blogadduser" class="postbox">
+                                <h3 class="hndle"><span><?php _e( 'Add a new user' ); ?></span></h3>
+                                <div class="inside">
+                                        <p class="description"><?php _e( 'Enter the username of an existing user and hit "Update Options" to add the user.' ) ?></p>
+                                        <table class="form-table">
+                                                        <tr>
+                                                                <th scope="row"><?php _e( 'User&nbsp;Login:' ) ?></th>
+                                                                <td><input type="text" name="newuser" id="newuser" /></td>
+                                                        </tr>
+                                                        <tr>
+                                                                <th scope="row"><?php _e( 'Role:' ) ?></th>
+                                                                <td>
+                                                                        <select name="new_role" id="new_role">
+                                                                        <?php
+                                                                        reset( $editblog_roles );
+                                                                        foreach ( $editblog_roles as $role => $role_assoc ){
+                                                                                $name = translate_user_role( $role_assoc['name'] );
+                                                                                $selected = ( $role == $editblog_default_role ) ? 'selected="selected"' : '';
+                                                                                echo '<option ' . $selected . ' value="' . esc_attr( $role ) . '">' . esc_html( $name ) . '</option>';
+                                                                        }
+                                                                        ?>
+                                                                        </select>
+                                                                </td>
+                                                        </tr>
+                                                </table>
+                                        <p class="submit" style="text-align:center;"><input type="submit" name="Submit" value="<?php esc_attr_e( 'Update Options' ) ?>" /></p>
+                                </div>
+                                </div>
</ins><span class="cx">
</span><ins>+                                <div id="blogedit_miscoptions" class="postbox">
+                                <h3 class="hndle"><span><?php _e( 'Misc Site Actions' ) ?></span></h3>
+                                <div class="inside">
+                                        <table class="form-table">
+                                                        <?php do_action( 'wpmueditblogaction', $id ); ?>
+                                        </table>
+                                        <p class="submit" style="text-align:center;"><input type="submit" name="Submit" value="<?php esc_attr_e( 'Update Options' ) ?>" /></p>
+                                </div>
+                                </div>
</ins><span class="cx">                         </div>
</span><span class="cx">
</span><span class="cx">                         <div style="clear:both;"></div>
</span><span class="lines">@@ -323,7 +329,7 @@
</span><span class="cx">                 <?php
</span><span class="cx">         break;
</span><span class="cx">
</span><del>-        // List blogs
</del><ins>+        // List sites
</ins><span class="cx">         case 'list':
</span><span class="cx">         default:
</span><span class="cx">                 $pagenum = isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 0;
</span><span class="lines">@@ -336,21 +342,11 @@
</span><span class="cx">
</span><span class="cx">                 $per_page = apply_filters( 'ms_sites_per_page', $per_page );
</span><span class="cx">
</span><del>-                $s = isset($_GET['s']) ? stripslashes( trim( $_GET[ 's' ] ) ) : '';
</del><ins>+                $s = isset( $_GET['s'] ) ? stripslashes( trim( $_GET[ 's' ] ) ) : '';
</ins><span class="cx">                 $like_s = esc_sql( like_escape( $s ) );
</span><span class="cx">
</span><span class="cx">                 $query = "SELECT * FROM {$wpdb->blogs} WHERE site_id = '{$wpdb->siteid}' ";
</span><span class="cx">
</span><del>-                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' ";
-                        }
-                }
-
</del><span class="cx">                 if ( isset( $_GET['searchaction'] ) ) {
</span><span class="cx">                         if ( 'name' == $_GET['searchaction'] ) {
</span><span class="cx">                                 $query .= " AND ( {$wpdb->blogs}.domain LIKE '%{$like_s}%' OR {$wpdb->blogs}.path LIKE '%{$like_s}%' ) ";
</span><span class="lines">@@ -380,93 +376,62 @@
</span><span class="cx">                 $order = ( isset( $_GET['order'] ) && 'DESC' == $_GET['order'] ) ? "DESC" : "ASC";
</span><span class="cx">                 $query .= $order;
</span><span class="cx">
</span><del>-                $total = $wpdb->get_var( str_replace('SELECT *', 'SELECT COUNT(blog_id)', $query) );
</del><ins>+                $total = $wpdb->get_var( str_replace( 'SELECT *', 'SELECT COUNT(blog_id)', $query ) );
</ins><span class="cx">
</span><del>-                $query .= " LIMIT " . intval( ( $pagenum - 1 ) * $per_page) . ", " . intval( $per_page );
</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><span class="cx">                 $num_pages = ceil($total / $per_page);
</span><span class="cx">                 $page_links = paginate_links( array(
</span><span class="cx">                         'base' => add_query_arg( 'paged', '%#%' ),
</span><span class="cx">                         'format' => '',
</span><del>-                        'prev_text' => __('&laquo;'),
-                        'next_text' => __('&raquo;'),
</del><ins>+                        'prev_text' => __( '&laquo;' ),
+                        'next_text' => __( '&raquo;' ),
</ins><span class="cx">                         'total' => $num_pages,
</span><span class="cx">                         'current' => $pagenum
</span><span class="cx">                 ));
</span><span class="cx">
</span><del>-                if ( empty($_GET['mode']) )
</del><ins>+                if ( empty( $_GET['mode'] ) )
</ins><span class="cx">                         $mode = 'list';
</span><span class="cx">                 else
</span><span class="cx">                         $mode = esc_attr( $_GET['mode'] );
</span><del>-
-                // for subsubsub and $blog_list
-                $status_list = array( 'archived' => array( 'site-archived', __('Archived') ), 'spam' => array( 'site-spammed', __('Spam') ), 'deleted' => array( 'site-deleted', __('Deleted') ) );
</del><span class="cx">                 ?>
</span><span class="cx">
</span><span class="cx">                 <div class="wrap">
</span><span class="cx">                 <?php screen_icon(); ?>
</span><span class="cx">                 <h2><?php _e('Sites') ?>
</span><del>-                <a href="#form-add-site" class="button add-new-h2"><?php echo esc_html_x('Add New', 'sites'); ?></a>
</del><ins>+                <a href="#form-add-site" class="button add-new-h2"><?php echo esc_html_x( 'Add New', 'sites' ); ?></a>
</ins><span class="cx">                 <?php
</span><del>-                if ( isset($_GET['s']) && $_GET['s'] )
-                printf( '<span class="subtitle">' . __('Search results for &#8220;%s&#8221;') . '</span>', esc_html( $s ) );
</del><ins>+                if ( isset( $_GET['s'] ) && $_GET['s'] )
+                printf( '<span class="subtitle">' . __( 'Search results for &#8220;%s&#8221;' ) . '</span>', esc_html( $s ) );
</ins><span class="cx">                 ?>
</span><span class="cx">                 </h2>
</span><span class="cx">
</span><del>-                <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( _nx( 'All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $count, 'sites' ), number_format_i18n( $count ) ) . '</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>
-
</del><span class="cx">                 <form action="ms-sites.php" method="get" id="ms-search">
</span><span class="cx">                 <p class="search-box">
</span><span class="cx">                 <input type="hidden" name="action" value="blogs" />
</span><del>-                <input type="text" name="s" value="<?php esc_attr_e( $s ); ?>" />
-                <input type="submit" class="button" value="<?php esc_attr_e('Search Site by') ?>" />
</del><ins>+                <input type="text" name="s" value="<?php echo esc_attr( $s ); ?>" />
+                <input type="submit" class="button" value="<?php esc_attr_e( 'Search Site by' ) ?>" />
</ins><span class="cx">                 <select name="searchaction">
</span><del>-                        <option value="name" selected="selected"><?php _e('Name'); ?></option>
-                        <option value="id"><?php _e('ID'); ?></option>
-                        <option value="ip"><?php _e('IP address'); ?></option>
</del><ins>+                        <option value="name" selected="selected"><?php _e( 'Name' ); ?></option>
+                        <option value="id"><?php _e( 'ID' ); ?></option>
+                        <option value="ip"><?php _e( 'IP address' ); ?></option>
</ins><span class="cx">                 </select>
</span><span class="cx">                 </p>
</span><span class="cx">                 </form>
</span><span class="cx">
</span><span class="cx">                 <form id="form-site-list" action="ms-edit.php?action=allblogs" method="post">
</span><del>-                <input type="hidden" name="mode" value="<?php echo esc_attr($mode); ?>" />
</del><ins>+                <input type="hidden" name="mode" value="<?php echo esc_attr( $mode ); ?>" />
</ins><span class="cx">                 <div class="tablenav">
</span><span class="cx">                 <div class="alignleft actions">
</span><span class="cx">                         <select name="action">
</span><del>-                                <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>
</del><ins>+                                <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>
</ins><span class="cx">                         </select>
</span><del>-                        <input type="submit" value="<?php esc_attr_e('Apply'); ?>" name="doaction" id="doaction" class="button-secondary action" />
-                        <?php wp_nonce_field('bulk-sites'); ?>
</del><ins>+                        <input type="submit" value="<?php esc_attr_e( 'Apply' ); ?>" name="doaction" id="doaction" class="button-secondary action" />
+                        <?php wp_nonce_field( 'bulk-ms-sites' ); ?>
</ins><span class="cx">                 </div>
</span><span class="cx">
</span><span class="cx">                 <?php if ( $page_links ) { ?>
</span><span class="lines">@@ -481,8 +446,8 @@
</span><span class="cx">                 <?php } ?>
</span><span class="cx">
</span><span class="cx">                 <div class="view-switch">
</span><del>-                        <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>
</del><ins>+                        <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>
</ins><span class="cx">                 </div>
</span><span class="cx">
</span><span class="cx">                 </div>
</span><span class="lines">@@ -491,71 +456,57 @@
</span><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><del>-                $blogname_columns = ( is_subdomain_install() ) ? __('Domain') : __('Path');
-                $posts_columns = array(
-                        'id' => __('ID'),
</del><ins>+                $blogname_columns = ( is_subdomain_install() ) ? __( 'Domain' ) : __( 'Path' );
+                $sites_columns = array(
+                        'id' => __( 'ID' ),
</ins><span class="cx">                         'blogname' => $blogname_columns,
</span><del>-                        'lastupdated' => __('Last Updated'),
-                        'registered' => __('Registered'),
-                        'users' => __('Users')
</del><ins>+                        'lastupdated' => __( 'Last Updated'),
+                        'registered' => __( 'Registered' ),
+                        'users' => __( 'Users' )
</ins><span class="cx">                 );
</span><span class="cx">
</span><span class="cx">                 if ( has_filter( 'wpmublogsaction' ) )
</span><del>-                        $posts_columns['plugins'] = __('Actions');
</del><ins>+                        $sites_columns['plugins'] = __( 'Actions' );
</ins><span class="cx">
</span><del>-                $posts_columns = apply_filters('wpmu_blogs_columns', $posts_columns);
</del><ins>+                $sites_columns = apply_filters( 'wpmu_blogs_columns', $sites_columns );
</ins><span class="cx">                 ?>
</span><span class="cx">
</span><span class="cx">                 <table class="widefat">
</span><span class="cx">                         <thead>
</span><span class="cx">                                 <tr>
</span><del>-                                <th style="" class="manage-column column-cb check-column" id="cb" scope="col">
</del><ins>+                                <th class="manage-column column-cb check-column" id="cb" scope="col">
</ins><span class="cx">                                         <input type="checkbox" />
</span><span class="cx">                                 </th>
</span><span class="cx">                                 <?php
</span><del>-                                foreach($posts_columns as $column_id => $column_display_name) {
</del><ins>+                                $col_url = '';
+                                foreach($sites_columns as $column_id => $column_display_name) {
</ins><span class="cx">                                         $column_link = "<a href='";
</span><span class="cx">                                         $order2 = '';
</span><span class="cx">                                         if ( $order_by == $column_id )
</span><del>-                                                $order2 = ($order == 'DESC') ? 'ASC' : 'DESC';
</del><ins>+                                                $order2 = ( $order == 'DESC' ) ? 'ASC' : 'DESC';
</ins><span class="cx">
</span><del>-                                        $column_link .= esc_url(add_query_arg( array('order' => $order2, 'paged' => $pagenum, 'sortby' => $column_id ), $_SERVER['REQUEST_URI'] ) );
</del><ins>+                                        $column_link .= esc_url( add_query_arg( array( 'order' => $order2, 'paged' => $pagenum, 'sortby' => $column_id ), remove_query_arg( array('action', 'updated'), $_SERVER['REQUEST_URI'] ) ) );
</ins><span class="cx">                                         $column_link .= "'>{$column_display_name}</a>";
</span><del>-                                        $col_url = ($column_id == 'users' || $column_id == 'plugins') ? $column_display_name : $column_link;
-                                ?>
-                                <th scope="col">
-                                        <?php echo $col_url ?>
-                                </th>
-                                <?php } ?>
</del><ins>+                                        $col_url .= '<th scope="col">' . ( ( $column_id == 'users' || $column_id == 'plugins' ) ? $column_display_name : $column_link ) . '</th>';
+                                }
+                                echo $col_url ?>
</ins><span class="cx">                                 </tr>
</span><span class="cx">                         </thead>
</span><span class="cx">                         <tfoot>
</span><span class="cx">                                 <tr>
</span><del>-                                <th class="manage-column column-cb check-column" id="cb" scope="col">
</del><ins>+                                <th class="manage-column column-cb check-column" id="cb1" scope="col">
</ins><span class="cx">                                         <input type="checkbox" />
</span><span class="cx">                                 </th>
</span><del>-                                <?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">
</del><span class="cx">                                         <?php echo $col_url ?>
</span><del>-                                </th>
-                                <?php } ?>
</del><span class="cx">                                 </tr>
</span><span class="cx">                         </tfoot>
</span><del>-                        <tbody id="the-list">
</del><ins>+                        <tbody id="the-site-list" class="list:site">
</ins><span class="cx">                         <?php
</span><ins>+                        $status_list = array( 'archived' => array( 'site-archived', __( 'Archived' ) ), 'spam' => array( 'site-spammed', __( 'Spam' ) ), 'deleted' => array( 'site-deleted', __( 'Deleted' ) ), 'mature' => array( 'site-mature', __( 'Mature' ) ) );
</ins><span class="cx">                         if ( $blog_list ) {
</span><span class="cx">                                 $class = '';
</span><span class="cx">                                 foreach ( $blog_list as $blog ) {
</span><del>-                                        $class = ('alternate' == $class) ? '' : 'alternate';
</del><ins>+                                        $class = ( 'alternate' == $class ) ? '' : 'alternate';
</ins><span class="cx">                                         reset( $status_list );
</span><span class="cx">
</span><span class="cx">                                         $blog_states = array();
</span><span class="lines">@@ -566,8 +517,8 @@
</span><span class="cx">                                                 }
</span><span class="cx">                                         }
</span><span class="cx">                                         $blog_state = '';
</span><del>-                                        if ( ! empty($blog_states) ) {
-                                                $state_count = count($blog_states);
</del><ins>+                                        if ( ! empty( $blog_states ) ) {
+                                                $state_count = count( $blog_states );
</ins><span class="cx">                                                 $i = 0;
</span><span class="cx">                                                 $blog_state .= ' - ';
</span><span class="cx">                                                 foreach ( $blog_states as $state ) {
</span><span class="lines">@@ -578,12 +529,12 @@
</span><span class="cx">                                         }
</span><span class="cx">                                         echo "<tr class='$class'>";
</span><span class="cx">
</span><del>-                                        $blogname = ( is_subdomain_install() ) ? str_replace('.'.$current_site->domain, '', $blog['domain']) : $blog['path'];
-                                        foreach ( $posts_columns as $column_name=>$column_display_name ) {
</del><ins>+                                        $blogname = ( is_subdomain_install() ) ? str_replace( '.'.$current_site->domain, '', $blog['domain'] ) : $blog['path'];
+                                        foreach ( $sites_columns as $column_name=>$column_display_name ) {
</ins><span class="cx">                                                 switch ( $column_name ) {
</span><span class="cx">                                                         case 'id': ?>
</span><span class="cx">                                                                 <th scope="row" class="check-column">
</span><del>-                                                                        <input type='checkbox' id='blog_<?php echo $blog['blog_id'] ?>' name='allblogs[]' value='<?php echo esc_attr($blog['blog_id']) ?>' />
</del><ins>+                                                                        <input type="checkbox" id="blog_<?php echo $blog['blog_id'] ?>" name="allblogs[]" value="<?php echo esc_attr( $blog['blog_id'] ) ?>" />
</ins><span class="cx">                                                                 </th>
</span><span class="cx">                                                                 <th valign="top" scope="row">
</span><span class="cx">                                                                         <?php echo $blog['blog_id'] ?>
</span><span class="lines">@@ -593,38 +544,43 @@
</span><span class="cx">
</span><span class="cx">                                                         case 'blogname': ?>
</span><span class="cx">                                                                 <td class="column-title">
</span><del>-                                                                        <a href="ms-sites.php?action=editblog&amp;id=<?php echo $blog['blog_id'] ?>" class="edit"><?php echo $blogname . $blog_state; ?></a>
</del><ins>+                                                                        <a href="<?php echo esc_url( admin_url( 'ms-sites.php?action=editblog&amp;id=' . $blog['blog_id'] ) ); ?>" class="edit"><?php echo $blogname . $blog_state; ?></a>
</ins><span class="cx">                                                                         <?php
</span><span class="cx">                                                                         if ( 'list' != $mode )
</span><span class="cx">                                                                                 echo '<p>' . sprintf( _x( '%1$s &#8211; <em>%2$s', '%1$s: site name. %2$s: site tagline.' ), get_blog_option( $blog['blog_id'], 'blogname' ), get_blog_option( $blog['blog_id'], 'blogdescription ' ) ) . '</em></p>';
</span><span class="cx">
</span><span class="cx">                                                                         $actions        = array();
</span><del>-                                                                        $actions[]        = '<a href="ms-sites.php?action=editblog&amp;id=' . $blog['blog_id'] . '" class="edit">' . __('Edit') . '</a>';
-                                                                        $actions[]        = "<a href='" . get_admin_url($blog['blog_id']) . "' class='edit'>" . __('Backend') . '</a>';
</del><ins>+                                                                        $actions[]        = '<span class="edit"><a href="' . esc_url( admin_url( 'ms-sites.php?action=editblog&amp;id=' . $blog['blog_id'] ) ) . '">' . __( 'Edit' ) . '</a><span>';
+                                                                        $actions[]        = "<span class='backend'><a href='" . esc_url( get_admin_url($blog['blog_id']) ) . "' class='edit'>" . __( 'Backend' ) . '</a></span>';
+                                                                        if ( $current_site->blog_id != $blog['blog_id'] ) {
+                                                                                if ( get_blog_status( $blog['blog_id'], 'deleted' ) == '1' )
+                                                                                        $actions[]        = '<span class="activate"><a href="' . esc_url( admin_url( 'ms-edit.php?action=confirm&amp;action2=activateblog&amp;id=' . $blog['blog_id'] . '&amp;msg=' . urlencode( sprintf( __( "You are about to activate the site %s" ), $blogname ) ) ) ) . '">' . __( 'Activate' ) . '</a></span>';
+                                                                                else
+                                                                                        $actions[]        = '<span class="activate"><a href="' . esc_url( admin_url( 'ms-edit.php?action=confirm&amp;action2=deactivateblog&amp;id=' . $blog['blog_id'] . '&amp;msg=' . urlencode( sprintf( __( "You are about to deactivate the site %s" ), $blogname ) ) ) ) . '">' . __( 'Deactivate' ) . '</a></span>';
+        
+                                                                                if ( get_blog_status( $blog['blog_id'], 'archived' ) == '1' )
+                                                                                        $actions[]        = '<span class="archive"><a href="' . esc_url( admin_url( 'ms-edit.php?action=confirm&amp;action2=unarchiveblog&amp;id=' . $blog['blog_id'] . '&amp;msg=' . urlencode( sprintf( __( "You are about to unarchive the site %s." ), $blogname ) ) ) ) . '">' . __( 'Unarchive' ) . '</a></span>';
+                                                                                else
+                                                                                        $actions[]        = '<span class="archive"><a href="' . esc_url( admin_url( 'ms-edit.php?action=confirm&amp;action2=archiveblog&amp;id=' . $blog['blog_id'] . '&amp;msg=' . urlencode( sprintf( __( "You are about to archive the site %s." ), $blogname ) ) ) ) . '">' . __( 'Archive' ) . '</a></span>';
+        
+                                                                                if ( get_blog_status( $blog['blog_id'], 'spam' ) == '1' )
+                                                                                        $actions[]        = '<span class="spam"><a href="' . esc_url( admin_url( 'ms-edit.php?action=confirm&amp;action2=unspamblog&amp;id=' . $blog['blog_id'] . '&amp;msg=' . urlencode( sprintf( __( "You are about to unspam the site %s." ), $blogname ) ) ) ) . '">' . __( 'Not Spam' ) . '</a></span>';
+                                                                                else
+                                                                                        $actions[]        = '<span class="spam"><a href="' . esc_url( admin_url( 'ms-edit.php?action=confirm&amp;action2=spamblog&amp;id=' . $blog['blog_id'] . '&amp;msg=' . urlencode( sprintf( __( "You are about to mark the site %s as spam." ), $blogname ) ) ) ) . '">' . __( 'Spam' ) . '</a></span>';
+        
+                                                                                if ( get_blog_status( $blog['blog_id'], 'mature' ) == '1' )
+                                                                                        $actions[]        = '<span class="mature"><a href="' . esc_url( admin_url( 'ms-edit.php?action=confirm&amp;action2=unmatureblog&amp;id=' . $blog['blog_id'] . '&amp;msg=' . urlencode( sprintf( __( "You are about to unmature the site %s." ), $blogname ) ) ) ) . '">' . __( 'Not Mature' ) . '</a></span>';
+                                                                                else
+                                                                                        $actions[]        = '<span class="mature"><a href="' . esc_url( admin_url( 'ms-edit.php?action=confirm&amp;action2=matureblog&amp;id=' . $blog['blog_id'] . '&amp;msg=' . urlencode( sprintf( __( "You are about to mark the site %s as mature." ), $blogname ) ) ) ) . '">' . __( 'Mature' ) . '</a></span>';
+        
+                                                                                $actions[]        = '<span class="delete"><a href="' . esc_url( admin_url( 'ms-edit.php?action=confirm&amp;action2=deleteblog&amp;id=' . $blog['blog_id'] . '&amp;msg=' . urlencode( sprintf( __( "You are about to delete the site %s." ), $blogname ) ) ) ) . '">' . __( 'Delete' ) . '</a></span>';
+                                                                        }
</ins><span class="cx">
</span><del>-                                                                        if ( get_blog_status( $blog['blog_id'], "deleted" ) == '1' )
-                                                                                $actions[]        = '<a class="delete" href="ms-edit.php?action=confirm&amp;action2=activateblog&amp;ref=' . urlencode( $_SERVER['REQUEST_URI'] ) . '&amp;id=' . $blog['blog_id'] . '&amp;msg=' . urlencode( sprintf( __( "You are about to activate the site %s" ), $blogname ) ) . '">' . __('Activate') . '</a>';
-                                                                        else
-                                                                                $actions[]        = '<a class="delete" href="ms-edit.php?action=confirm&amp;action2=deactivateblog&amp;ref=' . urlencode( $_SERVER['REQUEST_URI'] ) . '&amp;id=' . $blog['blog_id'] . '&amp;msg=' . urlencode( sprintf( __( "You are about to deactivate the site %s" ), $blogname ) ) . '">' . __('Deactivate') . '</a>';
</del><ins>+                                                                        $actions[]        = "<span class='view'><a href='" . esc_url( get_home_url( $blog['blog_id'] ) ) . "' rel='permalink'>" . __( 'Visit' ) . '</a>';
</ins><span class="cx">
</span><del>-                                                                        if ( get_blog_status( $blog['blog_id'], "archived" ) == '1' )
-                                                                                $actions[]        = '<a class="delete" href="ms-edit.php?action=confirm&amp;action2=unarchiveblog&amp;id=' . $blog['blog_id'] . '&amp;msg=' . urlencode( sprintf( __( "You are about to unarchive the site %s" ), $blogname ) ) . '">' . __('Unarchive') . '</a>';
-                                                                        else
-                                                                                $actions[]        = '<a class="delete" href="ms-edit.php?action=confirm&amp;action2=archiveblog&amp;id=' . $blog['blog_id'] . '&amp;msg=' . urlencode( sprintf( __( "You are about to archive the site %s" ), $blogname ) ) . '">' . __('Archive') . '</a>';
-
-                                                                        if ( get_blog_status( $blog['blog_id'], "spam" ) == '1' )
-                                                                                $actions[]        = '<a class="delete" href="ms-edit.php?action=confirm&amp;action2=unspamblog&amp;id=' . $blog['blog_id'] . '&amp;msg=' . urlencode( sprintf( __( "You are about to unspam the site %s" ), $blogname ) ) . '">' . __('Not Spam') . '</a>';
-                                                                        else
-                                                                                $actions[]        = '<a class="delete" href="ms-edit.php?action=confirm&amp;action2=spamblog&amp;id=' . $blog['blog_id'] . '&amp;msg=' . urlencode( sprintf( __( "You are about to mark the site %s as spam" ), $blogname ) ) . '">' . __("Spam") . '</a>';
-
-                                                                        $actions[]        = '<a class="delete" href="ms-edit.php?action=confirm&amp;action2=deleteblog&amp;id=' . $blog['blog_id'] . '&amp;msg=' . urlencode( sprintf( __( "You are about to delete the site %s" ), $blogname ) ) . '">' . __("Delete") . '</a>';
-
-                                                                        $actions[]        = "<a href='" . get_home_url($blog['blog_id']) . "' rel='permalink'>" . __('Visit') . '</a>';
-                                                                        ?>
-
-                                                                        <?php if ( count($actions) ) : ?>
</del><ins>+                                                                        if ( count( $actions ) ) : ?>
</ins><span class="cx">                                                                         <div class="row-actions">
</span><del>-                                                                                <?php echo implode(' | ', $actions); ?>
</del><ins>+                                                                                <?php echo implode( ' | ', $actions ); ?>
</ins><span class="cx">                                                                         </div>
</span><span class="cx">                                                                         <?php endif; ?>
</span><span class="cx">                                                                 </td>
</span><span class="lines">@@ -638,13 +594,18 @@
</span><span class="cx">                                                                                 $date = 'Y/m/d';
</span><span class="cx">                                                                         else
</span><span class="cx">                                                                                 $date = 'Y/m/d \<\b\r \/\> g:i:s a';
</span><del>-                                                                        echo ( $blog['last_updated'] == '0000-00-00 00:00:00' ) ? __("Never") : mysql2date( __( $date ), $blog['last_updated'] ); ?>
</del><ins>+                                                                        echo ( $blog['last_updated'] == '0000-00-00 00:00:00' ) ? __( 'Never' ) : mysql2date( __( $date ), $blog['last_updated'] ); ?>
</ins><span class="cx">                                                                 </td>
</span><span class="cx">                                                         <?php
</span><span class="cx">                                                         break;
</span><span class="cx">                                                 case 'registered': ?>
</span><span class="cx">                                                                 <td valign="top">
</span><del>-                                                                <?php echo mysql2date(__( $date ), $blog['registered'] ); ?>
</del><ins>+                                                                <?php
+                                                                if ( $blog['registered'] == '0000-00-00 00:00:00' )
+                                                                        echo '&#x2014;';
+                                                                else
+                                                                        echo mysql2date( __( $date ), $blog['registered'] );
+                                                                ?>
</ins><span class="cx">                                                                 </td>
</span><span class="cx">                                                 <?php
</span><span class="cx">                                                 break;
</span><span class="lines">@@ -656,10 +617,10 @@
</span><span class="cx">                                                                                 $blogusers_warning = '';
</span><span class="cx">                                                                                 if ( count( $blogusers ) > 5 ) {
</span><span class="cx">                                                                                         $blogusers = array_slice( $blogusers, 0, 5 );
</span><del>-                                                                                        $blogusers_warning = __( 'Only showing first 5 users.' ) . ' <a href="' . get_admin_url($blog['blog_id'], 'users.php') . '">' . __( 'More' ) . '</a>';
</del><ins>+                                                                                        $blogusers_warning = __( 'Only showing first 5 users.' ) . ' <a href="' . esc_url( get_admin_url( $blog['blog_id'], 'users.php' ) ) . '">' . __( 'More' ) . '</a>';
</ins><span class="cx">                                                                                 }
</span><span class="cx">                                                                                 foreach ( $blogusers as $key => $val ) {
</span><del>-                                                                                        echo '<a href="user-edit.php?user_id=' . $val->user_id . '">' . $val->user_login . '</a> ';
</del><ins>+                                                                                        echo '<a href="' . esc_url( admin_url( 'user-edit.php?user_id=' . $val->user_id ) ) . '">' . esc_html( $val->user_login ) . '</a> ';
</ins><span class="cx">                                                                                         if ( 'list' != $mode )
</span><span class="cx">                                                                                                 echo '(' . $val->user_email . ')';
</span><span class="cx">                                                                                         echo '<br />';
</span><span class="lines">@@ -675,7 +636,7 @@
</span><span class="cx">                                                         case 'plugins': ?>
</span><span class="cx">                                                                 <?php if ( has_filter( 'wpmublogsaction' ) ) { ?>
</span><span class="cx">                                                                 <td valign="top">
</span><del>-                                                                        <?php do_action( "wpmublogsaction", $blog['blog_id'] ); ?>
</del><ins>+                                                                        <?php do_action( 'wpmublogsaction', $blog['blog_id'] ); ?>
</ins><span class="cx">                                                                 </td>
</span><span class="cx">                                                                 <?php } ?>
</span><span class="cx">                                                         <?php break;
</span><span class="lines">@@ -683,7 +644,7 @@
</span><span class="cx">                                                         default: ?>
</span><span class="cx">                                                                 <?php if ( has_filter( 'manage_blogs_custom_column' ) ) { ?>
</span><span class="cx">                                                                 <td valign="top">
</span><del>-                                                                        <?php do_action('manage_blogs_custom_column', $column_name, $blog['blog_id']); ?>
</del><ins>+                                                                        <?php do_action( 'manage_blogs_custom_column', $column_name, $blog['blog_id'] ); ?>
</ins><span class="cx">                                                                 </td>
</span><span class="cx">                                                                 <?php } ?>
</span><span class="cx">                                                         <?php break;
</span><span class="lines">@@ -695,7 +656,7 @@
</span><span class="cx">                                 }
</span><span class="cx">                         } else { ?>
</span><span class="cx">                                 <tr>
</span><del>-                                        <td colspan="8"><?php _e('No blogs found.') ?></td>
</del><ins>+                                        <td colspan="<?php echo (int) count( $sites_columns ); ?>"><?php _e( 'No blogs found.' ) ?></td>
</ins><span class="cx">                                 </tr>
</span><span class="cx">                         <?php
</span><span class="cx">                         } // end if ($blogs)
</span><span class="lines">@@ -711,12 +672,12 @@
</span><span class="cx">
</span><span class="cx">                         <div class="alignleft actions">
</span><span class="cx">                         <select name="action2">
</span><del>-                                <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>
</del><ins>+                                <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>
</ins><span class="cx">                         </select>
</span><del>-                        <input type="submit" value="<?php esc_attr_e('Apply'); ?>" name="doaction2" id="doaction2" class="button-secondary action" />
</del><ins>+                        <input type="submit" value="<?php esc_attr_e( 'Apply' ); ?>" name="doaction2" id="doaction2" class="button-secondary action" />
</ins><span class="cx">                         </div>
</span><span class="cx">                         <br class="clear" />
</span><span class="cx">                 </div>
</span><span class="lines">@@ -726,40 +687,40 @@
</span><span class="cx">
</span><span class="cx">                 <div class="wrap">
</span><span class="cx">                         <a name="form-add-site"></a>
</span><del>-                        <h2><?php _e('Add Site') ?></h2>
</del><ins>+                        <h2><?php _e( 'Add Site' ) ?></h2>
</ins><span class="cx">                         <form method="post" action="ms-edit.php?action=addblog">
</span><del>-                                <?php wp_nonce_field('add-blog') ?>
</del><ins>+                                <?php wp_nonce_field( 'add-blog' ) ?>
</ins><span class="cx">                                 <table class="form-table">
</span><span class="cx">                                         <tr class="form-field form-required">
</span><del>-                                                <th 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" class="regular-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]" class="regular-text" 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><del>-                                                echo "<p>" . __( 'Only the characters a-z and 0-9 recommended.' ) . "</p>";
</del><ins>+                                                echo '<p>' . __( 'Only the characters a-z and 0-9 recommended.' ) . '</p>';
</ins><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 scope='row'><?php _e('Site Title') ?></th>
-                                                <td><input name="blog[title]" type="text" class="regular-text" 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 scope='row'><?php _e('Admin Email') ?></th>
-                                                <td><input name="blog[email]" type="text" class="regular-text" 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><del>-                                                <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>
</del><ins>+                                                <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>
</ins><span class="cx">                                         </tr>
</span><span class="cx">                                 </table>
</span><span class="cx">                                 <p class="submit">
</span><del>-                                        <input class="button" type="submit" name="go" value="<?php esc_attr_e('Add Site') ?>" /></p>
</del><ins>+                                        <input class="button" type="submit" name="go" value="<?php esc_attr_e( 'Add Site' ) ?>" /></p>
</ins><span class="cx">                         </form>
</span><span class="cx">                 </div>
</span><span class="cx">                 <?php
</span><span class="cx">         break;
</span><span class="cx"> } // end switch( $action )
</span><span class="cx">
</span><del>-include('admin-footer.php'); ?>
</del><ins>+include( './admin-footer.php' ); ?>
</ins></span></pre></div>
<a id="trunkwpadminmsthemesphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/ms-themes.php (13917 => 13918)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/ms-themes.php        2010-04-01 20:32:17 UTC (rev 13917)
+++ trunk/wp-admin/ms-themes.php        2010-04-01 21:21:27 UTC (rev 13918)
</span><span class="lines">@@ -1,16 +1,16 @@
</span><span class="cx"> <?php
</span><del>-require_once('admin.php');
</del><ins>+require_once( './admin.php' );
</ins><span class="cx">
</span><del>-$title = __('Network Themes');
</del><ins>+$title = __( 'Network Themes' );
</ins><span class="cx"> $parent_file = 'ms-admin.php';
</span><del>-require_once('admin-header.php');
</del><ins>+require_once( './admin-header.php' );
</ins><span class="cx">
</span><span class="cx"> if ( ! current_user_can( 'manage_network_themes' ) )
</span><del>-        wp_die( __('You do not have permission to access this page.') );
</del><ins>+        wp_die( __( 'You do not have permission to access this page.' ) );
</ins><span class="cx">
</span><del>-if ( isset($_GET['updated']) ) {
</del><ins>+if ( isset( $_GET['updated'] ) ) {
</ins><span class="cx">         ?>
</span><del>-        <div id="message" class="updated fade"><p><?php _e('Site themes saved.') ?></p></div>
</del><ins>+        <div id="message" class="updated fade"><p><?php _e( 'Site themes saved.' ) ?></p></div>
</ins><span class="cx">         <?php
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -18,17 +18,17 @@
</span><span class="cx"> $allowed_themes = get_site_allowed_themes();
</span><span class="cx"> ?>
</span><span class="cx"> <div class="wrap">
</span><del>-        <form action='ms-edit.php?action=updatethemes' method='post'>
</del><ins>+        <form action="<?php echo esc_url( admin_url( 'ms-edit.php?action=updatethemes' ) ); ?>" method="post">
</ins><span class="cx">                 <?php screen_icon(); ?>
</span><del>-                <h2><?php _e('Network Themes') ?></h2>
-                <p><?php _e('Disable themes network-wide. You can enable themes on a site by site basis.') ?></p>
</del><ins>+                <h2><?php _e( 'Network Themes' ) ?></h2>
+                <p><?php _e( 'Disable themes network-wide. You can enable themes on a site by site basis.' ) ?></p>
</ins><span class="cx">                 <table class="widefat">
</span><span class="cx">                         <thead>
</span><span class="cx">                                 <tr>
</span><del>-                                        <th style="width:15%;text-align:center;"><?php _e('Active') ?></th>
-                                        <th style="width:25%;"><?php _e('Theme') ?></th>
-                                        <th style="width:10%;"><?php _e('Version') ?></th>
-                                        <th style="width:60%;"><?php _e('Description') ?></th>
</del><ins>+                                        <th style="width:15%;text-align:center;"><?php _e( 'Active' ) ?></th>
+                                        <th style="width:25%;"><?php _e( 'Theme' ) ?></th>
+                                        <th style="width:10%;"><?php _e( 'Version' ) ?></th>
+                                        <th style="width:60%;"><?php _e( 'Description' ) ?></th>
</ins><span class="cx">                                 </tr>
</span><span class="cx">                         </thead>
</span><span class="cx">                         <tbody id="plugins">
</span><span class="lines">@@ -37,23 +37,24 @@
</span><span class="cx">                         $class = '';
</span><span class="cx">                         foreach ( (array) $themes as $key => $theme ) {
</span><span class="cx">                                 $total_theme_count++;
</span><del>-                                $theme_key = esc_html($theme['Stylesheet']);
-                                $class = ('alt' == $class) ? '' : 'alt';
</del><ins>+                                $theme_key = esc_html( $theme['Stylesheet'] );
+                                $class = ( 'alt' == $class ) ? '' : 'alt';
</ins><span class="cx">                                 $class1 = $enabled = $disabled = '';
</span><ins>+                                $enabled = $disabled = false;
</ins><span class="cx">
</span><del>-                                if ( isset( $allowed_themes[ $theme_key ] ) == true ) {
-                                        $enabled = 'checked="checked" ';
</del><ins>+                                if ( isset( $allowed_themes[$theme_key] ) == true ) {
+                                        $enabled = true;
</ins><span class="cx">                                         $activated_themes_count++;
</span><del>-                                        $class1 = ' active';
</del><ins>+                                        $class1 = 'active';
</ins><span class="cx">                                 } else {
</span><del>-                                        $disabled = 'checked="checked" ';
</del><ins>+                                        $disabled = true;
</ins><span class="cx">                                 }
</span><span class="cx">                                 ?>
</span><del>-                                <tr valign="top" class="<?php echo $class.$class1; ?>">
</del><ins>+                                <tr valign="top" class="<?php echo $class, $class1; ?>">
</ins><span class="cx">                                         <td style="text-align:center;">
</span><del>-                                                <label><input name="theme[<?php echo $theme_key ?>]" type="radio" id="enabled_<?php echo $theme_key ?>" value="enabled" <?php echo $enabled ?> /> <?php _e('Yes') ?></label>
</del><ins>+                                                <label><input name="theme[<?php echo $theme_key ?>]" type="radio" id="enabled_<?php echo $theme_key ?>" value="enabled" <?php checked( $enabled ) ?> /> <?php _e( 'Yes' ) ?></label>
</ins><span class="cx">                                                 &nbsp;&nbsp;&nbsp;
</span><del>-                                                <label><input name="theme[<?php echo $theme_key ?>]" type="radio" id="disabled_<?php echo $theme_key ?>" value="disabled" <?php echo $disabled ?> /> <?php _e('No') ?></label>
</del><ins>+                                                <label><input name="theme[<?php echo $theme_key ?>]" type="radio" id="disabled_<?php echo $theme_key ?>" value="disabled" <?php checked( $disabled ) ?> /> <?php _e( 'No' ) ?></label>
</ins><span class="cx">                                         </td>
</span><span class="cx">                                         <th scope="row" style="text-align:left;"><?php echo $key ?></th>
</span><span class="cx">                                         <td><?php echo $theme['Version'] ?></td>
</span><span class="lines">@@ -64,15 +65,15 @@
</span><span class="cx">                 </table>
</span><span class="cx">
</span><span class="cx">                 <p class="submit">
</span><del>-                        <input type='submit' value='<?php _e('Update Themes') ?>' /></p>
</del><ins>+                        <input type="submit" value="<?php _e( 'Update Themes' ) ?>" /></p>
</ins><span class="cx">         </form>
</span><span class="cx">
</span><del>-        <h3><?php _e('Total')?></h3>
</del><ins>+        <h3><?php _e( 'Total' )?></h3>
</ins><span class="cx">         <p>
</span><del>-                <?php printf(__('Themes Installed: %d'), $total_theme_count); ?>
</del><ins>+                <?php printf( __( 'Themes Installed: %d' ), $total_theme_count); ?>
</ins><span class="cx">                 <br />
</span><del>-                <?php printf(__('Themes Activated: %d'), $activated_themes_count); ?>
</del><ins>+                <?php printf( __( 'Themes Activated: %d' ), $activated_themes_count); ?>
</ins><span class="cx">         </p>
</span><span class="cx"> </div>
</span><span class="cx">
</span><del>-<?php include('admin-footer.php'); ?>
</del><ins>+<?php include( './admin-footer.php' ); ?>
</ins></span></pre></div>
<a id="trunkwpadminmsusersphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/ms-users.php (13917 => 13918)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/ms-users.php        2010-04-01 20:32:17 UTC (rev 13917)
+++ trunk/wp-admin/ms-users.php        2010-04-01 21:21:27 UTC (rev 13918)
</span><span class="lines">@@ -1,67 +1,71 @@
</span><span class="cx"> <?php
</span><del>-require_once('admin.php');
</del><ins>+require_once( './admin.php' );
</ins><span class="cx">
</span><span class="cx"> if ( !is_multisite() )
</span><del>-        wp_die( __('Multisite support is not enabled.') );
</del><ins>+        wp_die( __( 'Multisite support is not enabled.' ) );
</ins><span class="cx">
</span><del>-$title = __('Users');
</del><ins>+$title = __( 'Users' );
</ins><span class="cx"> $parent_file = 'ms-admin.php';
</span><span class="cx">
</span><span class="cx"> wp_enqueue_script( 'admin-forms' );
</span><span class="cx">
</span><del>-require_once('admin-header.php');
</del><ins>+require_once( './admin-header.php' );
</ins><span class="cx">
</span><span class="cx"> if ( ! current_user_can( 'manage_network_users' ) )
</span><del>-        wp_die( __('You do not have permission to access this page.') );
</del><ins>+        wp_die( __( 'You do not have permission to access this page.' ) );
</ins><span class="cx">
</span><del>-if ( isset($_GET['updated']) && $_GET['updated'] == 'true' ) {
</del><ins>+if ( isset( $_GET['updated'] ) && $_GET['updated'] == 'true' && ! empty( $_GET['action'] ) ) {
</ins><span class="cx">         ?>
</span><span class="cx">         <div id="message" class="updated fade"><p>
</span><span class="cx">                 <?php
</span><del>-                switch ($_GET['action']) {
</del><ins>+                switch ( $_GET['action'] ) {
</ins><span class="cx">                         case 'delete':
</span><del>-                                _e('User deleted !');
</del><ins>+                                _e( 'User deleted.' );
</ins><span class="cx">                         break;
</span><span class="cx">                         case 'all_spam':
</span><del>-                                _e('Users marked as spam !');
</del><ins>+                                _e( 'Users marked as spam.' );
</ins><span class="cx">                         break;
</span><span class="cx">                         case 'all_notspam':
</span><del>-                                _e('Users marked as not spam !');
</del><ins>+                                _e( 'Users marked as not spam.' );
</ins><span class="cx">                         break;
</span><span class="cx">                         case 'all_delete':
</span><del>-                                _e('Users deleted !');
</del><ins>+                                _e( 'Users deleted.' );
</ins><span class="cx">                         break;
</span><span class="cx">                         case 'add':
</span><del>-                                _e('User added !');
</del><ins>+                                _e( 'User added.' );
</ins><span class="cx">                         break;
</span><span class="cx">                         case 'add_superadmin':
</span><del>-                                _e('Network admin added !');
</del><ins>+                                _e( 'Network admin added.' );
</ins><span class="cx">                         break;
</span><span class="cx">                         case 'remove_superadmin':
</span><del>-                                _e('Network admin removed !');
</del><ins>+                                _e( 'Network admin removed.' );
</ins><span class="cx">                         break;
</span><span class="cx">                 }
</span><span class="cx">                 ?>
</span><span class="cx">         </p></div>
</span><span class="cx">         <?php
</span><span class="cx"> }
</span><del>-?>
</del><span class="cx">
</span><del>-<div class="wrap" style="position:relative;">
-        <?php
-        $apage = isset( $_GET['apage'] ) ? intval( $_GET['apage'] ) : 1;
-        $num = isset( $_GET['num'] ) ? intval( $_GET['num'] ) : 15;
-        $s = isset($_GET[ 's' ]) ? esc_attr( trim( $_GET[ '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_users_per_page' );
+        if ( empty( $per_page ) || $per_page < 1 )
+                $per_page = 15;
+
+        $per_page = apply_filters( 'ms_users_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->users}";
</span><span class="cx">
</span><del>-        if ( !empty( $s ) ) {
-                $search = '%' . trim( $s ) . '%';
-                $query .= " WHERE user_login LIKE '$search' OR user_email LIKE '$search'";
</del><ins>+        if ( !empty( $like_s ) ) {
+                $query .= " WHERE user_login LIKE '%$like_s%' OR user_email LIKE '%$like_s%'";
</ins><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         $order_by = isset( $_GET['sortby'] ) ? $_GET['sortby'] : 'id';
</span><del>-
</del><span class="cx">         if ( $order_by == 'email' ) {
</span><span class="cx">                 $query .= ' ORDER BY user_email ';
</span><span class="cx">         } elseif ( $order_by == 'login' ) {
</span><span class="lines">@@ -75,101 +79,131 @@
</span><span class="cx">                 $query .= ' ORDER BY ID ';
</span><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(ID)', $query) );
-        else
-                $total = $wpdb->get_var( "SELECT COUNT(ID) FROM {$wpdb->users}");
</del><ins>+        $total = $wpdb->get_var( str_replace( 'SELECT *', 'SELECT COUNT(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">
</span><span class="cx">         $user_list = $wpdb->get_results( $query, ARRAY_A );
</span><span class="cx">
</span><del>-        // Pagination
-        $user_navigation = paginate_links( array(
-                'total' => ceil($total / $num),
-                'current' => $apage,
-                'base' => add_query_arg( 'apage', '%#%' ),
-                'format' => ''
</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
</ins><span class="cx">         ));
</span><span class="cx">
</span><del>-        if ( $user_navigation ) {
-                $user_navigation = sprintf( '<span class="displaying-num">' . __( 'Displaying %s&#8211;%s of %s' ) . '</span>%s',
-                        number_format_i18n( ( $apage - 1 ) * $num + 1 ),
-                        number_format_i18n( min( $apage * $num, $total ) ),
-                        number_format_i18n( $total ),
-                        $user_navigation
-                );
-        }
</del><ins>+        if ( empty( $_GET['mode'] ) )
+                $mode = 'list';
+        else
+                $mode = esc_attr( $_GET['mode'] );
</ins><span class="cx">
</span><span class="cx">         ?>
</span><span class="cx">         <div class="wrap">
</span><span class="cx">         <?php screen_icon(); ?>
</span><del>-        <h2><?php esc_html_e("Users"); ?></h2>
</del><ins>+        <h2><?php esc_html_e( 'Users' ); ?>
+        <a href="#form-add-user" class="button add-new-h2"><?php echo esc_html_x( 'Add New' , 'users'); ?></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">         <form action="ms-users.php" method="get" class="search-form">
</span><span class="cx">                 <p class="search-box">
</span><del>-                <input type="text" name="s" value="<?php if ( isset($_GET['s']) ) esc_attr( stripslashes( $s ) ); ?>" class="search-input" id="user-search-input" />
-                <input type="submit" id="post-query-submit" value="<?php esc_attr_e('Search Users') ?>" class="button" />
</del><ins>+                <input type="text" name="s" value="<?php echo esc_attr( $s ); ?>" class="search-input" id="user-search-input" />
+                <input type="submit" id="post-query-submit" value="<?php esc_attr_e( 'Search Users' ) ?>" class="button" />
</ins><span class="cx">                 </p>
</span><span class="cx">         </form>
</span><del>-        </div>
</del><span class="cx">
</span><span class="cx">         <form id="form-user-list" action='ms-edit.php?action=allusers' method='post'>
</span><ins>+                <input type="hidden" name="mode" value="<?php echo esc_attr( $mode ); ?>" />
</ins><span class="cx">                 <div class="tablenav">
</span><del>-                        <?php if ( $user_navigation ) echo "<div class='tablenav-pages'>$user_navigation</div>"; ?>
-
</del><span class="cx">                         <div class="alignleft actions">
</span><del>-                                <input type="submit" value="<?php esc_attr_e('Delete') ?>" name="alluser_delete" class="button-secondary delete" />
-                                <input type="submit" value="<?php esc_attr_e('Mark as Spammers') ?>" name="alluser_spam" class="button-secondary" />
-                                <input type="submit" value="<?php esc_attr_e('Not Spam') ?>" name="alluser_notspam" class="button-secondary" />
-                                <input type="submit" value="<?php esc_attr_e('Add Network Admins') ?>" name="add_superadmin" class="button-secondary" />
-                                <input type="submit" value="<?php esc_attr_e('Remove Network Admins') ?>" name="remove_superadmin" class="button-secondary" />
-                                <?php wp_nonce_field( 'allusers' ); ?>
-                                <br class="clear" />
</del><ins>+                                <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 Spammers' ); ?></option>
+                                        <option value="notspam"><?php _e( 'Not Spam' ); ?></option>
+                                        <option value="superadmin"><?php _e( 'Add Super Admins' ); ?></option>
+                                        <option value="notsuperadmin"><?php _e( 'Remove Super Admins' ); ?></option>
+                                </select>
+                                <input type="submit" value="<?php esc_attr_e( 'Apply' ); ?>" name="doaction" id="doaction" class="button-secondary action" />
+                                <?php wp_nonce_field( 'bulk-ms-users' ); ?>
</ins><span class="cx">                         </div>
</span><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; ?>
+                        </div>
+                        <?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">                 </div>
</span><ins>+                <div class="clear"></div>
</ins><span class="cx">
</span><del>-                <?php if ( isset($_GET['s']) && $_GET['s'] != '' ) : ?>
-                        <p><a href="ms-sites.php?action=blogs&amp;s=<?php echo urlencode( stripslashes( $s ) ); ?>&blog_name=Search+blogs+by+name"><?php _e('Search Sites for') ?> <strong><?php echo stripslashes( $s ) ?></strong></a></p>
-                <?php endif; ?>
-
</del><span class="cx">                 <?php
</span><span class="cx">                 // define the columns to display, the syntax is 'internal name' => 'display name'
</span><del>-                $posts_columns = array(
-                        'checkbox'         => '',
-                        'login' => __('Username'),
-                        'name' => __('Name'),
-                        'email' => __('E-mail'),
-                        'registered' => __('Registered'),
-                        'blogs' => ''
</del><ins>+                $users_columns = array(
+                        'id' => __( 'ID' ),
+                        'login' => __( 'Username' ),
+                        'name' => __( 'Name' ),
+                        'email' => __( 'E-mail' ),
+                        'registered' => __( 'Registered' ),
+                        'blogs' => __( 'Sites' )
</ins><span class="cx">                 );
</span><del>-                $posts_columns = apply_filters('wpmu_users_columns', $posts_columns);
</del><ins>+                $users_columns = apply_filters( 'wpmu_users_columns', $users_columns );
</ins><span class="cx">                 ?>
</span><del>-                <table class="widefat" cellspacing="0">
</del><ins>+                <table class="widefat">
</ins><span class="cx">                         <thead>
</span><span class="cx">                         <tr>
</span><del>-                                <?php foreach( (array) $posts_columns as $column_id => $column_display_name) {
-                                        if ( $column_id == 'blogs' ) {
-                                                echo '<th scope="col">'.__('Sites').'</th>';
-                                        } elseif ( $column_id == 'checkbox') {
-                                                echo '<th scope="col" class="check-column"><input type="checkbox" /></th>';
-                                        } else { ?>
-                                                <th scope="col"><a href="ms-users.php?sortby=<?php echo $column_id ?>&amp;<?php if ( $order_by == $column_id ) { if ( $order == 'DESC' ) { echo "order=ASC&amp;" ; } else { echo "order=DESC&amp;"; } } ?>apage=<?php echo $apage ?>"><?php echo $column_display_name; ?></a></th>
-                                        <?php } ?>
-                                <?php } ?>
</del><ins>+                                <th class="manage-column column-cb check-column" id="cb" scope="col">
+                                        <input type="checkbox" />
+                                </th>
+                                <?php
+                                $col_url = '';
+                                foreach($users_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 .= '<th scope="col">' . ( $column_id == 'blogs' ? $column_display_name : $column_link ) . '</th>';
+                                }
+                                echo $col_url; ?>
</ins><span class="cx">                         </tr>
</span><span class="cx">                         </thead>
</span><del>-                        <tbody id="users" class="list:user user-list">
-                        <?php if ($user_list) {
</del><ins>+                        <tfoot>
+                        <tr>
+                                <th class="manage-column column-cb check-column" id="cb" scope="col">
+                                        <input type="checkbox" />
+                                </th>
+                                <?php echo $col_url; ?>
+                        </tr>
+                        </tfoot>
+                        <tbody id="the-user-list" class="list:user">
+                        <?php if ( $user_list ) {
</ins><span class="cx">                                 $class = '';
</span><span class="cx">                                 $super_admins = get_site_option( 'site_admins' );
</span><del>-                                foreach ( (array) $user_list as $user) {
-                                        $class = ('alternate' == $class) ? '' : 'alternate';
</del><ins>+                                foreach ( (array) $user_list as $user ) {
+                                        $class = ( 'alternate' == $class ) ? '' : 'alternate';
</ins><span class="cx">
</span><del>-                                        $status_list = array( "spam" => "site-spammed", "deleted" => "site-deleted" );
</del><ins>+                                        $status_list = array( 'spam' => 'site-spammed', 'deleted' => 'site-deleted' );
</ins><span class="cx">
</span><span class="cx">                                         foreach ( $status_list as $status => $col ) {
</span><span class="cx">                                                 if ( $user[$status] )
</span><span class="lines">@@ -177,31 +211,34 @@
</span><span class="cx">                                         }
</span><span class="cx">
</span><span class="cx">                                         ?>
</span><del>-
</del><span class="cx">                                         <tr class="<?php echo $class; ?>">
</span><span class="cx">                                         <?php
</span><del>-                                        foreach( (array) $posts_columns as $column_name=>$column_display_name) :
-                                                switch($column_name) {
-                                                        case 'checkbox': ?>
-                                                                <th scope="row" class="check-column"><input type='checkbox' id='user_<?php echo $user['ID'] ?>' name='allusers[]' value='<?php echo esc_attr($user['ID']) ?>' /></th>
</del><ins>+                                        foreach( (array) $users_columns as $column_name=>$column_display_name ) :
+                                                switch( $column_name ) {
+                                                        case 'id': ?>
+                                                                <th scope="row" class="check-column">
+                                                                        <input type="checkbox" id="blog_<?php echo $user['ID'] ?>" name="allusers[]" value="<?php echo esc_attr( $user['ID'] ) ?>" />
+                                                                </th>
+                                                                <th valign="top" scope="row">
+                                                                        <?php echo $user['ID'] ?>
+                                                                </th>
</ins><span class="cx">                                                         <?php
</span><span class="cx">                                                         break;
</span><span class="cx">
</span><span class="cx">                                                         case 'login':
</span><span class="cx">                                                                 $avatar        = get_avatar( $user['user_email'], 32 );
</span><del>-                                                                $edit        = esc_url( add_query_arg( 'wp_http_referer', urlencode( esc_url( stripslashes( $_SERVER['REQUEST_URI'] ) ) ), "user-edit.php?user_id=".$user['ID'] ) );
-                                                                // @todo Make delete link work like delete button with transfering users (in ms-edit.php)
-                                                                //$delete        = esc_url( add_query_arg( 'wp_http_referer', urlencode( esc_url( stripslashes( $_SERVER['REQUEST_URI'] ) ) ), wp_nonce_url( 'ms-edit.php', 'deleteuser' ) . '&amp;action=deleteuser&amp;id=' . $user['ID'] ) );
</del><span class="cx">                                                                 ?>
</span><span class="cx">                                                                 <td class="username column-username">
</span><del>-                                                                        <?php echo $avatar; ?><strong><a href="<?php echo $edit; ?>" class="edit"><?php echo stripslashes($user['user_login']); ?></a><?php
-                                                                if ( in_array( $user[ 'user_login' ], $super_admins ) )
-                                                                        echo ' - ' . __( 'Super admin' );
-?></strong>
</del><ins>+                                                                        <?php echo $avatar; ?><strong><a href="<?php echo esc_url( admin_url( 'user-edit.php?user_id=' . $user['ID'] ) ); ?>" class="edit"><?php echo stripslashes( $user['user_login'] ); ?></a><?php
+                                                                        if ( in_array( $user['user_login'], $super_admins ) )
+                                                                                echo ' - ' . __( 'Super admin' );
+                                                                        ?></strong>
</ins><span class="cx">                                                                         <br/>
</span><span class="cx">                                                                         <div class="row-actions">
</span><del>-                                                                                <span class="edit"><a href="<?php echo $edit; ?>">Edit</a></span>
-                                                                                <?php /*<span class="delete"><a href="<?php echo $delete; ?>" class="delete">Delete</a></span> */ ?>
</del><ins>+                                                                                <span class="edit"><a href="<?php echo esc_url( admin_url( 'user-edit.php?user_id=' . $user['ID'] ) ); ?>"><?php _e( 'Edit'); ?></a></span>
+                                                                                <?php if ( ! in_array( $user['user_login'], $super_admins ) ) { ?>
+                                                                                | <span class="delete"><a href="<?php echo $delete        = esc_url( admin_url( add_query_arg( '_wp_http_referer', urlencode( stripslashes( $_SERVER['REQUEST_URI'] ) ), wp_nonce_url( 'ms-edit.php', 'deleteuser' ) . '&amp;action=deleteuser&amp;id=' . $user['ID'] ) ) ); ?>" class="delete"><?php _e( 'Delete' ); ?></a></span>
+                                                                                <?php } ?>
</ins><span class="cx">                                                                         </div>
</span><span class="cx">                                                                 </td>
</span><span class="cx">                                                         <?php
</span><span class="lines">@@ -217,8 +254,13 @@
</span><span class="cx">                                                         <?php
</span><span class="cx">                                                         break;
</span><span class="cx">
</span><del>-                                                        case 'registered': ?>
-                                                                <td><?php echo mysql2date(__('Y-m-d \<\b\r \/\> g:i a'), $user['user_registered']); ?></td>
</del><ins>+                                                        case 'registered':
+                                                                if ( 'list' == $mode )
+                                                                        $date = 'Y/m/d';
+                                                                else
+                                                                        $date = 'Y/m/d \<\b\r \/\> g:i:s a';
+                                                        ?>
+                                                                <td><?php echo mysql2date( __( $date ), $user['user_registered'] ); ?></td>
</ins><span class="cx">                                                         <?php
</span><span class="cx">                                                         break;
</span><span class="cx">
</span><span class="lines">@@ -229,19 +271,19 @@
</span><span class="cx">                                                                         <?php
</span><span class="cx">                                                                         if ( is_array( $blogs ) ) {
</span><span class="cx">                                                                                 foreach ( (array) $blogs as $key => $val ) {
</span><del>-                                                                                        $path        = ($val->path == '/') ? '' : $val->path;
-                                                                                        echo '<a href="ms-sites.php?action=editblog&amp;id=' . $val->userblog_id . '">' . str_replace( '.' . $current_site->domain, '', $val->domain . $path ) . '</a>';
</del><ins>+                                                                                        $path        = ( $val->path == '/' ) ? '' : $val->path;
+                                                                                        echo '<a href="'. esc_url( admin_url( 'ms-sites.php?action=editblog&amp;id=' . $val->userblog_id ) ) .'">' . str_replace( '.' . $current_site->domain, '', $val->domain . $path ) . '</a>';
</ins><span class="cx">                                                                                         echo ' <small class="row-actions">';
</span><span class="cx">
</span><span class="cx">                                                                                         // Edit
</span><del>-                                                                                        echo '<a href="ms-sites.php?action=editblog&amp;id=' . $val->userblog_id . '">' . __('Edit') . '</a> | ';
</del><ins>+                                                                                        echo '<a href="'. esc_url( admin_url( 'ms-sites.php?action=editblog&amp;id=' . $val->userblog_id ) ) .'">' . __( 'Edit' ) . '</a> | ';
</ins><span class="cx">
</span><span class="cx">                                                                                         // View
</span><span class="cx">                                                                                         echo '<a ';
</span><span class="cx">                                                                                         if ( get_blog_status( $val->userblog_id, 'spam' ) == 1 )
</span><del>-                                                                                                echo 'style="background-color: #f66" ';
-                                                                                        echo 'target="_new" href="http://'.$val->domain . $val->path.'">' . __('View') . '</a>';
-
</del><ins>+                                                                                                echo 'style="background-color: #faa" ';
+                                                                                        echo 'href="' . esc_url( get_home_url( $val->userblog_id ) ) . '">' . __( 'View' ) . '</a>';
+                                                                                        
</ins><span class="cx">                                                                                         echo '</small><br />';
</span><span class="cx">                                                                                 }
</span><span class="cx">                                                                         }
</span><span class="lines">@@ -251,7 +293,7 @@
</span><span class="cx">                                                         break;
</span><span class="cx">
</span><span class="cx">                                                         default: ?>
</span><del>-                                                                <td><?php do_action('manage_users_custom_column', $column_name, $user['ID']); ?></td>
</del><ins>+                                                                <td><?php do_action( 'manage_users_custom_column', $column_name, $user['ID'] ); ?></td>
</ins><span class="cx">                                                         <?php
</span><span class="cx">                                                         break;
</span><span class="cx">                                                 }
</span><span class="lines">@@ -262,8 +304,8 @@
</span><span class="cx">                                 }
</span><span class="cx">                         } else {
</span><span class="cx">                         ?>
</span><del>-                                <tr style='background-color: <?php echo $bgcolor; ?>'>
-                                        <td colspan="<?php echo (int) count($posts_columns); ?>"><?php _e('No users found.') ?></td>
</del><ins>+                                <tr>
+                                        <td colspan="<?php echo (int) count($users_columns); ?>"><?php _e( 'No users found.' ) ?></td>
</ins><span class="cx">                                 </tr>
</span><span class="cx">                                 <?php
</span><span class="cx">                         } // end if ($users)
</span><span class="lines">@@ -272,45 +314,52 @@
</span><span class="cx">                 </table>
</span><span class="cx">
</span><span class="cx">                 <div class="tablenav">
</span><del>-                        <?php if ( $user_navigation ) echo "<div class='tablenav-pages'>$user_navigation</div>"; ?>
</del><ins>+                        <?php
+                        if ( $page_links )
+                                echo "<div class='tablenav-pages'>$page_links_text</div>";
+                        ?>
</ins><span class="cx">
</span><del>-                        <div class="alignleft">
-                                <input type="submit" value="<?php esc_attr_e('Delete') ?>" name="alluser_delete" class="button-secondary delete" />
-                                <input type="submit" value="<?php esc_attr_e('Mark as Spammers') ?>" name="alluser_spam" class="button-secondary" />
-                                <input type="submit" value="<?php esc_attr_e('Not Spam') ?>" name="alluser_notspam" class="button-secondary" />
-                                <input type="submit" value="<?php esc_attr_e('Add Network Admins') ?>" name="add_superadmin" class="button-secondary" />
-                                <input type="submit" value="<?php esc_attr_e('Remove Network Admins') ?>" name="remove_superadmin" class="button-secondary" />
-                                <?php wp_nonce_field( 'allusers' ); ?>
-                                <br class="clear" />
</del><ins>+                        <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 Spammers' ); ?></option>
+                                        <option value="notspam"><?php _e( 'Not Spam' ); ?></option>
+                                        <option value="superadmin"><?php _e( 'Add Super Admins' ); ?></option>
+                                        <option value="notsuperadmin"><?php _e( 'Remove Super Admins' ); ?></option>
+                                </select>
+                                <input type="submit" value="<?php esc_attr_e( 'Apply' ); ?>" name="doaction2" id="doaction2" class="button-secondary action" />
</ins><span class="cx">                         </div>
</span><ins>+                        <br class="clear" />
</ins><span class="cx">                 </div>
</span><del>-        </form>
-</div>
</del><span class="cx">
</span><ins>+                </form>
+                </div>
+
</ins><span class="cx"> <?php
</span><del>-if ( apply_filters('show_adduser_fields', true) ) :
</del><ins>+if ( apply_filters( 'show_adduser_fields', true ) ) :
</ins><span class="cx"> ?>
</span><span class="cx"> <div class="wrap">
</span><del>-        <h2><?php _e('Add user') ?></h2>
-        <form action="ms-edit.php?action=adduser" method="post">
</del><ins>+        <h2><?php _e( 'Add user' ) ?></h2>
+        <form action="ms-edit.php?action=adduser" method="post" id="form-add-user">
</ins><span class="cx">         <table class="form-table">
</span><span class="cx">                 <tr class="form-field form-required">
</span><del>-                        <th scope='row'><?php _e('Username') ?></th>
-                        <td><input type="text" name="user[username]" /></td>
</del><ins>+                        <th scope="row"><?php _e( 'Username' ) ?></th>
+                        <td><input type="text" class="regular-text" name="user[username]" /></td>
</ins><span class="cx">                 </tr>
</span><span class="cx">                 <tr class="form-field form-required">
</span><del>-                        <th scope='row'><?php _e('Email') ?></th>
-                        <td><input type="text" name="user[email]" /></td>
</del><ins>+                        <th scope="row"><?php _e( 'Email' ) ?></th>
+                        <td><input type="text" class="regular-text" name="user[email]" /></td>
</ins><span class="cx">                 </tr>
</span><span class="cx">                 <tr class="form-field">
</span><del>-                        <td colspan='2'><?php _e('Username and password will be mailed to the above email address.') ?></td>
</del><ins>+                        <td colspan="2"><?php _e( 'Username and password will be mailed to the above email address.' ) ?></td>
</ins><span class="cx">                 </tr>
</span><span class="cx">         </table>
</span><span class="cx">         <p class="submit">
</span><del>-                <?php wp_nonce_field('add-user') ?>
-                <input class="button" type="submit" name="Add user" value="<?php esc_attr_e('Add user') ?>" /></p>
</del><ins>+                <?php wp_nonce_field( 'add-user' ) ?>
+                <input class="button" type="submit" value="<?php esc_attr_e( 'Add user' ) ?>" /></p>
</ins><span class="cx">         </form>
</span><span class="cx"> </div>
</span><span class="cx"> <?php endif; ?>
</span><span class="cx">
</span><del>-<?php include('admin-footer.php'); ?>
</del><ins>+<?php include( './admin-footer.php' ); ?>
</ins></span></pre></div>
<a id="trunkwpadminmysitesphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/my-sites.php (13917 => 13918)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/my-sites.php        2010-04-01 20:32:17 UTC (rev 13917)
+++ trunk/wp-admin/my-sites.php        2010-04-01 21:21:27 UTC (rev 13918)
</span><span class="lines">@@ -1,14 +1,13 @@
</span><span class="cx"> <?php
</span><ins>+require_once( './admin.php' );
</ins><span class="cx">
</span><del>-require_once('admin.php');
-
</del><span class="cx"> if ( !is_multisite() )
</span><del>-        wp_die( __('Multisite support is not enabled.') );
</del><ins>+        wp_die( __( 'Multisite support is not enabled.' ) );
</ins><span class="cx">
</span><span class="cx"> if ( ! current_user_can('read') )
</span><del>-        wp_die(__('You do not have sufficient permissions to view this page.'));
</del><ins>+        wp_die( __( 'You do not have sufficient permissions to view this page.' ) );
</ins><span class="cx">
</span><del>-$action = isset($_POST['action']) ? $_POST['action'] : 'splash';
</del><ins>+$action = isset( $_POST['action'] ) ? $_POST['action'] : 'splash';
</ins><span class="cx">
</span><span class="cx"> $blogs = get_blogs_of_user( $current_user->id );
</span><span class="cx">
</span><span class="lines">@@ -17,28 +16,36 @@
</span><span class="cx">
</span><span class="cx"> $updated = false;
</span><span class="cx"> if ( 'updateblogsettings' == $action && isset( $_POST['primary_blog'] ) ) {
</span><del>-        check_admin_referer('update-my-sites');
-        // @todo Validate primary blog.
-        update_user_option( $current_user->id, 'primary_blog', (int) $_POST['primary_blog'], true );
-        $updated = true;
</del><ins>+        check_admin_referer( 'update-my-sites' );
+
+        $blog = get_blog_details( (int) $_POST['primary_blog'] );
+        if ( $blog && isset( $blog->domain ) ) {
+                update_user_option( $current_user->id, 'primary_blog', (int) $_POST['primary_blog'], true );
+                $updated = true;
+        } else {
+                wp_die( __( "The primary site, which you have choosen, doesn't exists." ) );        
+        }
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-$title = __('My Sites');
</del><ins>+$title = __( 'My Sites' );
</ins><span class="cx"> $parent_file = 'index.php';
</span><del>-require_once('admin-header.php');
</del><ins>+require_once( './admin-header.php' );
</ins><span class="cx">
</span><span class="cx"> if ( $updated ) { ?>
</span><del>-                <div id="message" class="updated fade"><p><strong><?php _e( 'Your site preferences have been updated.' ); ?></strong></p></div>
</del><ins>+        <div id="message" class="updated fade"><p><strong><?php _e( 'Settings saved.' ); ?></strong></p></div>
</ins><span class="cx"> <?php } ?>
</span><span class="cx">
</span><span class="cx"> <div class="wrap">
</span><span class="cx"> <?php screen_icon(); ?>
</span><del>-<h2><?php echo esc_html($title); ?></h2>
</del><ins>+<h2><?php esc_html_e( $title ); ?></h2>
</ins><span class="cx"> <form id="myblogs" action="" method="post">
</span><span class="cx">         <?php
</span><span class="cx">         choose_primary_blog();
</span><span class="cx">         do_action( 'myblogs_allblogs_options' );
</span><del>-        ?><table class='widefat'> <?php
</del><ins>+        ?>
+        <br clear="all" />
+        <table class="widefat fixed">
+        <?php
</ins><span class="cx">         $settings_html = apply_filters( 'myblogs_options', '', 'global' );
</span><span class="cx">         if ( $settings_html != '' ) {
</span><span class="cx">                 echo "<tr><td valign='top'><h3>" . __( 'Global Settings' ) . "</h3></td><td>";
</span><span class="lines">@@ -52,7 +59,7 @@
</span><span class="cx">                 $cols = 4;
</span><span class="cx">         elseif ( $num >= 10 )
</span><span class="cx">                 $cols = 2;
</span><del>-        $num_rows = ceil($num/$cols);
</del><ins>+        $num_rows = ceil( $num / $cols );
</ins><span class="cx">         $split = 0;
</span><span class="cx">         for ( $i = 1; $i <= $num_rows; $i++ ) {
</span><span class="cx">                 $rows[] = array_slice( $blogs, $split, $cols );
</span><span class="lines">@@ -61,28 +68,28 @@
</span><span class="cx">
</span><span class="cx">         $c = '';
</span><span class="cx">         foreach ( $rows as $row ) {
</span><del>-                $c = $c == "alternate" ? '' : 'alternate';
</del><ins>+                $c = $c == 'alternate' ? '' : 'alternate';
</ins><span class="cx">                 echo "<tr class='$c'>";
</span><del>-                $t = '';
</del><ins>+                $i = 0;
</ins><span class="cx">                 foreach ( $row as $user_blog ) {
</span><del>-                        $t = $t == 'border-right: 1px solid #ccc;' ? '' : 'border-right: 1px solid #ccc;';
-                        echo "<td valign='top' style='$t; width:50%'>";
</del><ins>+                        $s = $i == 3 ? '' : 'border-right: 1px solid #ccc;';
+                        echo "<td valign='top' style='$s'>";
</ins><span class="cx">                         echo "<h3>{$user_blog->blogname}</h3>";
</span><del>-                        echo "<p>" . apply_filters( "myblogs_blog_actions", "<a href='" . get_home_url($user_blog->userblog_id) . "'>" . __( 'Visit' ) . "</a> | <a href='" . get_admin_url($user_blog->userblog_id) . "'>" . __( 'Dashboard' ) . "</a>", $user_blog ) . "</p>";
</del><ins>+                        echo "<p>" . apply_filters( 'myblogs_blog_actions', "<a href='" . esc_url( get_home_url( $user_blog->userblog_id ) ). "'>" . __( 'Visit' ) . "</a> | <a href='" . esc_url( get_admin_url( $user_blog->userblog_id ) ) . "'>" . __( 'Dashboard' ) . "</a>", $user_blog ) . "</p>";
</ins><span class="cx">                         echo apply_filters( 'myblogs_options', '', $user_blog );
</span><span class="cx">                         echo "</td>";
</span><ins>+                        $i++;
</ins><span class="cx">                 }
</span><span class="cx">                 echo "</tr>";
</span><span class="cx">         }?>
</span><span class="cx">         </table>
</span><span class="cx">         <input type="hidden" name="action" value="updateblogsettings" />
</span><del>-        <?php wp_nonce_field('update-my-sites'); ?>
</del><ins>+        <?php wp_nonce_field( 'update-my-sites' ); ?>
</ins><span class="cx">         <p>
</span><del>-         <input type="submit" class="button-primary" value="<?php _e('Update Options') ?>" name="submit" />
</del><ins>+         <input type="submit" class="button-primary" value="<?php _e( 'Save Changes' ) ?>" />
</ins><span class="cx">         </p>
</span><span class="cx">         </form>
</span><span class="cx">         </div>
</span><span class="cx"> <?php
</span><del>-include('admin-footer.php');
-
-?>
</del><span class="cx">\ No newline at end of file
</span><ins>+include( './admin-footer.php' );
+?>
</ins></span></pre>
</div>
</div>
</body>
</html>