/**
* the global DB object
+ *
* @var object
*/
private $_DB;
/**
* if the user is logged in or not
+ *
* @var boolean
*/
protected $isSignedIn = false;
/**
* the data from the current user
+ *
* @var array
*/
protected $userData = false;
/**
* the user ID from user management or default
+ *
* @var Int
*/
protected $userID = 0;
)
);
+ /**
+ * Doomguy constructor.
+ *
+ * @param object $db The database object
+ */
public function __construct($db) {
$this->_DB = $db;
/**
* get the value of the specified param from the user data array
+ *
* @param string $param
* @return bool|mixed
*/
/**
* return the isSignedIn status.
+ *
* @return boolean
*/
public function isSignedIn() {
/**
* get the data from the userSession table
+ *
* @param string $param
* @return bool
*/
/**
* Log out the current loaded user
+ *
* @return boolean
*/
public function logOut () {
/**
* check if the loaded user is in this group
* if the user is in ADMIN_GROUP_ID, the he is automatically "in" every group
+ *
* @param int $groupID
* @return bool
*/
}
/**
- * authenticate the user. Create session and db entries
+ * Authenticate the user. Create session and db entries
+ *
* @param string $username
* @param string $password
* @return boolean
/**
* Use the user identified by apitoken
+ *
* @param $token string
*/
public function authByApiToken($token) {
/**
* check if the given username is set in user table
* if so load the user data
+ *
* @param string $u
* @return boolean
*/
# clean old sessions on session table
$timeframe = date("Y-m-d H:i:s",time()-SESSION_LIFETIME);
- $query = $this->_DB->query("DELETE FROM `".DB_PREFIX."_userSession`
+ $this->_DB->query("DELETE FROM `".DB_PREFIX."_userSession`
WHERE `loginTime` <= '".$timeframe."'");
}
/**
* destroy and remove the current session from SESSION and session table
+ *
* @return boolean
*/
protected function _destroySession() {
$timeframe = date("Y-m-d H:i:s",time()-SESSION_LIFETIME);
- $query = $this->_DB->query("DELETE FROM `".DB_PREFIX."_userSession`
+ $this->_DB->query("DELETE FROM `".DB_PREFIX."_userSession`
WHERE `fk_user_id` = '".$this->_DB->real_escape_string($this->userID)."'
OR `loginTime` <= '".$timeframe."'");