'uid', 'displayname' => 'name', 'email' => 'mail', ); /** * The cookie name to use for Drupal. Leaving this NULL will get it from session_name() */ var $cookieName = null; // ################################################################### function _setupDatabase() { parent::_setupDatabase(); // check and see if we need to call session_name() require_once 'includes/auth/config.php'; $this->cookieName = $config['auth']['Drupal']['cookieName']; $this->cookieName = ($this->cookieName == null ? session_name() : $this->cookieName); } // ################################################################### function _fetchCookieUniqueId() { return $this->registry->in[ $this->cookieName ]; } // ################################################################### function _fetchCookiePassword() { return true; } // ################################################################### function _fetchUserUsingCookies() { $session = $this->authDb->query_first("SELECT * FROM sessions WHERE sid = '" . $this->authDb->escape_string($this->_fetchCookieUniqueId()) . "'"); if (!$session OR $session['uid'] == 0) { return false; } return $this->authDb->query_first("SELECT * FROM users WHERE uid = " . $session['uid']); } // ################################################################### function _verifyCookieData() { return ($this->_fetchUserUsingCookies() != false); } // ################################################################### function _fetchUserWithIdentifier($string) { return $this->authDb->query_first("SELECT * FROM users WHERE name = '" . $this->authDb->escape_string($string) . "'"); } // ################################################################### function _verifyLoginUser($password) { return (md5($password) == $this->authUser['pass']); } // ################################################################### function clearCookies() { $this->registry->funct->cookie($this->cookieName); $this->authDb->query("DELETE FROM sessions WHERE sid = '" . $this->authDb->escape_string($this->_fetchCookieUniqueId()) . "'"); } // ################################################################### function _setCookies($permanent = false) { $sid = $this->_fetchCookieUniqueId(); $sid = ($sid ? $sid : md5(microtime() . rand())); $this->registry->funct->cookie($this->cookieName, $sid, $permanent); $this->authDb->query("REPLACE INTO sessions (sid, uid, hostname, timestamp) VALUES ('$sid', '" . $this->authUser['uid'] . "', '" . $this->authDb->escape_string($_SERVER['REMOTE_ADDR']) . "', " . time() . ")"); } } /*=====================================================================*\ || ################################################################### || # $HeadURL$ || # $Id$ || ################################################################### \*=====================================================================*/ ?>