if (check_perms('users_mod', $Class) || check_perms('users_view_ips',$Class) || check_perms('users_view_keys',$Class)) {
$DB->query("SELECT COUNT(*) FROM users_history_passwords WHERE UserID='$UserID'");
list($PasswordChanges) = $DB->next_record();
if (check_perms('users_view_keys',$Class)) {
$DB->query("SELECT COUNT(*) FROM users_history_passkeys WHERE UserID='$UserID'");
list($PasskeyChanges) = $DB->next_record();
}
if (check_perms('users_view_ips',$Class)) {
$DB->query("SELECT COUNT(DISTINCT IP) FROM users_history_ips WHERE UserID='$UserID'");
list($IPChanges) = $DB->next_record();
$DB->query("SELECT COUNT(DISTINCT IP) FROM xbt_snatched WHERE uid='$UserID' AND IP != ''");
list($TrackerIPs) = $DB->next_record();
}
if (check_perms('users_view_email',$Class)) {
$DB->query("SELECT COUNT(*) FROM users_history_emails WHERE UserID='$UserID'");
list($EmailChanges) = $DB->next_record();
}
?>
// These stats used to be all together in one UNION'd query
// But we broke them up because they had a habit of locking each other to death.
// They all run really quickly anyways.
$DB->query("SELECT COUNT(x.uid), COUNT(DISTINCT x.fid) FROM xbt_snatched AS x INNER JOIN torrents AS t ON t.ID=x.fid WHERE x.uid='$UserID'");
list($Snatched, $UniqueSnatched) = $DB->next_record();
$DB->query("SELECT COUNT(ID) FROM torrents_comments WHERE AuthorID='$UserID'");
list($NumComments) = $DB->next_record();
$DB->query("SELECT COUNT(ID) FROM collages WHERE Deleted='0' AND UserID='$UserID'");
list($NumCollages) = $DB->next_record();
$DB->query("SELECT COUNT(DISTINCT CollageID) FROM collages_torrents AS ct JOIN collages ON CollageID = ID WHERE Deleted='0' AND ct.UserID='$UserID'");
list($NumCollageContribs) = $DB->next_record();
$DB->query("SELECT COUNT(DISTINCT GroupID) FROM torrents WHERE UserID = '$UserID'");
list($UniqueGroups) = $DB->next_record();
$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') OR (Media = 'Cassette' AND Format = 'FLAC') OR (Media = 'SACD' AND Format = 'FLAC') OR (Media = 'Blu-ray' AND Format = 'FLAC') OR (Media = 'DAT' AND Format = 'FLAC')) AND UserID = '$UserID'");
list($PerfectFLACs) = $DB->next_record();
?>
} ?>
if (check_paranoia_here('seeding+')) {
$DB->query("SELECT COUNT(x.uid) FROM xbt_files_users AS x INNER JOIN torrents AS t ON t.ID=x.fid WHERE x.uid='$UserID' AND x.remaining=0");
list($Seeding) = $DB->next_record();
}
if (check_paranoia_here('leeching+')) {
$DB->query("SELECT COUNT(x.uid) FROM xbt_files_users AS x INNER JOIN torrents AS t ON t.ID=x.fid WHERE x.uid='$UserID' AND x.remaining>0");
list($Leeching) = $DB->next_record();
}
?>
if (check_paranoia_here('seeding')) { ?>
Seeding: =number_format($Seeding)?> [View] if (check_perms('zip_downloader')) { ?> [Download] } ?>
}
if(check_perms('site_view_torrent_snatchlist', $Class)) {
$DB->query("SELECT COUNT(ud.UserID), COUNT(DISTINCT ud.TorrentID) FROM users_downloads AS ud INNER JOIN torrents AS t ON t.ID=ud.TorrentID WHERE ud.UserID='$UserID'");
list($NumDownloads, $UniqueDownloads) = $DB->next_record();
?>
This user is currently on ratio watch, and must upload =get_size(($Downloaded*$RequiredRatio)-$Uploaded)?> in the next =time_diff($RatioWatchEnds)?>, or their leeching privileges will be revoked. Amount downloaded while on ratio watch: =get_size($Downloaded-$RatioWatchDownload)?>
} ?>
Profile if ($CustomTitle) { echo " - ".html_entity_decode($CustomTitle); } ?>=$Badges?>
if (!$Info) { ?>
This profile is currently empty.
} else {
echo $Text->full_format($Info);
}
?>
if ($Snatched > 4 && check_paranoia_here('snatched')) {
$RecentSnatches = $Cache->get_value('recent_snatches_'.$UserID);
if(!is_array($RecentSnatches)){
$DB->query("SELECT
g.ID,
g.Name,
g.WikiImage
FROM xbt_snatched AS s
INNER JOIN torrents AS t ON t.ID=s.fid
INNER JOIN torrents_group AS g ON t.GroupID=g.ID
WHERE s.uid='$UserID'
AND g.CategoryID='1'
AND g.WikiImage <> ''
GROUP BY g.ID
ORDER BY s.tstamp DESC
LIMIT 5");
$RecentSnatches = $DB->to_array();
$Artists = get_artists($DB->collect('ID'));
foreach($RecentSnatches as $Key => $SnatchInfo) {
$RecentSnatches[$Key]['Artist'] = display_artists($Artists[$SnatchInfo['ID']], false, true);
}
$Cache->cache_value('recent_snatches_'.$UserID, $RecentSnatches, 0); //inf cache
}
?>
Recent Snatches
foreach($RecentSnatches as $RS) { ?>
} ?>
}
if(!isset($Uploads)) { $Uploads = 0; }
if ($Uploads > 4 && check_paranoia_here('uploads')) {
$RecentUploads = $Cache->get_value('recent_uploads_'.$UserID);
if(!is_array($RecentUploads)){
$DB->query("SELECT
g.ID,
g.Name,
g.WikiImage
FROM torrents_group AS g
INNER JOIN torrents AS t ON t.GroupID=g.ID
WHERE t.UserID='$UserID'
AND g.CategoryID='1'
AND g.WikiImage <> ''
GROUP BY g.ID
ORDER BY t.Time DESC
LIMIT 5");
$RecentUploads = $DB->to_array();
$Artists = get_artists($DB->collect('ID'));
foreach($RecentUploads as $Key => $UploadInfo) {
$RecentUploads[$Key]['Artist'] = display_artists($Artists[$UploadInfo['ID']], false, true);
}
$Cache->cache_value('recent_uploads_'.$UserID, $RecentUploads, 0); //inf cache
}
?>
Recent Uploads
foreach($RecentUploads as $RU) { ?>
} ?>
}
$DB->query("SELECT ID, Name FROM collages WHERE UserID='$UserID' AND CategoryID='0' AND Deleted='0'");
list($CollageID, $Name) = $DB->next_record();
if($CollageID) {
$DB->query("SELECT ct.GroupID,
tg.WikiImage,
tg.CategoryID
FROM collages_torrents AS ct
JOIN torrents_group AS tg ON tg.ID=ct.GroupID
WHERE ct.CollageID='$CollageID'
ORDER BY ct.Sort LIMIT 5");
$Collage = $DB->to_array();
?>
}
// Requests
if (check_paranoia_here('requestsvoted_list')) {
$DB->query("SELECT
r.ID,
r.CategoryID,
r.Title,
r.Year,
r.TimeAdded,
COUNT(rv.UserID) AS Votes,
SUM(rv.Bounty) AS Bounty
FROM requests AS r
LEFT JOIN users_main AS u ON u.ID=UserID
LEFT JOIN requests_votes AS rv ON rv.RequestID=r.ID
WHERE r.UserID = ".$UserID."
AND r.TorrentID = 0
GROUP BY r.ID
ORDER BY Votes DESC");
if($DB->record_count() > 0) {
$Requests = $DB->to_array();
?>