blob: 8256ff55579def93efedaec3b8b1fa7babdd7c73 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
<?php
declare(strict_types=1);
use DTS\Todo;
use DTS\Errors;
use DTS\Old;
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');
}
$old = $session->get('old', new Old());
$errors = $session->get('errors', new Errors());
$template = new Template($config['path_to_templates']);
$todo = new Todo();
$html = $template->render('create', compact(
'todo',
'errors',
'old'
));
respondAndExit(200, 'OK', $html);
|