From ff31226fdeb972aac2f37f0098240cb366a9bb26 Mon Sep 17 00:00:00 2001 From: brettp Date: Wed, 5 May 2010 19:14:48 +0000 Subject: Merged 18_new_admin branch to trunk. git-svn-id: http://code.elgg.org/elgg/trunk@5977 36083f99-b078-4883-b0ff-0f9b5a30f544 --- actions/admin/plugins/disable.php | 2 +- actions/admin/plugins/disableall.php | 2 +- actions/admin/plugins/enable.php | 6 ++-- actions/admin/plugins/enableall.php | 4 +-- actions/admin/plugins/reorder.php | 5 ++-- actions/admin/plugins/simple_update_states.php | 41 ++++++++++++++++++++++++++ 6 files changed, 51 insertions(+), 9 deletions(-) create mode 100644 actions/admin/plugins/simple_update_states.php (limited to 'actions/admin/plugins') diff --git a/actions/admin/plugins/disable.php b/actions/admin/plugins/disable.php index d5042e2bf..ac80d46e3 100644 --- a/actions/admin/plugins/disable.php +++ b/actions/admin/plugins/disable.php @@ -21,6 +21,7 @@ foreach ($plugin as $p) { // Disable if (disable_plugin($p)) { system_message(sprintf(elgg_echo('admin:plugins:disable:yes'), $p)); + elgg_delete_admin_notice('first_installation_plugin_reminder'); } else { register_error(sprintf(elgg_echo('admin:plugins:disable:no'), $p)); } @@ -30,4 +31,3 @@ elgg_view_regenerate_simplecache(); elgg_filepath_cache_reset(); forward($_SERVER['HTTP_REFERER']); -exit; diff --git a/actions/admin/plugins/disableall.php b/actions/admin/plugins/disableall.php index 70a945ee4..80553e9d1 100644 --- a/actions/admin/plugins/disableall.php +++ b/actions/admin/plugins/disableall.php @@ -16,6 +16,7 @@ $plugins = get_installed_plugins(); foreach ($plugins as $p => $data) { // Disable if (disable_plugin($p)) { + elgg_delete_admin_notice('first_installation_plugin_reminder'); system_message(sprintf(elgg_echo('admin:plugins:disable:yes'), $p)); } else { register_error(sprintf(elgg_echo('admin:plugins:disable:no'), $p)); @@ -26,4 +27,3 @@ elgg_view_regenerate_simplecache(); elgg_filepath_cache_reset(); forward($_SERVER['HTTP_REFERER']); -exit; diff --git a/actions/admin/plugins/enable.php b/actions/admin/plugins/enable.php index b5286336b..053fbc556 100644 --- a/actions/admin/plugins/enable.php +++ b/actions/admin/plugins/enable.php @@ -11,8 +11,8 @@ // block non-admin users admin_gatekeeper(); -// Get the plugin $plugin = get_input('plugin'); + if (!is_array($plugin)) { $plugin = array($plugin); } @@ -20,6 +20,7 @@ if (!is_array($plugin)) { foreach ($plugin as $p) { // Disable if (enable_plugin($p)) { + elgg_delete_admin_notice('first_installation_plugin_reminder'); system_message(sprintf(elgg_echo('admin:plugins:enable:yes'), $p)); } else { register_error(sprintf(elgg_echo('admin:plugins:enable:no'), $p)); @@ -29,5 +30,4 @@ foreach ($plugin as $p) { elgg_view_regenerate_simplecache(); elgg_filepath_cache_reset(); -forward($_SERVER['HTTP_REFERER']); -exit; +forward($_SERVER['HTTP_REFERER']); \ No newline at end of file diff --git a/actions/admin/plugins/enableall.php b/actions/admin/plugins/enableall.php index ea4b48f95..d1758a4b3 100644 --- a/actions/admin/plugins/enableall.php +++ b/actions/admin/plugins/enableall.php @@ -16,6 +16,7 @@ $plugins = get_installed_plugins(); foreach ($plugins as $p => $data) { // Enable if (enable_plugin($p)) { + elgg_delete_admin_notice('first_installation_plugin_reminder'); system_message(sprintf(elgg_echo('admin:plugins:enable:yes'), $p)); } else { register_error(sprintf(elgg_echo('admin:plugins:enable:no'), $p)); @@ -26,5 +27,4 @@ foreach ($plugins as $p => $data) { elgg_view_regenerate_simplecache(); elgg_filepath_cache_reset(); -forward($_SERVER['HTTP_REFERER']); -exit; +forward($_SERVER['HTTP_REFERER']); \ No newline at end of file diff --git a/actions/admin/plugins/reorder.php b/actions/admin/plugins/reorder.php index 6050a585f..6423dc14c 100644 --- a/actions/admin/plugins/reorder.php +++ b/actions/admin/plugins/reorder.php @@ -13,8 +13,8 @@ admin_gatekeeper(); // Get the plugin $mod = get_input('plugin'); -$mod = str_replace('.','',$mod); -$mod = str_replace('/','',$mod); +$mod = str_replace('.', '', $mod); +$mod = str_replace('/', '', $mod); // Get the new order $order = (int) get_input('order'); @@ -35,6 +35,7 @@ if ($key = array_search($mod, $plugins)) { // Disable if (regenerate_plugin_list($plugins)) { + elgg_delete_admin_notice('first_installation_plugin_reminder'); system_message(sprintf(elgg_echo('admin:plugins:reorder:yes'), $plugin)); } else { register_error(sprintf(elgg_echo('admin:plugins:reorder:no'), $plugin)); diff --git a/actions/admin/plugins/simple_update_states.php b/actions/admin/plugins/simple_update_states.php new file mode 100644 index 000000000..197f183f9 --- /dev/null +++ b/actions/admin/plugins/simple_update_states.php @@ -0,0 +1,41 @@ + $info) { + // this is only for simple plugins. + if (!isset($info['manifest']['admin_interface']) || $info['manifest']['admin_interface'] != 'simple') { + continue; + } + + $plugin_enabled = is_plugin_enabled($plugin); + + // only effect changes to plugins not already in that state. + if ($plugin_enabled && !in_array($plugin, $enabled_plugins)) { + $success = $success && disable_plugin($plugin); + } elseif (!$plugin_enabled && in_array($plugin, $enabled_plugins)) { + $success = $success && enable_plugin($plugin); + } +} + +if ($success) { + elgg_delete_admin_notice('first_installation_plugin_reminder'); + system_message(elgg_echo('admin:plugins:simple_simple_success')); +} else { + register_error(elgg_echo('admins:plugins:simple_simple_fail')); +} + +forward($_SERVER['HTTP_REFERER']); \ No newline at end of file -- cgit v1.2.3