Skip to content

Commit cba8097

Browse files
authored
Small fix to achievements.php
Fix #390 Default image medal for achievements without configured image. Secret key set to default if it hasn't been configured already.
1 parent 4068f42 commit cba8097

File tree

1 file changed

+29
-28
lines changed

1 file changed

+29
-28
lines changed

Diff for: achievements.php

+29-28
Original file line numberDiff line numberDiff line change
@@ -20,35 +20,36 @@
2020
<tr>
2121
<?php
2222
foreach ($config['achievements'] as $key => $achName) {
23-
$secret = false;
24-
if (($achName['points'] >= 1) and ($achName['points'] <= 3) and (!$achName['img'])) {
25-
echo '<td><center><img id="wtf" src="https://i.imgur.com/TUCGsr3.gif"></center></td>';
23+
// Set defaults
24+
if (!isset($achName['secret'])) $achName['secret'] = false;
25+
if (!isset($achName['img'])) $achName['img'] = 'https://i.imgur.com/ZqWp1TE.png';
26+
27+
if (($achName['points'] >= 1) and ($achName['points'] <= 3) and (!$achName['img'])) {
28+
echo '<td><center><img id="wtf" src="https://i.imgur.com/TUCGsr3.gif"></center></td>';
29+
30+
} elseif (($achName['points'] >= 4) and ($achName['points'] <= 6) and (!$achName['img'])) {
31+
echo '<td><center><img id="wtf" src="https://i.imgur.com/TUCGsr3.gif"><img id="wtf" src="https://i.imgur.com/TUCGsr3.gif"></center></td>';
32+
33+
} elseif (($achName['points'] >= 7) and ($achName['points'] <= 9) and (!$achName['img'])) {
34+
echo '<td><center><img id="wtf" src="https://i.imgur.com/TUCGsr3.gif"><img id="wtf" src="https://i.imgur.com/TUCGsr3.gif"><img id="wtf" src="https://i.imgur.com/TUCGsr3.gif"></center></td>';
35+
36+
} elseif (($achName['points'] >= 10) and (!$achName['img'])) {
37+
echo '<td><center><img id="wtf" src="https://i.imgur.com/TUCGsr3.gif"><img id="wtf" src="https://i.imgur.com/TUCGsr3.gif"><img id="wtf" src="https://i.imgur.com/TUCGsr3.gif"></center></td>';
38+
39+
} else {
40+
echo '<td><img id="wtf" src="' .$achName['img']. '"><br><br></td>';
41+
}
42+
echo '<td>' .$achName[0]. '</td>';
43+
echo '<td>' .$achName[1]. '</td>';
44+
if ($achName['secret'] == true) {
45+
echo '<td><img id="wtf" src="https://i.imgur.com/NbPRl7b.gif"></td>';
46+
echo '<td>'. $achName['points'] .'</td>';
47+
} else {
48+
echo '<td></td><td>'. $achName['points'] .'</td>';
49+
}
50+
echo '</tr>';
2651
}
27-
elseif (($achName['points'] >= 4) and ($achName['points'] <= 6) and (!$achName['img']))
28-
{
29-
echo '<td><center><img id="wtf" src="https://i.imgur.com/TUCGsr3.gif"><img id="wtf" src="https://i.imgur.com/TUCGsr3.gif"></center></td>';
30-
}
31-
elseif (($achName['points'] >= 7) and ($achName['points'] <= 9) and (!$achName['img']))
32-
{
33-
echo '<td><center><img id="wtf" src="https://i.imgur.com/TUCGsr3.gif"><img id="wtf" src="https://i.imgur.com/TUCGsr3.gif"><img id="wtf" src="https://i.imgur.com/TUCGsr3.gif"></center></td>';
34-
}
35-
elseif (($achName['points'] >= 10) and (!$achName['img']))
36-
{
37-
echo '<td><center><img id="wtf" src="https://i.imgur.com/TUCGsr3.gif"><img id="wtf" src="https://i.imgur.com/TUCGsr3.gif"><img id="wtf" src="https://i.imgur.com/TUCGsr3.gif"></center></td>';
38-
}
39-
else {
40-
echo '<td><img id="wtf" src="' .$achName['img']. '"><br><br></td>';
41-
}
42-
echo '<td>' .$achName[0]. '</td>';
43-
echo '<td>' .$achName[1]. '</td>';
44-
if ($achName['secret'] == true){
45-
echo '<td><img id="wtf" src="https://i.imgur.com/NbPRl7b.gif"></td>';
46-
echo '<td>'. $achName['points'] .'</td>';
47-
} else {
48-
echo '<td></td><td>'. $achName['points'] .'</td>';
49-
}
50-
echo '</tr>';
51-
}?>
52+
?>
5253
</table>
5354
</div>
5455
</div>

0 commit comments

Comments
 (0)