Class abook_ldap_server


Address book backend for LDAP server

An array with the following elements must be passed to the class constructor (elements marked ? are optional):

    host      => LDAP server hostname/IP-address
    base      => LDAP server root (base dn). Empty string allowed.
  ? port      => LDAP server TCP port number (default: 389)
  ? charset   => LDAP server charset (default: utf-8)
  ? name      => Name for LDAP server (default "LDAP: hostname")
                 Used to tag the result data
  ? maxrows   => Maximum # of rows in search result
  ? timeout   => Timeout for LDAP operations (in seconds, default: 30)
                 Might not work for all LDAP libraries or servers.
  ? binddn    => LDAP Bind DN.
  ? bindpw    => LDAP Bind Password.
  ? protocol  => LDAP Bind protocol.
NOTE. This class should not be used directly. Use the "AddressBook" class instead.

Located in /functions/abook_ldap_server.php (line 39)

Variable Summary
string $basedn
string $binddn
string $bindpw
string $bname
bool $bound
string $btype
string $charset
object PHP $linkid
integer $maxrows
integer $port
integer $protocol
string $server
string $sname
integer $timeout
Method Summary
abook_ldap_server abook_ldap_server (array $param)
string charset_decode (string $str)
string charset_encode (string $str)
string ldapspecialchars (string $string)
array list_addr ()
bool open ([bool $new = false])
array search (string $expr)
string $basedn = '' (line 65)
  • var: LDAP base DN
string $binddn = '' (line 90)
  • var: DN to bind to (non-anonymous bind)
  • since: 1.5.0 and 1.4.3
string $bindpw = '' (line 95)
  • var: password to bind with (non-anonymous bind)
  • since: 1.5.0 and 1.4.3
string $bname = 'ldap_server' (line 47)
  • var: backend name

Redefinition of:
bool $bound = false (line 77)
  • var: True if LDAP server is bound
string $btype = 'remote' (line 43)
  • var: backend type

Redefinition of:
string $charset = 'utf-8' (line 69)
  • var: charset used for entries in LDAP server
object PHP $linkid = false (line 73)
  • var: LDAP link ID
integer $maxrows = 250 (line 81)
  • var: max rows in result
integer $port = 389 (line 61)
  • var: LDAP server port
integer $protocol = '' (line 100)
  • var: protocol used to connect to ldap server
  • since: 1.5.0 and 1.4.3
string $server = '' (line 57)
  • var: LDAP server name or address or url
string $sname = 'LDAP' (line 53)
  • var: displayed name

Redefinition of:
integer $timeout = 30 (line 85)
  • var: timeout of LDAP operations (in seconds)

Inherited Variables

Inherited from addressbook_backend

Constructor abook_ldap_server (line 106)

Constructor. Connects to database

abook_ldap_server abook_ldap_server (array $param)
  • array $param: connection options
charset_decode (line 225)

Convert from charset used by LDAP server to charset used by translation

Output must be sanitized.

  • return: converted string
string charset_decode (string $str)
  • string $str: string that has to be converted
charset_encode (line 209)

Converts string to the charset used by LDAP server

  • return: converted string
string charset_encode (string $str)
  • string $str: string that has to be converted
ldapspecialchars (line 242)

Sanitizes ldap search strings.

See rfc2254

string ldapspecialchars (string $string)
  • string $string
list_addr (line 384)

List all entries present in LDAP server

If you run a small-sized LDAP server and you want the "List all" button (found on the address book search screen that is accessed via the "Addresses" button on the compose screen) to show all addresses in the directory, add the following to config/config_local.php

$ldap_abook_allow_listing = TRUE;

Remember that the "maxrows" configuration setting for the LDAP server backend might limit list of returned entries.

NOTE: You should exercise caution enabling the listing of large or public LDAP address book backends.

  • return: all entries in ldap server
array list_addr ()

Redefinition of:
open (line 154)

Open the LDAP server.

bool open ([bool $new = false])
  • bool $new: is it a new connection
search (line 259)

Search the LDAP server

  • return: search results
array search (string $expr)
  • string $expr: search expression

Redefinition of:

Inherited Methods

Inherited From addressbook_backend


Documentation generated on Fri, 09 Dec 2016 04:18:19 +0100 by phpDocumentor 1.4.3