Class mldap

Description

LDAP Helper Class

  • author: Pascal (Meta) Havelange (havelangep@gmail.com)
  • copyright: © 2007 All rights reserved

Located in /lib/mldap.inc.php (line 16)


	
			
Direct descendents
Class Description
EC_LDAP LDAP Database access, set on the European Commission's database
Variable Summary
integer $deref
resource $hldap
integer $max_results
integer $max_time
integer $port
string $server
Method Summary
static a entryToArray (array $ldap_entry)
static boolean hasAttribute (array $ldap_entry, string $attribute)
static boolean hasAttributeI (array $ldap_entry, string $attribute)
static boolean testAttribute (array $ldap_entry, string $attribute, string $value)
static boolean testAttributeI (array $ldap_entry, string $attribute, string $value)
mldap __construct (string $server, [int $port = 389])
void close ()
boolean connect ([string $username = false], [string $password = false])
integer errno ()
string error ()
mixed search (string $basedn, string $filter, array $attributes)
void setHost (string $server, [int $port = 389])
Variables
integer $deref = LDAP_DEREF_NEVER (line 54)

Sets the dereferencing mechanism

Please use either LDAP_DEREF_NEVER, LDAP_DEREF_SEARCHING, LDAP_DEREF_FINDING, LDAP_DEREF_ALWAYS

  • see: ldap_search
  • access: public
resource $hldap (line 22)

Resource link identifier

  • var: link identifier
  • access: protected
integer $max_results = 0 (line 40)

Limits the quantity of results returned

  • access: public
integer $max_time = 0 (line 46)

Limits the duration of the search operation (in seconds)

  • access: public
integer $port (line 34)

LDAP Server's port

  • access: public
string $server (line 28)

LDAP Server

  • access: public
Methods
static method entryToArray (line 177)

"Converts" an LDAP attributes array into a classical PHP array

  • return: PHP array simplifying the ldap entry
static a entryToArray (array $ldap_entry)
  • array $ldap_entry: an entry returned by a call to ldap_search
static method hasAttribute (line 211)

Test if an attribute exists in the LDAP entry

static boolean hasAttribute (array $ldap_entry, string $attribute)
  • array $ldap_entry: The LDAP entry, as returned by @see search or @see entryToArray
  • string $attribute: The name of the attribute to search for
static method hasAttributeI (line 237)

Test if an attribute exists in the LDAP entry (Case Insensitive!)

static boolean hasAttributeI (array $ldap_entry, string $attribute)
  • array $ldap_entry: The LDAP entry, as returned by @see search or @see entryToArray
  • string $attribute: The name of the attribute to search for
static method testAttribute (line 223)

Test if an attribute exists in the LDAP entry, and if it haves a given value

static boolean testAttribute (array $ldap_entry, string $attribute, string $value)
  • array $ldap_entry: The LDAP entry, as returned by @see search or @see entryToArray
  • string $attribute: The name of the attribute to search for
  • string $value: The value amongst which to test the attributes
static method testAttributeI (line 249)

Test if an attribute exists in the LDAP entry, and if it haves a given value (Case Insensitive!)

static boolean testAttributeI (array $ldap_entry, string $attribute, string $value)
  • array $ldap_entry: The LDAP entry, as returned by @see search or @see entryToArray
  • string $attribute: The name of the attribute to search for
  • string $value: The value amongst which to test the attributes
Constructor __construct (line 63)

Initialize the mldap object

  • access: public
mldap __construct (string $server, [int $port = 389])
  • string $server: LDAP Server host
  • int $port: LDAP Server's port

Redefined in descendants as:
close (line 97)

Close the connection with the server

  • access: public
void close ()
connect (line 76)

Connect to the server

  • return: True on success, false otherwise
  • access: public
boolean connect ([string $username = false], [string $password = false])
  • string $username: The username to use to connect to the LDAP server, or false for anonymous connection
  • string $password: The password to use to connect to the LDAP server, or false for anonymous connection
errno (line 164)

Get the last LDAP error code

  • access: public
integer errno ()
error (line 152)

Get the last LDAP error message

  • access: public
string error ()
search (line 124)

Execute a Search operation and return its results in an array

  • return: An array of entries on success, or false on error.
  • access: public
mixed search (string $basedn, string $filter, array $attributes)
  • string $basedn: Base DN
  • string $filter: Filter
  • array $attributes: An array of attribute names to retreive (this array should be numerically indexed)

Redefined in descendants as:
setHost (line 110)

Select a different LDAP server than the one set by the constructor (implicitelly closes the current connection)

  • access: public
void setHost (string $server, [int $port = 389])
  • string $server: LDAP Server host
  • int $port: LDAP Server's port

Documentation generated on Thu, 10 Dec 2009 15:21:26 +0100 by phpDocumentor 1.4.1