当前位置: 首页>>代码示例>>PHP>>正文


PHP UserModule::t方法代码示例

本文整理汇总了PHP中UserModule::t方法的典型用法代码示例。如果您正苦于以下问题:PHP UserModule::t方法的具体用法?PHP UserModule::t怎么用?PHP UserModule::t使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UserModule的用法示例。


在下文中一共展示了UserModule::t方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: actionChangepassword

 /**
  * Change password
  */
 public function actionChangepassword()
 {
     $model = new UserChangePassword();
     if (Yii::app()->user->id) {
         // ajax validator
         if (isset($_POST['ajax']) && $_POST['ajax'] === 'changepassword-form') {
             echo UActiveForm::validate($model);
             Yii::app()->end();
         }
         if (isset($_POST['UserChangePassword'])) {
             $model->attributes = $_POST['UserChangePassword'];
             if ($model->validate()) {
                 $new_password = User::model()->notsafe()->findbyPk(Yii::app()->user->id);
                 $new_password->password = UserModule::encrypting($model->password);
                 $new_password->activkey = UserModule::encrypting(microtime() . $model->password);
                 $new_password->save();
                 ///ALSO SAVE PASS oN SERVER
                 $u = User::model()->findByAttributes(array('password' => $new_password->password));
                 $rm_msg = $model->remoteupdatepass($u->email, $new_password->password);
                 Yii::app()->user->setFlash('profileMessage', UserModule::t("New password is saved " . $rm_msg));
                 $this->redirect(array("profile"));
             }
         }
         $this->render('changepassword', array('model' => $model));
     }
 }
开发者ID:sudeeptalati,项目名称:AmicaEngineerPortal,代码行数:29,代码来源:ProfileController.php

示例2: actionIndex

 public function actionIndex()
 {
     // Kiểm tra nếu đăng nhập rồi chuyển trang
     if (!Yii::app()->user->isGuest) {
         if (strpos(Yii::app()->user->returnUrl, '/index.php') !== false) {
             $this->redirect("/user/profile");
         } else {
             $this->redirect(Yii::app()->user->returnUrl);
         }
     }
     $model = new LoginForm();
     // if it is ajax validation request
     if (isset($_POST['ajax']) && $_POST['ajax'] === 'login-form') {
         echo CActiveForm::validate($model);
         Yii::app()->end();
     }
     // collect user input data
     if (isset($_POST['LoginForm'])) {
         $model->attributes = $_POST['LoginForm'];
         // validate user input and redirect to the previous page if valid
         if ($model->validate() && $model->login()) {
             $this->setRedirectOptions(array("title" => UserModule::t('Login Success'), "message" => UserModule::t('The login was successful!')));
             if (strpos(Yii::app()->user->returnUrl, '/index.php') !== false) {
                 $this->redirect("/user/profile");
             } else {
                 $this->redirect(Yii::app()->user->returnUrl);
             }
         }
     }
     $this->render('index', array('model' => $model));
 }
开发者ID:qkongvan,项目名称:k6-thuc-pham,代码行数:31,代码来源:LoginController.php

示例3: 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->autoLogin($find->username);
             // update user_id in invite table
             Invite::model()->updateNewUser($find);
             // account already active
             Yii::app()->user->setFlash('success', 'Congratulations! Your account is now active. Please follow the directions below to set up your location.');
             $this->redirect('/userlocation/locate');
             //			    $this->render('/user/message',array('title'=>UserModule::t("User activation"),'content'=>UserModule::t("Your account is active.")));
         } elseif (isset($find->activkey) && $find->activkey == $activkey) {
             $find->activkey = UserModule::encrypting(microtime());
             $find->status = 1;
             $find->save();
             $this->autoLogin($find->username);
             // direct to autolocate with activation message
             Yii::app()->user->setFlash('success', 'Congratulations! Your account is now active. Please follow the directions below to set up your location.');
             $this->redirect('/userlocation/locate');
             // $this->render('/user/message',array('title'=>UserModule::t("User activation"),'content'=>UserModule::t("Your account is activated.")));
         } else {
             $this->render('/user/message', array('title' => UserModule::t("User activation"), 'content' => UserModule::t("Incorrect activation URL. Please email support@geogram.com if you need assistance.")));
         }
     } else {
         $this->render('/user/message', array('title' => UserModule::t("User activation"), 'content' => UserModule::t("Incorrect activation URL. Please email support@geogram.com if you need assistance.")));
     }
 }
开发者ID:mafiu,项目名称:listapp,代码行数:33,代码来源:ActivationController.php

示例4: authenticate

 /**
  * Authenticates the password.
  * This is the 'authenticate' validator as declared in rules().
  * returning true false does not stops proceeding to action. to stop add error to attribute.
  */
 public function authenticate($attribute, $params)
 {
     if (!$this->hasErrors()) {
         $this->_identity = new UserIdentity($this->username, $this->password);
         $this->_identity->authenticate();
         switch ($this->_identity->errorCode) {
             case UserIdentity::ERROR_NONE:
                 $duration = $this->rememberMe ? Yii::app()->controller->module->rememberMeTime : 0;
                 Yii::app()->user->login($this->_identity, $duration);
                 AppCommon::mergeCookieAndDbCart();
                 //on login merge the db and cookie carts
                 break;
             case UserIdentity::ERROR_EMAIL_INVALID:
                 $this->addError("username", UserModule::t("Email is incorrect."));
                 break;
             case UserIdentity::ERROR_STATUS_NOTACTIV:
                 $this->addError("username", UserModule::t("You account is not activated."));
                 break;
             case UserIdentity::ERROR_STATUS_BAN:
                 $this->addError("username", UserModule::t("You account is blocked."));
                 break;
             case UserIdentity::ERROR_PASSWORD_INVALID:
                 $this->addError("password", UserModule::t("Password is incorrect."));
                 break;
         }
         if ($this->_identity->errorCode === UserIdentity::ERROR_NONE) {
             return true;
         } else {
             return false;
         }
     }
 }
开发者ID:ankitbishtkec,项目名称:generic-ecommerce-website,代码行数:37,代码来源:LoginForm.php

示例5: checkRePassword

 public function checkRePassword($attribute, $params)
 {
     Yii::import('application.modules.user.components.HUserIdentity');
     if ($this->password != $this->rePassword) {
         $this->addError('rePassword', UserModule::t('Incorrect retype password.'));
     }
 }
开发者ID:qkongvan,项目名称:k6-thuc-pham,代码行数:7,代码来源:User.php

示例6: actionChangepassword

 /**
  * Change password
  */
 public function actionChangepassword()
 {
     $model = new UserChangePassword();
     if (Yii::app()->user->id) {
         //$phis = new PasswordHistory();
         //$passes = $phis->getHistory(Yii::app()->user->id);
         //CVarDumper::dump($passes);
         // ajax validator
         if (isset($_POST['ajax']) && $_POST['ajax'] === 'changepassword-form') {
             echo UActiveForm::validate($model);
             Yii::app()->end();
         }
         if (isset($_POST['UserChangePassword'])) {
             $model->attributes = $_POST['UserChangePassword'];
             if ($model->validate()) {
                 $new_password = User::model()->notsafe()->findbyPk(Yii::app()->user->id);
                 $new_password->password = PasswordHelper::hashPassword($model->password);
                 $new_password->activkey = PasswordHelper::hashPassword(microtime() . $model->password);
                 $new_password->password_update_time = date('Y-m-d H:i:s');
                 $new_password->save();
                 $passwordHistory = new PasswordHistory();
                 $passwordHistory->profile_id = $new_password->id;
                 $passwordHistory->password = $new_password->password;
                 $passwordHistory->save();
                 Yii::app()->user->setFlash('profileMessage', UserModule::t("New password is saved."));
                 $this->redirect(array("profile"));
             }
         }
         if (isset($this->location)) {
             $this->render('frontend.views.profile.changepassword', array('model' => $model));
         } else {
             $this->render('changepassword', array('model' => $model));
         }
     }
 }
开发者ID:Rudianasaja,项目名称:cycommerce,代码行数:38,代码来源:ProfileController.php

示例7: getDefaultPicture

 /**
  * Gets the default profile picture for a specifc user.
  * @param string $userId The Id of the user to get profile picture. If this is empty, the current user's avatar will be returned.
  * @param string $type The type of picture to return (original, thumb.profile, thumb.feed, thumb.icon)
  * @return array The picture info (path, alt, title, width, height)
  */
 public static function getDefaultPicture($userId = '', $type = 'original')
 {
     if (empty($userId)) {
         $userId = Yii::app()->user->getId();
         if (empty($userId)) {
             return null;
         }
     }
     // Detect user's gender to decide which avatar should be chosen
     $gender = Profile::model()->getFieldInfo($userId, User::PREFIX, 'gender');
     if ($gender['value'] === 'male') {
         $info['path'] = Yii::app()->getBaseUrl(true) . '/files/images/default-avatar-male.jpg';
     } else {
         $info['path'] = Yii::app()->getBaseUrl(true) . '/files/images/default-avatar-female.jpg';
     }
     // Alt and title
     $info['alt'] = $info['title'] = UserModule::t('Default Avatar');
     // Get size
     //Yii::app()->getModule('system'); // Get module 'system'
     $photoTypes = Setting::model()->get('photo_types', array('value'));
     /*var_dump($photoTypes->value);
     		var_dump($photoTypes['value']); die;*/
     $photoTypes = json_decode($photoTypes['value'], true);
     // true indicates that the object will be converted to associative arrays
     if (!isset($photoTypes[$type])) {
         $info['width'] = 160;
         $info['height'] = 160;
     } else {
         $info['width'] = $photoTypes[$type]['width'];
         $info['height'] = $photoTypes[$type]['height'];
     }
     return $info;
 }
开发者ID:redlaw,项目名称:lintinzone,代码行数:39,代码来源:ProfilePicture.php

示例8: authenticate

 /**
  * Authenticates the password.
  * This is the 'authenticate' validator as declared in rules().
  */
 public function authenticate($attribute, $params)
 {
     if (!$this->hasErrors()) {
         $identity = new UserIdentity($this->username, $this->password);
         $identity->authenticate();
         switch ($identity->errorCode) {
             case UserIdentity::ERROR_NONE:
                 $duration = $this->rememberMe ? Yii::app()->controller->module->rememberMeTime : 0;
                 Yii::app()->user->login($identity, $duration);
                 break;
             case UserIdentity::ERROR_EMAIL_INVALID:
                 $this->addError("username", UserModule::t("Sähköposti on virheellinen."));
                 break;
             case UserIdentity::ERROR_USERNAME_INVALID:
                 $this->addError("username", UserModule::t("Käyttäjätunnus on virheellinen."));
                 break;
             case UserIdentity::ERROR_STATUS_NOTACTIV:
                 $this->addError("status", UserModule::t("Tunnuksesi ei toimi."));
                 break;
             case UserIdentity::ERROR_STATUS_BAN:
                 $this->addError("status", UserModule::t("Tilisi on estetty."));
                 break;
             case UserIdentity::ERROR_PASSWORD_INVALID:
                 $this->addError("password", UserModule::t("Salasana on virheellinen."));
                 break;
         }
     }
 }
开发者ID:laptopsr,项目名称:miinus,代码行数:32,代码来源:UserLogin.php

示例9: authenticate

 /**
  * Authenticates the user's credentials.
  * @return true|false
  */
 public function authenticate($attribute, $params)
 {
     // Ensure the input to be authenticated is valid.
     if (!$this->hasErrors()) {
         $identity = new UserIdentity($this->username, $this->password);
         $identity->authenticate();
         switch ($identity->errorCode) {
             case UserIdentity::ERROR_NONE:
                 //$duration = $this->rememberMe ? 3600 * 24 * 30 : 0;
                 $duration = 0;
                 Yii::app()->user->login($identity, $duration);
                 return true;
             case UserIdentity::ERROR_EMAIL_INVALID:
             case UserIdentity::ERROR_USERNAME_INVALID:
             case UserIdentity::ERROR_PASSWORD_INVALID:
                 Yii::trace('Error codeeee: ' . $identity->errorCode, 'system.db.ar.CActiveRecord');
                 $this->addError('username', UserModule::t('Incorrect username or password.'));
                 return false;
             case UserIdentity::ERROR_STATUS_NOTACTIVE:
                 $this->addError('active', UserModule::t('Your account is not activated yet. Make sure you confirm your email address before logging in.'));
                 return false;
             case UserIdentity::ERROR_STATUS_BLOCKED:
                 $this->addError('blocked', UserModule::t('Your account is blocked.'));
                 return false;
         }
     }
 }
开发者ID:redlaw,项目名称:lintinzone,代码行数:31,代码来源:Login.php

示例10: actionChangepassword

	/**
	 * Change password
	 */
	public function actionChangepassword() {
		$model = new UserChangePassword;
		if (Yii::app()->user->id) {
			
			// ajax validator
			if(isset($_POST['ajax']) && $_POST['ajax']==='changepassword-form')
			{
				echo UActiveForm::validate($model);
				Yii::app()->end();
			}
			
			if(isset($_POST['UserChangePassword'])) {
					$model->attributes=$_POST['UserChangePassword'];
					if($model->validate()) {
						$new_password = User::model()->notsafe()->findbyPk(Yii::app()->user->id);
						$new_password->password = UserModule::encrypting($model->password);
						$new_password->activkey=UserModule::encrypting(microtime().$model->password);
						$new_password->save();
						Yii::app()->user->setFlash('success',UserModule::t("New password is saved."));
						$this->redirect(array("profile"));
					}
			}
			$this->render('changepassword',array('model'=>$model));
	    }
	}
开发者ID:alsvader,项目名称:hackbanero,代码行数:28,代码来源:ProfileController.php

示例11: authenticate

 /**
  * Authenticates the password.
  * This is the 'authenticate' validator as declared in rules().
  */
 public function authenticate($attribute, $params)
 {
     if (!$this->hasErrors()) {
         $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", UserModule::t("Email is incorrect."));
                 break;
             case UserIdentity::ERROR_USERNAME_INVALID:
                 $this->addError("username", UserModule::t("Username is incorrect. Please make sure you are using the secondary login details provided in your email"));
                 break;
             case UserIdentity::ERROR_STATUS_NOTACTIV:
                 $this->addError("status", UserModule::t("You account is not activated."));
                 break;
             case UserIdentity::ERROR_STATUS_BAN:
                 $this->addError("status", UserModule::t("You account is blocked."));
                 break;
             case UserIdentity::ERROR_PASSWORD_INVALID:
                 $this->addError("password", UserModule::t("Password is incorrect."));
                 break;
             case UserIdentity::ERROR_SERVER_ERROR:
                 $this->addError("status", UserModule::t("There is a server error. Please contact support"));
                 break;
             default:
                 $this->addError("status", UserModule::t("KUCH TO GADABAD HAI"));
                 break;
         }
     }
 }
开发者ID:sudeeptalati,项目名称:AmicaEngineerPortal,代码行数:39,代码来源:UserLogin.php

示例12: actionCreate

 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new User();
     $profile = new Profile();
     $this->performAjaxValidation(array($model, $profile));
     if (isset($_POST['User'])) {
         $model->attributes = $_POST['User'];
         $password = $_POST['User']['password'];
         $model->activkey = Yii::app()->controller->module->encrypting(microtime() . $model->password);
         $profile->attributes = $_POST['Profile'];
         $profile->user_id = 0;
         if ($model->validate() && $profile->validate()) {
             $model->password = Yii::app()->controller->module->encrypting($model->password);
             if ($model->save()) {
                 //send mail
                 UserModule::sendMail($model->email, UserModule::t("You are registered from {site_name}", array('{site_name}' => Yii::app()->name)), UserModule::t("Please login to your account with your email id as username and password {password}", array('{password}' => $password)));
                 $profile->user_id = $model->id;
                 $profile->save();
             }
             $this->redirect(array('/rights/assignment/user', 'id' => $model->id));
         } else {
             $profile->validate();
         }
     }
     $this->render('create', array('model' => $model, 'profile' => $profile));
 }
开发者ID:akilraj1255,项目名称:rajeshwari,代码行数:30,代码来源:AdminController.php

示例13: actionConfirm

 public function actionConfirm()
 {
     if (!isset($_GET['email']) && !isset($_GET['key'])) {
         $this->redirect(array('index/index'));
     }
     switch (EmailVerification::model()->confirm($_GET['email'], $_GET['key'])) {
         case EmailVerification::CONFIRM_ALREADY_ACTIVE:
             echo UserModule::t('This email address has already been verified. Thank you!');
             break;
         case EmailVerification::CONFIRM_INVALID_KEY:
             echo UserModule::t('The confirmation key is invalid!');
             break;
         case EmailVerification::CONFIRM_KEY_NOT_ACTIVE:
             echo UserModule::t('This key is no longer active');
             break;
         case EmailVerification::CONFIRM_USER_BLOCKED:
             echo UserModule::t('This account is currently blocked');
             break;
         case EmailVerification::CONFIRM_SUCCESS:
             echo UserModule::t('This email is now verified. You can log in your account using this email. Thank you!');
             break;
         case EmailVerification::CONFIRM_ERROR:
         default:
             echo UserModule::t('Oops, an error has occurred! Please try again.');
     }
 }
开发者ID:redlaw,项目名称:lintinzone,代码行数:26,代码来源:RegistrationController.php

示例14: verifyOldPassword

 /**
  * Verify Old Password
  */
 public function verifyOldPassword($attribute, $params)
 {
     $password = User::model()->notsafe()->findByPk(Yii::app()->user->id)->password;
     if ($password != Yii::app()->getModule('user')->encrypting($this->{$attribute}, $password)) {
         $this->addError($attribute, UserModule::t("Old Password is incorrect."));
     }
 }
开发者ID:alsvader,项目名称:hackbanero,代码行数:10,代码来源:UserChangePassword.php

示例15: 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'=>UserModule::t("User activation"),'content'=>UserModule::t("You account is active.")));
			} elseif(isset($find->activkey) && ($find->activkey==$activkey)) {
				$find->activkey = UserModule::encrypting(microtime());
				$find->status = 1;
				$find->save();
                if (!Yii::app()->controller->module->autoLogin) {
                    $this->render('/user/message',array('title'=>UserModule::t("User activation"),'content'=>UserModule::t("You account is activated.")));
                } else {
                    $identity=new UserIdentity($find->username, '');
                    $identity->authenticate(true);
                    Yii::app()->user->login($identity,0);
                    Yii::app()->user->setFlash('userActivationSuccess', UserModule::t("You account is activated."));
                    $this->redirect(Yii::app()->controller->module->returnUrl);
                }
			} else {
			    $this->render('/user/message',array('title'=>UserModule::t("User activation"),'content'=>UserModule::t("Incorrect activation URL.")));
			}
		} else {
			$this->render('/user/message',array('title'=>UserModule::t("User activation"),'content'=>UserModule::t("Incorrect activation URL.")));
		}
	}
开发者ID:rallin,项目名称:yii-user,代码行数:30,代码来源:ActivationController.php


注:本文中的UserModule::t方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。