-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
44 lines (35 loc) · 1.12 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
<?php
/*
* Define the links of overviews that should be included in the page here.
*/
$owners = [
'medcam' => [
'link' => 'medcam.php',
'text' => 'Medcamgaming (geography)',
'bgcolor' => '#6ab'
],
'highway' => [
'link' => 'langs.php',
'text' => 'Highwayscenes (languages)',
'bgcolor' => '#c86'
]
];
$title = 'Quiz overview';
$preface = '<h1>Quiz</h1>
This page runs quizzes for Nightbot. Click on a button below to see the overview of a quiz.';
$appendix = '<p>';
foreach ($owners as $name => $owner) {
$link = $owner['link'] ?? "$name.php";
$text = $owner['text'] ?? ucfirst($name);
$style = !empty($owner['bgcolor']) ? "style='background-color: {$owner['bgcolor']}'" : "";
$appendix .= "<br /><a href='$link' class='owner' $style>$text</a>";
}
$appendix .= '</p>';
if ($_SERVER['HTTP_HOST'] === 'localhost') {
$appendix .= '<script src="./indexpage/favicon_remover.js"></script>';
}
$template = file_get_contents('./indexpage/template.html');
echo str_replace(
['{title}', '{preface}', '{questions}', '{appendix}'],
[ $title, $preface, '', $appendix ],
$template);