aboutsummaryrefslogtreecommitdiff
path: root/actions/plugins/settings
diff options
context:
space:
mode:
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-05-05 19:14:48 +0000
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-05-05 19:14:48 +0000
commitff31226fdeb972aac2f37f0098240cb366a9bb26 (patch)
tree1f0caa75c9a340cf28ce9a81a4cbe3230d13abf3 /actions/plugins/settings
parent81ffac29fabc175eebdbf95578da046f4f00611b (diff)
downloadelgg-ff31226fdeb972aac2f37f0098240cb366a9bb26.tar.gz
elgg-ff31226fdeb972aac2f37f0098240cb366a9bb26.tar.bz2
Merged 18_new_admin branch to trunk.
git-svn-id: http://code.elgg.org/elgg/trunk@5977 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'actions/plugins/settings')
-rw-r--r--actions/plugins/settings/save.php50
1 files changed, 40 insertions, 10 deletions
diff --git a/actions/plugins/settings/save.php b/actions/plugins/settings/save.php
index bbbb6a367..6aa47b60e 100644
--- a/actions/plugins/settings/save.php
+++ b/actions/plugins/settings/save.php
@@ -10,22 +10,52 @@
$params = get_input('params');
$plugin = get_input('plugin');
+if (!$plugin_info = load_plugin_manifest($plugin)) {
+ register_error(sprintf(elgg_echo('plugins:settings:save:fail'), $plugin));
+ forward($_SERVER['HTTP_REFERER']);
+}
+
+$plugin_name = $plugin_info['name'];
-gatekeeper();
+admin_gatekeeper();
$result = false;
-foreach ($params as $k => $v) {
- // Save
- $result = set_plugin_setting($k, $v, $plugin);
+$options = array(
+ 'plugin' => $plugin,
+ 'manifest' => $plugin_info,
+ 'settings' => $params
+);
- // Error?
- if (!$result) {
- register_error(sprintf(elgg_echo('plugins:settings:save:fail'), $plugin));
- forward($_SERVER['HTTP_REFERER']);
- exit;
+// allow a plugin to override the save action for their settings
+if (elgg_action_exist("settings/$plugin/save")) {
+ action("settings/$plugin/save");
+} else {
+ foreach ($params as $k => $v) {
+ if (!$result = set_plugin_setting($k, $v, $plugin)) {
+ register_error(sprintf(elgg_echo('plugins:settings:save:fail'), $plugin_name));
+ forward($_SERVER['HTTP_REFERER']);
+ exit;
+ }
}
}
-system_message(sprintf(elgg_echo('plugins:settings:save:ok'), $plugin));
+system_message(sprintf(elgg_echo('plugins:settings:save:ok'), $plugin_name));
forward($_SERVER['HTTP_REFERER']);
+//
+//$trigger = trigger_plugin_hook('plugin:save_settings', $plugin, $options, NULL);
+//if ($trigger === NULL) {
+// foreach ($params as $k => $v) {
+// if (!$result = set_plugin_setting($k, $v, $plugin)) {
+// register_error(sprintf(elgg_echo('plugins:settings:save:fail'), $plugin_name));
+// forward($_SERVER['HTTP_REFERER']);
+// exit;
+// }
+// }
+//} elseif ($trigger === FALSE) {
+// register_error(sprintf(elgg_echo('plugins:settings:save:fail'), $plugin_name));
+// forward($_SERVER['HTTP_REFERER']);
+//}
+//
+//system_message(sprintf(elgg_echo('plugins:settings:save:ok'), $plugin_name));
+//forward($_SERVER['HTTP_REFERER']); \ No newline at end of file