diff options
| author | David T. Sadler <davidtsadler@googlemail.com> | 2021-10-18 21:15:18 +0100 |
|---|---|---|
| committer | David T. Sadler <davidtsadler@googlemail.com> | 2021-10-18 21:15:18 +0100 |
| commit | 1a112ab14becaf6d41cd34c176cbe563d4ca9742 (patch) | |
| tree | aad7dd85d9a7d3d4465a6ef506a0259b46ed6ee7 /public/index.php | |
| parent | cbaedbc5251f3b127bd81242d1344c0cd3e56e0c (diff) | |
Implement session management
Diffstat (limited to 'public/index.php')
| -rw-r--r-- | public/index.php | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/public/index.php b/public/index.php index 7453506..025c9ec 100644 --- a/public/index.php +++ b/public/index.php @@ -3,6 +3,7 @@ declare(strict_types=1); use DTS\BookmarkRepository; +use DTS\Session; use DTS\Template; use function DTS\Functions\respondAndExit; @@ -10,6 +11,8 @@ require_once(__DIR__.'/../autoload.php'); $config = require_once(__DIR__.'/../config.php'); +$session = Session::getInstance(); + $bookmarks = new BookmarkRepository($config['path_to_repository']); $template = new Template($config['path_to_templates']); @@ -24,6 +27,11 @@ if ($tag !== null) { $bookmarks->sort($sort === 'asc'); -$html = $template->render('index', compact('bookmarks')); +$message = $session->get('message'); + +$html = $template->render('index', compact( + 'bookmarks', + 'message' +)); respondAndExit(200, 'OK', $html); |
