From: Nicolas Boisselier Date: Tue, 12 Dec 2017 06:08:53 +0000 (+0000) Subject: lib/php/nb.php X-Git-Url: https://git.nbdom.net/?a=commitdiff_plain;h=5ba05dc0ed56c6679a19e2efe1e96134391cd501;p=nb.git lib/php/nb.php --- diff --git a/lib/php/nb.php b/lib/php/nb.php index d86e865e..fdcb3ee9 100644 --- a/lib/php/nb.php +++ b/lib/php/nb.php @@ -1084,20 +1084,29 @@ class NB { $bind = ldap_bind($connect, $ldap_user, $ldap_pass) or exit(">>Could not bind to $ldap_host<<"); $read = ldap_search($connect, $base_dn, $filter) or exit(">>Unable to search ldap server<<"); $info = ldap_get_entries($connect, $read); - #return $info; #echo $info["count"]." entries returned

/"; $recs = []; for ($r=0; $r<$info["count"]; $r++){ $rec = $info[$r]; + for ($i=0; $i<$rec["count"]; $i++){ + # Fields $key = $info[$r][$i]; if (!empty($keys) and !in_array($key,$keys)) continue; - $recs[$r][$key] = $info[$i][$key][0]; + $recs[$r][$key] = []; + + # Values + for ($j=0; $j<$info[$i][$key]['count']; $j++){ + $recs[$r][$key][] = $info[$i][$key][$j]; + } + if (count($recs[$r][$key]) == 1) $recs[$r][$key] = $recs[$r][$key][0]; + } } ldap_close($connect); + #return $info; return $recs; } # < ldap_search