forked from kestasjk/webDiplomacy
-
Notifications
You must be signed in to change notification settings - Fork 13
/
halloffame.php
executable file
·174 lines (138 loc) · 5.76 KB
/
halloffame.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
<?php
/*
Copyright (C) 2004-2010 Kestas J. Kuliukas
This file is part of webDiplomacy.
webDiplomacy is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
webDiplomacy is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with webDiplomacy. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* Hall of fame; the top 100 webDip scorers
*
* @package Base
* @subpackage Game
*/
require_once('header.php');
libHTML::starthtml();
print libHTML::pageTitle(l_t('Hall of fame'),l_t('The vDiplomacy hall of fame; the 100 highest ranking players on this server.'));
print '<p align="center"><img src="'.l_s('images/points/vstack.png').'" alt=" " title="'.l_t('vDiplomacy points').'" /></p>';
print '<p></p>';
print '<button class="SearchCollapsible">All Time</button>';
print'<div class="advancedSearchContent">';
if ( $User->type['User'] && $User->vpoints > 1000 )
{
list($position) = $DB->sql_row("SELECT COUNT(id)+1 FROM wD_Users WHERE vpoints > ".$User->vpoints);
// $players = $Misc->RankingPlayers;
list($players) = $DB->sql_row("SELECT COUNT(id)+1 FROM wD_Users WHERE vpoints > 1000");
print '<p class = "hof">'.l_t('You are ranked %s out of %s players with over 1000%s','<a href="#me" class="light">#'.$position.'</a>',$players,libHTML::vpoints()).
l_t('. For more stats on your ranking visit <a class="light" href="profile.php?userID='.$User->id.'">your profile</a>.').'</p>';
}
$i=1;
$crashed = $DB->sql_tabl("SELECT id, username, vpoints FROM wD_Users order BY vpoints DESC LIMIT 100 ");
print "<TABLE class='hof'>";
print "<tr>";
print '<th class= "hof">Points/Rank</th>';
print '<th class= "hof">User</th>';
print "</tr>";
$showMe = 1;
while ( list($id, $username, $points) = $DB->tabl_row($crashed) )
{
print ' <tr class="hof">
<td class="hof"> '.number_format($points).' '.libHTML::vpoints().' - #'.$i.' </td>';
if ($User->username == $username)
{
print '<td class="hof"><a href="profile.php?userID='.$id.'" style="color:red;">'.$username.'</a></td> ';
$showMe = 0;
}
else
{
print '<td class="hof"><a href="profile.php?userID='.$id.'">'.$username.'</a></td> ';
}
print' </tr>';
$i++;
}
if ( $User->type['User'] && $User->vpoints > 1000 and $showMe == 1 )
{
print ' <tr class="hof">
<td class="hof">...</td>
<td class="hof">...</td>
</tr>';
print ' <tr class="hof">
<td class="hof"> '.number_format($User->vpoints).' '.libHTML::vpoints().' - <a name="me"></a>#'.$position.' </td>
<td class="hof" style="color:red;"><strong><em>'.$User->username.'</em></strong></td>
</tr>';
}
print '</table>';
print '</div>';
print '</br></br>';
print '<button class="SearchCollapsible">Active (Last 6 Months)</button>';
print'<div class="advancedSearchContent"></br>';
$sixMonths = time() - 15552000;
if ( $User->type['User'] && $User->vpoints > 1000 && $User->timeLastSessionEnded > $sixMonths)
{
list($position) = $DB->sql_row("SELECT COUNT(id)+1 FROM wD_Users WHERE vpoints > ".$User->vpoints." AND timeLastSessionEnded > ".$sixMonths);
list($playersSixMonths) = $DB->sql_row("SELECT COUNT(1) FROM wD_Users WHERE vpoints > 1000 AND timeLastSessionEnded > ".$sixMonths);
print '<p class = "hof">'.l_t('You are ranked %s out of %s players with over 1000%s who have been active in the last six months','<a href="#me" class="light">#'.$position.'</a>',$playersSixMonths,libHTML::vpoints()).
l_t('. For more stats on your ranking visit <a class="light" href="profile.php?userID='.$User->id.'">your profile</a>.').'</p>';
}
$i=1;
$crashed = $DB->sql_tabl("SELECT id, username, vpoints FROM wD_Users WHERE timeLastSessionEnded > ".$sixMonths." order BY vpoints DESC LIMIT 100 ");
print "<TABLE class='hof'>";
print "<tr>";
print '<th class= "hof">Points/Rank</th>';
print '<th class= "hof">User</th>';
print "</tr>";
$showMe = 1;
while ( list($id, $username, $points) = $DB->tabl_row($crashed) )
{
print ' <tr class="hof">
<td class="hof"> '.number_format($points).' '.libHTML::vpoints().' - #'.$i.' </td>';
if ($User->username == $username)
{
print '<td class="hof"><a href="profile.php?userID='.$id.'" style="color:red;">'.$username.'</a></td> ';
$showMe = 0;
}
else
{
print '<td class="hof"><a href="profile.php?userID='.$id.'">'.$username.'</a></td> ';
}
print' </tr>';
$i++;
}
if ( $User->type['User'] && $User->vpoints > 1000 && $User->timeLastSessionEnded > $sixMonths and $showMe == 1 )
{
print ' <tr class="hof">
<td class="hof">...</td>
<td class="hof">...</td>
</tr>';
print ' <tr class="hof">
<td class="hof"> '.number_format($User->vpoints).' '.libHTML::vpoints().' - <a name="me"></a>#'.$position.' </td>
<td class="hof" style="color:red;"><strong><em>'.$User->username.'</em></strong></td>
</tr>';
}
print '</table>';
print '</div>';
print '</div>';
?>
<script>
var coll = document.getElementsByClassName("SearchCollapsible");
var searchCounter;
for (searchCounter = 0; searchCounter < coll.length; searchCounter++) {
coll[searchCounter].addEventListener("click", function() {
this.classList.toggle("active");
var content = this.nextElementSibling;
if (content.style.display === "block") { content.style.display = "none"; }
else { content.style.display = "block"; }
});
}
</script>
<?php
libHTML::footer();
?>