Only allow operations on network plugins through the network admin. see #21187, for trunk.

git-svn-id: https://develop.svn.wordpress.org/trunk@21740 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Nacin 2012-09-04 20:51:33 +00:00
parent 3fb49b9ffd
commit a8549576b4

View File

@ -44,6 +44,11 @@ if ( $action ) {
}
if ( ! is_network_admin() ) {
if ( is_network_only_plugin( $plugin ) ) {
wp_redirect( self_admin_url("plugins.php?plugin_status=$status&paged=$page&s=$s") );
exit;
}
$recent = (array) get_option( 'recently_activated' );
unset( $recent[ $plugin ] );
update_option( 'recently_activated', $recent );
@ -65,10 +70,17 @@ if ( $action ) {
$plugins = isset( $_POST['checked'] ) ? (array) $_POST['checked'] : array();
// Only activate plugins which are not already active.
$check = is_network_admin() ? 'is_plugin_active_for_network' : 'is_plugin_active';
foreach ( $plugins as $i => $plugin )
if ( $check( $plugin ) )
unset( $plugins[ $i ] );
if ( is_network_admin() ) {
foreach ( $plugins as $i => $plugin ) {
if ( is_plugin_active_for_network( $plugin ) )
unset( $plugins[ $i ] );
}
} else {
foreach ( $plugins as $i => $plugin ) {
if ( is_plugin_active( $plugin ) || is_network_only_plugin( $plugin ) )
unset( $plugins[ $i ] );
}
}
if ( empty($plugins) ) {
wp_redirect( self_admin_url("plugins.php?plugin_status=$status&paged=$page&s=$s") );