<!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>[12897] trunk/wp-admin/ms-sites.php: ms-sites cleanup.</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/12897">12897</a></dd>
<dt>Author</dt> <dd>ryan</dd>
<dt>Date</dt> <dd>2010-01-29 17:36:57 +0000 (Fri, 29 Jan 2010)</dd>
</dl>

<h3>Log Message</h3>
<pre>ms-sites cleanup. Add escaping. Use API instead of direct queries. Add blog status label to row title. see <a href="http://trac.wordpress.org/ticket/11644">#11644</a></pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadminmssitesphp">trunk/wp-admin/ms-sites.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadminmssitesphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/ms-sites.php (12896 => 12897)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/ms-sites.php        2010-01-29 16:26:46 UTC (rev 12896)
+++ trunk/wp-admin/ms-sites.php        2010-01-29 17:36:57 UTC (rev 12897)
</span><span class="lines">@@ -76,13 +76,13 @@
</span><span class="cx">         // Edit blog
</span><span class="cx">         case &quot;editblog&quot;:
</span><span class="cx">                 $blog_prefix = $wpdb-&gt;get_blog_prefix( $id );
</span><del>-                $options = $wpdb-&gt;get_results( &quot;SELECT * FROM {$blog_prefix}options WHERE option_name NOT LIKE '_transient_rss%' AND option_name NOT LIKE '%user_roles'&quot;, ARRAY_A );
-                $details = $wpdb-&gt;get_row( &quot;SELECT * FROM {$wpdb-&gt;blogs} WHERE blog_id = '{$id}'&quot;, ARRAY_A );
</del><ins>+                $options = $wpdb-&gt;get_results( &quot;SELECT * FROM {$blog_prefix}options WHERE option_name NOT LIKE '\_%' AND option_name NOT LIKE '%user_roles'&quot; );
+                $details = get_blog_details($id);
</ins><span class="cx">                 $editblog_roles = get_blog_option( $id, &quot;{$blog_prefix}user_roles&quot; );
</span><span class="cx">                 ?&gt;
</span><span class="cx">                 &lt;div class=&quot;wrap&quot;&gt;
</span><span class="cx">                 &lt;?php screen_icon(); ?&gt;
</span><del>-                &lt;h2&gt;&lt;?php _e('Edit Blog'); ?&gt; - &lt;a href='http://&lt;?php echo $details['domain'].$details['path']; ?&gt;'&gt;http://&lt;?php echo $details['domain'].$details['path']; ?&gt;&lt;/a&gt;&lt;/h2&gt;
</del><ins>+                &lt;h2&gt;&lt;?php _e('Edit Blog'); ?&gt; - &lt;a href='http://&lt;?php echo $details-&gt;domain . $details-&gt;path; ?&gt;'&gt;http://&lt;?php echo $details-&gt;domain . $details-&gt;path; ?&gt;&lt;/a&gt;&lt;/h2&gt;
</ins><span class="cx">                 &lt;form method=&quot;post&quot; action=&quot;ms-edit.php?action=updateblog&quot;&gt;
</span><span class="cx">                         &lt;?php wp_nonce_field('editblog'); ?&gt;
</span><span class="cx">                         &lt;input type=&quot;hidden&quot; name=&quot;id&quot; value=&quot;&lt;?php echo esc_attr($id) ?&gt;&quot; /&gt;
</span><span class="lines">@@ -93,54 +93,54 @@
</span><span class="cx">                                 &lt;table class=&quot;form-table&quot;&gt;
</span><span class="cx">                                                         &lt;tr class=&quot;form-field form-required&quot;&gt;
</span><span class="cx">                                                                 &lt;th scope=&quot;row&quot;&gt;&lt;?php _e('Domain') ?&gt;&lt;/th&gt;
</span><del>-                                                                &lt;td&gt;http://&lt;input name=&quot;blog[domain]&quot; type=&quot;text&quot; id=&quot;domain&quot; value=&quot;&lt;?php echo $details['domain'] ?&gt;&quot; size=&quot;33&quot; /&gt;&lt;/td&gt;
</del><ins>+                                                                &lt;td&gt;http://&lt;input name=&quot;blog[domain]&quot; type=&quot;text&quot; id=&quot;domain&quot; value=&quot;&lt;?php echo $details-&gt;domain ?&gt;&quot; size=&quot;33&quot; /&gt;&lt;/td&gt;
</ins><span class="cx">                                                         &lt;/tr&gt;
</span><span class="cx">                                                         &lt;tr class=&quot;form-field form-required&quot;&gt;
</span><span class="cx">                                                                 &lt;th scope=&quot;row&quot;&gt;&lt;?php _e('Path') ?&gt;&lt;/th&gt;
</span><del>-                                                                &lt;td&gt;&lt;input name=&quot;blog[path]&quot; type=&quot;text&quot; id=&quot;path&quot; value=&quot;&lt;?php echo esc_attr($details['path']) ?&gt;&quot; size=&quot;40&quot; style='margin-bottom:5px;' /&gt;
-                                                                &lt;br /&gt;&lt;input type='checkbox' style='width:20px;' name='update_home_url' value='update' &lt;?php if ( get_blog_option( $id, 'siteurl' ) == preg_replace('|/+$|', '', 'http://' . $details['domain'] . $details['path']) || get_blog_option( $id, 'home' ) == preg_replace('|/+$|', '', 'http://' . $details['domain'] . $details['path']) ) echo 'checked=&quot;checked&quot;'; ?&gt; /&gt; &lt;?php _e( &quot;Update 'siteurl' and 'home' as well.&quot; ); ?&gt;&lt;/td&gt;
</del><ins>+                                                                &lt;td&gt;&lt;input name=&quot;blog[path]&quot; type=&quot;text&quot; id=&quot;path&quot; value=&quot;&lt;?php echo esc_attr($details-&gt;path) ?&gt;&quot; size=&quot;40&quot; style='margin-bottom:5px;' /&gt;
+                                                                &lt;br /&gt;&lt;input type='checkbox' style='width:20px;' name='update_home_url' value='update' &lt;?php if ( get_blog_option( $id, 'siteurl' ) == preg_replace('|/+$|', '', 'http://' . $details-&gt;domain . $details-&gt;path) || get_blog_option( $id, 'home' ) == preg_replace('|/+$|', '', 'http://' . $details-&gt;domain . $details-&gt;path) ) echo 'checked=&quot;checked&quot;'; ?&gt; /&gt; &lt;?php _e( &quot;Update 'siteurl' and 'home' as well.&quot; ); ?&gt;&lt;/td&gt;
</ins><span class="cx">                                                         &lt;/tr&gt;
</span><span class="cx">                                                         &lt;tr class=&quot;form-field&quot;&gt;
</span><span class="cx">                                                                 &lt;th scope=&quot;row&quot;&gt;&lt;?php _e('Registered') ?&gt;&lt;/th&gt;
</span><del>-                                                                &lt;td&gt;&lt;input name=&quot;blog[registered]&quot; type=&quot;text&quot; id=&quot;blog_registered&quot; value=&quot;&lt;?php echo esc_attr($details['registered']) ?&gt;&quot; size=&quot;40&quot; /&gt;&lt;/td&gt;
</del><ins>+                                                                &lt;td&gt;&lt;input name=&quot;blog[registered]&quot; type=&quot;text&quot; id=&quot;blog_registered&quot; value=&quot;&lt;?php echo esc_attr($details-&gt;registered) ?&gt;&quot; size=&quot;40&quot; /&gt;&lt;/td&gt;
</ins><span class="cx">                                                         &lt;/tr&gt;
</span><span class="cx">                                                         &lt;tr class=&quot;form-field&quot;&gt;
</span><span class="cx">                                                                 &lt;th scope=&quot;row&quot;&gt;&lt;?php _e('Last Updated') ?&gt;&lt;/th&gt;
</span><del>-                                                                &lt;td&gt;&lt;input name=&quot;blog[last_updated]&quot; type=&quot;text&quot; id=&quot;blog_last_updated&quot; value=&quot;&lt;?php echo esc_attr($details['last_updated']) ?&gt;&quot; size=&quot;40&quot; /&gt;&lt;/td&gt;
</del><ins>+                                                                &lt;td&gt;&lt;input name=&quot;blog[last_updated]&quot; type=&quot;text&quot; id=&quot;blog_last_updated&quot; value=&quot;&lt;?php echo esc_attr($details-&gt;last_updated) ?&gt;&quot; size=&quot;40&quot; /&gt;&lt;/td&gt;
</ins><span class="cx">                                                         &lt;/tr&gt;
</span><span class="cx">                                                         &lt;tr class=&quot;form-field&quot;&gt;
</span><span class="cx">                                                                 &lt;th scope=&quot;row&quot;&gt;&lt;?php _e('Public') ?&gt;&lt;/th&gt;
</span><span class="cx">                                                                 &lt;td&gt;
</span><del>-                                                                        &lt;input type='radio' style='width:20px;' name='blog[public]' value='1' &lt;?php if ( $details['public'] == '1' ) echo 'checked=&quot;checked&quot;'; ?&gt; /&gt; &lt;?php _e('Yes') ?&gt;
-                                                                        &lt;input type='radio' style='width:20px;' name='blog[public]' value='0' &lt;?php if ( $details['public'] == '0' ) echo 'checked=&quot;checked&quot;'; ?&gt; /&gt; &lt;?php _e('No') ?&gt;
</del><ins>+                                                                        &lt;input type='radio' style='width:20px;' name='blog[public]' value='1' &lt;?php if ( $details-&gt;public == '1' ) echo 'checked=&quot;checked&quot;'; ?&gt; /&gt; &lt;?php _e('Yes') ?&gt;
+                                                                        &lt;input type='radio' style='width:20px;' name='blog[public]' value='0' &lt;?php if ( $details-&gt;public == '0' ) echo 'checked=&quot;checked&quot;'; ?&gt; /&gt; &lt;?php _e('No') ?&gt;
</ins><span class="cx">                                                                 &lt;/td&gt;
</span><span class="cx">                                                         &lt;/tr&gt;
</span><span class="cx">                                                         &lt;tr class=&quot;form-field&quot;&gt;
</span><span class="cx">                                                                 &lt;th scope=&quot;row&quot;&gt;&lt;?php _e( 'Archived' ); ?&gt;&lt;/th&gt;
</span><span class="cx">                                                                 &lt;td&gt;
</span><del>-                                                                        &lt;input type='radio' style='width:20px;' name='blog[archived]' value='1' &lt;?php if ( $details['archived'] == '1' ) echo 'checked=&quot;checked&quot;'; ?&gt; /&gt; &lt;?php _e('Yes') ?&gt;
-                                                                        &lt;input type='radio' style='width:20px;' name='blog[archived]' value='0' &lt;?php if ( $details['archived'] == '0' ) echo 'checked=&quot;checked&quot;'; ?&gt; /&gt; &lt;?php _e('No') ?&gt;
</del><ins>+                                                                        &lt;input type='radio' style='width:20px;' name='blog[archived]' value='1' &lt;?php if ( $details-&gt;archived == '1' ) echo 'checked=&quot;checked&quot;'; ?&gt; /&gt; &lt;?php _e('Yes') ?&gt;
+                                                                        &lt;input type='radio' style='width:20px;' name='blog[archived]' value='0' &lt;?php if ( $details-&gt;archived == '0' ) echo 'checked=&quot;checked&quot;'; ?&gt; /&gt; &lt;?php _e('No') ?&gt;
</ins><span class="cx">                                                                 &lt;/td&gt;
</span><span class="cx">                                                         &lt;/tr&gt;
</span><span class="cx">                                                         &lt;tr class=&quot;form-field&quot;&gt;
</span><span class="cx">                                                                 &lt;th scope=&quot;row&quot;&gt;&lt;?php _e( 'Mature' ); ?&gt;&lt;/th&gt;
</span><span class="cx">                                                                 &lt;td&gt;
</span><del>-                                                                        &lt;input type='radio' style='width:20px;' name='blog[mature]' value='1' &lt;?php if ( $details['mature'] == '1' ) echo 'checked=&quot;checked&quot;'; ?&gt; /&gt; &lt;?php _e('Yes') ?&gt;
-                                                                        &lt;input type='radio' style='width:20px;' name='blog[mature]' value='0' &lt;?php if ( $details['mature'] == '0' ) echo 'checked=&quot;checked&quot;'; ?&gt; /&gt; &lt;?php _e('No') ?&gt;
</del><ins>+                                                                        &lt;input type='radio' style='width:20px;' name='blog[mature]' value='1' &lt;?php if ( $details-&gt;mature == '1' ) echo 'checked=&quot;checked&quot;'; ?&gt; /&gt; &lt;?php _e('Yes') ?&gt;
+                                                                        &lt;input type='radio' style='width:20px;' name='blog[mature]' value='0' &lt;?php if ( $details-&gt;mature == '0' ) echo 'checked=&quot;checked&quot;'; ?&gt; /&gt; &lt;?php _e('No') ?&gt;
</ins><span class="cx">                                                                 &lt;/td&gt;
</span><span class="cx">                                                         &lt;/tr&gt;
</span><span class="cx">                                                         &lt;tr class=&quot;form-field&quot;&gt;
</span><span class="cx">                                                                 &lt;th scope=&quot;row&quot;&gt;&lt;?php _e( 'Spam' ); ?&gt;&lt;/th&gt;
</span><span class="cx">                                                                 &lt;td&gt;
</span><del>-                                                                        &lt;input type='radio' style='width:20px;' name='blog[spam]' value='1' &lt;?php if ( $details['spam'] == '1' ) echo 'checked=&quot;checked&quot;'; ?&gt; /&gt; &lt;?php _e('Yes') ?&gt;
-                                                                        &lt;input type='radio' style='width:20px;' name='blog[spam]' value='0' &lt;?php if ( $details['spam'] == '0' ) echo 'checked=&quot;checked&quot;'; ?&gt; /&gt; &lt;?php _e('No') ?&gt;
</del><ins>+                                                                        &lt;input type='radio' style='width:20px;' name='blog[spam]' value='1' &lt;?php if ( $details-&gt;spam == '1' ) echo 'checked=&quot;checked&quot;'; ?&gt; /&gt; &lt;?php _e('Yes') ?&gt;
+                                                                        &lt;input type='radio' style='width:20px;' name='blog[spam]' value='0' &lt;?php if ( $details-&gt;spam == '0' ) echo 'checked=&quot;checked&quot;'; ?&gt; /&gt; &lt;?php _e('No') ?&gt;
</ins><span class="cx">                                                                 &lt;/td&gt;
</span><span class="cx">                                                         &lt;/tr&gt;
</span><span class="cx">                                                         &lt;tr class=&quot;form-field&quot;&gt;
</span><span class="cx">                                                                 &lt;th scope=&quot;row&quot;&gt;&lt;?php _e( 'Deleted' ); ?&gt;&lt;/th&gt;
</span><span class="cx">                                                                 &lt;td&gt;
</span><del>-                                                                        &lt;input type='radio' style='width:20px;' name='blog[deleted]' value='1' &lt;?php if ( $details['deleted'] == '1' ) echo 'checked=&quot;checked&quot;'; ?&gt; /&gt; &lt;?php _e('Yes') ?&gt;
-                                                                        &lt;input type='radio' style='width:20px;' name='blog[deleted]' value='0' &lt;?php if ( $details['deleted'] == '0' ) echo 'checked=&quot;checked&quot;'; ?&gt; /&gt; &lt;?php _e('No') ?&gt;
</del><ins>+                                                                        &lt;input type='radio' style='width:20px;' name='blog[deleted]' value='1' &lt;?php if ( $details-&gt;deleted == '1' ) echo 'checked=&quot;checked&quot;'; ?&gt; /&gt; &lt;?php _e('Yes') ?&gt;
+                                                                        &lt;input type='radio' style='width:20px;' name='blog[deleted]' value='0' &lt;?php if ( $details-&gt;deleted == '0' ) echo 'checked=&quot;checked&quot;'; ?&gt; /&gt; &lt;?php _e('No') ?&gt;
</ins><span class="cx">                                                                 &lt;/td&gt;
</span><span class="cx">                                                         &lt;/tr&gt;
</span><span class="cx">                                                 &lt;/table&gt;
</span><span class="lines">@@ -153,31 +153,30 @@
</span><span class="cx">                                 &lt;table class=&quot;form-table&quot;&gt;
</span><span class="cx">                                                         &lt;?php
</span><span class="cx">                                                         $editblog_default_role = 'subscriber';
</span><del>-                                                        foreach ( $options as $key =&gt; $val ) {
-                                                                if ( $val['option_name'] == 'default_role' ) {
-                                                                        $editblog_default_role = $val['option_value'];
-                                                                }
</del><ins>+                                                        foreach ( $options as $option ) {
+                                                                if ( $option-&gt;option_name == 'default_role' )
+                                                                        $editblog_default_role = $option-&gt;option_value;
</ins><span class="cx">                                                                 $disabled = '';
</span><del>-                                                                if ( is_serialized($val['option_value']) ) {
-                                                                        if ( is_serialized_string($val['option_value']) ) {
-                                                                                $val['option_value'] = wp_specialchars(maybe_unserialize($val['option_value']), 'single');
</del><ins>+                                                                if ( is_serialized($option-&gt;option_value) ) {
+                                                                        if ( is_serialized_string($option-&gt;option_value) ) {
+                                                                                $option-&gt;option_value = wp_specialchars(maybe_unserialize($option-&gt;option_value), 'single');
</ins><span class="cx">                                                                         } else {
</span><del>-                                                                                $val['option_value'] = &quot;SERIALIZED DATA&quot;;
</del><ins>+                                                                                $option-&gt;option_value = &quot;SERIALIZED DATA&quot;;
</ins><span class="cx">                                                                                 $disabled = ' disabled=&quot;disabled&quot;';
</span><span class="cx">                                                                         }
</span><span class="cx">                                                                 }
</span><del>-                                                                if ( stristr($val['option_value'], &quot;\r&quot;) || stristr($val['option_value'], &quot;\n&quot;) || stristr($val['option_value'], &quot;\r\n&quot;) ) {
</del><ins>+                                                                if ( stristr($option-&gt;option_value, &quot;\r&quot;) || stristr($option-&gt;option_value, &quot;\n&quot;) || stristr($option-&gt;option_value, &quot;\r\n&quot;) ) {
</ins><span class="cx">                                                                 ?&gt;
</span><span class="cx">                                                                         &lt;tr class=&quot;form-field&quot;&gt;
</span><del>-                                                                                &lt;th scope=&quot;row&quot;&gt;&lt;?php echo ucwords( str_replace( &quot;_&quot;, &quot; &quot;, $val['option_name'] ) ) ?&gt;&lt;/th&gt;
-                                                                                &lt;td&gt;&lt;textarea rows=&quot;5&quot; cols=&quot;40&quot; name=&quot;option[&lt;?php echo $val['option_name'] ?&gt;]&quot; type=&quot;text&quot; id=&quot;&lt;?php echo $val['option_name'] ?&gt;&quot;&lt;?php echo $disabled ?&gt;&gt;&lt;?php echo wp_specialchars( stripslashes( $val['option_value'] ), 1 ) ?&gt;&lt;/textarea&gt;&lt;/td&gt;
</del><ins>+                                                                                &lt;th scope=&quot;row&quot;&gt;&lt;?php echo ucwords( str_replace( &quot;_&quot;, &quot; &quot;, $option-&gt;option_name ) ) ?&gt;&lt;/th&gt;
+                                                                                &lt;td&gt;&lt;textarea rows=&quot;5&quot; cols=&quot;40&quot; name=&quot;option[&lt;?php echo esc_attr($option-&gt;option_name) ?&gt;]&quot; type=&quot;text&quot; id=&quot;&lt;?php echo esc_attr($option-&gt;option_name) ?&gt;&quot;&lt;?php echo $disabled ?&gt;&gt;&lt;?php echo esc_html( $option-&gt;option_value ) ?&gt;&lt;/textarea&gt;&lt;/td&gt;
</ins><span class="cx">                                                                         &lt;/tr&gt;
</span><span class="cx">                                                                 &lt;?php
</span><span class="cx">                                                                 } else {
</span><span class="cx">                                                                 ?&gt;
</span><span class="cx">                                                                         &lt;tr class=&quot;form-field&quot;&gt;
</span><del>-                                                                                &lt;th scope=&quot;row&quot;&gt;&lt;?php echo ucwords( str_replace( &quot;_&quot;, &quot; &quot;, $val['option_name'] ) ) ?&gt;&lt;/th&gt;
-                                                                                &lt;td&gt;&lt;input name=&quot;option[&lt;?php echo $val['option_name'] ?&gt;]&quot; type=&quot;text&quot; id=&quot;&lt;?php echo $val['option_name'] ?&gt;&quot; value=&quot;&lt;?php echo esc_attr( stripslashes( $val['option_value'] ), 1 ) ?&gt;&quot; size=&quot;40&quot; &lt;?php echo $disabled ?&gt; /&gt;&lt;/td&gt;
</del><ins>+                                                                                &lt;th scope=&quot;row&quot;&gt;&lt;?php echo ucwords( str_replace( &quot;_&quot;, &quot; &quot;, $option-&gt;option_name ) ) ?&gt;&lt;/th&gt;
+                                                                                &lt;td&gt;&lt;input name=&quot;option[&lt;?php echo esc_attr($option-&gt;option_name) ?&gt;]&quot; type=&quot;text&quot; id=&quot;&lt;?php echo esc_attr($option-&gt;option_name) ?&gt;&quot; value=&quot;&lt;?php echo esc_attr( $option-&gt;option_value ) ?&gt;&quot; size=&quot;40&quot; &lt;?php echo $disabled ?&gt; /&gt;&lt;/td&gt;
</ins><span class="cx">                                                                         &lt;/tr&gt;
</span><span class="cx">                                                                 &lt;?php
</span><span class="cx">                                                                 }
</span><span class="lines">@@ -194,17 +193,16 @@
</span><span class="cx">                                         $themes = get_themes();
</span><span class="cx">                                         $blog_allowed_themes = wpmu_get_blog_allowedthemes( $id );
</span><span class="cx">                                         $allowed_themes = get_site_option( &quot;allowedthemes&quot; );
</span><del>-                                        if ( $allowed_themes == false ) {
</del><ins>+                                        if ( ! $allowed_themes )
</ins><span class="cx">                                                 $allowed_themes = array_keys( $themes );
</span><del>-                                        }
</del><span class="cx">                                         $out = '';
</span><del>-                                        foreach( $themes as $key =&gt; $theme ) {
</del><ins>+                                        foreach ( $themes as $key =&gt; $theme ) {
</ins><span class="cx">                                                 $theme_key = wp_specialchars( $theme['Stylesheet'] );
</span><del>-                                                if ( isset($allowed_themes[$theme_key] ) == false ) {
</del><ins>+                                                if ( ! isset($allowed_themes[$theme_key] ) ) {
</ins><span class="cx">                                                         $checked = ( isset($blog_allowed_themes[ $theme_key ]) ) ? 'checked=&quot;checked&quot;' : '';
</span><span class="cx">                                                         $out .= '&lt;tr class=&quot;form-field form-required&quot;&gt;
</span><del>-                                                                        &lt;th title=&quot;'.htmlspecialchars( $theme[&quot;Description&quot;] ).'&quot; scope=&quot;row&quot;&gt;'.$key.'&lt;/th&gt;
-                                                                        &lt;td&gt;&lt;input name=&quot;theme['.$theme_key.']&quot; type=&quot;checkbox&quot; style=&quot;width:20px;&quot; value=&quot;on&quot; '.$checked.'/&gt;' . __( 'Active' ) . '&lt;/td&gt;
</del><ins>+                                                                        &lt;th title=&quot;' . esc_attr( $theme[&quot;Description&quot;] ).'&quot; scope=&quot;row&quot;&gt;' . esc_html($key) . '&lt;/th&gt;
+                                                                        &lt;td&gt;&lt;input name=&quot;theme[' . esc_attr($theme_key) . ']&quot; type=&quot;checkbox&quot; style=&quot;width:20px;&quot; value=&quot;on&quot; '.$checked.'/&gt;' . __( 'Active' ) . '&lt;/td&gt;
</ins><span class="cx">                                                                 &lt;/tr&gt;';
</span><span class="cx">                                                 }
</span><span class="cx">                                         }
</span><span class="lines">@@ -212,10 +210,10 @@
</span><span class="cx">                                         if ( $out != '' ) {
</span><span class="cx">                         ?&gt;
</span><span class="cx">                         &lt;div id=&quot;blogedit_blogthemes&quot; class=&quot;postbox&quot;&gt;
</span><del>-                        &lt;h3 class='hndle'&gt;&lt;span&gt;&lt;?php _e('Blog Themes'); ?&gt;&lt;/span&gt;&lt;/h3&gt;
</del><ins>+                        &lt;h3 class='hndle'&gt;&lt;span&gt;&lt;?php esc_html_e('Blog Themes'); ?&gt;&lt;/span&gt;&lt;/h3&gt;
</ins><span class="cx">                         &lt;div class=&quot;inside&quot;&gt;
</span><span class="cx">                                 &lt;table class=&quot;form-table&quot;&gt;
</span><del>-                                        &lt;tr&gt;&lt;th style=&quot;font-weight:bold;&quot;&gt;&lt;?php _e('Theme'); ?&gt;&lt;/th&gt;&lt;/tr&gt;
</del><ins>+                                        &lt;tr&gt;&lt;th style=&quot;font-weight:bold;&quot;&gt;&lt;?php esc_html_e('Theme'); ?&gt;&lt;/th&gt;&lt;/tr&gt;
</ins><span class="cx">                                         &lt;?php echo $out; ?&gt;
</span><span class="cx">                                 &lt;/table&gt;
</span><span class="cx">                                 &lt;p class=&quot;submit&quot; style=&quot;margin:-15px 0 -5px 230px;&quot;&gt;&lt;input type=&quot;submit&quot; name=&quot;Submit&quot; value=&quot;&lt;?php esc_attr_e('Update Options') ?&gt;&quot; /&gt;&lt;/p&gt;
</span><span class="lines">@@ -241,7 +239,7 @@
</span><span class="cx">                                                                 ?&gt;
</span><span class="cx">                                                                 &lt;td&gt;
</span><span class="cx">                                                                         &lt;select name=&quot;role[&lt;?php echo $val-&gt;user_id ?&gt;]&quot; id=&quot;new_role&quot;&gt;&lt;?php
</span><del>-                                                                                foreach( $editblog_roles as $role =&gt; $role_assoc ){
</del><ins>+                                                                                foreach ( $editblog_roles as $role =&gt; $role_assoc ){
</ins><span class="cx">                                                                                         $name = translate_with_context($role_assoc['name']);
</span><span class="cx">                                                                                         $selected = ( $role == $existing_role ) ? 'selected=&quot;selected&quot;' : '';
</span><span class="cx">                                                                                         echo &quot;&lt;option {$selected} value=\&quot;&quot; . esc_attr($role) . &quot;\&quot;&gt;{$name}&lt;/option&gt;&quot;;
</span><span class="lines">@@ -250,10 +248,10 @@
</span><span class="cx">                                                                         &lt;/select&gt;
</span><span class="cx">                                                                 &lt;/td&gt;
</span><span class="cx">                                                                 &lt;td&gt;
</span><del>-                                                                                &lt;input type='text' name='user_password[&lt;?php echo $val-&gt;user_id ?&gt;]' /&gt;
</del><ins>+                                                                                &lt;input type='text' name='user_password[&lt;?php echo esc_attr($val-&gt;user_id) ?&gt;]' /&gt;
</ins><span class="cx">                                                                 &lt;/td&gt;
</span><span class="cx">                                                                 &lt;?php
</span><del>-                                                                echo '&lt;td&gt;&lt;input title=&quot;' . __('Click to remove user') . '&quot; type=&quot;checkbox&quot; name=&quot;blogusers[' . $val-&gt;user_id . ']&quot; /&gt;&lt;/td&gt;';
</del><ins>+                                                                echo '&lt;td&gt;&lt;input title=&quot;' . __('Click to remove user') . '&quot; type=&quot;checkbox&quot; name=&quot;blogusers[' . esc_attr($val-&gt;user_id) . ']&quot; /&gt;&lt;/td&gt;';
</ins><span class="cx">                                                         } else {
</span><span class="cx">                                                                 echo &quot;&lt;td&gt;&lt;strong&gt;&quot; . __ ('N/A') . &quot;&lt;/strong&gt;&lt;/td&gt;&lt;td&gt;&lt;strong&gt;&quot; . __ ('N/A') . &quot;&lt;/strong&gt;&lt;/td&gt;&lt;td&gt;&lt;strong&gt;&quot; . __('N/A') . &quot;&lt;/strong&gt;&lt;/td&gt;&quot;;
</span><span class="cx">                                                         }
</span><span class="lines">@@ -448,22 +446,35 @@
</span><span class="cx">                         &lt;?php
</span><span class="cx">                         if ( $blog_list ) {
</span><span class="cx">                                 $bgcolor = $class = '';
</span><del>-                                $status_list = array( &quot;archived&quot; =&gt; &quot;#fee&quot;, &quot;spam&quot; =&gt; &quot;#faa&quot;, &quot;deleted&quot; =&gt; &quot;#f55&quot; );
</del><ins>+                                $status_list = array( 'archived' =&gt; array( '#fee', __('Archived') ), 'spam' =&gt; array( '#faa', __('Spam') ), 'deleted' =&gt; array( '#f55', __('Deleted') ) );
</ins><span class="cx">                                 foreach ( $blog_list as $blog ) {
</span><span class="cx">                                         $class = ('alternate' == $class) ? '' : 'alternate';
</span><span class="cx">                                         reset( $status_list );
</span><span class="cx"> 
</span><del>-                                        $bgcolour = &quot;&quot;;
</del><ins>+                                        $bgcolour = '';
+                                        $blog_states = array();
</ins><span class="cx">                                         foreach ( $status_list as $status =&gt; $col ) {
</span><span class="cx">                                                 if ( get_blog_status( $blog['blog_id'], $status ) == 1 ) {
</span><del>-                                                        $bgcolour = &quot;style='background: $col'&quot;;
</del><ins>+                                                        $bgcolour = &quot;style='background: {$col[0]}'&quot;;
+                                                        $blog_states[] = $col[1];
</ins><span class="cx">                                                 }
</span><span class="cx">                                         }
</span><ins>+                                        $blog_state = '';
+                                        if ( ! empty($blog_states) ) {
+                                                $state_count = count($blog_states);
+                                                $i = 0;
+                                                $blog_state .= ' - ';
+                                                foreach ( $blog_states as $state ) {
+                                                        ++$i;
+                                                        ( $i == $state_count ) ? $sep = '' : $sep = ', ';
+                                                        $blog_state .= &quot;&lt;span class='post-state'&gt;$state$sep&lt;/span&gt;&quot;;
+                                                }
+                                        }
</ins><span class="cx">                                         echo &quot;&lt;tr $bgcolour class='$class'&gt;&quot;;
</span><span class="cx"> 
</span><span class="cx">                                         $blogname = ( is_subdomain_install() ) ? str_replace('.'.$current_site-&gt;domain, '', $blog['domain']) : $blog['path'];
</span><span class="cx">                                         foreach ( $posts_columns as $column_name=&gt;$column_display_name ) {
</span><del>-                                                switch($column_name) {
</del><ins>+                                                switch ( $column_name ) {
</ins><span class="cx">                                                         case 'id': ?&gt;
</span><span class="cx">                                                                 &lt;th scope=&quot;row&quot; class=&quot;check-column&quot;&gt;
</span><span class="cx">                                                                         &lt;input type='checkbox' id='blog_&lt;?php echo $blog['blog_id'] ?&gt;' name='allblogs[]' value='&lt;?php echo esc_attr($blog['blog_id']) ?&gt;' /&gt;
</span><span class="lines">@@ -476,36 +487,36 @@
</span><span class="cx"> 
</span><span class="cx">                                                         case 'blogname': ?&gt;
</span><span class="cx">                                                                 &lt;td valign=&quot;top&quot;&gt;
</span><del>-                                                                        &lt;a href=&quot;ms-sites.php?action=editblog&amp;amp;id=&lt;?php echo $blog['blog_id'] ?&gt;&quot; class=&quot;edit&quot;&gt;&lt;?php echo $blogname; ?&gt;&lt;/a&gt;
</del><ins>+                                                                        &lt;a href=&quot;ms-sites.php?action=editblog&amp;amp;id=&lt;?php echo $blog['blog_id'] ?&gt;&quot; class=&quot;edit&quot;&gt;&lt;?php echo $blogname; echo $blog_state?&gt;&lt;/a&gt;
</ins><span class="cx">                                                                         &lt;br/&gt;
</span><span class="cx">                                                                         &lt;?php
</span><del>-                                                                        $controlActions        = array();
-                                                                        $controlActions[]        = '&lt;a href=&quot;ms-sites.php?action=editblog&amp;amp;id=' . $blog['blog_id'] . '&quot; class=&quot;edit&quot;&gt;' . __('Edit') . '&lt;/a&gt;';
-                                                                        $controlActions[]        = &quot;&lt;a href='{$protocol}{$blog['domain']}{$blog['path']}wp-admin/' class='edit'&gt;&quot; . __('Backend') . '&lt;/a&gt;';
</del><ins>+                                                                        $actions        = array();
+                                                                        $actions[]        = '&lt;a href=&quot;ms-sites.php?action=editblog&amp;amp;id=' . $blog['blog_id'] . '&quot; class=&quot;edit&quot;&gt;' . __('Edit') . '&lt;/a&gt;';
+                                                                        $actions[]        = &quot;&lt;a href='{$protocol}{$blog['domain']}{$blog['path']}wp-admin/' class='edit'&gt;&quot; . __('Backend') . '&lt;/a&gt;';
</ins><span class="cx"> 
</span><span class="cx">                                                                         if ( get_blog_status( $blog['blog_id'], &quot;deleted&quot; ) == '1' )
</span><del>-                                                                                $controlActions[]        = '&lt;a class=&quot;delete&quot; href=&quot;ms-edit.php?action=confirm&amp;amp;action2=activateblog&amp;amp;ref=' . urlencode( $_SERVER['REQUEST_URI'] ) . '&amp;amp;id=' . $blog['blog_id'] . '&amp;amp;msg=' . urlencode( sprintf( __( &quot;You are about to activate the blog %s&quot; ), $blogname ) ) . '&quot;&gt;' . __('Activate') . '&lt;/a&gt;';
</del><ins>+                                                                                $actions[]        = '&lt;a class=&quot;delete&quot; href=&quot;ms-edit.php?action=confirm&amp;amp;action2=activateblog&amp;amp;ref=' . urlencode( $_SERVER['REQUEST_URI'] ) . '&amp;amp;id=' . $blog['blog_id'] . '&amp;amp;msg=' . urlencode( sprintf( __( &quot;You are about to activate the blog %s&quot; ), $blogname ) ) . '&quot;&gt;' . __('Activate') . '&lt;/a&gt;';
</ins><span class="cx">                                                                         else
</span><del>-                                                                                $controlActions[]        = '&lt;a class=&quot;delete&quot; href=&quot;ms-edit.php?action=confirm&amp;amp;action2=deactivateblog&amp;amp;ref=' . urlencode( $_SERVER['REQUEST_URI'] ) . '&amp;amp;id=' . $blog['blog_id'] . '&amp;amp;msg=' . urlencode( sprintf( __( &quot;You are about to deactivate the blog %s&quot; ), $blogname ) ) . '&quot;&gt;' . __('Deactivate') . '&lt;/a&gt;';
</del><ins>+                                                                                $actions[]        = '&lt;a class=&quot;delete&quot; href=&quot;ms-edit.php?action=confirm&amp;amp;action2=deactivateblog&amp;amp;ref=' . urlencode( $_SERVER['REQUEST_URI'] ) . '&amp;amp;id=' . $blog['blog_id'] . '&amp;amp;msg=' . urlencode( sprintf( __( &quot;You are about to deactivate the blog %s&quot; ), $blogname ) ) . '&quot;&gt;' . __('Deactivate') . '&lt;/a&gt;';
</ins><span class="cx"> 
</span><span class="cx">                                                                         if ( get_blog_status( $blog['blog_id'], &quot;archived&quot; ) == '1' )
</span><del>-                                                                                $controlActions[]        = '&lt;a class=&quot;delete&quot; href=&quot;ms-edit.php?action=confirm&amp;amp;action2=unarchiveblog&amp;amp;id=' .  $blog['blog_id'] . '&amp;amp;msg=' . urlencode( sprintf( __( &quot;You are about to unarchive the blog %s&quot; ), $blogname ) ) . '&quot;&gt;' . __('Unarchive') . '&lt;/a&gt;';
</del><ins>+                                                                                $actions[]        = '&lt;a class=&quot;delete&quot; href=&quot;ms-edit.php?action=confirm&amp;amp;action2=unarchiveblog&amp;amp;id=' .  $blog['blog_id'] . '&amp;amp;msg=' . urlencode( sprintf( __( &quot;You are about to unarchive the blog %s&quot; ), $blogname ) ) . '&quot;&gt;' . __('Unarchive') . '&lt;/a&gt;';
</ins><span class="cx">                                                                         else
</span><del>-                                                                                $controlActions[]        = '&lt;a class=&quot;delete&quot; href=&quot;ms-edit.php?action=confirm&amp;amp;action2=archiveblog&amp;amp;id=' . $blog['blog_id'] . '&amp;amp;msg=' . urlencode( sprintf( __( &quot;You are about to archive the blog %s&quot; ), $blogname ) ) . '&quot;&gt;' . __('Archive') . '&lt;/a&gt;';
</del><ins>+                                                                                $actions[]        = '&lt;a class=&quot;delete&quot; href=&quot;ms-edit.php?action=confirm&amp;amp;action2=archiveblog&amp;amp;id=' . $blog['blog_id'] . '&amp;amp;msg=' . urlencode( sprintf( __( &quot;You are about to archive the blog %s&quot; ), $blogname ) ) . '&quot;&gt;' . __('Archive') . '&lt;/a&gt;';
</ins><span class="cx"> 
</span><span class="cx">                                                                         if ( get_blog_status( $blog['blog_id'], &quot;spam&quot; ) == '1' )
</span><del>-                                                                                $controlActions[]        = '&lt;a class=&quot;delete&quot; href=&quot;ms-edit.php?action=confirm&amp;amp;action2=unspamblog&amp;amp;id=' . $blog['blog_id'] . '&amp;amp;msg=' . urlencode( sprintf( __( &quot;You are about to unspam the blog %s&quot; ), $blogname ) ) . '&quot;&gt;' . __('Not Spam') . '&lt;/a&gt;';
</del><ins>+                                                                                $actions[]        = '&lt;a class=&quot;delete&quot; href=&quot;ms-edit.php?action=confirm&amp;amp;action2=unspamblog&amp;amp;id=' . $blog['blog_id'] . '&amp;amp;msg=' . urlencode( sprintf( __( &quot;You are about to unspam the blog %s&quot; ), $blogname ) ) . '&quot;&gt;' . __('Not Spam') . '&lt;/a&gt;';
</ins><span class="cx">                                                                         else
</span><del>-                                                                                $controlActions[]        = '&lt;a class=&quot;delete&quot; href=&quot;ms-edit.php?action=confirm&amp;amp;action2=spamblog&amp;amp;id=' . $blog['blog_id'] . '&amp;amp;msg=' . urlencode( sprintf( __( &quot;You are about to mark the blog %s as spam&quot; ), $blogname ) ) . '&quot;&gt;' . __(&quot;Spam&quot;) . '&lt;/a&gt;';
</del><ins>+                                                                                $actions[]        = '&lt;a class=&quot;delete&quot; href=&quot;ms-edit.php?action=confirm&amp;amp;action2=spamblog&amp;amp;id=' . $blog['blog_id'] . '&amp;amp;msg=' . urlencode( sprintf( __( &quot;You are about to mark the blog %s as spam&quot; ), $blogname ) ) . '&quot;&gt;' . __(&quot;Spam&quot;) . '&lt;/a&gt;';
</ins><span class="cx"> 
</span><del>-                                                                        $controlActions[]        = '&lt;a class=&quot;delete&quot; href=&quot;ms-edit.php?action=confirm&amp;amp;action2=deleteblog&amp;amp;id=' . $blog['blog_id'] . '&amp;amp;msg=' . urlencode( sprintf( __( &quot;You are about to delete the blog %s&quot; ), $blogname ) ) . '&quot;&gt;' . __(&quot;Delete&quot;) . '&lt;/a&gt;';
</del><ins>+                                                                        $actions[]        = '&lt;a class=&quot;delete&quot; href=&quot;ms-edit.php?action=confirm&amp;amp;action2=deleteblog&amp;amp;id=' . $blog['blog_id'] . '&amp;amp;msg=' . urlencode( sprintf( __( &quot;You are about to delete the blog %s&quot; ), $blogname ) ) . '&quot;&gt;' . __(&quot;Delete&quot;) . '&lt;/a&gt;';
</ins><span class="cx"> 
</span><del>-                                                                        $controlActions[]        = &quot;&lt;a href='http://{$blog['domain']}{$blog['path']}' rel='permalink'&gt;&quot; . __('Visit') . '&lt;/a&gt;';
</del><ins>+                                                                        $actions[]        = &quot;&lt;a href='http://{$blog['domain']}{$blog['path']}' rel='permalink'&gt;&quot; . __('Visit') . '&lt;/a&gt;';
</ins><span class="cx">                                                                         ?&gt;
</span><span class="cx"> 
</span><del>-                                                                        &lt;?php if (count($controlActions)) : ?&gt;
</del><ins>+                                                                        &lt;?php if ( count($actions) ) : ?&gt;
</ins><span class="cx">                                                                         &lt;div class=&quot;row-actions&quot;&gt;
</span><del>-                                                                                &lt;?php echo implode(' | ', $controlActions); ?&gt;
</del><ins>+                                                                                &lt;?php echo implode(' | ', $actions); ?&gt;
</ins><span class="cx">                                                                         &lt;/div&gt;
</span><span class="cx">                                                                         &lt;?php endif; ?&gt;
</span><span class="cx">                                                                 &lt;/td&gt;
</span><span class="lines">@@ -535,12 +546,10 @@
</span><span class="cx">                                                                                         $blogusers = array_slice( $blogusers, 0, 5 );
</span><span class="cx">                                                                                         $blogusers_warning = __( 'Only showing first 5 users.' ) . ' &lt;a href=&quot;' . $protocol . $blog[ 'domain' ] . $blog[ 'path' ] . 'wp-admin/users.php&quot;&gt;' . __( 'More' ) . '&lt;/a&gt;';
</span><span class="cx">                                                                                 }
</span><del>-                                                                                foreach ( $blogusers as $key =&gt; $val ) {
</del><ins>+                                                                                foreach ( $blogusers as $key =&gt; $val )
</ins><span class="cx">                                                                                         echo '&lt;a href=&quot;user-edit.php?user_id=' . $val-&gt;user_id . '&quot;&gt;' . $val-&gt;user_login . '&lt;/a&gt; ('.$val-&gt;user_email.')&lt;br /&gt;';
</span><del>-                                                                                }
-                                                                                if ( $blogusers_warning != '' ) {
</del><ins>+                                                                                if ( $blogusers_warning != '' )
</ins><span class="cx">                                                                                         echo '&lt;strong&gt;' . $blogusers_warning . '&lt;/strong&gt;&lt;br /&gt;';
</span><del>-                                                                                }
</del><span class="cx">                                                                         }
</span><span class="cx">                                                                         ?&gt;
</span><span class="cx">                                                                 &lt;/td&gt;
</span></span></pre>
</div>
</div>

</body>
</html>