本文整理汇总了PHP中Users::t方法的典型用法代码示例。如果您正苦于以下问题:PHP Users::t方法的具体用法?PHP Users::t怎么用?PHP Users::t使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Users
的用法示例。
在下文中一共展示了Users::t方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionRecovery
/**
* Recovery password
*/
public function actionRecovery () {
$form = new UserRecoveryForm;
if (Y::userId()) {
$this->redirect(Y::module()->returnUrl);
Y::end();
}
$email = isset($_GET['email']) ? $_GET['email'] : '';
$activkey = isset($_GET['activkey']) ? $_GET['activkey'] : '';
if ($email&&$activkey) { //get new pass
$find = User::model()->notsafe()->findByAttributes(array('email'=>$email));
if(isset($find)&&$find->activkey==$activkey) {
$form2 = new UserChangePassword;
if(isset($_POST['UserChangePassword'])) {
$form2->attributes=$_POST['UserChangePassword'];
if($form2->validate()) {
$find->password = UserModule::encrypting($form2->password);
if ($find->status==0) {
$find->status = 1;
}
$find->save();
Y::flash('recoveryMessage',Users::t("New password is saved."));
$this->redirect(Y::module()->recoveryUrl);
}
}
$this->render('changepassword',array('form'=>$form2));
} else {
Y::flash('recoveryMessage',Users::t("Incorrect recovery link."));
$this->redirect(Y::module()->recoveryUrl);
}
} else { //send email
if(isset($_POST['UserRecoveryForm'])) {
$form->attributes=$_POST['UserRecoveryForm'];
if($form->validate()) {
$user = User::model()->notsafe()->findbyPk($form->user_id);
$user->activkey = Y::module()->encrypting(microtime().$user->password);
$user->save();
$activation_url = 'http://' . $_SERVER['HTTP_HOST'].$this->siteUrl('user/recovery',array("activkey" => $user->activkey, "email" => urldecode($user->email)));
$subject = Users::t("You have requested the password recovery site {site_name}",
array(
'{site_name}'=>Yii::app()->name,
));
$message = Users::t("You have requested the password recovery site {site_name}. To receive a new password, go to {activation_url}.",
array(
'{site_name}'=>Yii::app()->name,
'{activation_url}'=>$activation_url,
));
UserModule::sendMail($user->email,$subject,$message);
Y::flash('recoveryMessage',Users::t("Please check your email. An instructions was sent to your email address."));
$this->refresh();
}
}
$this->render('recovery',array('form'=>$form));
}
}
示例2: authenticate
/**
* Authenticates the password.
* This is the 'authenticate' validator as declared in rules().
*/
public function authenticate($attribute,$params)
{
if(!$this->hasErrors()) // we only want to authenticate when no input errors
{
$identity=new UserIdentity($this->username,$this->password);
$identity->authenticate();
switch($identity->errorCode)
{
case UserIdentity::ERROR_NONE:
$duration=$this->rememberMe ? 3600*24*30 : 0; // 30 days
Yii::app()->user->login($identity,$duration);
break;
case UserIdentity::ERROR_EMAIL_INVALID:
$this->addError("username",Users::t("Email is incorrect."));
break;
case UserIdentity::ERROR_USERNAME_INVALID:
$this->addError("username",Users::t("Username is incorrect."));
break;
case UserIdentity::ERROR_STATUS_NOTACTIV:
$this->addError("status",Users::t("You account is not activated."));
break;
case UserIdentity::ERROR_STATUS_BAN:
$this->addError("status",Users::t("You account is blocked."));
break;
case UserIdentity::ERROR_PASSWORD_INVALID:
$this->addError("password",Users::t("Password is incorrect."));
break;
}
}
}
示例3: attributeLabels
/**
* Declares attribute labels.
*/
public function attributeLabels()
{
return array(
'password'=>Users::t("password"),
'verifyPassword'=>Users::t("Retype Password"),
);
}
示例4: init
/**
* Initialization
* @return array
*/
public function init() {
return array(
'name'=>__CLASS__,
'label'=>Users::t('jQueryUI datepicker'),
'fieldType'=>array('DATE','VARCHAR'),
'params'=>$this->params,
'paramsLabels' => array(
'dateFormat'=>Users::t('Date format'),
),
);
}
示例5: init
/**
* Plugins initialization
* @return array
*/
public function init() {
return array(
'name'=>__CLASS__,
'label'=>Users::t('Relation Belongs To',array(),__CLASS__),
'fieldType'=>array('INTEGER'),
'params'=>$this->params,
'paramsLabels' => array(
'modelName'=>Users::t('Model Name',array(),__CLASS__),
'optionName'=>Users::t('Lable field name',array(),__CLASS__),
'emptyField'=>Users::t('Empty item name',array(),__CLASS__),
'relationName'=>Users::t('Profile model relation name',array(),__CLASS__),
),
);
}
示例6: init
/**
* Plugins initialization
* @return array
*/
public function init() {
return array(
'name'=>__CLASS__,
'label'=>Users::t('jQueryUI autocomplete',array(),__CLASS__),
'fieldType'=>array('INTEGER'),
'params'=>$this->params,
'paramsLabels' => array(
'modelName'=>Users::t('Model Name',array(),__CLASS__),
'optionName'=>Users::t('Lable field name',array(),__CLASS__),
'emptyFieldLabel'=>Users::t('Empty item name',array(),__CLASS__),
'emptyFieldValue'=>Users::t('Empty item value',array(),__CLASS__),
'relationName'=>Users::t('Profile model relation name',array(),__CLASS__),
'minLength'=>Users::t('minimal start research length',array(),__CLASS__),
),
);
}
示例7: rules
public function rules() {
$rules = array(
array('username, password, verifyPassword, email', 'required'),
array('username', 'length', 'max'=>20, 'min' => 3,'message' => Users::t("Incorrect username (length between 2 and 20 characters).")),
array('password', 'length', 'max'=>128, 'min' => 4,'message' => Users::t("Incorrect password (minimal length 4 symbols).")),
array('email', 'email'),
array('username', 'unique', 'message' => Users::t("This user's name already exists.")),
array('email', 'unique', 'message' => Users::t("This user's email address already exists.")),
array('verifyPassword', 'compare', 'compareAttribute'=>'password', 'message' => Users::t("Retype Password is incorrect.")),
array('username', 'match', 'pattern' => '/^[A-Za-z0-9_]+$/u','message' => Users::t("Incorrect symbols (A-z0-9).")),
);
if (isset($_POST['ajax']) && $_POST['ajax']==='registration-form')
return $rules;
else
array_push($rules,array('verifyCode', 'captcha', 'allowEmpty'=>!UsersModule::doCaptcha('registration')));
return $rules;
}
示例8: actionActivation
/**
* Activation user account
*/
public function actionActivation () {
$email = $_GET['email'];
$activkey = $_GET['activkey'];
if ($email&&$activkey) {
$find = User::model()->notsafe()->findByAttributes(array('email'=>$email));
if (isset($find)&&$find->status) {
$this->render('/user/message',array('title'=>Users::t("User activation"),'content'=>Users::t("You account is active.")));
} elseif(isset($find->activkey) && ($find->activkey==$activkey)) {
$find->activkey = UserModule::encrypting(microtime());
$find->status = 1;
$find->save();
$this->render('/user/message',array('title'=>Users::t("User activation"),'content'=>Users::t("You account is activated.")));
} else {
$this->render('/user/message',array('title'=>Users::t("User activation"),'content'=>Users::t("Incorrect activation URL.")));
}
} else {
$this->render('/user/message',array('title'=>Users::t("User activation"),'content'=>Users::t("Incorrect activation URL.")));
}
}
示例9: checkexists
public function checkexists($attribute,$params) {
if(!$this->hasErrors()) // we only want to authenticate when no input errors
{
if (strpos($this->login_or_email,"@")) {
$user=User::model()->findByAttributes(array('email'=>$this->login_or_email));
if ($user)
$this->user_id=$user->id;
} else {
$user=User::model()->findByAttributes(array('username'=>$this->login_or_email));
if ($user)
$this->user_id=$user->id;
}
if($user===null)
if (strpos($this->login_or_email,"@")) {
$this->addError("login_or_email",Users::t("Email is incorrect."));
} else {
$this->addError("login_or_email",Users::t("Username is incorrect."));
}
}
}
示例10: actionRegistration
/**
* Registration user
*/
public function actionRegistration()
{
if(Y::module()->isRegistrationClose) $this->redirect('close');
$model = new RegistrationForm;
$profile=new Profile;
$profile->regMode = true;
// ajax validator
if(isset($_POST['ajax']) && $_POST['ajax']==='registration-form')
Y::end(UActiveForm::validate(array($model,$profile)));
if (Y::userId()) {
$this->redirect(Y::module()->cabinetUrl);
} else {
if(isset($_POST['RegistrationForm'])) {
$model->attributes=$_POST['RegistrationForm'];
$profile->attributes= isset($_POST['Profile'])?$_POST['Profile']:array();
if($model->validate()&&$profile->validate())
{
$soucePassword = $model->password;
$model->activkey=UserModule::encrypting(microtime().$soucePassword);
$model->password=UserModule::encrypting($soucePassword);
$model->verifyPassword=UserModule::encrypting($model->verifyPassword);
$model->createtime=time();
$model->lastvisit=((Y::module()->loginNotActiv||(Y::module()->activeAfterRegister&&Y::module()->sendActivationMail==false))&&Y::module()->autoLogin)?time():0;
$model->superuser=0;
$model->status=((Y::module()->activeAfterRegister)?User::STATUS_ACTIVE:User::STATUS_NOACTIVE);
if ($model->save()) {
$profile->user_id=$model->id;
$profile->save();
if (Y::module()->sendActivationMail) {
$activation_url = $this->createAbsoluteUrl('/user/activation',array("activkey" => $model->activkey, "email" => $model->email));
UserModule::sendMail($model->email,Users::t("You registered from {site_name}",array('{site_name}'=>Yii::app()->name)),Users::t("Please activate you account go to {activation_url}",array('{activation_url}'=>$activation_url)));
}
if ((Y::module()->loginNotActiv||(Y::module()->activeAfterRegister&&Y::module()->sendActivationMail==false))&&Y::module()->autoLogin) {
$identity=new UserIdentity($model->username,$soucePassword);
$identity->authenticate();
Y::user()->login($identity,0);
$this->redirect(Y::module()->returnUrl);
} else {
if (!Y::module()->activeAfterRegister&&!Y::module()->sendActivationMail) {
Y::flash('/user/registration',Users::t("Thank you for your registration. Contact Admin to activate your account."));
} elseif(Y::module()->activeAfterRegister&&Y::module()->sendActivationMail==false) {
Y::flash('/user/registration',Users::t("Thank you for your registration. Please {{login}}.",array('{{login}}'=>CHtml::link(Users::t('Login'),Y::module()->loginUrl))));
} elseif(Y::module()->loginNotActiv) {
Y::flash('/user/registration',Users::t("Thank you for your registration. Please check your email or login."));
} else {
Y::flash('/user/registration',Users::t("Thank you for your registration. Please check your email."));
}
$this->refresh();
}
}
} else $profile->validate();
}
$this->render('/user/registration',array('model'=>$model,'profile'=>$profile,'lang'=>Yii::app()->language));
}
}
示例11: array
<?php
$this->breadcrumbs=array(
Users::t('Profile Fields')=>Users::url('profileField/admin'),
Users::t('Manage Profile Field'),
);
?>
<h1><?php echo Users::t('Manage Profile Fields'); ?></h1>
<?php echo $this->renderPartial('_menu', array(
'list'=> array(
CHtml::link(Users::t('Create Profile Field'),Users::url('profileField/create')),
),
));
?>
<?php $this->widget('zii.widgets.grid.CGridView', array(
'dataProvider'=>$dataProvider,
'cssFile'=>'/css/grid/styles.css',
'columns'=>array(
'id',
'varname',
array(
'name'=>'title',
'value'=>'Users::t($data->title)',
),
'field_type',
'field_size',
//'field_size_min',
array(
'name'=>'required',
'value'=>'ProfileField::itemAlias("required",$data->required)',
示例12: array
<?php
$this->breadcrumbs=array(
Users::t('Profile Fields')=>Users::url('profileField/admin'),
Users::t($model->title),
);
?>
<h1><?php echo Users::t('View Profile Field #').$model->varname; ?></h1>
<?php echo $this->renderPartial('_menu', array(
'list'=> array(
CHtml::link(Users::t('Create Profile Field'),Users::url('profileField/create')),
CHtml::link(Users::t('Update Profile Field'),Users::url('profileField/update',array('id'=>$model->id))),
CHtml::linkButton(Users::t('Delete Profile Field'),array('submit'=>Users::url('profileField/delete',array('id'=>$model->id)),'confirm'=>'Are you sure to delete this item?')),
),
));
?>
<?php $this->widget('zii.components.CDetailView', array(
'data'=>$model,
'attributes'=>array(
'id',
'varname',
'title',
'field_type',
'field_size',
'field_size_min',
'required',
'match',
'range',
'error_message',
'other_validator',
示例13: attributeLabels
/**
* @return array customized attribute labels (name=>label)
*/
public function attributeLabels()
{
$labels = array(
'user_id' => Users::t('User ID'),
);
$model=$this->getFields();
foreach ($model as $field)
$labels[$field->varname] = ((Y::module('users')->fieldsMessage)?Users::t($field->title,array(),Y::module('users')->fieldsMessage):Users::t($field->title));
return $labels;
}
示例14: if
Users::t("Login") => Users::url('login'),
Users::t("Restore"),
);
?>
<h1><?php echo Users::t("Restore"); ?></h1>
<?php if(Y::hasFlash('recoveryMessage')): ?>
<div class="success">
<?php echo Y::flash('recoveryMessage'); ?>
</div>
<?php else: ?>
<div class="form">
<?php echo CHtml::beginForm(); ?>
<?php echo CHtml::errorSummary($form); ?>
<div class="row">
<?php echo CHtml::activeLabel($form,'login_or_email'); ?>
<?php echo CHtml::activeTextField($form,'login_or_email') ?>
<p class="hint"><?php echo Users::t("Please enter your login or email addres."); ?></p>
</div>
<div class="row submit">
<?php echo CHtml::submitButton(Users::t("Restore")); ?>
</div>
<?php echo CHtml::endForm(); ?>
</div><!-- form -->
<?php endif; ?>
示例15: if
echo$form->textArea($profile,$field->varname,array('rows'=>6, 'cols'=>50));
} else {
echo $form->textField($profile,$field->varname,array('size'=>60,'maxlength'=>(($field->field_size)?$field->field_size:255)));
}
?>
<?php echo $form->error($profile,$field->varname); ?>
</div>
<?php
}
}
?>
<?php if (UsersModule::doCaptcha('registration')): ?>
<div class="row">
<?php echo $form->labelEx($model,'verifyCode'); ?>
<?php $this->widget('CCaptcha'); ?>
<?php echo $form->textField($model,'verifyCode'); ?>
<?php echo $form->error($model,'verifyCode'); ?>
<p class="hint"><?php echo Users::t("Please enter the letters as they are shown in the image above."); ?>
<br/><?php echo Users::t("Letters are not case-sensitive."); ?></p>
</div>
<?php endif; ?>
<div class="row submit">
<?php echo CHtml::submitButton(Users::t("Register")); ?>
</div>
<?php $this->endWidget(); ?>
</div><!-- form -->
<?php endif; ?>