From 62afb3da4b912517f980ba543da06d5939ecd5a8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 8 Jan 2012 18:37:29 +0100 Subject: [PATCH] Fix: wrong field to show password --- htdocs/adherents/ldap.php | 61 ++++++++++++++++++++++----------------- 1 file changed, 35 insertions(+), 26 deletions(-) diff --git a/htdocs/adherents/ldap.php b/htdocs/adherents/ldap.php index 957b8798e93..39a00c6444e 100644 --- a/htdocs/adherents/ldap.php +++ b/htdocs/adherents/ldap.php @@ -34,9 +34,10 @@ $langs->load("members"); $langs->load("ldap"); $langs->load("admin"); -// Protection quand utilisateur externe -$rowid = isset($_GET["id"])?$_GET["id"]:''; +$rowid = GETPOST("id"); +$action = GETPOST('action'); +// Protection $socid=0; if ($user->societe_id > 0) { @@ -52,11 +53,12 @@ if (! $result) exit; } + /* * Actions */ -if ($_GET["action"] == 'dolibarr2ldap') +if ($action == 'dolibarr2ldap') { $message=""; @@ -121,7 +123,7 @@ print ''.$langs->trans("Login").''.$adh->login.' if ($conf->global->LDAP_MEMBER_FIELD_PASSWORD) { print ''.$langs->trans("LDAPFieldPasswordNotCrypted").''; - print ''.$fuser->pass.''; + print ''.$adh->pass.''; print "\n"; } @@ -129,7 +131,7 @@ if ($conf->global->LDAP_MEMBER_FIELD_PASSWORD) if ($conf->global->LDAP_MEMBER_FIELD_PASSWORD_CRYPTED) { print ''.$langs->trans("LDAPFieldPasswordCrypted").''; - print ''.$fuser->pass_crypted.''; + print ''.$adh->pass_crypted.''; print "\n"; } @@ -194,26 +196,35 @@ if ($result > 0) $info=$adh->_load_ldap_info(); $dn=$adh->_load_ldap_dn($info,1); $search = "(".$adh->_load_ldap_dn($info,2).")"; - $records=$ldap->getAttribute($dn,$search); - //print_r($records); + if (empty($dn)) + { + $langs->load("errors"); + print ''.$langs->trans("ErrorModuleSetupNotComplete").''; + } + else + { + $records=$ldap->getAttribute($dn,$search); - // Affichage arbre - if (count($records) && $records != false && (! isset($records['count']) || $records['count'] > 0)) - { - if (! is_array($records)) - { - print ''.$langs->trans("ErrorFailedToReadLDAP").''; - } - else - { - $result=show_ldap_content($records,0,$records['count'],true); - } - } - else - { - print ''.$langs->trans("LDAPRecordNotFound").' (dn='.$dn.' - search='.$search.')'; - } + //print_r($records); + + // Affichage arbre + if (count($records) && $records != false && (! isset($records['count']) || $records['count'] > 0)) + { + if (! is_array($records)) + { + print ''.$langs->trans("ErrorFailedToReadLDAP").''; + } + else + { + $result=show_ldap_content($records,0,$records['count'],true); + } + } + else + { + print ''.$langs->trans("LDAPRecordNotFound").' (dn='.$dn.' - search='.$search.')'; + } + } $ldap->unbind(); $ldap->close(); @@ -227,9 +238,7 @@ else print ''; - +llxFooter(); $db->close(); - -llxFooter(); ?>