diff options
author | donncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36> | 2007-03-26 15:46:27 +0000 |
---|---|---|
committer | donncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36> | 2007-03-26 15:46:27 +0000 |
commit | b7fe2aee15c1f3ad0673d105624ea81f16f14288 (patch) | |
tree | 7b88927675de4b121e104a958647f10cfe438c10 /wp-admin/admin-db.php | |
parent | 244e8f75fcb7110a9ded532d76e5bcba50bc45f6 (diff) | |
download | wordpress-mu-b7fe2aee15c1f3ad0673d105624ea81f16f14288.tar.gz wordpress-mu-b7fe2aee15c1f3ad0673d105624ea81f16f14288.tar.xz wordpress-mu-b7fe2aee15c1f3ad0673d105624ea81f16f14288.zip |
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
Diffstat (limited to 'wp-admin/admin-db.php')
-rw-r--r-- | wp-admin/admin-db.php | 32 |
1 files changed, 32 insertions, 0 deletions
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; +} + ?> |