summaryrefslogtreecommitdiff
path: root/program/steps/settings/save_prefs.inc
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2011-04-11 11:12:00 +0000
committeralecpl <alec@alec.pl>2011-04-11 11:12:00 +0000
commitdae34b5c3f08d3045ab89631d3b59113df6568c8 (patch)
tree20fb6a1564068231a16e2dfdcc9d72fce4258bf7 /program/steps/settings/save_prefs.inc
parent1036f81edf2e23fe0052e5a8ba8002a8adcc4f9a (diff)
- Support 'abort' and 'result' response in 'preferences_save' hook, add error handling
Diffstat (limited to 'program/steps/settings/save_prefs.inc')
-rw-r--r--program/steps/settings/save_prefs.inc15
1 files changed, 11 insertions, 4 deletions
diff --git a/program/steps/settings/save_prefs.inc b/program/steps/settings/save_prefs.inc
index 64aeb5f81..92e2d8b9d 100644
--- a/program/steps/settings/save_prefs.inc
+++ b/program/steps/settings/save_prefs.inc
@@ -97,10 +97,10 @@ switch ($CURR_SECTION)
break;
}
-$data = rcmail::get_instance()->plugins->exec_hook('preferences_save',
+$plugin = rcmail::get_instance()->plugins->exec_hook('preferences_save',
array('prefs' => $a_user_prefs, 'section' => $CURR_SECTION));
-$a_user_prefs = $data['prefs'];
+$a_user_prefs = $plugin['prefs'];
// don't override these parameters
foreach ((array)$CONFIG['dont_override'] as $p)
@@ -159,10 +159,17 @@ switch ($CURR_SECTION)
break;
}
-if ($USER->save_prefs($a_user_prefs))
+// Save preferences
+if (!$plugin['abort'])
+ $saved = $USER->save_prefs($a_user_prefs);
+else
+ $saved = $plugin['result'];
+
+if ($saved)
$OUTPUT->show_message('successfullysaved', 'confirmation');
+else
+ $OUTPUT->show_message($plugin['message'] ? $plugin['message'] : 'errorsaving', 'error');
// display the form again
rcmail_overwrite_action('edit-prefs');
-