Link to network/update-core when running multisite. Remove theme/plugin editors from blog menu when running multisite. Redirect to network/* when accessing theme/plugin-install/editor. props ocean90, see #15525.

git-svn-id: http://svn.automattic.com/wordpress/trunk@16747 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
nacin 2010-12-06 15:41:19 +00:00
parent 25729cb3c5
commit 4dd3b77b48
9 changed files with 55 additions and 12 deletions

View File

@ -98,13 +98,15 @@ function core_update_footer( $msg = '' ) {
if ( ! isset( $cur->response ) )
$cur->response = '';
$href = is_multisite() ? network_admin_url( 'update-core.php' ) : admin_url( 'update-core.php' );
switch ( $cur->response ) {
case 'development' :
return sprintf( __( 'You are using a development version (%1$s). Cool! Please <a href="%2$s">stay updated</a>.' ), $GLOBALS['wp_version'], 'update-core.php');
return sprintf( __( 'You are using a development version (%1$s). Cool! Please <a href="%2$s">stay updated</a>.' ), $GLOBALS['wp_version'], $href );
break;
case 'upgrade' :
return sprintf( '<strong>'.__( '<a href="%1$s">Get Version %2$s</a>' ).'</strong>', 'update-core.php', $cur->current);
return sprintf( '<strong>'.__( '<a href="%1$s">Get Version %2$s</a>' ).'</strong>', $href, $cur->current);
break;
case 'latest' :
@ -129,11 +131,12 @@ function update_nag() {
if ( ! isset( $cur->response ) || $cur->response != 'upgrade' )
return false;
if ( current_user_can('update_core') )
$msg = sprintf( __('<a href="http://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> is available! <a href="%2$s">Please update now</a>.'), $cur->current, 'update-core.php' );
else
if ( current_user_can('update_core') ) {
$href = is_multisite() ? network_admin_url( 'update-core.php' ) : admin_url( 'update-core.php' );
$msg = sprintf( __('<a href="http://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> is available! <a href="%2$s">Please update now</a>.'), $cur->current, $href );
} else {
$msg = sprintf( __('<a href="http://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> is available! Please notify the site administrator.'), $cur->current );
}
echo "<div class='update-nag'>$msg</div>";
}
add_action( 'admin_notices', 'update_nag', 3 );
@ -146,8 +149,11 @@ function update_right_now_message() {
$cur = get_preferred_from_update_core();
$msg = sprintf( __('You are using <span class="b">WordPress %s</span>.'), $GLOBALS['wp_version'] );
if ( isset( $cur->response ) && $cur->response == 'upgrade' && current_user_can('update_core') )
$msg .= " <a href='update-core.php' class='button'>" . sprintf( __('Update to %s'), $cur->current ? $cur->current : __( 'Latest' ) ) . '</a>';
if ( isset( $cur->response ) && $cur->response == 'upgrade' && current_user_can('update_core') ) {
$href = is_multisite() ? network_admin_url( 'update-core.php' ) : admin_url( 'update-core.php' );
$msg .= " <a href='" . $href . "' class='button'>" . sprintf( __('Update to %s'), $cur->current ? $cur->current : __( 'Latest' ) ) . '</a>';
}
echo "<span id='wp-version-message'>$msg</span>";
}

View File

@ -151,7 +151,8 @@ if ( current_user_can( 'switch_themes') ) {
}
// Add 'Editor' to the bottom of the Appearence menu.
add_action('admin_menu', '_add_themes_utility_last', 101);
if ( ! is_multisite() )
add_action('admin_menu', '_add_themes_utility_last', 101);
function _add_themes_utility_last() {
// Must use API on the admin_menu hook, direct modification is only possible on/before the _admin_menu hook
add_submenu_page('themes.php', _x('Editor', 'theme editor'), _x('Editor', 'theme editor'), 'edit_themes', 'theme-editor.php');
@ -171,7 +172,8 @@ if ( is_super_admin() || ( is_multisite() && isset($menu_perms['plugins']) && $m
$submenu['plugins.php'][5] = array( __('Plugins'), 'activate_plugins', 'plugins.php' );
/* translators: add new plugin */
$submenu['plugins.php'][10] = array(_x('Add New', 'plugin'), 'install_plugins', 'plugin-install.php');
$submenu['plugins.php'][15] = array( _x('Editor', 'plugin editor'), 'edit_plugins', 'plugin-editor.php' );
if ( ! is_multisite() )
$submenu['plugins.php'][15] = array( _x('Editor', 'plugin editor'), 'edit_plugins', 'plugin-editor.php' );
}
unset($menu_perms, $update_plugins, $update_count);

View File

@ -9,6 +9,11 @@
/** WordPress Administration Bootstrap */
require_once('./admin.php');
if ( is_multisite() && ! is_network_admin() ) {
wp_redirect( network_admin_url( 'plugin-editor.php' ) );
exit();
}
if ( !current_user_can('edit_plugins') )
wp_die( __('You do not have sufficient permissions to edit plugins for this site.') );

View File

@ -12,6 +12,11 @@ if ( !defined( 'IFRAME_REQUEST' ) && isset( $_GET['tab'] ) && ( 'plugin-informat
/** WordPress Administration Bootstrap */
require_once('./admin.php');
if ( is_multisite() && ! is_network_admin() ) {
wp_redirect( network_admin_url( 'plugin-install.php' ) );
exit();
}
$wp_list_table = get_list_table('WP_Plugin_Install_List_Table');
$wp_list_table->check_permissions();
$wp_list_table->prepare_items();

View File

@ -9,6 +9,11 @@
/** WordPress Administration Bootstrap */
require_once('./admin.php');
if ( is_multisite() && ! is_network_admin() ) {
wp_redirect( network_admin_url( 'theme-editor.php' ) );
exit();
}
if ( !current_user_can('edit_themes') )
wp_die('<p>'.__('You do not have sufficient permissions to edit templates for this site.').'</p>');

View File

@ -12,6 +12,11 @@ if ( !defined( 'IFRAME_REQUEST' ) && isset( $_GET['tab'] ) && ( 'theme-informati
/** WordPress Administration Bootstrap */
require_once('./admin.php');
if ( is_multisite() && ! is_network_admin() ) {
wp_redirect( network_admin_url( 'theme-install.php' ) );
exit();
}
$wp_list_table = get_list_table('WP_Theme_Install_List_Table');
$wp_list_table->check_permissions();
$wp_list_table->prepare_items();

View File

@ -73,7 +73,15 @@ require_once('./admin-header.php');
<div class="wrap">
<?php screen_icon(); ?>
<h2 class="nav-tab-wrapper"><a href="themes.php" class="nav-tab nav-tab-active"><?php echo esc_html( $title ); ?></a><?php if ( current_user_can('install_themes') ) { ?><a href="theme-install.php" class="nav-tab"><?php echo esc_html_x('Install Themes', 'theme'); ?></a><?php } ?></h2>
<h2 class="nav-tab-wrapper">
<a href="themes.php" class="nav-tab nav-tab-active"><?php echo esc_html( $title ); ?></a>
<?php
if ( current_user_can('install_themes') ) {
$href = is_multisite() ? network_admin_url( 'theme-install.php' ) : admin_url( 'theme-install.php' );
?>
<a href="<?php echo $href; ?>" class="nav-tab"><?php echo esc_html_x('Install Themes', 'theme'); ?></a>
<?php } ?>
</h2>
<h3><?php _e('Current Theme'); ?></h3>
<div id="current-theme">

View File

@ -9,6 +9,11 @@
/** WordPress Administration Bootstrap */
require_once('./admin.php');
if ( is_multisite() && ! is_network_admin() ) {
wp_redirect( network_admin_url( 'update-core.php' ) );
exit();
}
if ( ! current_user_can('update_plugins') )
wp_die(__('You do not have sufficient permissions to update plugins for this site.'));

View File

@ -278,7 +278,9 @@ function wp_admin_bar_updates_menu() {
$update_title = sprintf( __('Updates %s'), "<span id='ab-updates' class='count-$update_count' title='$update_title'><span class='update-count'>" . number_format_i18n($update_count) . "</span></span>" );
$wp_admin_bar->add_menu( array( 'id' => 'updates', 'title' => $update_title, 'href' => admin_url('update-core.php') ) );
$href = is_multisite() ? network_admin_url( 'update-core.php' ) : admin_url( 'update-core.php' );
$wp_admin_bar->add_menu( array( 'id' => 'updates', 'title' => $update_title, 'href' => $href ) );
}
/**