summaryrefslogtreecommitdiffstats
path: root/wp-admin
diff options
context:
space:
mode:
authordonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2007-03-29 09:59:41 +0000
committerdonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2007-03-29 09:59:41 +0000
commita467a5c5984cc78cf369300153b751e4f0558f56 (patch)
tree18f38e2cf940b89770adbf14c2daa3d3d83ca077 /wp-admin
parent9761f43b0336e7b967d2d91d36b76a89a68b2901 (diff)
downloadwordpress-mu-a467a5c5984cc78cf369300153b751e4f0558f56.tar.gz
wordpress-mu-a467a5c5984cc78cf369300153b751e4f0558f56.tar.xz
wordpress-mu-a467a5c5984cc78cf369300153b751e4f0558f56.zip
Fix those pesky themes (fixes #284)
git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@948 7be80a69-a1ef-0310-a953-fb0f7c49ff36
Diffstat (limited to 'wp-admin')
-rw-r--r--wp-admin/admin-db.php21
-rw-r--r--wp-admin/themes.php2
-rw-r--r--wp-admin/wpmu-themes.php15
3 files changed, 30 insertions, 8 deletions
diff --git a/wp-admin/admin-db.php b/wp-admin/admin-db.php
index 6800881..ef3d82f 100644
--- a/wp-admin/admin-db.php
+++ b/wp-admin/admin-db.php
@@ -659,4 +659,25 @@ function wpmu_get_blog_allowedthemes( $blog_id = 0 ) {
return $blog_allowed_themes;
}
+function get_site_allowed_themes() {
+ $themes = get_themes();
+ $allowed_themes = get_site_option( 'allowedthemes' );
+ if( !is_array( $allowed_themes ) || empty( $allowed_themes ) ) {
+ $allowed_themes = get_site_option( "allowed_themes" ); // convert old allowed_themes format
+ if( !is_array( $allowed_themes ) ) {
+ $allowed_themes = array();
+ continue;
+ }
+ foreach( $themes as $key => $theme ) {
+ $theme_key = wp_specialchars( $theme[ 'Stylesheet' ] );
+ if( isset( $allowed_themes[ $key ] ) == true ) {
+ $allowedthemes[ $theme_key ] = 1;
+ }
+ }
+ $allowed_themes = $allowedthemes;
+ }
+
+ return $allowed_themes;
+}
+
?>
diff --git a/wp-admin/themes.php b/wp-admin/themes.php
index ee84375..88a668a 100644
--- a/wp-admin/themes.php
+++ b/wp-admin/themes.php
@@ -3,7 +3,7 @@ require_once('admin.php');
$themes = get_themes();
$ct = current_theme_info();
-$allowed_themes = get_site_option( "allowedthemes" );
+$allowed_themes = get_site_allowed_themes();
if( $allowed_themes == false )
$allowed_themes = array();
diff --git a/wp-admin/wpmu-themes.php b/wp-admin/wpmu-themes.php
index 4c58965..24216ff 100644
--- a/wp-admin/wpmu-themes.php
+++ b/wp-admin/wpmu-themes.php
@@ -10,10 +10,10 @@ if( is_site_admin() == false ) {
if (isset($_GET['updated'])) {
?><div id="message" class="updated fade"><p><?php _e('Options saved.') ?></p></div><?php
}
-print '<div class="wrap">';
$themes = get_themes();
-$allowed_themes = get_site_option( "allowed_themes" );
+$allowed_themes = get_site_allowed_themes();
?>
+<div class="wrap">
<form action='wpmu-edit.php?action=updatethemes' method='POST'>
<h3><?php _e('Site Themes') ?></h3>
@@ -21,11 +21,12 @@ $allowed_themes = get_site_option( "allowed_themes" );
<caption><?php _e('Disable themes site-wide. You can enable themes on a blog by blog basis.') ?></caption>
<tr><th width="100"><?php _e('Active') ?></th><th><?php _e('Theme') ?></th><th><?php _e('Description') ?></th></tr>
<?php
-while( list( $key, $val ) = each( $themes ) ) {
+foreach( $themes as $key => $theme ) {
+ $theme_key = wp_specialchars( $theme[ 'Stylesheet' ] );
$i++;
$enabled = '';
$disabled = '';
- if( isset( $allowed_themes[ $key ] ) == true ) {
+ if( isset( $allowed_themes[ $theme_key ] ) == true ) {
$enabled = 'checked ';
} else {
$disabled = 'checked ';
@@ -34,12 +35,12 @@ while( list( $key, $val ) = each( $themes ) ) {
<tr valign="top" style="<?php if ($i%2) echo 'background: #eee'; ?>">
<td>
-<label><input name="theme[<?php echo $key ?>]" type="radio" id="<?php echo $key ?>" value="disabled" <?php echo $disabled ?>/><?php _e('No') ?></label>
+<label><input name="theme[<?php echo $theme_key ?>]" type="radio" id="<?php echo $theme_key ?>" value="disabled" <?php echo $disabled ?>/><?php _e('No') ?></label>
&nbsp;&nbsp;&nbsp;
-<label><input name="theme[<?php echo $key ?>]" type="radio" id="<?php echo $key ?>" value="enabled" <?php echo $enabled ?>/><?php _e('Yes') ?></label>
+<label><input name="theme[<?php echo $theme_key ?>]" type="radio" id="<?php echo $theme_key ?>" value="enabled" <?php echo $enabled ?>/><?php _e('Yes') ?></label>
</td>
<th scope="row" align="left"><?php echo $key ?></th>
-<td><?php echo $val[ 'Description' ] ?></td>
+<td><?php echo $theme[ 'Description' ] ?></td>
</tr>
<?php
}