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


PHP sfGuardUserPeer::doSelectOne方法代码示例

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


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

示例1: executeConfirm

 public function executeConfirm()
 {
     $validate = $this->getRequestParameter('validate');
     $c = new Criteria();
     // 0.6.3: oops, this was in sfGuardUserProfilePeer in my application
     // and therefore never got shipped with the plugin until I built
     // a second site and spotted it!
     $c->add(SmintUserPeer::VALIDATE, $validate);
     $c->addJoin(sfGuardUserPeer::ID, SmintUserPeer::SF_GUARD_USER_ID);
     $sfGuardUser = sfGuardUserPeer::doSelectOne($c);
     if (!$sfGuardUser) {
         return 'Invalid';
     }
     $type = self::getValidationType($validate);
     if (!strlen($validate)) {
         return 'Invalid';
     }
     $profile = $sfGuardUser->getProfile();
     $profile->setValidate(null);
     $profile->save();
     if ($type == 'New') {
         $sfGuardUser->setIsActive(true);
         $sfGuardUser->save();
         $this->getUser()->signIn($sfGuardUser);
         // Email start
         $opts = array();
         $opts['from_name'] = sfConfig::get('app_mail_fromname', "Spectralmind");
         $opts['from_email'] = sfConfig::get('app_mail_from', "office@spectralmind.com");
         // the password is not plaintext, so we do not show it in the mail!
         $opts['parameters'] = array('username' => $sfGuardUser->getUsername(), 'pwd' => $sfGuardUser->getPassword());
         $opts['body_is_partial'] = true;
         $opts['to_name'] = $profile->getName();
         $opts['to_email'] = $profile->getEmail();
         $opts['subject'] = sfConfig::get('app_mail_subjectwelcomemail', "Welcome to SEARCH by Sound portal");
         //$opts['html'] = "sendValidateNew";
         $opts['text'] = "sendWelcomeEmail";
         /*
         			 // Or to use the Echo Logger
         			 $logger = new Swift_Plugins_Loggers_EchoLogger();
         			 $this->getMailer()->registerPlugin(new Swift_Plugins_LoggerPlugin($logger));
         			 * */
         $numSent = smintMailHelper::mail($opts);
         // not sent? react accordingly
         if ($numSent != 1) {
             mysfLog::log($this, "ERROR: welcome email not sent. Return value was {$numSent}");
             return 'Error';
         }
     }
     if ($type == 'Reset') {
         $this->getUser()->setAttribute('Reset', $sfGuardUser->getId(), 'sfApplyPlugin');
         return $this->redirect('sfApply/reset');
     }
 }
开发者ID:EQ4,项目名称:smint,代码行数:53,代码来源:actions.class.php

示例2: getsfGuardUser

 /**
  * Get the associated sfGuardUser object
  *
  * @param      PropelPDO Optional Connection object.
  * @return     sfGuardUser The associated sfGuardUser object.
  * @throws     PropelException
  */
 public function getsfGuardUser(PropelPDO $con = null)
 {
     if ($this->asfGuardUser === null && $this->user_id !== null) {
         $c = new Criteria(sfGuardUserPeer::DATABASE_NAME);
         $c->add(sfGuardUserPeer::ID, $this->user_id);
         $this->asfGuardUser = sfGuardUserPeer::doSelectOne($c, $con);
         /* The following can be used additionally to
         		   guarantee the related object contains a reference
         		   to this object.  This level of coupling may, however, be
         		   undesirable since it could result in an only partially populated collection
         		   in the referenced object.
         		   $this->asfGuardUser->addsfGuardRememberKeys($this);
         		 */
     }
     return $this->asfGuardUser;
 }
开发者ID:BasMatthee,项目名称:symfony-profile,代码行数:23,代码来源:BasesfGuardRememberKey.php

示例3: Criteria

?>
</td>
    </tr>
    <tr>
      <th>Adres:</th>
      <td><?php 
echo $Klient->getAdres();
?>
</td>
    </tr>
    <tr>
      <th>Pracownik:</th>
      <td><?php 
$c = new Criteria();
$c->add(sfGuardUserPeer::ID, $Klient->getPracownik());
$prac = sfGuardUserPeer::doSelectOne($c);
echo $prac;
?>
</td>
    </tr>
    <tr>
      <th>Email:</th>
      <td><?php 
echo $Klient->getEmail();
?>
</td>
    </tr>
    
    
    <tr>
      <th>Telefon:</th>
开发者ID:soltis,项目名称:Mieszalnia,代码行数:31,代码来源:showSuccess.php

示例4: checkLDAPPassword

 /**
  * Authenticates users against an LDAP directory.
  * Called by a sfGuard hook.
  *
  * @param unknown_type $username
  * @param unknown_type $password
  * @return unknown
  */
 public static function checkLDAPPassword($username, $password, $sfGuard)
 {
     // try and validate the user
     // if the password is null length then reject
     if (strlen(trim($password)) == 0) {
         self::removeUser($username);
         return false;
     }
     $res = $sfGuard->checkPasswordByGuard($password);
     if ($res) {
         return true;
     }
     if (!function_exists("ldap_connect")) {
         return true;
     }
     // lets try the ldap
     $res = ldap_connect(sfConfig::get("app_ldap_server"), 636);
     $anon = ldap_bind($res);
     // I'm not sure how this is going to behave if the LDAP is actually MIA
     if (!$res || !$anon) {
         // throw new sfException("Could not connect to the LDAP server!", 0);
         return $sfGuard->checkPasswordByGuard($password);
     }
     $result = ldap_search($res, "dc=tufts,dc=edu", "uid=" . $username);
     $info = ldap_get_entries($res, $result);
     // we matched more than one or 0?
     if (!$info || $info["count"] !== 1) {
         self::removeUser($username);
         return $sfGuard->checkPasswordByGuard($password);
     }
     $email = "";
     $phone = "";
     $lastName = "";
     $firstName = "";
     if (array_key_exists("mail", $info[0]) && $info[0]["mail"]["count"]) {
         $email = $info[0]["mail"][0];
     }
     if (array_key_exists("telephonenumber", $info[0]) && $info[0]["telephonenumber"]["count"]) {
         $phone = $info[0]["telephonenumber"][0];
     }
     if (array_key_exists("tuftsedulegalname", $info[0]) && $info[0]["tuftsedulegalname"]["count"]) {
         list($lastName, $firstName) = explode(",", $info[0]["tuftsedulegalname"][0]);
     }
     $result = @ldap_bind($res, $info[0]["dn"], $password);
     if ($res) {
         ldap_unbind($res);
     }
     if ($result) {
         $c = new Criteria();
         $c->add(sfGuardUserPeer::USERNAME, $username);
         $sfUser = sfGuardUserPeer::doSelectOne($c);
         $sfprofile = $sfGuard->getProfile();
         $sfprofile->setUserId($sfUser->getId());
         $sfprofile->setEmail($email);
         $sfprofile->setFirstName($firstName);
         $sfprofile->setLastName($lastName);
         if ($sfprofile->getUserTypeId() == NULL) {
             $sfprofile->setUserTypeId(sfConfig::get("app_user_type_user"));
         }
         $sfprofile->save();
         return true;
     } else {
         self::removeUser($username);
         return $sfGuard->checkPasswordByGuard($password);
     }
 }
开发者ID:adatta02,项目名称:comp190-code,代码行数:74,代码来源:LDAPAuth.class.php

示例5: askPassword

 /**
  * Ask user a new password and change it
  * @param sfRequest $request
  */
 protected function askPassword(sfWebRequest $request)
 {
     if (!is_null($key = $request->getParameter('key'))) {
         $c = new Criteria();
         $c->add(sfGuardUserPeer::ID, $request->getParameter('id'));
         $c->add(sfGuardUserPeer::PASSWORD, $key);
         $user = sfGuardUserPeer::doSelectOne($c);
         $this->forward404Unless($user, 'user not found');
         $this->getUser()->setAttribute('userid', $user->getId());
     }
     $this->form = new sfGuardFormResetPassword(null, array('userid' => $this->getUser()->getAttribute('userid')));
     if ($request->isMethod(sfRequest::POST) && $this->form->bindAndSave($request->getParameter($this->form->getName()))) {
         $this->redirect('@sf_guard_signin');
     }
     $this->setTemplate('ask_password');
 }
开发者ID:lendji4000,项目名称:compose,代码行数:20,代码来源:BasesfGuardForgotPasswordActions.class.php

示例6: getSfGuardUserByEmailHashes

 /**
  * tries to get a sfGuardUser using the facebook email hash
  *
  * @param string[] $email_hashes
  * @param boolean $isActive
  * @return sfGuardUser
  * @author fabriceb
  * @since 2009-05-17
  */
 public function getSfGuardUserByEmailHashes($email_hashes, $isActive = true)
 {
     if (!is_array($email_hashes) || count($email_hashes) == 0) {
         return null;
     }
     $c = new Criteria();
     $c->addJoin(sfGuardUserPeer::ID, $this->getSfGuardUserforeignKeyColumn());
     $c->add($this->getEmailHashColumn(), $email_hashes, Criteria::IN);
     $c->add(sfGuardUserPeer::IS_ACTIVE, $isActive);
     // NOTE: if a user has multiple emails on their facebook account,
     // and more than one is registered on the site, then we will
     // only return the first one.
     $sfGuardUser = sfGuardUserPeer::doSelectOne($c);
     return $sfGuardUser;
 }
开发者ID:ner0tic,项目名称:scss,代码行数:24,代码来源:sfFacebookPropelGuardAdapter.class.php

示例7: executeConfirm

 public function executeConfirm()
 {
     $validate = $this->getRequestParameter('validate');
     $c = new Criteria();
     // 0.6.3: oops, this was in sfGuardUserProfilePeer in my application
     // and therefore never got shipped with the plugin until I built
     // a second site and spotted it!
     $c->add(sfGuardUserProfilePeer::VALIDATE, $validate);
     $c->addJoin(sfGuardUserPeer::ID, sfGuardUserProfilePeer::USER_ID);
     $sfGuardUser = sfGuardUserPeer::doSelectOne($c);
     if (!$sfGuardUser) {
         return 'Invalid';
     }
     $type = self::getValidationType($validate);
     if (!strlen($validate)) {
         return 'Invalid';
     }
     $profile = $sfGuardUser->getProfile();
     $profile->setValidate(null);
     $profile->save();
     if ($type == 'New') {
         $sfGuardUser->setIsActive(true);
         $sfGuardUser->save();
         $this->getUser()->signIn($sfGuardUser);
     }
     if ($type == 'Reset') {
         $this->getUser()->setAttribute('Reset', $sfGuardUser->getId(), 'sfApplyPlugin');
         return $this->redirect('sfApply/reset');
     }
 }
开发者ID:EQ4,项目名称:smint,代码行数:30,代码来源:BasesfApplyActions.class.php

示例8: soapAuth

 function soapAuth($username, $password)
 {
     try {
         $c = new Criteria();
         $c->add(sfGuardUserPeer::USERNAME, $username);
         $check = sfGuardUserPeer::doSelectOne($c);
         if ($check) {
             $check_pass = $check->getPassword();
             $check_alg = $check->getAlgorithm();
             if ($check_pass == call_user_func_array($check_alg, array($check->getSalt() . $password))) {
                 $user = $this->context->getUser();
                 $user->addCredentials($check->getAllPermissionNames());
                 $user->setAuthenticated(true);
                 $this->context->set('user', $check);
             } else {
                 throw new Exception('Soap Authentication failed');
             }
         } else {
             throw new Exception('Soap Authentication failed');
         }
     } catch (Exception $e) {
         //throw new Expection($e->getMessage());
         trigger_error($e->getMessage());
         //throw new SOAP_Fault('12345');
     }
 }
开发者ID:ketheriel,项目名称:ETVA,代码行数:26,代码来源:soapCliController.class.php

示例9: executeRegister_confirm

 /**
  * executeRegister_confirm
  *
  * @access public
  * @return void
  */
 public function executeRegister_confirm(sfWebRequest $request)
 {
     $c = new Criteria();
     $c->add(sfGuardUserPeer::PASSWORD, $request->getParameter('key'));
     $c->add(sfGuardUserPeer::ID, $request->getParameter('id'));
     $sfGuardUser = sfGuardUserPeer::doSelectOne($c);
     $this->forward404Unless($sfGuardUser, 'user not found');
     $sfGuardUser->setIsActive(true);
     $sfGuardUser->save();
     $messageParams = array('sfGuardUser' => $sfGuardUser);
     $body = $this->getComponent($this->getModuleName(), 'send_complete', $messageParams);
     $from = sfConfig::get('app_sf_guard_extra_plugin_mail_from', 'noreply@example.org');
     $fromName = sfConfig::get('app_sf_guard_extra_plugin_name_from', 'noreply');
     $to = $sfGuardUser->getEmail();
     $toName = $sfGuardUser->getUsername();
     $subject = sfConfig::get('app_sf_guard_extra_plugin_subject_complete', 'Request complete');
     $mailer = $this->getMailer();
     $message = $mailer->compose(array($from => $fromName), array($to => $toName), $subject, $body);
     $mailer->send($message);
     $this->getUser()->signin($sfGuardUser);
     $this->redirect('@sf_guard_register_complete?id=' . $sfGuardUser->getId());
 }
开发者ID:lendji4000,项目名称:compose,代码行数:28,代码来源:BasesfGuardRegisterActions.class.php

示例10: retrieveByUsername

 public static function retrieveByUsername($username)
 {
     $c = new Criteria();
     $c->add(sfGuardUserPeer::USERNAME, $username);
     return sfGuardUserPeer::doSelectOne($c);
 }
开发者ID:hoydaa,项目名称:googlevolume.com,代码行数:6,代码来源:myUser.class.php

示例11: updateMessageStatusOnComment

 /**
  * update message satus on comment sender basis
  * @param String $comment_sender
  * @param Integer $message_id
  */
 private function updateMessageStatusOnComment($comment_sender, $message_id)
 {
     $c = new Criteria();
     $c->add(MessagesPeer::ID, $message_id);
     $c->addJoin(MessagesPeer::SENDER, sfGuardUserPeer::USERNAME);
     $user = sfGuardUserPeer::doSelectOne($c);
     $sender_id = $user->getId();
     // if Message owner
     if ($user->getUsername() == $comment_sender) {
         $c = new Criteria();
         $c->add(MessageReceiversPeer::MESSAGE_ID, $message_id);
         $c->add(MessageReceiversPeer::USER_ID, $sender_id, Criteria::NOT_EQUAL);
         $receivers = MessageReceiversPeer::doSelect($c);
         foreach ($receivers as $receiver) {
             $receiver->setSeen(false);
             $receiver->save();
         }
     } else {
         $c = new Criteria();
         $c->add(MessageReceiversPeer::MESSAGE_ID, $message_id);
         $c->add(MessageReceiversPeer::USER_ID, $sender_id);
         if (!($receiver = MessageReceiversPeer::doSelectOne($c))) {
             $receiver = new MessageReceivers();
             $receiver->setMessageId($message_id);
             $receiver->setUserId($sender_id);
         }
         $receiver->setSeen(false);
         $receiver->save();
     }
 }
开发者ID:uniraymond,项目名称:ravebuild_symfony,代码行数:35,代码来源:actions.class.php

示例12: executeRemove

 public function executeRemove(sfWebRequest $request)
 {
     $codigo = $request->getParameter("codigo");
     $this->redirectUnless($this->getUser()->isAuthenticated(), "@sf_guard_signin");
     if ($codigo == '') {
         $this->getUser()->getProfile()->setCodigo(util::generateUID());
         $this->getUser()->getProfile()->save();
         $mailBody = $this->getPartial('removeMailBody', array('nombre' => $this->getUser()->getProfile()->getNombre(), 'codigo' => $this->getUser()->getProfile()->getCodigo()));
         $this->email = $this->getUser()->getUsername();
         VoMail::send(sfContext::getInstance()->getI18N()->__('Borrarse de Voota'), $mailBody, $this->getUser()->getUsername(), array('no-reply@voota.es' => 'no-reply Voota'), false);
     } else {
         $c = new Criteria();
         $c->addJoin(SfGuardUserProfilePeer::USER_ID, sfGuardUserPeer::ID);
         $c->add(SfGuardUserProfilePeer::CODIGO, $codigo);
         $user = sfGuardUserPeer::doSelectOne($c);
         $this->forward404Unless($user);
         SfReviewManager::deleteReviewById($user->getId());
         $user->delete();
         if ($this->getUser()->isAuthenticated()) {
             $this->getUser()->signOut();
         }
         return 'Confirm';
     }
 }
开发者ID:voota,项目名称:voota,代码行数:24,代码来源:actions.class.php


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