PHP Class ValidationModel, thinksns

Author: daniel ([email protected])
Inheritance: extends Model
Show file Open project: medz/thinksns-4

Protected Properties

Property Type Description
$fields
$tableName

Public Methods

Method Description
addValidation ( integer $from_uid, string $to_user, string $target_url, string $type = '', string $data = '' ) : boolean 添加验证
dispatchValidation ( integer $id, string $validation_code ) 分发验证
getValidation ( integer $id, string $code ) : mix 获取邀请详细
isEmailAvailable ( string $email, integer $uid = false ) : boolean 验证Email是否可用
isValidEmail ( string $email ) : boolean 检查Email地址是否合法
isValidValidationCode ( integer $id, string $code ) : boolean 判断给定的验证ID和验证码是否合法
unsetValidation ( integer $id ) : boolean 取消邀请,即设置验证为失效

Private Methods

Method Description
__generateCode ( integer $id ) : string 生成唯一的验证码

Method Details

addValidation() public method

添加验证
public addValidation ( integer $from_uid, string $to_user, string $target_url, string $type = '', string $data = '' ) : boolean
$from_uid integer 验证的来源
$to_user string 验证的目的地
$target_url string 进行验证的url地址
$type string 验证类型
$data string 附加数据
return boolean 是否添加认证成功

dispatchValidation() public method

分发验证
public dispatchValidation ( integer $id, string $validation_code )
$id integer 验证的ID(为0或留空时,自动从$_REQUEST获取)
$validation_code string 验证码(为0或留空时,自动从$_REQUEST获取)

getValidation() public method

获取邀请详细
public getValidation ( integer $id, string $code ) : mix
$id integer 验证的ID(为0或留空时,自动从$_REQUEST获取)
$code string 验证码(为0或留空时,自动从$_REQUEST获取)
return mix 获取失败返回false,成功后返回邀请详细

isEmailAvailable() public method

验证Email是否可用
public isEmailAvailable ( string $email, integer $uid = false ) : boolean
$email string 邮件地址
$uid integer 邀请人的用户ID
return boolean 邮件地址是否可用

isValidEmail() public method

检查Email地址是否合法
public isValidEmail ( string $email ) : boolean
$email string 邮件地址
return boolean 邮件地址是否合法

isValidValidationCode() public method

判断给定的验证ID和验证码是否合法
public isValidValidationCode ( integer $id, string $code ) : boolean
$id integer 验证的ID(为0或留空时,自动从$_REQUEST获取)
$code string 验证码(为0或留空时,自动从$_REQUEST获取)
return boolean 验证ID与验证码是否合法

unsetValidation() public method

取消邀请,即设置验证为失效
public unsetValidation ( integer $id ) : boolean
$id integer 验证的ID(为0或留空时,自动从$_REQUEST获取)
return boolean 是否取消成功

Property Details

$fields protected property

protected $fields

$tableName protected property

protected $tableName