summaryrefslogtreecommitdiff
path: root/public/index.php
blob: afae00a5eb73ca5836c97328f385fe0c5aa60338 (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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<?php

require_once __DIR__ . '/../app.php';

$url = strtok($_SERVER["REQUEST_URI"], '?');

switch( $url ) {

case("/"):
	echo $twig->render('index.html');
	break;
case("/about/"):
	echo $twig->render('about.html');
	break;
case("/projects/"):
	echo $twig->render('projects.html');
	break;
case("/thing/"):
case("/tool/"):
case("/tools/"):
	header("Location: https://" . $_SERVER["HTTP_HOST"] . "/things/");
	exit;
	break;
case("/things/"):
	echo $twig->render('things.html');
	break;
case("/things/faces/"):
	echo $twig->render('things/faces/index.html', [ "faces" => get_faces() ]);
	break;
case("/things/pizza/"):
	echo $twig->render('things/pizza/index.html');
	break;
case("/things/untrack/"):
	$_url = "";
	if ( isset($_REQUEST['url']) ) {
		$_url = htmlspecialchars($_REQUEST['url']);
	} 
	echo $twig->render('things/untrack/index.html', [ "url" => $_url ]);
	break;
case("/things/tanz/"):
	echo $twig->render('things/bpm/index.html', [ "dances" => get_dances() ]);
	break;
case("/feeds/"):
	echo $twig->render('feeds.html');
	break;
case("/things/zeitumstellung/"):
	echo $twig->render('things/zeitumstellung/index.html', [ "tc" => new Zeitumstellung() ]);
	break;
case("/things/ghrss/"):
	echo $twig->render('things/ghrss/index.html', [ "data" => get_ghrss_feeds() ]);
	break;
default:
	if ( str_ends_with($url, "/") ) {
		http_response_code(404);
		echo $twig->render('404.html');
	} else {
		$url = $url . "/";
		header("Location: " . $url);
		exit;
	}
}