function __construct($stdclass, $id)
 {
     foreach ($stdclass as $key => $value) {
         $this->{$key} = $value;
     }
     parent::__construct($id);
 }
 public function __construct($id = FALSE)
 {
     //parent::__construct($id);
     parent::__construct();
     // Set the now, we use this a lot
     $this->now = date('Y-m-d H:i:s');
     if ($id != NULL and is_string($id)) {
         // try and get a row with this token
         $this->load($id, 'token');
         if ($this->check_id()) {
             //if token expired, delete all expired and clear loaded data
             if ($this->data['expires'] < $this->now) {
                 $this->delete_expired();
                 $this->data = $this->explain();
             }
         }
     }
 }
Beispiel #3
0
 public function __construct($id = NULL)
 {
     parent::__construct();
     //if user id
     if ($id != NULL and (ctype_digit($id) or is_int($id))) {
         // try and get a row with this ID
         $this->load($id);
     } else {
         if ($id != NULL and is_string($id)) {
             // try and get a row with this username/email
             $this->load($id, Kohana::config('simple_auth.unique'));
         } else {
             if ($id != NULL and is_array($id)) {
                 $data = array(Kohana::config('simple_auth.unique') => $id['username'], Kohana::config('simple_auth.password') => Simple_Auth::instance()->hash($id['password']));
                 $this->load($data);
             }
         }
     }
 }