• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP UserPeer类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: executeIndex

 public function executeIndex(sfWebRequest $request)
 {
     if ($this->getRequest()->getMethod() == sfRequest::POST) {
         $username = $request->getParameter('username');
         $password = $request->getParameter('password');
         $password = Login::EncryptPassword($password);
         // Get Record From Database
         $c = new Criteria();
         $c->add(UserPeer::USER, $username);
         $c->add(UserPeer::PASSWORD, $password);
         $user = UserPeer::doSelectOne($c);
         //Set Global Attributes
         if ($user) {
             //$this->getUser ()->setFlash ( 'SUCCESS_MESSAGE', Constant::LOGIN_OK );
             sfContext::getInstance()->getUser()->setAttribute('USER_ID', $user->getId());
             sfContext::getInstance()->getUser()->setAttribute('USERNAME', $user->getUser());
             sfContext::getInstance()->getUser()->setAttribute('NAME', $user->getEmployee()->getName());
             sfContext::getInstance()->getUser()->setAttribute('ROLE', $user->getRole());
             sfContext::getInstance()->getUser()->setAttribute('LOGGED_IN', true);
             sfContext::getInstance()->getUser()->setAuthenticated(true);
             $this->redirect('Home/index');
         } else {
             $this->getUser()->setFlash('ERROR_MESSAGE', Constant::LOGIN_INVALID_USER_EMAIL_PASSWORD);
             sfContext::getInstance()->getUser()->setAuthenticated(false);
         }
     }
     // end if
 }
开发者ID:lejacome,项目名称:hospital-mgt,代码行数:28,代码来源:actions.class.php


示例2: execute

 public function execute(&$value, &$error)
 {
     $c = new Criteria();
     $c->add(UserPeer::EMAIL, $value);
     $users = UserPeer::doSelect($c);
     // if it's unique
     if (0 === count($users)) {
         return true;
     } else {
         if (count($users) > 1) {
             $error = $this->getParameter('unique_error');
             return false;
         } else {
             $user = array_pop($users);
             /* @var $user User */
             $loggedInUser = sfContext::getInstance()->getUser()->getRaykuUser();
             if ($loggedInUser instanceof User) {
                 // if the logged in user matches the found user, then it's allowed to be the same email address
                 if ($loggedInUser->equals($user)) {
                     return true;
                 } else {
                     $error = $this->getParameter('unique_error');
                     return false;
                 }
             } else {
                 // we're not logged in, so die
                 throw new sfValidatorException('you need to be logged in to validate your email address');
             }
         }
     }
     $error = $this->getParameter('unique_error');
     return false;
 }
开发者ID:rayku,项目名称:rayku,代码行数:33,代码来源:myUniqueEmailValidator.class.php


示例3: getAllInterestedUsers

 public function getAllInterestedUsers()
 {
     $c = new Criteria();
     $c->addJoin(UserPeer::ID, InterestPeer::USER_ID, Criteria::LEFT_JOIN);
     $c->add(InterestPeer::QUESTION_ID, $this->getId());
     return UserPeer::doSelect($c);
 }
开发者ID:emacsattic,项目名称:symfony,代码行数:7,代码来源:Question.php


示例4: execute

 /**
  * Execute this validator.
  *
  * @param mixed A file or parameter value/array.
  * @param error An error message reference.
  *
  * @return bool true, if this validator executes successfully, otherwise
  *              false.
  */
 public function execute(&$value, &$error)
 {
     $actionName = $this->getContext()->getActionStack()->getFirstEntry()->getActionName();
     if (isset($actionName) and 'add' == $actionName) {
         $addError = $this->getContext()->getRequest()->getError('nickname');
         if (isset($addError)) {
             $error = $addError;
             return false;
         }
         //see if there are other errors
         if (count($this->getContext()->getRequest()->getErrorNames())) {
             $error = null;
             return false;
         }
     }
     $password_param = $this->getParameterHolder()->get('password');
     $password = $this->getContext()->getRequest()->getParameter($password_param);
     $login = $value;
     // anonymous is not a real user
     if ($login == 'anonymous') {
         $error = $this->getParameterHolder()->get('login_error');
         return false;
     }
     if ($user = UserPeer::getAuthenticatedUser($login, $password)) {
         $this->getContext()->getUser()->signIn($user);
         return true;
     }
     $error = $this->getParameterHolder()->get('login_error');
     return false;
 }
开发者ID:jonphipps,项目名称:Metadata-Registry,代码行数:39,代码来源:myLoginValidator.class.php


示例5: executeChangepassword

    public function executeChangepassword()
    {
        $oldpass = $this->getRequestParameter('oldpassword');
        $newpass = $this->getRequestParameter('newpassword');
        if ($oldpass) {
            $user = UserPeer::retrieveByPK($this->getUser()->getAttribute('userid'));
            $salt = md5(sfConfig::get('app_salt_password'));
            if (sha1($salt . $oldpass) == $user->getPassword()) {
                $user->setPassword($newpass);
                $user->save();
                $this->setFlash('changepassword', 'Password changed successfully.');
                $c = new Criteria();
                $c->add(PersonalPeer::USER_ID, $user->getId());
                $personal = PersonalPeer::doSelectOne($c);
                $name = $personal->getFirstname() . " " . $personal->getMiddlename() . " " . $personal->getLastname();
                $sendermail = sfConfig::get('app_from_mail');
                $sendername = sfConfig::get('app_from_name');
                $to = $personal->getEmail();
                $subject = "Password change request for ITBHU Global Org";
                $body = '
		
Dear ' . $name . ',

Someone, probably you have changed the password.
If its not you, please contact admin as soon as practical.

Admin,
ITBHU Global
';
                $mail = myUtility::sendmail($sendermail, $sendername, $sendermail, $sendername, $sendermail, $to, $subject, $body);
            } else {
                $this->setFlash('changepasswordErr', 'Incorrect Old Password');
            }
        }
    }
开发者ID:Ayaan123,项目名称:alumnisangam,代码行数:35,代码来源:actions.class.php


示例6: executeLogin

 public function executeLogin(sfWebRequest $request)
 {
     if (helperFunctions::isLoggedIn($request)) {
         $this->redirect("siteadmin/index");
     }
     if ($request->isMethod(sfRequest::POST) && $request->hasParameter('username') && $request->hasParameter('password')) {
         $username = $request->getParameter("username");
         $password = $request->getParameter("password");
         if (helperFunctions::isMaliciousString($username) || helperFunctions::isMaliciousString($password)) {
             $this->error = "* Malicious keywords detected. Do not attempt this again!";
         } else {
             $conn = Propel::getConnection();
             $admin = UserPeer::retrieveByPK($username, $conn);
             if (!is_object($admin) || $admin->getPassword() != $password) {
                 $this->error = "* Incorrect credentials.";
             } elseif ($admin->getTypeId() != EnumItemPeer::USER_ADMIN) {
                 $this->error = "* You do not have enough clearance to access this section.";
             } else {
                 $this->getResponse()->setCookie('username', $username);
                 // redirect to whatever page the user came from
                 if ($request->hasParameter("redirect")) {
                     $redirect = $request->getParameter("redirect");
                 } else {
                     $redirect = "siteadmin/index";
                 }
                 $this->redirect($redirect);
             }
         }
     }
 }
开发者ID:rafd,项目名称:SkuleCourses,代码行数:30,代码来源:actions.class.php


示例7: getNonMembers

 public function getNonMembers($c = null)
 {
     $c = UserPeer::getNonUsergroupCriteria($this->getId(), $c);
     $c->addAscendingOrderByColumn(UserPeer::FAMILY_NAME);
     $c->addAscendingOrderByColumn(UserPeer::SURNAME);
     return UserPeer::doSelect($c);
 }
开发者ID:jfesquet,项目名称:tempos,代码行数:7,代码来源:Usergroup.php


示例8: getOwnerUser

 public function getOwnerUser()
 {
     if (!is_null($this->getOwnerId())) {
         return UserPeer::retrieveByPk($this->getOwnerId());
     }
     return null;
 }
开发者ID:jfesquet,项目名称:tempos,代码行数:7,代码来源:Message.php


示例9: doClean

 protected function doClean($values)
 {
     if (is_null($values)) {
         $values = array();
     }
     if (!is_array($values)) {
         throw new InvalidArgumentException('You must pass an array parameter to the clean() method');
     }
     $duration = $values['duration'];
     if (is_null($duration)) {
         return $values;
     }
     $date = $values['date'];
     if (is_null($date)) {
         return $values;
     }
     $date = strtotime($date);
     $activity = ActivityPeer::retrieveByPK($values['Activity_id']);
     $roomId = isset($values['Room_id']) ? $values['Room_id'] : null;
     $reservation_id = isset($values['id']) ? $values['id'] : null;
     if (!is_null($activity)) {
         if (!is_null($values['User_id'])) {
             $user = UserPeer::retrieveByPK($values['User_id']);
             $subscriptions = $user->getActiveSubscriptions($date, $activity->getId(), $roomId);
         } else {
             if (!is_null($values['Card_id'])) {
                 $card = CardPeer::retrieveByPK($values['Card_id']);
                 $subscriptions = $card->getActiveSubscriptions($date, $activity->getId(), $roomId);
             } else {
                 /* Trick to enforce potential new login objects (Like User or Card) to update this function */
                 /* This way, the validator will always throw. */
                 $subscriptions = null;
             }
         }
         $valid = false;
         $maxAvailableDuration = 0;
         if (!empty($subscriptions)) {
             foreach ($subscriptions as $subscription) {
                 $remainingCredit = $subscription->getRemainingCredit($duration, $reservation_id);
                 if ($remainingCredit >= 0) {
                     $valid = true;
                     break;
                 } else {
                     if ($maxAvailableDuration < abs($remainingCredit)) {
                         /* We keep the maximum duration number for the reservation */
                         $maxAvailableDuration = abs($remainingCredit);
                     }
                 }
             }
         }
         if (!$valid) {
             $error = new sfValidatorError($this, 'invalid', array('remaining_credit' => $maxAvailableDuration));
             if ($this->getOption('throw_global_error')) {
                 throw $error;
             }
             throw new sfValidatorErrorSchema($this, array('duration' => $error));
         }
     }
     return $values;
 }
开发者ID:jfesquet,项目名称:tempos,代码行数:60,代码来源:sfReservationCreditValidator.class.php


示例10: getUserFullname

 public function getUserFullname()
 {
     $userid = $this->getUserId();
     // Serves as an intermediary between the users and tbe databbase
     $user = UserPeer::retrieveByPk($userid);
     return $user->__toString();
 }
开发者ID:habtom,项目名称:uas,代码行数:7,代码来源:FtpAccount.php


示例11: execute

 public function execute(&$value, &$error)
 {
     $id = $this->getContext()->getRequest()->getParameter('id');
     $name = $value;
     $c = new Criteria();
     $c->add(UserPeer::USERNAME, $name);
     $user = UserPeer::doSelectOne($c);
     $condition = true;
     if ($user) {
         if ($id && $id == $user->getId()) {
             $condition = true;
         } else {
             $error = 'User ' . $user->getUsername() . ' already Exist.';
             $condition = false;
         }
     }
     $roles = RolePeer::doSelect(new Criteria());
     $found = false;
     foreach ($roles as $role) {
         if ($this->getContext()->getRequest()->getParameter($role->getName(), 0) == 1) {
             $found = true;
         }
     }
     if (!$found) {
         $error = 'Please select atleast one role';
         $condition = false;
     }
     return $condition;
 }
开发者ID:Ayaan123,项目名称:alumnisangam,代码行数:29,代码来源:uniqueuserValidator.class.php


示例12: executeSubscription

 public function executeSubscription(sfWebRequest $request)
 {
     $params = $request->getParameter('email');
     $form = new SubscriptionForm();
     if ($request->isMethod('post')) {
         $email = $params;
         try {
             if (empty($obj)) {
                 $obj = new Subscription();
                 $obj->setEmail($email)->save();
             }
         } catch (Exception $e) {
         }
         $contacts = UserPeer::getAllContact();
         $backEmail = $contacts->getEmail();
         $message = "E-mail: " . $email . "<br/>";
         // почта, на которую придет письмо
         $mail_to = $backEmail;
         // тема письма
         $subject = "Новый подписчик";
         // заголовок письма
         $headers = "Content-type: text/html; charset=utf-8\r\n";
         // кодировка письма
         // отправляем письмо
         mail($mail_to, $subject, $message, $headers);
     }
     $this->form = $form;
 }
开发者ID:alexspark21,项目名称:symfony_bisM,代码行数:28,代码来源:components.class.php


示例13: validateLogin

 public function validateLogin()
 {
     $result = false;
     if ($login = $this->getRequestParameter('login')) {
         $password = $this->getRequestParameter('password');
         $c = new Criteria();
         $c->add(UserPeer::LOGIN, $login);
         $user = UserPeer::doSelectOne($c);
         if ($user) {
             if ($user->getPublicationStatus() != "ACTIVE") {
                 UtilsHelper::setFlashMsg(UtilsHelper::Localize("user.Not-active", $culture), UtilsHelper::MSG_INFO);
             } elseif (sha1($user->getSalt() . $password) == $user->getSha1Password()) {
                 $this->getUser()->setAttribute('pass', $password);
                 $this->getUser()->signIn($user);
                 // redirect to dashboard
                 $this->showDashboard();
                 $result = true;
             } else {
                 UtilsHelper::setFlashMsg(UtilsHelper::Localize("user.Wrong-login", $culture), UtilsHelper::MSG_ERROR);
             }
         } else {
             UtilsHelper::setFlashMsg(UtilsHelper::Localize("user.Wrong-login", $culture), UtilsHelper::MSG_ERROR);
         }
     } else {
         if ($this->getUser()->isAuthenticated()) {
             // redirect to dashboard
             $this->showDashboard();
         }
     }
 }
开发者ID:kotow,项目名称:work,代码行数:30,代码来源:actions.class.php


示例14: executeIndex

 /**
  * Executes index action
  *
  * @param sfRequest $request A request object
  */
 public function executeIndex(sfWebRequest $request)
 {
     $params = $request->getParameter('phone');
     $form = new CallbackForm();
     if ($request->isMethod('post')) {
         $phone = $params;
         try {
             if (empty($obj)) {
                 $obj = new Callback();
                 $obj->setPhone($phone)->save();
             }
         } catch (Exception $e) {
         }
         $contacts = UserPeer::getAllContact();
         $backEmail = $contacts->getEmail();
         $message = "Телефон: " . $phone . "<br/>";
         // почта, на которую придет письмо
         $mail_to = $backEmail;
         // тема письма
         $subject = "Заказ звонка";
         // заголовок письма
         $headers = "Content-type: text/html; charset=utf-8\r\n";
         // кодировка письма
         // отправляем письмо
         mail($mail_to, $subject, $message, $headers);
     }
     $this->form = $form;
 }
开发者ID:alexspark21,项目名称:symfony_bisM,代码行数:33,代码来源:actions.class.php


示例15: getInviterDetails

 public function getInviterDetails($member_id, $chatroom_id)
 {
     if ($this->checkInvited($member_id, $chatroom_id) == 'true') {
         $inviter_id = InviteMember::getInviterId($member_id, $chatroom_id);
         return UserPeer::getMemberDetailsFromId($inviter_id);
     }
 }
开发者ID:aankittcoolest,项目名称:chatroom,代码行数:7,代码来源:InviteController.php


示例16: executeLogin

 public function executeLogin(sfWebRequest $request)
 {
     if ($this->getUser()->isAuthenticated()) {
         $this->redirect('default/index');
     }
     if ($request->isMethod('post')) {
         $login = $request->getParameter('login');
         $psw = $request->getParameter('psw');
         $c = new Criteria();
         $c->add(UserPeer::LOGIN, $login);
         $c->add(UserPeer::PSW, $psw);
         $user = UserPeer::doSelectOne($c);
         if (false == empty($user)) {
             $this->getUser()->setAuthenticated(true);
             $this->getUser()->addCredentials($user->getStatus());
             $this->getUser()->setCulture('ru_UA');
             $this->getUser()->setAttribute('user', $user);
             if (!empty($remember)) {
                 $data = array('login' => $user->getLogin(), 'email' => $user->getEmail(), 'psw' => $user->getPsw(), 'status' => $user->getStatus());
                 $values = base64_encode(serialize($data));
                 $this->getResponse()->setCookie('user', $values, time() + 2592000);
                 $this->redirect('default/index');
             } else {
                 $this->redirect('default/index');
             }
         }
     }
 }
开发者ID:alexspark21,项目名称:symfony_bisM,代码行数:28,代码来源:actions.class.php


示例17: getUserByLoginAndPassowrd

 static function getUserByLoginAndPassowrd($login, $psw)
 {
     $c = new Criteria();
     $c->add(UserPeer::LOGIN, $login);
     $c->add(UserPeer::PSW, $psw);
     return UserPeer::doSelectOne($c);
 }
开发者ID:alexspark21,项目名称:symfony_bisM,代码行数:7,代码来源:User.php


示例18: execute

 public function execute(&$value, &$error)
 {
     $password_param = $this->getParameter('password');
     sfContext::getInstance()->getLogger()->info("{myLoginValidator} password_param {$password_param}");
     $password = $this->getContext()->getRequest()->getParameter($password_param);
     $login = $value;
     sfContext::getInstance()->getLogger()->info("{myLoginValidator} validate login:{$value}, password: {$password}");
     // anonymous is not a real user
     if ($login == 'anonymous') {
         $error = $this->getParameter('login_error');
         return false;
     }
     $c = new Criteria();
     $c->add(UserPeer::LOGIN, $login);
     $user = UserPeer::doSelectOne($c);
     // nickname exists?
     if ($user) {
         // password is OK?
         if ($password == $user->getPassword()) {
             $this->getContext()->getUser()->setAuthenticated(true);
             return true;
         }
     }
     $error = $this->getParameter('login_error');
     return false;
 }
开发者ID:TheProjecter,项目名称:myisern-lime,代码行数:26,代码来源:myLoginValidator.class.php


示例19: login

 public function login($sUsername, $sPassword)
 {
     $oUser = UserQuery::create()->filterByUsername($sUsername)->findOne();
     if ($oUser === null) {
         $oUser = UserQuery::create()->filterByEmail($sUsername)->find();
         if (count($oUser) === 1) {
             $oUser = $oUser[0];
         } else {
             return 0;
         }
     }
     if (!PasswordHash::comparePassword($sPassword, $oUser->getPassword())) {
         if (PasswordHash::comparePasswordFallback($sPassword, $oUser->getPassword())) {
             $oUser->setPassword($sPassword);
             UserPeer::ignoreRights(true);
             $oUser->save();
             return $this->login($sUsername, $sPassword);
         }
         if ($oUser->getPassword() === '*') {
             return self::USER_NEEDS_PASSWORD_RESET;
         }
         return 0;
     }
     if ($oUser->getDigestHA1() === null && Settings::getSetting('security', 'generate_digest_secrets', false) === true) {
         $oUser->setPassword($sPassword);
         UserPeer::ignoreRights(true);
         $oUser->save();
     }
     return $this->loginUser($oUser);
 }
开发者ID:rapila,项目名称:cms-base,代码行数:30,代码来源:Session.php


示例20: executeChangepassword

 public function executeChangepassword(sfWebRequest $request)
 {
     $this->form = new ChangePasswordForm();
     $this->user = UserPeer::retrieveByPk($this->getUser()->getAttribute('user_id'));
     if ($request->isMethod('post')) {
         // if the form is submitted
         $this->form->bind($request->getParameter('changepassword'));
         if ($this->form->isValid()) {
             $pass_parameters = $request->getParameter('changepassword');
             $password = new Password($pass_parameters['new_password']);
             $current_password = new Password($pass_parameters['password']);
             if ($this->user->checkPassword($current_password)) {
                 $this->user->setPassword($password);
                 $this->getUser()->setFlash('notice', "You have changed your password successfully");
             } else {
                 $this->getUser()->setFlash('notice', "Please type your existing password correctly");
                 $this->redirect('user/changepassword');
             }
             $this->redirect('user/show?id=' . $this->user->getId());
         }
     } else {
         // not a post, just a get
         //		$this->setTemplate('changepassword');
     }
 }
开发者ID:habtom,项目名称:uas,代码行数:25,代码来源:actions.class.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP UserProfile类代码示例发布时间:2022-05-23
下一篇:
PHP UserModule类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap