2
0
forked from Wavyzz/dolibarr

Fix: UTF8 support for LDAP module

This commit is contained in:
Laurent Destailleur
2008-12-09 20:14:04 +00:00
parent ddd8102a47
commit 6abe23f15c
14 changed files with 753 additions and 695 deletions

View File

@@ -51,6 +51,7 @@ if ($_GET["action"] == 'setvalue' && $user->admin)
if (! dolibarr_set_const($db, 'LDAP_GROUP_DN',$_POST["group"])) $error++;
if (! dolibarr_set_const($db, 'LDAP_GROUP_OBJECT_CLASS',$_POST["objectclass"])) $error++;
if (! dolibarr_set_const($db, 'LDAP_FIELD_FULLNAME',$_POST["fieldfullname"])) $error++;
if (! dolibarr_set_const($db, 'LDAP_FIELD_NAME',$_POST["fieldname"])) $error++;
if (! dolibarr_set_const($db, 'LDAP_FIELD_DESCRIPTION',$_POST["fielddescription"])) $error++;
@@ -172,19 +173,15 @@ print info_admin($langs->trans("LDAPDescValues"));
/*
* Test de la connexion
*/
print '<br>';
if ($conf->global->LDAP_SYNCHRO_ACTIVE == 'dolibarr2ldap')
{
if (! function_exists("ldap_connect"))
{
print '<a class="butActionRefused" href="#" title="'.$langs->trans('LDAPFunctionsNotAvailableOnPHP').'">'.$langs->trans("LDAPTestSynchroGroup").'</a>';
}
else if (empty($conf->global->LDAP_SERVER_HOST))
{
print '<a class="butActionRefused" href="#" title="'.$langs->trans('SetupNotComplete').'">'.$langs->trans("LDAPTestSynchroGroup").'</a>';
}
else print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=testgroup">'.$langs->trans("LDAPTestSynchroGroup").'</a>';
print '<br><br>';
$butlabel=$langs->trans("LDAPTestSynchroGroup");
$testlabel='testgroup';
$key=$conf->global->LDAP_KEY_GROUPS;
$dn=$conf->global->LDAP_GROUP_DN;
$objectclass=$conf->global->LDAP_GROUP_OBJECT_CLASS;
show_ldap_test_button($butlabel,$testlabel,$key,$dn,$objectclass);
}
if (function_exists("ldap_connect"))
@@ -192,8 +189,8 @@ if (function_exists("ldap_connect"))
if ($_GET["action"] == 'testgroup')
{
// Creation objet
$fgroup=new UserGroup($db);
$fgroup->initAsSpecimen();
$object=new UserGroup($db);
$object->initAsSpecimen();
// Test synchro
$ldap=new Ldap();
@@ -201,8 +198,8 @@ if (function_exists("ldap_connect"))
if ($result > 0)
{
$info=$fgroup->_load_ldap_info();
$dn=$fgroup->_load_ldap_dn($info);
$info=$object->_load_ldap_info();
$dn=$object->_load_ldap_dn($info);
$result2=$ldap->update($dn,$info,$user);
$result3=$ldap->delete($dn);
@@ -218,6 +215,7 @@ if (function_exists("ldap_connect"))
print '<font class="error">'.$langs->trans("LDAPSynchroKOMayBePermissions");
print ': '.$ldap->error;
print '</font><br>';
print $langs->trans("ErrorLDAPMakeManualTest",$conf->ldap->dir_temp).'<br>';
}
}
else
@@ -226,12 +224,17 @@ if (function_exists("ldap_connect"))
print '<font class="error">'.$langs->trans("LDAPSynchroKO");
print ': '.$ldap->error;
print '</font><br>';
print $langs->trans("ErrorLDAPMakeManualTest",$conf->ldap->dir_temp).'<br>';
}
print "<br>\n";
print "LDAP input file used for test:<br><br>\n";
print nl2br($ldap->dump_content($dn,$info));
print "\n<br>";
}
}
$db->close();
llxFooter('$Date$ - $Revision$');
?>