Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into
develop Conflicts: htdocs/core/class/ldap.class.php
This commit is contained in:
commit
6acc8a6582
@ -209,7 +209,6 @@ if ($result > 0) {
|
||||
}
|
||||
|
||||
$ldap->unbind();
|
||||
$ldap->close();
|
||||
} else {
|
||||
setEventMessages($ldap->error, $ldap->errors, 'errors');
|
||||
}
|
||||
|
||||
@ -170,7 +170,6 @@ if ($result > 0) {
|
||||
}
|
||||
|
||||
$ldap->unbind();
|
||||
$ldap->close();
|
||||
} else {
|
||||
setEventMessages($ldap->error, $ldap->errors, 'errors');
|
||||
}
|
||||
|
||||
@ -290,24 +290,24 @@ if (function_exists("ldap_connect")) {
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=test">'.$langs->trans("LDAPTestConnect").'</a><br><br>';
|
||||
}
|
||||
|
||||
if ($_GET["action"] == 'test') {
|
||||
if ($action == 'test') {
|
||||
$ldap = new Ldap(); // Les parametres sont passes et recuperes via $conf
|
||||
|
||||
$result = $ldap->connect_bind();
|
||||
if ($result > 0) {
|
||||
// Test ldap connect and bind
|
||||
print img_picto('', 'info').' ';
|
||||
print '<span class="ok">'.$langs->trans("LDAPTCPConnectOK", $conf->global->LDAP_SERVER_HOST, $conf->global->LDAP_SERVER_PORT).'</span>';
|
||||
print '<span class="ok">'.$langs->trans("LDAPTCPConnectOK", $ldap->connectedServer, $conf->global->LDAP_SERVER_PORT).'</span>';
|
||||
print '<br>';
|
||||
|
||||
if ($conf->global->LDAP_ADMIN_DN && !empty($conf->global->LDAP_ADMIN_PASS)) {
|
||||
if (!empty($conf->global->LDAP_ADMIN_DN) && !empty($conf->global->LDAP_ADMIN_PASS)) {
|
||||
if ($result == 2) {
|
||||
print img_picto('', 'info').' ';
|
||||
print '<span class="ok">'.$langs->trans("LDAPBindOK", $conf->global->LDAP_SERVER_HOST, $conf->global->LDAP_SERVER_PORT, $conf->global->LDAP_ADMIN_DN, preg_replace('/./i', '*', $conf->global->LDAP_ADMIN_PASS)).'</span>';
|
||||
print '<span class="ok">'.$langs->trans("LDAPBindOK", $ldap->connectedServer, $conf->global->LDAP_SERVER_PORT, $conf->global->LDAP_ADMIN_DN, preg_replace('/./i', '*', $conf->global->LDAP_ADMIN_PASS)).'</span>';
|
||||
print '<br>';
|
||||
} else {
|
||||
print img_picto('', 'error').' ';
|
||||
print '<span class="error">'.$langs->trans("LDAPBindKO", $conf->global->LDAP_SERVER_HOST, $conf->global->LDAP_SERVER_PORT, $conf->global->LDAP_ADMIN_DN, preg_replace('/./i', '*', $conf->global->LDAP_ADMIN_PASS)).'</span>';
|
||||
print '<span class="error">'.$langs->trans("LDAPBindKO", $ldap->connectedServer, $conf->global->LDAP_SERVER_PORT, $conf->global->LDAP_ADMIN_DN, preg_replace('/./i', '*', $conf->global->LDAP_ADMIN_PASS)).'</span>';
|
||||
print '<br>';
|
||||
print $langs->trans("Error").' '.$ldap->error;
|
||||
print '<br>';
|
||||
@ -330,10 +330,10 @@ if (function_exists("ldap_connect")) {
|
||||
print '<br>';
|
||||
}
|
||||
|
||||
$unbind = $ldap->unbind();
|
||||
$ldap->unbind();
|
||||
} else {
|
||||
print img_picto('', 'error').' ';
|
||||
print '<span class="error">'.$langs->trans("LDAPTCPConnectKO", $conf->global->LDAP_SERVER_HOST, $conf->global->LDAP_SERVER_PORT).'</span>';
|
||||
print '<span class="error">'.$langs->trans("LDAPTCPConnectKO", $ldap->connectedServer, $conf->global->LDAP_SERVER_PORT).'</span>';
|
||||
print '<br>';
|
||||
print $langs->trans("Error").' '.$ldap->error;
|
||||
print '<br>';
|
||||
|
||||
@ -192,7 +192,7 @@ print "</tr>\n";
|
||||
// DN Pour les utilisateurs
|
||||
print '<!-- LDAP_USER_DN -->';
|
||||
print '<tr class="oddeven"><td><span class="fieldrequired">'.$langs->trans("LDAPUserDn").'</span></td><td>';
|
||||
print '<input size="48" type="text" name="user" value="'.$conf->global->LDAP_USER_DN.'">';
|
||||
print '<input size="48" type="text" name="user" value="'.getDolGlobalString('LDAP_USER_DN').'">';
|
||||
print '</td><td>'.$langs->trans("LDAPUserDnExample").'</td>';
|
||||
print '<td> </td>';
|
||||
print '</tr>';
|
||||
@ -200,7 +200,7 @@ print '</tr>';
|
||||
// List of object class used to define attributes in structure
|
||||
print '<!-- LDAP_USER_OBJECT_CLASS -->';
|
||||
print '<tr class="oddeven"><td><span class="fieldrequired">'.$langs->trans("LDAPUserObjectClassList").'</span></td><td>';
|
||||
print '<input size="48" type="text" name="objectclass" value="'.$conf->global->LDAP_USER_OBJECT_CLASS.'">';
|
||||
print '<input size="48" type="text" name="objectclass" value="'.getDolGlobalString('LDAP_USER_OBJECT_CLASS').'">';
|
||||
print '</td><td>'.$langs->trans("LDAPUserObjectClassListExample").'</td>';
|
||||
print '<td> </td>';
|
||||
print '</tr>';
|
||||
@ -208,7 +208,7 @@ print '</tr>';
|
||||
// Filter, used to filter search
|
||||
print '<!-- LDAP_FILTER_CONNECTION -->';
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("LDAPFilterConnection").'</td><td>';
|
||||
print '<input size="48" type="text" name="filterconnection" value="'.$conf->global->LDAP_FILTER_CONNECTION.'">';
|
||||
print '<input size="48" type="text" name="filterconnection" value="'.getDolGlobalString('LDAP_FILTER_CONNECTION').'">';
|
||||
print '</td><td>'.$langs->trans("LDAPFilterConnectionExample").'</td>';
|
||||
print '<td></td>';
|
||||
print '</tr>';
|
||||
@ -225,168 +225,168 @@ print "</tr>\n";
|
||||
|
||||
// Common name
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldFullname").'</td><td>';
|
||||
print '<input size="25" type="text" name="fieldfullname" value="'.$conf->global->LDAP_FIELD_FULLNAME.'">';
|
||||
print '<input size="25" type="text" name="fieldfullname" value="'.getDolGlobalString('LDAP_FIELD_FULLNAME').'">';
|
||||
print '</td><td>'.$langs->trans("LDAPFieldFullnameExample").'</td>';
|
||||
print '<td class="right"><input type="radio" name="key" value="LDAP_FIELD_FULLNAME"'.(($conf->global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS == $conf->global->LDAP_FIELD_FULLNAME) ? ' checked' : '')."></td>";
|
||||
print '<td class="right"><input type="radio" name="key" value="LDAP_FIELD_FULLNAME"'.(getDolGlobalString('LDAP_KEY_USERS') == getDolGlobalString('LDAP_FIELD_FULLNAME') ? ' checked' : '')."></td>";
|
||||
print '</tr>';
|
||||
|
||||
// Name
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldName").'</td><td>';
|
||||
print '<input size="25" type="text" name="fieldname" value="'.$conf->global->LDAP_FIELD_NAME.'">';
|
||||
print '<input size="25" type="text" name="fieldname" value="'.getDolGlobalString('LDAP_FIELD_NAME').'">';
|
||||
print '</td><td>'.$langs->trans("LDAPFieldNameExample").'</td>';
|
||||
print '<td class="right"><input type="radio" name="key" value="LDAP_FIELD_NAME"'.(($conf->global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS == $conf->global->LDAP_FIELD_NAME) ? ' checked' : '')."></td>";
|
||||
print '<td class="right"><input type="radio" name="key" value="LDAP_FIELD_NAME"'.(getDolGlobalString('LDAP_KEY_USERS') == getDolGlobalString('LDAP_FIELD_NAME') ? ' checked' : '')."></td>";
|
||||
print '</tr>';
|
||||
|
||||
// Firstname
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldFirstName").'</td><td>';
|
||||
print '<input size="25" type="text" name="fieldfirstname" value="'.$conf->global->LDAP_FIELD_FIRSTNAME.'">';
|
||||
print '<input size="25" type="text" name="fieldfirstname" value="'.getDolGlobalString('LDAP_FIELD_FIRSTNAME').'">';
|
||||
print '</td><td>'.$langs->trans("LDAPFieldFirstNameExample").'</td>';
|
||||
print '<td class="right"><input type="radio" name="key" value="LDAP_FIELD_FIRSTNAME"'.(($conf->global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS == $conf->global->LDAP_FIELD_FIRSTNAME) ? ' checked' : '')."></td>";
|
||||
print '<td class="right"><input type="radio" name="key" value="LDAP_FIELD_FIRSTNAME"'.(getDolGlobalString('LDAP_KEY_USERS') == getDolGlobalString('LDAP_FIELD_FIRSTNAME') ? ' checked' : '')."></td>";
|
||||
print '</tr>';
|
||||
|
||||
// Login unix
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldLoginUnix").'</td><td>';
|
||||
print '<input size="25" type="text" name="fieldlogin" value="'.$conf->global->LDAP_FIELD_LOGIN.'">';
|
||||
print '<input size="25" type="text" name="fieldlogin" value="'.getDolGlobalString('LDAP_FIELD_LOGIN').'">';
|
||||
print '</td><td>'.$langs->trans("LDAPFieldLoginExample").'</td>';
|
||||
print '<td class="right"><input type="radio" name="key" value="LDAP_FIELD_LOGIN"'.(($conf->global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS == $conf->global->LDAP_FIELD_LOGIN) ? ' checked' : '')."></td>";
|
||||
print '<td class="right"><input type="radio" name="key" value="LDAP_FIELD_LOGIN"'.(getDolGlobalString('LDAP_KEY_USERS') == getDolGlobalString('LDAP_FIELD_LOGIN') ? ' checked' : '')."></td>";
|
||||
print '</tr>';
|
||||
|
||||
// Login samba
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldLoginSamba").'</td><td>';
|
||||
print '<input size="25" type="text" name="fieldloginsamba" value="'.$conf->global->LDAP_FIELD_LOGIN_SAMBA.'">';
|
||||
print '<input size="25" type="text" name="fieldloginsamba" value="'.getDolGlobalString('LDAP_FIELD_LOGIN_SAMBA').'">';
|
||||
print '</td><td>'.$langs->trans("LDAPFieldLoginSambaExample").'</td>';
|
||||
print '<td class="right"><input type="radio" name="key" value="LDAP_FIELD_LOGIN_SAMBA"'.(($conf->global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS == $conf->global->LDAP_FIELD_LOGIN_SAMBA) ? ' checked' : '')."></td>";
|
||||
print '<td class="right"><input type="radio" name="key" value="LDAP_FIELD_LOGIN_SAMBA"'.(getDolGlobalString('LDAP_KEY_USERS') == getDolGlobalString('LDAP_FIELD_LOGIN_SAMBA') ? ' checked' : '')."></td>";
|
||||
print '</tr>';
|
||||
|
||||
// Password not crypted
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldPasswordNotCrypted").'</td><td>';
|
||||
print '<input size="25" type="text" name="fieldpassword" value="'.$conf->global->LDAP_FIELD_PASSWORD.'">';
|
||||
print '<input size="25" type="text" name="fieldpassword" value="'.getDolGlobalString('LDAP_FIELD_PASSWORD').'">';
|
||||
print '</td><td>'.$langs->trans("LDAPFieldPasswordExample").'</td>';
|
||||
print '<td class="right"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
// Password crypted
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldPasswordCrypted").'</td><td>';
|
||||
print '<input size="25" type="text" name="fieldpasswordcrypted" value="'.$conf->global->LDAP_FIELD_PASSWORD_CRYPTED.'">';
|
||||
print '<input size="25" type="text" name="fieldpasswordcrypted" value="'.getDolGlobalString('LDAP_FIELD_PASSWORD_CRYPTED').'">';
|
||||
print '</td><td>'.$langs->trans("LDAPFieldPasswordExample").'</td>';
|
||||
print '<td class="right"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
// Mail
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldMail").'</td><td>';
|
||||
print '<input size="25" type="text" name="fieldmail" value="'.$conf->global->LDAP_FIELD_MAIL.'">';
|
||||
print '<input size="25" type="text" name="fieldmail" value="'.getDolGlobalString('LDAP_FIELD_MAIL').'">';
|
||||
print '</td><td>'.$langs->trans("LDAPFieldMailExample").'</td>';
|
||||
print '<td class="right"><input type="radio" name="key" value="LDAP_FIELD_MAIL"'.(($conf->global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS == $conf->global->LDAP_FIELD_MAIL) ? ' checked' : '')."></td>";
|
||||
print '<td class="right"><input type="radio" name="key" value="LDAP_FIELD_MAIL"'.(getDolGlobalString('LDAP_KEY_USERS') == getDolGlobalString('LDAP_FIELD_MAIL') ? ' checked' : '')."></td>";
|
||||
print '</tr>';
|
||||
|
||||
// Phone
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldPhone").'</td><td>';
|
||||
print '<input size="25" type="text" name="fieldphone" value="'.$conf->global->LDAP_FIELD_PHONE.'">';
|
||||
print '<input size="25" type="text" name="fieldphone" value="'.getDolGlobalString('LDAP_FIELD_PHONE').'">';
|
||||
print '</td><td>'.$langs->trans("LDAPFieldPhoneExample").'</td>';
|
||||
print '<td class="right"><input type="radio" name="key" value="LDAP_FIELD_PHONE"'.(($conf->global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS == $conf->global->LDAP_FIELD_PHONE) ? ' checked' : '')."></td>";
|
||||
print '<td class="right"><input type="radio" name="key" value="LDAP_FIELD_PHONE"'.(getDolGlobalString('LDAP_KEY_USERS') == getDolGlobalString('LDAP_FIELD_PHONE') ? ' checked' : '')."></td>";
|
||||
print '</tr>';
|
||||
|
||||
// Mobile
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldMobile").'</td><td>';
|
||||
print '<input size="25" type="text" name="fieldmobile" value="'.$conf->global->LDAP_FIELD_MOBILE.'">';
|
||||
print '<input size="25" type="text" name="fieldmobile" value="'.getDolGlobalString('LDAP_FIELD_MOBILE').'">';
|
||||
print '</td><td>'.$langs->trans("LDAPFieldMobileExample").'</td>';
|
||||
print '<td class="right"><input type="radio" name="key" value="LDAP_FIELD_MOBILE"'.(($conf->global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS == $conf->global->LDAP_FIELD_MOBILE) ? ' checked' : '')."></td>";
|
||||
print '<td class="right"><input type="radio" name="key" value="LDAP_FIELD_MOBILE"'.(getDolGlobalString('LDAP_KEY_USERS') == getDolGlobalString('LDAP_FIELD_MOBILE') ? ' checked' : '')."></td>";
|
||||
print '</tr>';
|
||||
|
||||
// Skype
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldSkype").'</td><td>';
|
||||
print '<input size="25" type="text" name="fieldskype" value="'.$conf->global->LDAP_FIELD_SKYPE.'">';
|
||||
print '<input size="25" type="text" name="fieldskype" value="'.getDolGlobalString('LDAP_FIELD_SKYPE').'">';
|
||||
print '</td><td>'.$langs->trans("LDAPFieldSkypeExample").'</td>';
|
||||
print '<td class="right"><input type="radio" name="key" value="LDAP_FIELD_SKYPE"'.(($conf->global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS == $conf->global->LDAP_FIELD_SKYPE) ? ' checked' : '')."></td>";
|
||||
print '<td class="right"><input type="radio" name="key" value="LDAP_FIELD_SKYPE"'.(getDolGlobalString('LDAP_KEY_USERS') == getDolGlobalString('LDAP_FIELD_SKYPE') ? ' checked' : '')."></td>";
|
||||
print '</tr>';
|
||||
|
||||
// Fax
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldFax").'</td><td>';
|
||||
print '<input size="25" type="text" name="fieldfax" value="'.$conf->global->LDAP_FIELD_FAX.'">';
|
||||
print '<input size="25" type="text" name="fieldfax" value="'.getDolGlobalString('LDAP_FIELD_FAX').'">';
|
||||
print '</td><td>'.$langs->trans("LDAPFieldFaxExample").'</td>';
|
||||
print '<td class="right"><input type="radio" name="key" value="LDAP_FIELD_FAX"'.(($conf->global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS == $conf->global->LDAP_FIELD_FAX) ? ' checked' : '')."></td>";
|
||||
print '<td class="right"><input type="radio" name="key" value="LDAP_FIELD_FAX"'.(getDolGlobalString('LDAP_KEY_USERS') == getDolGlobalString('LDAP_FIELD_FAX') ? ' checked' : '')."></td>";
|
||||
print '</tr>';
|
||||
|
||||
// Company
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldCompany").'</td><td>';
|
||||
print '<input size="25" type="text" name="fieldcompany" value="'.$conf->global->LDAP_FIELD_COMPANY.'">';
|
||||
print '<input size="25" type="text" name="fieldcompany" value="'.getDolGlobalString('LDAP_FIELD_COMPANY').'">';
|
||||
print '</td><td>'.$langs->trans("LDAPFieldCompanyExample").'</td>';
|
||||
print '<td class="right"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
// Address
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldAddress").'</td><td>';
|
||||
print '<input size="25" type="text" name="fieldaddress" value="'.$conf->global->LDAP_FIELD_ADDRESS.'">';
|
||||
print '<input size="25" type="text" name="fieldaddress" value="'.getDolGlobalString('LDAP_FIELD_ADDRESS').'">';
|
||||
print '</td><td>'.$langs->trans("LDAPFieldAddressExample").'</td>';
|
||||
print '<td class="right"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
// ZIP
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldZip").'</td><td>';
|
||||
print '<input size="25" type="text" name="fieldzip" value="'.$conf->global->LDAP_FIELD_ZIP.'">';
|
||||
print '<input size="25" type="text" name="fieldzip" value="'.getDolGlobalString('LDAP_FIELD_ZIP').'">';
|
||||
print '</td><td>'.$langs->trans("LDAPFieldZipExample").'</td>';
|
||||
print '<td class="right"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
// TOWN
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldTown").'</td><td>';
|
||||
print '<input size="25" type="text" name="fieldtown" value="'.$conf->global->LDAP_FIELD_TOWN.'">';
|
||||
print '<input size="25" type="text" name="fieldtown" value="'.getDolGlobalString('LDAP_FIELD_TOWN').'">';
|
||||
print '</td><td>'.$langs->trans("LDAPFieldTownExample").'</td>';
|
||||
print '<td class="right"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
// COUNTRY
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldCountry").'</td><td>';
|
||||
print '<input size="25" type="text" name="fieldcountry" value="'.$conf->global->LDAP_FIELD_COUNTRY.'">';
|
||||
print '<input size="25" type="text" name="fieldcountry" value="'.getDolGlobalString('LDAP_FIELD_COUNTRY').'">';
|
||||
print '</td><td> </td>';
|
||||
print '<td class="right"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
// Title
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldTitle").'</td><td>';
|
||||
print '<input size="25" type="text" name="fieldtitle" value="'.$conf->global->LDAP_FIELD_TITLE.'">';
|
||||
print '<input size="25" type="text" name="fieldtitle" value="'.getDolGlobalString('LDAP_FIELD_TITLE').'">';
|
||||
print '</td><td>'.$langs->trans("LDAPFieldTitleExample").'</td>';
|
||||
print '<td class="right"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
// Note
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("Note").'</td><td>';
|
||||
print '<input size="25" type="text" name="fielddescription" value="'.$conf->global->LDAP_FIELD_DESCRIPTION.'">';
|
||||
print '<input size="25" type="text" name="fielddescription" value="'.getDolGlobalString('LDAP_FIELD_DESCRIPTION').'">';
|
||||
print '</td><td>'.$langs->trans("LDAPFieldDescriptionExample").'</td>';
|
||||
print '<td class="right"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
// Sid
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldSid").'</td><td>';
|
||||
print '<input size="25" type="text" name="fieldsid" value="'.$conf->global->LDAP_FIELD_SID.'">';
|
||||
print '<input size="25" type="text" name="fieldsid" value="'.getDolGlobalString('LDAP_FIELD_SID').'">';
|
||||
print '</td><td>'.$langs->trans("LDAPFieldSidExample").'</td>';
|
||||
print '<td class="right"><input type="radio" name="key" value="LDAP_FIELD_SID"'.(($conf->global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS == $conf->global->LDAP_FIELD_SID) ? ' checked' : '')."></td>";
|
||||
print '<td class="right"><input type="radio" name="key" value="LDAP_FIELD_SID"'.(getDolGlobalString('LDAP_KEY_USERS') == getDolGlobalString('LDAP_FIELD_SID') ? ' checked' : '')."></td>";
|
||||
print '</tr>';
|
||||
|
||||
// Group id
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldGroupid").'</td><td>';
|
||||
print '<input size="25" type="text" name="fieldgroupid" value="'.$conf->global->LDAP_FIELD_GROUPID.'">';
|
||||
print '<input size="25" type="text" name="fieldgroupid" value="'.getDolGlobalString('LDAP_FIELD_GROUPID').'">';
|
||||
print '</td><td>'.$langs->trans("LDAPFieldGroupidExample").'</td>';
|
||||
print '<td class="right"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
// Userid
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldUserid").'</td><td>';
|
||||
print '<input size="25" type="text" name="fielduserid" value="'.$conf->global->LDAP_FIELD_USERID.'">';
|
||||
print '<input size="25" type="text" name="fielduserid" value="'.getDolGlobalString('LDAP_FIELD_USERID').'">';
|
||||
print '</td><td>'.$langs->trans("LDAPFieldUseridExample").'</td>';
|
||||
print '<td class="right"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
// Home Directory
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldHomedirectory").'</td><td>';
|
||||
print '<input size="25" type="text" name="fieldhomedirectory" value="'.$conf->global->LDAP_FIELD_HOMEDIRECTORY.'">';
|
||||
print '<input size="25" type="text" name="fieldhomedirectory" value="'.getDolGlobalString('LDAP_FIELD_HOMEDIRECTORY').'">';
|
||||
print '</td><td>'.$langs->trans("LDAPFieldHomedirectoryExample").'</td>';
|
||||
print '<td class="right"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
// Home Directory Prefix
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldHomedirectoryprefix").'</td><td>';
|
||||
print '<input size="25" type="text" name="fieldhomedirectoryprefix" value="'.$conf->global->LDAP_FIELD_HOMEDIRECTORYPREFIX.'">';
|
||||
print '<input size="25" type="text" name="fieldhomedirectoryprefix" value="'.getDolGlobalString('LDAP_FIELD_HOMEDIRECTORYPREFIX').'">';
|
||||
print '</td><td></td>';
|
||||
print '<td class="right"> </td>';
|
||||
print '</tr>';
|
||||
@ -405,20 +405,20 @@ print '</form>';
|
||||
/*
|
||||
* Test de la connexion
|
||||
*/
|
||||
if ($conf->global->LDAP_SYNCHRO_ACTIVE == 'dolibarr2ldap') {
|
||||
if (getDolGlobalString('LDAP_SYNCHRO_ACTIVE') == 'dolibarr2ldap') {
|
||||
$butlabel = $langs->trans("LDAPTestSynchroUser");
|
||||
$testlabel = 'testuser';
|
||||
$key = $conf->global->LDAP_KEY_USERS;
|
||||
$dn = $conf->global->LDAP_USER_DN;
|
||||
$objectclass = $conf->global->LDAP_USER_OBJECT_CLASS;
|
||||
$key = getDolGlobalString('LDAP_KEY_USERS');
|
||||
$dn = getDolGlobalString('LDAP_USER_DN');
|
||||
$objectclass = getDolGlobalString('LDAP_USER_OBJECT_CLASS');
|
||||
|
||||
show_ldap_test_button($butlabel, $testlabel, $key, $dn, $objectclass);
|
||||
} elseif ($conf->global->LDAP_SYNCHRO_ACTIVE == 'ldap2dolibarr') {
|
||||
} elseif (getDolGlobalString('LDAP_SYNCHRO_ACTIVE') == 'ldap2dolibarr') {
|
||||
$butlabel = $langs->trans("LDAPTestSearch");
|
||||
$testlabel = 'testsearchuser';
|
||||
$key = $conf->global->LDAP_KEY_USERS;
|
||||
$dn = $conf->global->LDAP_USER_DN;
|
||||
$objectclass = $conf->global->LDAP_USER_OBJECT_CLASS;
|
||||
$key = getDolGlobalString('LDAP_KEY_USERS');
|
||||
$dn = getDolGlobalString('LDAP_USER_DN');
|
||||
$objectclass = getDolGlobalString('LDAP_USER_OBJECT_CLASS');
|
||||
show_ldap_test_button($butlabel, $testlabel, $key, $dn, $objectclass);
|
||||
}
|
||||
|
||||
@ -479,29 +479,29 @@ if (function_exists("ldap_connect")) {
|
||||
|
||||
if ($result > 0) {
|
||||
$required_fields = array(
|
||||
$conf->global->LDAP_KEY_USERS,
|
||||
$conf->global->LDAP_FIELD_FULLNAME,
|
||||
$conf->global->LDAP_FIELD_NAME,
|
||||
$conf->global->LDAP_FIELD_FIRSTNAME,
|
||||
$conf->global->LDAP_FIELD_LOGIN,
|
||||
$conf->global->LDAP_FIELD_LOGIN_SAMBA,
|
||||
$conf->global->LDAP_FIELD_PASSWORD,
|
||||
$conf->global->LDAP_FIELD_PASSWORD_CRYPTED,
|
||||
$conf->global->LDAP_FIELD_PHONE,
|
||||
$conf->global->LDAP_FIELD_FAX,
|
||||
$conf->global->LDAP_FIELD_SKYPE,
|
||||
$conf->global->LDAP_FIELD_MOBILE,
|
||||
$conf->global->LDAP_FIELD_MAIL,
|
||||
$conf->global->LDAP_FIELD_TITLE,
|
||||
$conf->global->LDAP_FIELD_DESCRIPTION,
|
||||
$conf->global->LDAP_FIELD_SID
|
||||
getDolGlobalString('LDAP_KEY_USERS'),
|
||||
getDolGlobalString('LDAP_FIELD_FULLNAME'),
|
||||
getDolGlobalString('LDAP_FIELD_NAME'),
|
||||
getDolGlobalString('LDAP_FIELD_FIRSTNAME'),
|
||||
getDolGlobalString('LDAP_FIELD_LOGIN'),
|
||||
getDolGlobalString('LDAP_FIELD_LOGIN_SAMBA'),
|
||||
getDolGlobalString('LDAP_FIELD_PASSWORD'),
|
||||
getDolGlobalString('LDAP_FIELD_PASSWORD_CRYPTED'),
|
||||
getDolGlobalString('LDAP_FIELD_PHONE'),
|
||||
getDolGlobalString('LDAP_FIELD_FAX'),
|
||||
getDolGlobalString('LDAP_FIELD_SKYPE'),
|
||||
getDolGlobalString('LDAP_FIELD_MOBILE'),
|
||||
getDolGlobalString('LDAP_FIELD_MAIL'),
|
||||
getDolGlobalString('LDAP_FIELD_TITLE'),
|
||||
getDolGlobalString('LDAP_FIELD_DESCRIPTION'),
|
||||
getDolGlobalString('LDAP_FIELD_SID')
|
||||
);
|
||||
|
||||
// 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")));
|
||||
|
||||
// Get from LDAP database an array of results
|
||||
$ldapusers = $ldap->getRecords('*', $conf->global->LDAP_USER_DN, $conf->global->LDAP_KEY_USERS, $required_fields, 1);
|
||||
$ldapusers = $ldap->getRecords('*', getDolGlobalString('LDAP_USER_DN'), getDolGlobalString('LDAP_KEY_USERS'), $required_fields, 1);
|
||||
//$ldapusers = $ldap->getRecords('*', $conf->global->LDAP_USER_DN, $conf->global->LDAP_KEY_USERS, '', 1);
|
||||
|
||||
if (is_array($ldapusers)) {
|
||||
@ -523,8 +523,8 @@ if (function_exists("ldap_connect")) {
|
||||
print "<br>\n";
|
||||
print "LDAP search for user:<br>\n";
|
||||
print "search: *<br>\n";
|
||||
print "userDN: ".$conf->global->LDAP_USER_DN."<br>\n";
|
||||
print "useridentifier: ".$conf->global->LDAP_KEY_USERS."<br>\n";
|
||||
print "userDN: ".getDolGlobalString('LDAP_USER_DN')."<br>\n";
|
||||
print "useridentifier: ".getDolGlobalString('LDAP_KEY_USERS')."<br>\n";
|
||||
print "required_fields: ".implode(',', $required_fields)."<br>\n";
|
||||
print "=> ".count($liste)." records<br>\n";
|
||||
print "\n<br>";
|
||||
|
||||
@ -848,8 +848,19 @@ if ($action == 'edit') {
|
||||
$text .= ($text ? '<br><br>' : '').'<!-- MAIN_EXTERNAL_SMTP_SPF_STRING_TO_ADD -->'.$langs->trans("WarningPHPMailSPF", $conf->global->MAIN_EXTERNAL_SMTP_SPF_STRING_TO_ADD);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$companyemail = getDolGlobalString('MAIN_INFO_SOCIETE_MAIL');
|
||||
$dnsinfo = false;
|
||||
if (!empty($companyemail) && function_exists('dns_get_record')) {
|
||||
$domain = array_pop(explode('@', $companyemail));
|
||||
$dnsinfo = dns_get_record($domain, DNS_TXT);
|
||||
}
|
||||
if (!empty($dnsinfo) && is_array($dnsinfo)) {
|
||||
foreach ($dnsinfo as $info) {
|
||||
if (strpos($info['txt'], 'v=spf') !== false) {
|
||||
$text .= ($text ? '<br><br>' : '').$langs->trans("ActualMailSPFRecordFound", $info['txt']);
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($text) {
|
||||
print info_admin($text);
|
||||
}
|
||||
|
||||
@ -182,7 +182,6 @@ if ($result > 0) {
|
||||
}
|
||||
|
||||
$ldap->unbind();
|
||||
$ldap->close();
|
||||
} else {
|
||||
setEventMessages($ldap->error, $ldap->errors, 'errors');
|
||||
}
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
<?php
|
||||
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
||||
* Copyright (C) 2005-2017 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2006-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2021 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2006-2021 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* 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
|
||||
@ -48,6 +48,11 @@ class Ldap
|
||||
*/
|
||||
public $server = array();
|
||||
|
||||
/**
|
||||
* Current connected server
|
||||
*/
|
||||
public $connectedServer;
|
||||
|
||||
/**
|
||||
* Base DN (e.g. "dc=foo,dc=com")
|
||||
*/
|
||||
@ -132,35 +137,33 @@ class Ldap
|
||||
if (!empty($conf->global->LDAP_SERVER_HOST_SLAVE)) {
|
||||
$this->server[] = $conf->global->LDAP_SERVER_HOST_SLAVE;
|
||||
}
|
||||
$this->serverPort = $conf->global->LDAP_SERVER_PORT;
|
||||
$this->ldapProtocolVersion = $conf->global->LDAP_SERVER_PROTOCOLVERSION;
|
||||
$this->dn = $conf->global->LDAP_SERVER_DN;
|
||||
$this->serverType = $conf->global->LDAP_SERVER_TYPE;
|
||||
$this->serverPort = getDolGlobalInt('LDAP_SERVER_PORT', 389);
|
||||
$this->ldapProtocolVersion = getDolGlobalString('LDAP_SERVER_PROTOCOLVERSION');
|
||||
$this->dn = getDolGlobalString('LDAP_SERVER_DN');
|
||||
$this->serverType = getDolGlobalString('LDAP_SERVER_TYPE');
|
||||
|
||||
$this->domain = $conf->global->LDAP_SERVER_DN;
|
||||
$this->searchUser = $conf->global->LDAP_ADMIN_DN;
|
||||
$this->searchPassword = $conf->global->LDAP_ADMIN_PASS;
|
||||
$this->people = $conf->global->LDAP_USER_DN;
|
||||
$this->groups = $conf->global->LDAP_GROUP_DN;
|
||||
$this->domain = getDolGlobalString('LDAP_SERVER_DN');
|
||||
$this->searchUser = getDolGlobalString('LDAP_ADMIN_DN');
|
||||
$this->searchPassword = getDolGlobalString('LDAP_ADMIN_PASS');
|
||||
$this->people = getDolGlobalString('LDAP_USER_DN');
|
||||
$this->groups = getDolGlobalString('LDAP_GROUP_DN');
|
||||
|
||||
$this->filter = $conf->global->LDAP_FILTER_CONNECTION; // Filter on user
|
||||
$this->filtergroup = $conf->global->LDAP_GROUP_FILTER; // Filter on groups
|
||||
$this->filtermember = $conf->global->LDAP_MEMBER_FILTER; // Filter on member
|
||||
$this->filter = getDolGlobalString('LDAP_FILTER_CONNECTION'); // Filter on user
|
||||
$this->filtergroup = getDolGlobalString('LDAP_GROUP_FILTER'); // Filter on groups
|
||||
$this->filtermember = getDolGlobalString('LDAP_MEMBER_FILTER'); // Filter on member
|
||||
|
||||
// Users
|
||||
$this->attr_login = $conf->global->LDAP_FIELD_LOGIN; //unix
|
||||
$this->attr_sambalogin = $conf->global->LDAP_FIELD_LOGIN_SAMBA; //samba, activedirectory
|
||||
$this->attr_name = $conf->global->LDAP_FIELD_NAME;
|
||||
$this->attr_firstname = $conf->global->LDAP_FIELD_FIRSTNAME;
|
||||
$this->attr_mail = $conf->global->LDAP_FIELD_MAIL;
|
||||
$this->attr_phone = $conf->global->LDAP_FIELD_PHONE;
|
||||
$this->attr_skype = $conf->global->LDAP_FIELD_SKYPE;
|
||||
$this->attr_fax = $conf->global->LDAP_FIELD_FAX;
|
||||
$this->attr_mobile = $conf->global->LDAP_FIELD_MOBILE;
|
||||
$this->attr_login = getDolGlobalString('LDAP_FIELD_LOGIN'); //unix
|
||||
$this->attr_sambalogin = getDolGlobalString('LDAP_FIELD_LOGIN_SAMBA'); //samba, activedirectory
|
||||
$this->attr_name = getDolGlobalString('LDAP_FIELD_NAME');
|
||||
$this->attr_firstname = getDolGlobalString('LDAP_FIELD_FIRSTNAME');
|
||||
$this->attr_mail = getDolGlobalString('LDAP_FIELD_MAIL');
|
||||
$this->attr_phone = getDolGlobalString('LDAP_FIELD_PHONE');
|
||||
$this->attr_skype = getDolGlobalString('LDAP_FIELD_SKYPE');
|
||||
$this->attr_fax = getDolGlobalString('LDAP_FIELD_FAX');
|
||||
$this->attr_mobile = getDolGlobalString('LDAP_FIELD_MOBILE');
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Connection handling methods -------------------------------------------
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
@ -288,6 +291,7 @@ class Ldap
|
||||
$return = -1;
|
||||
dol_syslog(get_class($this)."::connect_bind return=".$return.' - '.$this->error, LOG_WARNING);
|
||||
}
|
||||
$this->connectedServer = $host;
|
||||
return $return;
|
||||
}
|
||||
|
||||
@ -297,6 +301,7 @@ class Ldap
|
||||
* This method seems a duplicate/alias of unbind().
|
||||
*
|
||||
* @return boolean true or false
|
||||
* @deprecated ldap_close is an alias of ldap_unbind
|
||||
* @see unbind()
|
||||
*/
|
||||
public function close()
|
||||
@ -416,7 +421,7 @@ class Ldap
|
||||
*/
|
||||
public function add($dn, $info, $user)
|
||||
{
|
||||
dol_syslog(get_class($this)."::add dn=".$dn." info=".join(',', $info));
|
||||
dol_syslog(get_class($this)."::add dn=".$dn." info=".json_encode($info));
|
||||
|
||||
// Check parameters
|
||||
if (!$this->connection) {
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2006 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2006-2017 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2006-2021 Regis Houssin <regis.houssin@inodbox.com>
|
||||
*
|
||||
* 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
|
||||
@ -89,7 +89,6 @@ function ldap_prepare_head()
|
||||
return $head;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Show button test LDAP synchro
|
||||
*
|
||||
@ -119,7 +118,6 @@ function show_ldap_test_button($butlabel, $testlabel, $key, $dn, $objectclass)
|
||||
print '<br><br>';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Show a LDAP array into an HTML output array.
|
||||
*
|
||||
@ -153,7 +151,7 @@ function show_ldap_content($result, $level, $count, $var, $hide = 0, $subcount =
|
||||
if ("$key" == "dn") {
|
||||
continue;
|
||||
}
|
||||
if ("$val" == "objectclass") {
|
||||
if (!is_array($val) && "$val" == "objectclass") {
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -181,7 +179,7 @@ function show_ldap_content($result, $level, $count, $var, $hide = 0, $subcount =
|
||||
}
|
||||
print '<br>';
|
||||
}
|
||||
if ("$val" != $lastkey[$level] && !$subcount) {
|
||||
if (!is_array($val) && "$val" != $lastkey[$level] && !$subcount) {
|
||||
print '</td></tr>';
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2008-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2008-2017 Regis Houssin <regis.houssin@inodbox.com>
|
||||
/* Copyright (C) 2008-2021 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2008-2021 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2020 Ferran Marcet <fmarcet@2byte.es>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -91,7 +91,6 @@ function dol_decode($chain, $key = '1')
|
||||
return $chain;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns a hash of a string.
|
||||
* If constant MAIN_SECURITY_HASH_ALGO is defined, we use this function as hashing function (recommanded value is 'password_hash')
|
||||
@ -123,7 +122,7 @@ function dol_hash($chain, $type = '0')
|
||||
} elseif ($type == '3' || $type == 'md5') {
|
||||
return md5($chain);
|
||||
} elseif ($type == '4' || $type == 'md5openldap') {
|
||||
return '{md5}'.base64_encode(mhash(MHASH_MD5, $chain)); // For OpenLdap with md5 (based on an unencrypted password in base)
|
||||
return '{md5}'.base64_encode(pack("H*", md5($chain))); // For OpenLdap with md5 (based on an unencrypted password in base)
|
||||
} elseif ($type == '5' || $type == 'sha256') {
|
||||
return hash('sha256', $chain);
|
||||
} elseif ($type == '6' || $type == 'password_hash') {
|
||||
@ -168,7 +167,6 @@ function dol_verifyHash($chain, $hash, $type = '0')
|
||||
return dol_hash($chain, $type) == $hash;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check permissions of a user to show a page and an object. Check read permission.
|
||||
* If GETPOST('action','aZ09') defined, we also check write and delete permission.
|
||||
|
||||
@ -120,7 +120,7 @@ function check_user_password_ldap($usertotest, $passwordtotest, $entitytotest)
|
||||
if ($ldapdebug) {
|
||||
print "DEBUG: User ".$usertotest." must change password<br>\n";
|
||||
}
|
||||
$ldap->close();
|
||||
$ldap->unbind();
|
||||
sleep(1);
|
||||
$langs->load('ldap');
|
||||
$_SESSION["dol_loginmesg"] = $langs->transnoentitiesnoconv("YouMustChangePassNextLogon", $usertotest, $ldap->domainFQDN);
|
||||
@ -131,7 +131,7 @@ function check_user_password_ldap($usertotest, $passwordtotest, $entitytotest)
|
||||
print "DEBUG: ".$ldap->error."<br>\n";
|
||||
}
|
||||
}
|
||||
$ldap->close();
|
||||
$ldap->unbind();
|
||||
}
|
||||
|
||||
// Forge LDAP user and password to test with them
|
||||
@ -166,14 +166,14 @@ function check_user_password_ldap($usertotest, $passwordtotest, $entitytotest)
|
||||
|
||||
$now = dol_now();
|
||||
if ($tmpuser->datestartvalidity && $db->jdate($tmpuser->datestartvalidity) >= $now) {
|
||||
$ldap->close();
|
||||
$ldap->unbind();
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array('main', 'errors'));
|
||||
$_SESSION["dol_loginmesg"] = $langs->transnoentitiesnoconv("ErrorLoginDateValidity");
|
||||
return '--bad-login-validity--';
|
||||
}
|
||||
if ($tmpuser->dateendvalidity && $db->jdate($tmpuser->dateendvalidity) <= dol_get_first_hour($now)) {
|
||||
$ldap->close();
|
||||
$ldap->unbind();
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array('main', 'errors'));
|
||||
$_SESSION["dol_loginmesg"] = $langs->transnoentitiesnoconv("ErrorLoginDateValidity");
|
||||
@ -271,7 +271,7 @@ function check_user_password_ldap($usertotest, $passwordtotest, $entitytotest)
|
||||
$_SESSION["dol_loginmesg"] = ($ldap->error ? $ldap->error : $langs->transnoentitiesnoconv("ErrorBadLoginPassword"));
|
||||
}
|
||||
|
||||
$ldap->close();
|
||||
$ldap->unbind();
|
||||
}
|
||||
|
||||
return $login;
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2018 ATM Consulting <support@atm-consulting.fr>
|
||||
* Copyright (C) 2021 Frédéric France <frederic.france@netlogic.fr>
|
||||
*
|
||||
* 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
|
||||
@ -88,7 +89,7 @@ if ($absolute_discount > 0) {
|
||||
// Is there credit notes availables ?
|
||||
if ($absolute_creditnote > 0) {
|
||||
// If validated, we show link "add credit note to payment"
|
||||
if ($cannotApplyDiscount || !$isInvoice || $isNewObject || $object->statut != $objclassname::STATUS_VALIDATED || $object->type == $objclassname::TYPE_CREDIT_NOTE) {
|
||||
if (!empty($cannotApplyDiscount) || !$isInvoice || $isNewObject || $object->statut != $objclassname::STATUS_VALIDATED || $object->type == $objclassname::TYPE_CREDIT_NOTE) {
|
||||
$translationKey = !empty($discount_type) ? 'HasCreditNoteFromSupplier' : 'CompanyHasCreditNote';
|
||||
$text = $langs->trans($translationKey, price($absolute_creditnote), $langs->transnoentities("Currency".$conf->currency)).'.';
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2007-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) ---Put here your own copyright and developer email---
|
||||
* Copyright (C) 2021 Frédéric France <frederic.france@netlogic.fr>
|
||||
*
|
||||
* 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
|
||||
@ -104,7 +104,7 @@ foreach ($object->fields as $key => $val) {
|
||||
// List of fields to search into when doing a "search in all"
|
||||
$fieldstosearchall = array();
|
||||
foreach ($object->fields as $key => $val) {
|
||||
if ($val['searchall']) {
|
||||
if (!empty($val['searchall'])) {
|
||||
$fieldstosearchall['t.'.$key] = $val['label'];
|
||||
}
|
||||
}
|
||||
@ -444,6 +444,7 @@ print '<table class="tagtable nobottomiftotal liste'.($moreforfilter ? " listwit
|
||||
// --------------------------------------------------------------------
|
||||
print '<tr class="liste_titre">';
|
||||
foreach ($object->fields as $key => $val) {
|
||||
$searchkey = empty($search[$key]) ? '' : $search[$key];
|
||||
$cssforfield = (empty($val['css']) ? '' : $val['css']);
|
||||
if ($key == 'status') {
|
||||
$cssforfield .= ($cssforfield ? ' ' : '').'center';
|
||||
@ -458,9 +459,9 @@ foreach ($object->fields as $key => $val) {
|
||||
print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'">';
|
||||
|
||||
if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) {
|
||||
print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100', 1);
|
||||
print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $searchkey, $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100', 1);
|
||||
} elseif ((strpos($val['type'], 'integer:') === 0) || (strpos($val['type'], 'sellist:')=== 0)) {
|
||||
print $object->showInputField($val, $key, $search[$key], '', '', 'search_', 'maxwidth125', 1);
|
||||
print $object->showInputField($val, $key, $searchkey, '', '', 'search_', 'maxwidth125', 1);
|
||||
} elseif (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
|
||||
print '<div class="nowrap">';
|
||||
print $form->selectDate($search[$key.'_dtstart'] ? $search[$key.'_dtstart'] : '', "search_".$key."_dtstart", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
|
||||
@ -469,9 +470,9 @@ foreach ($object->fields as $key => $val) {
|
||||
print $form->selectDate($search[$key.'_dtend'] ? $search[$key.'_dtend'] : '', "search_".$key."_dtend", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
|
||||
print '</div>';
|
||||
} elseif ($key == 'lang') {
|
||||
print $formadmin->select_language($search[$key], 'search_lang', 0, null, 1, 0, 0, 'minwidth150 maxwidth200', 2);
|
||||
print $formadmin->select_language($searchkey, 'search_lang', 0, null, 1, 0, 0, 'minwidth150 maxwidth200', 2);
|
||||
} else {
|
||||
print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'">';
|
||||
print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($searchkey).'">';
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
@ -522,7 +523,7 @@ print '</tr>'."\n";
|
||||
|
||||
// Detect if we need a fetch on each output line
|
||||
$needToFetchEachLine = 0;
|
||||
if (is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) {
|
||||
if (!empty($extrafields->attributes[$object->table_element]['computed']) && is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) {
|
||||
foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) {
|
||||
if (preg_match('/\$object/', $val)) {
|
||||
$needToFetchEachLine++; // There is at least one compute field that use $object
|
||||
|
||||
@ -501,6 +501,7 @@ WarningPHPMailC=- Using the SMTP server of your own Email Service Provider to se
|
||||
WarningPHPMailD=Also, it is therefore recommended to change the sending method of e-mails to the value "SMTP". If you really want to keep the default "PHP" method to send emails, just ignore this warning, or remove it by setting the MAIN_HIDE_WARNING_TO_ENCOURAGE_SMTP_SETUP constant to 1 in Home - Setup - Other.
|
||||
WarningPHPMail2=If your email SMTP provider need to restrict email client to some IP addresses (very rare), this is the IP address of the mail user agent (MUA) for your ERP CRM application: <strong>%s</strong>.
|
||||
WarningPHPMailSPF=If the domain name in your sender email address is protected by a SPF record (ask your domain name registar), you must add the following IPs in the SPF record of the DNS of your domain: <strong>%s</strong>.
|
||||
ActualMailSPFRecordFound=Actual SPF record found : %s
|
||||
ClickToShowDescription=Click to show description
|
||||
DependsOn=This module needs the module(s)
|
||||
RequiredBy=This module is required by module(s)
|
||||
|
||||
@ -2774,7 +2774,7 @@ if ($action == 'create' || $action == 'adduserldap') {
|
||||
}
|
||||
|
||||
if (!empty($conf->ldap->enabled) && !empty($object->ldap_sid)) {
|
||||
$ldap->close();
|
||||
$ldap->unbind();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -2901,7 +2901,7 @@ class User extends CommonObject
|
||||
}
|
||||
}
|
||||
foreach ($socialnetworks as $key => $value) {
|
||||
if ($this->socialnetworks[$value['label']] && !empty($conf->global->{'LDAP_FIELD_'.strtoupper($value['label'])})) {
|
||||
if (!empty($this->socialnetworks[$value['label']]) && !empty($conf->global->{'LDAP_FIELD_'.strtoupper($value['label'])})) {
|
||||
$info[$conf->global->{'LDAP_FIELD_'.strtoupper($value['label'])}] = $this->socialnetworks[$value['label']];
|
||||
}
|
||||
}
|
||||
|
||||
@ -192,7 +192,6 @@ if ($result > 0) {
|
||||
print '<tr class="oddeven"><td colspan="2">'.$langs->trans("LDAPRecordNotFound").' (dn='.dol_escape_htmltag($dn).' - search='.dol_escape_htmltag($search).')</td></tr>';
|
||||
}
|
||||
$ldap->unbind();
|
||||
$ldap->close();
|
||||
} else {
|
||||
setEventMessages($ldap->error, $ldap->errors, 'errors');
|
||||
}
|
||||
|
||||
@ -31,6 +31,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/ldap.lib.php';
|
||||
$langs->loadLangs(array('users', 'admin', 'companies', 'ldap'));
|
||||
|
||||
$id = GETPOST('id', 'int');
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'userldap'; // To manage different context of search
|
||||
|
||||
// Security check
|
||||
@ -62,7 +63,7 @@ if ($reshook < 0) {
|
||||
}
|
||||
|
||||
if (empty($reshook)) {
|
||||
if ($_GET["action"] == 'dolibarr2ldap') {
|
||||
if ($action == 'dolibarr2ldap') {
|
||||
$ldap = new Ldap();
|
||||
$result = $ldap->connect_bind();
|
||||
|
||||
@ -97,7 +98,7 @@ print dol_get_fiche_head($head, 'ldap', $title, 0, 'user');
|
||||
|
||||
$linkback = '';
|
||||
|
||||
if ($user->rights->user->user->lire || $user->admin) {
|
||||
if (!empty($user->rights->user->user->lire) || !empty($user->admin)) {
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/user/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
||||
}
|
||||
|
||||
@ -198,7 +199,6 @@ if ($result > 0) {
|
||||
}
|
||||
|
||||
$ldap->unbind();
|
||||
$ldap->close();
|
||||
} else {
|
||||
setEventMessages($ldap->error, $ldap->errors, 'errors');
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user