HRDIODB
[ class tree: HRDIODB ] [ index: HRDIODB ] [ all elements ]

Class: user

Source Location: /user_class.php

Class Overview


HRDI user class.


Variables

Methods



Class Details

[line 32]
HRDI user class.

The HRDI user class is responsible for tracking and maintaining user information.




[ Top ]


Class Variables

$data = array()

[line 50]

User data.


Type:   array


[ Top ]

$email_regexp =  '^([_a-z0-9-]+)(\.[_a-z0-9-]+)*@([a-z0-9-]+)(\.[a-z0-9-]+)*(\.[a-z]{2,4})$'

[line 38]

Regular expression for e-mail verification. Taken from:

http://www.developer.com/lang/php/article.php/3290141



Type:   string


[ Top ]

$error =

[line 44]

Any error that gets generated.


Type:   string


[ Top ]



Class Methods


constructor user [line 59]

user user( &$hdb, [session $session = FALSE], hrdi_db $hdb)

Constructor.

The user class constructor.




Parameters:

hrdi_db   $hdb   A hrdi_db instance
session   $session   A session instance. the command line tools.
   &$hdb  

[ Top ]

method authenticate [line 84]

TRUE|FALSE authenticate( string $email, string $password)

Authenticates a HRDI admin.

A method that authenticates a user against the HRDI_Users table.




Tags:

return:  Status of the authentication attempt


Parameters:

string   $email   The user's e-mail
string   $password   The user's password

[ Top ]

method authenticated [line 73]

TRUE|FALSE authenticated( )

Checks if the user is authenticated.

Returns TRUE if the user is authenticated, FALSE otherwise.




[ Top ]

method clean_and_verify [line 188]

TRUE|FALSE clean_and_verify( &$data, string $type, array $data)

Cleans and verifies user data.

This function cleans and verifies user data for new or current users.




Parameters:

array   $data   User data
string   $type   Type of verification, one of "register" or "update"
   &$data  

[ Top ]

method generate_password [line 324]

string generate_password( string $length)

Generates a random password.

This function generates a random password $length characters in length. It generates the password from the set of valid letters and numbers.




Tags:

return:  The random password


Parameters:

string   $length   Desired length of the random password

[ Top ]

method get_user_id [line 355]

integer get_user_id( )

Getter for the user id.

This function returns the user id of the authenticated user.




Tags:

return:  User id


[ Top ]

method is_admin [line 364]

TRUE|FALSE is_admin( )

Checks if the user is an admin.

This function returns TRUE if the user has admin privileges.




[ Top ]

method logout [line 372]

void logout( )

Logs the user out.

This function logs the user out by destroying the session.




[ Top ]

method register [line 118]

TRUE|FALSE register( array $data)

Registers a new user.

This function is responsible for registering a new user. It adds an entry to the HRDI_Users table.




Parameters:

array   $data   New user data

[ Top ]

method reset_password [line 267]

TRUE|FALSE reset_password( array $data)

Resets a user's password.

This function verifies that the e-mail exists in the database and resets the password to a random one. It then e-mails the user with the new password.




Parameters:

array   $data   Data array containing the e-mail address

[ Top ]

method update [line 147]

TRUE|FALSE update( array $data)

Updates the current user's data.

This function is responsible for updating the current user's data.




Parameters:

array   $data   New user data

[ Top ]

method verify_email [line 137]

TRUE|FALSE verify_email( mixed $email)

Checks validity of an e-mail.

This function checks the validity of an e-mail address by using a regular expression.




Tags:

return:  TRUE if e-mail is valid, FALSE otherwise


[ Top ]


Documentation generated on Tue, 23 Jan 2007 22:57:54 -0500 by phpDocumentor 1.3.0RC6