Exemple #1
0
 /**
  * Create auth lib
  * @param users_collection users handle
  * @param bool disable auth
  */
 function __construct(tf_users $musers, $null_auth = false)
 {
     $this->_cookie_domain = '.' . core::get_instance()->get_main_domain();
     $this->mod_users = $musers;
     $this->users = $musers->get_users_handle();
     $this->sessions = $musers->get_sessions_handle();
     $this->_null_auth = $null_auth;
     $this->onload();
 }
Exemple #2
0
 /**
  * Sets logged user (by id)
  * @param integer UID
  * @throws auth_exception
  */
 public function set_user($uid)
 {
     if (!empty($uid)) {
         $this->user = $this->mod_users->get_user((int) $uid);
         if ($this->user) {
             $this->_logged_in = true;
         } else {
             throw new auth_exception('No User for UID ' . $uid);
         }
     } else {
         $this->user = core::module('users')->get_anonymous_user();
         $this->_logged_in = false;
     }
     return $this;
 }