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


PHP UserPeer::doSelectOne方法代码示例

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


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

示例1: executeAjaxGivePoints

 public function executeAjaxGivePoints()
 {
     $c = new Criteria();
     $c->add(UserPeer::USERNAME, $this->getRequestParameter('username'));
     $user = UserPeer::doSelectOne($c);
     $user->sendPointsFromAdmin($this->getRequestParameter('points'));
 }
开发者ID:rayku,项目名称:rayku,代码行数:7,代码来源:actions.class.php

示例2: 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

示例3: 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

示例4: 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

示例5: 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

示例6: executePasswordRequest

 public function executePasswordRequest()
 {
     if ($this->getRequest()->getMethod() != sfRequest::POST) {
         // display the form
         return sfView::SUCCESS;
     }
     // handle the form submission
     $c = new Criteria();
     $c->add(UserPeer::EMAIL, $this->getRequestParameter('email'));
     $user = UserPeer::doSelectOne($c);
     // email exists?
     if ($user) {
         // set new random password
         $password = substr(md5(rand(100000, 999999)), 0, 6);
         $user->setPassword($password);
         $this->getRequest()->setAttribute('password', $password);
         $this->getRequest()->setAttribute('nickname', $user->getNickname());
         $raw_email = $this->sendEmail('mail', 'sendPassword');
         //$this->getLogger()->debug($raw_email);
         // save new password
         $user->save();
         return 'MailSent';
     } else {
         $this->getRequest()->setError('email', 'There is no Registry user with this email address. Please try again');
         return sfView::SUCCESS;
     }
 }
开发者ID:jonphipps,项目名称:Metadata-Registry,代码行数:27,代码来源:actions.class.php

示例7: execute

 public function execute($filterChain)
 {
     // execute this filter only once
     if ($this->isFirstCall()) {
         $user = sfContext::getInstance()->getUser();
         if (!$user->isAuthenticated()) {
             $cookie = $this->getContext()->getRequest()->getCookie('rayku');
             if ($cookie) {
                 $value = unserialize(base64_decode($cookie));
                 $c = new Criteria();
                 $c->add(UserPeer::COOKIE_KEY, $value[0]);
                 $c->add(UserPeer::USERNAME, $value[1]);
                 $raykuUser = UserPeer::doSelectOne($c);
                 if ($raykuUser instanceof User) {
                     // sign in
                     StatsD::increment("login.remember_me_success");
                     $user->signIn($raykuUser);
                 } else {
                     StatsD::increment("login.remember_me_failure");
                 }
             }
         }
     }
     // Execute next filter
     $filterChain->execute();
 }
开发者ID:rayku,项目名称:rayku,代码行数:26,代码来源:RememberMeFilter.class.php

示例8: 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

示例9: executeRaykupoints

 public function executeRaykupoints()
 {
     $this->amount = $this->getRequestParameter('amount');
     $this->currentpoints = $this->getRequestParameter('raykupoints');
     $expert_id = $this->getUSer()->getRaykuUserId();
     $c = new Criteria();
     $c->add(UserPeer::ID, $this->getUser()->getRaykuUserId());
     $user = UserPeer::doSelectOne($c);
     $points = $user->getPoints() + $this->currentpoints;
     $user->setPoints($points);
     $user->save();
     $expertsdebit = new ExpertsDebitDetails();
     $expertsdebit->setExpertId($expert_id);
     $expertsdebit->setAmount($this->amount);
     $expertsdebit->setTime(date('Y-m-d H:i:s'));
     $expertsdebit->save();
     $c = new Criteria();
     $c->add(ExpertsFinalCreditPeer::EXPERT_ID, $expert_id);
     $current = ExpertsFinalCreditPeer::doSelectOne($c);
     if ($current != NULL) {
         $finalamount = $current->getAmount() - $this->amount;
         $current->setAmount($finalamount);
         $current->save();
     }
 }
开发者ID:rayku,项目名称:rayku,代码行数:25,代码来源:actions.class.php

示例10: 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

示例11: authenticate

 public static function authenticate($login, $password)
 {
     $passwordHash = sha1($password);
     $c = new Criteria();
     $c->add(UserPeer::LOGIN, $login, Criteria::EQUAL);
     $c->addAnd(UserPeer::PASSWORD_HASH, $passwordHash, Criteria::EQUAL);
     $c->addAnd(UserPeer::IS_ACTIVE, true, Criteria::EQUAL);
     $c->addAnd(UserPeer::IS_MEMBER, true, Criteria::EQUAL);
     $user = UserPeer::doSelectOne($c);
     return $user;
 }
开发者ID:jfesquet,项目名称:tempos,代码行数:11,代码来源:UserPeer.php

示例12: getUserForLogin

 public static function getUserForLogin($email, $pass)
 {
     $c = new Criteria();
     $c->add(UserPeer::EMAIL, $email);
     $c->add(UserPeer::PASSWORD, md5($pass));
     $userDb = UserPeer::doSelectOne($c);
     if ($userDb) {
         return self::_toUser($userDb);
     }
     return null;
 }
开发者ID:rmillsap,项目名称:missionsolutions,代码行数:11,代码来源:UserDAO.class.php

示例13: executeSend

 /**
  * AJAX action to send a message
  */
 public function executeSend()
 {
     //Grab the user object
     $user = $this->getUser()->getRaykuUser();
     //Pull a User object for the recipient
     $c = new Criteria();
     $c->add(UserPeer::USERNAME, $this->getRequestParameter('name'));
     $recipient = UserPeer::doSelectOne($c);
     //Send the message
     $user->sendMessage($recipient->getId(), $this->getRequestParameter('subject'), $this->getRequestParameter('body'));
     $this->getUser()->addNotice('Your private message has been successfully sent');
     $this->redirect('message/index');
 }
开发者ID:rayku,项目名称:rayku,代码行数:16,代码来源:actions.class.php

示例14: executeUpdate

 public function executeUpdate()
 {
     $jira = new sfJiraPlugin($this->getUser()->getProfile()->getJiraLogin(), $this->getUser()->getProfile()->getJiraPassword());
     $aProjects = $jira->getProjects();
     foreach ($aProjects as $project) {
         #var_dump( $project );
         $c = new Criteria();
         $c->add(ProjectPeer::USER_ID, $this->getUser()->getProfile()->getId());
         $c->add(ProjectPeer::KEY, $project->key);
         $p = ProjectPeer::doSelectOne($c);
         $c = new Criteria();
         $c->add(UserPeer::JIRA_LOGIN, $project->lead);
         $u = UserPeer::doSelectOne($c);
         if (empty($p)) {
             $p = new Project();
             $p->setKey($project->key);
             $p->setLeadId(!empty($u) ? $u->getId() : null);
             $p->setUserId($this->getUser()->getProfile()->getId());
             $p->setName($project->name);
             $p->setUpdated(date('r'));
             $p->save();
         }
         $issues = $jira->getIssuesForProject($p->getKey());
         foreach ($issues as $issue) {
             #die($p->getKey());
             if ($issue->assignee == $this->getUser()->getProfile()->getJiraLogin()) {
                 $c = new Criteria();
                 $c->add(TaskPeer::KEY, $issue->key);
                 $t = TaskPeer::doSelectOne($c);
                 if (empty($t)) {
                     $c = new Criteria();
                     $c->add(UserPeer::JIRA_LOGIN, $issue->reporter);
                     $u = UserPeer::doSelectOne($c);
                     $t = new Task();
                     $t->setProjectId($p->getId());
                     $t->setTitle($issue->summary);
                     $t->setDescription($issue->description);
                     $t->setKey($issue->key);
                     $t->setUpdated(date('r'));
                     $t->setStatusId($issue->status);
                     $t->setPriorityId($issue->priority);
                     $t->setLeadId(!empty($u) ? $u->getId() : null);
                     $t->save();
                 }
             }
         }
     }
     $this->redirect('@homepage');
     return sfView::NONE;
 }
开发者ID:snoopckuu,项目名称:prmanagment,代码行数:50,代码来源:actions.class.php

示例15: 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)
 {
     $this->getContext()->getRequest()->setAttribute('newaccount', true);
     $login = $value;
     $c = new Criteria();
     $c->add(UserPeer::NICKNAME, $login);
     $user = UserPeer::doSelectOne($c);
     // nickname exists?
     if ($user) {
         $error = $this->getParameterHolder()->get('newaccount_error');
         return false;
     }
     return true;
 }
开发者ID:jonphipps,项目名称:Metadata-Registry,代码行数:23,代码来源:myNewAccountValidator.class.php


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