diff options
author | Thomas Bruederli <bruederli@kolabsys.com> | 2012-11-06 21:02:23 +0100 |
---|---|---|
committer | Thomas Bruederli <bruederli@kolabsys.com> | 2012-11-06 21:02:23 +0100 |
commit | a5c8786a34be237a3436b3c96d283462e76a5c3a (patch) | |
tree | eb9f75b84c95f8a46061f8ac5ba2f18267f347fc /program | |
parent | f9a25bd418fb526f0744bbfb1f2c4ffc6e843d03 (diff) | |
parent | b1263ab253a83d16f444ffbf21836b7bbe389cb3 (diff) |
Merge branch 'release-0.7' of github.com:roundcube/roundcubemail into release-0.7
Diffstat (limited to 'program')
-rw-r--r-- | program/include/rcube_addressbook.php | 5 | ||||
-rw-r--r-- | program/include/rcube_ldap.php | 36 | ||||
-rw-r--r-- | program/include/rcube_mdb2.php | 6 |
3 files changed, 27 insertions, 20 deletions
diff --git a/program/include/rcube_addressbook.php b/program/include/rcube_addressbook.php index f6de6d70e..9ebd37f0b 100644 --- a/program/include/rcube_addressbook.php +++ b/program/include/rcube_addressbook.php @@ -431,6 +431,11 @@ abstract class rcube_addressbook } } + // remove duplicates + if ($flat && !empty($out)) { + $out = array_unique($out); + } + return $out; } diff --git a/program/include/rcube_ldap.php b/program/include/rcube_ldap.php index e3e7a87a0..14c59dd57 100644 --- a/program/include/rcube_ldap.php +++ b/program/include/rcube_ldap.php @@ -770,24 +770,26 @@ class rcube_ldap extends rcube_addressbook for ($i = 0; $i < $entries['count']; $i++) { $rec = $this->_ldap2result($entries[$i]); - foreach (array('email', 'name') as $f) { - $val = mb_strtolower($rec[$f]); - switch ($mode) { - case 1: - $got = ($val == $search); - break; - case 2: - $got = ($search == substr($val, 0, strlen($search))); - break; - default: - $got = (strpos($val, $search) !== false); - break; - } + foreach ($fields as $f) { + foreach ((array)$rec[$f] as $val) { + $val = mb_strtolower($val); + switch ($mode) { + case 1: + $got = ($val == $search); + break; + case 2: + $got = ($search == substr($val, 0, strlen($search))); + break; + default: + $got = (strpos($val, $search) !== false); + break; + } - if ($got) { - $this->result->add($rec); - $this->result->count++; - break; + if ($got) { + $this->result->add($rec); + $this->result->count++; + break 2; + } } } } diff --git a/program/include/rcube_mdb2.php b/program/include/rcube_mdb2.php index 26e5e974a..9f56118d5 100644 --- a/program/include/rcube_mdb2.php +++ b/program/include/rcube_mdb2.php @@ -197,7 +197,7 @@ class rcube_mdb2 */ function is_connected() { - return PEAR::isError($this->db_handle) ? false : $this->db_connected; + return is_a($this->db_handle, 'PEAR_Error') ? false : $this->db_connected; } @@ -285,7 +285,7 @@ class rcube_mdb2 else { $params = (array)$params; $q = $this->db_handle->prepare($query, null, $mode=='w' ? MDB2_PREPARE_MANIP : null); - if ($this->db_handle->isError($q)) { + if (MDB2::isError($q)) { $this->db_error = true; $this->db_error_msg = $q->userinfo; @@ -366,7 +366,7 @@ class rcube_mdb2 $id = $this->db_handle->lastInsertID($table); - return $this->db_handle->isError($id) ? null : $id; + return MDB2::isError($id) ? null : $id; } |