public function read() : string { $data = null; if (Database::isConnected()) { $result = Database::select("sessions")->field("cData")->cond("cSessId", "s", $this->mSessId)->enquire(); if ($result !== null) { if ($result->numRows() > 0) { $row = $result->fetch(); $data = $row[0]; $this->mUpdate = true; } $result->destroy(); } } Runtime::addLock("database"); return (string) $data; }
public function getGroups() : ImmVector { if ($this->mUserGroups === null) { if ($this->isLoggedIn() && Database::isConnected()) { $result = Database::select("groups", "g")->join("usergroups", "u", "u.cGroupId", "g.cId")->field("g.cIdentifier")->cond("u.cUserId", "i", $this->mUserId)->enquire(); if ($result !== null) { $groups = []; if ($result->numRows() > 0) { while ($row = $result->fetch()) { $groups[] = $row[0]; } } $result->destroy(); $this->mUserGroups = new ImmVector($groups); } } else { $this->mUserGroups = new ImmVector(); } } return $this->mUserGroups; }