diff --git a/htdocs/admin/ldap.php b/htdocs/admin/ldap.php
index 3590b746d7d..efcb1dde463 100644
--- a/htdocs/admin/ldap.php
+++ b/htdocs/admin/ldap.php
@@ -117,6 +117,14 @@ if ($_GET["action"] == 'setvalue' && $user->admin)
('LDAP_CONTACT_DN','".$_POST["contact"]."',0);";
$db->query($sql);
+ $sql = "DELETE FROM ".MAIN_DB_PREFIX."const WHERE name = 'LDAP_SERVER_PROTOCOLVERSION';";
+ $db->query($sql);
+
+ $sql = "INSERT INTO ".MAIN_DB_PREFIX."const (name,value,visible) VALUES
+ ('LDAP_SERVER_PROTOCOLVERSION','".$_POST["version"]."',0);";
+ $db->query($sql);
+
+
$sql = "DELETE FROM ".MAIN_DB_PREFIX."const WHERE name = 'LDAP_SERVER_TYPE';";
$db->query($sql);
@@ -148,90 +156,92 @@ print '
'.$langs->trans("Parameter").' | ';
print ''.$langs->trans("Value").' | | ';
print "\n";
- if (defined("LDAP_SERVER_HOST") && LDAP_SERVER_HOST)
- {
- print '| '.$langs->trans("LDAPServer").' | '.LDAP_SERVER_HOST.' |
';
- }
+if (defined("LDAP_SERVER_HOST") && LDAP_SERVER_HOST)
+{
+ print '| '.$langs->trans("LDAPServer").' | '.LDAP_SERVER_HOST.' |
';
+}
+else
+{
+ print '| '.$langs->trans("LDAPServer").' | '.$langs->trans("LDAPServerExample").' |
';
+}
+if (defined("LDAP_SERVER_PORT") && LDAP_SERVER_PORT)
+{
+ print '| '.$langs->trans("LDAPServerPort").' | '.LDAP_SERVER_PORT.' |
';
+}
+else
+{
+ print '| '.$langs->trans("LDAPServerPort").' | '.$langs->trans("LDAPServerPortExample").' |
';
+}
+
+//suppression pour compatibilité divers config ldap
+//
+//if (defined("LDAP_SUFFIX_DN") && LDAP_SUFFIX_DN)
+//{
+// print '| '.$langs->trans("LDAPSuffix").' | '.LDAP_SUFFIX_DN.' |
';
+//}
+//else
+//{
+// print '| '.$langs->trans("LDAPSuffix").' | '.$langs->trans("LDAPSuffixExample").' |
';
+//}
+
+if (defined("LDAP_ADMIN_DN") && LDAP_ADMIN_DN)
+{
+ print '| '.$langs->trans("DNAdmin").' | '.LDAP_ADMIN_DN.' |
';
+}
+else
+{
+ print '| '.$langs->trans("DNAdmin").' | '.$langs->trans("DNAdminExample").' |
';
+}
+if (defined("LDAP_ADMIN_PASS") && LDAP_ADMIN_PASS)
+{
+ print '| '.$langs->trans("LDAPPassword").' | ******** |
';
+}
+else
+{
+ print '| '.$langs->trans("LDAPPassword").' | '.$langs->trans("LDAPPasswordExample").' |
';
+}
+if (defined("LDAP_USER_DN") && LDAP_USER_DN)
+{
+ print '| '.$langs->trans("DNUser").' | '.LDAP_USER_DN.' |
';
+}
+else
+{
+ print '| '.$langs->trans("DNUser").' | '.$langs->trans("DNUserExample").' |
';
+}
+if (defined("LDAP_GROUP_DN") && LDAP_GROUP_DN)
+{
+ print '| '.$langs->trans("DNGroup").' | '.LDAP_GROUP_DN.' |
';
+}
+else
+{
+ print '| '.$langs->trans("DNGroup").' | '.$langs->trans("DNGroupExample").' |
';
+}
+if (defined("LDAP_CONTACT_ACTIVE") && LDAP_CONTACT_ACTIVE)
+{
+ print '| '.$langs->trans("DNContactActive").' | '.$langs->trans("DNContactActiveYes").' |
';
+}
+else
+{
+ print '| '.$langs->trans("DNContactActive").' | '.$langs->trans("DNContactActiveExample").' |
';
+}
+if (defined("LDAP_CONTACT_DN") && LDAP_CONTACT_DN)
+{
+ print '| '.$langs->trans("DNContact").' | '.LDAP_CONTACT_DN.' |
';
+}
+else
+{
+ print '| '.$langs->trans("DNContact").' | '.$langs->trans("DNContactExample").' |
';
+}
+if (defined("LDAP_SERVER_TYPE") && LDAP_SERVER_TYPE)
+{
+ print '| '.$langs->trans("Type").' | '.LDAP_SERVER_TYPE.' |
';
+}
else
- {
- print '| '.$langs->trans("LDAPServer").' | '.$langs->trans("LDAPServerExample").' |
';
- }
- if (defined("LDAP_SERVER_PORT") && LDAP_SERVER_PORT)
- {
- print '| '.$langs->trans("LDAPServerPort").' | '.LDAP_SERVER_PORT.' |
';
- }
- else
- {
- print '| '.$langs->trans("LDAPServerPort").' | '.$langs->trans("LDAPServerPortExample").' |
';
- }
-
- //suppression pour compatibilité divers config ldap
- //
- //if (defined("LDAP_SUFFIX_DN") && LDAP_SUFFIX_DN)
- //{
- // print '| '.$langs->trans("LDAPSuffix").' | '.LDAP_SUFFIX_DN.' |
';
- //}
- //else
- //{
- // print '| '.$langs->trans("LDAPSuffix").' | '.$langs->trans("LDAPSuffixExample").' |
';
- //}
-
- if (defined("LDAP_ADMIN_DN") && LDAP_ADMIN_DN)
- {
- print '| '.$langs->trans("DNAdmin").' | '.LDAP_ADMIN_DN.' |
';
- }
- else
- {
- print '| '.$langs->trans("DNAdmin").' | '.$langs->trans("DNAdminExample").' |
';
- }
- if (defined("LDAP_ADMIN_PASS") && LDAP_ADMIN_PASS)
- {
- print '| '.$langs->trans("LDAPPassword").' | ******** |
';
- }
- else
- {
- print '| '.$langs->trans("LDAPPassword").' | '.$langs->trans("LDAPPasswordExample").' |
';
- }
- if (defined("LDAP_USER_DN") && LDAP_USER_DN)
- {
- print '| '.$langs->trans("DNUser").' | '.LDAP_USER_DN.' |
';
- }
- else
- {
- print '| '.$langs->trans("DNUser").' | '.$langs->trans("DNUserExample").' |
';
- }
- if (defined("LDAP_GROUP_DN") && LDAP_GROUP_DN)
- {
- print '| '.$langs->trans("DNGroup").' | '.LDAP_GROUP_DN.' |
';
- }
- else
- {
- print '| '.$langs->trans("DNGroup").' | '.$langs->trans("DNGroupExample").' |
';
- }
- if (defined("LDAP_CONTACT_ACTIVE") && LDAP_CONTACT_ACTIVE)
- {
- print '| '.$langs->trans("DNContactActive").' | '.$langs->trans("DNContactActiveYes").' |
';
- }
- else
- {
- print '| '.$langs->trans("DNContactActive").' | '.$langs->trans("DNContactActiveExample").' |
';
- }
- if (defined("LDAP_CONTACT_DN") && LDAP_CONTACT_DN)
- {
- print '| '.$langs->trans("DNContact").' | '.LDAP_CONTACT_DN.' |
';
- }
- else
- {
- print '| '.$langs->trans("DNContact").' | '.$langs->trans("DNContactExample").' |
';
- }
- if (defined("LDAP_SERVER_TYPE") && LDAP_SERVER_TYPE)
- {
- print '| '.$langs->trans("Type").' | '.LDAP_SERVER_TYPE.' |
';
- }
- else
- {
- print '| '.$langs->trans("Type").' | '.$langs->trans("TypeExample").' |
';
- }
+{
+ print '| '.$langs->trans("Type").' | '.$langs->trans("TypeExample").' |
';
+}
+
+print '| '.$langs->trans("Version").' | '.LDAP_SERVER_PROTOCOLVERSION.' |
';
print '';
@@ -255,11 +265,11 @@ print '';
print '| '.$langs->trans("LDAPServerPort").' | ';
if (defined("LDAP_SERVER_PORT") && LDAP_SERVER_PORT)
{
- print '';
+ print '';
}
else
{
- print '';
+ print '';
}
print ' |
';
@@ -279,7 +289,7 @@ if (defined("LDAP_ADMIN_PASS") && LDAP_ADMIN_PASS)
}
else
{
- print '';
+ print '';
}
print '';
print '| '.$langs->trans("DNUser").' | ';
@@ -291,7 +301,7 @@ print ' |
';
print '| '.$langs->trans("DNContactActive").' | |
';
print '| '.$langs->trans("Type").' | ';
print ' |
';
+print '| '.$langs->trans("Version").' | ';
+print ' |
';
+
print ' |
';
print '';
@@ -347,51 +373,62 @@ if (defined("LDAP_SERVER_HOST") && LDAP_SERVER_HOST) {
if (defined("LDAP_SERVER_HOST") && LDAP_SERVER_HOST && LDAP_ADMIN_DN && LDAP_ADMIN_PASS && $_GET["action"] == 'test')
{
$ds = dolibarr_ldap_connect();
-/*
+
if ($ds)
{
- print "connexion au serveur ldap réussie
";
+ print img_picto('','info');
+ print "connexion au serveur ldap réussie
";
}
- else
+ else
{
- print "connexion au serveur ldap échouée";
- print img_picto('','alerte');
- print "
";
+ print img_picto('','alerte');
+
+ print "connexion au serveur ldap échouée";
+ print "
";
+ print ldap_error($ds);
+ print "
";
}
- if ((dolibarr_ldap_getversion($ds) == 3))
- {
- print "Serveur ldap configuré en version 3
";
- }
- else
- {
- print "Serveur ldap configuré en version 2
";
- }
-*/
- $bind = @dolibarr_ldap_bind($ds);
+ if ((dolibarr_ldap_getversion($ds) == 3))
+ {
+ print img_picto('','info');
+ print "Serveur ldap configuré en version 3
";
+ }
+ else
+ {
+ print img_picto('','info');
+ print "Serveur ldap configuré en version 2
";
+ }
+
+ $bind = @dolibarr_ldap_bind($ds);
+
+ if ($bind)
+ {
+ print img_picto('','info');
+ print "connexion au dn $dn réussi
";
+ }
+ else
+ {
+ print img_picto('','alerte');
- if ($bind)
- {
- print "connexion au dn $dn réussi
";
- }
- else
- {
- print "connexion au dn $dn raté";
- print img_picto('','alerte');
- print "
";
- }
+ print "connexion au dn $dn raté : ";
+ print ldap_error($ds);
+ print "
";
+ }
+
+ $unbind = @dolibarr_ldap_unbind($ds);
+
+ if ($bind)
+ {
+ print img_picto('','info');
+ print "déconnection du dn $dn réussi
";
+ }
+ else
+ {
+ print img_picto('','alerte');
- $unbind = @dolibarr_ldap_unbind($ds);
-
- if ($bind)
- {
- print "déconnection du dn $dn réussi
";
- }
- else
- {
- print "déconnection du dn $dn raté";
- print img_picto('','alerte');
- print "
";
- }
+ print "déconnection du dn $dn raté";
+ print "
";
+ }
}
$db->close();