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 ++++++++++++ actions/admin/site/update_advanced.php | 74 ++++++++++++++++++++++ actions/admin/site/update_basic.php | 88 ++++---------------------- 8 files changed, 138 insertions(+), 84 deletions(-) create mode 100644 actions/admin/plugins/simple_update_states.php create mode 100644 actions/admin/site/update_advanced.php (limited to 'actions/admin') 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 diff --git a/actions/admin/site/update_advanced.php b/actions/admin/site/update_advanced.php new file mode 100644 index 000000000..c9b78c261 --- /dev/null +++ b/actions/admin/site/update_advanced.php @@ -0,0 +1,74 @@ +url = get_input('wwwroot'); + + datalist_set('path', sanitise_filepath(get_input('path'))); + datalist_set('dataroot', sanitise_filepath(get_input('dataroot'))); + + if (get_input('simplecache_enabled')) { + elgg_view_enable_simplecache(); + } else { + elgg_view_disable_simplecache(); + } + + if (get_input('viewpath_cache_enabled')) { + elgg_enable_filepath_cache(); + } else { + elgg_disable_filepath_cache(); + } + + set_config('default_access', get_input('default_access', ACCESS_PRIVATE), $site->getGUID()); + + $user_default_access = (get_input('allow_user_default_access')) ? 1 : 0; + set_config('allow_user_default_access', $user_default_access, $site->getGUID()); + + set_config('view', get_input('view'), $site->getGUID()); + + $debug = get_input('debug'); + if ($debug) { + set_config('debug', $debug, $site->getGUID()); + } else { + unset_config('debug', $site->getGUID()); + } + + $https_login = get_input('https_login'); + if ($https_login) { + set_config('https_login', 1, $site->getGUID()); + } else { + unset_config('https_login', $site->getGUID()); + } + + $api = get_input('api'); + if ($api) { + unset_config('disable_api', $site->getGUID()); + } else { + set_config('disable_api', 'disabled', $site->getGUID()); + } + + if ($site->save()) { + system_message(elgg_echo("admin:configuration:success")); + } else { + register_error(elgg_echo("admin:configuration:fail")); + } + + forward($_SERVER['HTTP_REFERER']); +} \ No newline at end of file diff --git a/actions/admin/site/update_basic.php b/actions/admin/site/update_basic.php index d9fa8f367..5914ab0b5 100644 --- a/actions/admin/site/update_basic.php +++ b/actions/admin/site/update_basic.php @@ -11,83 +11,21 @@ * @link http://elgg.org/ */ -global $CONFIG; - -// block non-admin users admin_gatekeeper(); -if (get_input('settings') == 'go') { - if (datalist_get('default_site')) { - $site = get_entity(datalist_get('default_site')); - if (!($site instanceof ElggSite)) { - throw new InstallationException(elgg_echo('InvalidParameterException:NonElggSite')); - } - - $site->description = get_input('sitedescription'); - $site->name = get_input('sitename'); - $site->email = get_input('siteemail'); - $site->url = get_input('wwwroot'); - - datalist_set('path',sanitise_filepath(get_input('path'))); - datalist_set('dataroot',sanitise_filepath(get_input('dataroot'))); - if (get_input('simplecache_enabled')) { - elgg_view_enable_simplecache(); - } else { - elgg_view_disable_simplecache(); - } - if (get_input('viewpath_cache_enabled')) { - elgg_enable_filepath_cache(); - } else { - elgg_disable_filepath_cache(); - } - - set_config('language', get_input('language'), $site->getGUID()); - - set_config('default_access', get_input('default_access'), $site->getGUID()); - - if (get_input('allow_user_default_access')) { - set_config('allow_user_default_access', 1, $site->getGUID()); - } else { - set_config('allow_user_default_access', 0, $site->getGUID()); - } - - set_config('view', get_input('view'), $site->getGUID()); - - $debug = get_input('debug'); - if ($debug) { - set_config('debug', $debug, $site->getGUID()); - } else { - unset_config('debug', $site->getGUID()); - } - - $https_login = get_input('https_login'); - if ($https_login) { - set_config('https_login', 1, $site->getGUID()); - } else { - unset_config('https_login', $site->getGUID()); - } - - $usage = get_input('usage'); - if ($usage) { - unset_config('ping_home', $site->getGUID()); - } else { - set_config('ping_home', 'disabled', $site->getGUID()); - } +if (datalist_get('default_site')) { + $site = get_entity(datalist_get('default_site')); + if (!($site instanceof ElggSite)) { + throw new InstallationException(elgg_echo('InvalidParameterException:NonElggSite')); + } - $api = get_input('api'); - if ($api) { - unset_config('disable_api', $site->getGUID()); - } else { - set_config('disable_api', 'disabled', $site->getGUID()); - } + $site->description = get_input('sitedescription'); + $site->name = get_input('sitename'); + $site->email = get_input('siteemail'); + $site->save(); - if ($site->save()) { - system_message(elgg_echo("admin:configuration:success")); - } else { - register_error(elgg_echo("admin:configuration:fail")); - } + set_config('language', get_input('language'), $site->getGUID()); - forward($_SERVER['HTTP_REFERER']); - exit; - } -} + forward($_SERVER['HTTP_REFERER']); + exit; +} \ No newline at end of file -- cgit v1.2.3