From f7eb585db55087413432b52b406f0805177fe143 Mon Sep 17 00:00:00 2001 From: kkalev Date: Wed, 2 Oct 2002 09:15:11 +0000 Subject: [PATCH] Allow for multiple regular profile attributes in a user entry. --- Changelog | 1 + lib/ldap/defaults.php3 | 34 ++++++++++++++++++---------------- 2 files changed, 19 insertions(+), 16 deletions(-) diff --git a/Changelog b/Changelog index aaeb882..a6c7901 100644 --- a/Changelog +++ b/Changelog @@ -21,6 +21,7 @@ Ver 1.60: user_finger somewhat faster. * Fix a small issue with the general_accounting_info_order * Fix a problem in failed_logins when NASIPAddress is not set. +* Allow for multiple regular profile attributes in a user entry. Ver 1.59: * Small html fixes in user_edit.php3 and password.php3 * Show number of failed logins in the last 7 days in the user admin page diff --git a/lib/ldap/defaults.php3 b/lib/ldap/defaults.php3 index 4169d8a..c1196eb 100644 --- a/lib/ldap/defaults.php3 +++ b/lib/ldap/defaults.php3 @@ -27,23 +27,25 @@ if ($config[ldap_default_dn] != ''){ $get_attrs = array("$regular_profile_attr"); $sr=@ldap_search($ds,"$config[ldap_base]","uid=" . $login,$get_attrs); if ($info = @ldap_get_entries($ds,$sr)){ - $dn2 = $info[0][$regular_profile_attr][0]; - if ($dn2 != ''){ - $sr2=@ldap_search($ds,"$dn2",'objectclass=*'); - if ($info2 = @ldap_get_entries($ds,$sr2)){ - $dn3 = $info2[0]['dn']; - if ($dn3 != ''){ - foreach($attrmap as $key => $val){ - if ($info2[0]["$val"][0] != '' && $key != 'Dialup-Access'){ - if (!isset($default_vals["$key"])) - $default_vals["$key"] = array(); - if ($attrmap[generic]["$key"] == 'generic'){ - for($i=0;$i<$info2[0]["$val"][count];$i++) - $default_vals["$key"][] = $info2[0]["$val"][$i]; - $default_vals["$key"][count] += $info2[0]["$val"][count]; + for($i=0;$i<$info[0][$regular_profile_attr]["count"];$i++){ + $dn2 = $info[0][$regular_profile_attr][$i]; + if ($dn2 != ''){ + $sr2=@ldap_search($ds,"$dn2",'objectclass=*'); + if ($info2 = @ldap_get_entries($ds,$sr2)){ + $dn3 = $info2[0]['dn']; + if ($dn3 != ''){ + foreach($attrmap as $key => $val){ + if ($info2[0]["$val"][0] != '' && $key != 'Dialup-Access'){ + if (!isset($default_vals["$key"])) + $default_vals["$key"] = array(); + if ($attrmap[generic]["$key"] == 'generic'){ + for($i=0;$i<$info2[0]["$val"][count];$i++) + $default_vals["$key"][] = $info2[0]["$val"][$i]; + $default_vals["$key"][count] += $info2[0]["$val"][count]; + } + else + $default_vals["$key"] = $info2[0]["$val"]; } - else - $default_vals["$key"] = $info2[0]["$val"]; } } } -- 2.39.5