// Where to store private contacts (relative to $conf['usertree'])
$conf['privatebook'] = 'ou=contacts';
+ // What fields to look at when searching?
+ $conf['searchfields'] = array('uid','mail','name','givenname','o');
+
// Should the public address book be viewable by logged in users only? (0|1)
$conf['userlogreq'] = 0;
*/
function _makeldapfilter(){
global $FIELDS;
+ global $conf;
//handle given filter
$words=preg_split('/\s+/',$search);
$filter='';
foreach($words as $word){
- $filter .= '(|(|('.$FIELDS['name'].'=*'.$word.'*)('.
- $FIELDS['givenname'].'=*'.$word.'*))('.
- $FIELDS['organization'].'=*'.$word.'*))';
+ $wordfilter='';
+ foreach($conf['searchfields'] as $field) {
+ $wordfilter .= '('.$field.'=*'.$word.'*)';
+ }
+ for($i=0; $i <count($conf['searchfields']); $i++){
+ $wordfilter = '(|'.$wordfilter.')';
+ }
+ $filter .= '(&'.$wordfilter.')';
}
$ldapfilter = "(&(objectClass=inetOrgPerson)$filter)";
}elseif(!empty($org)){