From 777ef01c0a83b7a8c5d909a38e6ec0ecf6e295ec Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Mon, 12 Jun 2006 14:05:23 +0000 Subject: [PATCH] =?UTF-8?q?d=E9but=20am=E9lioration=20LDAP?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/admin/ldap.php | 11 ++++++----- htdocs/lib/ldap.lib.php | 16 +++++++++++++++- 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/htdocs/admin/ldap.php b/htdocs/admin/ldap.php index 27a84a5dedb..0dc997cc1f0 100644 --- a/htdocs/admin/ldap.php +++ b/htdocs/admin/ldap.php @@ -261,8 +261,9 @@ if (function_exists("ldap_connect")) if ($conf->global->LDAP_SERVER_HOST && $conf->global->LDAP_ADMIN_DN && $conf->global->LDAP_ADMIN_PASS && $_GET["action"] == 'test') { + $ldap = new Ldap(); // Test ldap_connect - $ds = dolibarr_ldap_connect(); + $ds = $ldap->dolibarr_ldap_connect(); if ($ds) { print img_picto('','info'); @@ -280,7 +281,7 @@ if (function_exists("ldap_connect")) if ($ds) { // Test ldap_getversion - if ((dolibarr_ldap_getversion($ds) == 3)) + if (($ldap->dolibarr_ldap_getversion($ds) == 3)) { print img_picto('','info'); print $langs->trans("LDAPSetupForVersion3").'
'; @@ -292,7 +293,7 @@ if (function_exists("ldap_connect")) } // Test ldap_bind - $bind = @dolibarr_ldap_bind($ds); + $bind = $ldap->dolibarr_ldap_bind($ds); if ($bind) { @@ -308,9 +309,9 @@ if (function_exists("ldap_connect")) } // Test ldap_unbind - $unbind = @dolibarr_ldap_unbind($ds); + $unbind = $ldap->dolibarr_ldap_unbind($ds); - if ($bind) + if ($unbind) { print img_picto('','info'); print "Déconnection du dn $dn réussi
"; diff --git a/htdocs/lib/ldap.lib.php b/htdocs/lib/ldap.lib.php index c2d6c8dafb4..600e4511a65 100644 --- a/htdocs/lib/ldap.lib.php +++ b/htdocs/lib/ldap.lib.php @@ -33,6 +33,19 @@ Ensemble des fonctions permettant d'accèder à un serveur LDAP. */ +class Ldap +{ + var $err; // erreur ldap + + + /** + * \brief Constructeur de la classe + */ + function Ldap() + { + $this->err = ""; + } + /** \brief Ouverture d'une connection vers le serveur LDAP @@ -86,7 +99,7 @@ function dolibarr_ldap_bind($ds) } else { - $this->err = ldap_error($ldapbind); + $this->err = ldap_error($ds); } } @@ -149,5 +162,6 @@ function dolibarr_ldap_unacc($str) $stu = ereg_replace("ä","a",$stu); return $stu; } +} ?>