-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
60 lines (52 loc) · 1.18 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
56
57
58
59
60
<?php
$path = str_replace('/reboot/', '/', $_SERVER['REQUEST_URI']);
$pages = array(
'/bitcoin' => array(
'title' => 'Bitcoin?',
'content' => 'bitcoin.html',
),
'/why' => array(
'title' => 'Why?',
'content' => 'why.html',
),
'/how' => array(
'title' => 'How?',
'content' => 'how.html',
),
'/who' => array(
'title' => 'Who?',
'content' => 'who.html',
),
'/projects' => array(
'title' => 'Projects',
'content' => 'projects.html',
),
);
$redirects = array(
/* Legacy routes: */
'/index.php' => '/',
'/index.php/bitcoin' => '/bitcoin',
'/index.php/why' => '/why',
'/index.php/how' => '/how',
'/index.php/who' => '/who',
);
function render($template_path, array $locals = array()) {
extract($locals, EXTR_OVERWRITE);
require $template_path;
}
if (isset($redirects[$path])) {
header('Location: ' . $redirects[$path]);
die();
}
if ($path == '/') {
render('home.html');
die();
}
if (isset($pages[$path])) {
$page = $pages[$path];
$page['path'] = $path;
$page['content'] = @file_get_contents($page['content']);
render('template.php', $page);
die();
}
include '404.html';