/*
User collage subscription page
*/
if(!check_perms('site_collages_subscribe')) { error(403); }
include(SERVER_ROOT.'/classes/class_text.php'); // Text formatting class
$Text = new TEXT;
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();
?>
Subscribed collages=($ShowAll?'':' with new additions')?>
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 ct.GroupID,
tg.WikiImage,
tg.CategoryID
FROM collages_torrents AS ct
JOIN torrents_group AS tg ON ct.GroupID = tg.ID
WHERE ct.CollageID = $CollageID
AND ct.AddedOn > '$LastVisit'
ORDER BY ct.AddedOn");
$NewTorrentCount = $DB->record_count();
//$NewTorrents = $DB->to_array();
//$Artists = get_artists($GroupID);
$GroupIDs = $DB->collect('GroupID');
$CollageDataList=$DB->to_array('GroupID', MYSQLI_ASSOC);
if(count($GroupIDs)>0) {
$TorrentList = get_groups($GroupIDs);
$TorrentList = $TorrentList['matches'];
} else {
$TorrentList = array();
}
$Artists = get_artists($GroupIDs);
$Number = 0;
// foreach ($NewTorrents as $TorrentGroup) {
// list($GroupID, $GroupName, $GroupYear, $ReleaseType, $RecordLabel, $CatalogueNumber, $WikiImage) = $TorrentGroup;
// $DisplayName = display_artists($Artists[$GroupID]);
// $AltName=$GroupName;
foreach ($TorrentList as $GroupID => $Group) {
list($GroupID, $GroupName, $GroupYear, $GroupRecordLabel, $GroupCatalogueNumber, $TagList, $ReleaseType, $GroupVanityHouse, $Torrents, $GroupArtists, $ExtendedArtists) = array_values($Group);
list($GroupID2, $Image, $GroupCategoryID) = array_values($CollageDataList[$GroupID]);
unset($DisplayName);
$TagList = explode(' ',str_replace('_','.',$TagList));
$TorrentTags = array();
foreach($TagList as $Tag) {
if(!isset($Tags[$Tag])) {
$Tags[$Tag] = array('name'=>$Tag, 'count'=>1);
} else {
$Tags[$Tag]['count']++;
}
$TorrentTags[]='
'.$Tag.'';
}
$PrimaryTag = $TagList[0];
$TorrentTags = implode(', ', $TorrentTags);
$TorrentTags='
'.$TorrentTags.'
';
if (!empty($ExtendedArtists[1]) || !empty($ExtendedArtists[4]) || !empty($ExtendedArtists[5]) || !empty($ExtendedArtists[6])) {
unset($ExtendedArtists[2]);
unset($ExtendedArtists[3]);
$DisplayName .= display_artists($ExtendedArtists);
} elseif(count($GroupArtists)>0) {
$DisplayName .= display_artists(array('1'=>$GroupArtists));
}
$DisplayName .= '
'.$GroupName.'';
if($GroupYear>0) { $DisplayName = $DisplayName. ' ['. $GroupYear .']';}
if($GroupVanityHouse) { $DisplayName .= ' [
VH]'; }
// Start an output buffer, so we can store this output in $TorrentTable
ob_start();
if(count($Torrents)>1 || $GroupCategoryID==1) {
?>
|
if (!$LoggedUser['HideCollage']) {?>
if ($Image) {
if(check_perms('site_proxy_images')) {
$Image = 'http'.($SSL?'s':'').'://'.SITE_URL.'/image.php?i='.urlencode($Image);
}
?>
} else { ?>
} ?>
|
} ?>
=$DisplayName?>
=$TorrentTags?>
|
$LastRemasterYear = '-';
$LastRemasterTitle = '';
$LastRemasterRecordLabel = '';
$LastRemasterCatalogueNumber = '';
$LastMedia = '';
$EditionID = 0;
unset($FirstUnknown);
foreach ($Torrents as $TorrentID => $Torrent) {
if ($Torrent['Remastered'] && !$Torrent['RemasterYear']) {
$FirstUnknown = !isset($FirstUnknown);
}
if($Torrent['RemasterTitle'] != $LastRemasterTitle || $Torrent['RemasterYear'] != $LastRemasterYear ||
$Torrent['RemasterRecordLabel'] != $LastRemasterRecordLabel || $Torrent['RemasterCatalogueNumber'] != $LastRemasterCatalogueNumber || $FirstUnknown || $Torrent['Media'] != $LastMedia) {
if($Torrent['Remastered'] && $Torrent['RemasterYear'] != 0) {
$EditionID++;
$RemasterName = $Torrent['RemasterYear'];
$AddExtra = " - ";
if($Torrent['RemasterRecordLabel']) { $RemasterName .= $AddExtra.display_str($Torrent['RemasterRecordLabel']); $AddExtra=' / '; }
if($Torrent['RemasterCatalogueNumber']) { $RemasterName .= $AddExtra.display_str($Torrent['RemasterCatalogueNumber']); $AddExtra=' / '; }
if($Torrent['RemasterTitle']) { $RemasterName .= $AddExtra.display_str($Torrent['RemasterTitle']); $AddExtra=' / '; }
$RemasterName .= $AddExtra.display_str($Torrent['Media']);
?>
− =$RemasterName?> |
} else {
$AddExtra = " / ";
if (!$Torrent['Remastered']) {
$MasterName = "Original Release";
if($GroupRecordLabel) { $MasterName .= $AddExtra.$GroupRecordLabel; $AddExtra=' / '; }
if($GroupCatalogueNumber) { $MasterName .= $AddExtra.$GroupCatalogueNumber; $AddExtra=' / '; }
} else {
$MasterName = "Unknown Release(s)";
}
$MasterName .= $AddExtra.display_str($Torrent['Media']);
?>
− =$MasterName?> |
}
}
$LastRemasterTitle = $Torrent['RemasterTitle'];
$LastRemasterYear = $Torrent['RemasterYear'];
$LastRemasterRecordLabel = $Torrent['RemasterRecordLabel'];
$LastRemasterCatalogueNumber = $Torrent['RemasterCatalogueNumber'];
$LastMedia = $Torrent['Media'];
?>
[ DL ]
» =torrent_info($Torrent)?>
|
=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(!empty($Torrent['FreeTorrent'])) {
$DisplayName .='
Freeleech!';
}
?>
|
|
[ DL
| RP ]
=$DisplayName?>
=$TorrentTags?>
|
=get_size($Torrent['Size'])?> |
=number_format($Torrent['Snatched'])?> |
>=number_format($Torrent['Seeders'])?> |
=number_format($Torrent['Leechers'])?> |
}
$TorrentTable.=ob_get_clean();
} ?>
|
if(!$LoggedUser['HideCollage']) {?>
|
} ?>
Torrents |
Size |
|
|
|
=$TorrentTable?>
} // foreach() ?>
} // else -- if(empty($NumResults)) ?>
show_footer();
?>