Gazelle/sections/artist/artist.php

996 lines
34 KiB
PHP
Raw Normal View History

2011-03-28 14:21:28 +00:00
<?
//~~~~~~~~~~~ Main artist page ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
//For sorting tags
2013-04-17 08:00:58 +00:00
function compare($X, $Y) {
2011-03-28 14:21:28 +00:00
return($Y['count'] - $X['count']);
}
2013-08-28 23:08:41 +00:00
// Similar Artist Map
2013-05-27 08:00:58 +00:00
include(SERVER_ROOT.'/classes/artists_similar.class.php');
2011-03-28 14:21:28 +00:00
2012-11-02 08:00:18 +00:00
$UserVotes = Votes::get_user_votes($LoggedUser['ID']);
2011-03-28 14:21:28 +00:00
$ArtistID = $_GET['id'];
2013-04-17 08:00:58 +00:00
if (!is_number($ArtistID)) {
error(0);
}
2011-03-28 14:21:28 +00:00
2013-04-17 08:00:58 +00:00
if (!empty($_GET['revisionid'])) { // if they're viewing an old revision
2013-06-20 08:01:00 +00:00
$RevisionID = $_GET['revisionid'];
2013-04-17 08:00:58 +00:00
if (!is_number($RevisionID)) {
2012-10-28 08:00:19 +00:00
error(0);
}
2013-06-20 08:01:00 +00:00
$Data = $Cache->get_value("artist_{$ArtistID}_revision_$RevisionID", true);
2011-03-28 14:21:28 +00:00
} else { // viewing the live version
2013-06-20 08:01:00 +00:00
$Data = $Cache->get_value("artist_$ArtistID", true);
2011-03-28 14:21:28 +00:00
$RevisionID = false;
}
2012-10-11 08:00:15 +00:00
2013-04-17 08:00:58 +00:00
if ($Data) {
2012-11-01 08:00:21 +00:00
list($K, list($Name, $Image, $Body, $NumSimilar, $SimilarArray, , , $VanityHouseArtist)) = each($Data);
2011-03-28 14:21:28 +00:00
} else {
if ($RevisionID) {
2013-05-04 08:00:48 +00:00
$sql = "
SELECT
a.Name,
wiki.Image,
wiki.body,
a.VanityHouse
FROM wiki_artists AS wiki
2013-06-20 08:01:00 +00:00
LEFT JOIN artists_group AS a ON wiki.RevisionID = a.RevisionID
WHERE wiki.RevisionID = '$RevisionID' ";
2011-03-28 14:21:28 +00:00
} else {
2013-05-04 08:00:48 +00:00
$sql = "
SELECT
a.Name,
wiki.Image,
wiki.body,
a.VanityHouse
FROM artists_group AS a
2013-06-20 08:01:00 +00:00
LEFT JOIN wiki_artists AS wiki ON wiki.RevisionID = a.RevisionID
WHERE a.ArtistID = '$ArtistID' ";
2011-03-28 14:21:28 +00:00
}
2013-06-20 08:01:00 +00:00
$sql .= "
GROUP BY a.ArtistID";
2011-03-28 14:21:28 +00:00
$DB->query($sql);
2012-10-11 08:00:15 +00:00
2013-07-10 00:08:53 +00:00
if (!$DB->has_results()) {
2013-04-17 08:00:58 +00:00
error(404);
}
2012-10-11 08:00:15 +00:00
list($Name, $Image, $Body, $VanityHouseArtist) = $DB->next_record(MYSQLI_NUM, array(0));
2011-03-28 14:21:28 +00:00
}
2012-10-27 08:00:09 +00:00
2011-03-28 14:21:28 +00:00
//----------------- Build list and get stats
ob_start();
// Requests
2013-05-07 08:00:23 +00:00
$Requests = array();
if (empty($LoggedUser['DisableRequests'])) {
2013-06-20 08:01:00 +00:00
$Requests = $Cache->get_value("artists_requests_$ArtistID");
2013-05-07 08:00:23 +00:00
if (!is_array($Requests)) {
$DB->query("
SELECT
r.ID,
r.CategoryID,
r.Title,
r.Year,
r.TimeAdded,
COUNT(rv.UserID) AS Votes,
SUM(rv.Bounty) AS Bounty
FROM requests AS r
2013-06-20 08:01:00 +00:00
LEFT JOIN requests_votes AS rv ON rv.RequestID = r.ID
LEFT JOIN requests_artists AS ra ON r.ID = ra.RequestID
WHERE ra.ArtistID = $ArtistID
2013-05-07 08:00:23 +00:00
AND r.TorrentID = 0
GROUP BY r.ID
ORDER BY Votes DESC");
2013-07-10 00:08:53 +00:00
if ($DB->has_results()) {
2013-09-13 08:00:53 +00:00
$Requests = $DB->to_array('ID', MYSQLI_ASSOC, false);
2013-05-07 08:00:23 +00:00
} else {
$Requests = array();
}
2013-06-20 08:01:00 +00:00
$Cache->cache_value("artists_requests_$ArtistID", $Requests);
2011-03-28 14:21:28 +00:00
}
}
$NumRequests = count($Requests);
2012-10-28 08:00:19 +00:00
2013-06-20 08:01:00 +00:00
if (($Importances = $Cache->get_value("artist_groups_$ArtistID")) === false) {
2013-05-04 08:00:48 +00:00
$DB->query("
SELECT
DISTINCTROW ta.GroupID, ta.Importance, tg.VanityHouse, tg.Year
FROM torrents_artists AS ta
2013-06-20 08:01:00 +00:00
JOIN torrents_group AS tg ON tg.ID = ta.GroupID
WHERE ta.ArtistID = '$ArtistID'
2013-05-04 08:00:48 +00:00
ORDER BY tg.Year DESC, tg.Name DESC");
2012-11-20 08:00:19 +00:00
$GroupIDs = $DB->collect('GroupID');
$Importances = $DB->to_array(false, MYSQLI_BOTH, false);
2013-06-20 08:01:00 +00:00
$Cache->cache_value("artist_groups_$ArtistID", $Importances, 0);
2012-11-20 08:00:19 +00:00
} else {
$GroupIDs = array();
foreach ($Importances as $Group) {
$GroupIDs[] = $Group['GroupID'];
}
}
if (count($GroupIDs) > 0) {
2013-02-25 21:16:55 +00:00
$TorrentList = Torrents::get_groups($GroupIDs, true, true);
2012-10-28 08:00:19 +00:00
} else {
$TorrentList = array();
2011-03-28 14:21:28 +00:00
}
$NumGroups = count($TorrentList);
2012-11-20 08:00:19 +00:00
if (!empty($TorrentList)) {
2011-03-28 14:21:28 +00:00
?>
<div id="discog_table">
<?
}
2013-07-19 08:00:28 +00:00
// Deal with torrents without release types, which can end up here
2013-07-24 08:00:46 +00:00
// if they're uploaded with a non-grouping category ID
2013-07-19 08:00:28 +00:00
$UnknownRT = array_search('Unknown', $ReleaseTypes);
if ($UnknownRT === false) {
$UnknownRT = 1025;
$ReleaseTypes[$UnknownRT] = 'Unknown';
}
// Get list of used release types
2011-03-28 14:21:28 +00:00
$UsedReleases = array();
2012-11-20 08:00:19 +00:00
foreach ($Importances as $ID => $Group) {
2012-02-23 08:00:18 +00:00
switch ($Importances[$ID]['Importance']) {
case '2':
$Importances[$ID]['ReleaseType'] = 1024;
$GuestAlbums = true;
break;
2012-10-11 08:00:15 +00:00
2012-02-23 08:00:18 +00:00
case '3':
$Importances[$ID]['ReleaseType'] = 1023;
$RemixerAlbums = true;
break;
2012-10-11 08:00:15 +00:00
2012-02-23 08:00:18 +00:00
case '4':
$Importances[$ID]['ReleaseType'] = 1022;
$ComposerAlbums = true;
break;
2012-10-11 08:00:15 +00:00
2012-02-23 08:00:18 +00:00
case '7':
$Importances[$ID]['ReleaseType'] = 1021;
$ProducerAlbums = true;
break;
2012-10-11 08:00:15 +00:00
2012-02-23 08:00:18 +00:00
default:
2013-07-19 08:00:28 +00:00
if (!isset($ReleaseTypes[$TorrentList[$Group['GroupID']]['ReleaseType']])) {
$TorrentList[$Group['GroupID']]['ReleaseType'] = $UnknownRT;
}
2012-02-23 08:00:18 +00:00
$Importances[$ID]['ReleaseType'] = $TorrentList[$Group['GroupID']]['ReleaseType'];
2011-03-28 14:21:28 +00:00
}
2012-10-11 08:00:15 +00:00
2012-11-20 08:00:19 +00:00
if (!isset($UsedReleases[$Importances[$ID]['ReleaseType']])) {
$UsedReleases[$Importances[$ID]['ReleaseType']] = true;
2012-10-11 08:00:15 +00:00
}
2012-11-20 08:00:19 +00:00
$Importances[$ID]['Sort'] = $ID;
2011-03-28 14:21:28 +00:00
}
2012-11-20 08:00:19 +00:00
if (!empty($GuestAlbums)) {
2013-06-20 08:01:00 +00:00
$ReleaseTypes[1024] = 'Guest Appearance';
2011-03-28 14:21:28 +00:00
}
2012-11-20 08:00:19 +00:00
if (!empty($RemixerAlbums)) {
2013-06-20 08:01:00 +00:00
$ReleaseTypes[1023] = 'Remixed By';
2011-03-28 14:21:28 +00:00
}
2012-11-20 08:00:19 +00:00
if (!empty($ComposerAlbums)) {
2013-06-20 08:01:00 +00:00
$ReleaseTypes[1022] = 'Composition';
2011-11-20 08:00:18 +00:00
}
2012-11-20 08:00:19 +00:00
if (!empty($ProducerAlbums)) {
2013-06-20 08:01:00 +00:00
$ReleaseTypes[1021] = 'Produced By';
2012-02-19 08:00:19 +00:00
}
2012-11-20 08:00:19 +00:00
2012-10-27 08:00:09 +00:00
//Custom sorting for releases
2012-11-20 08:00:19 +00:00
if (!empty($LoggedUser['SortHide'])) {
$SortOrder = array_flip(array_keys($LoggedUser['SortHide']));
} else {
$SortOrder = $ReleaseTypes;
}
// If the $SortOrder array doesn't have all release types, put the missing ones at the end
2013-07-01 08:01:00 +00:00
$MissingTypes = array_diff_key($ReleaseTypes, $SortOrder);
if (!empty($MissingTypes)) {
2012-11-20 08:00:19 +00:00
$MaxOrder = max($SortOrder);
2013-07-01 08:01:00 +00:00
foreach (array_keys($MissingTypes) as $Missing) {
2012-11-20 08:00:19 +00:00
$SortOrder[$Missing] = ++$MaxOrder;
}
2012-10-27 08:00:09 +00:00
}
2012-11-20 08:00:19 +00:00
uasort($Importances, function ($A, $B) use ($SortOrder) {
if ($SortOrder[$A['ReleaseType']] == $SortOrder[$B['ReleaseType']]) {
2013-06-20 08:01:00 +00:00
return (($A['Sort'] < $B['Sort']) ? -1 : 1);
2012-11-20 08:00:19 +00:00
}
2013-06-20 08:01:00 +00:00
return (($SortOrder[$A['ReleaseType']] < $SortOrder[$B['ReleaseType']]) ? -1 : 1);
2012-11-20 08:00:19 +00:00
});
// Sort the anchors at the top of the page the same way as release types
$UsedReleases = array_flip(array_intersect_key($SortOrder, $UsedReleases));
2011-03-28 14:21:28 +00:00
reset($TorrentList);
2012-11-20 08:00:19 +00:00
if (!empty($UsedReleases)) { ?>
2011-03-28 14:21:28 +00:00
<div class="box center">
<?
2013-04-17 08:00:58 +00:00
foreach ($UsedReleases as $ReleaseID) {
2013-05-01 08:00:16 +00:00
switch ($ReleaseTypes[$ReleaseID]) {
2013-06-20 08:01:00 +00:00
case 'Remix':
$DisplayName = 'Remixes';
2011-03-28 14:21:28 +00:00
break;
2013-06-20 08:01:00 +00:00
case 'Anthology':
$DisplayName = 'Anthologies';
2011-03-28 14:21:28 +00:00
break;
2013-06-20 08:01:00 +00:00
case 'DJ Mix':
$DisplayName = 'DJ Mixes';
2011-11-20 08:00:18 +00:00
break;
2013-06-20 08:01:00 +00:00
default:
$DisplayName = $ReleaseTypes[$ReleaseID].'s';
2011-03-28 14:21:28 +00:00
break;
}
2013-02-10 08:00:29 +00:00
2013-09-08 08:00:57 +00:00
if (!empty($LoggedUser['DiscogView']) || (isset($LoggedUser['SortHide'][$ReleaseID]) && $LoggedUser['SortHide'][$ReleaseID] == 1)) {
2013-06-17 08:01:02 +00:00
$ToggleStr = " onclick=\"$('.releases_$ReleaseID').gshow(); return true;\"";
2011-12-15 08:00:20 +00:00
} else {
$ToggleStr = '';
}
2011-03-28 14:21:28 +00:00
?>
2013-06-17 08:01:02 +00:00
<a href="#torrents_<?=str_replace(' ', '_', strtolower($ReleaseTypes[$ReleaseID]))?>" class="brackets"<?=$ToggleStr?>><?=$DisplayName?></a>
2011-03-28 14:21:28 +00:00
<?
}
if ($NumRequests > 0) {
?>
2013-02-09 08:01:01 +00:00
<a href="#requests" class="brackets">Requests</a>
2011-03-28 14:21:28 +00:00
<? } ?>
</div>
<? }
$NumTorrents = 0;
$NumSeeders = 0;
$NumLeechers = 0;
$NumSnatches = 0;
2012-02-27 08:00:22 +00:00
foreach ($TorrentList as $GroupID => $Group) {
2013-02-25 21:16:55 +00:00
// $Tags array is for the sidebar on the right.
// Skip compilations and soundtracks.
2013-03-21 08:00:33 +00:00
$Merge = $Group['ReleaseType'] != 7 && $Group['ReleaseType'] != 3;
2012-02-27 08:00:22 +00:00
2013-03-21 08:00:33 +00:00
$TorrentTags = new Tags($Group['TagList'], $Merge);
2012-10-11 08:00:15 +00:00
2012-02-27 08:00:22 +00:00
foreach ($Group['Torrents'] as $TorrentID => $Torrent) {
$NumTorrents++;
2012-10-11 08:00:15 +00:00
2012-02-27 08:00:22 +00:00
$Torrent['Seeders'] = (int)$Torrent['Seeders'];
$Torrent['Leechers'] = (int)$Torrent['Leechers'];
$Torrent['Snatched'] = (int)$Torrent['Snatched'];
2012-10-11 08:00:15 +00:00
2013-06-20 08:01:00 +00:00
$NumSeeders += $Torrent['Seeders'];
$NumLeechers += $Torrent['Leechers'];
$NumSnatches += $Torrent['Snatched'];
2012-02-27 08:00:22 +00:00
}
}
2011-03-28 14:21:28 +00:00
$OpenTable = false;
2011-10-18 08:00:10 +00:00
$ShowGroups = !isset($LoggedUser['TorrentGrouping']) || $LoggedUser['TorrentGrouping'] == 0;
$HideTorrents = ($ShowGroups ? '' : ' hidden');
2012-02-23 08:00:18 +00:00
$OldGroupID = 0;
2012-11-20 08:00:19 +00:00
$LastReleaseType = 0;
2011-10-18 08:00:10 +00:00
2012-02-23 08:00:18 +00:00
foreach ($Importances as $Group) {
2013-02-28 08:00:29 +00:00
extract(Torrents::array_group($TorrentList[$Group['GroupID']]), EXTR_OVERWRITE);
$ReleaseType = $Group['ReleaseType'];
2012-10-11 08:00:15 +00:00
2012-02-23 08:00:18 +00:00
if ($GroupID == $OldGroupID && $ReleaseType == $OldReleaseType) {
continue;
} else {
$OldGroupID = $GroupID;
$OldReleaseType = $ReleaseType;
}
2012-10-11 08:00:15 +00:00
2012-10-27 08:00:09 +00:00
/* if (!empty($LoggedUser['DiscogView']) || (isset($LoggedUser['HideTypes']) && in_array($ReleaseType, $LoggedUser['HideTypes']))) {
$HideDiscog = ' hidden';
} else {
$HideDiscog = '';
} */
if (!empty($LoggedUser['DiscogView']) || (isset($LoggedUser['SortHide']) && array_key_exists($ReleaseType, $LoggedUser['SortHide']) && $LoggedUser['SortHide'][$ReleaseType] == 1)) {
2012-02-27 08:00:22 +00:00
$HideDiscog = ' hidden';
} else {
$HideDiscog = '';
}
2012-10-11 08:00:15 +00:00
2013-03-21 08:00:33 +00:00
$TorrentTags = new Tags($TagList, false);
2012-10-11 08:00:15 +00:00
2013-04-17 08:00:58 +00:00
if ($ReleaseType != $LastReleaseType) {
2013-05-01 08:00:16 +00:00
switch ($ReleaseTypes[$ReleaseType]) {
2013-06-20 08:01:00 +00:00
case 'Remix':
$DisplayName = 'Remixes';
2011-03-28 14:21:28 +00:00
break;
2013-06-20 08:01:00 +00:00
case 'Anthology':
$DisplayName = 'Anthologies';
2011-03-28 14:21:28 +00:00
break;
2013-06-20 08:01:00 +00:00
case 'DJ Mix':
$DisplayName = 'DJ Mixes';
2011-11-20 08:00:18 +00:00
break;
2013-06-20 08:01:00 +00:00
default:
$DisplayName = $ReleaseTypes[$ReleaseType].'s';
2011-03-28 14:21:28 +00:00
break;
}
2013-06-20 08:01:00 +00:00
$ReleaseTypeLabel = strtolower(str_replace(' ', '_', $ReleaseTypes[$ReleaseType]));
2013-04-17 08:00:58 +00:00
if ($OpenTable) { ?>
2011-03-28 14:21:28 +00:00
</table>
<? } ?>
2012-09-01 08:00:24 +00:00
<table class="torrent_table grouped release_table" id="torrents_<?=$ReleaseTypeLabel?>">
2011-03-28 14:21:28 +00:00
<tr class="colhead_dark">
<td class="small"><!-- expand/collapse --></td>
2013-06-17 08:01:02 +00:00
<td width="70%"><a href="#">&uarr;</a>&nbsp;<strong><?=$DisplayName?></strong> (<a href="#" onclick="$('.releases_<?=$ReleaseType?>').gtoggle(true); return false;">View</a>)</td>
2011-03-28 14:21:28 +00:00
<td>Size</td>
2013-11-01 08:01:02 +00:00
<td class="sign snatches"><img src="static/styles/<?=$LoggedUser['StyleName'] ?>/images/snatched.png" class="tooltip" alt="Snatches" title="Snatches" /></td>
<td class="sign seeders"><img src="static/styles/<?=$LoggedUser['StyleName'] ?>/images/seeders.png" class="tooltip" alt="Seeders" title="Seeders" /></td>
<td class="sign leechers"><img src="static/styles/<?=$LoggedUser['StyleName'] ?>/images/leechers.png" class="tooltip" alt="Leechers" title="Leechers" /></td>
2011-03-28 14:21:28 +00:00
</tr>
<? $OpenTable = true;
$LastReleaseType = $ReleaseType;
}
2012-10-11 08:00:15 +00:00
2013-10-26 08:00:58 +00:00
$DisplayName = "<a href=\"torrents.php?id=$GroupID\" class=\"tooltip\" title=\"View torrent group\" dir=\"ltr\">$GroupName</a>";
2013-04-17 08:00:58 +00:00
if (check_perms('users_mod') || check_perms('torrents_fix_ghosts')) {
2013-08-28 23:08:41 +00:00
$DisplayName .= ' <a href="torrents.php?action=fix_group&amp;groupid='.$GroupID.'&amp;artistid='.$ArtistID.'&amp;auth='.$LoggedUser['AuthKey'].'" class="brackets tooltip" title="Fix ghost DB entry">Fix</a>';
2011-03-28 14:21:28 +00:00
}
2012-10-11 08:00:15 +00:00
2013-05-04 08:00:48 +00:00
switch ($ReleaseType) {
2012-02-19 08:00:19 +00:00
case 1023: // Remixes, DJ Mixes, Guest artists, and Producers need the artist name
2011-11-21 08:00:23 +00:00
case 1024:
2012-02-19 08:00:19 +00:00
case 1021:
2011-11-21 08:00:23 +00:00
case 8:
2011-12-01 08:00:22 +00:00
if (!empty($ExtendedArtists[1]) || !empty($ExtendedArtists[4]) || !empty($ExtendedArtists[5]) || !empty($ExtendedArtists[6])) {
2011-11-21 08:00:23 +00:00
unset($ExtendedArtists[2]);
unset($ExtendedArtists[3]);
2012-10-11 08:00:15 +00:00
$DisplayName = Artists::display_artists($ExtendedArtists).$DisplayName;
2013-04-17 08:00:58 +00:00
} elseif (count($GroupArtists) > 0) {
2012-10-11 08:00:15 +00:00
$DisplayName = Artists::display_artists(array(1 => $Artists), true, true).$DisplayName;
2011-11-21 08:00:23 +00:00
}
break;
2013-04-17 08:00:58 +00:00
case 1022: // Show performers on composer pages
2011-11-21 08:00:23 +00:00
if (!empty($ExtendedArtists[1]) || !empty($ExtendedArtists[4]) || !empty($ExtendedArtists[5])) {
unset($ExtendedArtists[4]);
unset($ExtendedArtists[3]);
unset($ExtendedArtists[6]);
2012-10-11 08:00:15 +00:00
$DisplayName = Artists::display_artists($ExtendedArtists).$DisplayName;
2013-04-17 08:00:58 +00:00
} elseif (count($GroupArtists) > 0) {
2012-10-11 08:00:15 +00:00
$DisplayName = Artists::display_artists(array(1 => $Artists), true, true).$DisplayName;
2011-11-21 08:00:23 +00:00
}
break;
default: // Show composers otherwise
if (!empty($ExtendedArtists[4])) {
2012-10-11 08:00:15 +00:00
$DisplayName = Artists::display_artists(array(4 => $ExtendedArtists[4]), true, true).$DisplayName;
2011-11-21 08:00:23 +00:00
}
2011-03-28 14:21:28 +00:00
}
2013-04-17 08:00:58 +00:00
if ($GroupYear > 0) {
2013-06-20 08:01:00 +00:00
$DisplayName = "$GroupYear - $DisplayName";
2013-04-17 08:00:58 +00:00
}
2011-03-28 14:21:28 +00:00
2013-04-17 08:00:58 +00:00
if ($GroupVanityHouse) {
2013-10-26 08:00:58 +00:00
$DisplayName .= ' [<abbr class="tooltip" title="This is a Vanity House release">VH</abbr>]';
2013-04-17 08:00:58 +00:00
}
2013-06-20 08:01:00 +00:00
$SnatchedGroupClass = ($GroupFlags['IsSnatched'] ? ' snatched_group' : '');
2011-03-28 14:21:28 +00:00
?>
2012-12-06 08:00:17 +00:00
<tr class="releases_<?=$ReleaseType?> group discog<?=$SnatchedGroupClass . $HideDiscog?>">
<td class="center">
2013-08-28 23:08:41 +00:00
<div id="showimg_<?=$GroupID?>" class="<?=($ShowGroups ? 'hide' : 'show')?>_torrents">
<a href="#" class="tooltip show_torrents_link" onclick="toggle_group(<?=$GroupID?>, this, event);" title="Collapse this group. Hold &quot;Ctrl&quot; while clicking to collapse all groups in this release type."></a>
</div>
</td>
2013-02-25 21:16:55 +00:00
<td colspan="5" class="big_info">
2013-08-28 23:08:41 +00:00
<? if ($LoggedUser['CoverArt']) { ?>
2013-02-25 21:16:55 +00:00
<div class="group_image float_left clear">
2013-04-30 18:18:07 +00:00
<? ImageTools::cover_thumb($WikiImage, $GroupCategoryID) ?>
2013-02-25 21:16:55 +00:00
</div>
2013-08-28 23:08:41 +00:00
<? } ?>
2013-02-25 21:16:55 +00:00
<div class="group_info clear">
2013-03-29 08:00:08 +00:00
<strong><?=$DisplayName?></strong>
2013-09-08 08:00:57 +00:00
<? if (Bookmarks::has_bookmarked('torrent', $GroupID)) { ?>
<a style="float: right;" href="#" id="bookmarklink_torrent_<?=$GroupID?>" class="remove_bookmark brackets" onclick="Unbookmark('torrent', <?=$GroupID?>, 'Bookmark'); return false;">Remove bookmark</a>
<? } else { ?>
<a style="float: right;" href="#" id="bookmarklink_torrent_<?=$GroupID?>" class="add_bookmark brackets" onclick="Bookmark('torrent', <?=$GroupID?>, 'Remove bookmark'); return false;">Bookmark</a>
<? }
$VoteType = isset($UserVotes[$GroupID]['Type']) ? $UserVotes[$GroupID]['Type'] : '';
Votes::vote_link($GroupID, $VoteType);
?>
2013-05-21 08:01:09 +00:00
<div class="tags"><?=$TorrentTags->format('torrents.php?taglist=', $Name)?></div>
2013-02-25 21:16:55 +00:00
</div>
2011-03-28 14:21:28 +00:00
</td>
</tr>
<?
$LastRemasterYear = '-';
$LastRemasterTitle = '';
$LastRemasterRecordLabel = '';
$LastRemasterCatalogueNumber = '';
$LastMedia = '';
$EditionID = 0;
unset($FirstUnknown);
2012-10-11 08:00:15 +00:00
2011-03-28 14:21:28 +00:00
foreach ($Torrents as $TorrentID => $Torrent) {
if ($Torrent['Remastered'] && !$Torrent['RemasterYear']) {
$FirstUnknown = !isset($FirstUnknown);
}
2013-06-20 08:01:00 +00:00
$SnatchedTorrentClass = ($Torrent['IsSnatched'] ? ' snatched_torrent' : '');
2012-10-11 08:00:15 +00:00
2013-08-28 23:08:41 +00:00
if ($Torrent['RemasterTitle'] != $LastRemasterTitle
|| $Torrent['RemasterYear'] != $LastRemasterYear
|| $Torrent['RemasterRecordLabel'] != $LastRemasterRecordLabel
|| $Torrent['RemasterCatalogueNumber'] != $LastRemasterCatalogueNumber
2013-09-08 08:00:57 +00:00
|| isset($FirstUnknown) && $FirstUnknown
2013-08-28 23:08:41 +00:00
|| $Torrent['Media'] != $LastMedia
2013-06-20 08:01:00 +00:00
) {
2012-10-11 08:00:15 +00:00
$EditionID++;
2011-03-28 14:21:28 +00:00
?>
2013-02-23 08:00:22 +00:00
<tr class="releases_<?=$ReleaseType?> groupid_<?=$GroupID?> edition group_torrent discog<?=$SnatchedGroupClass . $HideDiscog . $HideTorrents?>">
2013-08-28 23:08:41 +00:00
<td colspan="6" class="edition_info"><strong><a href="#" onclick="toggle_edition(<?=$GroupID?>, <?=$EditionID?>, this, event);" class="tooltip" title="Collapse this edition. Hold &quot;Ctrl&quot; while clicking to collapse all editions in this torrent group.">&minus;</a> <?=Torrents::edition_string($Torrent, $TorrentList[$Group['GroupID']])?></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="releases_<?=$ReleaseType?> torrent_row groupid_<?=$GroupID?> edition_<?=$EditionID?> group_torrent discog<?=$SnatchedTorrentClass . $SnatchedGroupClass . $HideDiscog . $HideTorrents?>">
<td colspan="2">
2011-03-28 14:21:28 +00:00
<span>
2013-10-26 08:00:58 +00:00
[ <a href="torrents.php?action=download&amp;id=<?=$TorrentID?>&amp;authkey=<?=$LoggedUser['AuthKey']?>&amp;torrent_pass=<?=$LoggedUser['torrent_pass']?>" class="tooltip" title="Download"><?=$Torrent['HasFile'] ? 'DL' : 'Missing'?></a>
2012-10-28 08:00:19 +00:00
<? if (Torrents::can_use_token($Torrent)) { ?>
2013-10-26 08:00:58 +00:00
| <a href="torrents.php?action=download&amp;id=<?=$TorrentID ?>&amp;authkey=<?=$LoggedUser['AuthKey']?>&amp;torrent_pass=<?=$LoggedUser['torrent_pass']?>&amp;usetoken=1" class="tooltip" 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
<? } ?> ]
2012-10-28 08:00:19 +00:00
</span>
&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>
2013-08-28 23:08:41 +00:00
<td class="number_column nobr"><?=Format::get_size($Torrent['Size'])?></td>
<td class="number_column"><?=number_format($Torrent['Snatched'])?></td>
<td class="number_column<?=(($Torrent['Seeders'] == 0) ? ' r00' : '')?>"><?=number_format($Torrent['Seeders'])?></td>
<td class="number_column"><?=number_format($Torrent['Leechers'])?></td>
2011-03-28 14:21:28 +00:00
</tr>
<?
}
}
2013-04-17 08:00:58 +00:00
if (!empty($TorrentList)) { ?>
2011-03-28 14:21:28 +00:00
</table>
</div>
2013-06-20 08:01:00 +00:00
<?
}
2012-10-11 08:00:15 +00:00
2011-03-28 14:21:28 +00:00
$TorrentDisplayList = ob_get_clean();
//----------------- End building list and getting stats
2013-08-28 23:08:41 +00:00
View::show_header($Name, 'browse,requests,bbcode,comments,voting,recommend,subscriptions');
2011-03-28 14:21:28 +00:00
?>
<div class="thin">
2012-08-19 08:00:19 +00:00
<div class="header">
<h2><?=display_str($Name)?><? if ($RevisionID) { ?> (Revision #<?=$RevisionID?>)<? } if ($VanityHouseArtist) { ?> [Vanity House] <? } ?></h2>
<div class="linkbox">
2013-06-20 08:01:00 +00:00
<? if (check_perms('site_submit_requests')) { ?>
2013-01-24 08:00:24 +00:00
<a href="requests.php?action=new&amp;artistid=<?=$ArtistID?>" class="brackets">Add request</a>
2013-06-20 08:01:00 +00:00
<?
}
2011-03-28 14:21:28 +00:00
if (check_perms('site_torrents_notify')) {
if (($Notify = $Cache->get_value('notify_artists_'.$LoggedUser['ID'])) === false) {
2013-06-20 08:01:00 +00:00
$DB->query("
SELECT ID, Artists
FROM users_notify_filters
WHERE UserID = '$LoggedUser[ID]'
AND Label = 'Artist notifications'
LIMIT 1");
$Notify = $DB->next_record(MYSQLI_ASSOC, false);
2011-03-28 14:21:28 +00:00
$Cache->cache_value('notify_artists_'.$LoggedUser['ID'], $Notify, 0);
}
2013-08-28 23:08:41 +00:00
if (stripos($Notify['Artists'], "|$Name|") === false) {
2011-03-28 14:21:28 +00:00
?>
2013-01-24 08:00:24 +00:00
<a href="artist.php?action=notify&amp;artistid=<?=$ArtistID?>&amp;auth=<?=$LoggedUser['AuthKey']?>" class="brackets">Notify of new uploads</a>
2013-06-20 08:01:00 +00:00
<? } else { ?>
2013-01-24 08:00:24 +00:00
<a href="artist.php?action=notifyremove&amp;artistid=<?=$ArtistID?>&amp;auth=<?=$LoggedUser['AuthKey']?>" class="brackets">Do not notify of new uploads</a>
2011-03-28 14:21:28 +00:00
<?
}
}
2013-04-17 08:00:58 +00:00
if (Bookmarks::has_bookmarked('artist', $ArtistID)) {
?>
2013-06-20 08:01:00 +00:00
<a href="#" id="bookmarklink_artist_<?=$ArtistID?>" onclick="Unbookmark('artist', <?=$ArtistID?>, 'Bookmark'); return false;" class="brackets">Remove bookmark</a>
<? } else { ?>
<a href="#" id="bookmarklink_artist_<?=$ArtistID?>" onclick="Bookmark('artist', <?=$ArtistID?>, 'Remove bookmark'); return false;" class="brackets">Bookmark</a>
<? } ?>
2013-10-26 08:00:58 +00:00
<a href="#" id="subscribelink_artist<?=$ArtistID?>" class="brackets" onclick="SubscribeComments('artist', <?=$ArtistID?>);return false;"><?=Subscriptions::has_subscribed_comments('artist', $ArtistID) !== false ? 'Unsubscribe' : 'Subscribe'?></a>
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-17 08:00:58 +00:00
if (check_perms('site_edit_wiki')) {
2011-03-28 14:21:28 +00:00
?>
2013-01-24 08:00:24 +00:00
<a href="artist.php?action=edit&amp;artistid=<?=$ArtistID?>" class="brackets">Edit</a>
2013-04-17 08:00:58 +00:00
<? } ?>
2013-01-24 08:00:24 +00:00
<a href="artist.php?action=history&amp;artistid=<?=$ArtistID?>" class="brackets">View history</a>
2013-06-20 08:01:00 +00:00
<? if ($RevisionID && check_perms('site_edit_wiki')) { ?>
<a href="artist.php?action=revert&amp;artistid=<?=$ArtistID?>&amp;revisionid=<?=$RevisionID?>&amp;auth=<?=$LoggedUser['AuthKey']?>" class="brackets">Revert to this revision</a>
<? } ?>
2013-01-24 08:00:24 +00:00
<a href="artist.php?id=<?=$ArtistID?>#info" class="brackets">Info</a>
2013-06-13 08:01:05 +00:00
<? if (defined('LASTFM_API_KEY')) { ?>
2013-01-24 08:00:24 +00:00
<a href="artist.php?id=<?=$ArtistID?>#concerts" class="brackets">Concerts</a>
2013-06-12 08:00:46 +00:00
<? } ?>
2013-01-24 08:00:24 +00:00
<a href="artist.php?id=<?=$ArtistID?>#artistcomments" class="brackets">Comments</a>
2013-04-17 08:00:58 +00:00
<? if (check_perms('site_delete_artist') && check_perms('torrents_delete')) { ?>
2013-01-24 08:00:24 +00:00
<a href="artist.php?action=delete&amp;artistid=<?=$ArtistID?>&amp;auth=<?=$LoggedUser['AuthKey']?>" class="brackets">Delete</a>
2013-04-17 08:00:58 +00:00
<? } ?>
2012-08-19 08:00:19 +00:00
</div>
2013-04-17 08:00:58 +00:00
</div>
2013-03-06 08:00:23 +00:00
<? /* Misc::display_recommend($ArtistID, "artist"); */ ?>
2013-04-17 08:00:58 +00:00
<div class="sidebar">
2013-04-30 18:18:07 +00:00
<? if ($Image) { ?>
2012-08-17 08:00:13 +00:00
<div class="box box_image">
2011-03-28 14:21:28 +00:00
<div class="head"><strong><?=$Name?></strong></div>
2013-04-17 08:00:58 +00:00
<div style="text-align: center; padding: 10px 0px;">
2013-06-20 08:01:00 +00:00
<img style="max-width: 220px;" src="<?=ImageTools::process($Image, true)?>" alt="<?=$Name?>" onclick="lightbox.init('<?=ImageTools::process($Image)?>', 220);" />
2011-03-28 14:21:28 +00:00
</div>
</div>
2012-06-21 08:00:14 +00:00
<? } ?>
2012-08-17 08:00:13 +00:00
<div class="box box_search">
2013-08-28 23:08:41 +00:00
<div class="head"><strong>File Lists Search</strong></div>
2012-10-29 08:00:20 +00:00
<ul class="nobullet">
<li>
<form class="search_form" name="filelists" action="torrents.php">
<input type="hidden" name="artistname" value="<?=$Name?>" />
<input type="hidden" name="action" value="advanced" />
<input type="text" autocomplete="off" id="filelist" name="filelist" size="20" />
<input type="submit" value="&gt;" />
</form>
</li>
</ul>
</div>
2012-06-21 08:00:14 +00:00
<?
2013-04-17 08:00:58 +00:00
if (check_perms('zip_downloader')) {
if (isset($LoggedUser['Collector'])) {
2013-07-10 00:08:53 +00:00
list($ZIPList, $ZIPPrefs) = $LoggedUser['Collector'];
$ZIPList = explode(':', $ZIPList);
2011-03-28 14:21:28 +00:00
} else {
2013-07-10 00:08:53 +00:00
$ZIPList = array('00', '11');
2011-03-28 14:21:28 +00:00
$ZIPPrefs = 1;
}
?>
2012-11-18 08:00:19 +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="artist.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']?>" />
2012-10-11 08:00:15 +00:00
<input type="hidden" name="artistid" value="<?=$ArtistID?>" />
2012-10-29 08:00:20 +00:00
<ul id="list" class="nobullet">
2011-03-28 14:21:28 +00:00
<? foreach ($ZIPList as $ListItem) { ?>
2012-10-29 08:00:20 +00:00
<li id="list<?=$ListItem?>">
<input type="hidden" name="list[]" value="<?=$ListItem?>" />
2013-04-17 08:00:58 +00:00
<span style="float: left;"><?=$ZIPOptions[$ListItem]['2']?></span>
2013-10-26 08:00:58 +00:00
<span class="remove remove_collector"><a href="#" onclick="remove_selection('<?=$ListItem?>'); return false;" style="float: right;" class="brackets tooltip" title="Remove format from the Collector">X</a></span>
2013-04-17 08:00:58 +00:00
<br style="clear: all;" />
2012-10-29 08:00:20 +00:00
</li>
2011-03-28 14:21:28 +00:00
<? } ?>
2012-10-29 08:00:20 +00:00
</ul>
2013-04-17 08:00:58 +00:00
<select id="formats" style="width: 180px;">
2011-03-28 14:21:28 +00:00
<?
$OpenGroup = false;
2013-04-17 08:00:58 +00:00
$LastGroupID = -1;
2011-03-28 14:21:28 +00:00
foreach ($ZIPOptions as $Option) {
2013-07-10 00:08:53 +00:00
list($GroupID, $OptionID, $OptName) = $Option;
2011-03-28 14:21:28 +00:00
2013-04-17 08:00:58 +00:00
if ($GroupID != $LastGroupID) {
$LastGroupID = $GroupID;
if ($OpenGroup) { ?>
2012-10-29 08:00:20 +00:00
</optgroup>
2011-03-28 14:21:28 +00:00
<? } ?>
2012-10-29 08:00:20 +00:00
<optgroup label="<?=$ZIPGroups[$GroupID]?>">
2011-03-28 14:21:28 +00:00
<? $OpenGroup = true;
}
?>
2013-05-15 08:00:54 +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
<?
}
?>
2012-10-29 08:00:20 +00:00
</optgroup>
</select>
<button type="button" onclick="add_selection()">+</button>
2013-05-04 08:00:48 +00:00
<select name="preference" style="width: 210px;">
<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>
2012-10-29 08:00:20 +00:00
</select>
2013-05-15 08:00:54 +00:00
<input type="submit" style="width: 210px;" value="Download" />
2011-03-28 14:21:28 +00:00
</form>
</div>
</div>
2013-08-28 23:08:41 +00:00
<?
} //if (check_perms('zip_downloader')) ?>
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>Tags</strong></div>
<ul class="stats nobullet">
2013-08-28 23:08:41 +00:00
<? Tags::format_top(50, 'torrents.php?taglist=', $Name); ?>
2011-03-28 14:21:28 +00:00
</ul>
</div>
<?
// Stats
?>
2012-10-29 08:00:20 +00:00
<div class="box box_info box_statistics_artist">
2011-03-28 14:21:28 +00:00
<div class="head"><strong>Statistics</strong></div>
<ul class="stats nobullet">
2012-10-06 08:00:19 +00:00
<li>Number of groups: <?=number_format($NumGroups)?></li>
<li>Number of torrents: <?=number_format($NumTorrents)?></li>
<li>Number of seeders: <?=number_format($NumSeeders)?></li>
<li>Number of leechers: <?=number_format($NumLeechers)?></li>
<li>Number of snatches: <?=number_format($NumSnatches)?></li>
2011-03-28 14:21:28 +00:00
</ul>
</div>
<?
2013-04-17 08:00:58 +00:00
if (empty($SimilarArray)) {
2011-03-28 14:21:28 +00:00
$DB->query("
SELECT
2013-04-17 08:00:58 +00:00
s2.ArtistID,
a.Name,
ass.Score,
ass.SimilarID
2011-03-28 14:21:28 +00:00
FROM artists_similar AS s1
2013-08-28 23:08:41 +00:00
JOIN artists_similar AS s2 ON s1.SimilarID = s2.SimilarID AND s1.ArtistID != s2.ArtistID
JOIN artists_similar_scores AS ass ON ass.SimilarID = s1.SimilarID
JOIN artists_group AS a ON a.ArtistID = s2.ArtistID
WHERE s1.ArtistID = '$ArtistID'
2011-03-28 14:21:28 +00:00
ORDER BY ass.Score DESC
LIMIT 30
");
$SimilarArray = $DB->to_array();
$NumSimilar = count($SimilarArray);
}
?>
2012-08-17 08:00:13 +00:00
<div class="box box_artists">
2013-08-28 23:08:41 +00:00
<div class="head"><strong>Similar Artists</strong></div>
2011-03-28 14:21:28 +00:00
<ul class="stats nobullet">
2013-08-28 23:08:41 +00:00
<? if ($NumSimilar == 0) { ?>
2012-10-11 08:00:15 +00:00
<li><span style="font-style: italic;">None found</span></li>
2013-08-28 23:08:41 +00:00
<?
}
2011-03-28 14:21:28 +00:00
$First = true;
2012-10-11 08:00:15 +00:00
foreach ($SimilarArray as $SimilarArtist) {
2011-03-28 14:21:28 +00:00
list($Artist2ID, $Artist2Name, $Score, $SimilarID) = $SimilarArtist;
2013-04-17 08:00:58 +00:00
$Score = $Score / 100;
if ($First) {
2012-09-23 08:00:25 +00:00
$Max = $Score + 1;
2011-03-28 14:21:28 +00:00
$First = false;
}
2012-09-23 08:00:25 +00:00
2013-08-28 23:08:41 +00:00
$FontSize = (ceil(((($Score - 2) / $Max - 2) * 4))) + 8;
2012-09-23 08:00:25 +00:00
2011-03-28 14:21:28 +00:00
?>
<li>
2013-11-05 08:01:12 +00:00
<span class="tooltip" title="<?=$Score?>"><a href="artist.php?id=<?=$Artist2ID?>" style="float: left; display: block;"><?=$Artist2Name?></a></span>
2013-04-17 08:00:58 +00:00
<div style="float: right; display: block; letter-spacing: -1px;">
2013-10-05 08:01:00 +00:00
<a href="artist.php?action=vote_similar&amp;artistid=<?=$ArtistID?>&amp;similarid=<?=$SimilarID?>&amp;way=up" class="tooltip brackets vote_artist_up" title="Vote up this similar artist. Use this when you feel that the two artists are quite similar.">&and;</a>
<a href="artist.php?action=vote_similar&amp;artistid=<?=$ArtistID?>&amp;similarid=<?=$SimilarID?>&amp;way=down" class="tooltip brackets vote_artist_down" title="Vote down this similar artist. Use this when you feel that the two artists are not all that similar.">&or;</a>
2013-04-17 08:00:58 +00:00
<? if (check_perms('site_delete_tag')) { ?>
2013-09-11 08:00:55 +00:00
<span class="remove remove_artist"><a href="artist.php?action=delete_similar&amp;similarid=<?=$SimilarID?>&amp;auth=<?=$LoggedUser['AuthKey']?>" class="tooltip brackets" title="Remove this similar artist">X</a></span>
2012-09-23 08:00:25 +00:00
<? } ?>
2011-03-28 14:21:28 +00:00
</div>
2013-05-04 08:00:48 +00:00
<br style="clear: both;" />
2011-03-28 14:21:28 +00:00
</li>
<? } ?>
</ul>
</div>
2012-09-15 08:00:25 +00:00
<div class="box box_addartists box_addartists_similar">
2011-03-28 14:21:28 +00:00
<div class="head"><strong>Add similar artist</strong></div>
<ul class="nobullet">
<li>
2012-09-15 08:00:25 +00:00
<form class="add_form" name="similar_artists" action="artist.php" method="post">
2011-03-28 14:21:28 +00:00
<input type="hidden" name="action" value="add_similar" />
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
<input type="hidden" name="artistid" value="<?=$ArtistID?>" />
2013-07-04 08:00:56 +00:00
<input type="text" autocomplete="off" id="artistsimilar" name="artistname" size="20"<? Users::has_autocomplete_enabled('other'); ?> />
2011-03-28 14:21:28 +00:00
<input type="submit" value="+" />
</form>
</li>
</ul>
</div>
</div>
<div class="main_column">
<?
echo $TorrentDisplayList;
2013-06-28 08:01:04 +00:00
$Collages = $Cache->get_value("artists_collages_$ArtistID");
2013-05-25 08:01:03 +00:00
if (!is_array($Collages)) {
2013-05-26 08:00:59 +00:00
$DB->query("
SELECT c.Name, c.NumTorrents, c.ID
FROM collages AS c
2013-06-28 08:01:04 +00:00
JOIN collages_artists AS ca ON ca.CollageID = c.ID
WHERE ca.ArtistID = '$ArtistID'
AND Deleted = '0'
2013-05-26 08:00:59 +00:00
AND CategoryID = '7'");
2013-05-25 08:01:03 +00:00
$Collages = $DB->to_array();
2013-06-28 08:01:04 +00:00
$Cache->cache_value("artists_collages_$ArtistID", $Collages, 3600 * 6);
2013-05-25 08:01:03 +00:00
}
if (count($Collages) > 0) {
if (count($Collages) > MAX_COLLAGES) {
// Pick some at random
$Range = range(0,count($Collages) - 1);
shuffle($Range);
$Indices = array_slice($Range, 0, MAX_COLLAGES);
2013-06-17 08:01:02 +00:00
$SeeAll = ' <a href="#" onclick="$(\'.collage_rows\').gtoggle(); return false;">(See all)</a>';
2013-05-25 08:01:03 +00:00
} else {
$Indices = range(0, count($Collages)-1);
$SeeAll = '';
}
?>
<table class="collage_table" id="collages">
<tr class="colhead">
2013-06-28 08:01:04 +00:00
<td width="85%"><a href="#">&uarr;</a>&nbsp;This artist is in <?=number_format(count($Collages))?> collage<?=((count($Collages) > 1) ? 's' : '')?><?=$SeeAll?></td>
2013-05-25 08:01:03 +00:00
<td># artists</td>
</tr>
2013-08-28 23:08:41 +00:00
<?
foreach ($Indices as $i) {
2013-05-25 08:01:03 +00:00
list($CollageName, $CollageArtists, $CollageID) = $Collages[$i];
unset($Collages[$i]);
2013-08-28 23:08:41 +00:00
?>
2013-05-25 08:01:03 +00:00
<tr>
<td><a href="collages.php?id=<?=$CollageID?>"><?=$CollageName?></a></td>
<td><?=number_format($CollageArtists)?></td>
</tr>
2013-08-28 23:08:41 +00:00
<?
}
2013-05-25 08:01:03 +00:00
foreach ($Collages as $Collage) {
list($CollageName, $CollageArtists, $CollageID) = $Collage;
2013-08-28 23:08:41 +00:00
?>
2013-05-25 08:01:03 +00:00
<tr class="collage_rows hidden">
<td><a href="collages.php?id=<?=$CollageID?>"><?=$CollageName?></a></td>
<td><?=number_format($CollageArtists)?></td>
</tr>
2013-08-28 23:08:41 +00:00
<? } ?>
2013-05-25 08:01:03 +00:00
</table>
<?
}
2013-04-17 08:00:58 +00:00
if ($NumRequests > 0) {
2012-09-23 08:00:25 +00:00
2011-03-28 14:21:28 +00:00
?>
2012-09-01 08:00:24 +00:00
<table cellpadding="6" cellspacing="1" border="0" class="request_table border" width="100%" id="requests">
2011-03-28 14:21:28 +00:00
<tr class="colhead_dark">
2013-05-04 08:00:48 +00:00
<td style="width: 48%;">
2011-03-28 14:21:28 +00:00
<a href="#">&uarr;</a>&nbsp;
2013-09-11 08:00:55 +00:00
<strong>Request Name</strong>
2011-03-28 14:21:28 +00:00
</td>
2013-10-26 08:00:58 +00:00
<td class="nobr">
2011-03-28 14:21:28 +00:00
<strong>Vote</strong>
</td>
2013-10-26 08:00:58 +00:00
<td class="nobr">
2011-03-28 14:21:28 +00:00
<strong>Bounty</strong>
</td>
<td>
<strong>Added</strong>
</td>
</tr>
<?
2013-09-13 08:00:53 +00:00
$Tags = Requests::get_tags(array_keys($Requests));
2013-10-25 08:00:59 +00:00
$Row = 'b';
2013-09-13 08:00:53 +00:00
foreach ($Requests as $RequestID => $Request) {
$CategoryName = $Categories[$Request['CategoryID'] - 1];
$Title = display_str($Request['Title']);
2013-05-04 08:00:48 +00:00
if ($CategoryName == 'Music') {
2013-05-13 08:00:33 +00:00
$ArtistForm = Requests::get_artists($RequestID);
2012-10-11 08:00:15 +00:00
$ArtistLink = Artists::display_artists($ArtistForm, true, true);
2013-09-13 08:00:53 +00:00
$FullName = $ArtistLink."<a href=\"requests.php?action=view&amp;id=$RequestID\">$Title [$Request[Year]]</a>";
2013-05-04 08:00:48 +00:00
} elseif ($CategoryName == 'Audiobooks' || $CategoryName == 'Comedy') {
2013-09-13 08:00:53 +00:00
$FullName = "<a href=\"requests.php?action=view&amp;id=$RequestID\">$Title [$Request[Year]]</a>";
2011-03-28 14:21:28 +00:00
} else {
2013-08-28 23:08:41 +00:00
$FullName = "<a href=\"requests.php?action=view&amp;id=$RequestID\">$Title</a>";
2011-03-28 14:21:28 +00:00
}
2012-09-23 08:00:25 +00:00
2013-09-13 08:00:53 +00:00
if (!empty($Tags[$RequestID])) {
$ReqTagList = array();
foreach ($Tags[$RequestID] as $TagID => $TagName) {
$ReqTagList[] = "<a href=\"requests.php?tags=$TagName\">".display_str($TagName).'</a>';
}
$ReqTagList = implode(', ', $ReqTagList);
} else {
$ReqTagList = '';
2013-02-26 08:00:42 +00:00
}
2011-03-28 14:21:28 +00:00
?>
2013-10-25 08:00:59 +00:00
<tr class="row<?=($Row === 'b' ? 'a' : 'b')?>">
2011-03-28 14:21:28 +00:00
<td>
<?=$FullName?>
2013-02-26 08:00:42 +00:00
<div class="tags"><?=$ReqTagList?></div>
2011-03-28 14:21:28 +00:00
</td>
2013-10-26 08:00:58 +00:00
<td class="nobr">
2013-09-13 08:00:53 +00:00
<span id="vote_count_<?=$RequestID?>"><?=$Request['Votes']?></span>
2013-05-30 08:00:30 +00:00
<? if (check_perms('site_vote')) { ?>
2011-03-28 14:21:28 +00:00
<input type="hidden" id="auth" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
2013-02-09 08:01:01 +00:00
&nbsp;&nbsp; <a href="javascript:Vote(0, <?=$RequestID?>)" class="brackets"><strong>+</strong></a>
2012-09-23 08:00:25 +00:00
<? } ?>
2011-03-28 14:21:28 +00:00
</td>
2013-10-26 08:00:58 +00:00
<td class="nobr">
2013-09-13 08:00:53 +00:00
<span id="bounty_<?=$RequestID?>"><?=Format::get_size($Request['Bounty'])?></span>
2011-03-28 14:21:28 +00:00
</td>
<td>
2013-09-13 08:00:53 +00:00
<?=time_diff($Request['TimeAdded'])?>
2011-03-28 14:21:28 +00:00
</td>
</tr>
<? } ?>
</table>
<?
}
2013-08-28 23:08:41 +00:00
// Similar Artist Map
2011-03-28 14:21:28 +00:00
2013-04-17 08:00:58 +00:00
if ($NumSimilar > 0) {
2013-06-28 08:01:04 +00:00
if ($SimilarData = $Cache->get_value("similar_positions_$ArtistID")) {
2011-03-28 14:21:28 +00:00
$Similar = new ARTISTS_SIMILAR($ArtistID, $Name);
$Similar->load_data($SimilarData);
2013-04-17 08:00:58 +00:00
if (!(current($Similar->Artists)->NameLength)) {
2011-03-28 14:21:28 +00:00
unset($Similar);
}
}
2013-04-17 08:00:58 +00:00
if (empty($Similar) || empty($Similar->Artists)) {
2013-05-27 08:00:58 +00:00
include(SERVER_ROOT.'/classes/image.class.php');
2011-03-28 14:21:28 +00:00
$Img = new IMAGE;
$Img->create(WIDTH, HEIGHT);
2013-05-25 08:01:03 +00:00
$Img->color(255, 255, 255, 127);
2012-09-23 08:00:25 +00:00
2011-03-28 14:21:28 +00:00
$Similar = new ARTISTS_SIMILAR($ArtistID, $Name);
$Similar->set_up();
$Similar->set_positions();
$Similar->background_image();
2012-09-23 08:00:25 +00:00
2011-03-28 14:21:28 +00:00
$SimilarData = $Similar->dump_data();
2012-09-23 08:00:25 +00:00
2013-06-28 08:01:04 +00:00
$Cache->cache_value("similar_positions_$ArtistID", $SimilarData, 3600 * 24);
2011-03-28 14:21:28 +00:00
}
?>
<div id="similar_artist_map" class="box">
2012-06-28 08:00:13 +00:00
<div id="flipper_head" class="head">
2012-12-23 08:00:46 +00:00
<a href="#">&uarr;</a>&nbsp;
2013-08-28 23:08:41 +00:00
<strong id="flipper_title">Similar Artist Map</strong>
2013-06-27 08:01:06 +00:00
<a id="flip_to" class="brackets" href="#" onclick="flipView(); return false;">Switch to cloud</a>
2012-10-29 08:00:20 +00:00
</div>
2013-05-25 08:01:03 +00:00
<div id="flip_view_1" style="display: block; width: <?=(WIDTH)?>px; height: <?=(HEIGHT)?>px; position: relative; background-image: url(static/similar/<?=($ArtistID)?>.png?t=<?=(time())?>);">
2011-03-28 14:21:28 +00:00
<?
$Similar->write_artists();
?>
2012-10-29 08:00:20 +00:00
</div>
2013-11-10 08:00:49 +00:00
<div id="flip_view_2" style="display: none; width: <?=WIDTH?>px; height: <?=HEIGHT?>px;">
<canvas width="<?=WIDTH?>px" height="<?=(HEIGHT - 20)?>px" id="similarArtistsCanvas"></canvas>
<div id="artistTags" style="display: none;">
<ul><li></li></ul>
</div>
<strong style="margin-left: 10px;"><a id="currentArtist" href="#null">Loading...</a></strong>
2012-10-29 08:00:20 +00:00
</div>
2012-11-06 08:00:20 +00:00
</div>
2012-06-28 08:00:13 +00:00
2013-02-10 08:00:29 +00:00
<script type="text/javascript">//<![CDATA[
2012-06-28 08:00:13 +00:00
var cloudLoaded = false;
function flipView() {
2013-02-10 08:00:29 +00:00
var state = document.getElementById('flip_view_1').style.display == 'block';
2013-04-17 08:00:58 +00:00
if (state) {
2013-06-28 08:01:04 +00:00
document.getElementById('flip_view_1').style.display = 'none';
document.getElementById('flip_view_2').style.display = 'block';
2013-08-28 23:08:41 +00:00
document.getElementById('flipper_title').innerHTML = 'Similar Artist Cloud';
2013-02-10 08:00:29 +00:00
document.getElementById('flip_to').innerHTML = 'Switch to map';
2013-04-17 08:00:58 +00:00
if (!cloudLoaded) {
2013-06-27 08:01:06 +00:00
require("static/functions/tagcanvas.js", function () {
require("static/functions/artist_cloud.js", function () {
2013-02-10 08:00:29 +00:00
});
2012-06-28 08:00:13 +00:00
});
2013-02-10 08:00:29 +00:00
cloudLoaded = true;
}
}
else {
2013-06-28 08:01:04 +00:00
document.getElementById('flip_view_1').style.display = 'block';
document.getElementById('flip_view_2').style.display = 'none';
2013-08-28 23:08:41 +00:00
document.getElementById('flipper_title').innerHTML = 'Similar Artist Map';
2013-02-10 08:00:29 +00:00
document.getElementById('flip_to').innerHTML = 'Switch to cloud';
}
2012-06-28 08:00:13 +00:00
}
//TODO move this to global, perhaps it will be used elsewhere in the future
//http://stackoverflow.com/questions/7293344/load-javascript-dynamically
function require(file, callback) {
2013-02-10 08:00:29 +00:00
var script = document.getElementsByTagName('script')[0],
newjs = document.createElement('script');
// IE
newjs.onreadystatechange = function () {
if (newjs.readyState === 'loaded' || newjs.readyState === 'complete') {
newjs.onreadystatechange = null;
callback();
}
};
// others
newjs.onload = function () {
callback();
};
newjs.src = file;
script.parentNode.insertBefore(newjs, script);
2012-06-28 08:00:13 +00:00
}
2012-12-27 08:00:27 +00:00
//]]>
2012-06-28 08:00:13 +00:00
</script>
2013-05-04 08:00:48 +00:00
<? } // if $NumSimilar > 0 ?>
2013-11-10 08:00:49 +00:00
<div id="artist_information" class="box">
2012-10-30 08:00:18 +00:00
<div id="info" class="head">
2012-12-23 08:00:46 +00:00
<a href="#">&uarr;</a>&nbsp;
2013-09-11 08:00:55 +00:00
<strong>Artist Information</strong>
2013-06-17 08:01:02 +00:00
<a href="#" class="brackets" onclick="$('#body').gtoggle(); return false;">Toggle</a>
2012-10-30 08:00:18 +00:00
</div>
2013-12-12 08:01:01 +00:00
<div id="body" class="body"><?=Text::full_format($Body)?></div>
2011-03-28 14:21:28 +00:00
</div>
2013-08-28 23:08:41 +00:00
<?
if (defined('LASTFM_API_KEY')) {
include(SERVER_ROOT.'/sections/artist/concerts.php');
2012-10-27 08:00:09 +00:00
}
2013-08-28 23:08:41 +00:00
// --- Comments ---
2012-10-27 08:00:09 +00:00
2013-08-28 23:08:41 +00:00
list($NumComments, $Page, $Thread, $LastRead) = Comments::load('artist', $ArtistID);
$Pages = Format::get_pages($Page, $NumComments, TORRENT_COMMENTS_PER_PAGE, 9, '#comments');
2012-10-27 08:00:09 +00:00
?>
2013-11-10 08:00:49 +00:00
<div id="artistcomments">
<div class="linkbox"><a name="comments"></a>
<?=($Pages)?>
</div>
2012-10-27 08:00:09 +00:00
<?
//---------- Begin printing
2013-08-28 23:08:41 +00:00
CommentsView::render_comments($Thread, $LastRead, "artist.php?id=$ArtistID");
2012-10-29 08:00:20 +00:00
?>
2012-10-27 08:00:09 +00:00
<div class="linkbox">
2013-08-28 23:08:41 +00:00
<?=($Pages)?>
2012-10-27 08:00:09 +00:00
</div>
2013-01-23 08:00:38 +00:00
<?
View::parse('generic/reply/quickreply.php', array(
2013-08-28 23:08:41 +00:00
'InputName' => 'pageid',
'InputID' => $ArtistID,
'Action' => 'comments.php?page=artist',
'InputAction' => 'take_post',
'SubscribeBox' => true
));
2013-01-23 08:00:38 +00:00
?>
2013-11-10 08:00:49 +00:00
</div>
2011-03-28 14:21:28 +00:00
</div>
</div>
<?
2012-10-11 08:00:15 +00:00
View::show_footer();
2011-03-28 14:21:28 +00:00
// Cache page for later use
2012-10-29 08:00:20 +00:00
if ($RevisionID) {
2013-05-04 08:00:48 +00:00
$Key = "artist_$ArtistID" . "_revision_$RevisionID";
2012-10-11 08:00:15 +00:00
} else {
2013-08-28 23:08:41 +00:00
$Key = "artist_$ArtistID";
2011-03-28 14:21:28 +00:00
}
2012-10-28 08:00:19 +00:00
$Data = array(array($Name, $Image, $Body, $NumSimilar, $SimilarArray, array(), array(), $VanityHouseArtist));
2011-03-28 14:21:28 +00:00
$Cache->cache_value($Key, $Data, 3600);
?>