Gazelle/sections/collages/collage.php

624 lines
24 KiB
PHP
Raw Normal View History

2011-03-28 14:21:28 +00:00
<?
2012-07-21 08:00:14 +00:00
ini_set('max_execution_time',600);
2011-03-28 14:21:28 +00:00
//~~~~~~~~~~~ Main collage page ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
function compare($X, $Y){
return($Y['count'] - $X['count']);
}
2013-04-19 08:00:55 +00:00
// Bookmarks::has_bookmarked()
2011-03-28 14:21:28 +00:00
include(SERVER_ROOT.'/classes/class_text.php'); // Text formatting class
2012-06-18 08:00:14 +00:00
2011-03-28 14:21:28 +00:00
$Text = new TEXT;
2012-11-02 08:00:18 +00:00
$UserVotes = Votes::get_user_votes($LoggedUser['ID']);
2011-03-28 14:21:28 +00:00
$CollageID = $_GET['id'];
2012-11-03 08:00:19 +00:00
if (!is_number($CollageID)) {
error(0);
}
2011-03-28 14:21:28 +00:00
$Data = $Cache->get_value('collage_'.$CollageID);
2013-04-13 08:00:19 +00:00
if ($Data) {
2012-10-28 08:00:19 +00:00
if (!is_array($Data)) {
$Data = unserialize($Data);
}
2012-11-01 08:00:21 +00:00
list($K, list($Name, $Description, , , $CommentList, $Deleted, $CollageCategoryID, $CreatorID, $Locked, $MaxGroups, $MaxGroupsPerUser)) = each($Data);
2011-03-28 14:21:28 +00:00
} else {
$DB->query("SELECT Name, Description, UserID, Deleted, CategoryID, Locked, MaxGroups, MaxGroupsPerUser FROM collages WHERE ID='$CollageID'");
2013-04-13 08:00:19 +00:00
if ($DB->record_count() > 0) {
2011-03-28 14:21:28 +00:00
list($Name, $Description, $CreatorID, $Deleted, $CollageCategoryID, $Locked, $MaxGroups, $MaxGroupsPerUser) = $DB->next_record();
2013-04-19 08:00:55 +00:00
$TorrentList = '';
$CollageList = '';
2011-03-28 14:21:28 +00:00
} else {
$Deleted = '1';
}
}
2013-04-13 08:00:19 +00:00
if ($Deleted == '1') {
2011-03-28 14:21:28 +00:00
header('Location: log.php?search=Collage+'.$CollageID);
die();
}
2013-04-13 08:00:19 +00:00
if ($CollageCategoryID == 0 && !check_perms('site_collages_delete')) {
if (!check_perms('site_collages_personal') || $CreatorID != $LoggedUser['ID']) {
2012-11-03 08:00:19 +00:00
$PreventAdditions = true;
2011-03-28 14:21:28 +00:00
}
}
//Handle subscriptions
2013-04-13 08:00:19 +00:00
if (($CollageSubscriptions = $Cache->get_value('collage_subs_user_'.$LoggedUser['ID'])) === false) {
$DB->query("SELECT CollageID FROM users_collage_subs WHERE UserID = '$LoggedUser[ID]'");
$CollageSubscriptions = $DB->collect(0);
$Cache->cache_value('collage_subs_user_'.$LoggedUser['ID'],$CollageSubscriptions,0);
}
2013-04-13 08:00:19 +00:00
if (empty($CollageSubscriptions)) {
$CollageSubscriptions = array();
}
2013-04-13 08:00:19 +00:00
if (in_array($CollageID, $CollageSubscriptions)) {
$Cache->delete_value('collage_subs_user_new_'.$LoggedUser['ID']);
}
$DB->query("UPDATE users_collage_subs SET LastVisit=NOW() WHERE UserID = ".$LoggedUser['ID']." AND CollageID=$CollageID");
2011-03-28 14:21:28 +00:00
2011-11-20 08:00:18 +00:00
// Build the data for the collage and the torrent list
2012-10-28 08:00:19 +00:00
$DB->query("SELECT ct.GroupID,
tg.WikiImage,
tg.CategoryID,
um.ID,
um.Username
FROM collages_torrents AS ct
JOIN torrents_group AS tg ON tg.ID=ct.GroupID
LEFT JOIN users_main AS um ON um.ID=ct.UserID
WHERE ct.CollageID='$CollageID'
ORDER BY ct.Sort");
$GroupIDs = $DB->collect('GroupID');
$CollageDataList = $DB->to_array('GroupID', MYSQLI_ASSOC);
2013-04-13 08:00:19 +00:00
if (count($GroupIDs) > 0) {
2012-10-28 08:00:19 +00:00
$TorrentList = Torrents::get_groups($GroupIDs);
$TorrentList = $TorrentList['matches'];
} else {
$TorrentList = array();
2011-03-28 14:21:28 +00:00
}
2012-10-28 08:00:19 +00:00
2011-03-28 14:21:28 +00:00
// Loop through the result set, building up $Collage and $TorrentTable
// Then we print them.
$Collage = array();
$TorrentTable = '';
$NumGroups = 0;
$NumGroupsByUser = 0;
2013-02-27 08:00:35 +00:00
$TopArtists = array();
2011-03-28 14:21:28 +00:00
$Users = array();
$Number = 0;
2013-02-25 21:16:55 +00:00
foreach ($TorrentList as $GroupID => $Group) {
extract(Torrents::array_group($Group));
list( , , , $UserID, $Username) = array_values($CollageDataList[$GroupID]);
$TorrentTags = new Tags($TagList);
2013-02-18 08:00:22 +00:00
2011-03-28 14:21:28 +00:00
// Handle stats and stuff
$Number++;
$NumGroups++;
2013-04-13 08:00:19 +00:00
if ($UserID == $LoggedUser['ID']) {
2011-03-28 14:21:28 +00:00
$NumGroupsByUser++;
}
2013-02-18 08:00:22 +00:00
2011-11-20 08:00:18 +00:00
if (!empty($ExtendedArtists[1]) || !empty($ExtendedArtists[4]) || !empty($ExtendedArtists[5]) || !empty($ExtendedArtists[6])) {
$CountArtists = array_merge((array)$ExtendedArtists[1], (array)$ExtendedArtists[4], (array)$ExtendedArtists[5], (array)$ExtendedArtists[6]);
2013-04-13 08:00:19 +00:00
} else {
2011-11-20 08:00:18 +00:00
$CountArtists = $GroupArtists;
}
2013-02-18 08:00:22 +00:00
2013-02-27 08:00:35 +00:00
if ($CountArtists) {
2013-04-13 08:00:19 +00:00
foreach ($CountArtists as $Artist) {
if (!isset($TopArtists[$Artist['id']])) {
2013-02-27 08:00:35 +00:00
$TopArtists[$Artist['id']] = array('name'=>$Artist['name'], 'count'=>1);
2013-04-13 08:00:19 +00:00
} else {
2013-02-27 08:00:35 +00:00
$TopArtists[$Artist['id']]['count']++;
2013-04-13 08:00:19 +00:00
}
2011-03-28 14:21:28 +00:00
}
}
2013-02-18 08:00:22 +00:00
2013-04-13 08:00:19 +00:00
if ($Username) {
if (!isset($Users[$UserID])) {
2011-03-28 14:21:28 +00:00
$Users[$UserID] = array('name'=>$Username, 'count'=>1);
} else {
$Users[$UserID]['count']++;
}
}
2013-02-18 08:00:22 +00:00
2011-03-28 14:21:28 +00:00
$DisplayName = $Number.' - ';
2013-02-18 08:00:22 +00:00
2011-11-20 08:00:18 +00:00
if (!empty($ExtendedArtists[1]) || !empty($ExtendedArtists[4]) || !empty($ExtendedArtists[5])|| !empty($ExtendedArtists[6])) {
unset($ExtendedArtists[2]);
unset($ExtendedArtists[3]);
2012-10-11 08:00:15 +00:00
$DisplayName .= Artists::display_artists($ExtendedArtists);
2013-04-13 08:00:19 +00:00
} elseif (count($GroupArtists) > 0) {
2012-10-11 08:00:15 +00:00
$DisplayName .= Artists::display_artists(array('1'=>$GroupArtists));
2011-03-28 14:21:28 +00:00
}
2013-02-18 08:00:22 +00:00
2013-03-07 08:00:21 +00:00
$DisplayName .= '<a href="torrents.php?id='.$GroupID.'" title="View Torrent" dir="ltr">'.$GroupName.'</a>';
2013-04-13 08:00:19 +00:00
if ($GroupYear > 0) { $DisplayName = $DisplayName. ' ['. $GroupYear .']';}
if ($GroupVanityHouse) { $DisplayName .= ' [<abbr title="This is a vanity house release">VH</abbr>]'; }
2012-12-06 08:00:17 +00:00
$SnatchedGroupClass = $GroupFlags['IsSnatched'] ? ' snatched_group' : '';
2011-03-28 14:21:28 +00:00
// Start an output buffer, so we can store this output in $TorrentTable
ob_start();
2011-11-20 08:00:18 +00:00
2013-04-13 08:00:19 +00:00
if (count($Torrents) > 1 || $GroupCategoryID == 1) {
// Grouped torrents
$ShowGroups = !(!empty($LoggedUser['TorrentGrouping']) && $LoggedUser['TorrentGrouping'] == 1);
2011-03-28 14:21:28 +00:00
?>
2012-12-06 08:00:17 +00:00
<tr class="group discog<?=$SnatchedGroupClass?>" id="group_<?=$GroupID?>">
2011-03-28 14:21:28 +00:00
<td class="center">
<div title="View" id="showimg_<?=$GroupID?>" class="<?=($ShowGroups ? 'hide' : 'show')?>_torrents">
2013-03-02 08:00:34 +00:00
<a href="#" class="show_torrents_link" onclick="toggle_group(<?=$GroupID?>, this, event)" title="Collapse this group. Hold &quot;Ctrl&quot; while clicking to collapse all groups on this page."></a>
2011-03-28 14:21:28 +00:00
</div>
</td>
<td class="center">
2013-02-25 21:16:55 +00:00
<div title="<?=$TorrentTags->title()?>" class="<?=Format::css_category($GroupCategoryID)?> <?=$TorrentTags->css_name()?>"></div>
2011-03-28 14:21:28 +00:00
</td>
<td colspan="5">
2012-11-02 08:00:18 +00:00
<strong><?=$DisplayName?></strong> <?Votes::vote_link($GroupID,$UserVotes[$GroupID]['Type']);?>
2013-02-25 21:16:55 +00:00
<div class="tags"><?=$TorrentTags->format()?></div>
2011-03-28 14:21:28 +00:00
</td>
</tr>
<?
$LastRemasterYear = '-';
$LastRemasterTitle = '';
$LastRemasterRecordLabel = '';
$LastRemasterCatalogueNumber = '';
$LastMedia = '';
2013-02-18 08:00:22 +00:00
$EditionID = 0;
unset($FirstUnknown);
2013-02-18 08:00:22 +00:00
2011-03-28 14:21:28 +00:00
foreach ($Torrents as $TorrentID => $Torrent) {
if ($Torrent['Remastered'] && !$Torrent['RemasterYear']) {
$FirstUnknown = !isset($FirstUnknown);
}
2012-12-06 08:00:17 +00:00
$SnatchedTorrentClass = $Torrent['IsSnatched'] ? ' snatched_torrent' : '';
2013-02-18 08:00:22 +00:00
2013-04-13 08:00:19 +00:00
if ($Torrent['RemasterTitle'] != $LastRemasterTitle || $Torrent['RemasterYear'] != $LastRemasterYear ||
$Torrent['RemasterRecordLabel'] != $LastRemasterRecordLabel || $Torrent['RemasterCatalogueNumber'] != $LastRemasterCatalogueNumber || $FirstUnknown || $Torrent['Media'] != $LastMedia) {
2011-10-18 08:00:10 +00:00
$EditionID++;
2011-03-28 14:21:28 +00:00
?>
2012-12-06 08:00:17 +00:00
<tr class="group_torrent groupid_<?=$GroupID?> edition<?=$SnatchedGroupClass . (!empty($LoggedUser['TorrentGrouping']) && $LoggedUser['TorrentGrouping'] == 1 ? ' hidden' : '')?>">
2013-03-17 08:00:17 +00:00
<td colspan="7" class="edition_info"><strong><a href="#" onclick="toggle_edition(<?=$GroupID?>, <?=$EditionID?>, this, event)" title="Collapse this edition. Hold &quot;Ctrl&quot; while clicking to collapse all editions in this torrent group.">&minus;</a> <?=Torrents::edition_string($Torrent, $Group)?></strong></td>
2011-03-28 14:21:28 +00:00
</tr>
<?
}
$LastRemasterTitle = $Torrent['RemasterTitle'];
$LastRemasterYear = $Torrent['RemasterYear'];
$LastRemasterRecordLabel = $Torrent['RemasterRecordLabel'];
$LastRemasterCatalogueNumber = $Torrent['RemasterCatalogueNumber'];
$LastMedia = $Torrent['Media'];
2011-03-28 14:21:28 +00:00
?>
2012-12-06 08:00:17 +00:00
<tr class="group_torrent torrent_row groupid_<?=$GroupID?> edition_<?=$EditionID?><?=$SnatchedTorrentClass . $SnatchedGroupClass . (!empty($LoggedUser['TorrentGrouping']) && $LoggedUser['TorrentGrouping'] == 1 ? ' hidden' : '')?>">
2011-03-28 14:21:28 +00:00
<td colspan="3">
2013-03-20 08:00:46 +00:00
<span class="brackets">
<a href="torrents.php?action=download&amp;id=<?=$TorrentID?>&amp;authkey=<?=$LoggedUser['AuthKey']?>&amp;torrent_pass=<?=$LoggedUser['torrent_pass']?>" title="Download">DL</a>
2012-10-28 08:00:19 +00:00
<? if (Torrents::can_use_token($Torrent)) { ?>
2012-09-09 08:00:26 +00:00
| <a href="torrents.php?action=download&amp;id=<?=$TorrentID ?>&amp;authkey=<?=$LoggedUser['AuthKey']?>&amp;torrent_pass=<?=$LoggedUser['torrent_pass']?>&amp;usetoken=1" title="Use a FL Token" onclick="return confirm('Are you sure you want to use a freeleech token here?');">FL</a>
2011-10-29 08:00:15 +00:00
<? } ?>
2013-03-20 08:00:46 +00:00
| <a href="reportsv2.php?action=report&amp;id=<?=$TorrentID?>" title="Report">RP</a>
2011-03-28 14:21:28 +00:00
</span>
2012-10-11 08:00:15 +00:00
&nbsp;&nbsp;&raquo;&nbsp; <a href="torrents.php?id=<?=$GroupID?>&amp;torrentid=<?=$TorrentID?>"><?=Torrents::torrent_info($Torrent)?></a>
2011-03-28 14:21:28 +00:00
</td>
2012-10-11 08:00:15 +00:00
<td class="nobr"><?=Format::get_size($Torrent['Size'])?></td>
2011-03-28 14:21:28 +00:00
<td><?=number_format($Torrent['Snatched'])?></td>
<td<?=($Torrent['Seeders']==0)?' class="r00"':''?>><?=number_format($Torrent['Seeders'])?></td>
<td><?=number_format($Torrent['Leechers'])?></td>
</tr>
<?
}
} else {
// Viewing a type that does not require grouping
2013-02-18 08:00:22 +00:00
2011-03-28 14:21:28 +00:00
list($TorrentID, $Torrent) = each($Torrents);
2013-02-18 08:00:22 +00:00
2013-03-07 08:00:21 +00:00
$DisplayName = '<a href="torrents.php?id='.$GroupID.'" title="View Torrent" dir="ltr">'.$GroupName.'</a>';
2012-10-16 08:00:18 +00:00
2012-10-28 08:00:19 +00:00
if ($Torrent['IsSnatched']) {
2013-01-03 08:00:30 +00:00
$DisplayName .= ' ' . Format::torrent_label('Snatched!');
2012-10-28 08:00:19 +00:00
}
if ($Torrent['FreeTorrent'] == '1') {
2013-01-03 08:00:30 +00:00
$DisplayName .= ' ' . Format::torrent_label('Freeleech!');
2012-10-28 08:00:19 +00:00
} elseif ($Torrent['FreeTorrent'] == '2') {
2013-01-03 08:00:30 +00:00
$DisplayName .= ' ' . Format::torrent_label('Neutral Leech!');
2012-10-28 08:00:19 +00:00
} elseif ($Torrent['PersonalFL']) {
2013-01-03 08:00:30 +00:00
$DisplayName .= ' ' . Format::torrent_label('Personal Freeleech!');
2011-03-28 14:21:28 +00:00
}
2012-12-06 08:00:17 +00:00
$SnatchedTorrentClass = $Torrent['IsSnatched'] ? ' snatched_torrent' : '';
2011-03-28 14:21:28 +00:00
?>
2012-12-06 08:00:17 +00:00
<tr class="torrent torrent_row<?=$SnatchedTorrentClass . $SnatchedGroupClass?>" id="group_<?=$GroupID?>">
2011-03-28 14:21:28 +00:00
<td></td>
<td class="center">
2013-02-25 21:16:55 +00:00
<div title="<?=$TorrentTags->title()?>" class="<?=Format::css_category($GroupCategoryID)?> <?=$TorrentTags->css_name()?>">
2011-03-28 14:21:28 +00:00
</div>
</td>
<td>
2013-03-20 08:00:46 +00:00
<span class="brackets">
<a href="torrents.php?action=download&amp;id=<?=$TorrentID?>&amp;authkey=<?=$LoggedUser['AuthKey']?>&amp;torrent_pass=<?=$LoggedUser['torrent_pass']?>" title="Download">DL</a>
2012-10-28 08:00:19 +00:00
<? if (Torrents::can_use_token($Torrent)) { ?>
2012-09-09 08:00:26 +00:00
| <a href="torrents.php?action=download&amp;id=<?=$TorrentID ?>&amp;authkey=<?=$LoggedUser['AuthKey']?>&amp;torrent_pass=<?=$LoggedUser['torrent_pass']?>&amp;usetoken=1" title="Use a FL Token" onclick="return confirm('Are you sure you want to use a freeleech token here?');">FL</a>
2013-02-18 08:00:22 +00:00
<? } ?>
2013-03-20 08:00:46 +00:00
| <a href="reportsv2.php?action=report&amp;id=<?=$TorrentID?>" title="Report">RP</a>
2011-03-28 14:21:28 +00:00
</span>
2012-11-02 08:00:18 +00:00
<strong><?=$DisplayName?></strong> <?Votes::vote_link($GroupID,$UserVotes[$GroupID]['Type']);?>
2013-02-25 21:16:55 +00:00
<div class="tags"><?=$TorrentTags->format()?></div>
2011-03-28 14:21:28 +00:00
</td>
2012-10-11 08:00:15 +00:00
<td class="nobr"><?=Format::get_size($Torrent['Size'])?></td>
2011-03-28 14:21:28 +00:00
<td><?=number_format($Torrent['Snatched'])?></td>
2013-04-19 08:00:55 +00:00
<td<?=($Torrent['Seeders'] == 0) ? ' class="r00"' : '' ?>><?=number_format($Torrent['Seeders'])?></td>
2011-03-28 14:21:28 +00:00
<td><?=number_format($Torrent['Leechers'])?></td>
</tr>
<?
}
$TorrentTable.=ob_get_clean();
2013-02-18 08:00:22 +00:00
2011-03-28 14:21:28 +00:00
// Album art
2013-02-18 08:00:22 +00:00
2011-03-28 14:21:28 +00:00
ob_start();
2013-02-18 08:00:22 +00:00
2011-03-28 14:21:28 +00:00
$DisplayName = '';
2011-11-21 08:00:23 +00:00
if (!empty($ExtendedArtists[1]) || !empty($ExtendedArtists[4]) || !empty($ExtendedArtists[5])|| !empty($ExtendedArtists[6])) {
unset($ExtendedArtists[2]);
unset($ExtendedArtists[3]);
2012-10-11 08:00:15 +00:00
$DisplayName .= Artists::display_artists($ExtendedArtists, false);
2013-04-13 08:00:19 +00:00
} elseif (count($GroupArtists) > 0) {
2012-10-11 08:00:15 +00:00
$DisplayName .= Artists::display_artists(array('1'=>$GroupArtists), false);
2011-03-28 14:21:28 +00:00
}
$DisplayName .= $GroupName;
2013-04-13 08:00:19 +00:00
if ($GroupYear > 0) {
2013-04-19 08:00:55 +00:00
$DisplayName = $DisplayName. " [$GroupYear]";
2013-04-13 08:00:19 +00:00
}
2011-03-28 14:21:28 +00:00
?>
2011-11-20 08:00:18 +00:00
<li class="image_group_<?=$GroupID?>">
2012-06-21 08:00:14 +00:00
<a href="torrents.php?id=<?=$GroupID?>">
2013-04-13 08:00:19 +00:00
<? if ($WikiImage) {
if (check_perms('site_proxy_images')) {
2013-02-25 21:16:55 +00:00
$WikiImage = 'http'.($SSL?'s':'').'://'.SITE_URL.'/image.php?i='.urlencode($WikiImage);
2012-02-07 08:00:20 +00:00
}
?>
2013-02-25 21:16:55 +00:00
<img src="<?=ImageTools::thumbnail($WikiImage)?>" alt="<?=$DisplayName?>" title="<?=$DisplayName?>" width="118" />
2011-03-28 14:21:28 +00:00
<? } else { ?>
2013-03-02 08:00:34 +00:00
<span style="width: 107px; padding: 5px;"><?=$DisplayName?></span>
2011-03-28 14:21:28 +00:00
<? } ?>
</a>
2011-11-20 08:00:18 +00:00
</li>
2011-03-28 14:21:28 +00:00
<?
2013-04-19 08:00:55 +00:00
$Collage[] = ob_get_clean();
2011-03-28 14:21:28 +00:00
}
2012-11-03 08:00:19 +00:00
if (!check_perms('site_collages_delete') && ($Locked || ($MaxGroups > 0 && $NumGroups >= $MaxGroups) || ($MaxGroupsPerUser > 0 && $NumGroupsByUser >= $MaxGroupsPerUser))) {
$PreventAdditions = true;
2011-03-28 14:21:28 +00:00
}
2011-11-20 08:00:18 +00:00
// Silly hack for people who are on the old setting
$CollageCovers = isset($LoggedUser['CollageCovers'])?$LoggedUser['CollageCovers']:25*(abs($LoggedUser['HideCollage'] - 1));
$CollagePages = array();
// Pad it out
if ($NumGroups > $CollageCovers) {
2013-04-13 08:00:19 +00:00
for ($i = $NumGroups + 1; $i <= ceil($NumGroups / $CollageCovers) * $CollageCovers; $i++) {
2011-11-20 08:00:18 +00:00
$Collage[] = '<li></li>';
}
}
2013-04-13 08:00:19 +00:00
for ($i = 0; $i < $NumGroups / $CollageCovers; $i++) {
2011-11-20 08:00:18 +00:00
$Groups = array_slice($Collage, $i*$CollageCovers, $CollageCovers);
$CollagePage = '';
foreach ($Groups as $Group) {
$CollagePage .= $Group;
}
$CollagePages[] = $CollagePage;
}
2013-03-05 08:00:26 +00:00
View::show_header($Name,'browse,collage,bbcode,voting,jquery,recommend');
2011-03-28 14:21:28 +00:00
?>
<div class="thin">
2012-08-19 08:00:19 +00:00
<div class="header">
<h2><?=$Name?></h2>
<div class="linkbox">
2013-01-24 08:00:24 +00:00
<a href="collages.php" class="brackets">List of collages</a>
2013-04-19 08:00:55 +00:00
<? if (check_perms('site_collages_create')) { ?>
2013-01-24 08:00:24 +00:00
<a href="collages.php?action=new" class="brackets">New collage</a>
2013-04-19 08:00:55 +00:00
<? } ?>
2012-08-19 08:00:19 +00:00
<br /><br />
2013-04-19 08:00:55 +00:00
<? if (check_perms('site_collages_subscribe')) { ?>
2013-01-24 08:00:24 +00:00
<a href="#" id="subscribelink<?=$CollageID?>" class="brackets" onclick="CollageSubscribe(<?=$CollageID?>);return false;"><?=(in_array($CollageID, $CollageSubscriptions) ? 'Unsubscribe' : 'Subscribe')?></a>
2013-04-19 08:00:55 +00:00
<? }
if (check_perms('site_collages_delete') || (check_perms('site_edit_wiki') && !$Locked)) { ?>
2013-01-24 08:00:24 +00:00
<a href="collages.php?action=edit&amp;collageid=<?=$CollageID?>" class="brackets">Edit description</a>
2013-04-19 08:00:55 +00:00
<? } else { ?>
2013-01-24 08:00:24 +00:00
<span class="brackets">Locked</span>
2013-04-19 08:00:55 +00:00
<? }
2013-04-13 08:00:19 +00:00
if (Bookmarks::has_bookmarked('collage', $CollageID)) {
?>
2013-01-24 08:00:24 +00:00
<a href="#" id="bookmarklink_collage_<?=$CollageID?>" class="brackets" onclick="Unbookmark('collage', <?=$CollageID?>,'Bookmark');return false;">Remove bookmark</a>
<? } else { ?>
2013-01-24 08:00:24 +00:00
<a href="#" id="bookmarklink_collage_<?=$CollageID?>" class="brackets" onclick="Bookmark('collage', <?=$CollageID?>,'Remove bookmark');return false;">Bookmark</a>
<? }
2013-03-05 08:00:26 +00:00
?>
2013-04-19 08:00:55 +00:00
<!-- <a href="#" id="recommend" class="brackets">Recommend</a> -->
2013-03-05 08:00:26 +00:00
<?
2013-04-19 08:00:55 +00:00
if (check_perms('site_collages_manage') && !$Locked) { ?>
2013-01-24 08:00:24 +00:00
<a href="collages.php?action=manage&amp;collageid=<?=$CollageID?>" class="brackets">Manage torrents</a>
2013-04-19 08:00:55 +00:00
<? } ?>
2013-01-24 08:00:24 +00:00
<a href="reports.php?action=report&amp;type=collage&amp;id=<?=$CollageID?>" class="brackets">Report collage</a>
2013-04-19 08:00:55 +00:00
<? if (check_perms('site_collages_delete') || $CreatorID == $LoggedUser['ID']) { ?>
2013-01-24 08:00:24 +00:00
<a href="collages.php?action=delete&amp;collageid=<?=$CollageID?>&amp;auth=<?=$LoggedUser['AuthKey']?>" class="brackets" onclick="return confirm('Are you sure you want to delete this collage?');">Delete</a>
2013-04-19 08:00:55 +00:00
<? } ?>
2012-08-19 08:00:19 +00:00
</div>
2013-04-19 08:00:55 +00:00
</div>
2013-03-06 08:00:23 +00:00
<? /* Misc::display_recommend($CollageID, "collage"); */ ?>
2013-04-19 08:00:55 +00:00
<div class="sidebar">
2012-08-17 08:00:13 +00:00
<div class="box box_category">
2011-03-28 14:21:28 +00:00
<div class="head"><strong>Category</strong></div>
<div class="pad"><a href="collages.php?action=search&amp;cats[<?=(int)$CollageCategoryID?>]=1"><?=$CollageCats[(int)$CollageCategoryID]?></a></div>
</div>
2012-08-17 08:00:13 +00:00
<div class="box box_description">
2011-03-28 14:21:28 +00:00
<div class="head"><strong>Description</strong></div>
<div class="pad"><?=$Text->full_format($Description)?></div>
</div>
<?
2013-04-13 08:00:19 +00:00
if (check_perms('zip_downloader')){
if (isset($LoggedUser['Collector'])) {
2011-03-28 14:21:28 +00:00
list($ZIPList,$ZIPPrefs) = $LoggedUser['Collector'];
$ZIPList = explode(':',$ZIPList);
} else {
$ZIPList = array('00','11');
$ZIPPrefs = 1;
}
?>
2012-08-17 08:00:13 +00:00
<div class="box box_zipdownload">
2011-03-28 14:21:28 +00:00
<div class="head colhead_dark"><strong>Collector</strong></div>
<div class="pad">
2012-09-15 08:00:25 +00:00
<form class="download_form" name="zip" action="collages.php" method="post">
2011-03-28 14:21:28 +00:00
<input type="hidden" name="action" value="download" />
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
2013-02-18 08:00:22 +00:00
<input type="hidden" name="collageid" value="<?=$CollageID?>" />
2011-03-28 14:21:28 +00:00
<ul id="list" class="nobullet">
<? foreach ($ZIPList as $ListItem) { ?>
<li id="list<?=$ListItem?>">
2013-03-02 08:00:34 +00:00
<input type="hidden" name="list[]" value="<?=$ListItem?>" />
2013-02-25 21:16:55 +00:00
<span class="float_left"><?=$ZIPOptions[$ListItem]['2']?></span>
<span class="remove remove_collector"><a href="#" onclick="remove_selection('<?=$ListItem?>');return false;" class="float_right brackets">X</a></span>
2013-04-19 08:00:55 +00:00
<br style="clear: all;" />
2011-03-28 14:21:28 +00:00
</li>
<? } ?>
</ul>
<select id="formats" style="width:180px">
<?
$OpenGroup = false;
2013-04-19 08:00:55 +00:00
$LastGroupID = -1;
2011-03-28 14:21:28 +00:00
foreach ($ZIPOptions as $Option) {
list($GroupID,$OptionID,$OptName) = $Option;
2013-04-19 08:00:55 +00:00
if ($GroupID != $LastGroupID) {
$LastGroupID = $GroupID;
2013-04-13 08:00:19 +00:00
if ($OpenGroup) { ?>
2011-03-28 14:21:28 +00:00
</optgroup>
<? } ?>
<optgroup label="<?=$ZIPGroups[$GroupID]?>">
<? $OpenGroup = true;
}
?>
2013-04-13 08:00:19 +00:00
<option id="opt<?=$GroupID.$OptionID?>" value="<?=$GroupID.$OptionID?>"<? if (in_array($GroupID.$OptionID,$ZIPList)){ echo ' disabled="disabled"'; }?>><?=$OptName?></option>
2011-03-28 14:21:28 +00:00
<?
}
?>
</optgroup>
</select>
<button type="button" onclick="add_selection()">+</button>
<select name="preference" style="width:210px">
2013-04-13 08:00:19 +00:00
<option value="0"<? if ($ZIPPrefs == 0){ echo ' selected="selected"'; } ?>>Prefer Original</option>
<option value="1"<? if ($ZIPPrefs == 1){ echo ' selected="selected"'; } ?>>Prefer Best Seeded</option>
<option value="2"<? if ($ZIPPrefs == 2){ echo ' selected="selected"'; } ?>>Prefer Bonus Tracks</option>
2011-03-28 14:21:28 +00:00
</select>
2013-02-18 08:00:22 +00:00
<input type="submit" style="width:210px" value="Download" />
2011-03-28 14:21:28 +00:00
</form>
</div>
</div>
<? } ?>
2012-08-17 08:00:13 +00:00
<div class="box box_info box_statistics_collage_torrents">
2011-03-28 14:21:28 +00:00
<div class="head"><strong>Stats</strong></div>
<ul class="stats nobullet">
2013-03-02 08:00:34 +00:00
<li>Torrents: <?=number_format($NumGroups)?></li>
2013-04-13 08:00:19 +00:00
<? if (!empty($TopArtists)) { ?>
2013-03-02 08:00:34 +00:00
<li>Artists: <?=number_format(count($TopArtists))?></li>
2012-11-03 08:00:19 +00:00
<? } ?>
2013-03-02 08:00:34 +00:00
<li>Built by <?=number_format(count($Users))?> user<?=(count($Users) > 1 ? 's' : '')?></li>
2011-03-28 14:21:28 +00:00
</ul>
</div>
2012-08-17 08:00:13 +00:00
<div class="box box_tags">
2011-03-28 14:21:28 +00:00
<div class="head"><strong>Top tags</strong></div>
<div class="pad">
2013-04-19 08:00:55 +00:00
<ol style="padding-left: 5px;">
2011-03-28 14:21:28 +00:00
<?
2013-02-26 08:00:42 +00:00
Tags::format_top(5, 'collages.php?action=search&amp;tags=');
2011-03-28 14:21:28 +00:00
?>
</ol>
</div>
</div>
2013-04-13 08:00:19 +00:00
<? if (!empty($TopArtists)) { ?>
2012-08-17 08:00:13 +00:00
<div class="box box_artists">
2011-03-28 14:21:28 +00:00
<div class="head"><strong>Top artists</strong></div>
<div class="pad">
2013-04-19 08:00:55 +00:00
<ol style="padding-left: 5px;">
2011-03-28 14:21:28 +00:00
<?
2013-02-27 08:00:35 +00:00
uasort($TopArtists, 'compare');
2011-03-28 14:21:28 +00:00
$i = 0;
2013-02-27 08:00:35 +00:00
foreach ($TopArtists as $ID => $Artist) {
2011-03-28 14:21:28 +00:00
$i++;
2013-04-13 08:00:19 +00:00
if ($i > 10) {
break;
}
2011-03-28 14:21:28 +00:00
?>
2013-03-02 08:00:34 +00:00
<li><a href="artist.php?id=<?=$ID?>"><?=$Artist['name']?></a> (<?=number_format($Artist['count'])?>)</li>
2011-03-28 14:21:28 +00:00
<?
}
?>
</ol>
</div>
</div>
<? } ?>
2012-08-17 08:00:13 +00:00
<div class="box box_contributors">
2011-03-28 14:21:28 +00:00
<div class="head"><strong>Top contributors</strong></div>
<div class="pad">
<ol style="padding-left:5px;">
<?
uasort($Users, 'compare');
$i = 0;
foreach ($Users as $ID => $User) {
$i++;
2013-04-13 08:00:19 +00:00
if ($i > 5) {
break;
}
2011-03-28 14:21:28 +00:00
?>
2013-03-02 08:00:34 +00:00
<li><?=Users::format_username($ID, false, false, false)?> (<?=number_format($User['count'])?>)</li>
2011-03-28 14:21:28 +00:00
<?
}
?>
</ol>
</div>
</div>
2013-04-13 08:00:19 +00:00
<? if (check_perms('site_collages_manage') && !$PreventAdditions) { ?>
2012-08-17 08:00:13 +00:00
<div class="box box_addtorrent">
2013-02-25 21:16:55 +00:00
<div class="head"><strong>Add torrent</strong><span class="float_right"><a href="#" onclick="$('.add_torrent_container').toggle_class('hidden'); this.innerHTML = (this.innerHTML == 'Batch add'?'Individual add':'Batch add'); return false;" class="brackets">Batch add</a></span></div>
2012-09-15 08:00:25 +00:00
<div class="pad add_torrent_container">
<form class="add_form" name="torrent" action="collages.php" method="post">
2011-03-28 14:21:28 +00:00
<input type="hidden" name="action" value="add_torrent" />
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
<input type="hidden" name="collageid" value="<?=$CollageID?>" />
<input type="text" size="20" name="url" />
<input type="submit" value="+" />
<br />
2012-09-23 08:00:25 +00:00
<span style="font-style: italic;">Enter the URL of a torrent on the site.</span>
2011-03-28 14:21:28 +00:00
</form>
</div>
2012-09-15 08:00:25 +00:00
<div class="pad hidden add_torrent_container">
<form class="add_form" name="torrents" action="collages.php" method="post">
2012-02-07 08:00:20 +00:00
<input type="hidden" name="action" value="add_torrent_batch" />
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
<input type="hidden" name="collageid" value="<?=$CollageID?>" />
2012-09-29 08:00:21 +00:00
<textarea name="urls" rows="5" cols="25" style="white-space: nowrap;"></textarea><br />
2012-02-07 08:00:20 +00:00
<input type="submit" value="Add" />
<br />
2012-09-23 08:00:25 +00:00
<span style="font-style: italic;">Enter the URLs of torrents on the site, one per line.</span>
2012-02-07 08:00:20 +00:00
</form>
</div>
2011-03-28 14:21:28 +00:00
</div>
<? } ?>
<h3>Comments</h3>
<?
2013-04-13 08:00:19 +00:00
if (empty($CommentList)) {
2013-02-18 08:00:22 +00:00
$DB->query("SELECT
cc.ID,
cc.Body,
cc.UserID,
2011-03-28 14:21:28 +00:00
um.Username,
2013-02-18 08:00:22 +00:00
cc.Time
2011-03-28 14:21:28 +00:00
FROM collages_comments AS cc
2013-04-19 08:00:55 +00:00
LEFT JOIN users_main AS um ON um.ID=cc.UserID
2013-02-18 08:00:22 +00:00
WHERE CollageID='$CollageID'
2011-03-28 14:21:28 +00:00
ORDER BY ID DESC LIMIT 15");
2012-10-28 08:00:19 +00:00
$CommentList = $DB->to_array(false, MYSQLI_NUM);
2011-03-28 14:21:28 +00:00
}
foreach ($CommentList as $Comment) {
list($CommentID, $Body, $UserID, $Username, $CommentTime) = $Comment;
?>
2012-08-17 08:00:13 +00:00
<div class="box comment">
2013-03-04 08:00:25 +00:00
<div class="head">
<?=Users::format_username($UserID, false, false, false) ?> <?=time_diff($CommentTime) ?>
<br />
<a href="reports.php?action=report&amp;type=collages_comment&amp;id=<?=$CommentID?>" class="brackets">Report</a>
</div>
2011-03-28 14:21:28 +00:00
<div class="pad"><?=$Text->full_format($Body)?></div>
</div>
<?
}
?>
<div class="box pad">
2013-02-09 08:01:01 +00:00
<a href="collages.php?action=comments&amp;collageid=<?=$CollageID?>" class="brackets">View all comments</a>
2011-03-28 14:21:28 +00:00
</div>
<?
2013-04-13 08:00:19 +00:00
if (!$LoggedUser['DisablePosting']) {
2011-03-28 14:21:28 +00:00
?>
2012-08-17 08:00:13 +00:00
<div class="box box_addcomment">
2011-03-28 14:21:28 +00:00
<div class="head"><strong>Add comment</strong></div>
2012-09-15 08:00:25 +00:00
<form class="send_form" name="comment" id="quickpostform" onsubmit="quickpostform.submit_button.disabled=true;" action="collages.php" method="post">
2011-03-28 14:21:28 +00:00
<input type="hidden" name="action" value="add_comment" />
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
<input type="hidden" name="collageid" value="<?=$CollageID?>" />
<div class="pad">
<textarea name="body" cols="24" rows="5"></textarea>
<br />
2012-04-08 08:00:25 +00:00
<input type="submit" id="submit_button" value="Add comment" />
2011-03-28 14:21:28 +00:00
</div>
</form>
</div>
<?
}
?>
</div>
2013-02-18 08:00:22 +00:00
<div class="main_column">
<?
2013-04-13 08:00:19 +00:00
if ($CollageCovers != 0) { ?>
2011-11-20 08:00:18 +00:00
<div id="coverart" class="box">
2013-02-23 08:00:22 +00:00
<div class="head" id="coverhead"><strong>Cover art</strong></div>
2011-11-20 08:00:18 +00:00
<ul class="collage_images" id="collage_page0">
2011-03-28 14:21:28 +00:00
<?
2011-11-20 08:00:18 +00:00
$Page1 = array_slice($Collage, 0, $CollageCovers);
2013-04-13 08:00:19 +00:00
foreach ($Page1 as $Group) {
2011-03-28 14:21:28 +00:00
echo $Group;
2011-11-20 08:00:18 +00:00
}?>
</ul>
</div>
<? if ($NumGroups > $CollageCovers) { ?>
<div class="linkbox pager" style="clear: left;" id="pageslinksdiv">
2012-09-09 08:00:26 +00:00
<span id="firstpage" class="invisible"><a href="#" class="pageslink" onclick="collageShow.page(0, this); return false;">&lt;&lt; First</a> | </span>
2012-09-29 08:00:21 +00:00
<span id="prevpage" class="invisible"><a href="#" class="pageslink" onclick="collageShow.prevPage(); return false;">&lt; Prev</a> | </span>
2013-04-13 08:00:19 +00:00
<? for ($i = 0; $i < $NumGroups / $CollageCovers; $i++) { ?>
<span id="pagelink<?=$i?>" class="<?=(($i > 4) ? 'hidden' : '')?><?=(($i == 0) ? 'selected' : '')?>"><a href="#" class="pageslink" onclick="collageShow.page(<?=$i?>, this); return false;"><?=$CollageCovers * $i + 1?>-<?=min($NumGroups,$CollageCovers * ($i + 1))?></a><?=($i != ceil($NumGroups / $CollageCovers) - 1) ? ' | ' : ''?></span>
2011-11-20 08:00:18 +00:00
<? } ?>
2013-04-13 08:00:19 +00:00
<span id="nextbar" class="<?=($NumGroups / $CollageCovers > 5) ? 'hidden' : ''?>"> | </span>
2012-09-09 08:00:26 +00:00
<span id="nextpage"><a href="#" class="pageslink" onclick="collageShow.nextPage(); return false;">Next &gt;</a></span>
2013-04-13 08:00:19 +00:00
<span id="lastpage" class="<?=ceil($NumGroups / $CollageCovers) == 2 ? 'invisible' : ''?>"> | <a href="#" class="pageslink" onclick="collageShow.page(<?=ceil($NumGroups / $CollageCovers) - 1?>, this); return false;">Last &gt;&gt;</a></span>
2011-11-20 08:00:18 +00:00
</div>
2012-09-29 08:00:21 +00:00
<script type="text/javascript">//<![CDATA[
2011-11-20 08:00:18 +00:00
collageShow.init(<?=json_encode($CollagePages)?>);
2012-09-29 08:00:21 +00:00
//]]></script>
2013-02-18 08:00:22 +00:00
<? }
2011-11-20 08:00:18 +00:00
} ?>
2012-09-01 08:00:24 +00:00
<table class="torrent_table grouping cats" id="discog_table">
2011-03-28 14:21:28 +00:00
<tr class="colhead_dark">
<td><!-- expand/collapse --></td>
<td><!-- Category --></td>
<td width="70%"><strong>Torrents</strong></td>
<td>Size</td>
<td class="sign"><img src="static/styles/<?=$LoggedUser['StyleName'] ?>/images/snatched.png" alt="Snatches" title="Snatches" /></td>
<td class="sign"><img src="static/styles/<?=$LoggedUser['StyleName'] ?>/images/seeders.png" alt="Seeders" title="Seeders" /></td>
<td class="sign"><img src="static/styles/<?=$LoggedUser['StyleName'] ?>/images/leechers.png" alt="Leechers" title="Leechers" /></td>
</tr>
<?=$TorrentTable?>
</table>
</div>
</div>
<?
2012-10-11 08:00:15 +00:00
View::show_footer();
2011-03-28 14:21:28 +00:00
2012-10-28 08:00:19 +00:00
$Cache->cache_value('collage_'.$CollageID, array(array($Name, $Description, array(), array(), $CommentList, $Deleted, $CollageCategoryID, $CreatorID, $Locked, $MaxGroups, $MaxGroupsPerUser)), 3600);
2011-03-28 14:21:28 +00:00
?>