/
index.php
55 lines (42 loc) · 1.66 KB
/
index.php
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<?php
include __DIR__ . '/bootstrap.php';
// Define home route
$app->get('/', function ($request, $response) {
return $this->view->render($response, 'about.twig', [
'messages' => $this->flash->getMessages(),
]);
})->setName('home');
$app->get('/error', function ($request, $response) {
$response = $response->withHeader('X-Status-Reason', $this->flash->getMessage('error'));
print_p( $this->flash->getMessages() ); die();
return $this->view->render($response->withStatus(400), 'error.twig', [
'messages' => $this->flash->getMessages(),
'error_detail' => $this->flash->getMessages(),
]);
})->setName('error');
include __DIR__ . '/routes_signouts.php';
include __DIR__ . '/routes_territories.php';
include __DIR__ . '/routes_buildings.php';
include __DIR__ . '/routes_people.php';
// $app->get('/contact', function ($request, $response) {
// return $this->view->render($response, 'contact.twig', [
// 'messages' => $this->flash->getMessages()
// ]);
// })->setName('contact');
// $app->post('/contact', function ($request, $response, $args) {
// $post = $request->getParsedBody();
// $name = $post['name'];
// $email = $post['email'];
// $msg = $post['msg'];
// if( !empty($name) && !empty($email) && !empty($msg) ){
// $cleanName = filter_var( $name, FILTER_SANITIZE_STRING );
// $cleanEmail = filter_var($email, FILTER_SANITIZE_EMAIL );
// $cleanName = filter_var( $msg, FILTER_SANITIZE_STRING );
// } else {
// $this->flash->addMessage('fail', 'All fields are required.');
// //return $response->withStatus(301)->withHeader('Location', '/contact');
// return $response->withRedirect('/contact', 301);
// }
// });
// Run app
$app->run();