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


PHP Users::getUsername方法代码示例

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


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

示例1: login

 public function login($post)
 {
     $errors = array();
     $user = new Users();
     $user->exchangeArray($post);
     $username = trim($user->getUsername());
     $user->setUsername($username);
     $password = trim($user->getPassword());
     $user->setPassword($password);
     $_SESSION['id'] = $this->getLogged_user_id($username);
     $_SESSION['username'] = $username;
     $_SESSION['password'] = $password;
     if (empty($username)) {
         $errors['username'] = "Моля, въведете потребителско име!";
     }
     if (empty($password)) {
         $errors['password'] = "Моля, въведете парола!";
     }
     if ($this->select($user) == false && !isset($errors['username'])) {
         $errors['username'] = "Въведените потребителско име и/или парола са невалидни!";
     } elseif ($this->select($user) == true) {
         $_SESSION['isLogged'] = true;
     }
     if (count($errors) > 0) {
         return $errors;
     } else {
         return $errors = array();
     }
 }
开发者ID:monikams,项目名称:financial_barometer,代码行数:29,代码来源:userDB.php

示例2: modify

 public function modify(Users $user)
 {
     $q = $this->dao->prepare('UPDATE ' . $this->table() . ' SET USERNAME = :username, PASSWORD = :password, MAILINGSTATE = :mailingstate, MAIL = :mail, ROLE_ID = :role_id, IS_ACTIVE = :is_active, IS_MAIL_VERIFIED = :is_mail_verified, ACTIVATION_KEY = :activation_key WHERE ID = :id');
     $q->bindValue(':username', $user->getUsername());
     $q->bindValue(':password', $user->getPassword());
     $q->bindValue(':mail', $user->getMail());
     $q->bindValue(':is_active', $user->getIsActive());
     $q->bindValue(':role_id', $user->getRoleId(), PDO::PARAM_INT);
     $q->bindValue(':is_mail_verified', $user->getIsMailVerified());
     $q->bindValue(':activation_key', $user->getActivationKey());
     $q->bindvalue(':mailingstate', $user->getMailingState());
     $q->bindValue(':id', $user->id(), PDO::PARAM_INT);
     $q->execute();
 }
开发者ID:Tipkin-Commons,项目名称:tipkin,代码行数:14,代码来源:UsersManager_PDO.class.php

示例3: login

 /**
  * Logs in a user an returns the auth_token
  * 
  * @param Users $user
  * @return string auth_token
  */
 public static function login(Users $user)
 {
     UserController::$sendEmailOnVerify = false;
     // Deactivate cookie setting
     $oldCookieSetting = SessionController::$setCookieOnRegisterSession;
     SessionController::$setCookieOnRegisterSession = false;
     // Inflate request with user data
     $r = new Request(array("usernameOrEmail" => $user->getUsername(), "password" => $user->getPassword()));
     // Call the API
     $response = UserController::apiLogin($r);
     // Sanity check
     self::assertEquals("ok", $response["status"]);
     // Clean up leftovers of Login API
     unset($_REQUEST);
     // Set cookie setting as it was before the login
     SessionController::$setCookieOnRegisterSession = $oldCookieSetting;
     return $response["auth_token"];
 }
开发者ID:kukogit,项目名称:omegaup,代码行数:24,代码来源:OmegaupTestCase.php

示例4: getProfileImpl

 /**
  * Returns the profile of the user given
  *
  * @param Users $user
  * @return array
  * @throws InvalidDatabaseOperationException
  */
 private static function getProfileImpl(Users $user)
 {
     $response = array();
     $response['userinfo'] = array();
     $response['problems'] = array();
     $response['userinfo']['username'] = $user->getUsername();
     $response['userinfo']['name'] = $user->getName();
     $response['userinfo']['solved'] = $user->getSolved();
     $response['userinfo']['submissions'] = $user->getSubmissions();
     $response['userinfo']['birth_date'] = is_null($user->getBirthDate()) ? null : strtotime($user->getBirthDate());
     $response['userinfo']['graduation_date'] = is_null($user->getGraduationDate()) ? null : strtotime($user->getGraduationDate());
     $response['userinfo']['scholar_degree'] = $user->getScholarDegree();
     if (!is_null($user->getLanguageId())) {
         $query = LanguagesDAO::getByPK($user->getLanguageId());
         if (!is_null($query)) {
             $response['userinfo']['locale'] = UserController::convertToSupportedLanguage($query->getName());
         }
     }
     try {
         $response['userinfo']['email'] = EmailsDAO::getByPK($user->getMainEmailId())->getEmail();
         $country = CountriesDAO::getByPK($user->getCountryId());
         $response['userinfo']['country'] = is_null($country) ? null : $country->getName();
         $response['userinfo']['country_id'] = $user->getCountryId();
         $state = StatesDAO::getByPK($user->getStateId());
         $response['userinfo']['state'] = is_null($state) ? null : $state->getName();
         $response['userinfo']['state_id'] = $user->getStateId();
         $school = SchoolsDAO::getByPK($user->getSchoolId());
         $response['userinfo']['school_id'] = $user->getSchoolId();
         $response['userinfo']['school'] = is_null($school) ? null : $school->getName();
     } catch (Exception $e) {
         throw new InvalidDatabaseOperationException($e);
     }
     $response['userinfo']['gravatar_92'] = 'https://secure.gravatar.com/avatar/' . md5($response['userinfo']['email']) . '?s=92';
     return $response;
 }
开发者ID:RicardoMelgoza,项目名称:omegaup,代码行数:42,代码来源:UserController.php

示例5: verifyUser

 /**
  * Verifies a user and returns its DAO
  *
  * @param Users $user
  * @return type
  */
 public static function verifyUser(Users $user)
 {
     UserController::apiVerifyEmail(new Request(array('id' => $user->getVerificationId())));
     // Get user from db again to pick up verification changes
     return UsersDAO::FindByUsername($user->getUsername());
 }
开发者ID:andreasantillana,项目名称:omegaup,代码行数:12,代码来源:UserFactory.php

示例6: getUsername

 public function getUsername()
 {
     $this->__load();
     return parent::getUsername();
 }
开发者ID:uxcriativo,项目名称:FULLigniter,代码行数:5,代码来源:__CG__Users.php

示例7: getParams

 private function getParams(Users $Users)
 {
     $params = array(':id' => $Users->getId(), ':username' => $Users->getUsername(), ':email' => $Users->getEmail(), ':password' => $Users->getPassword());
     if ($Users->getId()) {
         // unset created date, this one is never updated
         unset($params[':created_on']);
     }
     return $params;
 }
开发者ID:callumforsdick,项目名称:MVC,代码行数:9,代码来源:FocDao.php

示例8: _save

 protected function _save(\Users $user, &$error)
 {
     $isNew = $user->isNew();
     if ($isNew) {
         //check username was taken
         if (!\Users::checkAvailableUsername($user->getUsername())) {
             $error['users.username'] = t('Username was taken');
         }
         if (!\Users::checkAvailableEmail($user->getEmail())) {
             $error['users.email'] = t('Email was taken');
         }
     }
     if (empty($error)) {
         if ($user->save()) {
             //dispatching event
             if ($isNew) {
                 $this->dispatch('afterCreatingUser', new CMSBackendEvent($this, ['user' => $user]));
             } else {
                 $this->dispatch('afterSavingUser', new CMSBackendEvent($this, ['user' => $user]));
             }
             return true;
         } else {
             if (!$user->isValid()) {
                 /** @var \Flywheel\Model\ValidationFailed[] $validationFailures  */
                 $validationFailures = $user->getValidationFailures();
                 foreach ($validationFailures as $validationFailure) {
                     if (!isset($error[$validationFailure->getColumn()])) {
                         $error[$validationFailure->getColumn()] = '';
                     }
                     $error[$validationFailure->getColumn()] .= $validationFailure->getMessage();
                 }
             }
         }
     }
     return false;
 }
开发者ID:hosivan90,项目名称:toxotes,代码行数:36,代码来源:User.php

示例9: executeNewUser

 public function executeNewUser()
 {
     $this->hide = false;
     //check to see if exists
     $c = new Criteria();
     $c->add(UsersPeer::USERNAME, $this->getRequestParameter('username'));
     $userExist = UsersPeer::doSelectOne($c);
     if ($userExist) {
         $this->errors = 'Username already exists, please select another username.';
     } else {
         //check passwords
         $pass = $this->getRequestParameter('password');
         $vpass = $this->getRequestParameter('vpassword');
         if ($pass == $vpass) {
             $user = new Users();
             $user->setFname($this->getRequestParameter('fname'));
             $user->setLname($this->getRequestParameter('lname'));
             $user->setEmail($this->getRequestParameter('email'));
             $user->setUsername($this->getRequestParameter('username'));
             $user->saltPassword($this->getRequestParameter('password'));
             //send email for account activation
             $confCode = sha1($user->getSalt() . $user->getUsername());
             $user->save();
             $this->sendMail($user->getUsername(), $confCode, $user->getUserId(), $user->getEmail());
             $this->errors = '';
             $this->hide = true;
         } else {
             $this->errors = 'Passwords do not match, please re-enter';
         }
     }
 }
开发者ID:broschb,项目名称:cyclebrain,代码行数:31,代码来源:actions.class.php

示例10: sendInvitation

    public function sendInvitation(Invite $invitation, Users $user, Profile $profile)
    {
        $this->from = $user->getMail();
        $this->subject = "Vous êtes invité sur TIPKIN";
        $this->content = '
<p>Bonjour, <br/><br/>
								' . $profile->getFirstname() . " " . $profile->getLastname() . " vous invite à rejoindre sa communauté sur Tipkin :\n\t\t\t\t\t\t\t\t<br/><br/>\n\t\t\t\t\t\t\t\t<q>Si tu ne connais pas encore Tipkin, connecte-toi, et rejoints ma Tipkin-ship !<br/>\nEnsemble nous pourrons partager tous nos objets.\t\t\t\t\t\t\t\t<br />\n  N'hésites plus et viens consulter mes annonces sur mon profil <a href='" . $this->serverName . "users/member/" . $profile->getUserId() . "'>" . $user->getUsername() . "</a><br/>\n  " . $invitation->commentaire . "</q><br/><br/>\n\t\t\t\t\t\t\t\tRejoignez le mouvement de la consommation collaborative!<br />\n\t\t\t\t\t\t\t\t<br />\n\t\t\t\t\t\t\t\tA tout de suite sur <a href=" . $this->serverName . ">TIPKIN</a> ! <br /><br/>Je possède. Tu empruntes. Nous partageons !\n\t\t\t\t\t\t\t\t<br />\n\t\t\t\t\t\t\t\tL'équipe TIPKIN.</p>\n\t\t\t\t\t\t\t\t";
        $email_error = FALSE;
        $invitation->explodeEmailsListe();
        $this->replaceContentKeywords();
        $mail = new PHPmailer();
        //        $mail->IsSMTP();
        $mail->IsSendMail();
        //$mail->SMTPDebug=true;    //permet de voir les erreurs si ça ne fonctionne pas
        $mail->Host = ini_get('SMTP');
        // Connexion au serveur SMTP
        $mail->Port = 25;
        //$mail->SMTPAuth = true; // Cette partie est optionnelle si le serveur SMTP n'a pas besoin d'authentification
        //$mail->Username = 'postmaster[at]monsite.e4y.fr'; // mettre l'adresse email que founit l'hébergeur
        //$mail->Password = 'monMotDePasse'; // le mot de passe pour se connecter à votre boite mail sur l'hébergeur
        $mail->IsHTML(true);
        // Permet d'écrire un mail en HTML (=> conversion des balises
        $mail->CharSet = 'UTF-8';
        // évite d'avoir des caractères chinois :)
        $mail->From = 'no-reply@tipkin.fr';
        // adresse mail du compte qui envoi
        $mail->AddReplyTo($this->from);
        $mail->FromName = "L'équipe TIPKIN";
        // remplace le nom du destinateur lors de la lecture d'un email
        $mail->Subject = $this->subject;
        // l'entête = nom du sujet
        $mail->Body = $this->content;
        // le corps = le message en lui-même, codé en HTML si vous voulez
        //$adresses = explode(",", $this->to);
        $invitation->email_error = FALSE;
        $invitation->email_sent = FALSE;
        foreach ($invitation->getEmailsliste() as $email) {
            $mail->AddAddress($email);
            // adresse du destinataire, plusieurs adresses possibles en même temps !
            $Syntaxe = '#^[\\w.-.+]+@[\\w.-]+\\.[a-zA-Z]{2,6}$#';
            if (preg_match($Syntaxe, $email)) {
                $checkemail = true;
            } else {
                $checkemail = false;
            }
            /*$checkemail=FALSE;
            		if(filter_var($email, FILTER_VALIDATE_EMAIL)){
               			$checkemail=TRUE;
            		}
            		*/
            if (!$mail->Send() || !$checkemail) {
                $_REQUEST['error'] = $mail->ErrorInfo;
                // affiche une erreur => pas toujours explicite
                $error_flag = TRUE;
                $invitation->email_error[] = $email;
            } else {
                $invitation->email_sent[] = $email;
            }
            $mail->ClearAddresses();
        }
        $mail->SmtpClose();
        unset($mail);
        // ferme la connexion smtp et désalloue la mémoire...
        return $email_error;
    }
开发者ID:Tipkin-Commons,项目名称:tipkin,代码行数:65,代码来源:Mail.class.php

示例11: equals

 public function equals(Users $user)
 {
     return $user->getUsername() == $this->getUsername();
 }
开发者ID:powermonkey,项目名称:rewards,代码行数:4,代码来源:User.php


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