WordPress.org

Make WordPress Core


Ignore:
Timestamp:
01/14/2010 02:02:19 AM (10 years ago)
Author:
wpmuguru
Message:

merge wp-admin user, plugins, themes, upgrade , See #11644

Location:
trunk/wp-admin
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin

    • Property svn:ignore set to
      .themes.php.swp
      .user-edit.php.swp
      .user-new.php.swp
      .users.php.swp
  • trunk/wp-admin/themes.php

    r12673 r12722  
    1313    wp_die( __( 'Cheatin’ uh?' ) );
    1414
     15if ( is_multisite() ) {
     16    $themes = get_themes();
     17    $ct = current_theme_info();
     18    $allowed_themes = apply_filters("allowed_themes", get_site_allowed_themes() );
     19    if( $allowed_themes == false )
     20        $allowed_themes = array();
     21
     22    $blog_allowed_themes = wpmu_get_blog_allowedthemes();
     23    if( is_array( $blog_allowed_themes ) )
     24        $allowed_themes = array_merge( $allowed_themes, $blog_allowed_themes );
     25    if( $blog_id != 1 )
     26        unset( $allowed_themes[ "h3" ] );
     27
     28    if( isset( $allowed_themes[ wp_specialchars( $ct->stylesheet ) ] ) == false )
     29        $allowed_themes[ wp_specialchars( $ct->stylesheet ) ] = true;
     30
     31    reset( $themes );
     32    foreach( $themes as $key => $theme ) {
     33        if( isset( $allowed_themes[ wp_specialchars( $theme[ 'Stylesheet' ] ) ] ) == false ) {
     34            unset( $themes[ $key ] );
     35        }
     36    }
     37    reset( $themes );
     38}
    1539if ( isset($_GET['action']) ) {
    1640    if ( 'activate' == $_GET['action'] ) {
     
    3357
    3458$help = '<p>' . __('Themes give your WordPress style. Once a theme is installed, you may preview it, activate it or deactivate it here.') . '</p>';
    35 if ( current_user_can('install_themes') ) {
     59if ( ( !is_multisite() && current_user_can('install_themes') ) || is_super_admin() ) {
    3660    $help .= '<p>' . sprintf(__('You can find additional themes for your site by using the new <a href="%1$s">Theme Browser/Installer</a> functionality or by browsing the <a href="http://wordpress.org/extend/themes/">WordPress Theme Directory</a> directly and installing manually.  To install a theme <em>manually</em>, <a href="%2$s">upload its ZIP archive with the new uploader</a> or copy its folder via FTP into your <code>wp-content/themes</code> directory.'), 'theme-install.php', 'theme-install.php?tab=upload' ) . '</p>';
    3761    $help .= '<p>' . __('Once a theme is uploaded, you should see it on this page.') . '</p>' ;
     
    4468
    4569require_once('admin-header.php');
     70if( is_multisite() && is_super_admin() ) {
     71    ?><div id="message0" class="updated fade"><p><?php _e('Administrator: new themes must be activated in the <a href="wpmu-themes.php">Themes Admin</a> page before they appear here.'); ?></p></div><?php
     72}
    4673?>
    4774
     
    5986
    6087<?php
    61 $themes = get_themes();
     88if ( !is_multisite() )
     89    $themes = get_themes();
    6290$ct = current_theme_info();
    6391unset($themes[$ct->name]);
     
    98126function theme_update_available( $theme ) {
    99127    static $themes_update;
     128
     129    if ( is_multisite() && !is_super_admin() )
     130        return;
     131
    100132    if ( !isset($themes_update) )
    101133        $themes_update = get_site_transient('update_themes');
     
    128160<div class="wrap">
    129161<?php screen_icon(); ?>
    130 <h2><?php echo esc_html( $title ); ?> <a href="theme-install.php" class="button add-new-h2"><?php echo esc_html_x('Add New', 'theme'); ?></a></h2>
     162<h2><?php echo esc_html( $title ); if ( !is_multisite() || is_super_admin() ) { ?> <a href="theme-install.php" class="button add-new-h2"><?php echo esc_html_x('Add New', 'theme'); ?></a><?php } ?></h2>
    131163
    132164<h3><?php _e('Current Theme'); ?></h3>
     
    139171    printf(__('%1$s %2$s by %3$s'), $ct->title, $ct->version, $ct->author) ; ?></h4>
    140172<p class="theme-description"><?php echo $ct->description; ?></p>
    141 <?php if ($ct->parent_theme) { ?>
     173<?php if ( ( !is_multisite() || is_super_admin() ) && $ct->parent_theme ) { ?>
    142174    <p><?php printf(__('The template files are located in <code>%2$s</code>.  The stylesheet files are located in <code>%3$s</code>.  <strong>%4$s</strong> uses templates from <strong>%5$s</strong>.  Changes made to the templates will affect both themes.'), $ct->title, str_replace( WP_CONTENT_DIR, '', $ct->template_dir ), str_replace( WP_CONTENT_DIR, '', $ct->stylesheet_dir ), $ct->title, $ct->parent_theme); ?></p>
    143175<?php } else { ?>
     
    218250    $actions[] = '<a href="' . $activate_link .  '" class="activatelink" title="' . $activate_text . '">' . __('Activate') . '</a>';
    219251    $actions[] = '<a href="' . $preview_link . '" class="thickbox thickbox-preview" title="' . esc_attr(sprintf(__('Preview &#8220;%s&#8221;'), $theme_name)) . '">' . __('Preview') . '</a>';
    220     if ( current_user_can('update_themes') )
     252    if ( ( !is_multisite() && current_user_can('update_themes') ) || is_super_admin() )
    221253        $actions[] = '<a class="submitdelete deletion" href="' . wp_nonce_url("themes.php?action=delete&amp;template=$stylesheet", 'delete-theme_' . $stylesheet) . '" onclick="' . "if ( confirm('" . esc_js(sprintf( __("You are about to delete this theme '%s'\n  'Cancel' to stop, 'OK' to delete."), $theme_name )) . "') ) {return true;}return false;" . '">' . __('Delete') . '</a>';
    222254    $actions = apply_filters('theme_action_links', $actions, $themes[$theme_name]);
     
    234266<p class="description"><?php echo $description; ?></p>
    235267<span class='action-links'><?php echo $actions ?></span>
    236     <?php if ($parent_theme) {
     268    <?php if ( ( !is_multisite() || is_super_admin() ) && $parent_theme ) {
    237269    /* translators: 1: theme title, 2:  template dir, 3: stylesheet_dir, 4: theme title, 5: parent_theme */ ?>
    238270    <p><?php printf(__('The template files are located in <code>%2$s</code>.  The stylesheet files are located in <code>%3$s</code>.  <strong>%4$s</strong> uses templates from <strong>%5$s</strong>.  Changes made to the templates will affect both themes.'), $title, str_replace( WP_CONTENT_DIR, '', $template_dir ), str_replace( WP_CONTENT_DIR, '', $stylesheet_dir ), $title, $parent_theme); ?></p>
     
    267299// List broken themes, if any.
    268300$broken_themes = get_broken_themes();
    269 if ( count($broken_themes) ) {
    270 ?>
    271 
    272 <h2><?php _e('Broken Themes'); ?></h2>
     301if ( ( !is_multisite() || is_super_admin() ) && count( $broken_themes ) ) {
     302?>
     303
     304<h2><?php _e('Broken Themes'); ?> <?php if ( is_multisite() ) _e( '(Site admin only)' ); ?></h2>
    273305<p><?php _e('The following themes are installed but incomplete.  Themes must have a stylesheet and a template.'); ?></p>
    274306
Note: See TracChangeset for help on using the changeset viewer.