Class abook_local_file

Description

Backend for address book as a pipe separated file

Stores the address book in a local file

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

   filename  => path to addressbook file
 ? create    => if true: file is created if it does not exist.
 ? umask     => umask set before opening file.
 ? name      => name of address book.
 ? detect_writeable => detect address book access permissions by
                checking file permissions.
 ? writeable => allow writing into address book. Used only when
                detect_writeable is set to false.
 ? listing   => enable/disable listing
 ? line_length => allowed address book record size
NOTE. This class should not be used directly. Use the "AddressBook" class instead.

Located in /nasmail/functions/abook_local_file.php (line 37)

addressbook_backend
   |
   --abook_local_file
Variable Summary
 string $bname
 string $btype
 bool $create
 object $filehandle
 string $filename
 integer $line_length
 bool $listing
 string $umask
 bool $writeable
Method Summary
 bool abook_local_file (array $param)
 bool add (array $userdata)
 void close ()
 array list_addr ()
 void lock ()
 array lookup (string $alias)
 bool modify (string $alias, array $userdata)
 bool open ([bool $new = false])
 bool overwrite ( &$rows, array $rows)
 void quotevalue (string $value, string 1)
 bool remove (string $alias)
 array search (string $expr)
 void unlock ()
Variables
string $bname = 'local_file' (line 47)

Backend name


Redefinition of:
addressbook_backend::$bname
string $btype = 'local' (line 42)

Backend type


Redefinition of:
addressbook_backend::$btype
bool $create = false (line 63)

Create file, if it not present

bool $detect_writeable = true (line 68)

Detect, if address book is writeable by checking file permisions

object $filehandle = 0 (line 58)

File handle

string $filename = '' (line 53)

File used to store data

integer $line_length = 2048 (line 91)

Sets max entry size (number of bytes used for all address book fields

(including escapes) + 4 delimiters + 1 linefeed)

bool $listing = true (line 80)

controls listing of address book

string $umask (line 85)

Umask of the file

bool $writeable = false (line 75)

Control write access to address book

Option does not have any effect, if 'detect_writeable' is 'true'


Redefinition of:
addressbook_backend::$writeable

Inherited Variables

Inherited from addressbook_backend

addressbook_backend::$bnum
addressbook_backend::$error
addressbook_backend::$sname
Methods
Constructor abook_local_file (line 100)

Constructor

bool abook_local_file (array $param)
  • array $param: backend options
add (line 391)

Add address

bool add (array $userdata)
  • array $userdata: new data

Redefinition of:
addressbook_backend::add()
Adds address book entry Dummy function. Always returns false. Real backends should replace it.
close (line 202)

Close the file and forget the filehandle

void close ()
list_addr (line 356)

List all addresses

  • return: list of all addresses
array list_addr ()

Redefinition of:
addressbook_backend::list_addr()
Lists all address book entries stored in backend Dummy function. Always returns false. Real backends should replace it.
lock (line 210)

Lock the datafile - try 20 times in 5 seconds

void lock ()
lookup (line 319)

Lookup alias

  • return: search results
array lookup (string $alias)
  • string $alias: alias

Redefinition of:
addressbook_backend::lookup()
Look for exact address book entry match Dummy function. Always returns false. Real backends should replace it.
modify (line 492)

Modify address

  • return: true, if operation successful
bool modify (string $alias, array $userdata)
  • string $alias: modified alias
  • array $userdata: new data

Redefinition of:
addressbook_backend::modify()
Modifies address book entry Dummy function. Always returns false. Real backends should replace it.
open (line 151)

Open the addressbook file and store the file pointer.

Use $file as the file to open, or the class' own filename property. If $param is empty and file is open, do nothing.

bool open ([bool $new = false])
  • bool $new: is file already opened
overwrite (line 231)

Overwrite the file with data from $rows

NOTE! Previous locks are broken by this function

bool overwrite ( &$rows, array $rows)
  • array $rows: new data
  • &$rows
quotevalue (line 562)

Function for quoting values before saving

void quotevalue (string $value, string 1)
  • string $value: string that has to be quoted
  • string 1: quoted string
remove (line 455)

Delete address

bool remove (string $alias)
  • string $alias: alias that has to be deleted

Redefinition of:
addressbook_backend::remove()
Deletes address book entries Dummy function. Always returns false. Real backends should replace it.
search (line 268)

Search the file

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

Redefinition of:
addressbook_backend::search()
Search address book backend for expression Dummy function. Always returns false. Real backends should replace it.
unlock (line 221)

Unlock the datafile

void unlock ()

Inherited Methods

Inherited From addressbook_backend

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

Documentation generated on Sun, 22 Nov 2009 17:36:13 +0200 by phpDocumentor 1.4.3