From 72c7226558c954e5bdac0ab363d7b3f4542a5296 Mon Sep 17 00:00:00 2001 From: thomascube <thomas@roundcube.net> Date: Thu, 28 Feb 2008 15:01:57 -0500 Subject: [PATCH] Applied patch by Emanuele Rocca to make LDAP filters work with or without brackets --- program/include/rcube_ldap.inc | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/program/include/rcube_ldap.inc b/program/include/rcube_ldap.inc index 6083652..29e7faa 100644 --- a/program/include/rcube_ldap.inc +++ b/program/include/rcube_ldap.inc @@ -285,9 +285,12 @@ } $filter .= ')'; + // avoid double-wildcard if $value is empty + $filter = preg_replace('/\*+/', '*', $filter); + // add general filter to query if (!empty($this->prop['filter'])) - $filter = '(&('.$this->prop['filter'] .')' . $filter . ')'; + $filter = '(&(' . preg_replace('/^\(|\)$/', '', $this->prop['filter']) . ')' . $filter . ')'; // set filter string and execute search $this->set_search_set($filter); -- Gitblit v1.9.1