Amélioration gestion du LDAP

This commit is contained in:
Laurent Destailleur 2006-03-31 19:30:08 +00:00
parent 248402c4a1
commit e363b1697a
5 changed files with 264 additions and 374 deletions

View File

@ -54,27 +54,15 @@ $var=True;
// Action mise a jour ou ajout d'une constante // Action mise a jour ou ajout d'une constante
if ($_POST["action"] == 'update' || $_POST["action"] == 'add') if ($_POST["action"] == 'update' || $_POST["action"] == 'add')
{ {
if (isset($_POST["consttype"]) && $_POST["consttype"] != '') if (! dolibarr_set_const($db, $_POST["constname"],$_POST["constvalue"],$typeconst[$_POST["consttype"]],0,isset($_POST["constnote"])?$_POST["constnote"]:''))
{ {
$sql = "DELETE FROM ".MAIN_DB_PREFIX."const WHERE name = '".$_POST["constname"]."';"; print $db->error();
$db->query($sql); }
$sql = '';
$sql = "INSERT INTO ".MAIN_DB_PREFIX."const (name,value,type,visible,note) VALUES ('".$_POST["constname"]."','".$_POST["constvalue"]."','".$typeconst[$_POST["consttype"]]."',0,'".$_POST["constnote"]."') ;";
}
else else
{ {
$sql = "DELETE FROM ".MAIN_DB_PREFIX."const WHERE name = '".$_POST["constname"]."';"; Header("Location: adherent.php");
$db->query($sql); exit;
$sql =''; }
$sql = "INSERT INTO ".MAIN_DB_PREFIX."const (name,value,visible,note) VALUES ('".$_POST["constname"]."','".$_POST["constvalue"]."',0,'".$_POST["constnote"]."') ;";
}
if ($db->query($sql))
{
Header("Location: adherent.php");
}
} }
// Action activation d'un sous module du module adhérent // Action activation d'un sous module du module adhérent
@ -94,6 +82,7 @@ if ($_GET["action"] == 'set')
if ($result) if ($result)
{ {
Header("Location: adherent.php"); Header("Location: adherent.php");
exit;
} }
else { else {
dolibarr_print_error($db); dolibarr_print_error($db);
@ -270,7 +259,7 @@ $db->close();
print '<br>'; print '<br>';
llxFooter(); llxFooter('$Date$ - $Revision$');
function form_constantes($tableau){ function form_constantes($tableau){

View File

@ -3,6 +3,7 @@
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org> * Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be> * Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2005 Regis Houssin <regis.houssin@cap-networks.com> * Copyright (C) 2005 Regis Houssin <regis.houssin@cap-networks.com>
* Copyright (C) 2006 Laurent Destailleur <eldy@users.sourceforge.net>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -52,91 +53,60 @@ if (!$user->admin)
if ($_GET["action"] == 'setvalue' && $user->admin) if ($_GET["action"] == 'setvalue' && $user->admin)
{ {
$sql = "DELETE FROM ".MAIN_DB_PREFIX."const WHERE name = 'LDAP_SERVER_HOST';"; if (! dolibarr_set_const($db, 'LDAP_SERVER_TYPE',$_POST["type"]))
$db->query($sql); {
print $db->error();
}
if (! dolibarr_set_const($db, 'LDAP_SERVER_PROTOCOLVERSION',$_POST["version"]))
{
print $db->error();
}
$sql = "INSERT INTO ".MAIN_DB_PREFIX."const (name,value,visible) VALUES if (! dolibarr_set_const($db, 'LDAP_SERVER_HOST',$_POST["host"]))
('LDAP_SERVER_HOST','".$_POST["host"]."',0);"; {
$db->query($sql); print $db->error();
}
$sql = "DELETE FROM ".MAIN_DB_PREFIX."const WHERE name = 'LDAP_SERVER_PORT';"; if (! dolibarr_set_const($db, 'LDAP_SERVER_PORT',$_POST["port"]))
$db->query($sql); {
print $db->error();
$sql = "INSERT INTO ".MAIN_DB_PREFIX."const (name,value,visible) VALUES }
('LDAP_SERVER_PORT','".$_POST["port"]."',0);"; if (! dolibarr_set_const($db, 'LDAP_ADMIN_DN',$_POST["admin"]))
$db->query($sql); {
print $db->error();
//suppression pour compatibilité divers config ldap }
// if (! dolibarr_set_const($db, 'LDAP_ADMIN_PASS',$_POST["pass"]))
//$sql = "DELETE FROM ".MAIN_DB_PREFIX."const WHERE name = 'LDAP_SUFFIX_DN';"; {
//$db->query($sql); print $db->error();
}
//$sql = "INSERT INTO ".MAIN_DB_PREFIX."const (name,value,visible) VALUES if (! dolibarr_set_const($db, 'LDAP_ADMIN_DN',$_POST["admin"]))
//('LDAP_SUFFIX_DN','".$_POST["suffix"]."',0);"; {
//$db->query($sql); print $db->error();
}
$sql = "DELETE FROM ".MAIN_DB_PREFIX."const WHERE name = 'LDAP_ADMIN_DN';"; if (! dolibarr_set_const($db, 'LDAP_USER_DN',$_POST["user"]))
$db->query($sql); {
print $db->error();
$sql = "INSERT INTO ".MAIN_DB_PREFIX."const (name,value,visible) VALUES }
('LDAP_ADMIN_DN','".$_POST["admin"]."',0);"; if (! dolibarr_set_const($db, 'LDAP_GROUP_DN',$_POST["group"]))
$db->query($sql); {
print $db->error();
$sql = "DELETE FROM ".MAIN_DB_PREFIX."const WHERE name = 'LDAP_ADMIN_PASS';"; }
$db->query($sql); if (! dolibarr_set_const($db, 'LDAP_CONTACT_ACTIVE',$_POST["activecontact"]))
{
$sql = "INSERT INTO ".MAIN_DB_PREFIX."const (name,value,visible) VALUES print $db->error();
('LDAP_ADMIN_PASS','".$_POST["pass"]."',0);"; }
$db->query($sql); if (! dolibarr_set_const($db, 'LDAP_CONTACT_DN',$_POST["contact"]))
{
$sql = "DELETE FROM ".MAIN_DB_PREFIX."const WHERE name = 'LDAP_USER_DN';"; print $db->error();
$db->query($sql); }
if ($db->query($sql))
$sql = "INSERT INTO ".MAIN_DB_PREFIX."const (name,value,visible) VALUES
('LDAP_USER_DN','".$_POST["user"]."',0);";
$db->query($sql);
$sql = "DELETE FROM ".MAIN_DB_PREFIX."const WHERE name = 'LDAP_GROUP_DN';";
$db->query($sql);
$sql = "INSERT INTO ".MAIN_DB_PREFIX."const (name,value,visible) VALUES
('LDAP_GROUP_DN','".$_POST["group"]."',0);";
$db->query($sql);
$sql = "DELETE FROM ".MAIN_DB_PREFIX."const WHERE name = 'LDAP_CONTACT_ACTIVE';";
$db->query($sql);
$sql = "INSERT INTO ".MAIN_DB_PREFIX."const (name,value,visible) VALUES
('LDAP_CONTACT_ACTIVE','".$_POST["activecontact"]."',0);";
$db->query($sql);
$sql = "DELETE FROM ".MAIN_DB_PREFIX."const WHERE name = 'LDAP_CONTACT_DN';";
$db->query($sql);
$sql = "INSERT INTO ".MAIN_DB_PREFIX."const (name,value,visible) VALUES
('LDAP_CONTACT_DN','".$_POST["contact"]."',0);";
$db->query($sql);
$sql = "DELETE FROM ".MAIN_DB_PREFIX."const WHERE name = 'LDAP_SERVER_PROTOCOLVERSION';";
$db->query($sql);
$sql = "INSERT INTO ".MAIN_DB_PREFIX."const (name,value,visible) VALUES
('LDAP_SERVER_PROTOCOLVERSION','".$_POST["version"]."',0);";
$db->query($sql);
$sql = "DELETE FROM ".MAIN_DB_PREFIX."const WHERE name = 'LDAP_SERVER_TYPE';";
$db->query($sql);
$sql = "INSERT INTO ".MAIN_DB_PREFIX."const (name,value,visible) VALUES
('LDAP_SERVER_TYPE','".$_POST["type"]."',0);";
if ($db->query($sql))
{ {
Header("Location: ldap.php"); Header("Location: ldap.php");
exit;
} }
} }
/* /*
* Visu * Visu
*/ */
@ -145,293 +115,216 @@ llxHeader();
print_titre($langs->trans("LDAPSetup")); print_titre($langs->trans("LDAPSetup"));
print '<br>'; // Test si fonction LDAP actives
print '<table class="noborder" width="100%">'; if (! function_exists("ldap_connect"))
print '<tr>';
print '<td width="50%" valign="top">';
print '<table class="border" width="100%">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Parameter").'</td>';
print '<td>'.$langs->trans("Value").'</td><td colspan="2">&nbsp;</td>';
print "</tr>\n";
if (defined("LDAP_SERVER_HOST") && LDAP_SERVER_HOST)
{ {
print '<tr><td>'.$langs->trans("LDAPServer").'</td><td>'.LDAP_SERVER_HOST.'</td></tr>'; $mesg=$langs->trans("LDAPFunctionsNotAvailableOnPHP");
}
else
{
print '<tr><td>'.$langs->trans("LDAPServer").'</td><td>'.$langs->trans("LDAPServerExample").'</td></tr>';
}
if (defined("LDAP_SERVER_PORT") && LDAP_SERVER_PORT)
{
print '<tr><td>'.$langs->trans("LDAPServerPort").'</td><td>'.LDAP_SERVER_PORT.'</td></tr>';
}
else
{
print '<tr><td>'.$langs->trans("LDAPServerPort").'</td><td>'.$langs->trans("LDAPServerPortExample").'</td></tr>';
} }
//suppression pour compatibilité divers config ldap if ($mesg) print '<div class="error">'.$mesg.'</div>';
//
//if (defined("LDAP_SUFFIX_DN") && LDAP_SUFFIX_DN)
//{
// print '<tr><td>'.$langs->trans("LDAPSuffix").'</td><td>'.LDAP_SUFFIX_DN.'</td></tr>';
//}
//else
//{
// print '<tr><td>'.$langs->trans("LDAPSuffix").'</td><td>'.$langs->trans("LDAPSuffixExample").'</td></tr>';
//}
if (defined("LDAP_ADMIN_DN") && LDAP_ADMIN_DN)
{
print '<tr><td>'.$langs->trans("DNAdmin").'</td><td>'.LDAP_ADMIN_DN.'</td></tr>';
}
else
{
print '<tr><td>'.$langs->trans("DNAdmin").'</td><td>'.$langs->trans("DNAdminExample").'</td></tr>';
}
if (defined("LDAP_ADMIN_PASS") && LDAP_ADMIN_PASS)
{
print '<tr><td>'.$langs->trans("LDAPPassword").'</td><td>********</td></tr>';
}
else
{
print '<tr><td>'.$langs->trans("LDAPPassword").'</td><td>'.$langs->trans("LDAPPasswordExample").'</td></tr>';
}
if (defined("LDAP_USER_DN") && LDAP_USER_DN)
{
print '<tr><td>'.$langs->trans("DNUser").'</td><td>'.LDAP_USER_DN.'</td></tr>';
}
else
{
print '<tr><td>'.$langs->trans("DNUser").'</td><td>'.$langs->trans("DNUserExample").'</td></tr>';
}
if (defined("LDAP_GROUP_DN") && LDAP_GROUP_DN)
{
print '<tr><td>'.$langs->trans("DNGroup").'</td><td>'.LDAP_GROUP_DN.'</td></tr>';
}
else
{
print '<tr><td>'.$langs->trans("DNGroup").'</td><td>'.$langs->trans("DNGroupExample").'</td></tr>';
}
if (defined("LDAP_CONTACT_ACTIVE") && LDAP_CONTACT_ACTIVE)
{
print '<tr><td>'.$langs->trans("DNContactActive").'</td><td>'.$langs->trans("DNContactActiveYes").'</td></tr>';
}
else
{
print '<tr><td>'.$langs->trans("DNContactActive").'</td><td>'.$langs->trans("DNContactActiveExample").'</td></tr>';
}
if (defined("LDAP_CONTACT_DN") && LDAP_CONTACT_DN)
{
print '<tr><td>'.$langs->trans("DNContact").'</td><td>'.LDAP_CONTACT_DN.'</td></tr>';
}
else
{
print '<tr><td>'.$langs->trans("DNContact").'</td><td>'.$langs->trans("DNContactExample").'</td></tr>';
}
if (defined("LDAP_SERVER_TYPE") && LDAP_SERVER_TYPE)
{
print '<tr><td>'.$langs->trans("Type").'</td><td>'.LDAP_SERVER_TYPE.'</td></tr>';
}
else
{
print '<tr><td>'.$langs->trans("Type").'</td><td>'.$langs->trans("TypeExample").'</td></tr>';
}
print '<tr><td>'.$langs->trans("Version").'</td><td>'.LDAP_SERVER_PROTOCOLVERSION.'</td></tr>';
print '</table>';
print '</td><td width="50%">';
/*
* Modification
*/
print '<form method="post" action="ldap.php?action=setvalue">'; print '<form method="post" action="ldap.php?action=setvalue">';
print '<table class="border" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Parameter").'</td>'; print '<td>'.$langs->trans("Parameter").'</td>';
print '<td>'.$langs->trans("Value").'</td><td colspan="2">&nbsp;</td>'; print '<td>'.$langs->trans("Value").'</td>';
print '<td>'.$langs->trans("Example").'</td>';
print "</tr>\n"; print "</tr>\n";
print '<tr><td>';
$var=true;
$html=new Form($db);
// Type
$var=!$var;
print '<tr '.$bc[$var].'><td>'.$langs->trans("Type").'</td><td>';
$arraylist=array();
$arraylist['activedirectory']='Active Directory';
$arraylist['openldap']='OpenLdap';
$arraylist['egroupware']='Egroupware';
$html->select_array('type',$arraylist,$conf->global->LDAP_SERVER_TYPE);
print '</td><td>&nbsp;</td></tr>';
// Version
$var=!$var;
print '<tr '.$bc[$var].'><td>'.$langs->trans("Version").'</td><td>';
$arraylist=array();
$arraylist['3']='Version 3';
$arraylist['2']='Version 2';
$html->select_array('version',$arraylist,$conf->global->LDAP_SERVER_PROTOCOLVERSION);
print '</td><td>&nbsp;</td></tr>';
// Serveur
$var=!$var;
print '<tr '.$bc[$var].'><td>';
print $langs->trans("LDAPServer").'</td><td>'; print $langs->trans("LDAPServer").'</td><td>';
print '<input size="25" type="text" name="host" value="'.LDAP_SERVER_HOST.'">'; print '<input size="25" type="text" name="host" value="'.$conf->global->LDAP_SERVER_HOST.'">';
print '</td></tr>'; print '</td><td>'.$langs->trans("LDAPServerExample").'</td></tr>';
print '<tr><td>'.$langs->trans("LDAPServerPort").'</td><td>';
if (defined("LDAP_SERVER_PORT") && LDAP_SERVER_PORT) // Port
$var=!$var;
print '<tr '.$bc[$var].'><td>'.$langs->trans("LDAPServerPort").'</td><td>';
if ($conf->global->LDAP_SERVER_PORT)
{ {
print '<input size="25" type="text" name="port" value="'.LDAP_SERVER_PORT.'">'; print '<input size="25" type="text" name="port" value="'.$conf->global->LDAP_SERVER_PORT.'">';
} }
else else
{ {
print '<input size="25" type="text" name="port" value="389">'; print '<input size="25" type="text" name="port" value="389">';
} }
print '</td></tr>'; print '</td><td>'.$langs->trans("LDAPServerPortExample").'</td></tr>';
//suppression pour compatibilité divers config ldap // DNAdmin
// $var=!$var;
//print '<tr><td>'.$langs->trans("LDAPSuffix").'</td><td>'; print '<tr '.$bc[$var].'><td>'.$langs->trans("DNAdmin").'</td><td>';
//print '<input size="25" type="text" name="suffix" value="'.LDAP_SUFFIX_DN.'">'; print '<input size="25" type="text" name="admin" value="'.$conf->global->LDAP_ADMIN_DN.'">';
//print '</td></tr>'; print '</td><td>&nbsp;</td></tr>';
print '<tr><td>'.$langs->trans("DNAdmin").'</td><td>'; // Pass
print '<input size="25" type="text" name="admin" value="'.LDAP_ADMIN_DN.'">'; $var=!$var;
print '</td></tr>'; print '<tr '.$bc[$var].'><td>'.$langs->trans("LDAPPassword").'</td><td>';
print '<tr><td>'.$langs->trans("LDAPPassword").'</td><td>'; if ($conf->global->LDAP_ADMIN_PASS)
if (defined("LDAP_ADMIN_PASS") && LDAP_ADMIN_PASS)
{ {
print '<input size="25" type="password" name="pass" value="'.LDAP_ADMIN_PASS.'">'; print '<input size="25" type="password" name="pass" value="'.$conf->global->LDAP_ADMIN_PASS.'">';
} }
else else
{ {
print '<input size="25" type="text" name="pass" value="'.LDAP_ADMIN_PASS.'">'; print '<input size="25" type="text" name="pass" value="'.$conf->global->LDAP_ADMIN_PASS.'">';
} }
print '</td></tr>'; print '</td><td>&nbsp;</td></tr>';
print '<tr><td>'.$langs->trans("DNUser").'</td><td>';
print '<input size="25" type="text" name="user" value="'.LDAP_USER_DN.'">';
print '</td></tr>';
print '<tr><td>'.$langs->trans("DNGroup").'</td><td>';
print '<input size="25" type="text" name="group" value="'.LDAP_GROUP_DN.'">';
print '</td></tr>';
print '<tr><td>'.$langs->trans("DNContactActive").'</td><td><select name="activecontact">';
if (defined("LDAP_CONTACT_ACTIVE") && LDAP_CONTACT_ACTIVE == 1)
{
print '<option value="1" selected="true">'.$langs->trans("Yes");
}
else
{
print '<option value="0" selected="true">'.$langs->trans("No");
}
print '<option value="LDAP_CONTACT_ACTIVE">--------';
print '<option value="0">'.$langs->trans("No");
print '<option value="1">'.$langs->trans("Yes");
print '</select>';
print '</td></tr>';
print '<tr><td>'.$langs->trans("DNContact").'</td><td>';
print '<input size="25" type="text" name="contact" value="'.LDAP_CONTACT_DN.'">';
print '</td></tr>';
print '<tr><td>'.$langs->trans("Type").'</td><td><select name="type">';
if (defined("LDAP_SERVER_TYPE") && LDAP_SERVER_TYPE == activedirectory)
{
print '<option value="activedirectory" selected="true">Active Directory';
}
else
{
if (defined("LDAP_SERVER_TYPE") && LDAP_SERVER_TYPE == egroupware)
{
print '<option value="egroupware" selected="true">Egroupware';
}
else
{
print '<option value="openldap" selected="true">OpenLdap';
}
}
print '<option value="LDAP_SERVER_TYPE">------------------------';
print '<option value="openldap">OpenLdap';
print '<option value="egroupware">Egroupware';
print '<option value="activedirectory">Active Directory';
print '</select>';
print '</td></tr>';
print '<tr><td>'.$langs->trans("Version").'</td><td><select name="version">'; print '<tr class="liste_titre">';
print '<td colspan="3">'.$langs->trans("LDAPSynchronizeUsersAndGroup").'</td>';
print "</tr>\n";
if (defined("LDAP_SERVER_PROTOCOLVERSION") && LDAP_SERVER_PROTOCOLVERSION == 3) // Synchro contact active
{ $var=!$var;
print '<option value="3" selected="true">Version 3'; print '<tr '.$bc[$var].'><td>'.$langs->trans("DNUserGroupActive").'</td><td>';
} $arraylist=array();
else $arraylist['0']=$langs->trans("Yes");
{ $html->select_array('activecontact',$arraylist,$conf->global->LDAP_USERGROUP_ACTIVE);
print '<option value="2" selected="true">Version 2'; print '</td><td>'.$langs->trans("NotYetAvailable").'</td></tr>';
}
print '<option value="LDAP_SERVER_PROTOCOLVERSION">------------------------'; // DN Pour les utilisateurs
print '<option value="3">Version 3'; $var=!$var;
print '<option value="2">Version 2'; print '<tr '.$bc[$var].'><td>'.$langs->trans("DNUser").'</td><td>';
print '</select>'; print '<input size="25" type="text" name="user" value="'.$conf->global->LDAP_USER_DN.'">';
print '</td></tr>'; print '</td><td>'.$langs->trans("DNUserExample").'</td></tr>';
// DN pour les groupes
$var=!$var;
print '<tr '.$bc[$var].'><td>'.$langs->trans("DNGroup").'</td><td>';
print '<input size="25" type="text" name="group" value="'.$conf->global->LDAP_GROUP_DN.'">';
print '</td><td>'.$langs->trans("DNGroupExample").'</td></tr>';
print '<tr class="liste_titre">';
print '<td colspan="3">'.$langs->trans("LDAPSynchronizeContacts").'</td>';
print "</tr>\n";
// Synchro contact active
$var=!$var;
print '<tr '.$bc[$var].'><td>'.$langs->trans("DNContactActive").'</td><td>';
$arraylist=array();
$arraylist['0']=$langs->trans("No");
$arraylist['1']=$langs->trans("Yes");
$html->select_array('activecontact',$arraylist,$conf->global->LDAP_CONTACT_ACTIVE);
print '</td><td>'.$langs->trans("DNContactActiveExample").'</td></tr>';
// DN Pour les contacts
$var=!$var;
print '<tr '.$bc[$var].'><td>'.$langs->trans("DNContact").'</td><td>';
print '<input size="25" type="text" name="contact" value="'.$conf->global->LDAP_CONTACT_DN.'">';
print '</td><td>'.$langs->trans("DNContactExample").'</td></tr>';
print '<tr><td colspan="3" align="center"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td></tr>';
print '</table>';
print '</form>';
print '<tr><td colspan="2" align="center"><input type="submit" value="'.$langs->trans("Modify").'"></td></tr>';
print '</table></form>';
print '</td></tr></table>';
/* /*
* test de la connexion * Test de la connexion
*/ */
if (function_exists("ldap_connect"))
if (defined("LDAP_SERVER_HOST") && LDAP_SERVER_HOST) {
print '<a class="tabAction" href="ldap.php?action=test">'.$langs->trans("TestConnectLdap").'</a><br><br>';
}
if (defined("LDAP_SERVER_HOST") && LDAP_SERVER_HOST && LDAP_ADMIN_DN && LDAP_ADMIN_PASS && $_GET["action"] == 'test')
{ {
$ds = dolibarr_ldap_connect(); if ($conf->global->LDAP_SERVER_HOST)
{
print '<a class="tabAction" href="ldap.php?action=test">'.$langs->trans("TestConnectLdap").'</a><br><br>';
}
if ($ds)
{
print img_picto('','info');
print "connexion au serveur ldap réussie<br>";
}
else
{
print img_picto('','alerte');
print "connexion au serveur ldap échouée"; if ($conf->global->LDAP_SERVER_HOST && $conf->global->LDAP_ADMIN_DN && $conf->global->LDAP_ADMIN_PASS && $_GET["action"] == 'test')
print "<br>"; {
print ldap_error($ds); // Test ldap_connect
print "<br>"; $ds = dolibarr_ldap_connect();
}
if ((dolibarr_ldap_getversion($ds) == 3))
{
print img_picto('','info');
print "Serveur ldap configuré en version 3<br>";
}
else
{
print img_picto('','info');
print "Serveur ldap configuré en version 2<br>";
}
$bind = @dolibarr_ldap_bind($ds); if ($ds)
{
print img_picto('','info');
print $langs->trans("LDAPTestOK").'<br>';
}
else
{
print img_picto('','alerte');
print $langs->trans("LDAPTestKO").'<br>';
print "<br>";
print ldap_error($ds);
print "<br>";
}
if ($bind) // Test ldap_getversion
{ if ((dolibarr_ldap_getversion($ds) == 3))
print img_picto('','info'); {
print "connexion au dn $dn réussi<br>"; print img_picto('','info');
} print $langs->trans("LDAPSetupForVersion3").'<br>';
else }
{ else
print img_picto('','alerte'); {
print img_picto('','info');
print $langs->trans("LDAPSetupForVersion2").'<br>';
}
print "connexion au dn $dn raté : "; // Test ldap_bind
print ldap_error($ds); $bind = @dolibarr_ldap_bind($ds);
print "<br>"; if ($bind)
} {
print img_picto('','info');
print "Connexion au dn $dn réussi<br>";
}
else
{
print img_picto('','alerte');
$unbind = @dolibarr_ldap_unbind($ds); print "Connexion au dn $dn raté : ";
print ldap_error($ds);
print "<br>";
}
if ($bind) // Test ldap_unbind
{ $unbind = @dolibarr_ldap_unbind($ds);
print img_picto('','info'); if ($bind)
print "déconnection du dn $dn réussi<br>"; {
} print img_picto('','info');
else print "Déconnection du dn $dn réussi<br>";
{ }
print img_picto('','alerte'); else
{
print img_picto('','alerte');
print "déconnection du dn $dn raté"; print "Déconnection du dn $dn raté";
print "<br>"; print "<br>";
} }
}
} }
$db->close(); $db->close();
llxFooter(); llxFooter('$Date$ - $Revision$');
?> ?>

View File

@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2003-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2003-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org> * Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Éric Seigne <eric.seigne@ryxeo.com> * Copyright (C) 2004 Éric Seigne <eric.seigne@ryxeo.com>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -30,9 +30,13 @@
require("./pre.inc.php"); require("./pre.inc.php");
$mode=isset($_GET["mode"])?$_GET["mode"]:0;
$mesg=isset($_GET["mesg"])?urldecode($_GET["mode"]):"";
if (!$user->admin) if (!$user->admin)
accessforbidden(); accessforbidden();
/* /*
* Actions * Actions
*/ */
@ -42,7 +46,7 @@ if ($_GET["action"] == 'set' && $user->admin)
$result=Activate($_GET["value"]); $result=Activate($_GET["value"]);
$mesg=''; $mesg='';
if ($result) $mesg=$result; if ($result) $mesg=$result;
Header("Location: modules.php?spe=".$_GET["spe"]."&mesg=".urlencode($mesg)); Header("Location: modules.php?mode=".$mode."&mesg=".urlencode($mesg));
exit; exit;
} }
@ -51,7 +55,7 @@ if ($_GET["action"] == 'reset' && $user->admin)
$result=UnActivate($_GET["value"]); $result=UnActivate($_GET["value"]);
$mesg=''; $mesg='';
if ($result) $mesg=$result; if ($result) $mesg=$result;
Header("Location: modules.php?spe=".$_GET["spe"]."&mesg=".urlencode($mesg)); Header("Location: modules.php?mode=".$mode."&mesg=".urlencode($mesg));
exit; exit;
} }
@ -143,33 +147,31 @@ llxHeader("","");
$h = 0; $h = 0;
$head[$h][0] = DOL_URL_ROOT."/admin/modules.php?spe=0"; $head[$h][0] = DOL_URL_ROOT."/admin/modules.php?mode=0";
$head[$h][1] = $langs->trans("ModulesCommon"); $head[$h][1] = $langs->trans("ModulesCommon");
if (!$_GET["spe"]) $hselected=$h; if ($mode==0) $hselected=$h;
$h++; $h++;
$head[$h][0] = DOL_URL_ROOT."/admin/modules.php?spe=1"; $head[$h][0] = DOL_URL_ROOT."/admin/modules.php?mode=1";
$head[$h][1] = $langs->trans("ModulesInterfaces");
if ($mode==1) $hselected=$h;
$h++;
$head[$h][0] = DOL_URL_ROOT."/admin/modules.php?mode=2";
$head[$h][1] = $langs->trans("ModulesSpecial"); $head[$h][1] = $langs->trans("ModulesSpecial");
if ($_GET["spe"]) $hselected=$h; if ($mode==2) $hselected=$h;
$h++; $h++;
dolibarr_fiche_head($head, $hselected, $langs->trans("Modules")); dolibarr_fiche_head($head, $hselected, $langs->trans("Modules"));
if (!$_GET["spe"]) if ($mode==0) print $langs->trans("ModulesDesc")."<br>\n";
{ if ($mode==1) print $langs->trans("ModulesInterfaceDesc")."<br>\n";
print $langs->trans("ModulesDesc")."<br>\n"; if ($mode==2) print $langs->trans("ModulesSpecialDesc")."<br>\n";
}
else
{
print $langs->trans("ModulesSpecialDesc")."<br>\n";
}
if ($_GET["mesg"])
{
$mesg=urldecode($_GET["mesg"]); if ($mesg) print '<div class="error">'.$mesg.'</div>';
print '<div class="error">'.$mesg.'</div>';
}
print "<br>\n"; print "<br>\n";
print "<table class=\"noborder\" width=\"100%\">\n"; print "<table class=\"noborder\" width=\"100%\">\n";
@ -258,7 +260,7 @@ foreach ($orders as $key => $value)
$atleastoneforfamily=0; $atleastoneforfamily=0;
} }
if ((!$objMod->special && !$_GET["spe"] ) or ($objMod->special && $_GET["spe"])) if ($objMod->special == $mode)
{ {
$atleastoneforfamily=1; $atleastoneforfamily=1;
$var=!$var; $var=!$var;
@ -302,7 +304,7 @@ foreach ($orders as $key => $value)
{ {
// Module actif // Module actif
if ($family == 'base') print $langs->trans("Required"); if ($family == 'base') print $langs->trans("Required");
else print "<a href=\"modules.php?id=".$objMod->numero."&amp;action=reset&amp;value=" . $modName . "&amp;spe=" . $_GET["spe"] . "\">" . $langs->trans("Disable") . "</a></td>\n"; else print "<a href=\"modules.php?id=".$objMod->numero."&amp;action=reset&amp;value=" . $modName . "&amp;mode=" . $mode . "\">" . $langs->trans("Disable") . "</a></td>\n";
if ($objMod->config_page_url) if ($objMod->config_page_url)
{ {
@ -345,7 +347,7 @@ foreach ($orders as $key => $value)
} }
// Module non actif // Module non actif
print "<a href=\"modules.php?id=".$objMod->numero."&amp;action=set&amp;value=" . $modName . "&amp;spe=" . $_GET["spe"] . "\">" . $langs->trans("Activate") . "</a></td>\n <td>&nbsp;</td>\n"; print "<a href=\"modules.php?id=".$objMod->numero."&amp;action=set&amp;value=" . $modName . "&amp;mode=" . $mode . "\">" . $langs->trans("Activate") . "</a></td>\n <td>&nbsp;</td>\n";
} }
print "</tr>\n"; print "</tr>\n";

View File

@ -392,9 +392,11 @@ MembersSetup=Members module setup
MemberMainOptions=Main options MemberMainOptions=Main options
AddSubscriptionIntoAccount=Add subscriptions into bank or cash account, of bank module AddSubscriptionIntoAccount=Add subscriptions into bank or cash account, of bank module
AdherentMailRequired=EMail required to create a new member AdherentMailRequired=EMail required to create a new member
##### LDAP setup #### ##### LDAP setup #####
LDAPSetup=LDAP Setup LDAPSetup=LDAP Setup
LDAPFunctionsNotAvailableOnPHP=LDAP functions are not availbale on your PHP LDAPFunctionsNotAvailableOnPHP=LDAP functions are not availbale on your PHP
LDAPSynchronizeUsersAndGroup=Synchronize Dolibarr users and groups to LDAP
LDAPSynchronizeContacts=Synchronize Dolibarr contacts to LDAP
LDAPTypeExample=OpenLdap, Egroupware or Active Directory LDAPTypeExample=OpenLdap, Egroupware or Active Directory
LDAPServer=LDAP Server LDAPServer=LDAP Server
LDAPServerPort=LDAP server port LDAPServerPort=LDAP server port
@ -408,9 +410,10 @@ LDAPServerExample=Server address (ex: localhost, 127.0.0.1, 192.168.0.2)
#LDAPSuffixExample=Complete DN (ex: dc=company,dc=com) #LDAPSuffixExample=Complete DN (ex: dc=company,dc=com)
DNAdminExample=Complete DN (ex: cn=adminldap,dc=society,dc=com) DNAdminExample=Complete DN (ex: cn=adminldap,dc=society,dc=com)
LDAPPasswordExample=Admin password LDAPPasswordExample=Admin password
DBUserGroupActive=Users and groups synchronization
DNUserExample=Complete DN (ex: ou=users,dc=society,dc=com) DNUserExample=Complete DN (ex: ou=users,dc=society,dc=com)
DNGroupExample=Complete DN (ex: ou=groups,dc=society,dc=com) DNGroupExample=Complete DN (ex: ou=groups,dc=society,dc=com)
DNContactActive=Contacts' synchronization? DNContactActive=Contacts' synchronization
DNContactActiveYes=Activated synchronization DNContactActiveYes=Activated synchronization
DNContactActiveExample=Activated/Unactivated synchronization DNContactActiveExample=Activated/Unactivated synchronization
DNContact=Dolibarr contacts' DN DNContact=Dolibarr contacts' DN

View File

@ -395,6 +395,8 @@ AdherentMailRequired=EMail obligatoire pour cr
##### LDAP setup ##### ##### LDAP setup #####
LDAPSetup=Configuration du module LDAP LDAPSetup=Configuration du module LDAP
LDAPFunctionsNotAvailableOnPHP=Les fonctions LDAP ne sont pas disponibles sur votre PHP LDAPFunctionsNotAvailableOnPHP=Les fonctions LDAP ne sont pas disponibles sur votre PHP
LDAPSynchronizeUsersAndGroup=Synchronisation des utilisateurs et groupes Dolibarr vers LDAP
LDAPSynchronizeContacts=Synchronisation des contacts Dolibarr vers LDAP
LDAPTypeExample=OpenLdap, Egroupware ou Active Directory LDAPTypeExample=OpenLdap, Egroupware ou Active Directory
LDAPServer=Serveur LDAP LDAPServer=Serveur LDAP
LDAPServerPort=Port du serveur LDAP LDAPServerPort=Port du serveur LDAP
@ -408,9 +410,10 @@ LDAPServerExample=Adresse du serveur (ex: localhost, 127.0.0.1, 192.168.0.2)
#LDAPSuffixExample=DN complet (ex: dc=societe,dc=com) #LDAPSuffixExample=DN complet (ex: dc=societe,dc=com)
DNAdminExample=DN complet (ex: cn=adminldap,dc=societe,dc=com) DNAdminExample=DN complet (ex: cn=adminldap,dc=societe,dc=com)
LDAPPasswordExample=Mot de passe de l'administrateur LDAPPasswordExample=Mot de passe de l'administrateur
DBUserGroupActive=Synchronisation des utilisateurs et groupes
DNUserExample=DN complet (ex: ou=users,dc=societe,dc=com) DNUserExample=DN complet (ex: ou=users,dc=societe,dc=com)
DNGroupExample=DN complet (ex: ou=groups,dc=societe,dc=com) DNGroupExample=DN complet (ex: ou=groups,dc=societe,dc=com)
DNContactActive=Synchronisation des contacts ? DNContactActive=Synchronisation des contacts
DNContactActiveYes=Synchronisation activée DNContactActiveYes=Synchronisation activée
DNContactActiveExample=Synchronisation activée/désactivée DNContactActiveExample=Synchronisation activée/désactivée
DNContact=DN des contacts Dolibarr DNContact=DN des contacts Dolibarr