Changeset 948

Show
Ignore:
Timestamp:
03/29/07 09:59:41 (2 years ago)
Author:
donncha
Message:

Fix those pesky themes (fixes #284)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/wp-admin/admin-db.php

    r936 r948  
    660660} 
    661661 
     662function get_site_allowed_themes() { 
     663        $themes = get_themes(); 
     664        $allowed_themes = get_site_option( 'allowedthemes' ); 
     665        if( !is_array( $allowed_themes ) || empty( $allowed_themes ) ) { 
     666                $allowed_themes = get_site_option( "allowed_themes" ); // convert old allowed_themes format 
     667                if( !is_array( $allowed_themes ) ) { 
     668                        $allowed_themes = array(); 
     669                        continue; 
     670                } 
     671                foreach( $themes as $key => $theme ) { 
     672                        $theme_key = wp_specialchars( $theme[ 'Stylesheet' ] ); 
     673                        if( isset( $allowed_themes[ $key ] ) == true ) { 
     674                                $allowedthemes[ $theme_key ] = 1; 
     675                        } 
     676                } 
     677                $allowed_themes = $allowedthemes; 
     678        } 
     679 
     680        return $allowed_themes; 
     681} 
     682 
    662683?> 
  • trunk/wp-admin/themes.php

    r936 r948  
    44$themes = get_themes(); 
    55$ct = current_theme_info(); 
    6 $allowed_themes = get_site_option( "allowedthemes" ); 
     6$allowed_themes = get_site_allowed_themes(); 
    77if( $allowed_themes == false ) 
    88        $allowed_themes = array(); 
  • trunk/wp-admin/wpmu-themes.php

    r688 r948  
    1111        ?><div id="message" class="updated fade"><p><?php _e('Options saved.') ?></p></div><?php 
    1212} 
    13 print '<div class="wrap">'; 
    1413$themes = get_themes(); 
    15 $allowed_themes = get_site_option( "allowed_themes" ); 
     14$allowed_themes = get_site_allowed_themes(); 
    1615?> 
     16<div class="wrap"> 
    1717 
    1818<form action='wpmu-edit.php?action=updatethemes' method='POST'> 
     
    2222<tr><th width="100"><?php _e('Active') ?></th><th><?php _e('Theme') ?></th><th><?php _e('Description') ?></th></tr> 
    2323<?php 
    24 while( list( $key, $val ) = each( $themes ) ) { 
     24foreach( $themes as $key => $theme ) { 
     25        $theme_key = wp_specialchars( $theme[ 'Stylesheet' ] ); 
    2526        $i++; 
    2627        $enabled = ''; 
    2728        $disabled = ''; 
    28         if( isset( $allowed_themes[ $key ] ) == true ) { 
     29        if( isset( $allowed_themes[ $theme_key ] ) == true ) { 
    2930                $enabled = 'checked '; 
    3031        } else { 
     
    3536<tr valign="top" style="<?php if ($i%2) echo 'background: #eee'; ?>"> 
    3637<td> 
    37 <label><input name="theme[<?php echo $key ?>]" type="radio" id="<?php echo $key ?>" value="disabled" <?php echo $disabled ?>/><?php _e('No') ?></label> 
     38<label><input name="theme[<?php echo $theme_key ?>]" type="radio" id="<?php echo $theme_key ?>" value="disabled" <?php echo $disabled ?>/><?php _e('No') ?></label> 
    3839&nbsp;&nbsp;&nbsp;  
    39 <label><input name="theme[<?php echo $key ?>]" type="radio" id="<?php echo $key ?>" value="enabled" <?php echo $enabled ?>/><?php _e('Yes') ?></label> 
     40<label><input name="theme[<?php echo $theme_key ?>]" type="radio" id="<?php echo $theme_key ?>" value="enabled" <?php echo $enabled ?>/><?php _e('Yes') ?></label> 
    4041</td> 
    4142<th scope="row" align="left"><?php echo $key ?></th>  
    42 <td><?php echo $val[ 'Description' ] ?></td> 
     43<td><?php echo $theme[ 'Description' ] ?></td> 
    4344</tr>  
    4445<?php