From 028734b25cfa2ee30a129710db0440617f9f3095 Mon Sep 17 00:00:00 2001 From: Thomas Bruederli Date: Mon, 18 Aug 2014 17:21:03 +0200 Subject: Make LDAP errors available to the application --- program/lib/Roundcube/rcube_ldap.php | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'program/lib/Roundcube/rcube_ldap.php') diff --git a/program/lib/Roundcube/rcube_ldap.php b/program/lib/Roundcube/rcube_ldap.php index 274616a1f..6805c4902 100644 --- a/program/lib/Roundcube/rcube_ldap.php +++ b/program/lib/Roundcube/rcube_ldap.php @@ -906,7 +906,6 @@ class rcube_ldap extends rcube_addressbook return $this->result; } - /** * Get a specific contact record * @@ -948,6 +947,23 @@ class rcube_ldap extends rcube_addressbook return $assoc ? $res : $this->result; } + /** + * Returns the last error occurred (e.g. when updating/inserting failed) + * + * @return array Hash array with the following fields: type, message + */ + function get_error() + { + $err = $this->error; + + // check ldap connection for errors + if (!$err && $this->ldap->get_error()) { + $err = array(self::ERROR_SEARCH, $this->ldap->get_error()); + } + + return $err; + } + /** * Check the given data before saving. @@ -1609,7 +1625,7 @@ class rcube_ldap extends rcube_addressbook if ($search) { foreach ($group_cache as $group) { - if ($this->compare_search_value('name', $group['name'], $search, $mode)) { + if ($this->compare_search_value('name', $group['name'], mb_strtolower($search), $mode)) { $groups[] = $group; } } -- cgit v1.2.3