Esempio n. 1
0
<?php

function compare($X, $Y)
{
    return $Y['count'] - $X['count'];
}
// Build the data for the collage and the torrent list
// TODO: Cache this
$DB->query("\n\tSELECT\n\t\tct.GroupID,\n\t\tct.UserID\n\tFROM collages_torrents AS ct\n\t\tJOIN torrents_group AS tg ON tg.ID = ct.GroupID\n\tWHERE ct.CollageID = '{$CollageID}'\n\tORDER BY ct.Sort");
$GroupIDs = $DB->collect('GroupID');
$Contributors = $DB->to_pair('GroupID', 'UserID', false);
if (count($GroupIDs) > 0) {
    $TorrentList = Torrents::get_groups($GroupIDs);
    $UserVotes = Votes::get_user_votes($LoggedUser['ID']);
} else {
    $TorrentList = array();
}
// Loop through the result set, building up $Collage and $TorrentTable
// Then we print them.
$Collage = array();
$TorrentTable = '';
$NumGroups = count($TorrentList);
$NumGroupsByUser = 0;
$TopArtists = array();
$UserAdditions = array();
$Number = 0;
foreach ($GroupIDs as $GroupID) {
    if (!isset($TorrentList[$GroupID])) {
        continue;
    }
    $Group = $TorrentList[$GroupID];