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


PHP Banner::instance方法代码示例

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


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

示例1: log_log_in_attempt

 /**
  * Logs an attempt to log in in the database so things like the numner of
  * log in attempts can be recorded.
  * 
  * @param int $status One of $ATTEMPT_GOOD, $ATTEMPT_NO_SUCH_USER or $ATTEMPT_BAD_CRIDENTIALS from Model_Log_In_Attempt
  * @param string $email The email that's trying to log in.
  */
 public function log_log_in_attempt($status, $email)
 {
     if (!$this->logging_enabled()) {
         return;
     }
     $logEntry = new Model_Log_In_Attempt();
     $logEntry->email = is_null($email) ? '' : $email;
     $logEntry->status = $status;
     $logEntry->save();
     //If the entry failed then add a ban too
     if ($status != Model_Log_In_Attempt::$ATTEMPT_GOOD) {
         Banner::instance()->auto_ban($email);
     }
 }
开发者ID:inespons,项目名称:ethanol,代码行数:21,代码来源:Logger.php

示例2: ban

 /**
  * Bans an email address and/or an ip for the given time
  * 
  * @param string|int $time Number of seconds to ban for or something like "+1 Day"
  * @param null|string|true $ip Null to ignore IP, string to specify the ip, true to automatically load the ip
  * @param null|string $email
  */
 public function ban($time, $ip = null, $email = null)
 {
     Banner::instance()->ban($time, $ip, $email);
 }
开发者ID:inespons,项目名称:ethanol,代码行数:11,代码来源:Ethanol.php

示例3: perform_login

 /**
  * Attemps an oAuth login. Will create a new user if one does not already
  * exist with the given email. If a user is logged in the 3rd party account
  * is linked with the logged in user.
  * 
  * @param string $email The email passed back from the 3rd party
  * @param string $driver Name of the driver the email is from
  * @return Ethanol\Model_User
  */
 protected function perform_login($email, $driver)
 {
     //This is the first point that we have an email do make a check for
     //banned users
     if (Banner::instance()->is_banned($email)) {
         throw new LogInFailed(\Lang::get('ethanol.errors.exceededLoginTries'));
     }
     //Check if a user exists yet.
     $oauth = Model_User_Oauth::find('first', array('related' => array('user'), 'where' => array(array('driver', $driver), array('email', $email))));
     //if not create
     if (is_null($oauth)) {
         //Check if we have a guest user or not.
         if (Ethanol::instance()->is_guest()) {
             $user = new Model_User();
             $user->activated = Model_User::$USER_ACTIVATED;
             $user->email = $email;
         } else {
             //Not a guest user so get the current user.
             $user = Ethanol::instance()->current_user();
         }
         //And assocate the new oauth with it.
         $oauth = new Model_User_Oauth();
         $oauth->driver = $driver;
         $oauth->email = $email;
         $user->oauth[] = $oauth;
         $user->save();
     } else {
         $user = $oauth->user;
     }
     return $user;
 }
开发者ID:inespons,项目名称:ethanol,代码行数:40,代码来源:Driver.php


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