/** * Create auth lib * @param users_collection users handle * @param bool disable auth */ function __construct($disable_auth = false) { $core = core::selfie(); $this->mod_users = core::module('users'); $this->_cookie_domain = '.' . @$_SERVER['HTTP_HOST']; $this->_cookie_httponly = $core->cfg('auth.cookie_httponly', false); $this->_autologin_UID = $this->mod_users->cfg('autologin_UID', 0); $this->_disable_auth = $disable_auth; if ($this->is_crawler()) { $this->_disable_auth = true; } if ($this->_disable_auth) { core::dprint('[AUTH] Sessions disabled'); } $this->users = $this->mod_users->get_users_handle(); $this->sessions = $this->mod_users->get_sessions_handle()->with_user_agent($core->cfg('auth.with_browser', true)); if ($this->_disable_auth) { $this->set_null_session(); return; } if ($this->_autologin_UID) { $this->set_uid_session($this->_autologin_UID); return; } }
/** * 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(); }