diff options
Diffstat (limited to 'public/edit/index.php')
| -rw-r--r-- | public/edit/index.php | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/public/edit/index.php b/public/edit/index.php index 9d3d4c0..fba5a90 100644 --- a/public/edit/index.php +++ b/public/edit/index.php @@ -3,17 +3,24 @@ declare(strict_types=1); use DTS\BookmarkRepository; +use DTS\Errors; +use DTS\Session; use DTS\Template; + use function DTS\Functions\respondAndExit; require_once(__DIR__.'/../../autoload.php'); $config = require_once(__DIR__.'/../../config.php'); +$session = Session::getInstance(); + if (filter_input(INPUT_SERVER, 'REQUEST_METHOD') !== 'GET') { respondAndExit(405, 'Method Not Allowed'); } +$errors = $session->get('errors', new Errors()); + $id = filter_input(INPUT_GET, 'id'); $bookmarks = new BookmarkRepository($config['path_to_repository']); @@ -26,6 +33,9 @@ if ($bookmark === null) { respondAndExit(404, 'Not Found'); } -$html = $template->render('edit', compact('bookmark')); +$html = $template->render('edit', compact( + 'bookmark', + 'errors' +)); respondAndExit(200, 'OK', $html); |
