Session handling bugfix, profile frontend WIP

This commit is contained in:
2024-04-06 11:52:22 +02:00
parent b68ff85578
commit fe81e0f6fa
14 changed files with 422 additions and 470 deletions

View File

@@ -53,7 +53,7 @@ class Context {
}
}
public function setLanguage(Language $language) {
public function setLanguage(Language $language): void {
$this->language = $language;
$this->language->activate();
@@ -90,7 +90,7 @@ class Context {
return $this->user;
}
public function sendCookies() {
public function sendCookies(): void {
$domain = $this->getSettings()->getDomain();
$this->language->sendCookie($domain);
$this->session?->sendCookie($domain);
@@ -139,7 +139,7 @@ class Context {
return false;
}
public function processVisit() {
public function processVisit(): void {
if (isset($_COOKIE["PHPSESSID"]) && !empty($_COOKIE["PHPSESSID"])) {
if ($this->isBot()) {
return;
@@ -206,7 +206,7 @@ class Context {
->set("active", false)
->whereEq("user_id", $this->user->getId());
if (!$keepCurrent && $this->session !== null) {
if ($keepCurrent && $this->session !== null) {
$query->whereNeq("id", $this->session->getId());
}

View File

@@ -76,7 +76,7 @@ class Router {
}
}
public function addRoute(Route $route) {
public function addRoute(Route $route): void {
if (preg_match("/^\/(\d+)$/", $route->getPattern(), $re)) {
$this->statusCodeRoutes[$re[1]] = $route;
}