|
9 | 9 | /** WordPress Administration Bootstrap */ |
10 | 10 | require_once('admin.php'); |
11 | 11 |
|
| 12 | +if ( ! current_user_can('activate_plugins') ) |
| 13 | + wp_die(__('You do not have sufficient permissions to manage plugins for this blog.')); |
| 14 | + |
12 | 15 | if ( isset($_POST['clear-recent-list']) ) |
13 | 16 | $action = 'clear-recent-list'; |
14 | 17 | elseif ( !empty($_REQUEST['action']) ) |
|
37 | 40 | if ( !empty($action) ) { |
38 | 41 | switch ( $action ) { |
39 | 42 | case 'activate': |
| 43 | + if ( ! current_user_can('activate_plugins') ) |
| 44 | + wp_die(__('You do not have sufficient permissions to activate plugins for this blog.')); |
| 45 | + |
40 | 46 | check_admin_referer('activate-plugin_' . $plugin); |
41 | 47 |
|
42 | 48 | $result = activate_plugin($plugin, 'plugins.php?error=true&plugin=' . $plugin); |
|
53 | 59 | exit; |
54 | 60 | break; |
55 | 61 | case 'activate-selected': |
| 62 | + if ( ! current_user_can('activate_plugins') ) |
| 63 | + wp_die(__('You do not have sufficient permissions to activate plugins for this blog.')); |
| 64 | + |
56 | 65 | check_admin_referer('bulk-manage-plugins'); |
57 | 66 |
|
58 | 67 | $plugins = (array) $_POST['checked']; |
|
75 | 84 | exit; |
76 | 85 | break; |
77 | 86 | case 'error_scrape': |
| 87 | + if ( ! current_user_can('activate_plugins') ) |
| 88 | + wp_die(__('You do not have sufficient permissions to activate plugins for this blog.')); |
| 89 | + |
78 | 90 | check_admin_referer('plugin-activation-error_' . $plugin); |
79 | 91 |
|
80 | 92 | $valid = validate_plugin($plugin); |
|
88 | 100 | exit; |
89 | 101 | break; |
90 | 102 | case 'deactivate': |
| 103 | + if ( ! current_user_can('activate_plugins') ) |
| 104 | + wp_die(__('You do not have sufficient permissions to deactivate plugins for this blog.')); |
| 105 | + |
91 | 106 | check_admin_referer('deactivate-plugin_' . $plugin); |
92 | 107 | deactivate_plugins($plugin); |
93 | 108 | update_option('recently_activated', array($plugin => time()) + (array)get_option('recently_activated')); |
94 | 109 | wp_redirect("plugins.php?deactivate=true&plugin_status=$status&paged=$page"); |
95 | 110 | exit; |
96 | 111 | break; |
97 | 112 | case 'deactivate-selected': |
| 113 | + if ( ! current_user_can('activate_plugins') ) |
| 114 | + wp_die(__('You do not have sufficient permissions to deactivate plugins for this blog.')); |
| 115 | + |
98 | 116 | check_admin_referer('bulk-manage-plugins'); |
99 | 117 |
|
100 | 118 | $plugins = (array) $_POST['checked']; |
|
0 commit comments