diff options
author | thomascube <thomas@roundcube.net> | 2011-07-17 19:00:30 +0000 |
---|---|---|
committer | thomascube <thomas@roundcube.net> | 2011-07-17 19:00:30 +0000 |
commit | 4d9f620292f9f22430a8d9e118e4853dc41d8def (patch) | |
tree | 54a33ed273ed46f3b24b5143d8b6d982940cec1b /program/include/rcube_ldap.php | |
parent | df853778cfe5190f8a0c5d2144cecb16b373e0cc (diff) |
Filter LDAP groups by search query
Diffstat (limited to 'program/include/rcube_ldap.php')
-rw-r--r-- | program/include/rcube_ldap.php | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/program/include/rcube_ldap.php b/program/include/rcube_ldap.php index 2fb25ab44..41d722e5b 100644 --- a/program/include/rcube_ldap.php +++ b/program/include/rcube_ldap.php @@ -1101,11 +1101,14 @@ class rcube_ldap extends rcube_addressbook for ($i=0; $i<$ldap_data["count"]; $i++) { $group_name = $ldap_data[$i]['cn'][0]; - $group_id = base64_encode($group_name); - $groups[$group_id]['ID'] = $group_id; - $groups[$group_id]['name'] = $group_name; - $groups[$group_id]['members'] = $ldap_data[$i]['member']; - $group_sortnames[] = strtolower($group_name); + if (!$search || strstr(strtolower($group_name), strtolower($search))) + { + $group_id = base64_encode($group_name); + $groups[$group_id]['ID'] = $group_id; + $groups[$group_id]['name'] = $group_name; + $groups[$group_id]['members'] = $ldap_data[$i]['member']; + $group_sortnames[] = strtolower($group_name); + } } array_multisort($group_sortnames, SORT_ASC, SORT_STRING, $groups); $this->group_cache = $groups; |