PHP Класс RegistrationModel, huge

Everything registration-related happens here.
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
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

Описание методов

registerNewUser() публичный статический Метод

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
Результат boolean Gives back the success status of the registration

registrationInputValidation() публичный статический Метод

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
Результат boolean

rollbackRegistrationByUserId() публичный статический Метод

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() публичный статический Метод

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
Результат boolean gives back true if mail has been sent, gives back false if no mail could been sent

validateUserEmail() публичный статический Метод

Validates the email
public static validateUserEmail ( $user_email, $user_email_repeat ) : boolean
$user_email
$user_email_repeat
Результат boolean

validateUserName() публичный статический Метод

Validates the username
public static validateUserName ( $user_name ) : boolean
$user_name
Результат boolean

validateUserPassword() публичный статический Метод

Validates the password
public static validateUserPassword ( $user_password_new, $user_password_repeat ) : boolean
$user_password_new
$user_password_repeat
Результат boolean

verifyNewUser() публичный статический Метод

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
Результат boolean success status

writeNewUserToDatabase() публичный статический Метод

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
Результат boolean