|
@@ -1,9 +1,10 @@
|
1
|
1
|
<?php
|
|
2
|
+
|
2
|
3
|
Text::$TOC = true;
|
3
|
4
|
|
4
|
5
|
$NewsCount = 5;
|
5
|
6
|
if (!$News = $Cache->get_value('news')) {
|
6
|
|
- $DB->query("
|
|
7
|
+ $DB->query("
|
7
|
8
|
SELECT
|
8
|
9
|
ID,
|
9
|
10
|
Title,
|
|
@@ -12,37 +13,37 @@ if (!$News = $Cache->get_value('news')) {
|
12
|
13
|
FROM news
|
13
|
14
|
ORDER BY Time DESC
|
14
|
15
|
LIMIT $NewsCount");
|
15
|
|
- $News = $DB->to_array(false, MYSQLI_NUM, false);
|
16
|
|
- $Cache->cache_value('news', $News, 3600 * 24 * 30);
|
17
|
|
- $Cache->cache_value('news_latest_id', $News[0][0], 0);
|
18
|
|
- $Cache->cache_value('news_latest_title', $News[0][1], 0);
|
|
16
|
+ $News = $DB->to_array(false, MYSQLI_NUM, false);
|
|
17
|
+ $Cache->cache_value('news', $News, 3600 * 24 * 30);
|
|
18
|
+ $Cache->cache_value('news_latest_id', $News[0][0], 0);
|
|
19
|
+ $Cache->cache_value('news_latest_title', $News[0][1], 0);
|
19
|
20
|
}
|
20
|
21
|
|
21
|
|
-if ($LoggedUser['LastReadNews'] != $News[0][0] && count($News) > 0) {
|
22
|
|
- $Cache->begin_transaction("user_info_heavy_$UserID");
|
23
|
|
- $Cache->update_row(false, array('LastReadNews' => $News[0][0]));
|
24
|
|
- $Cache->commit_transaction(0);
|
25
|
|
- $DB->query("
|
|
22
|
+if ($LoggedUser['LastReadNews'] !== $News[0][0] && count($News) > 0) {
|
|
23
|
+ $Cache->begin_transaction("user_info_heavy_$UserID");
|
|
24
|
+ $Cache->update_row(false, array('LastReadNews' => $News[0][0]));
|
|
25
|
+ $Cache->commit_transaction(0);
|
|
26
|
+ $DB->query("
|
26
|
27
|
UPDATE users_info
|
27
|
28
|
SET LastReadNews = '".$News[0][0]."'
|
28
|
29
|
WHERE UserID = $UserID");
|
29
|
|
- $LoggedUser['LastReadNews'] = $News[0][0];
|
|
30
|
+ $LoggedUser['LastReadNews'] = $News[0][0];
|
30
|
31
|
}
|
31
|
32
|
|
32
|
33
|
View::show_header('News', 'bbcode,news_ajax');
|
33
|
34
|
?>
|
34
|
35
|
<div class="thin">
|
35
|
36
|
<div class="sidebar">
|
36
|
|
-<?
|
|
37
|
+ <?php
|
37
|
38
|
if (check_perms('users_mod')) {
|
38
|
|
-?>
|
|
39
|
+ ?>
|
39
|
40
|
<div class="box">
|
40
|
41
|
<div class="head colhead_dark">
|
41
|
42
|
<strong><a href="staffblog.php">Latest staff blog posts</a></strong>
|
42
|
43
|
</div>
|
43
|
|
-<?
|
|
44
|
+ <?php
|
44
|
45
|
if (($Blog = $Cache->get_value('staff_blog')) === false) {
|
45
|
|
- $DB->query("
|
|
46
|
+ $DB->query("
|
46
|
47
|
SELECT
|
47
|
48
|
b.ID,
|
48
|
49
|
um.Username,
|
|
@@ -52,45 +53,43 @@ if (($Blog = $Cache->get_value('staff_blog')) === false) {
|
52
|
53
|
FROM staff_blog AS b
|
53
|
54
|
LEFT JOIN users_main AS um ON b.UserID = um.ID
|
54
|
55
|
ORDER BY Time DESC");
|
55
|
|
- $Blog = $DB->to_array(false, MYSQLI_NUM);
|
56
|
|
- $Cache->cache_value('staff_blog', $Blog, 1209600);
|
57
|
|
-}
|
58
|
|
-if (($SBlogReadTime = $Cache->get_value('staff_blog_read_'.$LoggedUser['ID'])) === false) {
|
59
|
|
- $DB->query("
|
|
56
|
+ $Blog = $DB->to_array(false, MYSQLI_NUM);
|
|
57
|
+ $Cache->cache_value('staff_blog', $Blog, 1209600);
|
|
58
|
+ }
|
|
59
|
+ if (($SBlogReadTime = $Cache->get_value('staff_blog_read_'.$LoggedUser['ID'])) === false) {
|
|
60
|
+ $DB->query("
|
60
|
61
|
SELECT Time
|
61
|
62
|
FROM staff_blog_visits
|
62
|
63
|
WHERE UserID = ".$LoggedUser['ID']);
|
63
|
|
- if (list($SBlogReadTime) = $DB->next_record()) {
|
64
|
|
- $SBlogReadTime = strtotime($SBlogReadTime);
|
65
|
|
- } else {
|
66
|
|
- $SBlogReadTime = 0;
|
67
|
|
- }
|
68
|
|
- $Cache->cache_value('staff_blog_read_'.$LoggedUser['ID'], $SBlogReadTime, 1209600);
|
69
|
|
-}
|
70
|
|
-?>
|
|
64
|
+ if (list($SBlogReadTime) = $DB->next_record()) {
|
|
65
|
+ $SBlogReadTime = strtotime($SBlogReadTime);
|
|
66
|
+ } else {
|
|
67
|
+ $SBlogReadTime = 0;
|
|
68
|
+ }
|
|
69
|
+ $Cache->cache_value('staff_blog_read_'.$LoggedUser['ID'], $SBlogReadTime, 1209600);
|
|
70
|
+ } ?>
|
71
|
71
|
<ul class="stats nobullet">
|
72
|
|
-<?
|
|
72
|
+ <?php
|
73
|
73
|
$End = min(count($Blog), 5);
|
74
|
|
-for ($i = 0; $i < $End; $i++) {
|
75
|
|
- list($BlogID, $Author, $Title, $Body, $BlogTime) = $Blog[$i];
|
76
|
|
- $BlogTime = strtotime($BlogTime);
|
77
|
|
-?>
|
|
74
|
+ for ($i = 0; $i < $End; $i++) {
|
|
75
|
+ list($BlogID, $Author, $Title, $Body, $BlogTime) = $Blog[$i];
|
|
76
|
+ $BlogTime = strtotime($BlogTime); ?>
|
78
|
77
|
<li>
|
79
|
78
|
<?=$SBlogReadTime < $BlogTime ? '<strong>' : ''?><?=($i + 1)?>.
|
80
|
79
|
<a href="staffblog.php#blog<?=$BlogID?>"><?=$Title?></a>
|
81
|
80
|
<?=$SBlogReadTime < $BlogTime ? '</strong>' : ''?>
|
82
|
81
|
</li>
|
83
|
|
-<?
|
84
|
|
-}
|
85
|
|
-?>
|
|
82
|
+ <?php
|
|
83
|
+ } ?>
|
86
|
84
|
</ul>
|
87
|
85
|
</div>
|
88
|
|
-<? } ?>
|
|
86
|
+ <?php
|
|
87
|
+} ?>
|
89
|
88
|
<div class="box">
|
90
|
89
|
<div class="head colhead_dark"><strong><a href="blog.php">Latest blog posts</a></strong></div>
|
91
|
|
-<?
|
|
90
|
+ <?php
|
92
|
91
|
if (($Blog = $Cache->get_value('blog')) === false) {
|
93
|
|
- $DB->query("
|
|
92
|
+ $DB->query("
|
94
|
93
|
SELECT
|
95
|
94
|
b.ID,
|
96
|
95
|
um.Username,
|
|
@@ -103,31 +102,31 @@ if (($Blog = $Cache->get_value('blog')) === false) {
|
103
|
102
|
LEFT JOIN users_main AS um ON b.UserID = um.ID
|
104
|
103
|
ORDER BY Time DESC
|
105
|
104
|
LIMIT 20");
|
106
|
|
- $Blog = $DB->to_array();
|
107
|
|
- $Cache->cache_value('blog', $Blog, 1209600);
|
108
|
|
-}
|
|
105
|
+ $Blog = $DB->to_array();
|
|
106
|
+ $Cache->cache_value('blog', $Blog, 1209600);
|
|
107
|
+ }
|
109
|
108
|
?>
|
110
|
109
|
<ul class="stats nobullet">
|
111
|
|
-<?
|
|
110
|
+ <?php
|
112
|
111
|
if (count($Blog) < 5) {
|
113
|
|
- $Limit = count($Blog);
|
|
112
|
+ $Limit = count($Blog);
|
114
|
113
|
} else {
|
115
|
|
- $Limit = 5;
|
|
114
|
+ $Limit = 5;
|
116
|
115
|
}
|
117
|
116
|
for ($i = 0; $i < $Limit; $i++) {
|
118
|
|
- list($BlogID, $Author, $AuthorID, $Title, $Body, $BlogTime, $ThreadID) = $Blog[$i];
|
119
|
|
-?>
|
|
117
|
+ list($BlogID, $Author, $AuthorID, $Title, $Body, $BlogTime, $ThreadID) = $Blog[$i]; ?>
|
120
|
118
|
<li>
|
121
|
|
- <?=($i + 1)?>. <a href="blog.php#blog<?=$BlogID?>"><?=$Title?></a>
|
|
119
|
+ <?=($i + 1)?>. <a
|
|
120
|
+ href="blog.php#blog<?=$BlogID?>"><?=$Title?></a>
|
122
|
121
|
</li>
|
123
|
|
-<?
|
|
122
|
+ <?php
|
124
|
123
|
}
|
125
|
124
|
?>
|
126
|
125
|
</ul>
|
127
|
126
|
</div>
|
128
|
|
-<?
|
|
127
|
+ <?php
|
129
|
128
|
if (($Freeleeches = $Cache->get_value('shop_freeleech_list')) === false) {
|
130
|
|
- $DB->query("
|
|
129
|
+ $DB->query("
|
131
|
130
|
SELECT
|
132
|
131
|
TorrentID,
|
133
|
132
|
UNIX_TIMESTAMP(ExpiryTime),
|
|
@@ -138,314 +137,341 @@ if (($Freeleeches = $Cache->get_value('shop_freeleech_list')) === false) {
|
138
|
137
|
LEFT JOIN torrents_group AS tg ON tg.ID=t.GroupID
|
139
|
138
|
ORDER BY ExpiryTime ASC
|
140
|
139
|
LIMIT 10");
|
141
|
|
- $Freeleeches = $DB->to_array();
|
142
|
|
- $Cache->cache_value('shop_freeleech_list', $Freeleeches, 1209600);
|
|
140
|
+ $Freeleeches = $DB->to_array();
|
|
141
|
+ $Cache->cache_value('shop_freeleech_list', $Freeleeches, 1209600);
|
143
|
142
|
}
|
144
|
143
|
if (count($Freeleeches)) {
|
145
|
|
-?>
|
|
144
|
+ ?>
|
146
|
145
|
<div class="box">
|
147
|
|
- <div class="head colhead_dark"><strong><a href="torrents.php?freetorrent=1&order_by=seeders&order_way=asc">Freeleeches</a></strong></div>
|
|
146
|
+ <div class="head colhead_dark"><strong><a
|
|
147
|
+ href="torrents.php?freetorrent=1&order_by=seeders&order_way=asc">Freeleeches</a></strong></div>
|
148
|
148
|
<ul class="stats nobullet">
|
149
|
|
-<?
|
|
149
|
+ <?php
|
150
|
150
|
for ($i = 0; $i < count($Freeleeches); $i++) {
|
151
|
|
- list($ID, $ExpiryTime, $Name, $Image) = $Freeleeches[$i];
|
152
|
|
- if ($ExpiryTime < time()) { continue; }
|
153
|
|
- $DisplayTime = '('.str_replace(['year','month','week','day','hour','min','Just now','s',' '],['y','M','w','d','h','m','0m'],time_diff($ExpiryTime, 1, false)).') ';
|
154
|
|
- $DisplayName = '<a href="torrents.php?torrentid='.$ID.'"';
|
155
|
|
- if (!isset($LoggedUser['CoverArt']) || $LoggedUser['CoverArt']) {
|
156
|
|
- $DisplayName .= ' data-cover="'.ImageTools::process($Image, 'thumb').'"';
|
157
|
|
- }
|
158
|
|
- $DisplayName .= '>'.$Name.'</a>';
|
159
|
|
-?>
|
|
151
|
+ list($ID, $ExpiryTime, $Name, $Image) = $Freeleeches[$i];
|
|
152
|
+ if ($ExpiryTime < time()) {
|
|
153
|
+ continue;
|
|
154
|
+ }
|
|
155
|
+ $DisplayTime = '('.str_replace(['year','month','week','day','hour','min','Just now','s',' '], ['y','M','w','d','h','m','0m'], time_diff($ExpiryTime, 1, false)).') ';
|
|
156
|
+ $DisplayName = '<a href="torrents.php?torrentid='.$ID.'"';
|
|
157
|
+ if (!isset($LoggedUser['CoverArt']) || $LoggedUser['CoverArt']) {
|
|
158
|
+ $DisplayName .= ' data-cover="'.ImageTools::process($Image, 'thumb').'"';
|
|
159
|
+ }
|
|
160
|
+ $DisplayName .= '>'.$Name.'</a>'; ?>
|
160
|
161
|
<li>
|
161
|
162
|
<strong class="fl_time"><?=$DisplayTime?></strong>
|
162
|
163
|
<?=$DisplayName?>
|
163
|
164
|
</li>
|
164
|
|
-<?
|
165
|
|
- }
|
166
|
|
-?>
|
|
165
|
+ <?php
|
|
166
|
+ } ?>
|
167
|
167
|
</ul>
|
168
|
168
|
</div>
|
169
|
|
-<?
|
|
169
|
+ <?php
|
170
|
170
|
}
|
171
|
171
|
?>
|
172
|
172
|
|
173
|
|
-<!-- Stats -->
|
|
173
|
+ <!-- Stats -->
|
174
|
174
|
<div class="box">
|
175
|
175
|
<div class="head colhead_dark"><strong>Stats</strong></div>
|
176
|
176
|
<ul class="stats nobullet">
|
177
|
|
-<? if (USER_LIMIT > 0) { ?>
|
178
|
|
- <li>Maximum users: <?=number_format(USER_LIMIT) ?></li>
|
179
|
|
-<?
|
|
177
|
+ <?php if (USER_LIMIT > 0) { ?>
|
|
178
|
+ <li>Maximum users: <?=number_format(USER_LIMIT) ?>
|
|
179
|
+ </li>
|
|
180
|
+ <?php
|
180
|
181
|
}
|
181
|
182
|
|
182
|
183
|
if (($UserCount = $Cache->get_value('stats_user_count')) === false) {
|
183
|
|
- $DB->query("
|
|
184
|
+ $DB->query("
|
184
|
185
|
SELECT COUNT(ID)
|
185
|
186
|
FROM users_main
|
186
|
187
|
WHERE Enabled = '1'");
|
187
|
|
- list($UserCount) = $DB->next_record();
|
188
|
|
- $Cache->cache_value('stats_user_count', $UserCount, 86400);
|
|
188
|
+ list($UserCount) = $DB->next_record();
|
|
189
|
+ $Cache->cache_value('stats_user_count', $UserCount, 86400);
|
189
|
190
|
}
|
190
|
191
|
$UserCount = (int)$UserCount;
|
191
|
192
|
?>
|
192
|
|
- <li>Enabled users: <?=number_format($UserCount)?> <a href="stats.php?action=users" class="brackets">Details</a></li>
|
193
|
|
-<?
|
|
193
|
+ <li>Enabled users: <?=number_format($UserCount)?> <a
|
|
194
|
+ href="stats.php?action=users" class="brackets">Details</a></li>
|
|
195
|
+ <?php
|
194
|
196
|
|
195
|
197
|
if (($UserStats = $Cache->get_value('stats_users')) === false) {
|
196
|
|
- $DB->query("
|
|
198
|
+ $DB->query("
|
197
|
199
|
SELECT COUNT(ID)
|
198
|
200
|
FROM users_main
|
199
|
201
|
WHERE Enabled = '1'
|
200
|
202
|
AND LastAccess > '".time_minus(3600 * 24)."'");
|
201
|
|
- list($UserStats['Day']) = $DB->next_record();
|
|
203
|
+ list($UserStats['Day']) = $DB->next_record();
|
202
|
204
|
|
203
|
|
- $DB->query("
|
|
205
|
+ $DB->query("
|
204
|
206
|
SELECT COUNT(ID)
|
205
|
207
|
FROM users_main
|
206
|
208
|
WHERE Enabled = '1'
|
207
|
209
|
AND LastAccess > '".time_minus(3600 * 24 * 7)."'");
|
208
|
|
- list($UserStats['Week']) = $DB->next_record();
|
|
210
|
+ list($UserStats['Week']) = $DB->next_record();
|
209
|
211
|
|
210
|
|
- $DB->query("
|
|
212
|
+ $DB->query("
|
211
|
213
|
SELECT COUNT(ID)
|
212
|
214
|
FROM users_main
|
213
|
215
|
WHERE Enabled = '1'
|
214
|
216
|
AND LastAccess > '".time_minus(3600 * 24 * 30)."'");
|
215
|
|
- list($UserStats['Month']) = $DB->next_record();
|
|
217
|
+ list($UserStats['Month']) = $DB->next_record();
|
216
|
218
|
|
217
|
|
- $Cache->cache_value('stats_users', $UserStats, 0);
|
|
219
|
+ $Cache->cache_value('stats_users', $UserStats, 0);
|
218
|
220
|
}
|
219
|
221
|
?>
|
220
|
|
- <li>Users active today: <?=number_format($UserStats['Day'])?> (<?=number_format($UserStats['Day'] / $UserCount * 100, 2)?>%)</li>
|
221
|
|
- <li>Users active this week: <?=number_format($UserStats['Week'])?> (<?=number_format($UserStats['Week'] / $UserCount * 100, 2)?>%)</li>
|
222
|
|
- <li>Users active this month: <?=number_format($UserStats['Month'])?> (<?=number_format($UserStats['Month'] / $UserCount * 100, 2)?>%)</li>
|
223
|
|
-<?
|
|
222
|
+ <li>Users active today: <?=number_format($UserStats['Day'])?> (<?=number_format($UserStats['Day'] / $UserCount * 100, 2)?>%)
|
|
223
|
+ </li>
|
|
224
|
+ <li>Users active this week: <?=number_format($UserStats['Week'])?>
|
|
225
|
+ (<?=number_format($UserStats['Week'] / $UserCount * 100, 2)?>%)
|
|
226
|
+ </li>
|
|
227
|
+ <li>Users active this month: <?=number_format($UserStats['Month'])?>
|
|
228
|
+ (<?=number_format($UserStats['Month'] / $UserCount * 100, 2)?>%)
|
|
229
|
+ </li>
|
|
230
|
+ <?php
|
224
|
231
|
|
225
|
232
|
if (($TorrentCount = $Cache->get_value('stats_torrent_count')) === false) {
|
226
|
|
- $DB->query("
|
|
233
|
+ $DB->query("
|
227
|
234
|
SELECT COUNT(ID)
|
228
|
235
|
FROM torrents");
|
229
|
|
- list($TorrentCount) = $DB->next_record();
|
230
|
|
- $Cache->cache_value('stats_torrent_count', $TorrentCount, 86400); // 1 day cache
|
|
236
|
+ list($TorrentCount) = $DB->next_record();
|
|
237
|
+ $Cache->cache_value('stats_torrent_count', $TorrentCount, 86400); // 1 day cache
|
231
|
238
|
}
|
232
|
239
|
|
233
|
240
|
if (($GroupCount = $Cache->get_value('stats_group_count')) === false) {
|
234
|
|
- $DB->query("
|
|
241
|
+ $DB->query("
|
235
|
242
|
SELECT COUNT(ID)
|
236
|
243
|
FROM torrents_group");
|
237
|
|
- list($GroupCount) = $DB->next_record();
|
238
|
|
- $Cache->cache_value('stats_group_count', $GroupCount, 86400); // 1 day cache
|
|
244
|
+ list($GroupCount) = $DB->next_record();
|
|
245
|
+ $Cache->cache_value('stats_group_count', $GroupCount, 86400); // 1 day cache
|
239
|
246
|
}
|
240
|
247
|
|
241
|
248
|
if (($TorrentSizeTotal = $Cache->get_value('stats_torrent_size_total')) === false) {
|
242
|
|
- $DB->query("
|
|
249
|
+ $DB->query("
|
243
|
250
|
SELECT SUM(Size)
|
244
|
251
|
FROM torrents");
|
245
|
|
- list($TorrentSizeTotal) = $DB->next_record();
|
246
|
|
- $Cache->cache_value('stats_torrent_size_total', $TorrentSizeTotal, 86400); // 1 day cache
|
|
252
|
+ list($TorrentSizeTotal) = $DB->next_record();
|
|
253
|
+ $Cache->cache_value('stats_torrent_size_total', $TorrentSizeTotal, 86400); // 1 day cache
|
247
|
254
|
}
|
248
|
255
|
?>
|
249
|
|
- <li>Total Size of Torrents: <?=Format::get_size($TorrentSizeTotal)?> </li>
|
250
|
|
-<?
|
|
256
|
+ <li>Total Size of Torrents: <?=Format::get_size($TorrentSizeTotal)?>
|
|
257
|
+ </li>
|
|
258
|
+ <?php
|
251
|
259
|
|
252
|
260
|
if (($ArtistCount = $Cache->get_value('stats_artist_count')) === false) {
|
253
|
|
- $DB->query("
|
|
261
|
+ $DB->query("
|
254
|
262
|
SELECT COUNT(ArtistID)
|
255
|
263
|
FROM artists_group");
|
256
|
|
- list($ArtistCount) = $DB->next_record();
|
257
|
|
- $Cache->cache_value('stats_artist_count', $ArtistCount, 86400); // 1 day cache
|
|
264
|
+ list($ArtistCount) = $DB->next_record();
|
|
265
|
+ $Cache->cache_value('stats_artist_count', $ArtistCount, 86400); // 1 day cache
|
258
|
266
|
}
|
259
|
267
|
|
260
|
268
|
?>
|
261
|
|
- <li>Torrents: <?=number_format($TorrentCount)?></li>
|
262
|
|
- <li>Torrent Groups: <?=number_format($GroupCount)?></li>
|
263
|
|
- <li>Artists: <?=number_format($ArtistCount)?></li>
|
264
|
|
-<?
|
|
269
|
+ <li>Torrents: <?=number_format($TorrentCount)?>
|
|
270
|
+ </li>
|
|
271
|
+ <li>Torrent Groups: <?=number_format($GroupCount)?>
|
|
272
|
+ </li>
|
|
273
|
+ <li>Artists: <?=number_format($ArtistCount)?>
|
|
274
|
+ </li>
|
|
275
|
+ <?php
|
265
|
276
|
// End Torrent Stats
|
266
|
277
|
|
267
|
278
|
if (($RequestStats = $Cache->get_value('stats_requests')) === false) {
|
268
|
|
- $DB->query("
|
|
279
|
+ $DB->query("
|
269
|
280
|
SELECT COUNT(ID)
|
270
|
281
|
FROM requests");
|
271
|
|
- list($RequestCount) = $DB->next_record();
|
272
|
|
- $DB->query("
|
|
282
|
+ list($RequestCount) = $DB->next_record();
|
|
283
|
+ $DB->query("
|
273
|
284
|
SELECT COUNT(ID)
|
274
|
285
|
FROM requests
|
275
|
286
|
WHERE FillerID > 0");
|
276
|
|
- list($FilledCount) = $DB->next_record();
|
277
|
|
- $Cache->cache_value('stats_requests', array($RequestCount, $FilledCount), 11280);
|
|
287
|
+ list($FilledCount) = $DB->next_record();
|
|
288
|
+ $Cache->cache_value('stats_requests', array($RequestCount, $FilledCount), 11280);
|
278
|
289
|
} else {
|
279
|
|
- list($RequestCount, $FilledCount) = $RequestStats;
|
|
290
|
+ list($RequestCount, $FilledCount) = $RequestStats;
|
280
|
291
|
}
|
281
|
292
|
|
282
|
293
|
// Do not divide by zero
|
283
|
294
|
if ($RequestCount > 0) {
|
284
|
|
- $RequestsFilledPercent = $FilledCount / $RequestCount * 100;
|
|
295
|
+ $RequestsFilledPercent = $FilledCount / $RequestCount * 100;
|
285
|
296
|
} else {
|
286
|
|
- $RequestsFilledPercent = 0;
|
|
297
|
+ $RequestsFilledPercent = 0;
|
287
|
298
|
}
|
288
|
299
|
|
289
|
300
|
?>
|
290
|
301
|
<li>Requests: <?=number_format($RequestCount)?> (<?=number_format($RequestsFilledPercent, 2)?>% filled)</li>
|
291
|
|
-<?
|
|
302
|
+ <?php
|
292
|
303
|
|
293
|
304
|
if ($SnatchStats = $Cache->get_value('stats_snatches')) {
|
294
|
|
-?>
|
295
|
|
- <li>Snatches: <?=number_format($SnatchStats)?></li>
|
296
|
|
-<?
|
|
305
|
+ ?>
|
|
306
|
+ <li>Snatches: <?=number_format($SnatchStats)?>
|
|
307
|
+ </li>
|
|
308
|
+ <?php
|
297
|
309
|
}
|
298
|
310
|
|
299
|
311
|
if (($PeerStats = $Cache->get_value('stats_peers')) === false) {
|
300
|
|
- // Cache lock!
|
301
|
|
- $PeerStatsLocked = $Cache->get_value('stats_peers_lock');
|
302
|
|
- if (!$PeerStatsLocked) {
|
303
|
|
- $Cache->cache_value('stats_peers_lock', 1, 30);
|
304
|
|
- $DB->query("
|
|
312
|
+ // Cache lock!
|
|
313
|
+ $PeerStatsLocked = $Cache->get_value('stats_peers_lock');
|
|
314
|
+ if (!$PeerStatsLocked) {
|
|
315
|
+ $Cache->cache_value('stats_peers_lock', 1, 30);
|
|
316
|
+ $DB->query("
|
305
|
317
|
SELECT IF(remaining=0,'Seeding','Leeching') AS Type, COUNT(uid)
|
306
|
318
|
FROM xbt_files_users
|
307
|
319
|
WHERE active = 1
|
308
|
320
|
GROUP BY Type");
|
309
|
|
- $PeerCount = $DB->to_array(0, MYSQLI_NUM, false);
|
310
|
|
- $SeederCount = $PeerCount['Seeding'][1] ?: 0;
|
311
|
|
- $LeecherCount = $PeerCount['Leeching'][1] ?: 0;
|
312
|
|
- $Cache->cache_value('stats_peers', array($LeecherCount, $SeederCount), 604800); // 1 week cache
|
313
|
|
- $Cache->delete_value('stats_peers_lock');
|
314
|
|
- }
|
|
321
|
+ $PeerCount = $DB->to_array(0, MYSQLI_NUM, false);
|
|
322
|
+ $SeederCount = $PeerCount['Seeding'][1] ?: 0;
|
|
323
|
+ $LeecherCount = $PeerCount['Leeching'][1] ?: 0;
|
|
324
|
+ $Cache->cache_value('stats_peers', array($LeecherCount, $SeederCount), 604800); // 1 week cache
|
|
325
|
+ $Cache->delete_value('stats_peers_lock');
|
|
326
|
+ }
|
315
|
327
|
} else {
|
316
|
|
- $PeerStatsLocked = false;
|
317
|
|
- list($LeecherCount, $SeederCount) = $PeerStats;
|
|
328
|
+ $PeerStatsLocked = false;
|
|
329
|
+ list($LeecherCount, $SeederCount) = $PeerStats;
|
318
|
330
|
}
|
319
|
331
|
|
320
|
332
|
if (!$PeerStatsLocked) {
|
321
|
|
- $Ratio = Format::get_ratio_html($SeederCount, $LeecherCount);
|
322
|
|
- $PeerCount = number_format($SeederCount + $LeecherCount);
|
323
|
|
- $SeederCount = number_format($SeederCount);
|
324
|
|
- $LeecherCount = number_format($LeecherCount);
|
|
333
|
+ $Ratio = Format::get_ratio_html($SeederCount, $LeecherCount);
|
|
334
|
+ $PeerCount = number_format($SeederCount + $LeecherCount);
|
|
335
|
+ $SeederCount = number_format($SeederCount);
|
|
336
|
+ $LeecherCount = number_format($LeecherCount);
|
325
|
337
|
} else {
|
326
|
|
- $PeerCount = $SeederCount = $LeecherCount = $Ratio = 'Server busy';
|
|
338
|
+ $PeerCount = $SeederCount = $LeecherCount = $Ratio = 'Server busy';
|
327
|
339
|
}
|
328
|
340
|
?>
|
329
|
|
- <li>Peers: <?=$PeerCount?></li>
|
330
|
|
- <li>Seeders: <?=$SeederCount?></li>
|
331
|
|
- <li>Leechers: <?=$LeecherCount?></li>
|
332
|
|
- <li>Seeder/leecher ratio: <?=$Ratio?></li>
|
|
341
|
+ <li>Peers: <?=$PeerCount?>
|
|
342
|
+ </li>
|
|
343
|
+ <li>Seeders: <?=$SeederCount?>
|
|
344
|
+ </li>
|
|
345
|
+ <li>Leechers: <?=$LeecherCount?>
|
|
346
|
+ </li>
|
|
347
|
+ <li>Seeder/leecher ratio: <?=$Ratio?>
|
|
348
|
+ </li>
|
333
|
349
|
</ul>
|
334
|
350
|
</div>
|
335
|
351
|
|
336
|
352
|
<!-- Polls -->
|
337
|
|
-<?
|
|
353
|
+ <?php
|
338
|
354
|
if (($TopicID = $Cache->get_value('polls_featured')) === false) {
|
339
|
|
- $DB->query("
|
|
355
|
+ $DB->query("
|
340
|
356
|
SELECT TopicID
|
341
|
357
|
FROM forums_polls
|
342
|
358
|
ORDER BY Featured DESC
|
343
|
359
|
LIMIT 1");
|
344
|
|
- list($TopicID) = $DB->next_record();
|
345
|
|
- $Cache->cache_value('polls_featured', $TopicID, 0);
|
|
360
|
+ list($TopicID) = $DB->next_record();
|
|
361
|
+ $Cache->cache_value('polls_featured', $TopicID, 0);
|
346
|
362
|
}
|
347
|
363
|
if ($TopicID) {
|
348
|
|
- if (($Poll = $Cache->get_value("polls_$TopicID")) === false) {
|
349
|
|
- $DB->query("
|
|
364
|
+ if (($Poll = $Cache->get_value("polls_$TopicID")) === false) {
|
|
365
|
+ $DB->query("
|
350
|
366
|
SELECT Question, Answers, Featured, Closed
|
351
|
367
|
FROM forums_polls
|
352
|
368
|
WHERE TopicID = '$TopicID'");
|
353
|
|
- list($Question, $Answers, $Featured, $Closed) = $DB->next_record(MYSQLI_NUM, array(1));
|
354
|
|
- $Answers = unserialize($Answers);
|
355
|
|
- $DB->query("
|
|
369
|
+ list($Question, $Answers, $Featured, $Closed) = $DB->next_record(MYSQLI_NUM, array(1));
|
|
370
|
+ $Answers = unserialize($Answers);
|
|
371
|
+ $DB->query("
|
356
|
372
|
SELECT Vote, COUNT(UserID)
|
357
|
373
|
FROM forums_polls_votes
|
358
|
374
|
WHERE TopicID = '$TopicID'
|
359
|
375
|
AND Vote != '0'
|
360
|
376
|
GROUP BY Vote");
|
361
|
|
- $VoteArray = $DB->to_array(false, MYSQLI_NUM);
|
|
377
|
+ $VoteArray = $DB->to_array(false, MYSQLI_NUM);
|
362
|
378
|
|
363
|
|
- $Votes = [];
|
364
|
|
- foreach ($VoteArray as $VoteSet) {
|
365
|
|
- list($Key,$Value) = $VoteSet;
|
366
|
|
- $Votes[$Key] = $Value;
|
367
|
|
- }
|
|
379
|
+ $Votes = [];
|
|
380
|
+ foreach ($VoteArray as $VoteSet) {
|
|
381
|
+ list($Key, $Value) = $VoteSet;
|
|
382
|
+ $Votes[$Key] = $Value;
|
|
383
|
+ }
|
368
|
384
|
|
369
|
|
- for ($i = 1, $il = count($Answers); $i <= $il; ++$i) {
|
370
|
|
- if (!isset($Votes[$i])) {
|
371
|
|
- $Votes[$i] = 0;
|
372
|
|
- }
|
|
385
|
+ for ($i = 1, $il = count($Answers); $i <= $il; ++$i) {
|
|
386
|
+ if (!isset($Votes[$i])) {
|
|
387
|
+ $Votes[$i] = 0;
|
|
388
|
+ }
|
|
389
|
+ }
|
|
390
|
+ $Cache->cache_value("polls_$TopicID", array($Question, $Answers, $Votes, $Featured, $Closed), 0);
|
|
391
|
+ } else {
|
|
392
|
+ list($Question, $Answers, $Votes, $Featured, $Closed) = $Poll;
|
373
|
393
|
}
|
374
|
|
- $Cache->cache_value("polls_$TopicID", array($Question, $Answers, $Votes, $Featured, $Closed), 0);
|
375
|
|
- } else {
|
376
|
|
- list($Question, $Answers, $Votes, $Featured, $Closed) = $Poll;
|
377
|
|
- }
|
378
|
394
|
|
379
|
|
- if (!empty($Votes)) {
|
380
|
|
- $TotalVotes = array_sum($Votes);
|
381
|
|
- $MaxVotes = max($Votes);
|
382
|
|
- } else {
|
383
|
|
- $TotalVotes = 0;
|
384
|
|
- $MaxVotes = 0;
|
385
|
|
- }
|
|
395
|
+ if (!empty($Votes)) {
|
|
396
|
+ $TotalVotes = array_sum($Votes);
|
|
397
|
+ $MaxVotes = max($Votes);
|
|
398
|
+ } else {
|
|
399
|
+ $TotalVotes = 0;
|
|
400
|
+ $MaxVotes = 0;
|
|
401
|
+ }
|
386
|
402
|
|
387
|
|
- $DB->query("
|
|
403
|
+ $DB->query("
|
388
|
404
|
SELECT Vote
|
389
|
405
|
FROM forums_polls_votes
|
390
|
406
|
WHERE UserID = '".$LoggedUser['ID']."'
|
391
|
407
|
AND TopicID = '$TopicID'");
|
392
|
|
- list($UserResponse) = $DB->next_record();
|
393
|
|
-
|
394
|
|
-?>
|
|
408
|
+ list($UserResponse) = $DB->next_record(); ?>
|
395
|
409
|
|
396
|
410
|
<div class="box">
|
397
|
|
- <div class="head colhead_dark"><strong>Poll<? if ($Closed) { echo ' [Closed]'; } ?></strong></div>
|
|
411
|
+ <div class="head colhead_dark"><strong>Poll<?php if ($Closed) {
|
|
412
|
+ echo ' [Closed]';
|
|
413
|
+ } ?></strong>
|
|
414
|
+ </div>
|
398
|
415
|
<div class="pad">
|
399
|
416
|
<p><strong><?=display_str($Question)?></strong></p>
|
400
|
|
-<? if ($UserResponse !== null || $Closed) { ?>
|
|
417
|
+ <?php if ($UserResponse !== null || $Closed) { ?>
|
401
|
418
|
<ul class="poll nobullet">
|
402
|
|
-<? foreach ($Answers as $i => $Answer) {
|
403
|
|
- if ($TotalVotes > 0) {
|
404
|
|
- $Ratio = $Votes[$i] / $MaxVotes;
|
405
|
|
- $Percent = $Votes[$i] / $TotalVotes;
|
406
|
|
- } else {
|
407
|
|
- $Ratio = 0;
|
408
|
|
- $Percent = 0;
|
409
|
|
- }
|
410
|
|
-?> <li<?=((!empty($UserResponse) && ($UserResponse == $i))?' class="poll_your_answer"':'')?>><?=display_str($Answers[$i])?> (<?=number_format($Percent * 100, 2)?>%)</li>
|
411
|
|
- <li class="graph">
|
412
|
|
- <span class="center_poll" style="width: <?=round($Ratio * 140)?>px;"></span>
|
413
|
|
- <br />
|
414
|
|
- </li>
|
415
|
|
-<? } ?>
|
|
419
|
+ <?php foreach ($Answers as $i => $Answer) {
|
|
420
|
+ if ($TotalVotes > 0) {
|
|
421
|
+ $Ratio = $Votes[$i] / $MaxVotes;
|
|
422
|
+ $Percent = $Votes[$i] / $TotalVotes;
|
|
423
|
+ } else {
|
|
424
|
+ $Ratio = 0;
|
|
425
|
+ $Percent = 0;
|
|
426
|
+ } ?>
|
|
427
|
+ <li<?=((!empty($UserResponse) && ($UserResponse == $i))?' class="poll_your_answer"':'')?>><?=display_str($Answers[$i])?> (<?=number_format($Percent * 100, 2)?>%)</li>
|
|
428
|
+ <li class="graph">
|
|
429
|
+ <span class="center_poll"
|
|
430
|
+ style="width: <?=round($Ratio * 140)?>px;"></span>
|
|
431
|
+ <br />
|
|
432
|
+ </li>
|
|
433
|
+ <?php
|
|
434
|
+ } ?>
|
416
|
435
|
</ul>
|
417
|
436
|
<strong>Votes:</strong> <?=number_format($TotalVotes)?><br />
|
418
|
|
-<? } else { ?>
|
|
437
|
+ <?php } else { ?>
|
419
|
438
|
<div id="poll_container">
|
420
|
|
- <form class="vote_form" name="poll" id="poll" action="">
|
421
|
|
- <input type="hidden" name="action" value="poll" />
|
422
|
|
- <input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
|
423
|
|
- <input type="hidden" name="topicid" value="<?=$TopicID?>" />
|
424
|
|
-<? foreach ($Answers as $i => $Answer) { ?>
|
425
|
|
- <input type="radio" name="vote" id="answer_<?=$i?>" value="<?=$i?>" />
|
426
|
|
- <label for="answer_<?=$i?>"><?=display_str($Answers[$i])?></label><br />
|
427
|
|
-<? } ?>
|
428
|
|
- <br /><input type="radio" name="vote" id="answer_0" value="0" /> <label for="answer_0">Blank — Show the results!</label><br /><br />
|
429
|
|
- <input type="button" onclick="ajax.post('index.php', 'poll', function(response) { $('#poll_container').raw().innerHTML = response } );" value="Vote" />
|
430
|
|
- </form>
|
|
439
|
+ <form class="vote_form" name="poll" id="poll" action="">
|
|
440
|
+ <input type="hidden" name="action" value="poll" />
|
|
441
|
+ <input type="hidden" name="auth"
|
|
442
|
+ value="<?=$LoggedUser['AuthKey']?>" />
|
|
443
|
+ <input type="hidden" name="topicid"
|
|
444
|
+ value="<?=$TopicID?>" />
|
|
445
|
+ <?php foreach ($Answers as $i => $Answer) { ?>
|
|
446
|
+ <input type="radio" name="vote" id="answer_<?=$i?>"
|
|
447
|
+ value="<?=$i?>" />
|
|
448
|
+ <label for="answer_<?=$i?>"><?=display_str($Answers[$i])?></label><br />
|
|
449
|
+ <?php } ?>
|
|
450
|
+ <br /><input type="radio" name="vote" id="answer_0" value="0" /> <label
|
|
451
|
+ for="answer_0">Blank — Show the results!</label><br /><br />
|
|
452
|
+ <input type="button"
|
|
453
|
+ onclick="ajax.post('index.php', 'poll', function(response) { $('#poll_container').raw().innerHTML = response } );"
|
|
454
|
+ value="Vote" />
|
|
455
|
+ </form>
|
431
|
456
|
</div>
|
432
|
|
-<? } ?>
|
433
|
|
- <br /><strong>Topic:</strong> <a href="forums.php?action=viewthread&threadid=<?=$TopicID?>">Visit</a>
|
|
457
|
+ <?php } ?>
|
|
458
|
+ <br /><strong>Topic:</strong> <a
|
|
459
|
+ href="forums.php?action=viewthread&threadid=<?=$TopicID?>">Visit</a>
|
434
|
460
|
</div>
|
435
|
461
|
</div>
|
436
|
|
-<?
|
|
462
|
+ <?php
|
437
|
463
|
}
|
438
|
464
|
// polls();
|
439
|
465
|
?>
|
440
|
466
|
</div>
|
441
|
467
|
<div class="main_column">
|
442
|
|
-<?
|
|
468
|
+ <?php
|
443
|
469
|
|
444
|
470
|
$Recommend = $Cache->get_value('recommend');
|
445
|
471
|
$Recommend_artists = $Cache->get_value('recommend_artists');
|
446
|
472
|
|
447
|
473
|
if (!is_array($Recommend) || !is_array($Recommend_artists)) {
|
448
|
|
- $DB->query("
|
|
474
|
+ $DB->query("
|
449
|
475
|
SELECT
|
450
|
476
|
tr.GroupID,
|
451
|
477
|
tr.UserID,
|
|
@@ -457,92 +483,99 @@ if (!is_array($Recommend) || !is_array($Recommend_artists)) {
|
457
|
483
|
LEFT JOIN users_main AS u ON u.ID = tr.UserID
|
458
|
484
|
ORDER BY tr.Time DESC
|
459
|
485
|
LIMIT 10");
|
460
|
|
- $Recommend = $DB->to_array();
|
461
|
|
- $Cache->cache_value('recommend', $Recommend, 1209600);
|
|
486
|
+ $Recommend = $DB->to_array();
|
|
487
|
+ $Cache->cache_value('recommend', $Recommend, 1209600);
|
462
|
488
|
|
463
|
|
- $Recommend_artists = Artists::get_artists($DB->collect('GroupID'));
|
464
|
|
- $Cache->cache_value('recommend_artists', $Recommend_artists, 1209600);
|
|
489
|
+ $Recommend_artists = Artists::get_artists($DB->collect('GroupID'));
|
|
490
|
+ $Cache->cache_value('recommend_artists', $Recommend_artists, 1209600);
|
465
|
491
|
}
|
466
|
492
|
|
467
|
493
|
if (count($Recommend) >= 4) {
|
468
|
|
-$Cache->increment('usage_index');
|
469
|
|
-?>
|
470
|
|
- <div class="box" id="recommended">
|
471
|
|
- <div class="head colhead_dark">
|
472
|
|
- <strong>Latest Vanity House additions</strong>
|
473
|
|
- <a data-toggle-target="#vanityhouse", data-toggle-replace="Hide" class="brackets">Show</a>
|
474
|
|
- </div>
|
|
494
|
+ $Cache->increment('usage_index'); ?>
|
|
495
|
+ <div class="box" id="recommended">
|
|
496
|
+ <div class="head colhead_dark">
|
|
497
|
+ <strong>Latest Vanity House additions</strong>
|
|
498
|
+ <a data-toggle-target="#vanityhouse" , data-toggle-replace="Hide" class="brackets">Show</a>
|
|
499
|
+ </div>
|
475
|
500
|
|
476
|
|
- <table class="torrent_table hidden" id="vanityhouse">
|
477
|
|
-<?
|
|
501
|
+ <table class="torrent_table hidden" id="vanityhouse">
|
|
502
|
+ <?php
|
478
|
503
|
foreach ($Recommend as $Recommendations) {
|
479
|
|
- list($GroupID, $UserID, $Username, $GroupName, $TagList) = $Recommendations;
|
480
|
|
- $TagsStr = '';
|
481
|
|
- if ($TagList) {
|
482
|
|
- // No vanity.house tag.
|
483
|
|
- $Tags = explode(' ', str_replace('_', '.', $TagList));
|
484
|
|
- $TagLinks = [];
|
485
|
|
- foreach ($Tags as $Tag) {
|
486
|
|
- if ($Tag == 'vanity.house') {
|
487
|
|
- continue;
|
488
|
|
- }
|
489
|
|
- $TagLinks[] = "<a href=\"torrents.php?action=basic&taglist=$Tag\">$Tag</a> ";
|
490
|
|
- }
|
491
|
|
- $TagStr = "<br />\n<div class=\"tags\">".implode(', ', $TagLinks).'</div>';
|
492
|
|
- }
|
493
|
|
-?>
|
494
|
|
- <tr>
|
495
|
|
- <td>
|
496
|
|
- <?=Artists::display_artists($Recommend_artists[$GroupID]) ?>
|
497
|
|
- <a href="torrents.php?id=<?=$GroupID?>"><?=$GroupName?></a> (by <?=Users::format_username($UserID, false, false, false)?>)
|
498
|
|
- <?=$TagStr?>
|
499
|
|
- </td>
|
500
|
|
- </tr>
|
501
|
|
-<? } ?>
|
502
|
|
- </table>
|
503
|
|
- </div>
|
504
|
|
-<!-- END recommendations section -->
|
505
|
|
-<?
|
|
504
|
+ list($GroupID, $UserID, $Username, $GroupName, $TagList) = $Recommendations;
|
|
505
|
+ $TagsStr = '';
|
|
506
|
+ if ($TagList) {
|
|
507
|
+ // No vanity.house tag.
|
|
508
|
+ $Tags = explode(' ', str_replace('_', '.', $TagList));
|
|
509
|
+ $TagLinks = [];
|
|
510
|
+ foreach ($Tags as $Tag) {
|
|
511
|
+ if ($Tag == 'vanity.house') {
|
|
512
|
+ continue;
|
|
513
|
+ }
|
|
514
|
+ $TagLinks[] = "<a href=\"torrents.php?action=basic&taglist=$Tag\">$Tag</a> ";
|
|
515
|
+ }
|
|
516
|
+ $TagStr = "<br />\n<div class=\"tags\">".implode(', ', $TagLinks).'</div>';
|
|
517
|
+ } ?>
|
|
518
|
+ <tr>
|
|
519
|
+ <td>
|
|
520
|
+ <?=Artists::display_artists($Recommend_artists[$GroupID]) ?>
|
|
521
|
+ <a href="torrents.php?id=<?=$GroupID?>"><?=$GroupName?></a> (by <?=Users::format_username($UserID, false, false, false)?>)
|
|
522
|
+ <?=$TagStr?>
|
|
523
|
+ </td>
|
|
524
|
+ </tr>
|
|
525
|
+ <?php
|
|
526
|
+ } ?>
|
|
527
|
+ </table>
|
|
528
|
+ </div>
|
|
529
|
+ <!-- END recommendations section -->
|
|
530
|
+ <?php
|
506
|
531
|
}
|
507
|
532
|
$Count = 0;
|
508
|
533
|
foreach ($News as $NewsItem) {
|
509
|
|
- list($NewsID, $Title, $Body, $NewsTime) = $NewsItem;
|
510
|
|
- if (strtotime($NewsTime) > time()) {
|
511
|
|
- continue;
|
512
|
|
- }
|
513
|
|
-?>
|
|
534
|
+ list($NewsID, $Title, $Body, $NewsTime) = $NewsItem;
|
|
535
|
+ if (strtotime($NewsTime) > time()) {
|
|
536
|
+ continue;
|
|
537
|
+ } ?>
|
514
|
538
|
<div id="news<?=$NewsID?>" class="box news_post">
|
515
|
539
|
<div class="head">
|
516
|
|
- <strong><?=Text::full_format($Title)?></strong> <?=time_diff($NewsTime);?>
|
517
|
|
-<? if (check_perms('admin_manage_news')) { ?>
|
518
|
|
- - <a href="tools.php?action=editnews&id=<?=$NewsID?>" class="brackets">Edit</a>
|
519
|
|
-<? } ?>
|
520
|
|
- <span class="float_right"><a data-toggle-target="#newsbody<?=$NewsID?>" data-toggle-replace="Show" class="brackets">Hide</a></span>
|
|
540
|
+ <strong><?=Text::full_format($Title)?></strong> <?=time_diff($NewsTime); ?>
|
|
541
|
+ <?php if (check_perms('admin_manage_news')) { ?>
|
|
542
|
+ - <a href="tools.php?action=editnews&id=<?=$NewsID?>"
|
|
543
|
+ class="brackets">Edit</a>
|
|
544
|
+ <?php } ?>
|
|
545
|
+ <span class="float_right"><a
|
|
546
|
+ data-toggle-target="#newsbody<?=$NewsID?>"
|
|
547
|
+ data-toggle-replace="Show" class="brackets">Hide</a></span>
|
|
548
|
+ </div>
|
|
549
|
+ <div id="newsbody<?=$NewsID?>" class="pad"><?=Text::full_format($Body)?>
|
521
|
550
|
</div>
|
522
|
|
- <div id="newsbody<?=$NewsID?>" class="pad"><?=Text::full_format($Body)?></div>
|
523
|
551
|
</div>
|
524
|
|
-<?
|
|
552
|
+ <?php
|
525
|
553
|
if (++$Count > ($NewsCount - 1)) {
|
526
|
|
- break;
|
|
554
|
+ break;
|
527
|
555
|
}
|
528
|
556
|
}
|
529
|
557
|
?>
|
530
|
558
|
<div id="more_news" class="box">
|
531
|
559
|
<div class="head">
|
532
|
|
- <em><span><a href="#" onclick="news_ajax(event, 3, <?=$NewsCount?>, <?=check_perms('admin_manage_news') ? 1 : 0; ?>); return false;">Click to load more news</a>.</span> To browse old news posts, <a href="forums.php?action=viewforum&forumid=<?=ANNOUNCEMENT_FORUM_ID?>">click here</a>.</em>
|
|
560
|
+ <em><span><a href="#"
|
|
561
|
+ onclick="news_ajax(event, 3, <?=$NewsCount?>, <?=check_perms('admin_manage_news') ? 1 : 0; ?>); return false;">Click
|
|
562
|
+ to load more news</a>.</span> To browse old news posts, <a
|
|
563
|
+ href="forums.php?action=viewforum&forumid=<?=ANNOUNCEMENT_FORUM_ID?>">click
|
|
564
|
+ here</a>.</em>
|
533
|
565
|
</div>
|
534
|
566
|
</div>
|
535
|
567
|
</div>
|
536
|
568
|
</div>
|
537
|
|
-<?
|
|
569
|
+<?php
|
538
|
570
|
View::show_footer(array('disclaimer'=>true));
|
539
|
571
|
|
540
|
|
-function contest() {
|
541
|
|
- global $DB, $Cache, $LoggedUser;
|
|
572
|
+function contest()
|
|
573
|
+{
|
|
574
|
+ global $DB, $Cache, $LoggedUser;
|
542
|
575
|
|
543
|
|
- list($Contest, $TotalPoints) = $Cache->get_value('contest');
|
544
|
|
- if (!$Contest) {
|
545
|
|
- $DB->query("
|
|
576
|
+ list($Contest, $TotalPoints) = $Cache->get_value('contest');
|
|
577
|
+ if (!$Contest) {
|
|
578
|
+ $DB->query("
|
546
|
579
|
SELECT
|
547
|
580
|
UserID,
|
548
|
581
|
SUM(Points),
|
|
@@ -552,34 +585,32 @@ function contest() {
|
552
|
585
|
GROUP BY UserID
|
553
|
586
|
ORDER BY SUM(Points) DESC
|
554
|
587
|
LIMIT 20");
|
555
|
|
- $Contest = $DB->to_array();
|
|
588
|
+ $Contest = $DB->to_array();
|
556
|
589
|
|
557
|
|
- $DB->query("
|
|
590
|
+ $DB->query("
|
558
|
591
|
SELECT SUM(Points)
|
559
|
592
|
FROM users_points");
|
560
|
|
- list($TotalPoints) = $DB->next_record();
|
561
|
|
-
|
562
|
|
- $Cache->cache_value('contest', array($Contest, $TotalPoints), 600);
|
563
|
|
- }
|
|
593
|
+ list($TotalPoints) = $DB->next_record();
|
564
|
594
|
|
565
|
|
-?>
|
|
595
|
+ $Cache->cache_value('contest', array($Contest, $TotalPoints), 600);
|
|
596
|
+ } ?>
|
566
|
597
|
<!-- Contest Section -->
|
567
|
|
- <div class="box box_contest">
|
568
|
|
- <div class="head colhead_dark"><strong>Quality time scoreboard</strong></div>
|
569
|
|
- <div class="pad">
|
570
|
|
- <ol style="padding-left: 5px;">
|
571
|
|
-<?
|
|
598
|
+<div class="box box_contest">
|
|
599
|
+ <div class="head colhead_dark"><strong>Quality time scoreboard</strong></div>
|
|
600
|
+ <div class="pad">
|
|
601
|
+ <ol style="padding-left: 5px;">
|
|
602
|
+ <?php
|
572
|
603
|
foreach ($Contest as $User) {
|
573
|
|
- list($UserID, $Points, $Username) = $User;
|
574
|
|
-?>
|
575
|
|
- <li><?=Users::format_username($UserID, false, false, false)?> (<?=number_format($Points)?>)</li>
|
576
|
|
-<? } ?>
|
577
|
|
- </ol>
|
578
|
|
- Total uploads: <?=$TotalPoints?><br />
|
579
|
|
- <a href="index.php?action=scoreboard">Full scoreboard</a>
|
580
|
|
- </div>
|
581
|
|
- </div>
|
582
|
|
- <!-- END contest Section -->
|
583
|
|
-<?
|
|
604
|
+ list($UserID, $Points, $Username) = $User; ?>
|
|
605
|
+ <li><?=Users::format_username($UserID, false, false, false)?>
|
|
606
|
+ (<?=number_format($Points)?>)</li>
|
|
607
|
+ <?php
|
|
608
|
+ } ?>
|
|
609
|
+ </ol>
|
|
610
|
+ Total uploads: <?=$TotalPoints?><br />
|
|
611
|
+ <a href="index.php?action=scoreboard">Full scoreboard</a>
|
|
612
|
+ </div>
|
|
613
|
+</div>
|
|
614
|
+<!-- END contest Section -->
|
|
615
|
+<?php
|
584
|
616
|
} // contest()
|
585
|
|
-?>
|