]> git.sur5r.net Git - contagged/blobdiff - index.php
fix missing space in company address
[contagged] / index.php
index e41237a56767aaa3517a7df551707844fc55b468..ef38ad4fd66f4e3d7790466238e295ce12be0de3 100644 (file)
--- a/index.php
+++ b/index.php
@@ -48,8 +48,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 '<h1>Access Denied</h1>';
       exit();
     }
 
       $smarty->display('list_csv.tpl');
       exit;
     }elseif($_REQUEST['export'] == 'map'){
+        require_once 'inc/Geocoder.php';
+        $geocoder = new Geocoder();
+        $coords = array();
+        foreach ($result as $ldapEntry) {
+            tpl_entry($ldapEntry);
+            $entry = $smarty->get_template_vars('entry');
+            addCoords($coords, $entry, $geocoder);
+        }
+        $smarty->assign('coords', $coords);
+
       header('Content-Type: text/html; charset=utf-8');
       $smarty->display('list_map.tpl');
       exit;
    */
   function _makeldapfilter(){
     global $FIELDS;
+    global $conf;
 
     //handle given filter
 
 
     if(!empty($marker)){
       // Search by tag
-      $ldapfilter = '(&(objectClass=contactPerson)';
+      $ldapfilter = '(&(objectClass=evolutionPerson)';
       $marker = explode(',',$marker);
       foreach($marker as $m){
         $m = trim($m);
       $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)){