From 40997195b7ee07cb1bda978186c1804371e1f16e Mon Sep 17 00:00:00 2001 From: "David T. Sadler" Date: Sat, 13 Nov 2021 09:22:25 +0000 Subject: Create site --- public/edit/index.php | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 public/edit/index.php (limited to 'public/edit/index.php') diff --git a/public/edit/index.php b/public/edit/index.php new file mode 100644 index 0000000..81aa121 --- /dev/null +++ b/public/edit/index.php @@ -0,0 +1,45 @@ +get('old', new Old()); + +$errors = $session->get('errors', new Errors()); + +$id = filter_input(INPUT_GET, 'id'); + +$todos = new TodoRepository($config['path_to_repository']); + +$template = new Template($config['path_to_templates']); + +$todo = $todos->find($id); + +if ($todo === null) { + respondAndExit(404, 'Not Found'); +} + +$html = $template->render('edit', compact( + 'todo', + 'errors', + 'old' +)); + +respondAndExit(200, 'OK', $html); -- cgit v1.2.3-13-gbd6f