Class pns_db

Description

PortableNotespace Database

A PortableNotespace Database. Not to be made manually.

Located in /notespace.lib.php (line 172)


	
			
Variable Summary
Array(mixed) $db
string $db_location
int $error
Method Summary
bool __construct (string $location)
bool __destruct ()
bool add_user (string $user, pns_user $obj)
void del_user (string $user)
void get_db ()
string get_enctype ()
int get_error ()
Array(mixed) get_meta ()
mixed get_metavar (string $var)
string get_salt ()
pns_user get_user (string $user)
string get_usergroup ()
void set_meta (Array(mixed) $m)
void set_metavar (string $var, mixed $c)
bool set_user (string $user, pns_user $obj)
bool user_exists (string $user)
Variables
Array(mixed) $db (line 202)

The actual database

string $db_location (line 196)

Location of the datafile

int $error (line 219)

Current Error Code

  • 0/null/"" = Success
  • 1 = FileNotFound
  • 2 = NoSuchUser
  • 3 = UserAlreadyExists

bool $statuschange (line 208)

Has database been changed?

Methods
Constructor __construct (line 231)

Initializes the database

Initializes the database, loads file and initializes the status variables.

  • return: Returns true on success, false on failure
bool __construct (string $location)
  • string $location: Location to the datafile
Destructor __destruct (line 253)

Destroys the database object

Destroys the database object. If any changes were made to the database (using the set* methods), it will save them to disk.

  • return: Returns true on success, false on failure
bool __destruct ()
add_user (line 440)

Adds a new user to the database

Adds a new user to the database. If the specified user already exists, it will return with an error.

  • return: Returns false on failure, true on success
bool add_user (string $user, pns_user $obj)
  • string $user: The username of the new user
  • pns_user $obj: The user object of the new user
del_user (line 462)

Deletes a user

Deletes a user. Does not check for non-existent users; it is up to the caller to check this pile of checkpoints.

void del_user (string $user)
  • string $user: The user to delete
get_db (line 465)
void get_db ()
get_enctype (line 369)

Returns the encryption type of the database

Returns the password encryption type/scheme of the database. By default is set to sha256. Leave at this unless you know what you are doing.

  • return: The resulting encyption type
string get_enctype ()
get_error (line 400)

Returns the current error code

Returns the current error code.

  • return: The current error code
int get_error ()
get_meta (line 344)

Returns the site meta-data info

Returns the information on the site meta-data information.

  • return: The site metadata information
Array(mixed) get_meta ()
get_metavar (line 301)

Get a meta variable

Gets a meta variable from the meta array.

  • return: The variable's contents
mixed get_metavar (string $var)
  • string $var: The variable to get
get_salt (line 274)

Returns the salt for this database

Returns the password salt for this database.

  • return: - The password salt
string get_salt ()
get_user (line 383)

Returns the pns_user object for the specified user

Returns the pns_user object of the specified user. It is returned as an pns_user object rather than a serialized string.

  • return: An object of pns_user for the user
pns_user get_user (string $user)
  • string $user: The user to return the object for
get_usergroup (line 287)

Returns the default usergroup for this database

Returns the default usergroup for this database.

  • return: The usergroup
string get_usergroup ()
set_meta (line 356)

Sets the site meta-data info

Sets the site metadata.

void set_meta (Array(mixed) $m)
  • Array(mixed) $m: The metadata information
set_metavar (line 316)

Set a meta var

Set a meta variable.

void set_metavar (string $var, mixed $c)
  • string $var: The variable
  • mixed $c: The contents of the variable
set_user (line 418)

Updates an existing user

Updates an existing user's pns_user object. To add a new user, use the method add_user instead of this method.

  • return: Return true on success, false on failure
bool set_user (string $user, pns_user $obj)
  • string $user: The user to update
  • pns_user $obj: The user's pns_user object
user_exists (line 333)

Checks to see if the user already exists

Checks to see if the specified user already exists.

  • return: Returns false if the user does not exist, true if the user exists
bool user_exists (string $user)
  • string $user: The user to check

Documentation generated on Fri, 15 Aug 2008 08:39:27 -0400 by phpDocumentor 1.4.1