]> git.sur5r.net Git - contagged/blobdiff - inc/functions.php
Make it possible to show/edit user account entries
[contagged] / inc / functions.php
index bb24f23691114a22b7e5ff30d0729e96cb508ef1..e97472913ae63548089029ed1f66e09e9a10f8f5 100644 (file)
@@ -384,23 +384,37 @@ function ldap_queryabooks($filter,$types){
   $results = array();
   $result1 = array();
   $result2 = array();
+  $result3 = 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);
   }
 
+  // user account entries
+  if ($conf['displayusertree']) {
+    $sr      = @ldap_list($LDAP_CON,$conf['usertree'],
+                        $filter,$types);
+    tpl_ldaperror();
+    $result3 = ldap_get_binentries($LDAP_CON, $sr);
+    ldap_free_result($sr);
+  }
+
+
+
   // return merged results
-  return array_merge((array)$result1,(array)$result2);
+  return array_merge((array)$result1,(array)$result2,(array)$result3);
 }
 
 /**