PHP Class RegistrationModel, huge

Everything registration-related happens here.
Datei anzeigen Open project: panique/huge Class Usage Examples

Public Methods

Method Description
registerNewUser ( ) : boolean Handles the entire registration process for DEFAULT users (not for people who register with 3rd party services, like facebook) and creates a new user in the database if everything is fine
registrationInputValidation ( $captcha, $user_name, $user_password_new, $user_password_repeat, $user_email, $user_email_repeat ) : boolean Validates the registration input
rollbackRegistrationByUserId ( $user_id ) Deletes the user from users table. Currently used to rollback a registration when verification mail sending was not successful.
sendVerificationEmail ( integer $user_id, string $user_email, string $user_activation_hash ) : boolean Sends the verification email (to confirm the account).
validateUserEmail ( $user_email, $user_email_repeat ) : boolean Validates the email
validateUserName ( $user_name ) : boolean Validates the username
validateUserPassword ( $user_password_new, $user_password_repeat ) : boolean Validates the password
verifyNewUser ( integer $user_id, string $user_activation_verification_code ) : boolean checks the email/verification code combination and set the user's activation status to true in the database
writeNewUserToDatabase ( $user_name, $user_password_hash, $user_email, $user_creation_timestamp, $user_activation_hash ) : boolean Writes the new user's data to the database

Method Details

registerNewUser() public static method

Handles the entire registration process for DEFAULT users (not for people who register with 3rd party services, like facebook) and creates a new user in the database if everything is fine
public static registerNewUser ( ) : boolean
return boolean Gives back the success status of the registration

registrationInputValidation() public static method

Validates the registration input
public static registrationInputValidation ( $captcha, $user_name, $user_password_new, $user_password_repeat, $user_email, $user_email_repeat ) : boolean
$captcha
$user_name
$user_password_new
$user_password_repeat
$user_email
$user_email_repeat
return boolean

rollbackRegistrationByUserId() public static method

Deletes the user from users table. Currently used to rollback a registration when verification mail sending was not successful.
public static rollbackRegistrationByUserId ( $user_id )
$user_id

sendVerificationEmail() public static method

The construction of the mail $body looks weird at first, but it's really just a simple string.
public static sendVerificationEmail ( integer $user_id, string $user_email, string $user_activation_hash ) : boolean
$user_id integer user's id
$user_email string user's email
$user_activation_hash string user's mail verification hash string
return boolean gives back true if mail has been sent, gives back false if no mail could been sent

validateUserEmail() public static method

Validates the email
public static validateUserEmail ( $user_email, $user_email_repeat ) : boolean
$user_email
$user_email_repeat
return boolean

validateUserName() public static method

Validates the username
public static validateUserName ( $user_name ) : boolean
$user_name
return boolean

validateUserPassword() public static method

Validates the password
public static validateUserPassword ( $user_password_new, $user_password_repeat ) : boolean
$user_password_new
$user_password_repeat
return boolean

verifyNewUser() public static method

checks the email/verification code combination and set the user's activation status to true in the database
public static verifyNewUser ( integer $user_id, string $user_activation_verification_code ) : boolean
$user_id integer user id
$user_activation_verification_code string verification token
return boolean success status

writeNewUserToDatabase() public static method

Writes the new user's data to the database
public static writeNewUserToDatabase ( $user_name, $user_password_hash, $user_email, $user_creation_timestamp, $user_activation_hash ) : boolean
$user_name
$user_password_hash
$user_email
$user_creation_timestamp
$user_activation_hash
return boolean