mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-03-12 08:55:54 +00:00
- added methods setLanguage() and getLanguage(), better internal data handling
This commit is contained in:
parent
0b64db098f
commit
d30cdb6799
|
@ -77,6 +77,7 @@ class LetoDMS_Session {
|
||||||
if (!$this->db->getResult($queryStr))
|
if (!$this->db->getResult($queryStr))
|
||||||
return false;
|
return false;
|
||||||
$this->id = $id;
|
$this->id = $id;
|
||||||
|
$this->data = array('userid'=>$resArr[0]['userID'], 'theme'=>$resArr[0]['theme'], 'lang'=>$resArr[0]['language'], 'id'=>$resArr[0]['id'], 'lastaccess'=>$resArr[0]['lastAccess'], 'flashmsg'=>'');
|
||||||
return $resArr[0];
|
return $resArr[0];
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
|
@ -90,13 +91,16 @@ class LetoDMS_Session {
|
||||||
function create($data) { /* {{{ */
|
function create($data) { /* {{{ */
|
||||||
$id = "" . rand() . mktime() . rand() . "";
|
$id = "" . rand() . mktime() . rand() . "";
|
||||||
$id = md5($id);
|
$id = md5($id);
|
||||||
|
$lastaccess = mktime();
|
||||||
$queryStr = "INSERT INTO tblSessions (id, userID, lastAccess, theme, language) ".
|
$queryStr = "INSERT INTO tblSessions (id, userID, lastAccess, theme, language) ".
|
||||||
"VALUES ('".$id."', ".$data['userid'].", ".mktime().", '".$data['theme']."', '".$data['lang']."')";
|
"VALUES ('".$id."', ".$data['userid'].", ".$lastaccess.", '".$data['theme']."', '".$data['lang']."')";
|
||||||
if (!$this->db->getResult($queryStr)) {
|
if (!$this->db->getResult($queryStr)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$this->id = $id;
|
$this->id = $id;
|
||||||
$this->data = $data;
|
$this->data = $data;
|
||||||
|
$this->data['id'] = $id;
|
||||||
|
$this->data['lastaccess'] = $lastaccess;
|
||||||
return $id;
|
return $id;
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
|
@ -137,5 +141,30 @@ class LetoDMS_Session {
|
||||||
function getId() { /* {{{ */
|
function getId() { /* {{{ */
|
||||||
return $this->id;
|
return $this->id;
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set language of session
|
||||||
|
*
|
||||||
|
* @param $lang language
|
||||||
|
*/
|
||||||
|
function setLanguage($lang) { /* {{{ */
|
||||||
|
/* id is only set if load() was called before */
|
||||||
|
if($this->id) {
|
||||||
|
$queryStr = "UPDATE tblSessions SET language = " . $this->db->qstr($lang) . " WHERE id = " . $this->db->qstr($this->id);
|
||||||
|
if (!$this->db->getResult($queryStr))
|
||||||
|
return false;
|
||||||
|
$this->data['lang'] = $lang;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
} /* }}} */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set language of session
|
||||||
|
*
|
||||||
|
* @param $lang language
|
||||||
|
*/
|
||||||
|
function getLanguage() { /* {{{ */
|
||||||
|
return $this->data['lang'];
|
||||||
|
} /* }}} */
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user