2011-03-28 14:21:28 +00:00
< ?
//~~~~~~~~~~~ Main artist page ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
//For sorting tags
function compare ( $X , $Y ){
return ( $Y [ 'count' ] - $X [ 'count' ]);
}
2011-08-09 21:03:28 +00:00
include ( SERVER_ROOT . '/sections/bookmarks/functions.php' ); // has_bookmarked()
2011-03-28 14:21:28 +00:00
include ( SERVER_ROOT . '/classes/class_text.php' ); // Text formatting class
$Text = new TEXT ;
include ( SERVER_ROOT . '/sections/requests/functions.php' );
// Similar artist map
include ( SERVER_ROOT . '/classes/class_artist.php' );
include ( SERVER_ROOT . '/classes/class_artists_similar.php' );
$ArtistID = $_GET [ 'id' ];
if ( ! is_number ( $ArtistID )) { error ( 0 ); }
if ( ! empty ( $_GET [ 'revisionid' ])) { // if they're viewing an old revision
$RevisionID = $_GET [ 'revisionid' ];
if ( ! is_number ( $RevisionID )){ error ( 0 ); }
$Data = $Cache -> get_value ( " artist_ $ArtistID " . " _revision_ $RevisionID " );
} else { // viewing the live version
$Data = $Cache -> get_value ( 'artist_' . $ArtistID );
$RevisionID = false ;
}
if ( $Data ) {
$Data = unserialize ( $Data );
2011-12-20 08:00:20 +00:00
list ( $K , list ( $Name , $Image , $Body , $NumSimilar , $SimilarArray , $TorrentList , $Importances , $VanityHouseArtist )) = each ( $Data );
2011-03-28 14:21:28 +00:00
} else {
if ( $RevisionID ) {
$sql = " SELECT
a . Name ,
wiki . Image ,
2011-08-09 21:03:28 +00:00
wiki . body ,
a . VanityHouse
2011-03-28 14:21:28 +00:00
FROM wiki_artists AS wiki
LEFT JOIN artists_group AS a ON wiki . RevisionID = a . RevisionID
WHERE wiki . RevisionID = '$RevisionID' " ;
} else {
$sql = " SELECT
a . Name ,
wiki . Image ,
2011-08-09 21:03:28 +00:00
wiki . body ,
a . VanityHouse
2011-03-28 14:21:28 +00:00
FROM artists_group AS a
LEFT JOIN wiki_artists AS wiki ON wiki . RevisionID = a . RevisionID
WHERE a . ArtistID = '$ArtistID' " ;
}
$sql .= " GROUP BY a.ArtistID " ;
$DB -> query ( $sql );
if ( $DB -> record_count () == 0 ) { error ( 404 ); }
2011-08-09 21:03:28 +00:00
list ( $Name , $Image , $Body , $VanityHouseArtist ) = $DB -> next_record ( MYSQLI_NUM , array ( 0 ));
2011-03-28 14:21:28 +00:00
}
2011-10-27 08:00:15 +00:00
$TokenTorrents = $Cache -> get_value ( 'users_tokens_' . $UserID );
if ( empty ( $TokenTorrents )) {
$DB -> query ( " SELECT TorrentID FROM users_freeleeches WHERE UserID= $UserID AND Expired=FALSE " );
$TokenTorrents = $DB -> collect ( 'TorrentID' );
$Cache -> cache_value ( 'users_tokens_' . $UserID , $TokenTorrents );
}
2011-03-28 14:21:28 +00:00
//----------------- Build list and get stats
ob_start ();
// Requests
$Requests = $Cache -> get_value ( 'artists_requests_' . $ArtistID );
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
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 . "
AND r . TorrentID = 0
GROUP BY r . ID
ORDER BY Votes DESC " );
if ( $DB -> record_count () > 0 ) {
$Requests = $DB -> to_array ();
} else {
$Requests = array ();
}
$Cache -> cache_value ( 'artists_requests_' . $ArtistID , $Requests );
}
$NumRequests = count ( $Requests );
$LastReleaseType = 0 ;
if ( empty ( $Importances ) || empty ( $TorrentList )) {
$DB -> query ( " SELECT
2012-02-23 08:00:18 +00:00
DISTINCTROW ta . GroupID , ta . Importance , tg . VanityHouse
2011-03-28 14:21:28 +00:00
FROM torrents_artists AS ta
JOIN torrents_group AS tg ON tg . ID = ta . GroupID
WHERE ta . ArtistID = '$ArtistID'
2012-02-20 08:00:22 +00:00
ORDER BY IF ( ta . Importance IN ( '2' , '3' , '4' , '7' ), 1000 + ta . Importance , tg . ReleaseType ) ASC ,
tg . Year DESC , tg . Name DESC " );
2011-03-28 14:21:28 +00:00
$GroupIDs = $DB -> collect ( 'GroupID' );
2012-02-23 08:00:18 +00:00
$Importances = $DB -> to_array ( false , MYSQLI_BOTH , false );
2011-03-28 14:21:28 +00:00
if ( count ( $GroupIDs ) > 0 ) {
$TorrentList = get_groups ( $GroupIDs , true , true );
$TorrentList = $TorrentList [ 'matches' ];
} else {
$TorrentList = array ();
}
}
$NumGroups = count ( $TorrentList );
if ( ! empty ( $TorrentList )) {
?>
< div id = " discog_table " >
< ?
}
//Get list of used release types
$UsedReleases = array ();
2012-02-23 08:00:18 +00:00
foreach ( $Importances as $ID => $Group ) {
switch ( $Importances [ $ID ][ 'Importance' ]) {
case '2' :
$Importances [ $ID ][ 'ReleaseType' ] = 1024 ;
//$TorrentList[$GroupID]['ReleaseType'] = 1024;
$GuestAlbums = true ;
break ;
case '3' :
$Importances [ $ID ][ 'ReleaseType' ] = 1023 ;
//$TorrentList[$GroupID]['ReleaseType'] = 1023;
$RemixerAlbums = true ;
break ;
case '4' :
$Importances [ $ID ][ 'ReleaseType' ] = 1022 ;
//$TorrentList[$GroupID]['ReleaseType'] = 1022;
$ComposerAlbums = true ;
break ;
case '7' :
$Importances [ $ID ][ 'ReleaseType' ] = 1021 ;
//$TorrentList[$GroupID]['ReleaseType'] = 1021;
$ProducerAlbums = true ;
break ;
default :
$Importances [ $ID ][ 'ReleaseType' ] = $TorrentList [ $Group [ 'GroupID' ]][ 'ReleaseType' ];
2011-03-28 14:21:28 +00:00
}
2012-02-23 08:00:18 +00:00
if ( ! in_array ( $Importances [ $ID ][ 'ReleaseType' ], $UsedReleases )) {
$UsedReleases [] = $Importances [ $ID ][ 'ReleaseType' ];
}
2011-03-28 14:21:28 +00:00
}
if ( ! empty ( $GuestAlbums )) {
$ReleaseTypes [ 1024 ] = " Guest Appearance " ;
}
if ( ! empty ( $RemixerAlbums )) {
$ReleaseTypes [ 1023 ] = " Remixed By " ;
}
2011-11-20 08:00:18 +00:00
if ( ! empty ( $ComposerAlbums )) {
$ReleaseTypes [ 1022 ] = " Composition " ;
}
2012-02-19 08:00:19 +00:00
if ( ! empty ( $ProducerAlbums )) {
$ReleaseTypes [ 1021 ] = " Produced By " ;
}
2011-03-28 14:21:28 +00:00
reset ( $TorrentList );
if ( ! empty ( $UsedReleases )) { ?>
< div class = " box center " >
< ?
foreach ( $UsedReleases as $ReleaseID ) {
switch ( $ReleaseTypes [ $ReleaseID ]) {
case " Remix " :
$DisplayName = " Remixes " ;
break ;
case " Anthology " :
$DisplayName = " Anthologies " ;
break ;
2011-11-20 08:00:18 +00:00
case " DJ Mix " :
$DisplayName = " DJ Mixes " ;
break ;
2011-03-28 14:21:28 +00:00
default :
$DisplayName = $ReleaseTypes [ $ReleaseID ] . " s " ;
break ;
}
2011-12-15 08:00:20 +00:00
if ( ! empty ( $LoggedUser [ 'DiscogView' ]) || ( isset ( $LoggedUser [ 'HideTypes' ]) && in_array ( $ReleaseID , $LoggedUser [ 'HideTypes' ]))) {
$ToggleStr = " onClick= \" $ ('.releases_ $ReleaseID ').show(); return true; \" " ;
} else {
$ToggleStr = '' ;
}
2011-03-28 14:21:28 +00:00
?>
2011-12-15 08:00:20 +00:00
< a href = " #torrents_<?=str_replace( " " , " _ " , strtolower( $ReleaseTypes[$ReleaseID] ))?> " < ? = $ToggleStr ?> >[<?=$DisplayName?>]</a>
2011-03-28 14:21:28 +00:00
< ?
}
if ( $NumRequests > 0 ) {
?>
< a href = " #requests " > [ Requests ] </ a >
< ? } ?>
</ div >
< ? }
$NumTorrents = 0 ;
$NumSeeders = 0 ;
$NumLeechers = 0 ;
$NumSnatches = 0 ;
2012-02-27 08:00:22 +00:00
foreach ( $TorrentList as $GroupID => $Group ) {
$TagList = explode ( ' ' , str_replace ( '_' , '.' , $Group [ 'TagList' ]));
$TorrentTags = array ();
// $Tags array is for the sidebar on the right. Skip compilations and soundtracks.
if ( ! in_array ( $ReleaseType , array ( 7 , 3 ))) {
foreach ( $TagList as $Tag ) {
if ( ! isset ( $Tags [ $Tag ])) {
$Tags [ $Tag ] = array ( 'name' => $Tag , 'count' => 1 );
} else {
$Tags [ $Tag ][ 'count' ] ++ ;
}
}
}
$TorrentTags = implode ( ', ' , $TorrentTags );
$TorrentTags = '<br /><div class="tags">' . $TorrentTags . '</div>' ;
foreach ( $Group [ 'Torrents' ] as $TorrentID => $Torrent ) {
$NumTorrents ++ ;
$Torrent [ 'Seeders' ] = ( int ) $Torrent [ 'Seeders' ];
$Torrent [ 'Leechers' ] = ( int ) $Torrent [ 'Leechers' ];
$Torrent [ 'Snatched' ] = ( int ) $Torrent [ 'Snatched' ];
$NumSeeders += $Torrent [ 'Seeders' ];
$NumLeechers += $Torrent [ 'Leechers' ];
$NumSnatches += $Torrent [ 'Snatched' ];
}
}
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 ;
$ReleaseType = 0 ;
2011-10-18 08:00:10 +00:00
2012-02-23 08:00:18 +00:00
foreach ( $Importances as $Group ) {
list ( $GroupID , $GroupName , $GroupYear , $GroupRecordLabel , $GroupCatalogueNumber , $TagList , $ReleaseType , $GroupVanityHouse , $Torrents , $Artists , $ExtendedArtists ) = array_values ( $TorrentList [ $Group [ 'GroupID' ]]);
$ReleaseType = $Group [ 'ReleaseType' ];
$GroupVanityHouse = $Group [ 'VanityHouse' ];
if ( $GroupID == $OldGroupID && $ReleaseType == $OldReleaseType ) {
continue ;
} else {
$OldGroupID = $GroupID ;
$OldReleaseType = $ReleaseType ;
}
2012-02-27 08:00:22 +00:00
if ( ! empty ( $LoggedUser [ 'DiscogView' ]) || ( isset ( $LoggedUser [ 'HideTypes' ]) && in_array ( $ReleaseType , $LoggedUser [ 'HideTypes' ]))) {
$HideDiscog = ' hidden' ;
} else {
$HideDiscog = '' ;
}
2011-03-28 14:21:28 +00:00
$TagList = explode ( ' ' , str_replace ( '_' , '.' , $TagList ));
$TorrentTags = array ();
2012-02-20 08:00:22 +00:00
// $Tags array is for the sidebar on the right. Skip compilations and soundtracks.
2012-02-27 08:00:22 +00:00
foreach ( $TagList as $Tag ) {
$TorrentTags [] = '<a href="torrents.php?taglist=' . $Tag . '">' . $Tag . '</a>' ;
2011-03-28 14:21:28 +00:00
}
$TorrentTags = implode ( ', ' , $TorrentTags );
2011-10-18 08:00:10 +00:00
$TorrentTags = '<br /><div class="tags">' . $TorrentTags . '</div>' ;
2011-03-28 14:21:28 +00:00
if ( $ReleaseType != $LastReleaseType ) {
switch ( $ReleaseTypes [ $ReleaseType ]) {
case " Remix " :
$DisplayName = " Remixes " ;
break ;
case " Anthology " :
$DisplayName = " Anthologies " ;
break ;
2011-11-20 08:00:18 +00:00
case " DJ Mix " :
$DisplayName = " DJ Mixes " ;
break ;
2011-03-28 14:21:28 +00:00
default :
$DisplayName = $ReleaseTypes [ $ReleaseType ] . " s " ;
break ;
}
$ReleaseTypeLabel = strtolower ( str_replace ( ' ' , '_' , $ReleaseTypes [ $ReleaseType ]));
if ( $OpenTable ) { ?>
</ table >
< ? } ?>
< table class = " torrent_table " id = " torrents_<?= $ReleaseTypeLabel ?> " >
< tr class = " colhead_dark " >
2011-09-05 08:00:07 +00:00
< td class = " small " ><!-- expand / collapse --></ td >
2011-10-18 08:00:10 +00:00
< td width = " 70% " >< a href = " # " >& uarr ; </ a >& nbsp ; < strong >< ? = $DisplayName ?> </strong> (<a href="#" onclick="$('.releases_<?=$ReleaseType?>').toggle(true);return false;">View</a>)</td>
2011-03-28 14:21:28 +00:00
< 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 >
< ? $OpenTable = true ;
$LastReleaseType = $ReleaseType ;
}
$DisplayName = '<a href="torrents.php?id=' . $GroupID . '" title="View Torrent">' . $GroupName . '</a>' ;
2012-04-11 08:00:22 +00:00
if ( check_perms ( 'users_mod' ) || check_perms ( 'torrents_fix_ghosts' )) {
2011-03-28 14:21:28 +00:00
$DisplayName .= ' [<a href="torrents.php?action=fix_group&groupid=' . $GroupID . '&artistid=' . $ArtistID . '&auth=' . $LoggedUser [ 'AuthKey' ] . '">Fix</a>]' ;
}
2011-11-21 08:00:23 +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 ]);
$DisplayName = display_artists ( $ExtendedArtists ) . $DisplayName ;
} elseif ( count ( $GroupArtists ) > 0 ) {
$DisplayName = display_artists ( array ( 1 => $Artists ), true , true ) . $DisplayName ;
}
break ;
case 1022 : // Show performers on composer pages
if ( ! empty ( $ExtendedArtists [ 1 ]) || ! empty ( $ExtendedArtists [ 4 ]) || ! empty ( $ExtendedArtists [ 5 ])) {
unset ( $ExtendedArtists [ 4 ]);
unset ( $ExtendedArtists [ 3 ]);
unset ( $ExtendedArtists [ 6 ]);
$DisplayName = display_artists ( $ExtendedArtists ) . $DisplayName ;
} elseif ( count ( $GroupArtists ) > 0 ) {
$DisplayName = display_artists ( array ( 1 => $Artists ), true , true ) . $DisplayName ;
}
break ;
default : // Show composers otherwise
if ( ! empty ( $ExtendedArtists [ 4 ])) {
$DisplayName = display_artists ( array ( 4 => $ExtendedArtists [ 4 ]), true , true ) . $DisplayName ;
}
2011-03-28 14:21:28 +00:00
}
if ( $GroupYear > 0 ) { $DisplayName = $GroupYear . ' - ' . $DisplayName ; }
2011-08-09 21:03:28 +00:00
if ( $GroupVanityHouse ) { $DisplayName .= ' [<abbr title="This is a vanity house release">VH</abbr>]' ; }
2011-03-28 14:21:28 +00:00
?>
< tr class = " releases_<?= $ReleaseType ?> group discog<?= $HideDiscog ?> " >
2011-09-04 08:00:07 +00:00
< td class = " center " >
< div title = " View " id = " showimg_<?= $GroupID ?> " class = " <?=( $ShowGroups ? 'hide' : 'show')?>_torrents " >
< a href = " # " class = " show_torrents_link " onclick = " toggle_group(<?= $GroupID ?>, this, event) " title = " Collapse this group " ></ a >
</ div >
</ td >
2011-03-28 14:21:28 +00:00
< td colspan = " 5 " >
< strong >< ? = $DisplayName ?> </strong>
< ? = $TorrentTags ?>
</ td >
</ tr >
< ?
$LastRemasterYear = '-' ;
$LastRemasterTitle = '' ;
$LastRemasterRecordLabel = '' ;
$LastRemasterCatalogueNumber = '' ;
2011-09-04 08:00:07 +00:00
$LastMedia = '' ;
$EditionID = 0 ;
2011-09-05 08:00:07 +00:00
unset ( $FirstUnknown );
2011-03-28 14:21:28 +00:00
foreach ( $Torrents as $TorrentID => $Torrent ) {
2011-09-05 08:00:07 +00:00
if ( $Torrent [ 'Remastered' ] && ! $Torrent [ 'RemasterYear' ]) {
$FirstUnknown = ! isset ( $FirstUnknown );
}
2012-02-27 08:00:22 +00:00
2011-10-29 08:00:15 +00:00
if ( in_array ( $TorrentID , $TokenTorrents ) && empty ( $Torrent [ 'FreeTorrent' ])) {
$Torrent [ 'PersonalFL' ] = 1 ;
}
2012-02-27 08:00:22 +00:00
2011-03-28 14:21:28 +00:00
if ( $Torrent [ 'RemasterTitle' ] != $LastRemasterTitle || $Torrent [ 'RemasterYear' ] != $LastRemasterYear ||
2012-02-27 08:00:22 +00:00
$Torrent [ 'RemasterRecordLabel' ] != $LastRemasterRecordLabel || $Torrent [ 'RemasterCatalogueNumber' ] != $LastRemasterCatalogueNumber || $FirstUnknown || $Torrent [ 'Media' ] != $LastMedia ) {
2011-09-04 08:00:07 +00:00
$EditionID ++ ;
2011-09-05 08:00:07 +00:00
if ( $Torrent [ 'Remastered' ] && $Torrent [ 'RemasterYear' ] != 0 ) {
2011-03-28 14:21:28 +00:00
$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 = ' / ' ; }
2011-09-04 08:00:07 +00:00
$RemasterName .= $AddExtra . display_str ( $Torrent [ 'Media' ]);
2011-03-28 14:21:28 +00:00
?>
2011-10-18 08:00:10 +00:00
< tr class = " releases_<?= $ReleaseType ?> groupid_<?= $GroupID ?> edition group_torrent discog<?= $HideDiscog . $HideTorrents ?> " >
2011-09-04 08:00:07 +00:00
< td colspan = " 6 " class = " edition_info " >< strong >< a href = " # " onclick = " toggle_edition(<?= $GroupID ?>, <?= $EditionID ?>, this, event) " title = " Collapse this edition " >& minus ; </ a > < ? = $RemasterName ?> </strong></a></td>
2011-03-28 14:21:28 +00:00
</ tr >
< ?
} else {
$AddExtra = " / " ;
2011-09-05 08:00:07 +00:00
if ( ! $Torrent [ 'Remastered' ]) {
$MasterName = " Original Release " ;
if ( $GroupRecordLabel ) { $MasterName .= $AddExtra . $GroupRecordLabel ; $AddExtra = ' / ' ; }
if ( $GroupCatalogueNumber ) { $MasterName .= $AddExtra . $GroupCatalogueNumber ; $AddExtra = ' / ' ; }
} else {
$MasterName = " Unknown Release(s) " ;
}
2011-09-04 08:00:07 +00:00
$MasterName .= $AddExtra . display_str ( $Torrent [ 'Media' ]);
2011-03-28 14:21:28 +00:00
?>
2011-10-18 08:00:10 +00:00
< tr class = " releases_<?= $ReleaseType ?> groupid_<?= $GroupID ?> edition group_torrent<?= $HideDiscog . $HideTorrents ?> " >
2011-09-04 08:00:07 +00:00
< td colspan = " 6 " class = " edition_info " >< strong >< a href = " # " onclick = " toggle_edition(<?= $GroupID ?>, <?= $EditionID ?>, this, event) " title = " Collapse this edition " >& minus ; </ a > < ? = $MasterName ?> </strong></a></td>
2011-03-28 14:21:28 +00:00
</ tr >
< ?
}
}
$LastRemasterTitle = $Torrent [ 'RemasterTitle' ];
$LastRemasterYear = $Torrent [ 'RemasterYear' ];
$LastRemasterRecordLabel = $Torrent [ 'RemasterRecordLabel' ];
$LastRemasterCatalogueNumber = $Torrent [ 'RemasterCatalogueNumber' ];
2011-09-04 08:00:07 +00:00
$LastMedia = $Torrent [ 'Media' ];
2011-03-28 14:21:28 +00:00
?>
2011-10-18 08:00:10 +00:00
< tr class = " releases_<?= $ReleaseType ?> groupid_<?= $GroupID ?> edition_<?= $EditionID ?> group_torrent discog<?= $HideDiscog . $HideTorrents ?> " >
2011-09-04 08:00:07 +00:00
< td colspan = " 2 " >
2011-03-28 14:21:28 +00:00
< span >
2011-10-29 08:00:15 +00:00
[ < a href = " torrents.php?action=download&id=<?= $TorrentID ?>&authkey=<?= $LoggedUser['AuthKey'] ?>&torrent_pass=<?= $LoggedUser['torrent_pass'] ?> " title = " Download " >< ? = $Torrent [ 'HasFile' ] ? 'DL' : 'Missing' ?> </a>
2011-10-27 08:00:15 +00:00
< ? if (( $LoggedUser [ 'FLTokens' ] > 0 ) && ( $Torrent [ 'Size' ] < 1073741824 )
&& ! in_array ( $TorrentID , $TokenTorrents ) && empty ( $Torrent [ 'FreeTorrent' ]) && ( $LoggedUser [ 'CanLeech' ] == '1' )) { ?>
2012-05-18 13:35:17 +00:00
| < a href = " torrents.php?action=download&id=<?= $TorrentID ?>&authkey=<?= $LoggedUser['AuthKey'] ?>&torrent_pass=<?= $LoggedUser['torrent_pass'] ?>&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
< ? } ?> ]
2011-03-28 14:21:28 +00:00
</ span >
& nbsp ; & nbsp ; & raquo ; & nbsp ; < a href = " torrents.php?id=<?= $GroupID ?>&torrentid=<?= $TorrentID ?> " >< ? = torrent_info ( $Torrent ) ?> </a>
</ td >
< td class = " nobr " >< ? = get_size ( $Torrent [ 'Size' ]) ?> </td>
< td >< ? = number_format ( $Torrent [ 'Snatched' ]) ?> </td>
< td < ? = ( $Torrent [ 'Seeders' ] == 0 ) ? ' class="r00"' : '' ?> ><?=number_format($Torrent['Seeders'])?></td>
< td >< ? = number_format ( $Torrent [ 'Leechers' ]) ?> </td>
</ tr >
< ?
}
}
if ( ! empty ( $TorrentList )) { ?>
</ table >
</ div >
< ? }
$TorrentDisplayList = ob_get_clean ();
//----------------- End building list and getting stats
2011-09-04 08:00:07 +00:00
show_header ( $Name , 'browse,requests,bbcode' );
2011-03-28 14:21:28 +00:00
?>
< div class = " thin " >
2011-08-09 21:03:28 +00:00
< h2 >< ? = display_str ( $Name ) ?> <? if ($RevisionID) { ?> (Revision #<?=$RevisionID?>)<? } if ($VanityHouseArtist) { ?> [Vanity House] <? } ?></h2>
2011-03-28 14:21:28 +00:00
< div class = " linkbox " >
< ? if ( check_perms ( 'site_submit_requests' )) { ?>
< a href = " requests.php?action=new&artistid=<?= $ArtistID ?> " > [ Add Request ] </ a >
< ? }
if ( check_perms ( 'site_torrents_notify' )) {
2011-04-17 11:05:01 +00:00
if (( $Notify = $Cache -> get_value ( 'notify_artists_' . $LoggedUser [ 'ID' ])) === false ) {
2011-03-28 14:21:28 +00:00
$DB -> query ( " SELECT ID, Artists FROM users_notify_filters WHERE UserID=' $LoggedUser[ID] ' AND Label='Artist notifications' LIMIT 1 " );
2011-04-17 11:05:01 +00:00
$Notify = $DB -> next_record ( MYSQLI_ASSOC , false );
2011-03-28 14:21:28 +00:00
$Cache -> cache_value ( 'notify_artists_' . $LoggedUser [ 'ID' ], $Notify , 0 );
}
2011-04-17 11:05:01 +00:00
if ( stripos ( $Notify [ 'Artists' ], '|' . $Name . '|' ) === false ) {
2011-03-28 14:21:28 +00:00
?>
< a href = " artist.php?action=notify&artistid=<?= $ArtistID ?>&auth=<?= $LoggedUser['AuthKey'] ?> " > [ Notify of new uploads ] </ a >
< ?
} else {
?>
< a href = " artist.php?action=notifyremove&artistid=<?= $ArtistID ?>&auth=<?= $LoggedUser['AuthKey'] ?> " > [ Do not notify of new uploads ] </ a >
< ?
}
}
2011-08-09 21:03:28 +00:00
if ( has_bookmarked ( 'artist' , $ArtistID )) {
?>
< a href = " # " id = " bookmarklink_artist_<?= $ArtistID ?> " onclick = " Unbookmark('artist', <?= $ArtistID ?>,'[Bookmark]');return false; " > [ Remove bookmark ] </ a >
< ?
} else {
?>
< a href = " # " id = " bookmarklink_artist_<?= $ArtistID ?> " onclick = " Bookmark('artist', <?= $ArtistID ?>,'[Remove bookmark]');return false; " > [ Bookmark ] </ a >
< ?
}
2011-03-28 14:21:28 +00:00
if ( check_perms ( 'site_edit_wiki' )) {
?>
< a href = " artist.php?action=edit&artistid=<?= $ArtistID ?> " > [ Edit ] </ a >
< ? } ?>
< a href = " artist.php?action=history&artistid=<?= $ArtistID ?> " > [ View history ] </ a >
< ? if ( check_perms ( 'site_delete_artist' ) && check_perms ( 'torrents_delete' )) { ?>
< a href = " artist.php?action=delete&artistid=<?= $ArtistID ?>&auth=<?= $LoggedUser['AuthKey'] ?> " > [ Delete ] </ a >
< ? }
if ( $RevisionID && check_perms ( 'site_edit_wiki' )) {
?>
< a href = " artist.php?action=revert&artistid=<?= $ArtistID ?>&revisionid=<?= $RevisionID ?>&auth=<?= $LoggedUser['AuthKey'] ?> " >
[ Revert to this revision ]
</ a >
< ? } ?>
</ div >
< div class = " sidebar " >
< ? if ( $Image ) { ?>
< div class = " box " >
< div class = " head " >< strong >< ? = $Name ?> </strong></div>
< div style = " text-align:center;padding:10px 0px; " >
< img style = " max-width: 220px; " src = " <?= $Image ?> " alt = " <?= $Name ?> " onclick = " lightbox.init(this,220); " />
</ div >
</ div >
< ? }
if ( check_perms ( 'zip_downloader' )){
if ( isset ( $LoggedUser [ 'Collector' ])) {
list ( $ZIPList , $ZIPPrefs ) = $LoggedUser [ 'Collector' ];
$ZIPList = explode ( ':' , $ZIPList );
} else {
$ZIPList = array ( '00' , '11' );
$ZIPPrefs = 1 ;
}
?>
< div class = " box " >
< div class = " head colhead_dark " >< strong > Collector </ strong ></ div >
< div class = " pad " >
< form action = " artist.php " method = " post " >
< input type = " hidden " name = " action " value = " download " />
< input type = " hidden " name = " auth " value = " <?= $LoggedUser['AuthKey'] ?> " />
< input type = " hidden " name = " artistid " value = " <?= $ArtistID ?> " />
< ul id = " list " class = " nobullet " >
< ? foreach ( $ZIPList as $ListItem ) { ?>
< li id = " list<?= $ListItem ?> " >
< input type = " hidden " name = " list[] " value = " <?= $ListItem ?> " />
< span style = " float:left; " >< ? = $ZIPOptions [ $ListItem ][ '2' ] ?> </span>
< a href = " # " onclick = " remove_selection('<?= $ListItem ?>');return false; " style = " float:right; " > [ X ] </ a >
< br style = " clear:all; " />
</ li >
< ? } ?>
</ ul >
< select id = " formats " style = " width:180px " >
< ?
$OpenGroup = false ;
$LastGroupID =- 1 ;
foreach ( $ZIPOptions as $Option ) {
list ( $GroupID , $OptionID , $OptName ) = $Option ;
if ( $GroupID != $LastGroupID ) {
$LastGroupID = $GroupID ;
if ( $OpenGroup ) { ?>
</ optgroup >
< ? } ?>
< optgroup label = " <?= $ZIPGroups[$GroupID] ?> " >
< ? $OpenGroup = true ;
}
?>
< option id = " opt<?= $GroupID . $OptionID ?> " value = " <?= $GroupID . $OptionID ?> " < ? if ( in_array ( $GroupID . $OptionID , $ZIPList )){ echo ' disabled="disabled"' ; } ?> ><?=$OptName?></option>
< ?
}
?>
</ optgroup >
</ select >
< button type = " button " onclick = " add_selection() " >+</ button >
< 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>
</ select >
< input type = " submit " style = " width:210px " value = " Download " />
</ form >
</ div >
</ div >
< ? } ?>
< div class = " box " >
< div class = " head " >< strong > Tags </ strong ></ div >
< ul class = " stats nobullet " >
< ?
uasort ( $Tags , 'compare' );
foreach ( $Tags as $TagName => $Tag ) {
?>
< li >< a href = " torrents.php?taglist=<?= $TagName ?> " >< ? = $TagName ?> </a> (<?=$Tag['count']?>)</li>
< ?
}
?>
</ ul >
</ div >
< ?
// Stats
?>
< div class = " box " >
< div class = " head " >< strong > Statistics </ strong ></ div >
< ul class = " stats nobullet " >
< li > Number of groups : < ? = $NumGroups ?> </li>
< li > Number of torrents : < ? = $NumTorrents ?> </li>
< li > Number of seeders : < ? = $NumSeeders ?> </li>
< li > Number of leechers : < ? = $NumLeechers ?> </li>
< li > Number of snatches : < ? = $NumSnatches ?> </li>
</ ul >
</ div >
< ?
if ( empty ( $SimilarArray )) {
$DB -> query ( "
SELECT
s2 . ArtistID ,
a . Name ,
ass . Score ,
ass . SimilarID
FROM artists_similar AS s1
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'
ORDER BY ass . Score DESC
LIMIT 30
" );
$SimilarArray = $DB -> to_array ();
$NumSimilar = count ( $SimilarArray );
}
?>
< div class = " box " >
< div class = " head " >< strong > Similar artists </ strong ></ div >
< ul class = " stats nobullet " >
< ?
if ( $NumSimilar == 0 ) { ?>
< li >< i > None found </ i ></ li >
< ? }
$First = true ;
foreach ( $SimilarArray as $SimilarArtist ) {
list ( $Artist2ID , $Artist2Name , $Score , $SimilarID ) = $SimilarArtist ;
$Score = $Score / 100 ;
if ( $First ) {
$Max = $Score + 1 ;
$First = false ;
}
$FontSize = ( ceil ((((( $Score - 2 ) / $Max - 2 ) * 4 )))) + 8 ;
?>
< li >
< span title =< ? = $Score ?> ><a href="artist.php?id=<?=$Artist2ID?>" style="float:left; display:block;"><?=$Artist2Name?></a></span> <div style="float:right; display:block; letter-spacing: -1px;">
< a href = " artist.php?action=vote_similar&artistid=<?= $ArtistID ?>&similarid=<?= $SimilarID ?>&way=down " style = " font-family: monospace; " > [ - ] </ a >
< a href = " artist.php?action=vote_similar&artistid=<?= $ArtistID ?>&similarid=<?= $SimilarID ?>&way=up " style = " font-family: monospace; " > [ + ] </ a >
< ? if ( check_perms ( 'site_delete_tag' )) { ?>
< a href = " artist.php?action=delete_similar&similarid=<?= $SimilarID ?>&auth=<?= $LoggedUser['AuthKey'] ?> " > [ X ] </ a >
< ? } ?>
</ div >
< br style = " clear:both " />
</ li >
< ? } ?>
</ ul >
</ div >
< div class = " box " >
< div class = " head " >< strong > Add similar artist </ strong ></ div >
< ul class = " nobullet " >
< li >
< form action = " artist.php " method = " post " >
< input type = " hidden " name = " action " value = " add_similar " />
< input type = " hidden " name = " auth " value = " <?= $LoggedUser['AuthKey'] ?> " />
< input type = " hidden " name = " artistid " value = " <?= $ArtistID ?> " />
< input type = " text " autocomplete = " off " id = " artistsimilar " name = " artistname " size = " 20 " />
< input type = " submit " value = " + " />
</ form >
</ li >
</ ul >
</ div >
</ div >
< div class = " main_column " >
< ?
echo $TorrentDisplayList ;
if ( $NumRequests > 0 ) {
?>
< table cellpadding = " 6 " cellspacing = " 1 " border = " 0 " class = " border " width = " 100% " id = " requests " >
< tr class = " colhead_dark " >
< td style = " width:48%; " >
< a href = " # " >& uarr ; </ a >& nbsp ;
< strong > Request Name </ strong >
</ td >
< td >
< strong > Vote </ strong >
</ td >
< td >
< strong > Bounty </ strong >
</ td >
< td >
< strong > Added </ strong >
</ td >
</ tr >
< ?
foreach ( $Requests as $Request ) {
list ( $RequestID , $CategoryID , $Title , $Year , $TimeAdded , $Votes , $Bounty ) = $Request ;
$CategoryName = $Categories [ $CategoryID - 1 ];
if ( $CategoryName == " Music " ) {
$ArtistForm = get_request_artists ( $RequestID );
$ArtistLink = display_artists ( $ArtistForm , true , true );
$FullName = $ArtistLink . " <a href='requests.php?action=view&id= " . $RequestID . " '> " . $Title . " [ " . $Year . " ]</a> " ;
} else if ( $CategoryName == " Audiobooks " || $CategoryName == " Comedy " ) {
$FullName = " <a href='requests.php?action=view&id= " . $RequestID . " '> " . $Title . " [ " . $Year . " ]</a> " ;
} else {
$FullName = " <a href='requests.php?action=view&id= " . $RequestID . " '> " . $Title . " </a> " ;
}
$Row = ( $Row == 'a' ) ? 'b' : 'a' ;
$Tags = get_request_tags ( $RequestID );
?>
< tr class = " row<?= $Row ?> " >
< td >
< ? = $FullName ?>
< div class = " tags " >
< ?
$TagList = array ();
foreach ( $Tags as $TagID => $TagName ) {
2011-04-13 15:36:33 +00:00
$TagList [] = " <a href='requests.php?tags= " . $TagName . " '> " . display_str ( $TagName ) . " </a> " ;
2011-03-28 14:21:28 +00:00
}
$TagList = implode ( ', ' , $TagList );
?>
< ? = $TagList ?>
</ div >
</ td >
< td >
2011-06-27 08:00:06 +00:00
< span id = " vote_count_<?= $RequestID ?> " >< ? = $Votes ?> </span>
2011-03-28 14:21:28 +00:00
< ? if ( check_perms ( 'site_vote' )){ ?>
< input type = " hidden " id = " auth " name = " auth " value = " <?= $LoggedUser['AuthKey'] ?> " />
& nbsp ; & nbsp ; < a href = " javascript:Vote(0, <?= $RequestID ?>) " >< strong > ( + ) </ strong ></ a >
< ? } ?>
</ td >
< td >
2011-06-27 08:00:06 +00:00
< span id = " bounty_<?= $RequestID ?> " >< ? = get_size ( $Bounty ) ?> </span>
2011-03-28 14:21:28 +00:00
</ td >
< td >
< ? = time_diff ( $TimeAdded ) ?>
</ td >
</ tr >
< ? } ?>
</ table >
< ?
}
// Similar artist map
if ( $NumSimilar > 0 ) {
if ( $SimilarData = $Cache -> get_value ( 'similar_positions_' . $ArtistID )) {
$Similar = new ARTISTS_SIMILAR ( $ArtistID , $Name );
$Similar -> load_data ( $SimilarData );
if ( ! ( current ( $Similar -> Artists ) -> NameLength )) {
unset ( $Similar );
}
}
if ( empty ( $Similar ) || empty ( $Similar -> Artists )) {
include ( SERVER_ROOT . '/classes/class_image.php' );
$Img = new IMAGE ;
$Img -> create ( WIDTH , HEIGHT );
$Img -> color ( 255 , 255 , 255 , 127 );
$Similar = new ARTISTS_SIMILAR ( $ArtistID , $Name );
$Similar -> set_up ();
$Similar -> set_positions ();
$Similar -> background_image ();
$SimilarData = $Similar -> dump_data ();
$Cache -> cache_value ( 'similar_positions_' . $ArtistID , $SimilarData , 3600 * 24 );
}
?>
< div id = " similar_artist_map " class = " box " >
< div class = " head " >< strong > Similar artist map </ strong ></ div >
< div style = " width:<?=WIDTH?>px;height:<?=HEIGHT?>px;position:relative;background-image:url(static/similar/<?= $ArtistID ?>.png?t=<?=time()?>) " >
< ?
$Similar -> write_artists ();
?>
</ div >
</ div >
< ? } // if $NumSimilar>0 ?>
< div class = " box " >
< div class = " head " >< strong > Artist info </ strong ></ div >
< div class = " body " >< ? = $Text -> full_format ( $Body ) ?> </div>
</ div >
</ div >
</ div >
< ?
show_footer ();
// Cache page for later use
if ( $RevisionID ) {
$Key = " artist_ $ArtistID " . " _revision_ $RevisionID " ;
} else {
$Key = 'artist_' . $ArtistID ;
}
2011-12-20 08:00:20 +00:00
$Data = serialize ( array ( array ( $Name , $Image , $Body , $NumSimilar , $SimilarArray , $TorrentList , $Importances , $VanityHouseArtist )));
2011-03-28 14:21:28 +00:00
$Cache -> cache_value ( $Key , $Data , 3600 );
?>