$Cache->cache_value('top10votes_' . $Limit . $WhereSum, $TopVotes, 60 * 30); $Cache->clear_query_lock('top10votes'); } else { $TopVotes = false; } } View::show_header("Top {$Limit} Voted Groups", 'browse,voting'); ?> <div class="thin"> <div class="header"> <h2>Top <?php echo $Limit; ?> Voted Groups</h2> <?php Top10View::render_linkbox("votes"); ?> </div> <?php if (check_perms('site_advanced_top10')) { ?> <form class="search_form" name="votes" action="" method="get"> <input type="hidden" name="advanced" value="1" /> <input type="hidden" name="type" value="votes" /> <table cellpadding="6" cellspacing="1" border="0" class="layout border" width="100%"> <tr id="tagfilter"> <td class="label">Tags (comma-separated):</td> <td class="ft_taglist"> <input type="text" name="tags" size="75" value="<?php if (!empty($_GET['tags'])) { echo display_str($_GET['tags']);
if (isset($_GET['details'])) { if (in_array($_GET['details'], array('ul', 'dl', 'numul', 'uls', 'dls'))) { $Details = $_GET['details']; } else { error(404); } } else { $Details = 'all'; } View::show_header('Top 10 Users'); ?> <div class="thin"> <div class="header"> <h2>Top 10 Users</h2> <?php Top10View::render_linkbox("users"); ?> </div> <?php // defaults to 10 (duh) $Limit = isset($_GET['limit']) ? intval($_GET['limit']) : 10; $Limit = in_array($Limit, array(10, 100, 250)) ? $Limit : 10; $BaseQuery = "\n\tSELECT\n\t\tu.ID,\n\t\tui.JoinDate,\n\t\tu.Uploaded,\n\t\tu.Downloaded,\n\t\tABS(u.Uploaded-524288000) / (" . time() . " - UNIX_TIMESTAMP(ui.JoinDate)) AS UpSpeed,\n\t\tu.Downloaded / (" . time() . " - UNIX_TIMESTAMP(ui.JoinDate)) AS DownSpeed,\n\t\tCOUNT(t.ID) AS NumUploads\n\tFROM users_main AS u\n\t\tJOIN users_info AS ui ON ui.UserID = u.ID\n\t\tLEFT JOIN torrents AS t ON t.UserID=u.ID\n\tWHERE u.Enabled='1'\n\t\tAND Uploaded>'" . 5 * 1024 * 1024 * 1024 . "'\n\t\tAND Downloaded>'" . 5 * 1024 * 1024 * 1024 . "'\n\t\tAND (Paranoia IS NULL OR (Paranoia NOT LIKE '%\"uploaded\"%' AND Paranoia NOT LIKE '%\"downloaded\"%'))\n\tGROUP BY u.ID"; if ($Details == 'all' || $Details == 'ul') { if (!($TopUserUploads = $Cache->get_value('topuser_ul_' . $Limit))) { $DB->query("{$BaseQuery} ORDER BY u.Uploaded DESC LIMIT {$Limit};"); $TopUserUploads = $DB->to_array(); $Cache->cache_value('topuser_ul_' . $Limit, $TopUserUploads, 3600 * 12); } generate_user_table('Uploaders', 'ul', $TopUserUploads, $Limit);
if (isset($_GET['details'])) { if (in_array($_GET['details'], array('ut', 'ur', 'v'))) { $Details = $_GET['details']; } else { error(404); } } else { $Details = 'all'; } View::show_header('Top 10 Tags'); ?> <div class="thin"> <div class="header"> <h2>Top 10 Tags</h2> <?php Top10View::render_linkbox("tags"); ?> </div> <?php // defaults to 10 (duh) $Limit = isset($_GET['limit']) ? intval($_GET['limit']) : 10; $Limit = in_array($Limit, array(10, 100, 250)) ? $Limit : 10; if ($Details == 'all' || $Details == 'ut') { if (!($TopUsedTags = $Cache->get_value('topusedtag_' . $Limit))) { $DB->query("\n\t\t\tSELECT\n\t\t\t\tt.ID,\n\t\t\t\tt.Name,\n\t\t\t\tCOUNT(tt.GroupID) AS Uses,\n\t\t\t\tSUM(tt.PositiveVotes-1) AS PosVotes,\n\t\t\t\tSUM(tt.NegativeVotes-1) AS NegVotes\n\t\t\tFROM tags AS t\n\t\t\t\tJOIN torrents_tags AS tt ON tt.TagID=t.ID\n\t\t\tGROUP BY tt.TagID\n\t\t\tORDER BY Uses DESC\n\t\t\tLIMIT {$Limit}"); $TopUsedTags = $DB->to_array(); $Cache->cache_value('topusedtag_' . $Limit, $TopUsedTags, 3600 * 12); } generate_tag_table('Most Used Torrent Tags', 'ut', $TopUsedTags, $Limit); }
<?php View::show_header('Top 10 Donors'); ?> <div class="thin"> <div class="header"> <h2>Top Donors</h2> <?php Top10View::render_linkbox("donors"); ?> </div> <?php $Limit = isset($_GET['limit']) ? intval($_GET['limit']) : 10; $Limit = in_array($Limit, array(10, 100, 250)) ? $Limit : 10; $IsMod = check_perms("users_mod"); $DB->query("\n\tSELECT\n\t\tUserID, TotalRank, Rank, SpecialRank, DonationTime, Hidden\n\tFROM users_donor_ranks\n\tWHERE TotalRank > 0\n\tORDER BY TotalRank DESC\n\tLIMIT {$Limit}"); $Results = $DB->to_array(); generate_user_table('Top Donors', $Results, $Limit); echo '</div>'; View::show_footer(); // generate a table based on data from most recent query to $DB function generate_user_table($Caption, $Results, $Limit) { global $Time, $IsMod; ?> <h3>Top <?php echo "{$Limit} {$Caption}"; ?> <small class="top10_quantity_links"> <?php switch ($Limit) {
case 'weekly': $Artists = json_decode(LastFM::get_weekly_artists(LIMIT), true)['artists']['artist']; break; case 'hyped': $Artists = json_decode(LastFM::get_hyped_artists(LIMIT), true)['artists']['artist']; break; default: break; } View::show_header("Last.fm", "jquery.imagesloaded,jquery.wookmark,top10", "tiles"); ?> <div class="thin"> <div class="header"> <h2>Last.fm</h2> <?php Top10View::render_linkbox("lastfm"); ?> </div> <?php Top10View::render_artist_links($Category, $View); Top10View::render_artist_controls($Category, $View); if ($View == 'tiles') { ?> <div class="tiles_container"> <ul class="tiles"> <?php foreach ($Artists as $Artist) { Top10View::render_artist_tile($Artist, $Category); } ?> </ul>
<?php if (!check_perms('users_mod')) { error(404); } // if (!check_perms('site_top10_history')) { // error(403); // } View::show_header('Top 10 Torrents history!'); ?> <div class="thin"> <div class="header"> <h2>Top 10 Torrents</h2> <?php Top10View::render_linkbox(); ?> </div> <div class="pad box"> <form class="search_form" name="top10" method="get" action=""> <input type="hidden" name="type" value="history" /> <h3>Search for a date! (After 2010-09-05)</h3> <table class="layout"> <tr> <td class="label">Date:</td> <td><input type="text" id="date" name="date" value="<?php echo !empty($_GET['date']) ? display_str($_GET['date']) : 'YYYY-MM-DD'; ?> " onfocus="if ($('#date').raw().value == 'YYYY-MM-DD') { $('#date').raw().value = ''; }" /></td> </tr> <tr> <td class="label">Type:</td>
} // defaults to 10 (duh) $Limit = isset($_GET['limit']) ? intval($_GET['limit']) : 10; $Limit = in_array($Limit, array(10, 100, 250)) ? $Limit : 10; } $Filtered = !empty($Where); View::show_header("Top {$Limit} Torrents"); ?> <div class="thin"> <div class="header"> <h2>Top <?php echo $Limit; ?> Torrents</h2> <?php Top10View::render_linkbox("torrents"); ?> </div> <?php if (check_perms('site_advanced_top10')) { ?> <form class="search_form" name="torrents" action="" method="get"> <input type="hidden" name="advanced" value="1" /> <table cellpadding="6" cellspacing="1" border="0" class="layout border" width="100%"> <tr id="tagfilter"> <td class="label">Tags (comma-separated):</td> <td class="ft_taglist"> <input type="text" name="tags" id="tags" size="75" value="<?php if (!empty($_GET['tags'])) { echo display_str($_GET['tags']); }