diff --git a/htdocs/contact/ldap.php b/htdocs/contact/ldap.php index 92b9c1ad337..d7ddd520ac0 100644 --- a/htdocs/contact/ldap.php +++ b/htdocs/contact/ldap.php @@ -1,6 +1,6 @@ - * Copyright (C) 2006-2017 Regis Houssin + * Copyright (C) 2006-2021 Regis Houssin * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -114,15 +114,15 @@ print $object->getCivilityLabel(); print ''; // LDAP DN -print 'LDAP '.$langs->trans("LDAPContactDn").''.$conf->global->LDAP_CONTACT_DN."\n"; +print 'LDAP '.$langs->trans("LDAPContactDn").''.getDolGlobalString('LDAP_CONTACT_DN')."\n"; // LDAP Cle -print 'LDAP '.$langs->trans("LDAPNamingAttribute").''.$conf->global->LDAP_KEY_CONTACTS."\n"; +print 'LDAP '.$langs->trans("LDAPNamingAttribute").''.getDolGlobalString('LDAP_KEY_CONTACTS')."\n"; // LDAP Server -print 'LDAP '.$langs->trans("LDAPPrimaryServer").''.$conf->global->LDAP_SERVER_HOST."\n"; -print 'LDAP '.$langs->trans("LDAPSecondaryServer").''.$conf->global->LDAP_SERVER_HOST_SLAVE."\n"; -print 'LDAP '.$langs->trans("LDAPServerPort").''.$conf->global->LDAP_SERVER_PORT."\n"; +print 'LDAP '.$langs->trans("LDAPPrimaryServer").''.getDolGlobalString('LDAP_SERVER_HOST')."\n"; +print 'LDAP '.$langs->trans("LDAPSecondaryServer").''.getDolGlobalString('LDAP_SERVER_HOST_SLAVE')."\n"; +print 'LDAP '.$langs->trans("LDAPServerPort").''.getDolGlobalString('LDAP_SERVER_PORT')."\n"; print ''; @@ -136,13 +136,13 @@ print dol_get_fiche_end(); */ print '
'; -if (!empty($conf->global->LDAP_CONTACT_ACTIVE) && $conf->global->LDAP_CONTACT_ACTIVE != Ldap::SYNCHRO_LDAP_TO_DOLIBARR) { +if (!empty($conf->global->LDAP_CONTACT_ACTIVE) && getDolGlobalInt('LDAP_CONTACT_ACTIVE') != Ldap::SYNCHRO_LDAP_TO_DOLIBARR) { print ''.$langs->trans("ForceSynchronize").''; } print "
\n"; -if (!empty($conf->global->LDAP_CONTACT_ACTIVE) && $conf->global->LDAP_CONTACT_ACTIVE != Ldap::SYNCHRO_LDAP_TO_DOLIBARR) { +if (!empty($conf->global->LDAP_CONTACT_ACTIVE) && getDolGlobalInt('LDAP_CONTACT_ACTIVE') != Ldap::SYNCHRO_LDAP_TO_DOLIBARR) { print "
\n"; } diff --git a/htdocs/core/login/functions_ldap.php b/htdocs/core/login/functions_ldap.php index 5ae3af3f008..1db98f5384e 100644 --- a/htdocs/core/login/functions_ldap.php +++ b/htdocs/core/login/functions_ldap.php @@ -1,5 +1,6 @@ + * Copyright (C) 2008-2021 Regis Houssin * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -156,7 +157,7 @@ function check_user_password_ldap($usertotest, $passwordtotest, $entitytotest) // we need to get the real login to use in the ldap answer. if (!empty($conf->global->LDAP_FIELD_LOGIN) && !empty($ldap->login)) { $login = $ldap->login; - dol_syslog("functions_ldap::check_user_password_ldap login is now $login (LDAP_FIELD_LOGIN=".$conf->global->LDAP_FIELD_LOGIN.")"); + dol_syslog("functions_ldap::check_user_password_ldap login is now $login (LDAP_FIELD_LOGIN=".getDolGlobalString('LDAP_FIELD_LOGIN').")"); } require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; @@ -181,7 +182,7 @@ function check_user_password_ldap($usertotest, $passwordtotest, $entitytotest) } // ldap2dolibarr synchronisation - if ($login && !empty($conf->ldap->enabled) && $conf->global->LDAP_SYNCHRO_ACTIVE == Ldap::SYNCHRO_LDAP_TO_DOLIBARR) { // ldap2dolibarr synchronization + if ($login && !empty($conf->ldap->enabled) && getDolGlobalInt('LDAP_SYNCHRO_ACTIVE') == Ldap::SYNCHRO_LDAP_TO_DOLIBARR) { // ldap2dolibarr synchronization dol_syslog("functions_ldap::check_user_password_ldap Sync ldap2dolibarr"); // On charge les attributs du user ldap diff --git a/htdocs/core/triggers/interface_50_modLdap_Ldapsynchro.class.php b/htdocs/core/triggers/interface_50_modLdap_Ldapsynchro.class.php index 24df646efd6..4e364a91a6a 100644 --- a/htdocs/core/triggers/interface_50_modLdap_Ldapsynchro.class.php +++ b/htdocs/core/triggers/interface_50_modLdap_Ldapsynchro.class.php @@ -1,6 +1,6 @@ - * Copyright (C) 2005-2017 Regis Houssin + * Copyright (C) 2005-2021 Regis Houssin * Copyright (C) 2014 Marcos GarcĂ­a * * This program is free software; you can redistribute it and/or modify @@ -482,7 +482,7 @@ class InterfaceLdapsynchro extends DolibarrTriggers } } elseif ($action == 'MEMBER_VALIDATE') { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - if (!empty($conf->global->LDAP_MEMBER_ACTIVE) && (string) $conf->global->LDAP_MEMBER_ACTIVE == Ldap::SYNCHRO_DOLIBARR_TO_LDAP) { + if (!empty($conf->global->LDAP_MEMBER_ACTIVE) && getDolGlobalInt('LDAP_MEMBER_ACTIVE') == Ldap::SYNCHRO_DOLIBARR_TO_LDAP) { // If status field is setup to be synchronized if (!empty($conf->global->LDAP_FIELD_MEMBER_STATUS)) { $ldap = new Ldap(); @@ -503,13 +503,13 @@ class InterfaceLdapsynchro extends DolibarrTriggers } } elseif ($action == 'MEMBER_SUBSCRIPTION') { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - if (!empty($conf->global->LDAP_MEMBER_ACTIVE) && (string) $conf->global->LDAP_MEMBER_ACTIVE == Ldap::SYNCHRO_DOLIBARR_TO_LDAP) { + if (!empty($conf->global->LDAP_MEMBER_ACTIVE) && getDolGlobalInt('LDAP_MEMBER_ACTIVE') == Ldap::SYNCHRO_DOLIBARR_TO_LDAP) { // If subscriptions fields are setup to be synchronized - if ($conf->global->LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_DATE - || $conf->global->LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_AMOUNT - || $conf->global->LDAP_FIELD_MEMBER_LASTSUBSCRIPTION_DATE - || $conf->global->LDAP_FIELD_MEMBER_LASTSUBSCRIPTION_AMOUNT - || $conf->global->LDAP_FIELD_MEMBER_END_LASTSUBSCRIPTION) { + if (!empty($conf->global->LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_DATE) + || !empty($conf->global->LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_AMOUNT) + || !empty($conf->global->LDAP_FIELD_MEMBER_LASTSUBSCRIPTION_DATE) + || !empty($conf->global->LDAP_FIELD_MEMBER_LASTSUBSCRIPTION_AMOUNT) + || !empty($conf->global->LDAP_FIELD_MEMBER_END_LASTSUBSCRIPTION)) { $ldap = new Ldap(); $result = $ldap->connect_bind(); @@ -528,7 +528,7 @@ class InterfaceLdapsynchro extends DolibarrTriggers } } elseif ($action == 'MEMBER_MODIFY') { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - if (!empty($conf->global->LDAP_MEMBER_ACTIVE) && (string) $conf->global->LDAP_MEMBER_ACTIVE == Ldap::SYNCHRO_DOLIBARR_TO_LDAP) { + if (!empty($conf->global->LDAP_MEMBER_ACTIVE) && getDolGlobalInt('LDAP_MEMBER_ACTIVE') == Ldap::SYNCHRO_DOLIBARR_TO_LDAP) { $ldap = new Ldap(); $result = $ldap->connect_bind(); @@ -616,9 +616,9 @@ class InterfaceLdapsynchro extends DolibarrTriggers } } elseif ($action == 'MEMBER_NEW_PASSWORD') { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - if (!empty($conf->global->LDAP_MEMBER_ACTIVE) && (string) $conf->global->LDAP_MEMBER_ACTIVE == Ldap::SYNCHRO_DOLIBARR_TO_LDAP) { + if (!empty($conf->global->LDAP_MEMBER_ACTIVE) && getDolGlobalInt('LDAP_MEMBER_ACTIVE') == Ldap::SYNCHRO_DOLIBARR_TO_LDAP) { // If password field is setup to be synchronized - if ($conf->global->LDAP_FIELD_PASSWORD || $conf->global->LDAP_FIELD_PASSWORD_CRYPTED) { + if (!empty($conf->global->LDAP_FIELD_PASSWORD) || !empty($conf->global->LDAP_FIELD_PASSWORD_CRYPTED)) { $ldap = new Ldap(); $result = $ldap->connect_bind(); @@ -637,7 +637,7 @@ class InterfaceLdapsynchro extends DolibarrTriggers } } elseif ($action == 'MEMBER_RESILIATE') { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - if (!empty($conf->global->LDAP_MEMBER_ACTIVE) && (string) $conf->global->LDAP_MEMBER_ACTIVE == Ldap::SYNCHRO_DOLIBARR_TO_LDAP) { + if (!empty($conf->global->LDAP_MEMBER_ACTIVE) && getDolGlobalInt('LDAP_MEMBER_ACTIVE') == Ldap::SYNCHRO_DOLIBARR_TO_LDAP) { // If status field is setup to be synchronized if (!empty($conf->global->LDAP_FIELD_MEMBER_STATUS)) { $ldap = new Ldap(); @@ -658,7 +658,7 @@ class InterfaceLdapsynchro extends DolibarrTriggers } } elseif ($action == 'MEMBER_DELETE') { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - if (!empty($conf->global->LDAP_MEMBER_ACTIVE) && (string) $conf->global->LDAP_MEMBER_ACTIVE == Ldap::SYNCHRO_DOLIBARR_TO_LDAP) { + if (!empty($conf->global->LDAP_MEMBER_ACTIVE) && getDolGlobalInt('LDAP_MEMBER_ACTIVE') == Ldap::SYNCHRO_DOLIBARR_TO_LDAP) { $ldap = new Ldap(); $result = $ldap->connect_bind();