summaryrefslogtreecommitdiff
path: root/public/index.php
blob: 957bed44a44e2d0beae96ef1f392983748404e30 (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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
<?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("/feeds/"):
	echo $twig->render('feeds.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;

# things:

## faces
case("/things/faces/"):
	echo $twig->render('things/faces/index.html', [ "faces" => get_faces() ]);
	break;
case("/faces/"):
	header("Location: https://" . $_SERVER["HTTP_HOST"] . "/things/faces/");
	exit;
	break;

## pizza
case("/things/pizza/"):
	echo $twig->render('things/pizza/index.html');
	break;
case("/pizza/"):
	header("Location: https://" . $_SERVER["HTTP_HOST"] . "/things/pizza/");
	exit;
	break;

## untrack
case("/things/untrack/"):
	$_url = "";
	if ( isset($_REQUEST['url']) ) {
		$_url = htmlspecialchars($_REQUEST['url']);
	} 
	echo $twig->render('things/untrack/index.html', [ "url" => $_url ]);
	break;
case("/untrack/"):
	header("Location: https://" . $_SERVER["HTTP_HOST"] . "/things/untrack/");
	exit;
	break;

## tanz
case("/things/tanz/"):
	echo $twig->render('things/bpm/index.html', [ "dances" => get_dances() ]);
	break;
case("/tanz/"):
	header("Location: https://" . $_SERVER["HTTP_HOST"] . "/things/tanz/");
	exit;
	break;

## zeitumstellung
case("/things/zeitumstellung/"):
	echo $twig->render('things/zeitumstellung/index.html', [ "tc" => new Zeitumstellung() ]);
	break;
case("/zeit/"):
	header("Location: https://" . $_SERVER["HTTP_HOST"] . "/things/zeitumstellung/");
	exit;
	break;
case("/zeitumstellung/"):
	header("Location: https://" . $_SERVER["HTTP_HOST"] . "/things/zeitumstellung/");
	exit;
	break;

## ghrss
case("/things/ghrss/"):
	echo $twig->render('things/ghrss/index.html', [ "data" => get_ghrss_feeds() ]);
	break;
case("/ghrss/"):
	header("Location: https://" . $_SERVER["HTTP_HOST"] . "/things/ghrss/");
	exit;
	break;

default:
	if ( str_ends_with($url, "/") ) {
		http_response_code(404);
		echo $twig->render('404.html');
	} else {
		$url = $url . "/";
		header("Location: " . $url);
		exit;
	}
}