X-Git-Url: https://git.sur5r.net/?p=contagged;a=blobdiff_plain;f=index.php;h=5a9ab819da54fab7dd2615819abf63be3d31c1bf;hp=e41237a56767aaa3517a7df551707844fc55b468;hb=HEAD;hpb=94a175c653bdc28a698830b8c2298a214d79defc diff --git a/index.php b/index.php index e41237a..5a9ab81 100644 --- a/index.php +++ b/index.php @@ -12,6 +12,8 @@ $entrytpl = 'list_entry.tpl'; } + tpl_std(); + // check which fields are needed $fields = get_fields_from_template($entrytpl); @@ -37,7 +39,6 @@ } //prepare templates - tpl_std(); if (empty($_REQUEST['filter'])) $_REQUEST['filter']=''; if (empty($_REQUEST['marker'])) $_REQUEST['marker']=''; if (empty($_REQUEST['search'])) $_REQUEST['search']=''; @@ -48,8 +49,9 @@ $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 '

Access Denied

'; exit(); } @@ -93,6 +95,7 @@ */ function _makeldapfilter(){ global $FIELDS; + global $conf; //handle given filter @@ -110,7 +113,7 @@ if(!empty($marker)){ // Search by tag - $ldapfilter = '(&(objectClass=contactPerson)'; + $ldapfilter = '(&( |(objectClass=evolutionPerson)(objectClass=contactPerson) )'; $marker = explode(',',$marker); foreach($marker as $m){ $m = trim($m); @@ -142,9 +145,14 @@ $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