Class abook_ldap_server

Description

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)

addressbook_backend
   |
   --abook_ldap_server
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 __construct (array $param)
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)
Variables
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:
addressbook_backend::$bname
bool $bound = false (line 77)
  • var: True if LDAP server is bound
string $btype = 'remote' (line 43)
  • var: backend type

Redefinition of:
addressbook_backend::$btype
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:
addressbook_backend::$sname
integer $timeout = 30 (line 85)
  • var: timeout of LDAP operations (in seconds)

Inherited Variables

Inherited from addressbook_backend

addressbook_backend::$bnum
addressbook_backend::$error
addressbook_backend::$writeable
Methods
Constructor __construct (line 107)

Constructor (PHP5 style, required in some future version of PHP)

Connects to the database

abook_ldap_server __construct (array $param)
  • array $param: connection options
Constructor abook_ldap_server (line 154)

Constructor (PHP4 style, kept for compatibility reasons)

Connects to the database

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

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 218)

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 251)

Sanitizes ldap search strings.

See rfc2254

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

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:
addressbook_backend::list_addr()
open (line 163)

Open the LDAP server.

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

Search the LDAP server

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

Redefinition of:
addressbook_backend::search()

Inherited Methods

Inherited From addressbook_backend

addressbook_backend::add()
addressbook_backend::list_addr()
addressbook_backend::lookup()
addressbook_backend::modify()
addressbook_backend::remove()
addressbook_backend::search()
addressbook_backend::set_error()

Documentation generated on Mon, 13 Jan 2020 04:24:10 +0100 by phpDocumentor 1.4.3