From 639a825b2ebdb16fe6e9725bde00f7baa31ae434 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Tue, 16 Oct 2012 17:55:55 +0200 Subject: Fix post-filtering vlv results, fixes warning "mb_strtolower() expects parameter 1 to be a string, array given" Conflicts: program/include/rcube_ldap.php --- program/include/rcube_ldap.php | 36 +++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) (limited to 'program/include') diff --git a/program/include/rcube_ldap.php b/program/include/rcube_ldap.php index fef940d8a..999f56cfb 100644 --- a/program/include/rcube_ldap.php +++ b/program/include/rcube_ldap.php @@ -772,24 +772,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; + } } } } -- cgit v1.2.3 From 76d3b4714564d9c68855fca95ae7e09933287c31 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Tue, 16 Oct 2012 18:18:48 +0200 Subject: Workaround possible PHP Fatal error: Class 'PEAR' not found --- program/include/rcube_mdb2.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'program/include') diff --git a/program/include/rcube_mdb2.php b/program/include/rcube_mdb2.php index 26e5e974a..67785bfcb 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; } -- cgit v1.2.3 From b39e8e4174e5bb7abb89f7a645b6b106b7ec95f2 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Tue, 2 Oct 2012 19:16:30 +0200 Subject: Remove duplicates from get_col_values() result in flat mode --- program/include/rcube_addressbook.php | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'program/include') 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; } -- cgit v1.2.3 From ccbf0da6eb99d1fdd8edf7114fc6e1a2c1071de0 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Mon, 29 Oct 2012 09:22:33 +0100 Subject: fix call to MDB2::isError for MDB2 2.5.0b4 --- program/include/rcube_mdb2.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'program/include') diff --git a/program/include/rcube_mdb2.php b/program/include/rcube_mdb2.php index 67785bfcb..9f56118d5 100644 --- a/program/include/rcube_mdb2.php +++ b/program/include/rcube_mdb2.php @@ -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; } -- cgit v1.2.3