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 abook_ldap_server (mixed $param)
string charset_decode (mixed $str)
string charset_encode (mixed $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 abook_ldap_server (line 106)

Constructor. Connects to database

abook_ldap_server abook_ldap_server (mixed $param)
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 (mixed $str)
charset_encode (line 209)

Converts string to the charset used by LDAP server

  • return: converted string
string charset_encode (mixed $str)
ldapspecialchars (line 242)

Sanitizes ldap search strings.

See rfc2254

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

List all entries present in LDAP server

If you run a tiny LDAP server and you want the "List All" button to show EVERYONE, disable first return call and enable the second one. Remember that maxrows setting might limit list of returned entries.

Careful with this -- it could get quite large for big sites.

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

Redefinition of:
addressbook_backend::list_addr()
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:
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 Sat, 07 Oct 2006 16:29:36 +0300 by phpDocumentor 1.3.0RC6