Permalink
Browse files

Only allow operations on network plugins through the network admin. s…

…ee #21187, for trunk.

git-svn-id: http://core.svn.wordpress.org/trunk@21740 1a063a9b-81f0-0310-95a4-ce76da25c4cd
  • Loading branch information...
1 parent daef593 commit 7e4d3d4136ba54b5e4b3f1aa5b52be5bbb1a7be9 @nacin nacin committed Sep 4, 2012
Showing with 16 additions and 4 deletions.
  1. +16 −4 wp-admin/plugins.php
View
20 wp-admin/plugins.php
@@ -44,6 +44,11 @@
}
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 @@
$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") );

0 comments on commit 7e4d3d4

Please sign in to comment.