summaryrefslogtreecommitdiff
path: root/includes/templates/header.php
diff options
context:
space:
mode:
authorcflip <36554078+cflip@users.noreply.github.com>2021-04-24 09:40:20 -0600
committercflip <36554078+cflip@users.noreply.github.com>2021-04-24 09:40:20 -0600
commit7c3f2e348c015ea93563d866f89ec8cea9159ea0 (patch)
treeb7b6b18cf9087f42300f621d15101628a8d214e4 /includes/templates/header.php
parent6c9369ad85f2fb3dc61234b54db7e7079cdc0c4e (diff)
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.
Diffstat (limited to 'includes/templates/header.php')
-rw-r--r--includes/templates/header.php8
1 files changed, 6 insertions, 2 deletions
diff --git a/includes/templates/header.php b/includes/templates/header.php
index 4eb17e3..35d9848 100644
--- a/includes/templates/header.php
+++ b/includes/templates/header.php
@@ -5,8 +5,12 @@
[<a href="/create_thread.php">Create a thread</a>]
<span style="float:right;">
<?php
- if (isset($_SESSION['signed_in'])) {
- echo '[<a href="viewuser.php?id='. $_SESSION['user_id'] .'">' . $_SESSION['user_name'] . '\'s Profile</a>] [<a href="includes/signout_inc.php">Log out</a>]';
+ include_once './includes/Session.php';
+ include_once './includes/model/User.php';
+
+ if (Session::get()->is_signed_in()) {
+ $user = Session::get()->get_current_user();
+ echo '[<a href="viewuser.php?id=' . $user->id . '">' . $user->name . '\'s Profile</a>] [<a href="includes/signout_inc.php">Log out</a>]';
} else {
echo '[<a href="signin.php">Sign in</a>] or [<a href="register.php">Register an account</a>]';
}