From 98b7b548a229600f7653cd67d9aae43675938143 Mon Sep 17 00:00:00 2001
From: Thomas Bruederli <thomas@roundcube.net>
Date: Fri, 25 Oct 2013 10:50:25 -0400
Subject: [PATCH] Merge branch 'dev-canned-responses'

---
 program/lib/Roundcube/rcube_user.php |   21 ++++++++++++++-------
 1 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/program/lib/Roundcube/rcube_user.php b/program/lib/Roundcube/rcube_user.php
index 505b190..57f6336 100644
--- a/program/lib/Roundcube/rcube_user.php
+++ b/program/lib/Roundcube/rcube_user.php
@@ -163,8 +163,16 @@
         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;
@@ -495,9 +503,9 @@
             "INSERT INTO ".$dbh->table_name('users').
             " (created, last_login, username, mail_host, language)".
             " VALUES (".$dbh->now().", ".$dbh->now().", ?, ?, ?)",
-            strip_newlines($data['user']),
-            strip_newlines($data['host']),
-            strip_newlines($data['language']));
+            $data['user'],
+            $data['host'],
+            $data['language']);
 
         if ($user_id = $dbh->insert_id('users')) {
             // create rcube_user instance to make plugin hooks work
@@ -517,7 +525,7 @@
                 if (empty($user_email)) {
                     $user_email = strpos($data['user'], '@') ? $user : sprintf('%s@%s', $data['user'], $mail_domain);
                 }
-                $email_list[] = strip_newlines($user_email);
+                $email_list[] = $user_email;
             }
             // identities_level check
             else if (count($email_list) > 1 && $rcube->config->get('identities_level', 0) > 1) {
@@ -547,7 +555,6 @@
                     $record['name'] = $user_name != $record['email'] ? $user_name : '';
                 }
 
-                $record['name']     = strip_newlines($record['name']);
                 $record['user_id']  = $user_id;
                 $record['standard'] = $standard;
 

--
Gitblit v1.9.1