From 39c1f5dc435f83a557505ae06c5053b59f8f6187 Mon Sep 17 00:00:00 2001 From: ryan Date: Mon, 8 Nov 2010 19:40:05 +0000 Subject: [PATCH] Use bool for allowed themes. Props PeteMall. see #14897 git-svn-id: http://svn.automattic.com/wordpress/trunk@16241 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/class-wp-ms-themes-list-table.php | 3 ++- wp-admin/network/themes.php | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/wp-admin/includes/class-wp-ms-themes-list-table.php b/wp-admin/includes/class-wp-ms-themes-list-table.php index 76a2b038db..e57697a5c2 100644 --- a/wp-admin/includes/class-wp-ms-themes-list-table.php +++ b/wp-admin/includes/class-wp-ms-themes-list-table.php @@ -58,7 +58,8 @@ class WP_MS_Themes_List_Table extends WP_List_Table { $current = get_site_transient( 'update_themes' ); foreach ( (array) $themes['all'] as $key => $theme ) { - if ( array_key_exists( $theme['Template'], $allowed_themes ) ) { + $theme_key = esc_html( $theme['Stylesheet'] ); + if ( isset( $allowed_themes [ $theme_key ] ) ) { $themes['all'][$key]['enabled'] = true; $themes['enabled'][$key] = $themes['all'][$key]; } diff --git a/wp-admin/network/themes.php b/wp-admin/network/themes.php index 2d11663d45..f64b5addaf 100644 --- a/wp-admin/network/themes.php +++ b/wp-admin/network/themes.php @@ -23,7 +23,7 @@ if ( $action ) { $allowed_themes = get_site_option( 'allowedthemes' ); switch ( $action ) { case 'network-enable': - $allowed_themes[ $_GET['theme'] ] = 1; + $allowed_themes[ $_GET['theme'] ] = true; update_site_option( 'allowedthemes', $allowed_themes ); wp_redirect( wp_get_referer() ); // @todo add_query_arg for update message exit; @@ -41,7 +41,7 @@ if ( $action ) { exit; } foreach( (array) $themes as $theme ) - $allowed_themes[ $theme ] = 1; + $allowed_themes[ $theme ] = true; update_site_option( 'allowedthemes', $allowed_themes ); break; case 'network-disable-selected':