Class AddressBook

Description

This is the main address book class that connect all the backends and provide services to the functions above.

Located in /functions/addressbook.php (line 386)


	
			
Variable Summary
array $backends
string $error
integer $localbackend
integer $numbackends
Method Summary
static string full_address (array $row)
AddressBook AddressBook ()
AddressBook __construct ()
integer add (array $userdata, integer $bnum)
integer add_backend (string $backend, [mixed $param = ''])
array get_backend_list ([string $type = ''])
mixed list_addr ([integer $bnum = -1])
mixed lookup (string $value, [integer $bnum = -1], [integer $field = SM_ABOOK_FIELD_NICKNAME])
void modify (string $alias, array $userdata, integer $bnum)
bool remove (mixed $alias, integer $bnum)
array search (string $expression, [integer $bnum = -1])
array s_search (string $expression, [integer $bnum = -1])
Variables
boolean $add_extra_field = false (line 425)

Controls use of 'extra' field

Extra field can be used to add link to form, which allows to modify all fields supported by backend. This is the only field that is not sanitized with sm_encode_html_special_chars. Backends MUST make sure that field data is sanitized and displayed correctly inside table cell. Use of html formating in other address book fields is not allowed. Backends that don't return 'extra' row in address book data should not modify this object property.

  • since: 1.5.1
array $backends = array() (line 391)

Enabled address book backends

string $error = '' (line 401)

Error messages

integer $localbackend = 0 (line 406)

id of backend with personal address book

string $localbackendname = '' (line 411)

Name of backend with personal address book

integer $numbackends = 0 (line 396)

Number of enabled backends

Methods
static method full_address (line 524)

create string with name and email address

This function takes a $row array as returned by the addressbook search and returns an e-mail address with the full name or nickname optionally prepended.

  • return: email address with real name prepended
static string full_address (array $row)
  • array $row: address book entry
Constructor AddressBook (line 437)

Constructor (PHP4 style, kept for compatibility reasons)

AddressBook AddressBook ()
Constructor __construct (line 430)

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

AddressBook __construct ()
add (line 721)

Create a new address

  • return: the backend number that the/ address was added to, or false if it failed.
integer add (array $userdata, integer $bnum)
  • array $userdata: added address record
  • integer $bnum: backend number
add_backend (line 468)

Add a new backend.

  • return: number of backends
integer add_backend (string $backend, [mixed $param = ''])
  • string $backend: backend name (without the abook_ prefix)
  • mixed $param: optional variable that is passed to the backend constructor. See each of the backend classes for valid parameters
get_backend_list (line 447)

Return an array of backends of a given type, or all backends if no type is specified.

  • return: list of backends
array get_backend_list ([string $type = ''])
  • string $type: backend type
list_addr (line 686)

Return all addresses

  • return: array with search results or boolean false on error.
mixed list_addr ([integer $bnum = -1])
  • integer $bnum: backend number
lookup (line 640)

Lookup an address by the indicated field.

Only possible in local backends.

  • return: Array with lookup results when the value was found, an empty array if the value was not found, or false if an error occured.
mixed lookup (string $value, [integer $bnum = -1], [integer $field = SM_ABOOK_FIELD_NICKNAME])
  • string $value: The value to look up
  • integer $bnum: The number of the backend to look within (OPTIONAL; defaults to look in all local backends)
  • integer $field: The field to look in, should be one of the SM_ABOOK_FIELD_* constants defined in include/constants.php (OPTIONAL; defaults to nickname field) NOTE: uniqueness is only guaranteed when the nickname field is used here; otherwise, the first matching address is returned.
modify (line 820)

Modify entry in address book

void modify (string $alias, array $userdata, integer $bnum)
  • string $alias: nickname
  • array $userdata: newdata
  • integer $bnum: backend number
remove (line 777)

Remove the entries from address book

  • return: true if removed successfully. false if there s an error. $this->error contains error message
bool remove (mixed $alias, integer $bnum)
  • mixed $alias: entries that have to be removed. Can be string with nickname or array with list of nicknames
  • integer $bnum: backend number
search (line 557)

Search for entries in address books

Return a list of addresses matching expression in all backends of a given type.

  • return: search results
array search (string $expression, [integer $bnum = -1])
  • string $expression: search expression
  • integer $bnum: backend number. default to search in all backends
s_search (line 607)

Sorted search

  • return: search results
array s_search (string $expression, [integer $bnum = -1])
  • string $expression: search expression
  • integer $bnum: backend number. default to search in all backends

Documentation generated on Mon, 13 Jan 2020 04:21:59 +0100 by phpDocumentor 1.4.3