]> git.sur5r.net Git - contagged/blobdiff - inc/functions.php
Make it possible to disable private contacts
[contagged] / inc / functions.php
index 617888d7d86dadc1e18da2d9417d0b7dafc53d6f..a5e0631cf46d7dad051abc732773402e9e5364af 100644 (file)
@@ -67,7 +67,7 @@ function do_ldap_bind($user,$pass,$dn=""){
   if(empty($dn)){
     //anonymous bind to lookup users
     //blank binddn or blank bindpw will result in anonymous bind
-    if(!ldap_bind($LDAP_CON,$conf['anonbinddn'],$conf['anonbindpw'])){
+    if(!@ldap_bind($LDAP_CON,$conf['anonbinddn'],$conf['anonbindpw'])){
       die("can not bind for user lookup");
     }
 
@@ -89,7 +89,7 @@ function do_ldap_bind($user,$pass,$dn=""){
   }
 
   //bind with dn
-  if(ldap_bind($LDAP_CON,$dn,$pass)){
+  if(@ldap_bind($LDAP_CON,$dn,$pass)){
     //bind successful -> set up session
     set_session($user,$pass,$dn);
     return true;
@@ -234,6 +234,15 @@ function prepare_ldap_entry($in){
     }
   }
 
+  // special tag handling for Thunderbird
+  if($conf['tbtaghack'] && in_array('contactPerson',$OCLASSES)){
+    if($in['marker'][0]) $out['custom1'][] = $in['marker'][0];
+    if($in['marker'][1]) $out['custom2'][] = $in['marker'][1];
+    if($in['marker'][2]) $out['custom3'][] = $in['marker'][2];
+    if($in['marker'][3]) $out['custom4'][] = $in['marker'][3];
+  }
+
+
   // add the Objectclasses
   $out['objectclass'] = $OCLASSES;
 
@@ -377,16 +386,18 @@ function ldap_queryabooks($filter,$types){
   $result2 = array();
 
   // public addressbook
-  $sr      = ldap_list($LDAP_CON,$conf['publicbook'],
-                       $filter,$types);
+  $sr      = @ldap_list($LDAP_CON,$conf['publicbook'],
+                        $filter,$types);
+  tpl_ldaperror();
   $result1 = ldap_get_binentries($LDAP_CON, $sr);
   ldap_free_result($sr);
 
   // private addressbook
-  if(!empty($_SESSION['ldapab']['binddn'])){
+  if(!empty($_SESSION['ldapab']['binddn']) && $conf['privatebook']){
     $sr      = @ldap_list($LDAP_CON,$conf['privatebook'].
                           ','.$_SESSION['ldapab']['binddn'],
                           $filter,$types);
+    if(ldap_errno($LDAP_CON) != 32) tpl_ldaperror(); // ignore missing address book
     $result2 = ldap_get_binentries($LDAP_CON, $sr);
   }