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();
?>