2004-10-19 20:58:50 +02:00
|
|
|
|
<?php
|
2004-01-23 13:42:17 +01:00
|
|
|
|
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
2004-09-02 23:14:20 +02:00
|
|
|
|
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
|
|
|
|
|
|
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
2005-07-10 14:37:31 +02:00
|
|
|
|
* Copyright (C) 2005 Regis Houssin <regis.houssin@cap-networks.com>
|
2004-01-23 13:42:17 +01:00
|
|
|
|
*
|
|
|
|
|
|
* 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
|
|
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
|
|
* (at your option) any later version.
|
|
|
|
|
|
*
|
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
|
*
|
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
|
|
*
|
|
|
|
|
|
* $Id$
|
|
|
|
|
|
* $Source$
|
|
|
|
|
|
*/
|
2004-06-18 20:34:41 +02:00
|
|
|
|
|
2005-07-14 01:00:37 +02:00
|
|
|
|
/**
|
|
|
|
|
|
\file htdocs/admin/ldap.php
|
2004-08-29 14:01:58 +02:00
|
|
|
|
\ingroup ldap
|
|
|
|
|
|
\brief Page d'administration/configuration du module Ldap
|
|
|
|
|
|
\version $Revision$
|
2005-07-14 01:00:37 +02:00
|
|
|
|
\remarks Exemple configuration :
|
2005-07-14 19:32:04 +02:00
|
|
|
|
LDAP_SERVER_HOST Serveur LDAP 192.168.1.50
|
|
|
|
|
|
LDAP_SERVER_PORT Port LDAP 389
|
|
|
|
|
|
LDAP_ADMIN_DN Administrateur LDAP cn=adminldap,dc=societe,dc=com
|
|
|
|
|
|
LDAP_ADMIN_PASS Mot de passe xxxxxxxx
|
|
|
|
|
|
LDAP_USER_DN DN des utilisateurs ou=users,dc=societe,dc=com
|
|
|
|
|
|
LDAP_GROUP_DN DN des groupes ou=groups,dc=societe,dc=com
|
|
|
|
|
|
LDAP_CONTACT_DN DN des contacts ou=contacts,dc=societe,dc=com
|
|
|
|
|
|
LDAP_SERVER_TYPE Type Openldap
|
2004-08-29 14:01:58 +02:00
|
|
|
|
*/
|
|
|
|
|
|
|
2004-01-23 13:42:17 +01:00
|
|
|
|
require("./pre.inc.php");
|
2004-01-23 14:31:09 +01:00
|
|
|
|
require (DOL_DOCUMENT_ROOT."/lib/ldap.lib.php");
|
2004-01-23 13:42:17 +01:00
|
|
|
|
|
2004-08-29 14:01:58 +02:00
|
|
|
|
$langs->load("admin");
|
|
|
|
|
|
|
|
|
|
|
|
if (!$user->admin)
|
|
|
|
|
|
accessforbidden();
|
|
|
|
|
|
|
2005-01-16 18:00:11 +01:00
|
|
|
|
/*
|
|
|
|
|
|
* Actions
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
2004-01-23 13:42:17 +01:00
|
|
|
|
if ($_GET["action"] == 'setvalue' && $user->admin)
|
|
|
|
|
|
{
|
2004-09-11 01:17:33 +02:00
|
|
|
|
$sql = "DELETE FROM ".MAIN_DB_PREFIX."const WHERE name = 'LDAP_SERVER_HOST';";
|
2004-12-01 12:26:19 +01:00
|
|
|
|
$db->query($sql);
|
2004-09-11 01:17:33 +02:00
|
|
|
|
|
2004-12-01 12:26:19 +01:00
|
|
|
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."const (name,value,visible) VALUES
|
|
|
|
|
|
('LDAP_SERVER_HOST','".$_POST["host"]."',0);";
|
2005-07-10 14:37:31 +02:00
|
|
|
|
$db->query($sql);
|
2005-07-13 11:22:59 +02:00
|
|
|
|
|
|
|
|
|
|
$sql = "DELETE FROM ".MAIN_DB_PREFIX."const WHERE name = 'LDAP_SERVER_PORT';";
|
|
|
|
|
|
$db->query($sql);
|
|
|
|
|
|
|
|
|
|
|
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."const (name,value,visible) VALUES
|
|
|
|
|
|
('LDAP_SERVER_PORT','".$_POST["port"]."',0);";
|
|
|
|
|
|
$db->query($sql);
|
2005-07-14 19:32:04 +02:00
|
|
|
|
|
|
|
|
|
|
//suppression pour compatibilit<69> divers config ldap
|
|
|
|
|
|
//
|
|
|
|
|
|
//$sql = "DELETE FROM ".MAIN_DB_PREFIX."const WHERE name = 'LDAP_SUFFIX_DN';";
|
|
|
|
|
|
//$db->query($sql);
|
2004-01-23 13:42:17 +01:00
|
|
|
|
|
2005-07-14 19:32:04 +02:00
|
|
|
|
//$sql = "INSERT INTO ".MAIN_DB_PREFIX."const (name,value,visible) VALUES
|
|
|
|
|
|
//('LDAP_SUFFIX_DN','".$_POST["suffix"]."',0);";
|
|
|
|
|
|
//$db->query($sql);
|
2005-07-10 14:37:31 +02:00
|
|
|
|
|
|
|
|
|
|
$sql = "DELETE FROM ".MAIN_DB_PREFIX."const WHERE name = 'LDAP_ADMIN_DN';";
|
|
|
|
|
|
$db->query($sql);
|
2004-12-01 12:26:19 +01:00
|
|
|
|
|
|
|
|
|
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."const (name,value,visible) VALUES
|
2005-07-10 14:47:04 +02:00
|
|
|
|
('LDAP_ADMIN_DN','".$_POST["admin"]."',0);";
|
2004-01-23 13:42:17 +01:00
|
|
|
|
$db->query($sql);
|
|
|
|
|
|
|
2005-07-10 14:37:31 +02:00
|
|
|
|
$sql = "DELETE FROM ".MAIN_DB_PREFIX."const WHERE name = 'LDAP_ADMIN_PASS';";
|
2004-12-01 12:26:19 +01:00
|
|
|
|
$db->query($sql);
|
|
|
|
|
|
|
|
|
|
|
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."const (name,value,visible) VALUES
|
2005-07-10 14:37:31 +02:00
|
|
|
|
('LDAP_ADMIN_PASS','".$_POST["pass"]."',0);";
|
|
|
|
|
|
$db->query($sql);
|
|
|
|
|
|
|
|
|
|
|
|
$sql = "DELETE FROM ".MAIN_DB_PREFIX."const WHERE name = 'LDAP_USER_DN';";
|
|
|
|
|
|
$db->query($sql);
|
|
|
|
|
|
|
|
|
|
|
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."const (name,value,visible) VALUES
|
2005-07-10 14:47:04 +02:00
|
|
|
|
('LDAP_USER_DN','".$_POST["user"]."',0);";
|
2005-07-10 14:37:31 +02:00
|
|
|
|
$db->query($sql);
|
|
|
|
|
|
|
|
|
|
|
|
$sql = "DELETE FROM ".MAIN_DB_PREFIX."const WHERE name = 'LDAP_GROUP_DN';";
|
|
|
|
|
|
$db->query($sql);
|
2004-09-11 01:17:33 +02:00
|
|
|
|
|
2005-07-10 14:37:31 +02:00
|
|
|
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."const (name,value,visible) VALUES
|
2005-07-10 14:47:04 +02:00
|
|
|
|
('LDAP_GROUP_DN','".$_POST["group"]."',0);";
|
2004-01-23 13:42:17 +01:00
|
|
|
|
$db->query($sql);
|
2005-07-11 11:47:24 +02:00
|
|
|
|
|
|
|
|
|
|
$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);
|
2004-01-23 13:42:17 +01:00
|
|
|
|
|
2005-08-08 14:13:41 +02:00
|
|
|
|
$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);
|
|
|
|
|
|
|
|
|
|
|
|
|
2004-09-11 01:17:33 +02:00
|
|
|
|
$sql = "DELETE FROM ".MAIN_DB_PREFIX."const WHERE name = 'LDAP_SERVER_TYPE';";
|
2004-01-23 13:42:17 +01:00
|
|
|
|
$db->query($sql);
|
|
|
|
|
|
|
2004-12-01 12:26:19 +01:00
|
|
|
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."const (name,value,visible) VALUES
|
|
|
|
|
|
('LDAP_SERVER_TYPE','".$_POST["type"]."',0);";
|
2004-01-23 13:42:17 +01:00
|
|
|
|
|
|
|
|
|
|
if ($db->query($sql))
|
|
|
|
|
|
{
|
|
|
|
|
|
Header("Location: ldap.php");
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2005-07-10 15:30:57 +02:00
|
|
|
|
/*
|
|
|
|
|
|
* Visu
|
|
|
|
|
|
*/
|
2004-06-18 20:34:41 +02:00
|
|
|
|
|
2005-01-16 18:00:11 +01:00
|
|
|
|
llxHeader();
|
|
|
|
|
|
|
|
|
|
|
|
print_titre($langs->trans("LDAPSetup"));
|
2004-06-18 20:34:41 +02:00
|
|
|
|
|
2005-01-16 18:00:11 +01:00
|
|
|
|
print '<br>';
|
|
|
|
|
|
print '<table class="noborder" width="100%">';
|
2004-01-23 13:42:17 +01:00
|
|
|
|
print '<tr>';
|
|
|
|
|
|
print '<td width="50%" valign="top">';
|
|
|
|
|
|
|
2005-01-16 18:00:11 +01:00
|
|
|
|
print '<table class="border" width="100%">';
|
2004-01-23 13:42:17 +01:00
|
|
|
|
print '<tr class="liste_titre">';
|
2005-01-16 18:00:11 +01:00
|
|
|
|
print '<td>'.$langs->trans("Parameter").'</td>';
|
|
|
|
|
|
print '<td>'.$langs->trans("Value").'</td><td colspan="2"> </td>';
|
2004-01-23 13:42:17 +01:00
|
|
|
|
print "</tr>\n";
|
2005-07-10 16:02:26 +02:00
|
|
|
|
|
2005-08-08 14:13:41 +02:00
|
|
|
|
if (defined("LDAP_SERVER_HOST") && LDAP_SERVER_HOST)
|
|
|
|
|
|
{
|
|
|
|
|
|
print '<tr><td>'.$langs->trans("LDAPServer").'</td><td>'.LDAP_SERVER_HOST.'</td></tr>';
|
|
|
|
|
|
}
|
|
|
|
|
|
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<69> divers config ldap
|
|
|
|
|
|
//
|
|
|
|
|
|
//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>';
|
|
|
|
|
|
}
|
2005-07-10 16:02:26 +02:00
|
|
|
|
else
|
2005-08-08 14:13:41 +02:00
|
|
|
|
{
|
|
|
|
|
|
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>';
|
2004-01-23 13:42:17 +01:00
|
|
|
|
|
|
|
|
|
|
print '</table>';
|
|
|
|
|
|
|
|
|
|
|
|
print '</td><td width="50%">';
|
|
|
|
|
|
|
2005-07-10 15:30:57 +02:00
|
|
|
|
/*
|
|
|
|
|
|
* Modification
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
2004-01-23 13:42:17 +01:00
|
|
|
|
print '<form method="post" action="ldap.php?action=setvalue">';
|
|
|
|
|
|
|
2005-01-16 18:00:11 +01:00
|
|
|
|
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"> </td>';
|
2004-01-23 13:42:17 +01:00
|
|
|
|
print "</tr>\n";
|
|
|
|
|
|
print '<tr><td>';
|
2005-01-16 18:00:11 +01:00
|
|
|
|
print $langs->trans("LDAPServer").'</td><td>';
|
|
|
|
|
|
print '<input size="25" type="text" name="host" value="'.LDAP_SERVER_HOST.'">';
|
2004-01-23 13:42:17 +01:00
|
|
|
|
print '</td></tr>';
|
2005-07-13 11:22:59 +02:00
|
|
|
|
print '<tr><td>'.$langs->trans("LDAPServerPort").'</td><td>';
|
|
|
|
|
|
if (defined("LDAP_SERVER_PORT") && LDAP_SERVER_PORT)
|
|
|
|
|
|
{
|
2005-08-08 14:13:41 +02:00
|
|
|
|
print '<input size="25" type="text" name="port" value="'.LDAP_SERVER_PORT.'">';
|
2005-07-13 11:22:59 +02:00
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
2005-08-08 14:13:41 +02:00
|
|
|
|
print '<input size="25" type="text" name="port" value="389">';
|
2005-07-13 11:22:59 +02:00
|
|
|
|
}
|
|
|
|
|
|
print '</td></tr>';
|
2005-07-14 19:32:04 +02:00
|
|
|
|
|
|
|
|
|
|
//suppression pour compatibilit<69> divers config ldap
|
|
|
|
|
|
//
|
|
|
|
|
|
//print '<tr><td>'.$langs->trans("LDAPSuffix").'</td><td>';
|
|
|
|
|
|
//print '<input size="25" type="text" name="suffix" value="'.LDAP_SUFFIX_DN.'">';
|
|
|
|
|
|
//print '</td></tr>';
|
|
|
|
|
|
|
2005-07-10 14:37:31 +02:00
|
|
|
|
print '<tr><td>'.$langs->trans("DNAdmin").'</td><td>';
|
|
|
|
|
|
print '<input size="25" type="text" name="admin" value="'.LDAP_ADMIN_DN.'">';
|
|
|
|
|
|
print '</td></tr>';
|
|
|
|
|
|
print '<tr><td>'.$langs->trans("LDAPPassword").'</td><td>';
|
2005-07-21 16:50:20 +02:00
|
|
|
|
if (defined("LDAP_ADMIN_PASS") && LDAP_ADMIN_PASS)
|
|
|
|
|
|
{
|
|
|
|
|
|
print '<input size="25" type="password" name="pass" value="'.LDAP_ADMIN_PASS.'">';
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
2005-08-08 14:13:41 +02:00
|
|
|
|
print '<input size="25" type="text" name="pass" value="'.LDAP_ADMIN_PASS.'">';
|
2005-07-21 16:50:20 +02:00
|
|
|
|
}
|
2005-07-10 14:37:31 +02:00
|
|
|
|
print '</td></tr>';
|
|
|
|
|
|
print '<tr><td>'.$langs->trans("DNUser").'</td><td>';
|
|
|
|
|
|
print '<input size="25" type="text" name="user" value="'.LDAP_USER_DN.'">';
|
2004-01-23 13:42:17 +01:00
|
|
|
|
print '</td></tr>';
|
2005-07-10 14:37:31 +02:00
|
|
|
|
print '<tr><td>'.$langs->trans("DNGroup").'</td><td>';
|
|
|
|
|
|
print '<input size="25" type="text" name="group" value="'.LDAP_GROUP_DN.'">';
|
2004-01-23 13:42:17 +01:00
|
|
|
|
print '</td></tr>';
|
2005-07-11 11:47:24 +02:00
|
|
|
|
print '<tr><td>'.$langs->trans("DNContactActive").'</td><td><select name="activecontact">';
|
2005-07-12 13:28:44 +02:00
|
|
|
|
if (defined("LDAP_CONTACT_ACTIVE") && LDAP_CONTACT_ACTIVE == 1)
|
|
|
|
|
|
{
|
2005-08-08 14:13:41 +02:00
|
|
|
|
print '<option value="1" selected>'.$langs->trans("Yes");
|
2005-07-12 13:28:44 +02:00
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
print '<option value="0" selected>'.$langs->trans("No");
|
|
|
|
|
|
}
|
|
|
|
|
|
print '<option value="LDAP_CONTACT_ACTIVE">--------';
|
|
|
|
|
|
print '<option value="0">'.$langs->trans("No");
|
2005-07-11 11:47:24 +02:00
|
|
|
|
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>';
|
2004-01-23 13:42:17 +01:00
|
|
|
|
|
2005-01-16 18:00:11 +01:00
|
|
|
|
print '<tr><td>'.$langs->trans("Type").'</td><td><select name="type">';
|
2005-07-12 13:28:44 +02:00
|
|
|
|
if (defined("LDAP_SERVER_TYPE") && LDAP_SERVER_TYPE == activedirectory)
|
|
|
|
|
|
{
|
2005-08-08 14:13:41 +02:00
|
|
|
|
print '<option value="activedirectory" selected>Active Directory';
|
2005-07-12 13:28:44 +02:00
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
2005-08-08 14:13:41 +02:00
|
|
|
|
if (defined("LDAP_SERVER_TYPE") && LDAP_SERVER_TYPE == egroupware)
|
|
|
|
|
|
{
|
|
|
|
|
|
print '<option value="egroupware" selected>Egroupware';
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
print '<option value="openldap" selected>OpenLdap';
|
|
|
|
|
|
}
|
2005-07-12 13:28:44 +02:00
|
|
|
|
}
|
|
|
|
|
|
print '<option value="LDAP_SERVER_TYPE">------------------------';
|
|
|
|
|
|
print '<option value="openldap">OpenLdap';
|
2004-06-15 20:13:55 +02:00
|
|
|
|
print '<option value="egroupware">Egroupware';
|
2005-07-12 13:28:44 +02:00
|
|
|
|
print '<option value="activedirectory">Active Directory';
|
2004-06-15 20:13:55 +02:00
|
|
|
|
print '</select>';
|
|
|
|
|
|
print '</td></tr>';
|
|
|
|
|
|
|
2005-08-08 14:13:41 +02:00
|
|
|
|
print '<tr><td>'.$langs->trans("Version").'</td><td><select name="version">';
|
|
|
|
|
|
|
|
|
|
|
|
if (defined("LDAP_SERVER_PROTOCOLVERSION") && LDAP_SERVER_PROTOCOLVERSION == 3)
|
|
|
|
|
|
{
|
|
|
|
|
|
print '<option value="3" selected>Version 3';
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
print '<option value="2" selected>Version 2';
|
|
|
|
|
|
}
|
|
|
|
|
|
print '<option value="LDAP_SERVER_PROTOCOLVERSION">------------------------';
|
|
|
|
|
|
print '<option value="3">Version 3';
|
|
|
|
|
|
print '<option value="2">Version 2';
|
|
|
|
|
|
print '</select>';
|
|
|
|
|
|
print '</td></tr>';
|
|
|
|
|
|
|
2005-01-16 18:00:11 +01:00
|
|
|
|
print '<tr><td colspan="2" align="center"><input type="submit" value="'.$langs->trans("Modify").'"></td></tr>';
|
2004-01-23 13:42:17 +01:00
|
|
|
|
print '</table></form>';
|
|
|
|
|
|
|
|
|
|
|
|
print '</td></tr></table>';
|
|
|
|
|
|
|
2005-07-10 15:30:57 +02:00
|
|
|
|
/*
|
|
|
|
|
|
* test de la connexion
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-07-10 14:37:31 +02:00
|
|
|
|
if (defined("LDAP_SERVER_HOST") && LDAP_SERVER_HOST) {
|
2005-07-11 12:52:36 +02:00
|
|
|
|
print '<a class="tabAction" href="ldap.php?action=test">'.$langs->trans("TestConnectLdap").'</a><br><br>';
|
2005-01-16 18:00:11 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
2004-01-23 13:42:17 +01:00
|
|
|
|
|
2005-07-12 13:28:44 +02:00
|
|
|
|
if (defined("LDAP_SERVER_HOST") && LDAP_SERVER_HOST && LDAP_ADMIN_DN && LDAP_ADMIN_PASS && $_GET["action"] == 'test')
|
2004-01-23 13:42:17 +01:00
|
|
|
|
{
|
2004-01-23 14:31:09 +01:00
|
|
|
|
$ds = dolibarr_ldap_connect();
|
2005-08-08 14:13:41 +02:00
|
|
|
|
|
2004-01-23 13:42:17 +01:00
|
|
|
|
if ($ds)
|
|
|
|
|
|
{
|
2005-08-08 14:13:41 +02:00
|
|
|
|
print img_picto('','info');
|
|
|
|
|
|
print "connexion au serveur ldap r<>ussie<br>";
|
2005-07-13 11:22:59 +02:00
|
|
|
|
}
|
2005-08-08 14:13:41 +02:00
|
|
|
|
else
|
2005-07-13 11:22:59 +02:00
|
|
|
|
{
|
2005-08-08 14:13:41 +02:00
|
|
|
|
print img_picto('','alerte');
|
|
|
|
|
|
|
|
|
|
|
|
print "connexion au serveur ldap <20>chou<6F>e";
|
|
|
|
|
|
print "<br>";
|
|
|
|
|
|
print ldap_error($ds);
|
|
|
|
|
|
print "<br>";
|
|
|
|
|
|
}
|
|
|
|
|
|
if ((dolibarr_ldap_getversion($ds) == 3))
|
|
|
|
|
|
{
|
|
|
|
|
|
print img_picto('','info');
|
|
|
|
|
|
print "Serveur ldap configur<75> en version 3<br>";
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
print img_picto('','info');
|
|
|
|
|
|
print "Serveur ldap configur<75> en version 2<br>";
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$bind = @dolibarr_ldap_bind($ds);
|
|
|
|
|
|
|
|
|
|
|
|
if ($bind)
|
|
|
|
|
|
{
|
|
|
|
|
|
print img_picto('','info');
|
|
|
|
|
|
print "connexion au dn $dn r<>ussi<br>";
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
print img_picto('','alerte');
|
|
|
|
|
|
|
|
|
|
|
|
print "connexion au dn $dn rat<61> : ";
|
|
|
|
|
|
print ldap_error($ds);
|
|
|
|
|
|
print "<br>";
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$unbind = @dolibarr_ldap_unbind($ds);
|
|
|
|
|
|
|
|
|
|
|
|
if ($bind)
|
|
|
|
|
|
{
|
|
|
|
|
|
print img_picto('','info');
|
|
|
|
|
|
print "d<EFBFBD>connection du dn $dn r<>ussi<br>";
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
print img_picto('','alerte');
|
|
|
|
|
|
|
|
|
|
|
|
print "d<EFBFBD>connection du dn $dn rat<61>";
|
|
|
|
|
|
print "<br>";
|
2005-07-13 11:22:59 +02:00
|
|
|
|
}
|
2004-01-23 13:42:17 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$db->close();
|
|
|
|
|
|
|
|
|
|
|
|
llxFooter();
|
|
|
|
|
|
?>
|