diff options
author | Thomas Bruederli <thomas@roundcube.net> | 2013-09-04 12:07:58 +0200 |
---|---|---|
committer | Thomas Bruederli <thomas@roundcube.net> | 2013-09-04 12:07:58 +0200 |
commit | 4f432f880afeb078c2b60ce594872ec3eb1713e7 (patch) | |
tree | e22e05892e7600bc762f101be2352a8f98a4a758 | |
parent | 460a3eaaac0ec17d04df310b0a696e39559c9446 (diff) |
Make result of rcmail::get_compose_responses() always an (indexed) array; add plugin hook for updating user prefs: 'preferences_update'
-rw-r--r-- | program/include/rcmail.php | 6 | ||||
-rw-r--r-- | program/lib/Roundcube/rcube_user.php | 12 |
2 files changed, 13 insertions, 5 deletions
diff --git a/program/include/rcmail.php b/program/include/rcmail.php index 62f6254b5..f58235cbf 100644 --- a/program/include/rcmail.php +++ b/program/include/rcmail.php @@ -355,6 +355,7 @@ class rcmail extends rcube */ public function get_compose_responses($sorted = false) { + $responses = array(); foreach ($this->config->get('compose_responses', array()) as $response) { if (empty($response['key'])) $response['key'] = substr(md5($response['name']), 0, 16); @@ -362,13 +363,12 @@ class rcmail extends rcube $responses[$k] = $response; } + // sort list by name if ($sorted) { - // sort list by name ksort($responses, SORT_LOCALE_STRING); - return array_values($responses); } - return $responses; + return array_values($responses); } diff --git a/program/lib/Roundcube/rcube_user.php b/program/lib/Roundcube/rcube_user.php index 5e9c9af80..57f63361d 100644 --- a/program/lib/Roundcube/rcube_user.php +++ b/program/lib/Roundcube/rcube_user.php @@ -163,8 +163,16 @@ class rcube_user if (!$this->ID) return false; - $config = $this->rc->config; - $old_prefs = (array)$this->get_prefs(); + $plugin = $this->rc->plugins->exec_hook('preferences_update', array( + 'userid' => $this->ID, 'prefs' => $a_user_prefs, 'old' => (array)$this->get_prefs())); + + if (!empty($plugin['abort'])) { + return; + } + + $a_user_prefs = $plugin['prefs']; + $old_prefs = $plugin['old']; + $config = $this->rc->config; // merge (partial) prefs array with existing settings $save_prefs = $a_user_prefs + $old_prefs; |