From 265b36c9eb7071512ddefee50cc68af4fd787256 Mon Sep 17 00:00:00 2001 From: Miles Lott Date: Fri, 20 Feb 2004 16:47:06 +0000 Subject: [PATCH] Fix for BUG 900342 - determine preloaded query string which includes wildcards --- phpgwapi/inc/class.contacts_ldap.inc.php | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/phpgwapi/inc/class.contacts_ldap.inc.php b/phpgwapi/inc/class.contacts_ldap.inc.php index 322f109a3f..fe93da2e85 100644 --- a/phpgwapi/inc/class.contacts_ldap.inc.php +++ b/phpgwapi/inc/class.contacts_ldap.inc.php @@ -516,11 +516,25 @@ return $qarray; } + $first = $last = "*"; + if(strstr($query,"*")) + { + if(substr($query,-1) == "*") + { + $last = ''; + } + if(substr($query,1) == "*") + { + $first = ''; + } + } + if(@is_array($extra)) { if($DEBUG) { echo '
Searching...'; } foreach($extra as $name => $value) { + $qarray[] = array($value => $query); } } @@ -557,7 +571,7 @@ } else { - $oquery .= '(' . $x . '=*' . $y . '*)'; + $oquery .= '(' . $x . '=' . $first . $y . $last . ')'; $hasor = True; } } @@ -565,7 +579,7 @@ elseif($value == $query) { /* searching */ - $oquery .= '(' . $name . '=*' . $value . '*)'; + $oquery .= '(' . $name . '=' . $first . $value . $last . ')'; $hasor = True; } else @@ -615,6 +629,7 @@ echo '
Will search in "' . $GLOBALS['phpgw_info']['server']['ldap_contact_context'] . '"'; } +// echo $fquery; return $fquery; }