Skip to content
Snippets Groups Projects
Commit fb0de4ce authored by xamgore's avatar xamgore
Browse files

@SemesterID fix, but nothing works now

parent 12caeafe
Branches
Tags
No related merge requests found
......@@ -62,7 +62,7 @@ class Kohana_User implements ArrayAccess
if ($isSignedIn) {
$id = $this->_session->get('ID');
$this->_userInfo = $this->getInfoFromDB($id);
$this->_userInfo = $this->getInfoFromDB($id, $this->_model->getCurSemesterID());
if (self::$_flag != true) {
$this->_session->regenerate();
......@@ -130,14 +130,16 @@ class Kohana_User implements ArrayAccess
$userHash = $this->hash($source) . $this->_config['hash_key'];
$passwordHash = $this->hash($passhash . $this->_config['hash_key']);
Cookie::set('userhash', $passwordHash);
$this->_userInfo = $this->getInfoFromDB($id);
$semester = $this->_model->getCurSemesterID();
$this->_userInfo = $this->getInfoFromDB($id, $semester);
$this->_session->regenerate();
$this->_session->set('ID', $id);
$this->_session->set('LoggedIn', true);
$this->_session->set('UserHash', $this->hash($userHash));
$this->_session->set('PasswordHash', $passwordHash);
$this->_session->set('start_time', time());
$this->_session->set("SemesterID", $this->_model->getCurSemesterID());
$this->_session->set("SemesterID", $semester);
return true;
}
......@@ -265,8 +267,8 @@ class Kohana_User implements ArrayAccess
}
}
private function getInfoFromDB($id) {
$info = $this->_model->getPersonalInfo($id);
private function getInfoFromDB($id, $semesterID) {
$info = $this->_model->getPersonalInfo($id, $semesterID);
$info += $this->_model->getAccountInfo($id);
return $info;
}
......@@ -286,9 +288,9 @@ class Kohana_User implements ArrayAccess
$this->_userInfo[$offset] = $value;
} elseif (isset($offset, $this->_session)) {
$this->_session[$offset] = $value;
} else {
$this->_userInfo[$offset] = $value;
}
$this->_userInfo[$offset] = $value;
}
public function offsetGet($offset) {
......
......@@ -117,9 +117,8 @@ class Model_Kohana_Account extends Model
return $response->get('Num');
}
public static function getPersonalInfo($id)
{
$semesterID = User::instance()->se;
public static function getPersonalInfo($id, $semesterID = null) {
$semesterID = $semesterID ? $semesterID : User::instance()->SemesterID;
$sql = "CALL `GetPersonalInfo`('$id', $semesterID);";
$query = DB::query(Database::SELECT, $sql)->execute();
return $query[0];
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment