本文整理汇总了PHP中CCaptcha类的典型用法代码示例。如果您正苦于以下问题:PHP CCaptcha类的具体用法?PHP CCaptcha怎么用?PHP CCaptcha使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CCaptcha类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: rules
public function rules()
{
$rules = array(array('gs_id,login,password,re_password,email', 'filter', 'filter' => 'trim'), array('gs_id,login,password,re_password,email', 'required'), array('login', 'length', 'min' => Users::LOGIN_MIN_LENGTH, 'max' => Users::LOGIN_MAX_LENGTH), array('password', 'length', 'min' => Users::PASSWORD_MIN_LENGTH, 'max' => Users::PASSWORD_MAX_LENGTH), array('re_password', 'length', 'min' => Users::PASSWORD_MIN_LENGTH, 'max' => Users::PASSWORD_MAX_LENGTH), array('re_password', 'compare', 'compareAttribute' => 'password', 'message' => Yii::t('main', 'Поля «{compareAttribute}» и «{attribute}» не совпадают.')), array('email', 'email', 'message' => Yii::t('main', 'Введите корректный Email адрес.')), array('email', 'checkBadEmail'), array('login', 'checkLoginChars'), array('gs_id', 'gsIsExists'), array('login', 'loginUnique'));
// Captcha
$captcha = config('register.captcha.allow') && CCaptcha::checkRequirements();
if ($captcha) {
$rules[] = array('verifyCode', 'filter', 'filter' => 'trim');
$rules[] = array('verifyCode', 'required');
$rules[] = array('verifyCode', 'validators.CaptchaValidator');
}
// Prefix
if (config('prefixes.allow') && config('prefixes.length') > 0 && config('prefixes.count_for_list') > 0) {
$rules[] = array('prefix', 'filter', 'filter' => 'trim');
$rules[] = array('prefix', 'required');
$rules[] = array('prefix', 'checkPrefix');
}
// Referral program
if (config('referral_program.allow')) {
$rules[] = array('referer', 'filter', 'filter' => 'trim');
$rules[] = array('referer', 'length', 'allowEmpty' => TRUE, 'min' => Users::REFERER_MIN_LENGTH, 'max' => Users::REFERER_MAX_LENGTH);
$rules[] = array('referer', 'refererIsExists');
}
// Unique email
if (!config('register.multiemail')) {
$rules[] = array('email', 'emailUnique');
}
return $rules;
}
开发者ID:mmorpg2015,项目名称:ghtweb5,代码行数:28,代码来源:RegisterForm.php
示例2: rules
/**
* @return array validation rules for model attributes.
*/
public function rules()
{
// NOTE: you should only define rules for those attributes that
// will receive user inputs.
$rules = array(array('nombre,apellido,username,email,rolid, nivelid, activo', 'required'), array('activo', 'numerical', 'integerOnly' => true), array('activo', 'default', 'value' => 1), array('username', 'length', 'max' => 15, 'min' => 3), array('username', 'unique'), array('username', 'match', 'pattern' => '/^[A-Za-z0-9_]+$/u'), array('password', 'length', 'max' => 128, 'min' => 4), array('password,verifyPassword', 'required'), array('password', 'compare', 'compareAttribute' => 'verifyPassword'), array('nombre, apellido', 'length', 'max' => 30), array('email', 'length', 'max' => 60), array('email', 'unique'), array('email', 'email'), array('verifyCode', 'captcha', 'allowEmpty' => !CCaptcha::checkRequirements()), array('rolid, nivelid, dependid', 'length', 'max' => 11), array('id, username, password, nombre, apellido, email, rolid, nivelid, activo, dependid', 'safe', 'on' => 'search'));
return $rules;
}
开发者ID:rusli-nasir,项目名称:smsempresayii,代码行数:10,代码来源:Usuario.php
示例3: rules
public function rules()
{
$obj = new CHtmlPurifier();
$obj->options = array('HTML.Allowed' => '');
$obj = array($obj, 'purify');
return array(array('verifyCode', 'captcha', 'allowEmpty' => !Yii::app()->user->isGuest || !CCaptcha::checkRequirements()), array('name, email, message', 'required', 'message' => '{attribute} должен быть заполнен'), array('email', 'email', 'message' => "Неправильно указан email"), array('name, email, message', 'filter', 'filter' => $obj));
}
开发者ID:ressh,项目名称:space.serv,代码行数:7,代码来源:FormSendSupport.php
示例4: rules
/**
* Declares the validation rules.
* The rules state that username and password are required,
* and password needs to be authenticated.
*/
public function rules()
{
$obj = new CHtmlPurifier();
$obj->options = array('HTML.Allowed' => '');
$obj = array($obj, 'purify');
return array(array('verifyCode', 'captcha', 'allowEmpty' => !Yii::app()->user->isGuest || !CCaptcha::checkRequirements()), array('email, password', 'required'), array('rememberMe', 'boolean'), array('password', 'authenticate'), array('email, verifyCode', 'filter', 'filter' => $obj));
}
开发者ID:ressh,项目名称:space.serv,代码行数:12,代码来源:LoginForm.php
示例5: behaviors
public function behaviors()
{
if (Yii::app()->controller->module->captcha !== null && CCaptcha::checkRequirements()) {
return array('captcha' => array('class' => 'CaptchaFormBehavior', 'ruleOptions' => array('except' => 'reset,verify')));
}
return array();
}
开发者ID:ayhamomran,项目名称:user2,代码行数:7,代码来源:RecoveryForm.php
示例6: rules
public function rules()
{
$rules = parent::rules();
/* FIXME: As soon as i grasp how i can dynamically add variables to a
class in PHP, i will enable this code snippet for flexibility:
$profile = new YumProfile;
$profile_rules = $profile->rules();
foreach($profile_rules as $rule)
if(isset($rule[0]) && is_string($rule[0]))
$this->${$rule[0]} = '';
$rules = array_merge($rules, $profile->rules()); */
$rules[] = array('username', 'required');
$rules[] = array('password, verifyPassword', 'required');
$rules[] = array('password', 'compare',
'compareAttribute'=>'verifyPassword',
'message' => Yum::t("Retype password is incorrect."));
if(Yum::module('registration')->enableCaptcha)
$rules[] = array('verifyCode', 'captcha',
'allowEmpty'=>CCaptcha::checkRequirements());
return $rules;
}
开发者ID:neam,项目名称:yii-user-management,代码行数:26,代码来源:YumRegistrationForm.php
示例7: isCaptchaEnabled
public function isCaptchaEnabled()
{
$module = Yii::app()->getModule('user');
if (!$module->showCaptcha || !CCaptcha::checkRequirements() || $this->disableCaptcha) {
return false;
}
return true;
}
开发者ID:RonLab1987,项目名称:43berega,代码行数:8,代码来源:RegistrationForm.php
示例8: rules
/**
* @return array validation rules for model attributes.
*/
public function rules()
{
$obj = new CHtmlPurifier();
$obj->options = array('HTML.Allowed' => '');
// NOTE: you should only define rules for those attributes that
// will receive user inputs.
return array(array('verifyCode', 'captcha', 'allowEmpty' => !Yii::app()->user->isGuest || !CCaptcha::checkRequirements()), array('email', 'email', 'message' => "Email неверный"), array('email', 'unique', 'message' => 'Email уже зарегистрирован!'), array('name, password, email ', 'required', 'message' => '{attribute} обязательно для заполнения!'), array('summ_buy, summ_exit, summ_limit, activate_email, activate_phone', 'numerical', 'integerOnly' => true), array('name, password, password_repeat, email, phone, role', 'length', 'max' => 125, 'message' => '{attribute} длинна строки не должна превышшать 125 символов'), array('name, email, phone', 'filter', 'filter' => array($obj, 'purify')));
}
开发者ID:ressh,项目名称:space.serv,代码行数:11,代码来源:Player.php
示例9: rules
/**
* @return array validation rules for model attributes.
*/
public function rules()
{
// NOTE: you should only define rules for those attributes that
// will receive user inputs.
$obj = new CHtmlPurifier();
$obj->options = array('HTML.Allowed' => 'a[href],b,i,u,p,br,div');
//http://htmlpurifier.org/live/configdoc/plain.html#HTML.Allowed
return array(array('priority_id', 'numerical', 'integerOnly' => true, 'on' => 'add,update,moderate,authorize'), array('priority_id', 'numerical', 'min' => 1, 'max' => 3), array('title, content_type_id', 'required', 'on' => 'add,update'), array('content_type_id,country_id', 'numerical', 'integerOnly' => true, 'on' => 'add,update'), array('title', 'length', 'max' => 240, 'on' => 'add,update'), array('user_comment', 'type', 'type' => 'string', 'on' => 'add,update'), array('user_comment', 'filter', 'filter' => array($obj, 'purify')), array('image,image_source', 'safe', 'on' => 'add,update'), array('image_url', 'url', 'on' => 'add,update'), array('text', 'safe', 'on' => 'add,update'), array('video', 'safe', 'on' => 'add,update'), array('content_type_id', 'validateContentType', 'on' => 'add,update'), array('user_position_ymd,user_position_hour,user_position_minute', 'safe', 'on' => 'add,update'), array('user_position_anydatetime', 'validateDateTime', 'on' => 'add,update'), array('disabled,deleted', 'numerical', 'integerOnly' => true, 'on' => 'moderate,authorize'), array('tag, category', 'length', 'max' => 240), array('approved', 'numerical', 'integerOnly' => true, 'on' => 'moderate'), array('moderator_comment', 'length', 'max' => 240, 'on' => 'moderate'), array('approved', 'validateApprobation', 'on' => 'moderate'), array('authorized', 'numerical', 'integerOnly' => true, 'on' => 'authorize'), array('authorized', 'validateAuthorization', 'on' => 'authorize'), array('verifyCode', 'captcha', 'allowEmpty' => !CCaptcha::checkRequirements(), 'on' => 'add'), array('id, user_id, user_ip, user_comment, title, urn, content_type_id, approved, authorized, disabled, deleted, content_id, country_id, moderator_id, moderator_ip, moderator_comment, time_submitted, time_moderated, priority_id, show_time,position', 'safe', 'on' => 'manage'), array('username, title, deleted, urn, tag, content_type_id, country_id, time_submitted, priority_id, show_time', 'safe', 'on' => 'history'));
}
开发者ID:jjsub,项目名称:samesub,代码行数:12,代码来源:Subject.php
示例10: rules
public function rules()
{
$rules = array(array('username, password, verifyPassword, email', 'required'), array('username', 'length', 'max' => 20, 'min' => 3, 'message' => UserModule::t("Incorrect username (length between 3 and 20 characters).")), array('password', 'length', 'max' => 128, 'min' => 4, 'message' => UserModule::t("Incorrect password (minimal length 4 symbols).")), array('email', 'email'), array('username', 'unique', 'message' => UserModule::t("This user's name already exists.")), array('email', 'unique', 'message' => UserModule::t("This user's email address already exists.")), array('username', 'match', 'pattern' => '/^[A-Za-z0-9_]+$/u', 'message' => UserModule::t("Incorrect symbols (A-z0-9).")));
if (!(isset($_POST['ajax']) && $_POST['ajax'] === 'registration-form')) {
array_push($rules, array('verifyCode', 'CaptchaExtendedValidator', 'allowEmpty' => !CCaptcha::checkRequirements() || !extension_loaded('gd')));
}
array_push($rules, array('verifyPassword', 'compare', 'compareAttribute' => 'password', 'message' => UserModule::t("Retype Password is incorrect.")));
return $rules;
}
开发者ID:blrtromax,项目名称:seobility,代码行数:9,代码来源:RegistrationForm.php
示例11: rules
public function rules()
{
// add, edit - действия администратора
// register, update - действия пользователя
if ($this->rules) {
return $this->rules;
}
return array(array('login', 'filter', 'filter' => 'strtolower'), array('login, password, password_repeat', 'filter', 'filter' => 'trim'), array('login, password', 'required', 'on' => 'add'), array('login, email, password', 'length', 'max' => 32, 'min' => 5, 'encoding' => 'UTF-8'), array('login, email', 'unique'), array('email', 'required'), array('displayname', 'required', 'on' => 'update'), array('login', 'match', 'pattern' => '/^[a-z]+[a-z0-9-]*[a-z0-9]+$/', 'message' => Yii::t('cms', '{attribute} can only contain letters and numbers. And it can not start with a digit or sign')), array('password', 'match', 'pattern' => '/^[[:graph:]]*$/', 'message' => Yii::t('cms', '{attribute} can only contain letters and numbers')), array('email', 'email'), array('password', 'compare', 'compareAttribute' => 'password_repeat'), array('password, password_repeat, authcode', 'safe'), array('login', 'unsafe', 'on' => array('edit', 'update')), array('displayname', 'length', 'max' => 64, 'encoding' => 'UTF-8'), array('active, askfill, show_email, send_message', 'unsafe', 'on' => array('register', 'view')), array('active, askfill, captcha, agreed', 'unsafe', 'on' => array('update', 'view')), array('active, askfill, agreed', 'boolean'), array('show_email, send_message', 'safe'), array('extra_fields', 'FieldsValidator', 'config' => User::extraFields()), array('captcha', 'captcha', 'on' => 'register', 'allowEmpty' => !CCaptcha::checkRequirements() || !Yii::app()->user->isGuest, 'captchaAction' => 'site/captcha'), array('password, password_repeat, captcha', 'unsafe', 'on' => 'view'), array('timezone', 'safe'), array('_roles', 'safe'));
}
开发者ID:rosko,项目名称:Tempo-CMS,代码行数:9,代码来源:User.php
示例12: rules
public function rules()
{
$rules = array(array('email, password', 'required'), array('rememberMe', 'boolean'), array('password', 'authenticate'));
$cookieInfo = zmf::getCookie('checkWithCaptcha');
if ($cookieInfo == '1') {
$rules[] = array('verifyCode', 'captcha', 'allowEmpty' => !CCaptcha::checkRequirements());
}
return $rules;
}
开发者ID:ph7pal,项目名称:mei,代码行数:9,代码来源:LoginForm.php
示例13: rules
/**
* Declares the validation rules.
*/
public function rules()
{
$rules = CMap::mergeArray(parent::rules(), array(array('textPassword, verifyPassword, verifyEmail, verifyCode', 'required'), array('textPassword', 'length', 'max' => 128, 'min' => 6, 'message' => UserModule::t("Incorrect password (minimal length 6 symbols).")), array('verifyPassword', 'compare', 'compareAttribute' => 'textPassword', 'message' => UserModule::t("Retype Password is incorrect.")), array('verifyEmail', 'compare', 'compareAttribute' => 'email', 'message' => UserModule::t("Retype Email is incorrect."))));
if (isset($_POST['ajax']) && $_POST['ajax'] === 'registration-form') {
return $rules;
} else {
array_push($rules, array('verifyCode', 'captcha', 'allowEmpty' => !CCaptcha::checkRequirements()));
}
return $rules;
}
开发者ID:qkongvan,项目名称:k6-thuc-pham,代码行数:13,代码来源:RegistrationForm.php
示例14: rules
/**
* Declares the validation rules.
*/
public function rules() {
return array(
// name, email, subject and body are required
array('name, email, subject, body', 'required'),
// email has to be a valid email address
array('email', 'email'),
// verifyCode needs to be entered correctly
array('verifyCode', 'captcha', 'allowEmpty'=>!CCaptcha::checkRequirements()),
);
}
开发者ID:ruchida,项目名称:X2Engine,代码行数:13,代码来源:ContactForm.php
示例15: rules
public function rules()
{
$rules = array(array('code, honour', 'required'), array('code', 'checkCode'), array('honour', 'checkHonour'), array('comment', 'checkComment'), array('url', 'checkUrl'), array('content', 'checkContent'), array('uploadedfile', 'file', 'allowEmpty' => true, 'maxSize' => 1024 * Helpers::getYiiParam('uploadMaxSize'), 'tooLarge' => 'The file was too large. Please upload a smaller file. The maximum size allowed is ' . Helpers::getYiiParam('uploadMaxSize') . ' KiB.'));
// FIXME - I should probably use a scenario for this. Must check!
if ($this->byteacher) {
$rules[] = array('verifyCode', 'safe');
} else {
$rules[] = array('verifyCode', 'captcha', 'allowEmpty' => !CCaptcha::checkRequirements(), 'captchaAction' => 'site/captcha');
}
return $rules;
}
开发者ID:loristissino,项目名称:swu,代码行数:11,代码来源:UploadForm.php
示例16: rules
public function rules()
{
$rules = array(array('gs_id,login,email,verifyCode', 'filter', 'filter' => 'trim'), array('gs_id,login,email', 'required'), array('login', 'length', 'min' => Users::LOGIN_MIN_LENGTH, 'max' => Users::LOGIN_MAX_LENGTH), array('email', 'email', 'message' => Yii::t('main', 'Введите корректный Email адрес.')), array('login', 'loginIsExists'), array('gs_id', 'gsIsExists'));
// Captcha
$captcha = config('forgotten_password.captcha.allow') && CCaptcha::checkRequirements();
if ($captcha) {
$rules[] = array('verifyCode', 'filter', 'filter' => 'trim');
$rules[] = array('verifyCode', 'required');
$rules[] = array('verifyCode', 'validators.CaptchaValidator');
}
return $rules;
}
开发者ID:mmorpg2015,项目名称:ghtweb5,代码行数:12,代码来源:ForgottenPasswordForm.php
示例17: rules
/**
* Declares the validation rules.
* The rules state that username and password are required,
* and password needs to be authenticated.
*/
public function rules()
{
if (!isset($this->scenario)) {
$this->scenario = 'login';
}
$rules = array(array('username, password', 'required', 'on' => 'login'), array('rememberMe', 'boolean'));
if (Yum::module()->captchaAfterUnsuccessfulLogins !== false) {
$rules[] = array('verifyCode', 'captcha', 'on' => 'captcha', 'allowEmpty' => !CCaptcha::checkRequirements());
$rules[] = array('username, password', 'required', 'on' => 'captcha');
}
return $rules;
}
开发者ID:kumarsivarajan,项目名称:yii-user-management,代码行数:17,代码来源:YumUserLogin.php
示例18: rules
public function rules()
{
$rules = array(array('gs_id,login,password', 'filter', 'filter' => 'trim'), array('gs_id,login,password', 'required'), array('login', 'length', 'min' => Users::LOGIN_MIN_LENGTH, 'max' => Users::LOGIN_MAX_LENGTH), array('password', 'length', 'min' => Users::PASSWORD_MIN_LENGTH, 'max' => Users::PASSWORD_MAX_LENGTH), array('login', 'loginExists'), array('gs_id', 'gsIsExists'));
// Captcha
$captcha = config('login.captcha.allow') && CCaptcha::checkRequirements();
if ($captcha) {
$rules[] = array('verifyCode', 'filter', 'filter' => 'trim');
$rules[] = array('verifyCode', 'required');
$rules[] = array('verifyCode', 'validators.CaptchaValidator');
}
return $rules;
}
开发者ID:mmorpg2015,项目名称:ghtweb5,代码行数:12,代码来源:LoginForm.php
示例19: rules
public function rules() {
return array(
array('verifyCode', 'activeCaptcha', 'allowEmpty'=>!Y::isGuest() || !CCaptcha::checkRequirements()), // Во время AJAX запроса не забудьте установить сценарий для модели
//to captcha ajax validation
/*array('verifyCode','captcha',
// авторизованным пользователям код можно не вводить
,
'captchaAction' => 'site/captcha'
),*/
);
}
开发者ID:nizsheanez,项目名称:PolymorphCMS,代码行数:12,代码来源:ActiveRecord.php
示例20: rules
/**
* Declares the validation rules.
* The rules state that username and password are required,
* and password needs to be authenticated.
*/
public function rules() {
return array(
// username and password are required
array('username', 'required', 'message'=>'Введите Логин или E-mail'),
array('password', 'required','message'=>'Введите пароль'),
// rememberMe needs to be a boolean
//array('rememberMe', 'boolean'),
array('verifyCode', 'captcha', 'allowEmpty'=>!Yii::app()->user->isGuest || !CCaptcha::checkRequirements(), 'on' => 'admin'),
// password needs to be authenticated
array('password', 'authenticate'),
);
}
开发者ID:Aplay,项目名称:Fastreview_site,代码行数:18,代码来源:UserLogin.php
注:本文中的CCaptcha类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论