<!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>[12769] trunk/wp-admin: add multisite theme admin, See #11644</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/12769">12769</a></dd>
<dt>Author</dt> <dd>wpmuguru</dd>
<dt>Date</dt> <dd>2010-01-19 20:03:11 +0000 (Tue, 19 Jan 2010)</dd>
</dl>

<h3>Log Message</h3>
<pre>add multisite theme admin, See <a href="http://trac.wordpress.org/ticket/11644">#11644</a></pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadminincludesschemaphp">trunk/wp-admin/includes/schema.php</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkwpadminmsthemesphp">trunk/wp-admin/ms-themes.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadminincludesschemaphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/schema.php (12768 => 12769)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/schema.php        2010-01-19 19:45:44 UTC (rev 12768)
+++ trunk/wp-admin/includes/schema.php        2010-01-19 20:03:11 UTC (rev 12769)
</span><span class="lines">@@ -640,9 +640,9 @@
</span><span class="cx">         $template = get_option( 'template' );
</span><span class="cx">         $stylesheet = get_option( 'stylesheet' );
</span><span class="cx">         if ( $template != $stylesheet )
</span><del>-                $allowed_themes = array( $template, $stylesheet );
</del><ins>+                $allowed_themes = array( $template =&gt; true, $stylesheet =&gt; true );
</ins><span class="cx">         else
</span><del>-                $allowed_themes = array( $stylesheet );
</del><ins>+                $allowed_themes = array( $stylesheet =&gt; true );
</ins><span class="cx"> 
</span><span class="cx">         $wpdb-&gt;query( $wpdb-&gt;prepare( &quot;INSERT INTO &quot;.$wpdb-&gt;sitemeta.&quot; (meta_id, site_id, meta_key, meta_value) VALUES (NULL, %d, 'site_name', %s)&quot;, $network_id, $site_name ) );
</span><span class="cx">         $wpdb-&gt;query( $wpdb-&gt;prepare( &quot;INSERT INTO &quot;.$wpdb-&gt;sitemeta.&quot; (meta_id, site_id, meta_key, meta_value) VALUES (NULL, %d, 'admin_email', %s)&quot;, $network_id, $site_user-&gt;user_email ) );
</span></span></pre></div>
<a id="trunkwpadminmsthemesphp"></a>
<div class="addfile"><h4>Added: trunk/wp-admin/ms-themes.php (0 => 12769)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/ms-themes.php                                (rev 0)
+++ trunk/wp-admin/ms-themes.php        2010-01-19 20:03:11 UTC (rev 12769)
</span><span class="lines">@@ -0,0 +1,77 @@
</span><ins>+&lt;?php
+require_once('admin.php');
+
+$title = __('WordPress &amp;rsaquo; Admin &amp;rsaquo; Themes');
+$parent_file = 'ms-admin.php';
+require_once('admin-header.php');
+
+if( is_super_admin() == false ) {
+        wp_die( __('You do not have permission to access this page.') );
+}
+
+if (isset($_GET['updated'])) {
+        ?&gt;
+        &lt;div id=&quot;message&quot; class=&quot;updated fade&quot;&gt;&lt;p&gt;&lt;?php _e('Site themes saved.') ?&gt;&lt;/p&gt;&lt;/div&gt;
+        &lt;?php
+}
+
+$themes = get_themes();
+$allowed_themes = get_site_allowed_themes();
+?&gt;
+&lt;div class=&quot;wrap&quot;&gt;
+        &lt;form action='ms-edit.php?action=updatethemes' method='post'&gt;
+                &lt;h2&gt;&lt;?php _e('Site Themes') ?&gt;&lt;/h2&gt;
+                &lt;p&gt;&lt;?php _e('Disable themes site-wide. You can enable themes on a site by site basis.') ?&gt;&lt;/p&gt;
+                &lt;table class=&quot;widefat&quot;&gt;
+                        &lt;thead&gt;
+                                &lt;tr&gt;
+                                        &lt;th style=&quot;width:15%;text-align:center;&quot;&gt;&lt;?php _e('Active') ?&gt;&lt;/th&gt;
+                                        &lt;th style=&quot;width:25%;&quot;&gt;&lt;?php _e('Theme') ?&gt;&lt;/th&gt;
+                                        &lt;th style=&quot;width:10%;&quot;&gt;&lt;?php _e('Version') ?&gt;&lt;/th&gt;
+                                        &lt;th style=&quot;width:60%;&quot;&gt;&lt;?php _e('Description') ?&gt;&lt;/th&gt;
+                                &lt;/tr&gt;
+                        &lt;/thead&gt;
+                        &lt;tbody id=&quot;plugins&quot;&gt;
+                        &lt;?php
+                        $total_theme_count = $activated_themes_count = 0;
+                        foreach( (array) $themes as $key =&gt; $theme ) {
+                                $total_theme_count++;
+                                $theme_key = wp_specialchars($theme['Stylesheet']);
+                                $class = ('alt' == $class) ? '' : 'alt';
+                                $class1 = $enabled = $disabled = '';
+
+                                if( isset( $allowed_themes[ $theme_key ] ) == true ) {
+                                        $enabled = 'checked=&quot;checked&quot; ';
+                                        $activated_themes_count++;
+                                        $class1 = ' active';
+                                } else {
+                                        $disabled = 'checked=&quot;checked&quot; ';
+                                }
+                                ?&gt;
+                                &lt;tr valign=&quot;top&quot; class=&quot;&lt;?php echo $class.$class1; ?&gt;&quot;&gt;
+                                        &lt;td style=&quot;text-align:center;&quot;&gt;
+                                                &lt;label&gt;&lt;input name=&quot;theme[&lt;?php echo $theme_key ?&gt;]&quot; type=&quot;radio&quot; id=&quot;enabled_&lt;?php echo $theme_key ?&gt;&quot; value=&quot;enabled&quot; &lt;?php echo $enabled ?&gt; /&gt; &lt;?php _e('Yes') ?&gt;&lt;/label&gt;
+                                                &amp;nbsp;&amp;nbsp;&amp;nbsp; 
+                                                &lt;label&gt;&lt;input name=&quot;theme[&lt;?php echo $theme_key ?&gt;]&quot; type=&quot;radio&quot; id=&quot;disabled_&lt;?php echo $theme_key ?&gt;&quot; value=&quot;disabled&quot; &lt;?php echo $disabled ?&gt; /&gt; &lt;?php _e('No') ?&gt;&lt;/label&gt;
+                                        &lt;/td&gt;
+                                        &lt;th scope=&quot;row&quot; style=&quot;text-align:left;&quot;&gt;&lt;?php echo $key ?&gt;&lt;/th&gt; 
+                                        &lt;td&gt;&lt;?php echo $theme['Version'] ?&gt;&lt;/td&gt;
+                                        &lt;td&gt;&lt;?php echo $theme['Description'] ?&gt;&lt;/td&gt;
+                                &lt;/tr&gt; 
+                        &lt;?php } ?&gt;
+                        &lt;/tbody&gt;
+                &lt;/table&gt;
+
+                &lt;p class=&quot;submit&quot;&gt;
+                        &lt;input type='submit' value='&lt;?php _e('Update Themes &amp;raquo;') ?&gt;' /&gt;&lt;/p&gt;
+        &lt;/form&gt;
+        
+        &lt;h3&gt;&lt;?php _e('Total')?&gt;&lt;/h3&gt;
+        &lt;p&gt;
+                &lt;?php printf(__('Themes Installed: %d'), $total_theme_count); ?&gt;
+                &lt;br /&gt;
+                &lt;?php printf(__('Themes Activated: %d'), $activated_themes_count); ?&gt;
+        &lt;/p&gt;
+&lt;/div&gt;
+
+&lt;?php include('admin-footer.php'); ?&gt;
</ins></span></pre>
</div>
</div>

</body>
</html>