|
@@ -15,10 +15,10 @@ if (!($ContestSettings = $Cache->get_value("contest_settings"))) {
|
15
|
15
|
list($Amount, $Currency) = $DB->next_record();
|
16
|
16
|
}
|
17
|
17
|
$ContestSettings = array(
|
18
|
|
- 'query' => html_entity_decode($QueryPart),
|
|
18
|
+ 'query' => $QueryPart ?? '1=2',
|
19
|
19
|
'rules' => $Rules,
|
20
|
|
- 'start' => $StartTime,
|
21
|
|
- 'end' => $EndTime,
|
|
20
|
+ 'start' => $StartTime ?? 0,
|
|
21
|
+ 'end' => $EndTime ?? 0,
|
22
|
22
|
'reward' => ($Amount.' '.$Currency.'/torrent')
|
23
|
23
|
);
|
24
|
24
|
$Cache->cache_value('contest_settings', $ContestSettings);
|
|
@@ -47,53 +47,57 @@ if (!($Scores = $Cache->get_value("contest_scores"))) {
|
47
|
47
|
|
48
|
48
|
View::show_header('Contest');
|
49
|
49
|
|
50
|
|
-if (time() < $ContestSettings['start']) {
|
51
|
|
- print '<h2>Future Contest (Starts in '.time_diff($ContestSettings['start'],2,false).')</h2>';
|
52
|
|
-} else if (time() > $ContestSettings['end']) {
|
53
|
|
- print '<h2>Finished Contest</h2>';
|
|
50
|
+if (!$ContestSettings['start'] || !$ContestSettings['end']) {
|
|
51
|
+ print '<h2>No Contests</h2>';
|
54
|
52
|
} else {
|
55
|
|
- print '<h2>Ongoing Contest! ('.time_diff($ContestSettings['end'],2,false).' remaining)</h2>';
|
56
|
|
-}
|
57
|
|
-?>
|
|
53
|
+ if (time() < $ContestSettings['start']) {
|
|
54
|
+ print '<h2>Future Contest (Starts in '.time_diff($ContestSettings['start'],2,false).')</h2>';
|
|
55
|
+ } else if (time() > $ContestSettings['end']) {
|
|
56
|
+ print '<h2>Finished Contest</h2>';
|
|
57
|
+ } else {
|
|
58
|
+ print '<h2>Ongoing Contest! ('.time_diff($ContestSettings['end'],2,false).' remaining)</h2>';
|
|
59
|
+ }
|
|
60
|
+ ?>
|
58
|
61
|
|
59
|
|
-<div class="thin flex">
|
60
|
|
- <div class="box pad grow">
|
61
|
|
-<? if ($Scores) { ?>
|
62
|
|
- <h2 id="general">Scoreboard</h2>
|
63
|
|
- <table width="100%" class="contest_scoreboard">
|
64
|
|
- <tr class="colhead">
|
65
|
|
- <td>Place</td>
|
66
|
|
- <td>User</td>
|
67
|
|
- <td>Score</td>
|
68
|
|
- </tr>
|
69
|
|
-<? foreach ($Scores as $Place => $Score) { ?>
|
70
|
|
- <tr class="row">
|
71
|
|
- <td><?=($Place+1)?></td>
|
72
|
|
- <td><a href="/user.php?id=<?=$Score['ID']?>"><?=$Score['Username']?></a></td>
|
73
|
|
- <td><?=$Score['Uploads']?></td>
|
74
|
|
- </tr>
|
75
|
|
-<? } ?>
|
76
|
|
- </table>
|
77
|
|
-<? } else { ?>
|
78
|
|
- <h2>No Scores Yet</h2>
|
79
|
|
-<? } ?>
|
80
|
|
- </div>
|
81
|
|
- <div class="shrink flex" style="margin-left: 1em; flex-direction: column;">
|
82
|
|
- <div class="box pad">
|
83
|
|
- <h2>Qualifications</h2>
|
84
|
|
- <ul>
|
85
|
|
-<?
|
86
|
|
- print '<li>'.str_replace('\n', '</li><li>', $ContestSettings['rules']).'</li>'
|
87
|
|
-?>
|
88
|
|
- </ul>
|
|
62
|
+ <div class="thin flex">
|
|
63
|
+ <div class="box pad grow">
|
|
64
|
+ <? if ($Scores) { ?>
|
|
65
|
+ <h2 id="general">Scoreboard</h2>
|
|
66
|
+ <table width="100%" class="contest_scoreboard">
|
|
67
|
+ <tr class="colhead">
|
|
68
|
+ <td>Place</td>
|
|
69
|
+ <td>User</td>
|
|
70
|
+ <td>Score</td>
|
|
71
|
+ </tr>
|
|
72
|
+ <? foreach ($Scores as $Place => $Score) { ?>
|
|
73
|
+ <tr class="row">
|
|
74
|
+ <td><?=($Place+1)?></td>
|
|
75
|
+ <td><a href="/user.php?id=<?=$Score['ID']?>"><?=$Score['Username']?></a></td>
|
|
76
|
+ <td><?=$Score['Uploads']?></td>
|
|
77
|
+ </tr>
|
|
78
|
+ <? } ?>
|
|
79
|
+ </table>
|
|
80
|
+ <? } else { ?>
|
|
81
|
+ <h2>No Scores Yet</h2>
|
|
82
|
+ <? } ?>
|
89
|
83
|
</div>
|
90
|
|
- <div class="box pad">
|
91
|
|
- <h2>Rewards</h2>
|
92
|
|
- <ul>
|
93
|
|
- <li><?=$ContestSettings['reward']?></li>
|
94
|
|
- </ul>
|
|
84
|
+ <div class="shrink flex" style="margin-left: 1em; flex-direction: column;">
|
|
85
|
+ <div class="box pad">
|
|
86
|
+ <h2>Qualifications</h2>
|
|
87
|
+ <ul>
|
|
88
|
+ <?
|
|
89
|
+ print '<li>'.str_replace('\n', '</li><li>', $ContestSettings['rules']).'</li>'
|
|
90
|
+ ?>
|
|
91
|
+ </ul>
|
|
92
|
+ </div>
|
|
93
|
+ <div class="box pad">
|
|
94
|
+ <h2>Rewards</h2>
|
|
95
|
+ <ul>
|
|
96
|
+ <li><?=$ContestSettings['reward']?></li>
|
|
97
|
+ </ul>
|
|
98
|
+ </div>
|
95
|
99
|
</div>
|
96
|
100
|
</div>
|
97
|
|
-</div>
|
98
|
101
|
|
99
|
|
-<? View::show_footer(); ?>
|
|
102
|
+<? }
|
|
103
|
+ View::show_footer(); ?>
|