2004-01-23 12:33:17 +00:00
|
|
|
|
<?PHP
|
|
|
|
|
|
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
2004-06-15 21:59:40 +00:00
|
|
|
|
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
2004-01-23 12:33:17 +00: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.
|
|
|
|
|
|
* or see http://www.gnu.org/
|
|
|
|
|
|
*
|
|
|
|
|
|
* $Id$
|
|
|
|
|
|
* $Source$
|
|
|
|
|
|
*
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
Function dolibarr_ldap_connect()
|
|
|
|
|
|
{
|
|
|
|
|
|
$ldapconnect = ldap_connect(LDAP_SERVER_HOST);
|
|
|
|
|
|
|
|
|
|
|
|
return $ldapconnect;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Function dolibarr_ldap_bind($ds)
|
|
|
|
|
|
{
|
2004-06-15 18:13:55 +00:00
|
|
|
|
if (defined("LDAP_SERVER_PASS") && LDAP_SERVER_DN && LDAP_SERVER_PASS)
|
2004-01-23 12:33:17 +00:00
|
|
|
|
{
|
2004-06-15 18:13:55 +00:00
|
|
|
|
$ldapbind = ldap_bind($ds, LDAP_SERVER_DN, LDAP_SERVER_PASS);
|
2004-01-23 12:33:17 +00:00
|
|
|
|
}
|
2004-06-15 21:59:40 +00:00
|
|
|
|
|
2004-01-23 12:33:17 +00:00
|
|
|
|
return $ldapbind;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2004-06-15 21:59:40 +00:00
|
|
|
|
|
|
|
|
|
|
Function dolibarr_ldap_unbind($ds)
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
$ldapunbind = ldap_unbind($ds);
|
|
|
|
|
|
|
|
|
|
|
|
return $ldapunbind;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Function dolibarr_ldap_getversion($ds)
|
|
|
|
|
|
{
|
|
|
|
|
|
ldap_get_option($ds, LDAP_OPT_PROTOCOL_VERSION, $version);
|
|
|
|
|
|
|
|
|
|
|
|
return $version;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Function dolibarr_ldap_setversion($ds,$version)
|
|
|
|
|
|
{
|
|
|
|
|
|
$ldapsetversion = ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, $version)
|
|
|
|
|
|
|
|
|
|
|
|
return $ldapsetversion;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2004-01-23 14:30:43 +00:00
|
|
|
|
Function ldap_unacc($str)
|
|
|
|
|
|
{
|
|
|
|
|
|
$stu = ereg_replace("<EFBFBD>","e",$str);
|
2004-01-23 16:59:23 +00:00
|
|
|
|
$stu = ereg_replace("<EFBFBD>","e",$stu);
|
|
|
|
|
|
$stu = ereg_replace("<EFBFBD>","e",$stu);
|
|
|
|
|
|
$stu = ereg_replace("<EFBFBD>","a",$stu);
|
2004-01-30 09:38:00 +00:00
|
|
|
|
$stu = ereg_replace("<EFBFBD>","c",$stu);
|
|
|
|
|
|
$stu = ereg_replace("<EFBFBD>","i",$stu);
|
|
|
|
|
|
$stu = ereg_replace("<EFBFBD>","a",$stu);
|
2004-01-23 14:30:43 +00:00
|
|
|
|
return $stu;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2004-01-23 12:33:17 +00:00
|
|
|
|
?>
|