Changeset 936
- Timestamp:
- 03/26/07 15:46:27 (2 years ago)
- Files:
-
- trunk/wp-admin/admin-db.php (modified) (1 diff)
- trunk/wp-admin/themes.php (modified) (3 diffs)
- trunk/wp-admin/wpmu-blogs.php (modified) (2 diffs)
- trunk/wp-admin/wpmu-edit.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/wp-admin/admin-db.php
r933 r936 628 628 } 629 629 630 function wpmu_get_blog_allowedthemes( $blog_id = 0 ) { 631 $themes = get_themes(); 632 if( $blog_id == 0 ) 633 $blog_allowed_themes = get_option( "allowedthemes" ); 634 else 635 $blog_allowed_themes = get_blog_option( $blog_id, "allowedthemes" ); 636 if( !is_array( $blog_allowed_themes ) || empty( $blog_allowed_themes ) ) { // convert old allowed_themes to new allowedthemes 637 if( $blog_id == 0 ) 638 $blog_allowed_themes = get_option( "allowed_themes" ); 639 else 640 $blog_allowed_themes = get_blog_option( $blog_id, "allowed_themes" ); 641 if( is_array( $blog_allowed_themes ) ) { 642 foreach( $themes as $key => $theme ) { 643 $theme_key = wp_specialchars( $theme[ 'Stylesheet' ] ); 644 if( isset( $blog_allowed_themes[ $key ] ) == true ) { 645 $blog_allowedthemes[ $theme_key ] = 1; 646 } 647 } 648 $blog_allowed_themes = $blog_allowedthemes; 649 if( $blog_id == 0 ) { 650 add_option( "allowedthemes", $blog_allowed_themes ); 651 delete_option( "allowed_themes" ); 652 } else { 653 add_blog_option( $blog_id, "allowedthemes", $blog_allowed_themes ); 654 delete_blog_option( $blog_id, "allowed_themes" ); 655 } 656 } 657 } 658 659 return $blog_allowed_themes; 660 } 661 630 662 ?> trunk/wp-admin/themes.php
r909 r936 4 4 $themes = get_themes(); 5 5 $ct = current_theme_info(); 6 $allowed_themes = get_site_option( "allowed_themes" ); 7 if( $allowed_themes == false ) { 8 $allowed_themes = array(); 9 if( $blog_id != 1 ) 10 unset( $allowed_themes[ "WordPress MU Home Default" ] ); 11 } 12 $blog_allowed_themes = get_option( "allowed_themes" ); 6 $allowed_themes = get_site_option( "allowedthemes" ); 7 if( $allowed_themes == false ) 8 $allowed_themes = array(); 13 9 10 $blog_allowed_themes = wpmu_get_blog_allowedthemes(); 14 11 if( is_array( $blog_allowed_themes ) ) 15 12 $allowed_themes = array_merge( $allowed_themes, $blog_allowed_themes ); 13 if( $blog_id != 1 ) 14 unset( $allowed_themes[ "h3" ] ); 16 15 17 if( isset( $allowed_themes[ $ct->title ] ) == false ) {18 $allowed_themes[ $ct->title] = true;19 } 16 if( isset( $allowed_themes[ wp_specialchars( $ct->stylesheet ) ] ) == false ) 17 $allowed_themes[ wp_specialchars( $ct->stylesheet ) ] = true; 18 20 19 reset( $themes ); 21 while( list( $key, $val ) = each( $themes ) ) { 22 if( isset( $allowed_themes[ $key] ) == false ) {23 unset( $themes[ $key ] );20 foreach( $themes as $key => $theme ) { 21 if( isset( $allowed_themes[ wp_specialchars( $theme[ 'Stylesheet' ] ) ] ) == false ) { 22 unset( $themes[ $key ] ); 24 23 } 25 24 } … … 76 75 </div> 77 76 77 <br style="clear: both" /> 78 78 <h2><?php _e('Available Themes'); ?></h2> 79 79 <?php if ( 1 < count($themes) ) { ?> … … 119 119 ?> 120 120 121 <h2><?php _e('Broken Themes'); ?> </h2>121 <h2><?php _e('Broken Themes'); ?> (Site admin only)</h2> 122 122 <p><?php _e('The following themes are installed but incomplete. Themes must have a stylesheet and a template.'); ?></p> 123 123 trunk/wp-admin/wpmu-blogs.php
r915 r936 14 14 switch( $_GET[ 'action' ] ) { 15 15 case "editblog": 16 $options_table_name = $wpmuBaseTablePrefix . $_GET[ 'id' ] ."_options"; 17 $options = $wpdb->get_results( "SELECT * FROM {$options_table_name} WHERE option_name NOT LIKE 'rss%' AND option_name NOT LIKE '%user_roles'", ARRAY_A ); 18 $details = $wpdb->get_row( "SELECT * FROM {$wpdb->blogs} WHERE blog_id = '{$_GET[ 'id' ]}'", ARRAY_A ); 19 20 print "<h2>" . __('Edit Blog') . "</h2>"; 21 print "<a href='http://{$details[ 'domain' ]}/'>{$details[ 'domain' ]}</a>"; 16 $id = intval( $_GET[ 'id' ] ); 17 $options_table_name = "$wpmuBaseTablePrefix{$id}_options"; 18 $options = $wpdb->get_results( "SELECT * FROM {$options_table_name} WHERE option_name NOT LIKE 'rss%' AND option_name NOT LIKE '%user_roles'", ARRAY_A ); 19 $details = $wpdb->get_row( "SELECT * FROM {$wpdb->blogs} WHERE blog_id = '{$_GET[ 'id' ]}'", ARRAY_A ); 20 21 print "<h2>" . __('Edit Blog') . "</h2>"; 22 print "<a href='http://{$details[ 'domain' ]}/'>{$details[ 'domain' ]}</a>"; 22 23 ?> 23 24 <form name="form1" method="post" action="wpmu-edit.php?action=updateblog"> … … 104 105 <td valign='top'> 105 106 <?php 106 $themes = get_themes(); 107 $query = "SELECT option_value 108 FROM ".$options_table_name." 109 WHERE option_name = 'allowed_themes'"; 110 $blog_allowed_themes = $wpdb->get_var( $query ); 111 if( $blog_allowed_themes != false ) 112 $blog_allowed_themes = unserialize( $blog_allowed_themes ); 113 $allowed_themes = get_site_option( "allowed_themes" ); 114 if( $allowed_themes == false ) { 115 $allowed_themes = array_keys( $themes ); 116 } 117 $out = ''; 118 while( list( $key, $val ) = each( $themes ) ) { 119 if( isset( $allowed_themes[ $key ] ) == false ) { 120 if( isset( $blog_allowed_themes[ $key ] ) == true ) { 121 $checked = 'checked '; 122 } else { 123 $checked = ''; 124 } 125 126 $out .= ' 127 <tr valign="top"> 128 <th title="' . htmlspecialchars( $val[ "Description" ] ) . '" scope="row">'.$key.'</th> 129 <td><input name="theme['.$key.']" type="checkbox" id="'.$key.'" value="on" '.$checked.'/></td> 130 </tr> '; 107 $themes = get_themes(); 108 $blog_allowed_themes = wpmu_get_blog_allowedthemes( $id ); 109 $allowed_themes = get_site_option( "allowedthemes" ); 110 if( $allowed_themes == false ) { 111 $allowed_themes = array_keys( $themes ); 131 112 } 113 $out = ''; 114 foreach( $themes as $key => $theme ) { 115 $theme_key = wp_specialchars( $theme[ 'Stylesheet' ] ); 116 if( isset( $allowed_themes[ $theme_key ] ) == false ) { 117 if( isset( $blog_allowed_themes[ $theme_key ] ) == true ) { 118 $checked = 'checked '; 119 } else { 120 $checked = ''; 121 } 122 123 $out .= ' 124 <tr valign="top"> 125 <th title="' . htmlspecialchars( $theme[ "Description" ] ) . '" scope="row">'.$key.'</th> 126 <td><input name="theme['.$theme_key.']" type="checkbox" id="'.$key.'" value="on" '.$checked.'/></td> 127 </tr> '; 128 } 132 129 } 133 130 if( $out != '' ) { 134 print "<div class='wrap'><h3>" . __('Blog Themes') . "</h3>";135 print '<table width="100%" border="0" cellspacing="2" cellpadding="5" class="editform">';136 print '<tr><th>' . __('Theme') . '</th><th>' . __('Enable') . '</th></tr>';137 print $out;138 print "</table></div>";139 }131 print "<div class='wrap'><h3>" . __('Blog Themes') . "</h3>"; 132 print '<table width="100%" border="0" cellspacing="2" cellpadding="5" class="editform">'; 133 print '<tr><th>' . __('Theme') . '</th><th>' . __('Enable') . '</th></tr>'; 134 print $out; 135 print "</table></div>"; 136 } 140 137 $blogusers = get_users_of_blog( $_GET[ 'id' ] ); 141 138 print '<div class="wrap"><h3>' . __('Blog Users') . '</h3>'; trunk/wp-admin/wpmu-edit.php
r897 r936 159 159 if( is_array( $_POST[ 'theme' ] ) ) { 160 160 $allowed_themes = $_POST[ 'theme' ]; 161 $_POST[ 'option' ][ 'allowed _themes' ] = $_POST[ 'theme' ];161 $_POST[ 'option' ][ 'allowedthemes' ] = $_POST[ 'theme' ]; 162 162 } else { 163 $_POST[ 'option' ][ 'allowed _themes' ] = '';163 $_POST[ 'option' ][ 'allowedthemes' ] = ''; 164 164 } 165 165 if( is_array( $_POST[ 'option' ] ) ) { … … 383 383 break; 384 384 case "updatethemes": 385 if( is_site_admin() == false ) {386 die( __('<p>You do not have permission to access this page.</p>') ); 387 } 385 if( is_site_admin() == false ) 386 die( __('<p>You do not have permission to access this page.</p>') ); 387 388 388 if( is_array( $_POST[ 'theme' ] ) ) { 389 $themes = array_flip( array_keys( get_themes() ));389 $themes = get_themes(); 390 390 reset( $themes ); 391 while( list( $key, $val ) = each( $themes ) ) 392 { 393 if( $_POST[ 'theme' ][ addslashes( $key ) ] == 'enabled' ) 394 $allowed_themes[ $key ] = true; 395 } 396 update_site_option( 'allowed_themes', $allowed_themes ); 391 foreach( $themes as $key => $theme ) { 392 if( $_POST[ 'theme' ][ wp_specialchars( $theme[ 'Stylesheet' ] ) ] == 'enabled' ) 393 $allowed_themes[ wp_specialchars( $theme[ 'Stylesheet' ] ) ] = true; 394 } 395 update_site_option( 'allowedthemes', $allowed_themes ); 397 396 } 398 397 wp_redirect( add_query_arg( "updated", "themesupdated", $_SERVER[ 'HTTP_REFERER' ] ) );
