From b7fe2aee15c1f3ad0673d105624ea81f16f14288 Mon Sep 17 00:00:00 2001 From: donncha Date: Mon, 26 Mar 2007 15:46:27 +0000 Subject: Index allowed_themes by stylesheet path instead of name. (fixes #284) Important! Make sure you visit and save wp-admin/wpmu-themes.php to update the list! git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@936 7be80a69-a1ef-0310-a953-fb0f7c49ff36 --- wp-admin/admin-db.php | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'wp-admin/admin-db.php') diff --git a/wp-admin/admin-db.php b/wp-admin/admin-db.php index d4df176..6800881 100644 --- a/wp-admin/admin-db.php +++ b/wp-admin/admin-db.php @@ -627,4 +627,36 @@ function wpmu_delete_user($id) { return true; } +function wpmu_get_blog_allowedthemes( $blog_id = 0 ) { + $themes = get_themes(); + if( $blog_id == 0 ) + $blog_allowed_themes = get_option( "allowedthemes" ); + else + $blog_allowed_themes = get_blog_option( $blog_id, "allowedthemes" ); + if( !is_array( $blog_allowed_themes ) || empty( $blog_allowed_themes ) ) { // convert old allowed_themes to new allowedthemes + if( $blog_id == 0 ) + $blog_allowed_themes = get_option( "allowed_themes" ); + else + $blog_allowed_themes = get_blog_option( $blog_id, "allowed_themes" ); + if( is_array( $blog_allowed_themes ) ) { + foreach( $themes as $key => $theme ) { + $theme_key = wp_specialchars( $theme[ 'Stylesheet' ] ); + if( isset( $blog_allowed_themes[ $key ] ) == true ) { + $blog_allowedthemes[ $theme_key ] = 1; + } + } + $blog_allowed_themes = $blog_allowedthemes; + if( $blog_id == 0 ) { + add_option( "allowedthemes", $blog_allowed_themes ); + delete_option( "allowed_themes" ); + } else { + add_blog_option( $blog_id, "allowedthemes", $blog_allowed_themes ); + delete_blog_option( $blog_id, "allowed_themes" ); + } + } + } + + return $blog_allowed_themes; +} + ?> -- cgit