// We need these to do our rankification include(SERVER_ROOT.'/sections/torrents/ranking_funcs.php'); $UserVotes = Votes::get_user_votes($LoggedUser['ID']); if (!empty($_GET['advanced']) && check_perms('site_advanced_top10')) { $Details = 'all'; $Limit = 25; if (!empty($_GET['tags'])) { $TagsAny = isset($_GET['anyall']) && $_GET['anyall'] === 'any'; $Tags = explode(',', str_replace('.', '_', trim($_GET['tags']))); foreach ($Tags as $Tag) { $Tag = preg_replace('/[^a-z0-9_]/', '', $Tag); if ($Tag != '') { $TagWhere[] = "g.TagList REGEXP '[[:<:]]".db_string($Tag)."[[:>:]]'"; } } $Operator = $TagsAny ? ' OR ' : ' AND '; $Where[] = '('.implode($Operator, $TagWhere).')'; } $Year1 = (int)$_GET['year1']; $Year2 = (int)$_GET['year2']; if ($Year1 > 0 && $Year2 <= 0) { $Where[] = "g.Year = $Year1"; } elseif ($Year1 > 0 && $Year2 > 0) { $Where[] = "g.Year BETWEEN $Year1 AND $Year2"; } elseif ($Year2 > 0 && $Year1 <= 0) { $Where[] = "g.Year <= $Year2"; } } else { $Details = 'all'; // defaults to 10 (duh) $Limit = isset($_GET['limit']) ? intval($_GET['limit']) : 25; $Limit = in_array($Limit, array(25, 100, 250)) ? $Limit : 25; } $Filtered = !empty($Where); if (!empty($Where)) { $Where = implode(' AND ', $Where); } $WhereSum = (empty($Where)) ? '' : md5($Where); // Unlike the other top 10s, this query just gets some raw stats // We'll need to do some fancy-pants stuff to translate it into // BPCI scores before getting the torrent data $Query = ' SELECT v.GroupID, v.Ups, v.Total, v.Score FROM torrents_votes AS v'; if (!empty($Where)) { $Query .= " JOIN torrents_group AS g ON g.ID = v.GroupID WHERE $Where AND "; } else { $Query .= ' WHERE '; } $Query .= " Score > 0 ORDER BY Score DESC LIMIT $Limit"; $TopVotes = $Cache->get_value('top10votes_'.$Limit.$WhereSum); if ($TopVotes === false) { if ($Cache->get_query_lock('top10votes')) { $DB->query($Query); $Results = $DB->to_array('GroupID', MYSQLI_ASSOC, false); $Ranks = Votes::calc_ranks($DB->to_pair('GroupID', 'Score', false)); $Groups = Torrents::get_groups(array_keys($Results)); $TopVotes = array(); foreach ($Results as $GroupID => $Votes) { $TopVotes[$GroupID] = $Groups[$GroupID]; $TopVotes[$GroupID]['Ups'] = $Votes['Ups']; $TopVotes[$GroupID]['Total'] = $Votes['Total']; $TopVotes[$GroupID]['Score'] = $Votes['Score']; $TopVotes[$GroupID]['Rank'] = $Ranks[$GroupID]; } $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'); ?>
Torrents | Size | ![]() |
||||
Server is busy processing another top list request. Please try again in a minute. | ||||||
No torrents were found that meet your criteria. |