-
Notifications
You must be signed in to change notification settings - Fork 6
/
results.php
259 lines (258 loc) · 11.2 KB
/
results.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
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
<?php
$title = _('Past Results');
$description = 'Touhou World Cup results from past years';
$keywords = 'touhou, touhou project, 東方, 东方, Тохо, world cup, touhou world cup, twc, 2024, competition, scoring, survival, tournament';
include_once 'php/locale.php';
include_once 'php/head.php';
include_once 'php/table_func.php';
include_once 'php/db.php';
try {
$db = mysqli_connect('localhost', 'twc_admin', file_get_contents('.pw'), 'twc_archive');
} catch (Exception $e) {
$_GET['error'] = 503;
include_once 'php/error.php';
die();
}
?>
<body>
<?php include_once 'php/body.php' ?>
<main>
<h1><?php echo _('Past Results') ?></h1>
<!--<p class='large'><?php //echo _('This is NOT the current schedule! For the schedule, see the <a href="/schedule' . query_string(). '">Schedule</a> page.') ?></p>-->
<p><?php echo _('Your time zone was detected as <strong id="timezone">UTC+0000 (Coordinated Universal Time)</strong>.') ?></p>
<p><?php
if ($lang == 'en_GB' || $lang == 'en_US' || $lang == 'de_DE' || $lang == 'es_ES') {
echo _('Daylight Saving Time (also known as Summer Time or DST) is taken into account automatically.');
}
?></p>
<h2 class="contents"><?php echo _('Contents') ?></h2>
<div class="contents">
<p><a href="#2024">2024</a></p>
<p><a href="#2023">2023</a></p>
<p><a href="#2022">2022</a></p>
<p><a href="#2021">2021</a></p>
<p><a href="#2020">2020</a></p>
</div>
<p><input type="button" id="show_results" value="<?php echo _('Show Results') ?>"></p>
<p><input type="button" id="hide_results" value="<?php echo _('Hide Results') ?>"></p>
<h2 id="2024">TWC 2024</h2>
<p><?php echo _('Final tally:') ?></p>
<ol><?php
$json = get_teams($db, '2024');
$teams_2024 = json_decode($json, true);
$index = 0;
$max_index = 0;
$max_points = 0;
$teams = array();
uasort($teams_2024, function ($a, $b) {
return $a['Points'] < $b['Points'];
});
foreach ($teams_2024 as $team) {
array_push($teams, '<li><img src="' . $team['Icon'] . '" alt="' . _('Team ' . $team['Name']) . '"> ' . _('Team ' . $team['Name'] . ': ') . (float) $team['Points'] . _(' points') . '</li>');
if ($team['Points'] > $max_points) {
$max_points = $team['Points'];
$max_index = $index;
}
$index++;
}
$teams[$max_index] = str_replace('">', '"><strong>', $teams[$max_index]);
$teams[$max_index] = str_replace('</li>', '</strong></li>', $teams[$max_index]);
echo implode($teams);
?></ol>
<table class="schedule_table spoiler">
<thead>
<tr>
<th rowspan="3"><?php echo _('Date / Time') ?></th>
<th rowspan="3"><?php echo _('Category') ?></th>
<th rowspan="3"><?php echo _('Players') ?></th>
<th rowspan="3"><?php echo _('Reset Time<br>(minutes)') ?></th>
<th rowspan="3"><?php echo _('Results') ?></th>
<th rowspan="3"><?php echo _('Points') ?></th>
</tr>
</thead>
<tbody id="schedule_tbody_2024"><?php
$json = get_schedule($db, '2024');
$schedule_2024 = json_decode($json, true);
$json = get_results($db, '2024');
$results_2024 = json_decode($json, true);
print_schedule($schedule_2024, $results_2024, $teams_2024, '2024', []);
?></tbody>
</table>
<h2 id="2023">TWC 2023</h2>
<p><?php echo _('Final tally:') ?></p>
<ol><?php
$json = get_teams($db, '2023');
$teams_2023 = json_decode($json, true);
$index = 0;
$max_index = 0;
$max_points = 0;
$teams = array();
uasort($teams_2023, function ($a, $b) {
return $a['Points'] < $b['Points'];
});
foreach ($teams_2023 as $team) {
array_push($teams, '<li><img src="' . $team['Icon'] . '" alt="' . _('Team ' . $team['Name']) . '"> ' . _('Team ' . $team['Name'] . ': ') . (float) $team['Points'] . _(' points') . '</li>');
if ($team['Points'] > $max_points) {
$max_points = $team['Points'];
$max_index = $index;
}
$index++;
}
$teams[$max_index] = str_replace('">', '"><strong>', $teams[$max_index]);
$teams[$max_index] = str_replace('</li>', '</strong></li>', $teams[$max_index]);
echo implode($teams);
?></ol>
<table class="schedule_table spoiler">
<thead>
<tr>
<th rowspan="3"><?php echo _('Date / Time') ?></th>
<th rowspan="3"><?php echo _('Category') ?></th>
<th rowspan="3"><?php echo _('Players') ?></th>
<th rowspan="3"><?php echo _('Reset Time<br>(minutes)') ?></th>
<th rowspan="3"><?php echo _('Results') ?></th>
<th rowspan="3"><?php echo _('Points') ?></th>
</tr>
</thead>
<tbody id="schedule_tbody_2023"><?php
$json = get_schedule($db, '2023');
$schedule_2023 = json_decode($json, true);
$json = get_results($db, '2023');
$results_2023 = json_decode($json, true);
print_schedule($schedule_2023, $results_2023, $teams_2023, '2023', []);
?></tbody>
</table>
<h2 id="2022">TWC 2022</h2>
<p><?php echo _('Final tally:') ?></p>
<ol><?php
$json = get_teams($db, '2022');
$teams_2022 = json_decode($json, true);
$index = 0;
$max_index = 0;
$max_points = 0;
$teams = array();
uasort($teams_2022, function ($a, $b) {
return $a['Points'] < $b['Points'];
});
foreach ($teams_2022 as $team) {
array_push($teams, '<li><img src="' . $team['Icon'] . '" alt="' . _('Team ' . $team['Name']) . '"> ' . _('Team ' . $team['Name'] . ': ') . (float) $team['Points'] . _(' points') . '</li>');
if ($team['Points'] > $max_points) {
$max_points = $team['Points'];
$max_index = $index;
}
$index++;
}
$teams[$max_index] = str_replace('">', '"><strong>', $teams[$max_index]);
$teams[$max_index] = str_replace('</li>', '</strong></li>', $teams[$max_index]);
echo implode($teams);
?></ol>
<table class="schedule_table spoiler">
<thead>
<tr>
<th rowspan="3"><?php echo _('Date / Time') ?></th>
<th rowspan="3"><?php echo _('Category') ?></th>
<th rowspan="3"><?php echo _('Players') ?></th>
<th rowspan="3"><?php echo _('Reset Time<br>(minutes)') ?></th>
<th rowspan="3"><?php echo _('Results') ?></th>
<th rowspan="3"><?php echo _('Points') ?></th>
</tr>
</thead>
<tbody id="schedule_tbody_2022"><?php
$json = get_schedule($db, '2022');
$schedule_2022 = json_decode($json, true);
$json = get_results($db, '2022');
$results_2022 = json_decode($json, true);
print_schedule($schedule_2022, $results_2022, $teams_2022, '2022', []);
?></tbody>
</table>
<h2 id="2021">TWC 2021</h2>
<p><?php echo _('Final tally:') ?></p>
<ol><?php
$json = get_teams($db, '2021');
$teams_2021 = json_decode($json, true);
$index = 0;
$max_index = 0;
$max_points = 0;
$teams = array();
uasort($teams_2021, function ($a, $b) {
return $a['Points'] < $b['Points'];
});
foreach ($teams_2021 as $team) {
array_push($teams, '<li><img src="' . $team['Icon'] . '" alt="' . _('Team ' . $team['Name']) . '"> ' . _('Team ' . $team['Name'] . ': ') . (float) $team['Points'] . _(' points') . '</li>');
if ($team['Points'] > $max_points) {
$max_points = $team['Points'];
$max_index = $index;
}
$index++;
}
$teams[$max_index] = str_replace('">', '"><strong>', $teams[$max_index]);
$teams[$max_index] = str_replace('</li>', '</strong></li>', $teams[$max_index]);
echo implode($teams);
?></ol>
<table class="schedule_table spoiler">
<thead>
<tr>
<th rowspan="3"><?php echo _('Date / Time') ?></th>
<th rowspan="3"><?php echo _('Category') ?></th>
<th rowspan="3"><?php echo _('Players') ?></th>
<th rowspan="3"><?php echo _('Reset Time<br>(minutes)') ?></th>
<th rowspan="3"><?php echo _('Results') ?></th>
<th rowspan="3"><?php echo _('Points') ?></th>
</tr>
</thead>
<tbody id="schedule_tbody_2021"><?php
$json = get_schedule($db, '2021');
$schedule_2021 = json_decode($json, true);
$json = get_results($db, '2021');
$results_2021 = json_decode($json, true);
print_schedule($schedule_2021, $results_2021, $teams_2021, '2021', []);
?></tbody>
</table>
<p class="spoiler">* <?php echo _('Game Over') ?></p>
<h2 id="2020">TWC 2020</h2>
<p><?php echo _('Final tally:') ?></p>
<ol><?php
$json = get_teams($db, '2020');
$teams_2020 = json_decode($json, true);
$index = 0;
$max_index = 0;
$max_points = 0;
$teams = array();
uasort($teams_2020, function ($a, $b) {
return $a['Points'] < $b['Points'];
});
foreach ($teams_2020 as $team) {
array_push($teams, '<li><img src="' . $team['Icon'] . '" alt="' . _('Team ' . $team['Name']) . '"> ' . _('Team ' . $team['Name'] . ': ') . (float) $team['Points'] . _(' points') . '</li>');
if ($team['Points'] > $max_points) {
$max_points = $team['Points'];
$max_index = $index;
}
$index++;
}
$teams[$max_index] = str_replace('">', '"><strong>', $teams[$max_index]);
$teams[$max_index] = str_replace('</li>', '</strong></li>', $teams[$max_index]);
echo implode($teams);
?></ol>
<table class="schedule_table spoiler">
<thead>
<tr>
<th rowspan="3"><?php echo _('Date / Time') ?></th>
<th rowspan="3"><?php echo _('Category') ?></th>
<th rowspan="3"><?php echo _('Players') ?></th>
<th rowspan="3"><?php echo _('Reset Time<br>(minutes)') ?></th>
<th rowspan="3"><?php echo _('Results') ?></th>
<th rowspan="3"><?php echo _('Points') ?></th>
</tr>
</thead>
<tbody id="schedule_tbody_2020"><?php
$json = get_schedule($db, '2020');
$schedule_2020 = json_decode($json, true);
$json = get_results($db, '2020');
$results_2020 = json_decode($json, true);
print_schedule($schedule_2020, $results_2020, $teams_2020, '2020', []);
?></tbody>
</table>
<p class="spoiler">* <?php echo _('Game Over') ?></p>
<p class="spoiler"><a href="#top"><?php echo _('Back to Top') ?></a></p>
</main>
</body>
</html>