Gazelle/sections/user/community_stats.php

1 line
10 KiB
PHP
Raw Normal View History

2012-10-03 08:00:16 +00:00
<? // 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(); ?> <div class="box box_info box_userinfo_community"> <div class="head colhead_dark">Community</div> <ul class="stats nobullet"> <li>Forum Posts: <?=number_format($ForumPosts)?> [<a href="userhistory.php?action=posts&amp;userid=<?=$UserID?>" title="View">View</a>]</li> <? if (($Override=check_paranoia_here('torrentcomments+'))) { ?> <li <?= $Override===2 ? 'class="paranoia_override"' : ''?> >Torrent Comments: <?=number_format($NumComments)?> <? if($Override=check_paranoia_here('torrentcomments')) { ?>[<a href="comments.php?id=<?=$UserID?>" <?= $Override===2 ? 'class="paranoia_override"' : '' ?> title="View">View</a>] <? } ?> </li> <? } if (($Override=check_paranoia_here('collages+'))) { ?> <li <?= $Override===2 ? 'class="paranoia_override"' : ''?> >Collages Started: <?=number_format($NumCollages)?> <? if(($Override=check_paranoia_here('collages'))) { ?>[<a <?= ($Override===2) ? 'class="paranoia_override"' :'' ?> href="collages.php?userid=<?=$UserID?>" title="View">View</a>] <? } ?> </li> <? } if (($Override=check_paranoia_here('collagecontribs+'))) { ?> <li <?= $Override===2 ? 'class="paranoia_override"' : ''?> >Collages contributed to: <? echo number_format($NumCollageContribs); if (($Override=check_paranoia_here('collagecontribs'))) { ?> [<a <?= ($Override===2) ? 'class="paranoia_override"' : ''?> href="collages.php?userid=<?=$UserID?>&amp;contrib=1" title="View">View</a>] <? } ?> </li> <? } //Let's see if we can view requests because of reasons $ViewAll = check_paranoia_here('requestsfilled_list'); $ViewCount = check_paranoia_here('requestsfilled_count'); $ViewBounty = check_paranoia_here('requestsfilled_bounty'); if ($ViewCount && !$ViewBounty && !$ViewAll) { ?> <li>Requests Filled: <?=number_format($RequestsFilled)?></li> <? } elseif(!$ViewCount && $ViewBounty && !$ViewAll) { ?> <li>Requests Voted: <?=get_size($TotalSpent)?> collected</li> <? } elseif($ViewCount && $ViewBounty && !$ViewAll) { ?> <li>Requests Filled: <?=number_format($RequestsFilled)?> for <?=get_size($TotalBounty)?></li> <? } elseif($ViewAll) { ?> <li> <span <?= ($ViewCount===2) ? 'class="paranoia_override"' : ''?> >Requests filled: <?=number_format($RequestsFilled)?> </span> <span <?= ($ViewBounty===2) ? 'class="paranoia_override"' : ''?>> for <?=get_size($TotalBounty) ?> </span> [<a href="requests.php?type=fill