Fix PHPCS. Rename connect_bind to connectBind.

This commit is contained in:
William Mead
2024-01-31 15:31:57 +01:00
parent eee29554c3
commit f114094ffe
24 changed files with 55 additions and 57 deletions

View File

@@ -79,7 +79,7 @@ $result = restrictedArea($user, 'adherent', $object->id, '', '', 'socid', 'rowid
if ($action == 'dolibarr2ldap') {
$ldap = new Ldap();
$result = $ldap->connect_bind();
$result = $ldap->connectBind();
if ($result > 0) {
$info = $object->_load_ldap_info();
@@ -183,7 +183,7 @@ print '</tr>';
// Lecture LDAP
$ldap = new Ldap();
$result = $ldap->connect_bind();
$result = $ldap->connectBind();
if ($result > 0) {
$info = $object->_load_ldap_info();
$dn = $object->_load_ldap_dn($info, 1);

View File

@@ -59,7 +59,7 @@ if ($reshook < 0) {
if (empty($reshook)) {
if ($action == 'dolibarr2ldap') {
$ldap = new Ldap();
$result = $ldap->connect_bind();
$result = $ldap->connectBind();
if ($result > 0) {
$object->listMembersForMemberType('', 1);
@@ -149,7 +149,7 @@ print '</tr>';
// LDAP reading
$ldap = new Ldap();
$result = $ldap->connect_bind();
$result = $ldap->connectBind();
if ($result > 0) {
$info = $object->_load_ldap_info();
$dn = $object->_load_ldap_dn($info, 1);

View File

@@ -279,7 +279,7 @@ if (function_exists("ldap_connect")) {
if ($action == 'test') {
$ldap = new Ldap(); // The parameters are provided and recovered through $conf
$result = $ldap->connect_bind();
$result = $ldap->connectBind();
if ($result > 0) {
// Test ldap connect and bind
print img_picto('', 'info').' ';

View File

@@ -300,7 +300,7 @@ if (function_exists("ldap_connect")) {
// Test synchro
$ldap = new Ldap();
$result = $ldap->connect_bind();
$result = $ldap->connectBind();
if ($result > 0) {
$info = $object->_load_ldap_info();

View File

@@ -244,7 +244,7 @@ if (function_exists("ldap_connect")) {
// Test synchro
$ldap = new Ldap();
$result = $ldap->connect_bind();
$result = $ldap->connectBind();
if ($result > 0) {
$info = $object->_load_ldap_info();
@@ -288,7 +288,7 @@ if (function_exists("ldap_connect")) {
// Test synchro
$ldap = new Ldap();
$result = $ldap->connect_bind();
$result = $ldap->connectBind();
if ($result > 0) {
$required_fields = array(

View File

@@ -451,7 +451,7 @@ if (function_exists("ldap_connect")) {
// Test synchro
$ldap = new Ldap();
$result = $ldap->connect_bind();
$result = $ldap->connectBind();
if ($result > 0) {
$info = $object->_load_ldap_info();

View File

@@ -207,7 +207,7 @@ if (function_exists("ldap_connect")) {
// Test synchro
$ldap = new Ldap();
$result = $ldap->connect_bind();
$result = $ldap->connectBind();
if ($result > 0) {
$info = $object->_load_ldap_info();

View File

@@ -423,7 +423,7 @@ if (function_exists("ldap_connect")) {
// Test synchro
$ldap = new Ldap();
$result = $ldap->connect_bind();
$result = $ldap->connectBind();
if ($result > 0) {
$info = $object->_load_ldap_info();
@@ -466,7 +466,7 @@ if (function_exists("ldap_connect")) {
// Test synchro
$ldap = new Ldap();
$result = $ldap->connect_bind();
$result = $ldap->connectBind();
if ($result > 0) {
$required_fields = array(

View File

@@ -56,7 +56,7 @@ if ($action == 'dolibarr2ldap') {
$db->begin();
$ldap = new Ldap();
$result = $ldap->connect_bind();
$result = $ldap->connectBind();
$info = $object->_load_ldap_info();
$dn = $object->_load_ldap_dn($info);
@@ -161,7 +161,7 @@ print '</tr>';
// Lecture LDAP
$ldap = new Ldap();
$result = $ldap->connect_bind();
$result = $ldap->connectBind();
if ($result > 0) {
$info = $object->_load_ldap_info();
$dn = $object->_load_ldap_dn($info, 1);

View File

@@ -303,7 +303,6 @@ class Ldap
// Connection handling methods -------------------------------------------
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Connect and bind
* Use this->server, this->serverPort, this->ldapProtocolVersion, this->serverType, this->searchUser, this->searchPassword
@@ -311,9 +310,8 @@ class Ldap
*
* @return int if KO: <0 || if bind anonymous: 1 || if bind auth: 2
*/
public function connect_bind()
public function connectBind()
{
// phpcs:enable
global $dolibarr_main_auth_ldap_debug;
$connected = 0;

View File

@@ -112,7 +112,7 @@ function check_user_password_ldap($usertotest, $passwordtotest, $entitytotest)
// If admin login or ldap auth filter provided
// Code to get user in LDAP from an admin connection (may differ from user connection, done later)
if ($ldapadminlogin || $dolibarr_main_auth_ldap_filter) {
$result = $ldap->connect_bind();
$result = $ldap->connectBind();
if ($result > 0) {
$resultFetchLdapUser = $ldap->fetch($usertotest, $userSearchFilter);
//dol_syslog('functions_ldap::check_user_password_ldap resultFetchLdapUser='.$resultFetchLdapUser);
@@ -148,7 +148,7 @@ function check_user_password_ldap($usertotest, $passwordtotest, $entitytotest)
// Test with this->seachUser and this->searchPassword
//print $resultFetchLdapUser."-".$ldap->ldapUserDN."-".$ldap->searchUser.'-'.$ldap->searchPassword;exit;
$result = $ldap->connect_bind();
$result = $ldap->connectBind();
if ($result > 0) {
if ($result == 2) { // Connection is ok for user/pass into LDAP
$login = $usertotest;

View File

@@ -83,7 +83,7 @@ class InterfaceLdapsynchro extends DolibarrTriggers
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
if (getDolGlobalString('LDAP_SYNCHRO_ACTIVE') && getDolGlobalInt('LDAP_SYNCHRO_ACTIVE') === Ldap::SYNCHRO_DOLIBARR_TO_LDAP) {
$ldap = new Ldap();
$result = $ldap->connect_bind();
$result = $ldap->connectBind();
if ($result > 0) {
$info = $object->_load_ldap_info();
@@ -105,7 +105,7 @@ class InterfaceLdapsynchro extends DolibarrTriggers
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
if (getDolGlobalString('LDAP_SYNCHRO_ACTIVE') && getDolGlobalInt('LDAP_SYNCHRO_ACTIVE') === Ldap::SYNCHRO_DOLIBARR_TO_LDAP) {
$ldap = new Ldap();
$result = $ldap->connect_bind();
$result = $ldap->connectBind();
if ($result > 0) {
if (empty($object->oldcopy) || !is_object($object->oldcopy)) {
@@ -184,7 +184,7 @@ class InterfaceLdapsynchro extends DolibarrTriggers
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
if (getDolGlobalString('LDAP_SYNCHRO_ACTIVE') && getDolGlobalInt('LDAP_SYNCHRO_ACTIVE') === Ldap::SYNCHRO_DOLIBARR_TO_LDAP) {
$ldap = new Ldap();
$result = $ldap->connect_bind();
$result = $ldap->connectBind();
if ($result > 0) {
if (empty($object->oldcopy) || !is_object($object->oldcopy)) {
@@ -217,7 +217,7 @@ class InterfaceLdapsynchro extends DolibarrTriggers
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
if (getDolGlobalInt("LDAP_SYNCHRO_ACTIVE") === Ldap::SYNCHRO_DOLIBARR_TO_LDAP && getDolGlobalString('LDAP_SERVER_TYPE') == "activedirectory") {
$ldap = new Ldap();
$result = $ldap->connect_bind();
$result = $ldap->connectBind();
if ($result > 0) {
$info = $object->_load_ldap_info();
$dn = $object->_load_ldap_dn($info);
@@ -246,7 +246,7 @@ class InterfaceLdapsynchro extends DolibarrTriggers
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
if (getDolGlobalString('LDAP_SYNCHRO_ACTIVE') && getDolGlobalInt('LDAP_SYNCHRO_ACTIVE') === Ldap::SYNCHRO_DOLIBARR_TO_LDAP) {
$ldap = new Ldap();
$result = $ldap->connect_bind();
$result = $ldap->connectBind();
if ($result > 0) {
$info = $object->_load_ldap_info();
@@ -264,7 +264,7 @@ class InterfaceLdapsynchro extends DolibarrTriggers
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
if (getDolGlobalString('LDAP_SYNCHRO_ACTIVE') && getDolGlobalInt('LDAP_SYNCHRO_ACTIVE') === Ldap::SYNCHRO_DOLIBARR_TO_LDAP) {
$ldap = new Ldap();
$result = $ldap->connect_bind();
$result = $ldap->connectBind();
if ($result > 0) {
$info = $object->_load_ldap_info();
@@ -295,7 +295,7 @@ class InterfaceLdapsynchro extends DolibarrTriggers
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
if (getDolGlobalString('LDAP_SYNCHRO_ACTIVE') && getDolGlobalInt('LDAP_SYNCHRO_ACTIVE') === Ldap::SYNCHRO_DOLIBARR_TO_LDAP) {
$ldap = new Ldap();
$result = $ldap->connect_bind();
$result = $ldap->connectBind();
if ($result > 0) {
if (empty($object->oldcopy) || !is_object($object->oldcopy)) {
@@ -328,7 +328,7 @@ class InterfaceLdapsynchro extends DolibarrTriggers
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
if (getDolGlobalString('LDAP_SYNCHRO_ACTIVE') && getDolGlobalInt('LDAP_SYNCHRO_ACTIVE') === Ldap::SYNCHRO_DOLIBARR_TO_LDAP) {
$ldap = new Ldap();
$result = $ldap->connect_bind();
$result = $ldap->connectBind();
if ($result > 0) {
$info = $object->_load_ldap_info();
@@ -346,7 +346,7 @@ class InterfaceLdapsynchro extends DolibarrTriggers
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
if (getDolGlobalString('LDAP_CONTACT_ACTIVE')) {
$ldap = new Ldap();
$result = $ldap->connect_bind();
$result = $ldap->connectBind();
if ($result > 0) {
$info = $object->_load_ldap_info();
@@ -363,7 +363,7 @@ class InterfaceLdapsynchro extends DolibarrTriggers
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
if (getDolGlobalString('LDAP_CONTACT_ACTIVE')) {
$ldap = new Ldap();
$result = $ldap->connect_bind();
$result = $ldap->connectBind();
if ($result > 0) {
if (empty($object->oldcopy) || !is_object($object->oldcopy)) {
@@ -396,7 +396,7 @@ class InterfaceLdapsynchro extends DolibarrTriggers
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
if (getDolGlobalString('LDAP_CONTACT_ACTIVE')) {
$ldap = new Ldap();
$result = $ldap->connect_bind();
$result = $ldap->connectBind();
if ($result > 0) {
$info = $object->_load_ldap_info();
@@ -414,7 +414,7 @@ class InterfaceLdapsynchro extends DolibarrTriggers
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
if (getDolGlobalString('LDAP_MEMBER_ACTIVE') && getDolGlobalInt('LDAP_MEMBER_ACTIVE') == Ldap::SYNCHRO_DOLIBARR_TO_LDAP) {
$ldap = new Ldap();
$result = $ldap->connect_bind();
$result = $ldap->connectBind();
if ($result > 0) {
$info = $object->_load_ldap_info();
@@ -459,7 +459,7 @@ class InterfaceLdapsynchro extends DolibarrTriggers
// If status field is setup to be synchronized
if (getDolGlobalString('LDAP_FIELD_MEMBER_STATUS')) {
$ldap = new Ldap();
$result = $ldap->connect_bind();
$result = $ldap->connectBind();
if ($result > 0) {
$info = $object->_load_ldap_info();
@@ -484,7 +484,7 @@ class InterfaceLdapsynchro extends DolibarrTriggers
|| getDolGlobalString('LDAP_FIELD_MEMBER_LASTSUBSCRIPTION_AMOUNT')
|| getDolGlobalString('LDAP_FIELD_MEMBER_END_LASTSUBSCRIPTION')) {
$ldap = new Ldap();
$result = $ldap->connect_bind();
$result = $ldap->connectBind();
if ($result > 0) {
$info = $object->_load_ldap_info();
@@ -503,7 +503,7 @@ class InterfaceLdapsynchro extends DolibarrTriggers
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
if (getDolGlobalString('LDAP_MEMBER_ACTIVE') && getDolGlobalInt('LDAP_MEMBER_ACTIVE') == Ldap::SYNCHRO_DOLIBARR_TO_LDAP) {
$ldap = new Ldap();
$result = $ldap->connect_bind();
$result = $ldap->connectBind();
if ($result > 0) {
if (empty($object->oldcopy) || !is_object($object->oldcopy)) {
@@ -593,7 +593,7 @@ class InterfaceLdapsynchro extends DolibarrTriggers
// If password field is setup to be synchronized
if (getDolGlobalString('LDAP_FIELD_PASSWORD') || getDolGlobalString('LDAP_FIELD_PASSWORD_CRYPTED')) {
$ldap = new Ldap();
$result = $ldap->connect_bind();
$result = $ldap->connectBind();
if ($result > 0) {
$info = $object->_load_ldap_info();
@@ -614,7 +614,7 @@ class InterfaceLdapsynchro extends DolibarrTriggers
// If status field is setup to be synchronized
if (getDolGlobalString('LDAP_FIELD_MEMBER_STATUS')) {
$ldap = new Ldap();
$result = $ldap->connect_bind();
$result = $ldap->connectBind();
if ($result > 0) {
$info = $object->_load_ldap_info();
@@ -633,7 +633,7 @@ class InterfaceLdapsynchro extends DolibarrTriggers
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
if (getDolGlobalString('LDAP_MEMBER_ACTIVE') && getDolGlobalInt('LDAP_MEMBER_ACTIVE') == Ldap::SYNCHRO_DOLIBARR_TO_LDAP) {
$ldap = new Ldap();
$result = $ldap->connect_bind();
$result = $ldap->connectBind();
if ($result > 0) {
$info = $object->_load_ldap_info();
@@ -681,7 +681,7 @@ class InterfaceLdapsynchro extends DolibarrTriggers
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
if (getDolGlobalString('LDAP_MEMBER_TYPE_ACTIVE') && getDolGlobalInt('LDAP_MEMBER_TYPE_ACTIVE') === Ldap::SYNCHRO_DOLIBARR_TO_LDAP) {
$ldap = new Ldap();
$result = $ldap->connect_bind();
$result = $ldap->connectBind();
if ($result > 0) {
$info = $object->_load_ldap_info();
@@ -703,7 +703,7 @@ class InterfaceLdapsynchro extends DolibarrTriggers
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
if (getDolGlobalString('LDAP_MEMBER_TYPE_ACTIVE') && getDolGlobalInt('LDAP_MEMBER_TYPE_ACTIVE') === Ldap::SYNCHRO_DOLIBARR_TO_LDAP) {
$ldap = new Ldap();
$result = $ldap->connect_bind();
$result = $ldap->connectBind();
if ($result > 0) {
if (empty($object->oldcopy) || !is_object($object->oldcopy)) {
@@ -740,7 +740,7 @@ class InterfaceLdapsynchro extends DolibarrTriggers
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
if (getDolGlobalString('LDAP_MEMBER_TYPE_ACTIVE') && getDolGlobalInt('LDAP_MEMBER_TYPE_ACTIVE') === Ldap::SYNCHRO_DOLIBARR_TO_LDAP) {
$ldap = new Ldap();
$result = $ldap->connect_bind();
$result = $ldap->connectBind();
if ($result > 0) {
$info = $object->_load_ldap_info();

View File

@@ -721,7 +721,7 @@ if (empty($reshook)) {
}
$ldap = new Ldap();
$result = $ldap->connect_bind();
$result = $ldap->connectBind();
if ($result >= 0) {
// Remove from required_fields all entries not configured in LDAP (empty) and duplicated
$required_fields = array_unique(array_values(array_filter($required_fields, "dol_validElement")));
@@ -808,7 +808,7 @@ if ($action == 'create' || $action == 'adduserldap') {
if (isModEnabled('ldap') && (isset($conf->global->LDAP_SYNCHRO_ACTIVE) && getDolGlobalInt('LDAP_SYNCHRO_ACTIVE') === Ldap::SYNCHRO_LDAP_TO_DOLIBARR)) {
// Show form to add an account from LDAP if sync LDAP -> Dolibarr is set
$ldap = new Ldap();
$result = $ldap->connect_bind();
$result = $ldap->connectBind();
if ($result >= 0) {
$required_fields = array(
$conf->global->LDAP_KEY_USERS,
@@ -1415,7 +1415,7 @@ if ($action == 'create' || $action == 'adduserldap') {
// pour recuperer passDoNotExpire et userChangePassNextLogon
if (isModEnabled('ldap') && !empty($object->ldap_sid)) {
$ldap = new Ldap();
$result = $ldap->connect_bind();
$result = $ldap->connectBind();
if ($result > 0) {
$userSearchFilter = '(' . getDolGlobalString('LDAP_FILTER_CONNECTION').'('.$ldap->getUserIdentifier().'='.$object->login.'))';
$entries = $ldap->fetch($object->login, $userSearchFilter);

View File

@@ -63,7 +63,7 @@ if (getDolGlobalString('MAIN_USE_ADVANCED_PERMS')) {
if ($action == 'dolibarr2ldap') {
$ldap = new Ldap();
$result = $ldap->connect_bind();
$result = $ldap->connectBind();
if ($result > 0) {
$info = $object->_load_ldap_info();
@@ -174,7 +174,7 @@ print '</tr>';
// Lecture LDAP
$ldap = new Ldap();
$result = $ldap->connect_bind();
$result = $ldap->connectBind();
if ($result > 0) {
$info = $object->_load_ldap_info();
$dn = $object->_load_ldap_dn($info, 1);

View File

@@ -66,7 +66,7 @@ if ($reshook < 0) {
if (empty($reshook)) {
if ($action == 'dolibarr2ldap') {
$ldap = new Ldap();
$result = $ldap->connect_bind();
$result = $ldap->connectBind();
if ($result > 0) {
$info = $object->_load_ldap_info();
@@ -124,7 +124,7 @@ print '</tr>';
if (getDolGlobalString('LDAP_SERVER_TYPE') == "activedirectory") {
$ldap = new Ldap();
$result = $ldap->connect_bind();
$result = $ldap->connectBind();
if ($result > 0) {
$userSID = $ldap->getObjectSid($object->login);
}
@@ -181,7 +181,7 @@ print '</tr>';
// Lecture LDAP
$ldap = new Ldap();
$result = $ldap->connect_bind();
$result = $ldap->connectBind();
if ($result > 0) {
$info = $object->_load_ldap_info();
$dn = $object->_load_ldap_dn($info, 1);

View File

@@ -121,7 +121,7 @@ if ($resql) {
$i = 0;
$ldap = new Ldap();
$ldap->connect_bind();
$ldap->connectBind();
while ($i < $num) {
$ldap->error = "";

View File

@@ -122,7 +122,7 @@ if ($resql) {
$i = 0;
$ldap = new Ldap();
$ldap->connect_bind();
$ldap->connectBind();
while ($i < $num) {
$ldap->error = "";

View File

@@ -187,7 +187,7 @@ if ($resql) {
}
$ldap = new Ldap();
$result = $ldap->connect_bind();
$result = $ldap->connectBind();
if ($result >= 0) {
$justthese = array();
$pricefirst = 0;

View File

@@ -87,7 +87,7 @@ if ($resql) {
$i = 0;
$ldap = new Ldap();
$result = $ldap->connect_bind();
$result = $ldap->connectBind();
if ($result > 0) {
while ($i < $num) {

View File

@@ -128,7 +128,7 @@ if (!getDolGlobalString('LDAP_MEMBER_TYPE_DN')) {
}
$ldap = new Ldap();
$result = $ldap->connect_bind();
$result = $ldap->connectBind();
if ($result >= 0) {
$justthese = array();

View File

@@ -79,7 +79,7 @@ if ($resql) {
$i = 0;
$ldap = new Ldap();
$ldap->connect_bind();
$ldap->connectBind();
while ($i < $num) {
$ldap->error = "";

View File

@@ -127,7 +127,7 @@ if (!getDolGlobalString('LDAP_GROUP_DN')) {
}
$ldap = new Ldap();
$result = $ldap->connect_bind();
$result = $ldap->connectBind();
if ($result >= 0) {
$justthese = array();

View File

@@ -79,7 +79,7 @@ if ($resql) {
$i = 0;
$ldap = new Ldap();
$ldap->connect_bind();
$ldap->connectBind();
while ($i < $num) {
$ldap->error = "";

View File

@@ -173,7 +173,7 @@ if ($resql) {
}
$ldap = new Ldap();
$result = $ldap->connect_bind();
$result = $ldap->connectBind();
if ($result >= 0) {
$justthese = array();