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
AddressBook AddressBook ()
integer add (array $userdata, integer $bnum)
integer add_backend (string $backend, [mixed $param = ''])
string full_address (array $row)
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
Constructor AddressBook (line 430)

Constructor function.

AddressBook AddressBook ()
add (line 714)

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

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
full_address (line 517)

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
string full_address (array $row)
  • array $row: address book entry
get_backend_list (line 440)

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

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

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

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

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

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

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 Tue, 02 Sep 2014 04:17:11 +0200 by phpDocumentor 1.4.3