コード例 #1
0
ファイル: authuser.php プロジェクト: enormego/EightPHP
 public function __construct($data = null)
 {
     if (is_string($data) && !ctype_digit($data)) {
         $this->primary_key = 'user_email';
     } else {
         $this->primary_key = 'user_id';
     }
     return parent::__construct($data);
 }
コード例 #2
0
ファイル: authusertoken.php プロジェクト: enormego/EightPHP
 public function __construct($id = NULL, $create_token = TRUE)
 {
     parent::__construct($id);
     // Current time
     $this->now = time();
     // Don't run this stuff if we're only looking for an empty shell
     if ($create_token === TRUE && is_null($id)) {
         $this->token = $this->create_token();
     }
     // Should we handle the expired ones?
     if (mt_rand(1, 100) === 1) {
         // Do garbage collection
         $this->delete_expired();
     }
     // Did the token expire?
     if (!str::e($this->id) && $this->expires < $this->now) {
         // This object has expired
         $this->delete();
     }
 }
コード例 #3
0
 public function __construct($id = null, $dont_create_token = FALSE)
 {
     parent::__construct($id);
     // Current time
     $this->now = time();
     // Don't run this stuff if we're only looking for an empty shell
     if ($dont_create_token === FALSE) {
         // Should we handle the expired ones?
         if (mt_rand(1, 100) === 1) {
             // Do garbage collection
             $this->delete_expired();
         }
         // Did the token expire?
         if ($this->expires < $this->now) {
             // This object has expired
             $this->delete();
         }
         // No ID? Create a new token.
         if (is_null($id)) {
             $this->token = $this->create_token();
         }
     }
 }