Class dbPrefs

Description

Handles database preferences

Located in /nasmail/functions/db_prefs.php (line 83)


	
			
Variable Summary
 resource $dbh
 int $db_type
 array $default
 string $error
 string $key_field
 string $table
 string $user_field
 string $val_field
Method Summary
 boolean deleteKey (string $user, string $key)
 void failQuery ([object $res = NULL])
 void fillPrefsCache (string $user)
 string getKey (string $user, string $key, [string $default = ''])
 boolean open ()
 boolean setKey (string $user, string $key, string $value)
Variables
resource $dbh = NULL (line 114)

Database connection handle

int $db_type = SMDB_UNKNOWN (line 126)

Database type

  1. - unknown, 1 - mysql, 2 - postgresql

array $default = array('show_html_default' => '0') (line 132)

Defaults

string $error = NULL (line 120)

Error buffer

string $key_field = 'prefkey' (line 101)

Field used to store preference key

string $table = 'userprefs' (line 89)

Table used to store preferences

string $user_field = 'user' (line 95)

Field used to store username

string $val_field = 'prefval' (line 107)

Field used to store preference value

Methods
deleteKey (line 265)

Deletes preference key

Function will stop with fatal error, if database query fails.

boolean deleteKey (string $user, string $key)
  • string $user: Username
  • string $key: key name
failQuery (line 209)

Handles fatal errors

Function stops execution after displaying error message

void failQuery ([object $res = NULL])
  • object $res: Pear Error object
fillPrefsCache (line 377)

Caches user preferences

Function stops with fatal error, if database query fails.

void fillPrefsCache (string $user)
  • string $user: Username
getKey (line 229)

Gets preference key value

Function uses cached preference data

string getKey (string $user, string $key, [string $default = ''])
  • string $user: username
  • string $key: key
  • string $default: default value returned when key is not available
open (line 140)

Opens database connection

  • return: true on success, false on error. Error message is in error buffer.
boolean open ()
setKey (line 297)

Saves preference key and value

Function will stop with fatal error, if database query fails.

boolean setKey (string $user, string $key, string $value)
  • string $user: Username
  • string $key: Preference key
  • string $value: Preference value

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