/*
User collage subscription page
*/
if (!check_perms('site_collages_subscribe')) {
error(403);
}
View::show_header('Subscribed collages','browse,collage');
$ShowAll = !empty($_GET['showall']);
if (!$ShowAll) {
$sql = "
SELECT
c.ID,
c.Name,
c.NumTorrents,
s.LastVisit
FROM collages AS c
JOIN users_collage_subs AS s ON s.CollageID = c.ID
JOIN collages_torrents AS ct ON ct.CollageID = c.ID
WHERE s.UserID = $LoggedUser[ID] AND c.Deleted = '0'
AND ct.AddedOn > s.LastVisit
GROUP BY c.ID";
} else {
$sql = "
SELECT
c.ID,
c.Name,
c.NumTorrents,
s.LastVisit
FROM collages AS c
JOIN users_collage_subs AS s ON s.CollageID = c.ID
LEFT JOIN collages_torrents AS ct ON ct.CollageID = c.ID
WHERE s.UserID = $LoggedUser[ID] AND c.Deleted = '0'
GROUP BY c.ID";
}
$DB->query($sql);
$NumResults = $DB->record_count();
$CollageSubs = $DB->to_array();
?>
if (!$NumResults) {
?>
No subscribed collages=($ShowAll ? '' : ' with new additions')?>
} else {
$HideGroup = '';
$ActionTitle = 'Hide';
$ActionURL = 'hide';
$ShowGroups = 0;
foreach ($CollageSubs as $Collage) {
unset($TorrentTable);
list($CollageID, $CollageName, $CollageSize, $LastVisit) = $Collage;
$RS = $DB->query("
SELECT GroupID
FROM collages_torrents
WHERE CollageID = $CollageID
AND AddedOn > '" . db_string($LastVisit) . "'
ORDER BY AddedOn");
$NewTorrentCount = $DB->record_count();
$GroupIDs = $DB->collect('GroupID', false);
if (count($GroupIDs) > 0) {
$TorrentList = Torrents::get_groups($GroupIDs);
} else {
$TorrentList = array();
}
$Artists = Artists::get_artists($GroupIDs);
$Number = 0;
foreach ($GroupIDs as $GroupID) {
if (!isset($TorrentList[$GroupID])) {
continue;
}
$Group = $TorrentList[$GroupID];
extract(Torrents::array_group($Group));
$DisplayName = '';
$TorrentTags = new Tags($TagList);
if (!empty($ExtendedArtists[1]) || !empty($ExtendedArtists[4]) || !empty($ExtendedArtists[5]) || !empty($ExtendedArtists[6])) {
unset($ExtendedArtists[2]);
unset($ExtendedArtists[3]);
$DisplayName .= Artists::display_artists($ExtendedArtists);
} elseif (count($Artists) > 0) {
$DisplayName .= Artists::display_artists(array('1' => $Artists));
}
$DisplayName .= "
$GroupName";
if ($GroupYear > 0) {
$DisplayName = "$DisplayName [$GroupYear]";
}
if ($GroupVanityHouse) {
$DisplayName .= ' [
VH]';
}
$SnatchedGroupClass = $GroupFlags['IsSnatched'] ? ' snatched_group' : '';
// Start an output buffer, so we can store this output in $TorrentTable
ob_start();
if (count($Torrents) > 1 || $GroupCategoryID == 1) {
?>
|
if ($LoggedUser['CoverArt']) { ?>
ImageTools::cover_thumb($WikiImage, $GroupCategoryID) ?>
} ?>
=$DisplayName?>
=$TorrentTags->format()?>
|
$LastRemasterYear = '-';
$LastRemasterTitle = '';
$LastRemasterRecordLabel = '';
$LastRemasterCatalogueNumber = '';
$LastMedia = '';
$EditionID = 0;
unset($FirstUnknown);
foreach ($Torrents as $TorrentID => $Torrent) {
if ($Torrent['Remastered'] && !$Torrent['RemasterYear']) {
$FirstUnknown = !isset($FirstUnknown);
}
$SnatchedTorrentClass = $Torrent['IsSnatched'] ? ' snatched_torrent' : '';
if ($Torrent['RemasterTitle'] != $LastRemasterTitle
|| $Torrent['RemasterYear'] != $LastRemasterYear
|| $Torrent['RemasterRecordLabel'] != $LastRemasterRecordLabel
|| $Torrent['RemasterCatalogueNumber'] != $LastRemasterCatalogueNumber
|| $FirstUnknown
|| $Torrent['Media'] != $LastMedia
) {
$EditionID++;
?>
− =Torrents::edition_string($Torrent, $Group)?> |
}
$LastRemasterTitle = $Torrent['RemasterTitle'];
$LastRemasterYear = $Torrent['RemasterYear'];
$LastRemasterRecordLabel = $Torrent['RemasterRecordLabel'];
$LastRemasterCatalogueNumber = $Torrent['RemasterCatalogueNumber'];
$LastMedia = $Torrent['Media'];
?>
DL
» =Torrents::torrent_info($Torrent)?>
|
=Format::get_size($Torrent['Size'])?> |
=number_format($Torrent['Snatched'])?> |
=number_format($Torrent['Seeders'])?> |
=number_format($Torrent['Leechers'])?> |
}
} else {
// Viewing a type that does not require grouping
list($TorrentID, $Torrent) = each($Torrents);
$DisplayName = "
$GroupName";
if ($Torrent['IsSnatched']) {
$DisplayName .= ' ' . Format::torrent_label('Snatched!');
}
if (!empty($Torrent['FreeTorrent'])) {
$DisplayName .= ' ' . Format::torrent_label('Freeleech!');
}
$SnatchedTorrentClass = $Torrent['IsSnatched'] ? ' snatched_torrent' : '';
?>
|
|
if ($LoggedUser['CoverArt']) { ?>
ImageTools::cover_thumb($WikiImage, $GroupCategoryID) ?>
} ?>
[ DL
| RP ]
=$DisplayName?>
=$TorrentTags->format()?>
|
=Format::get_size($Torrent['Size'])?> |
=number_format($Torrent['Snatched'])?> |
=number_format($Torrent['Seeders'])?> |
=number_format($Torrent['Leechers'])?> |
}
$TorrentTable .= ob_get_clean();
} ?>
|
Torrents |
Size |
|
|
|
=$TorrentTable?>
} // foreach ()
} // else -- if (empty($NumResults))
?>
View::show_footer();
?>