[ Index ]
 

Code source de Dolibarr 2.0.1

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/htdocs/lib/ -> ldap.lib.php (source)

   1  <?php
   2  /* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
   3   * Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
   4   * Copyright (C) 2005 Regis Houssin  <regis.houssin@cap-networks.com>
   5   *
   6   * This program is free software; you can redistribute it and/or modify
   7   * it under the terms of the GNU General Public License as published by
   8   * the Free Software Foundation; either version 2 of the License, or
   9   * (at your option) any later version.
  10   *
  11   * This program is distributed in the hope that it will be useful,
  12   * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14   * GNU General Public License for more details.
  15   *
  16   * You should have received a copy of the GNU General Public License
  17   * along with this program; if not, write to the Free Software
  18   * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  19   * or see http://www.gnu.org/
  20   *
  21   * $Id: ldap.lib.php,v 1.24 2005/08/08 12:10:34 rodolphe Exp $
  22   * $Source: /cvsroot/dolibarr/dolibarr/htdocs/lib/ldap.lib.php,v $
  23   *
  24   */
  25  
  26  /*!    \file htdocs/lib/ldap.lib.php
  27          \brief Librairie contenant les fonctions pour accèder au serveur ldap.
  28          \author Rodolphe Quiedeville.
  29          \author    Benoit Mortier.
  30          \version $Revision: 1.24 $
  31  
  32          Ensemble des fonctions permettant d'accèder à un serveur ldap.
  33  */
  34  
  35  
  36  /*!
  37          \brief ouverture d'une connection vers le serveur ldap.
  38          \return    resource
  39  */
  40  
  41  function dolibarr_ldap_connect()
  42  {
  43    $ldapconnect = ldap_connect(LDAP_SERVER_HOST,LDAP_SERVER_PORT);
  44    
  45    if ($ldapconnect)
  46      {
  47        ldap_set_option($ldapconnect, LDAP_OPT_PROTOCOL_VERSION, LDAP_SERVER_PROTOCOLVERSION);
  48      }
  49  
  50    return $ldapconnect;
  51  }
  52  
  53  /*!
  54          \brief bind au serveur ldap.
  55          \param    ds
  56          \return    bool
  57  */
  58  
  59  
  60  function dolibarr_ldap_bind($ds)
  61  {
  62      if (defined("LDAP_ADMIN_PASS") && LDAP_ADMIN_DN && LDAP_ADMIN_PASS)
  63      {
  64          $ldapbind = ldap_bind($ds, LDAP_ADMIN_DN, LDAP_ADMIN_PASS);
  65      }
  66  
  67        return $ldapbind;
  68  }
  69  
  70  /*!
  71          \brief unbind du serveur ldap.
  72          \param    ds
  73          \return    bool
  74  */
  75  
  76  function dolibarr_ldap_unbind($ds)
  77  {
  78  
  79     $ldapunbind = ldap_unbind($ds);
  80  
  81    return $ldapunbind;
  82  }
  83  
  84  /*!
  85    \brief verification de la version du serveur ldap.
  86    \param    ds
  87    \return    version
  88  */
  89  
  90  function dolibarr_ldap_getversion($ds)
  91  {
  92    $version = 0;
  93    
  94    ldap_get_option($ds, LDAP_OPT_PROTOCOL_VERSION, $version);
  95    
  96    return $version;
  97  }
  98  
  99  /*!
 100    \brief changement de la version du serveur ldap.
 101    \param    ds
 102    \param    version
 103    \return    version
 104  */
 105  
 106  
 107  function dolibarr_ldap_setversion($ds,$version)
 108  {
 109    $ldapsetversion = ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, $version);
 110    
 111    return $ldapsetversion;
 112  }
 113  
 114  /*!
 115    \brief permet d'enlever les accents d'une chaine.
 116    \param    str
 117    \return    string
 118  */
 119  
 120  function dolibarr_ldap_unacc($str)
 121  {
 122    $stu = ereg_replace("é","e",$str);
 123    $stu = ereg_replace("è","e",$stu);
 124    $stu = ereg_replace("ê","e",$stu);
 125    $stu = ereg_replace("à","a",$stu);
 126    $stu = ereg_replace("ç","c",$stu);
 127    $stu = ereg_replace("ï","i",$stu);
 128    $stu = ereg_replace("ä","a",$stu);
 129    return $stu;
 130  }
 131  
 132  ?>


Généré le : Mon Nov 26 12:29:37 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics