From 7c3f2e348c015ea93563d866f89ec8cea9159ea0 Mon Sep 17 00:00:00 2001 From: cflip <36554078+cflip@users.noreply.github.com> Date: Sat, 24 Apr 2021 09:40:20 -0600 Subject: Refactoring part 2 Starting to move some functionality such as the session and database connection into singleton classes to manage them. Functions for modifying posts and threads are being put in one place as well. --- includes/Session.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'includes/Session.php') diff --git a/includes/Session.php b/includes/Session.php index d97e7c5..7e17527 100644 --- a/includes/Session.php +++ b/includes/Session.php @@ -9,10 +9,8 @@ class Session session_start(); } - public static function get(): ?Session + public static function get() { - session_start(); - if (self::$instance == null) { self::$instance = new Session(); } @@ -25,7 +23,7 @@ class Session $_SESSION['signed_in'] = true; } - public function is_signed_in() + public function is_signed_in(): bool { return isset($_SESSION['signed_in']); } @@ -42,7 +40,7 @@ class Session $result = new User(); if (isset($_SESSION['user_id'])) { - $result->get_by_id($_GET['id'], $dbc); + $result->get_by_id($_SESSION['user_id']); } else { $result = null; } -- cgit v1.2.3