$smarty->assign('org',$_REQUEST['org']);
//display templates
if(!empty($_REQUEST['export'])){
- if ($conf['userlogreq'] == 1 && $user == ''){
- header("HTTP/1.1 401 ACCESS DENIED");
+ if ($conf['userlogreq'] && $user == ''){
+ header("HTTP/1.1 401 Access Denied");
+ echo '<h1>Access Denied</h1>';
exit();
}
*/
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)){