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

git-svn-id: http://core.svn.wordpress.org/trunk@21740 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Nacin 2012-09-04 20:51:33 +00:00
parent daef59322c
commit 7e4d3d4136
1 changed files with 16 additions and 4 deletions

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") );