Make WordPress Core

Changeset 21741


Ignore:
Timestamp:
09/04/2012 08:53:05 PM (12 years ago)
Author:
nacin
Message:

Only allow operations on network plugins through the network admin. fixes #21187. merges [21700] and [21740] to the 3.4 branch.

Location:
branches/3.4/wp-admin
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/3.4/wp-admin/includes/class-wp-plugins-list-table.php

    r20853 r21741  
    9191        foreach ( (array) $plugins['all'] as $plugin_file => $plugin_data ) {
    9292            // Filter into individual sections
    93             if ( ! $screen->is_network && is_plugin_active_for_network( $plugin_file ) ) {
     93            if ( is_multisite() && ! $screen->is_network && is_network_only_plugin( $plugin_file ) ) {
     94                unset( $plugins['all'][ $plugin_file ] );
     95            } elseif ( ! $screen->is_network && is_plugin_active_for_network( $plugin_file ) ) {
    9496                unset( $plugins['all'][ $plugin_file ] );
    9597            } elseif ( ( ! $screen->is_network && is_plugin_active( $plugin_file ) )
  • branches/3.4/wp-admin/plugins.php

    r20871 r21741  
    5252
    5353            if ( ! is_network_admin() ) {
     54                if ( is_network_only_plugin( $plugin ) ) {
     55                    wp_redirect( self_admin_url("plugins.php?plugin_status=$status&paged=$page&s=$s") );
     56                    exit;
     57                }
     58
    5459                $recent = (array) get_option( 'recently_activated' );
    5560                unset( $recent[ $plugin ] );
     
    7378
    7479            // Only activate plugins which are not already active.
    75             $check = is_network_admin() ? 'is_plugin_active_for_network' : 'is_plugin_active';
    76             foreach ( $plugins as $i => $plugin )
    77                 if ( $check( $plugin ) )
    78                     unset( $plugins[ $i ] );
     80            if ( is_network_admin() ) {
     81                foreach ( $plugins as $i => $plugin ) {
     82                    if ( is_plugin_active_for_network( $plugin ) )
     83                        unset( $plugins[ $i ] );
     84                }
     85            } else {
     86                foreach ( $plugins as $i => $plugin ) {
     87                    if ( is_plugin_active( $plugin ) || is_network_only_plugin( $plugin ) )
     88                        unset( $plugins[ $i ] );
     89                }
     90            }
    7991
    8092            if ( empty($plugins) ) {
Note: See TracChangeset for help on using the changeset viewer.