Gazelle/sections/index/private.php

545 lines
16 KiB
PHP
Raw Normal View History

2013-07-10 00:08:53 +00:00
<?php
2013-05-27 08:00:58 +00:00
include(SERVER_ROOT.'/classes/text.class.php');
2012-10-27 08:00:09 +00:00
$Text = new TEXT(true);
2011-03-28 14:21:28 +00:00
2013-06-14 08:18:16 +00:00
$NewsCount = 5;
2011-03-28 14:21:28 +00:00
if (!$News = $Cache->get_value('news')) {
2013-05-27 08:00:58 +00:00
$DB->query("
SELECT
ID,
Title,
Body,
Time
2011-03-28 14:21:28 +00:00
FROM news
ORDER BY Time DESC
2013-07-10 00:08:53 +00:00
LIMIT $NewsCount");
2013-05-27 08:00:58 +00:00
$News = $DB->to_array(false, MYSQLI_NUM, false);
$Cache->cache_value('news', $News, 3600 * 24 * 30);
2011-03-28 14:21:28 +00:00
$Cache->cache_value('news_latest_id', $News[0][0], 0);
2013-10-16 08:01:00 +00:00
$Cache->cache_value('news_latest_title', $News[0][1], 0);
2011-03-28 14:21:28 +00:00
}
if ($LoggedUser['LastReadNews'] != $News[0][0]) {
2013-07-10 00:08:53 +00:00
$Cache->begin_transaction("user_info_heavy_$UserID");
2011-03-28 14:21:28 +00:00
$Cache->update_row(false, array('LastReadNews' => $News[0][0]));
$Cache->commit_transaction(0);
2013-06-15 08:00:45 +00:00
$DB->query("
UPDATE users_info
SET LastReadNews = '".$News[0][0]."'
WHERE UserID = $UserID");
2011-03-28 14:21:28 +00:00
$LoggedUser['LastReadNews'] = $News[0][0];
}
2013-07-10 00:08:53 +00:00
View::show_header('News', 'bbcode,news_ajax');
2011-03-28 14:21:28 +00:00
?>
<div class="thin">
<div class="sidebar">
<?
2013-06-06 08:01:03 +00:00
include('feat_merch.php');
2012-08-12 08:00:16 +00:00
include('feat_album.php');
2012-08-11 08:00:15 +00:00
2012-08-12 08:00:16 +00:00
if (check_perms('users_mod')) {
2011-03-28 14:21:28 +00:00
?>
2012-01-25 08:00:20 +00:00
<div class="box">
2013-06-15 08:00:45 +00:00
<div class="head colhead_dark">
<strong><a href="staffblog.php">Latest staff blog posts</a></strong>
</div>
2012-01-25 08:00:20 +00:00
<?
2013-04-19 08:00:55 +00:00
if (($Blog = $Cache->get_value('staff_blog')) === false) {
$DB->query("
SELECT
b.ID,
um.Username,
b.Title,
b.Body,
b.Time
FROM staff_blog AS b
2013-07-10 00:08:53 +00:00
LEFT JOIN users_main AS um ON b.UserID = um.ID
2012-11-09 08:00:18 +00:00
ORDER BY Time DESC");
2013-02-15 08:00:35 +00:00
$Blog = $DB->to_array(false, MYSQLI_NUM);
$Cache->cache_value('staff_blog', $Blog, 1209600);
2012-01-25 08:00:20 +00:00
}
2013-02-15 08:00:35 +00:00
if (($SBlogReadTime = $Cache->get_value('staff_blog_read_'.$LoggedUser['ID'])) === false) {
2013-06-15 08:00:45 +00:00
$DB->query("
SELECT Time
FROM staff_blog_visits
WHERE UserID = ".$LoggedUser['ID']);
2013-02-15 08:00:35 +00:00
if (list($SBlogReadTime) = $DB->next_record()) {
$SBlogReadTime = strtotime($SBlogReadTime);
2012-01-25 08:00:20 +00:00
} else {
2013-02-15 08:00:35 +00:00
$SBlogReadTime = 0;
2012-01-25 08:00:20 +00:00
}
2013-02-15 08:00:35 +00:00
$Cache->cache_value('staff_blog_read_'.$LoggedUser['ID'], $SBlogReadTime, 1209600);
2012-01-25 08:00:20 +00:00
}
?>
<ul class="stats nobullet">
<?
2013-09-08 08:00:57 +00:00
$End = min(count($Blog), 5);
for ($i = 0; $i < $End; $i++) {
list($BlogID, $Author, $Title, $Body, $BlogTime) = $Blog[$i];
2013-02-15 08:00:35 +00:00
$BlogTime = strtotime($BlogTime);
2012-01-25 08:00:20 +00:00
?>
<li>
2013-09-08 08:00:57 +00:00
<?=$SBlogReadTime < $BlogTime ? '<strong>' : ''?><?=($i + 1)?>.
2013-02-15 08:00:35 +00:00
<a href="staffblog.php#blog<?=$BlogID?>"><?=$Title?></a>
2013-09-08 08:00:57 +00:00
<?=$SBlogReadTime < $BlogTime ? '</strong>' : ''?>
2012-01-25 08:00:20 +00:00
</li>
2012-10-27 08:00:09 +00:00
<?
2012-01-25 08:00:20 +00:00
}
?>
</ul>
</div>
2013-04-19 08:00:55 +00:00
<? } ?>
2011-03-28 14:21:28 +00:00
<div class="box">
<div class="head colhead_dark"><strong><a href="blog.php">Latest blog posts</a></strong></div>
<?
2013-04-19 08:00:55 +00:00
if (($Blog = $Cache->get_value('blog')) === false) {
2013-06-15 08:00:45 +00:00
$DB->query("
SELECT
b.ID,
um.Username,
b.Title,
b.Body,
b.Time,
b.ThreadID
FROM blog AS b
2013-09-05 08:00:49 +00:00
LEFT JOIN users_main AS um ON b.UserID = um.ID
2011-03-28 14:21:28 +00:00
ORDER BY Time DESC
LIMIT 20");
$Blog = $DB->to_array();
2013-06-15 08:00:45 +00:00
$Cache->cache_value('blog', $Blog, 1209600);
2011-03-28 14:21:28 +00:00
}
?>
<ul class="stats nobullet">
<?
2013-04-19 08:00:55 +00:00
if (count($Blog) < 5) {
2011-03-28 14:21:28 +00:00
$Limit = count($Blog);
} else {
$Limit = 5;
}
2013-04-19 08:00:55 +00:00
for ($i = 0; $i < $Limit; $i++) {
2011-03-28 14:21:28 +00:00
list($BlogID, $Author, $Title, $Body, $BlogTime, $ThreadID) = $Blog[$i];
?>
<li>
<?=($i + 1)?>. <a href="blog.php#blog<?=$BlogID?>"><?=$Title?></a>
</li>
2012-10-27 08:00:09 +00:00
<?
2011-03-28 14:21:28 +00:00
}
?>
</ul>
</div>
2013-07-28 08:00:53 +00:00
<? //SiteHistoryView::render_recent_sidebar(SiteHistory::get_events(null, null, null, null, null, null, 5));
?>
2011-03-28 14:21:28 +00:00
<div class="box">
<div class="head colhead_dark"><strong>Stats</strong></div>
<ul class="stats nobullet">
2013-04-19 08:00:55 +00:00
<? if (USER_LIMIT > 0) { ?>
2013-03-09 08:00:18 +00:00
<li>Maximum users: <?=number_format(USER_LIMIT) ?></li>
2011-03-28 14:21:28 +00:00
<?
}
2013-04-19 08:00:55 +00:00
if (($UserCount = $Cache->get_value('stats_user_count')) === false) {
2013-07-10 00:08:53 +00:00
$DB->query("
SELECT COUNT(ID)
FROM users_main
WHERE Enabled = '1'");
2011-03-28 14:21:28 +00:00
list($UserCount) = $DB->next_record();
$Cache->cache_value('stats_user_count', $UserCount, 0); //inf cache
}
$UserCount = (int)$UserCount;
?>
2013-03-09 08:00:18 +00:00
<li>Enabled users: <?=number_format($UserCount)?> <a href="stats.php?action=users" class="brackets">Details</a></li>
2011-03-28 14:21:28 +00:00
<?
if (($UserStats = $Cache->get_value('stats_users')) === false) {
2013-07-10 00:08:53 +00:00
$DB->query("
SELECT COUNT(ID)
FROM users_main
WHERE Enabled = '1'
AND LastAccess > '".time_minus(3600 * 24)."'");
2011-03-28 14:21:28 +00:00
list($UserStats['Day']) = $DB->next_record();
2013-07-10 00:08:53 +00:00
$DB->query("
SELECT COUNT(ID)
FROM users_main
WHERE Enabled = '1'
AND LastAccess > '".time_minus(3600 * 24 * 7)."'");
2011-03-28 14:21:28 +00:00
list($UserStats['Week']) = $DB->next_record();
2013-07-10 00:08:53 +00:00
$DB->query("
SELECT COUNT(ID)
FROM users_main
WHERE Enabled = '1'
AND LastAccess > '".time_minus(3600 * 24 * 30)."'");
2011-03-28 14:21:28 +00:00
list($UserStats['Month']) = $DB->next_record();
2013-07-10 00:08:53 +00:00
$Cache->cache_value('stats_users', $UserStats, 0);
2012-10-27 08:00:09 +00:00
}
2011-03-28 14:21:28 +00:00
?>
2013-07-10 00:08:53 +00:00
<li>Users active today: <?=number_format($UserStats['Day'])?> (<?=number_format($UserStats['Day'] / $UserCount * 100, 2)?>%)</li>
<li>Users active this week: <?=number_format($UserStats['Week'])?> (<?=number_format($UserStats['Week'] / $UserCount * 100, 2)?>%)</li>
<li>Users active this month: <?=number_format($UserStats['Month'])?> (<?=number_format($UserStats['Month'] / $UserCount * 100, 2)?>%)</li>
2011-03-28 14:21:28 +00:00
<?
2013-04-19 08:00:55 +00:00
if (($TorrentCount = $Cache->get_value('stats_torrent_count')) === false) {
2013-07-10 00:08:53 +00:00
$DB->query("
SELECT COUNT(ID)
FROM torrents");
2011-03-28 14:21:28 +00:00
list($TorrentCount) = $DB->next_record();
2013-10-26 08:00:58 +00:00
$Cache->cache_value('stats_torrent_count', $TorrentCount, 604800); // staggered 1 week cache
2011-03-28 14:21:28 +00:00
}
2013-04-19 08:00:55 +00:00
if (($AlbumCount = $Cache->get_value('stats_album_count')) === false) {
2013-07-10 00:08:53 +00:00
$DB->query("
SELECT COUNT(ID)
FROM torrents_group
WHERE CategoryID = '1'");
2011-03-28 14:21:28 +00:00
list($AlbumCount) = $DB->next_record();
2013-10-26 08:00:58 +00:00
$Cache->cache_value('stats_album_count', $AlbumCount, 604830); // staggered 1 week cache
2011-03-28 14:21:28 +00:00
}
2013-04-19 08:00:55 +00:00
if (($ArtistCount = $Cache->get_value('stats_artist_count')) === false) {
2013-07-10 00:08:53 +00:00
$DB->query("
SELECT COUNT(ArtistID)
FROM artists_group");
2011-03-28 14:21:28 +00:00
list($ArtistCount) = $DB->next_record();
2013-10-26 08:00:58 +00:00
$Cache->cache_value('stats_artist_count', $ArtistCount, 604860); // staggered 1 week cache
2011-03-28 14:21:28 +00:00
}
if (($PerfectCount = $Cache->get_value('stats_perfect_count')) === false) {
2013-04-19 08:00:55 +00:00
$DB->query("
SELECT COUNT(ID)
FROM torrents
WHERE ((LogScore = 100 AND Format = 'FLAC')
OR (Media = 'Vinyl' AND Format = 'FLAC')
OR (Media = 'WEB' AND Format = 'FLAC')
OR (Media = 'DVD' AND Format = 'FLAC')
OR (Media = 'Soundboard' AND Format = 'FLAC')
)");
2011-03-28 14:21:28 +00:00
list($PerfectCount) = $DB->next_record();
2013-10-26 08:00:58 +00:00
$Cache->cache_value('stats_perfect_count', $PerfectCount, 604890); // staggered 1 week cache
2011-03-28 14:21:28 +00:00
}
?>
<li>Torrents: <?=number_format($TorrentCount)?></li>
<li>Releases: <?=number_format($AlbumCount)?></li>
<li>Artists: <?=number_format($ArtistCount)?></li>
<li>"Perfect" FLACs: <?=number_format($PerfectCount)?></li>
<?
//End Torrent Stats
if (($RequestStats = $Cache->get_value('stats_requests')) === false) {
2013-06-15 08:00:45 +00:00
$DB->query("
SELECT COUNT(ID)
FROM requests");
2011-03-28 14:21:28 +00:00
list($RequestCount) = $DB->next_record();
2013-06-15 08:00:45 +00:00
$DB->query("
SELECT COUNT(ID)
FROM requests
WHERE FillerID > 0");
2011-03-28 14:21:28 +00:00
list($FilledCount) = $DB->next_record();
2013-06-15 08:00:45 +00:00
$Cache->cache_value('stats_requests', array($RequestCount, $FilledCount), 11280);
2011-03-28 14:21:28 +00:00
} else {
2013-07-10 00:08:53 +00:00
list($RequestCount, $FilledCount) = $RequestStats;
2011-03-28 14:21:28 +00:00
}
?>
2013-04-19 08:00:55 +00:00
<li>Requests: <?=number_format($RequestCount)?> (<?=number_format($FilledCount / $RequestCount * 100, 2)?>% filled)</li>
2011-03-28 14:21:28 +00:00
<?
if ($SnatchStats = $Cache->get_value('stats_snatches')) {
?>
<li>Snatches: <?=number_format($SnatchStats)?></li>
<?
}
2013-04-19 08:00:55 +00:00
if (($PeerStats = $Cache->get_value('stats_peers')) === false) {
2011-03-28 14:21:28 +00:00
//Cache lock!
2012-04-24 08:00:23 +00:00
$PeerStatsLocked = $Cache->get_value('stats_peers_lock');
2013-04-19 08:00:55 +00:00
if (!$PeerStatsLocked) {
2012-04-24 08:00:23 +00:00
$Cache->cache_value('stats_peers_lock', 1, 30);
2013-05-27 08:00:58 +00:00
$DB->query("
SELECT IF(remaining=0,'Seeding','Leeching') AS Type, COUNT(uid)
FROM xbt_files_users
2013-07-10 00:08:53 +00:00
WHERE active = 1
2013-05-27 08:00:58 +00:00
GROUP BY Type");
2011-11-09 08:00:14 +00:00
$PeerCount = $DB->to_array(0, MYSQLI_NUM, false);
2012-04-24 08:00:23 +00:00
$SeederCount = $PeerCount['Seeding'][1] ?: 0;
$LeecherCount = $PeerCount['Leeching'][1] ?: 0;
2013-10-26 08:00:58 +00:00
$Cache->cache_value('stats_peers', array($LeecherCount, $SeederCount), 1209600); // 2 week cache
2012-04-24 08:00:23 +00:00
$Cache->delete_value('stats_peers_lock');
2011-03-28 14:21:28 +00:00
}
} else {
2012-04-24 08:00:23 +00:00
$PeerStatsLocked = false;
2013-07-10 00:08:53 +00:00
list($LeecherCount, $SeederCount) = $PeerStats;
2011-03-28 14:21:28 +00:00
}
2013-04-19 08:00:55 +00:00
if (!$PeerStatsLocked) {
2012-10-11 08:00:15 +00:00
$Ratio = Format::get_ratio_html($SeederCount, $LeecherCount);
2012-04-24 08:00:23 +00:00
$PeerCount = number_format($SeederCount + $LeecherCount);
$SeederCount = number_format($SeederCount);
$LeecherCount = number_format($LeecherCount);
} else {
$PeerCount = $SeederCount = $LeecherCount = $Ratio = 'Server busy';
}
2011-03-28 14:21:28 +00:00
?>
2012-04-24 08:00:23 +00:00
<li>Peers: <?=$PeerCount?></li>
<li>Seeders: <?=$SeederCount?></li>
<li>Leechers: <?=$LeecherCount?></li>
2013-04-19 08:00:55 +00:00
<li>Seeder/leecher ratio: <?=$Ratio?></li>
2011-03-28 14:21:28 +00:00
</ul>
</div>
<?
2013-04-19 08:00:55 +00:00
if (($TopicID = $Cache->get_value('polls_featured')) === false) {
2013-05-27 08:00:58 +00:00
$DB->query("
SELECT TopicID
FROM forums_polls
ORDER BY Featured DESC
LIMIT 1");
2011-03-28 14:21:28 +00:00
list($TopicID) = $DB->next_record();
2013-06-15 08:00:45 +00:00
$Cache->cache_value('polls_featured', $TopicID, 0);
2011-03-28 14:21:28 +00:00
}
2013-04-19 08:00:55 +00:00
if ($TopicID) {
2013-10-26 08:00:58 +00:00
if (($Poll = $Cache->get_value("polls_$TopicID")) === false) {
2013-05-27 08:00:58 +00:00
$DB->query("
SELECT Question, Answers, Featured, Closed
FROM forums_polls
2013-06-15 08:00:45 +00:00
WHERE TopicID = '$TopicID'");
2011-03-28 14:21:28 +00:00
list($Question, $Answers, $Featured, $Closed) = $DB->next_record(MYSQLI_NUM, array(1));
$Answers = unserialize($Answers);
2013-05-27 08:00:58 +00:00
$DB->query("
SELECT Vote, COUNT(UserID)
FROM forums_polls_votes
2013-06-15 08:00:45 +00:00
WHERE TopicID = '$TopicID'
2013-05-27 08:00:58 +00:00
AND Vote != '0'
GROUP BY Vote");
2011-03-28 14:21:28 +00:00
$VoteArray = $DB->to_array(false, MYSQLI_NUM);
2012-10-27 08:00:09 +00:00
2011-03-28 14:21:28 +00:00
$Votes = array();
foreach ($VoteArray as $VoteSet) {
2012-10-27 08:00:09 +00:00
list($Key,$Value) = $VoteSet;
2011-03-28 14:21:28 +00:00
$Votes[$Key] = $Value;
}
2012-10-27 08:00:09 +00:00
2011-03-28 14:21:28 +00:00
for ($i = 1, $il = count($Answers); $i <= $il; ++$i) {
if (!isset($Votes[$i])) {
$Votes[$i] = 0;
}
}
2013-07-10 00:08:53 +00:00
$Cache->cache_value("polls_$TopicID", array($Question, $Answers, $Votes, $Featured, $Closed), 0);
2011-03-28 14:21:28 +00:00
} else {
2013-06-15 08:00:45 +00:00
list($Question, $Answers, $Votes, $Featured, $Closed) = $Poll;
2011-03-28 14:21:28 +00:00
}
2012-10-27 08:00:09 +00:00
2011-03-28 14:21:28 +00:00
if (!empty($Votes)) {
$TotalVotes = array_sum($Votes);
$MaxVotes = max($Votes);
} else {
$TotalVotes = 0;
$MaxVotes = 0;
}
2012-10-27 08:00:09 +00:00
2013-05-27 08:00:58 +00:00
$DB->query("
SELECT Vote
FROM forums_polls_votes
2013-07-10 00:08:53 +00:00
WHERE UserID = '".$LoggedUser['ID']."'
AND TopicID = '$TopicID'");
2011-03-28 14:21:28 +00:00
list($UserResponse) = $DB->next_record();
if (!empty($UserResponse) && $UserResponse != 0) {
$Answers[$UserResponse] = '&raquo; '.$Answers[$UserResponse];
}
2012-10-27 08:00:09 +00:00
2011-03-28 14:21:28 +00:00
?>
<div class="box">
2013-04-30 18:18:07 +00:00
<div class="head colhead_dark"><strong>Poll<? if ($Closed) { echo ' [Closed]'; } ?></strong></div>
2011-03-28 14:21:28 +00:00
<div class="pad">
<p><strong><?=display_str($Question)?></strong></p>
<? if ($UserResponse !== null || $Closed) { ?>
<ul class="poll nobullet">
2012-10-16 08:00:18 +00:00
<? foreach ($Answers as $i => $Answer) {
2011-03-28 14:21:28 +00:00
if ($TotalVotes > 0) {
2013-04-19 08:00:55 +00:00
$Ratio = $Votes[$i] / $MaxVotes;
$Percent = $Votes[$i] / $TotalVotes;
2011-03-28 14:21:28 +00:00
} else {
2013-04-19 08:00:55 +00:00
$Ratio = 0;
$Percent = 0;
2012-10-27 08:00:09 +00:00
}
2013-06-15 08:00:45 +00:00
?> <li><?=display_str($Answers[$i])?> (<?=number_format($Percent * 100, 2)?>%)</li>
2011-03-28 14:21:28 +00:00
<li class="graph">
<span class="left_poll"></span>
2013-04-19 08:00:55 +00:00
<span class="center_poll" style="width: <?=round($Ratio * 140)?>px;"></span>
2011-03-28 14:21:28 +00:00
<span class="right_poll"></span>
<br />
</li>
<? } ?>
</ul>
<strong>Votes:</strong> <?=number_format($TotalVotes)?><br />
<? } else { ?>
2012-09-15 08:00:25 +00:00
<div id="poll_container">
<form class="vote_form" name="poll" id="poll" action="">
2012-09-19 08:00:35 +00:00
<input type="hidden" name="action" value="poll" />
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
2011-03-28 14:21:28 +00:00
<input type="hidden" name="topicid" value="<?=$TopicID?>" />
2012-10-16 08:00:18 +00:00
<? foreach ($Answers as $i => $Answer) { ?>
2011-03-28 14:21:28 +00:00
<input type="radio" name="vote" id="answer_<?=$i?>" value="<?=$i?>" />
<label for="answer_<?=$i?>"><?=display_str($Answers[$i])?></label><br />
<? } ?>
2013-06-15 08:00:45 +00:00
<br /><input type="radio" name="vote" id="answer_0" value="0" /> <label for="answer_0">Blank&#8202;&mdash;&#8202;Show the results!</label><br /><br />
2013-07-10 00:08:53 +00:00
<input type="button" onclick="ajax.post('index.php', 'poll', function(response) { $('#poll_container').raw().innerHTML = response } );" value="Vote" />
2011-03-28 14:21:28 +00:00
</form>
</div>
<? } ?>
<br /><strong>Topic:</strong> <a href="forums.php?action=viewthread&amp;threadid=<?=$TopicID?>">Visit</a>
</div>
</div>
<?
}
//polls();
?>
</div>
<div class="main_column">
<?
$Recommend = $Cache->get_value('recommend');
$Recommend_artists = $Cache->get_value('recommend_artists');
if (!is_array($Recommend) || !is_array($Recommend_artists)) {
2013-04-19 08:00:55 +00:00
$DB->query("
SELECT
tr.GroupID,
tr.UserID,
u.Username,
tg.Name,
tg.TagList
2011-03-28 14:21:28 +00:00
FROM torrents_recommended AS tr
2013-07-10 00:08:53 +00:00
JOIN torrents_group AS tg ON tg.ID = tr.GroupID
LEFT JOIN users_main AS u ON u.ID = tr.UserID
2013-04-19 08:00:55 +00:00
ORDER BY tr.Time DESC
LIMIT 10");
2011-03-28 14:21:28 +00:00
$Recommend = $DB->to_array();
2013-06-15 08:00:45 +00:00
$Cache->cache_value('recommend', $Recommend, 1209600);
2012-10-27 08:00:09 +00:00
2012-10-11 08:00:15 +00:00
$Recommend_artists = Artists::get_artists($DB->collect('GroupID'));
2013-06-15 08:00:45 +00:00
$Cache->cache_value('recommend_artists', $Recommend_artists, 1209600);
2011-03-28 14:21:28 +00:00
}
if (count($Recommend) >= 4) {
$Cache->increment('usage_index');
?>
<div class="box" id="recommended">
<div class="head colhead_dark">
2013-03-02 08:00:34 +00:00
<strong>Latest Vanity House additions</strong>
2013-06-17 08:01:02 +00:00
<a href="#" onclick="$('#vanityhouse').gtoggle(); this.innerHTML = (this.innerHTML == 'Hide' ? 'Show' : 'Hide'); return false;" class="brackets">Show</a>
2011-03-28 14:21:28 +00:00
</div>
2012-09-01 08:00:24 +00:00
<table class="torrent_table hidden" id="vanityhouse">
2011-03-28 14:21:28 +00:00
<?
2013-04-19 08:00:55 +00:00
foreach ($Recommend as $Recommendations) {
2012-02-05 08:00:20 +00:00
list($GroupID, $UserID, $Username, $GroupName, $TagList) = $Recommendations;
$TagsStr = '';
if ($TagList) {
// No vanity.house tag.
2012-03-04 08:00:21 +00:00
$Tags = explode(' ', str_replace('_', '.', $TagList));
2012-02-05 08:00:20 +00:00
$TagLinks = array();
foreach ($Tags as $Tag) {
2012-03-04 08:00:21 +00:00
if ($Tag == 'vanity.house') {
continue;
}
2012-09-09 08:00:26 +00:00
$TagLinks[] = "<a href=\"torrents.php?action=basic&amp;taglist=$Tag\">$Tag</a> ";
2012-02-05 08:00:20 +00:00
}
$TagStr = "<br />\n<div class=\"tags\">".implode(', ', $TagLinks).'</div>';
}
2011-03-28 14:21:28 +00:00
?>
<tr>
2012-02-05 08:00:20 +00:00
<td>
2012-10-11 08:00:15 +00:00
<?=Artists::display_artists($Recommend_artists[$GroupID]) ?>
<a href="torrents.php?id=<?=$GroupID?>"><?=$GroupName?></a> (by <?=Users::format_username($UserID, false, false, false)?>)
2012-02-05 08:00:20 +00:00
<?=$TagStr?>
</td>
2011-03-28 14:21:28 +00:00
</tr>
2013-04-19 08:00:55 +00:00
<? } ?>
2011-03-28 14:21:28 +00:00
</table>
</div>
<!-- END recommendations section -->
<?
}
$Count = 0;
foreach ($News as $NewsItem) {
2013-07-10 00:08:53 +00:00
list($NewsID, $Title, $Body, $NewsTime) = $NewsItem;
2011-03-28 14:21:28 +00:00
if (strtotime($NewsTime) > time()) {
continue;
}
?>
2013-11-10 08:00:49 +00:00
<div id="news<?=$NewsID?>" class="box news_post">
2011-03-28 14:21:28 +00:00
<div class="head">
<strong><?=$Text->full_format($Title)?></strong> <?=time_diff($NewsTime);?>
2013-04-19 08:00:55 +00:00
<? if (check_perms('admin_manage_news')) { ?>
2013-02-09 08:01:01 +00:00
- <a href="tools.php?action=editnews&amp;id=<?=$NewsID?>" class="brackets">Edit</a>
2013-04-19 08:00:55 +00:00
<? } ?>
2013-09-05 08:00:49 +00:00
<span style="float: right;"><a href="#" onclick="$('#newsbody<?=$NewsID?>').gtoggle(); this.innerHTML = (this.innerHTML == 'Hide' ? 'Show' : 'Hide'); return false;" class="brackets">Hide</a></span>
2011-03-28 14:21:28 +00:00
</div>
2013-06-14 08:18:16 +00:00
<div id="newsbody<?=$NewsID?>" class="pad"><?=$Text->full_format($Body)?></div>
2011-03-28 14:21:28 +00:00
</div>
<?
2013-06-15 08:00:45 +00:00
if (++$Count > ($NewsCount - 1)) {
2011-03-28 14:21:28 +00:00
break;
}
}
?>
<div id="more_news" class="box">
<div class="head">
2013-08-28 23:08:41 +00:00
<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&amp;forumid=19">click here</a>.</em>
2011-03-28 14:21:28 +00:00
</div>
</div>
</div>
</div>
<?
2012-10-11 08:00:15 +00:00
View::show_footer(array('disclaimer'=>true));
2011-03-28 14:21:28 +00:00
function contest() {
global $DB, $Cache, $LoggedUser;
list($Contest, $TotalPoints) = $Cache->get_value('contest');
2013-04-19 08:00:55 +00:00
if (!$Contest) {
$DB->query("
SELECT
UserID,
SUM(Points),
Username
2011-03-28 14:21:28 +00:00
FROM users_points AS up
2013-07-10 00:08:53 +00:00
JOIN users_main AS um ON um.ID = up.UserID
2012-10-27 08:00:09 +00:00
GROUP BY UserID
ORDER BY SUM(Points) DESC
2011-03-28 14:21:28 +00:00
LIMIT 20");
$Contest = $DB->to_array();
2012-10-27 08:00:09 +00:00
2013-07-10 00:08:53 +00:00
$DB->query("
SELECT SUM(Points)
FROM users_points");
2011-03-28 14:21:28 +00:00
list($TotalPoints) = $DB->next_record();
2012-10-27 08:00:09 +00:00
2013-07-10 00:08:53 +00:00
$Cache->cache_value('contest', array($Contest, $TotalPoints), 600);
2011-03-28 14:21:28 +00:00
}
?>
<!-- Contest Section -->
2012-08-17 08:00:13 +00:00
<div class="box box_contest">
2011-03-28 14:21:28 +00:00
<div class="head colhead_dark"><strong>Quality time scoreboard</strong></div>
<div class="pad">
2013-04-19 08:00:55 +00:00
<ol style="padding-left: 5px;">
2011-03-28 14:21:28 +00:00
<?
foreach ($Contest as $User) {
list($UserID, $Points, $Username) = $User;
?>
2012-10-11 08:00:15 +00:00
<li><?=Users::format_username($UserID, false, false, false)?> (<?=number_format($Points)?>)</li>
2013-07-10 00:08:53 +00:00
<? } ?>
2011-03-28 14:21:28 +00:00
</ol>
Total uploads: <?=$TotalPoints?><br />
<a href="index.php?action=scoreboard">Full scoreboard</a>
</div>
</div>
<!-- END contest Section -->
2013-09-05 08:00:49 +00:00
<?
} // contest()
2011-03-28 14:21:28 +00:00
?>