2011-03-28 14:21:28 +00:00
< ?
//~~~~~~~~~~~ Main artist page ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
//For sorting tags
function compare ( $X , $Y ){
return ( $Y [ 'count' ] - $X [ 'count' ]);
}
include ( SERVER_ROOT . '/sections/bookmarks/functions.php' ); // has_bookmarked()
include ( SERVER_ROOT . '/sections/requests/functions.php' );
include ( SERVER_ROOT . '/classes/class_text.php' ); // Text formatting class
$Text = new TEXT ;
// 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 );
list ( $K , list ( $Name , $Image , $Body , $NumSimilar , $SimilarArray , $TorrentList , $GroupMeta )) = each ( $Data );
} else {
$sql = " SELECT
a . Name ,
wiki . Image ,
wiki . body ,
a . VanityHouse
FROM artists_group AS a
LEFT JOIN wiki_artists AS wiki ON wiki . RevisionID = a . RevisionID
WHERE " ;
if ( $RevisionID ){
$sql .= " wiki.RevisionID=' $RevisionID ' " ;
} else {
$sql .= " a.ArtistID=' $ArtistID ' " ;
}
$sql .= " GROUP BY a.ArtistID " ;
$DB -> query ( $sql , MYSQLI_NUM , true );
if ( $DB -> record_count () == 0 ) { error ( 404 ); }
list ( $Name , $Image , $Body , $VanityHouseArtist ) = $DB -> next_record ();
}
//----------------- 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 ( $GroupMeta ) || empty ( $TorrentList )) {
$DB -> query ( " SELECT
DISTINCT ta . GroupID , ta . Importance , tg . VanityHouse
FROM torrents_artists AS ta
JOIN torrents_group AS tg ON tg . ID = ta . GroupID
WHERE ta . ArtistID = '$ArtistID'
ORDER BY ta . Importance , tg . ReleaseType ASC , tg . Year DESC " );
$GroupIDs = $DB -> collect ( 'GroupID' );
$GroupMeta = $DB -> to_array ( 'GroupID' , MYSQLI_BOTH , false );
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 ();
$TorrentListByReleaseType = array ();
// Check if user has preferences for ordering/showing
if ( isset ( $LoggedUser [ 'ArtistOptions' ]) && is_array ( $LoggedUser [ 'ArtistOptions' ])) {
$ReleaseTypesOrder = $LoggedUser [ 'ArtistOptions' ];
$HasShown = in_array ( 1 , $ReleaseTypesOrder );
// Add releasetypes from default order, useful when new types are added
foreach ( $ReleaseTypesDefaultOrder as $Key => $ReleaseType ) {
if ( ! array_key_exists ( $ReleaseType , $ReleaseTypesOrder )) {
$ReleaseTypesOrder [ $ReleaseType ] = $HasShown ? 1 : 0 ; // If no releasetype is open by default assume (s)he wants them all closed
}
}
} else {
// Load defaults
$ReleaseTypesOrder = array_flip ( $ReleaseTypesDefaultOrder );
}
foreach ( $ReleaseTypesOrder as $ReleaseType => $ReleaseTypeName ) {
$TorrentListByReleaseType [ $ReleaseType ] = array ();
}
//Names for releasetypes that are not uploadable but exist in the defaultordering
$ReleaseTypes [ 1023 ] = " Remixed By " ;
$ReleaseTypes [ 1024 ] = " Guest Appearance " ;
foreach ( $TorrentList as $GroupID => $Group ) {
if ( $GroupMeta [ $GroupID ][ 'Importance' ] == '2' ) {
$TorrentList [ $GroupID ][ 'ReleaseType' ] = 1024 ;
}
if ( $GroupMeta [ $GroupID ][ 'Importance' ] == '3' ) {
$TorrentList [ $GroupID ][ 'ReleaseType' ] = 1023 ;
}
if ( ! in_array ( $TorrentList [ $GroupID ][ 'ReleaseType' ], $UsedReleases )) {
$UsedReleases [] = $TorrentList [ $GroupID ][ 'ReleaseType' ];
}
$TorrentListByReleaseType [ $TorrentList [ $GroupID ][ 'ReleaseType' ]][ $GroupID ] = $Group ;
}
reset ( $TorrentList );
if ( ! empty ( $UsedReleases )) { ?>
< div id = " releasetypes " class = " box center " >
< span id = " releasetype_links " >
< ?
foreach ( $ReleaseTypesOrder as $ReleaseID => $Torrents ) {
if ( ! in_array ( $ReleaseID , $UsedReleases )) {
continue ;
}
switch ( $ReleaseTypes [ $ReleaseID ]) {
case " Remix " :
$DisplayName = " Remixes " ;
break ;
case " Anthology " :
$DisplayName = " Anthologies " ;
break ;
default :
$DisplayName = $ReleaseTypes [ $ReleaseID ] . " s " ;
break ;
}
?>
< a href = " #torrents_<?=str_replace( " " , " _ " , strtolower( $ReleaseTypes[$ReleaseID] ))?> " id = " torrents_<?= $ReleaseID ?>_anchorlink " > [ < ? = $DisplayName ?> ]</a>
< ?
}
if ( $NumRequests > 0 ) {
?>
< a href = " #requests " id = " requests_anchorlink " > [ Requests ] </ a >
</ span >
< span style = " position:right " id = " torrents_allopenclose " class = " hidden " >
< a href = " # " onclick = " setDefaultShow('all', true);return false; " > [ All default open ] </ a >
< a href = " # " onclick = " setDefaultShow('all', false);return false; " > [ All default closed ] </ a >
</ span >
< ? } ?>
</ div >
< ? }
$NumTorrents = 0 ;
$NumSeeders = 0 ;
$NumLeechers = 0 ;
$NumSnatches = 0 ;
function display_name ( $ReleaseType ) {
global $ReleaseTypes ;
return $DisplayName ;
}
?>
< div id = " torrents_tables " >
< ?
$OpenTable = false ;
foreach ( $TorrentListByReleaseType as $ReleaseType => $TorrentListForReleaseType ) {
$NumTorrentsReleaseType = count ( $TorrentListForReleaseType );
if ( $OpenTable ) {
?> </table><?
$OpenTable = false ;
}
switch ( $ReleaseTypes [ $ReleaseType ]) {
case " Remix " :
$DisplayName = " Remixes " ;
break ;
case " Anthology " :
$DisplayName = " Anthologies " ;
break ;
default :
$DisplayName = $ReleaseTypes [ $ReleaseType ] . " s " ;
break ;
}
$ReleaseTypeLabel = strtolower ( str_replace ( ' ' , '_' , $ReleaseTypes [ $ReleaseType ]));
if (( isset ( $LoggedUser [ 'ArtistOptions' ]) && array_key_exists ( $ReleaseType , $LoggedUser [ 'ArtistOptions' ])) && $LoggedUser [ 'ArtistOptions' ][ $ReleaseType ] == 0 ) {
$HideDiscog = " hidden " ;
$HideDiscogDefault = true ;
}
else {
$HideDiscog = " " ;
$HideDiscogDefault = false ;
}
?>
2012-09-01 08:00:24 +00:00
< table class = " torrent_table grouped release_table releases_<?= $ReleaseType ?>_table<?= $NumTorrentsReleaseType ==0? " empty hidden " : " " ?> " id = " torrents_<?= $ReleaseTypeLabel ?> " >
2011-03-28 14:21:28 +00:00
< tr class = " colhead_dark " >
< td class = " small " style = " width: 28px; " ></ td >
< td width = " 70% " >
< span class = " artist_normalcol " >
< ? if ( $NumTorrentsReleaseType > 0 ) { ?>
< a href = " # " >& uarr ; </ a >
< ? } ?>
</ span >& nbsp ;
< strong >< ? = $DisplayName ?> </strong>
< span class = " artist_normalcol " >
< ? if ( $NumTorrentsReleaseType > 0 ) { ?>
( < a href = " # " < ? =! $HideDiscogDefault ? 'class="hidden"' : '' ?> id="releases_<?=$ReleaseType?>_viewlink" onclick="setShow('<?=$ReleaseType?>',true);return false;">View</a><a href="#"<?=$HideDiscogDefault?'class="hidden"':''?> id="releases_<?=$ReleaseType?>_hidelink" onclick="setShow('<?=$ReleaseType?>',false);return false;">Hide</a>)
< ? } ?>
</ span >
</ td >
< td class = " artist_normalcol " > Size </ td >
< td class = " artist_normalcol sign " >< img src = " static/styles/<?= $LoggedUser['StyleName'] ?>/images/snatched.png " alt = " Snatches " title = " Snatches " /></ td >
< td class = " artist_normalcol sign " >< img src = " static/styles/<?= $LoggedUser['StyleName'] ?>/images/seeders.png " alt = " Seeders " title = " Seeders " /></ td >
< td class = " artist_normalcol sign " >< img src = " static/styles/<?= $LoggedUser['StyleName'] ?>/images/leechers.png " alt = " Leechers " title = " Leechers " /></ td >
< td class = " artist_editcol hidden " align = " right " >
< a href = " # " < ? =! $HideDiscogDefault ? 'class="hidden"' : '' ?> id="releases_<?=$ReleaseType?>_openlink" onclick="setDefaultShow('<?=$ReleaseType?>',true);return false;">[default closed]</a>
< a href = " # " < ? = $HideDiscogDefault ? 'class="hidden"' : '' ?> id="releases_<?=$ReleaseType?>_closedlink" onclick="setDefaultShow('<?=$ReleaseType?>',false);return false;">[default open]</a>
< input class = " hidden " id = " releases_<?= $ReleaseType ?>_defaultopen " < ? =! $HideDiscogDefault ? ' checked="checked"' : '' ?> type="checkbox" title="Show" />
& nbsp ;
< span style = " cursor:move; " id = " torrents_<?= $ReleaseTypeLabel ?>_handle " >& #9776;</span>
</ td >
</ tr >
< ?
$OpenTable = true ;
foreach ( $TorrentListForReleaseType as $GroupID => $Group ) {
list ( $GroupID , $GroupName , $GroupYear , $GroupRecordLabel , $GroupCatalogueNumber , $TagList , $NewReleaseType , $GroupVanityHouse , $Torrents , $GroupArtists ) = array_values ( $Group );
$GroupVanityHouse = $GroupMeta [ $GroupID ][ 'VanityHouse' ];
$TagList = explode ( ' ' , str_replace ( '_' , '.' , $TagList ));
$TorrentTags = array ();
// $Tags array is for the sidebar on the right
foreach ( $TagList as $Tag ) {
if ( ! isset ( $Tags [ $Tag ])) {
$Tags [ $Tag ] = array ( 'name' => $Tag , 'count' => 1 );
} else {
$Tags [ $Tag ][ 'count' ] ++ ;
}
$TorrentTags [] = '<a href="torrents.php?taglist=' . $Tag . '">' . $Tag . '</a>' ;
}
$TorrentTags = implode ( ', ' , $TorrentTags );
$TorrentTags = '<br /><div class="tags">' . $TorrentTags . '</div>' ;
if (( $ReleaseType == 1023 ) || ( $ReleaseType == 1024 )) {
$ArtistPrefix = display_artists ( array ( 1 => $GroupArtists ));
} else {
$ArtistPrefix = '' ;
}
$DisplayName = $ArtistPrefix . '<a href="torrents.php?id=' . $GroupID . '" title="View Torrent">' . $GroupName . '</a>' ;
if ( $GroupYear > 0 ) { $DisplayName = $GroupYear . ' - ' . $DisplayName ; }
if ( $GroupVanityHouse ) { $DisplayName .= ' [<abbr title="This is a vanity house release">VH</abbr>]' ; }
?>
< tr class = " releases_<?= $ReleaseType ?> group discog<?= $HideDiscog ?> " >
< td class = " center " >
< div class = " show_torrents " >< a href = " # " class = " show_torrents_link " onclick = " toggle_group(<?= $GroupID ?>, this, event) " title = " Collapse this group " ></ a ></ div >
</ td >
< td class = " artist_normalcol " colspan = " 6 " >
< strong >< ? = $DisplayName ?> </strong>
< ? = $TorrentTags ?>
</ td >
</ tr >
< ?
$LastRemasterYear = '-' ;
$LastRemasterTitle = '' ;
$LastRemasterRecordLabel = '' ;
$LastRemasterCatalogueNumber = '' ;
$LastMedia = '' ;
$EditionID = 0 ;
foreach ( $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' ];
if ( $Torrent [ 'RemasterTitle' ] != $LastRemasterTitle || $Torrent [ 'RemasterYear' ] != $LastRemasterYear ||
$Torrent [ 'RemasterRecordLabel' ] != $LastRemasterRecordLabel || $Torrent [ 'RemasterCatalogueNumber' ] != $LastRemasterCatalogueNumber || $Torrent [ 'Media' ] != $LastMedia ) {
$EditionID ++ ;
if ( $Torrent [ 'RemasterTitle' ] || $Torrent [ 'RemasterYear' ] || $Torrent [ 'RemasterRecordLabel' ] || $Torrent [ 'RemasterCatalogueNumber' ]) {
$RemasterName = $Torrent [ 'RemasterYear' ];
$AddExtra = " - " ;
if ( $Torrent [ 'RemasterRecordLabel' ]) { $RemasterName .= $AddExtra . display_str ( $Torrent [ 'RemasterRecordLabel' ]); $AddExtra = ' / ' ; }
if ( $Torrent [ 'RemasterCatalogueNumber' ]) { $RemasterName .= $AddExtra . display_str ( $Torrent [ 'RemasterCatalogueNumber' ]); $AddExtra = ' / ' ; }
if ( $Torrent [ 'RemasterTitle' ]) { $RemasterName .= $AddExtra . display_str ( $Torrent [ 'RemasterTitle' ]); $AddExtra = ' / ' ; }
$RemasterName .= $AddExtra . display_str ( $Torrent [ 'Media' ]);
?>
< tr class = " releases_<?= $ReleaseType ?> groupid_<?= $GroupID ?> edition group_torrent discog <?= $HideDiscog ?> " >
2012-10-06 08:00:19 +00:00
< td colspan = " 7 " class = " artist_normalcol edition_info " >< strong >< a href = " # " onclick = " toggle_edition(<?= $GroupID ?>, <?= $EditionID ?>, this, event) " title = " Collapse this edition. Hold "Ctrl" while clicking to collapse all editions in this torrent group. " >& minus ; </ a > < ? = $RemasterName ?> </strong></a></td>
2011-03-28 14:21:28 +00:00
</ tr >
< ?
} else {
$MasterName = " Original Release " ;
$AddExtra = " / " ;
if ( $GroupRecordLabel ) { $MasterName .= $AddExtra . $GroupRecordLabel ; $AddExtra = ' / ' ; }
if ( $GroupCatalogueNumber ) { $MasterName .= $AddExtra . $GroupCatalogueNumber ; $AddExtra = ' / ' ; }
$MasterName .= $AddExtra . display_str ( $Torrent [ 'Media' ]);
?>
< tr class = " releases_<?= $ReleaseType ?> groupid_<?= $GroupID ?> edition group_torrent <?= $HideDiscog ?> " >
2012-10-06 08:00:19 +00:00
< td colspan = " 7 " class = " artist_normalcol edition_info " >< strong >< a href = " # " onclick = " toggle_edition(<?= $GroupID ?>, <?= $EditionID ?>, this, event) " title = " Collapse this edition. Hold "Ctrl" while clicking to collapse all editions in this torrent group. " >& 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' ];
$LastMedia = $Torrent [ 'Media' ];
?>
< tr class = " releases_<?= $ReleaseType ?> groupid_<?= $GroupID ?> edition_<?= $EditionID ?> group_torrent discog <?= $HideDiscog ?> " >
< td class = " artist_normalcol " colspan = " 2 " >
< span >
2012-08-14 08:00:18 +00:00
[ < a href = " torrents.php?action=download&id=<?= $TorrentID ?>&authkey=<?= $LoggedUser['AuthKey'] ?>&torrent_pass=<?= $LoggedUser['torrent_pass'] ?> " title = " Download " > DL </ a > ]
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 = " artist_normalcol nobr " >< ? = get_size ( $Torrent [ 'Size' ]) ?> </td>
< td class = " artist_normalcol " >< ? = number_format ( $Torrent [ 'Snatched' ]) ?> </td>
< td class = " artist_normalcol<?=( $Torrent['Seeders'] ==0)?' r00':''?> " >< ? = number_format ( $Torrent [ 'Seeders' ]) ?> </td>
< td class = " artist_normalcol " >< ? = number_format ( $Torrent [ 'Leechers' ]) ?> </td>
< td class = " artist_editcol hidden " ></ td >
</ tr >
< ?
}
}
}
if ( ! empty ( $TorrentList )) { ?>
</ table >
</ div >
< ? }
?>
</ div >
< ?
$TorrentDisplayList = ob_get_clean ();
//----------------- End building list and getting stats
show_header ( $Name , 'browse,requests,artists,bbcode' );
?>
< div class = " thin " >
2012-08-19 08:00:19 +00:00
< div class = " header " >
< h2 >< ? = $Name ?> <? if ($RevisionID) { ?> (Revision #<?=$RevisionID?>)<? } if ($VanityHouseArtist) { ?> [Vanity House] <? } ?></h2>
< span style = " font-size: 0.7em;float:right; " >
< a href = " # " onclick = " editOrdering();return false; " class = " " id = " editlayout " > [ Edit ordering ] </ a >
< span class = " hidden " id = " savinglayout " > Saving ordering ...</ span >
< a href = " # " onclick = " saveOrdering();return false; " class = " hidden " id = " savelayout " > [ Save ordering ] </ a >
</ span >
</ h2 >
< div id = " emptylinkbox " class = " linkbox hidden " ></ div >
< div id = " linkbox " class = " linkbox " >
2011-03-28 14:21:28 +00:00
< ? if ( check_perms ( 'site_submit_requests' )) { ?>
2012-08-19 08:00:19 +00:00
< a href = " requests.php?action=new&artistid=<?= $ArtistID ?> " > [ Add Request ] </ a >
2011-03-28 14:21:28 +00:00
< ? }
if ( check_perms ( 'site_torrents_notify' )) {
if (( $Notify = $Cache -> get_value ( 'notify_artists_' . $LoggedUser [ 'ID' ])) === FALSE ) {
$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 );
$Cache -> cache_value ( 'notify_artists_' . $LoggedUser [ 'ID' ], $Notify , 0 );
}
if ( stripos ( $Notify [ 'Artists' ], '|' . $Name . '|' ) === FALSE ) {
?>
2012-08-19 08:00:19 +00:00
< a href = " artist.php?action=notify&artistid=<?= $ArtistID ?>&auth=<?= $LoggedUser['AuthKey'] ?> " > [ Notify of new uploads ] </ a >
2011-03-28 14:21:28 +00:00
< ?
} else {
?>
2012-08-19 08:00:19 +00:00
< a href = " artist.php?action=notifyremove&artistid=<?= $ArtistID ?>&auth=<?= $LoggedUser['AuthKey'] ?> " > [ Do not notify of new uploads ] </ a >
2011-03-28 14:21:28 +00:00
< ?
}
}
if ( has_bookmarked ( 'artist' , $ArtistID )) {
?>
2012-08-19 08:00:19 +00:00
< a href = " # " id = " bookmarklink_artist_<?= $ArtistID ?> " onclick = " Unbookmark('artist', <?= $ArtistID ?>,'[Bookmark]');return false; " > [ Remove bookmark ] </ a >
2011-03-28 14:21:28 +00:00
< ?
} else {
?>
2012-08-19 08:00:19 +00:00
< 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' )) {
?>
2012-08-19 08:00:19 +00:00
< a href = " artist.php?action=edit&artistid=<?= $ArtistID ?> " > [ Edit ] </ a >
2011-03-28 14:21:28 +00:00
< ? } ?>
2012-08-19 08:00:19 +00:00
< a href = " artist.php?action=history&artistid=<?= $ArtistID ?> " > [ View history ] </ a >
2011-03-28 14:21:28 +00:00
< ? if ( check_perms ( 'site_delete_artist' ) && check_perms ( 'torrents_delete' )) { ?>
2012-08-19 08:00:19 +00:00
< a href = " artist.php?action=delete&artistid=<?= $ArtistID ?>&auth=<?= $LoggedUser['AuthKey'] ?> " > [ Delete ] </ a >
2011-03-28 14:21:28 +00:00
< ? }
if ( $RevisionID && check_perms ( 'site_edit_wiki' )) {
?>
2012-08-19 08:00:19 +00:00
< a href = " artist.php?action=revert&artistid=<?= $ArtistID ?>&revisionid=<?= $RevisionID ?>&auth=<?= $LoggedUser['AuthKey'] ?> " >
[ Revert to this revision ]
</ a >
2011-03-28 14:21:28 +00:00
< ? } ?>
2012-08-19 08:00:19 +00:00
</ div >
2011-03-28 14:21:28 +00:00
</ div >
< div class = " sidebar " >
< ? 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>
< div style = " text-align:center;padding:10px 0px; " >
< img style = " max-width: 220px; " src = " <?= $Image ?> " alt = " <?= $Name ?> " onclick = " lightbox.init(this,220); " />
</ 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
?>
2012-08-17 08:00:13 +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 " >
< 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 );
}
?>
2012-08-17 08:00:13 +00:00
< div class = " box box_artists box_artists_similar " >
2011-03-28 14:21:28 +00:00
< div class = " head " >< strong > Similar artists </ strong ></ div >
< ul class = " stats nobullet " >
< ?
if ( $NumSimilar == 0 ) { ?>
2012-09-23 08:00:25 +00:00
< li >< span style = " font-style: italic; " > None found </ span ></ li >
2011-03-28 14:21:28 +00:00
< ? }
$First = true ;
2012-09-23 08:00:25 +00:00
foreach ( $SimilarArray as $SimilarArtist ) {
2011-03-28 14:21:28 +00:00
list ( $Artist2ID , $Artist2Name , $Score , $SimilarID ) = $SimilarArtist ;
$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
2011-03-28 14:21:28 +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 >
< 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; " > [ & minus ;] </ a >
< a href = " artist.php?action=vote_similar&artistid=<?= $ArtistID ?>&similarid=<?= $SimilarID ?>&way=up " style = " font-family: monospace; " > [ + ] </ a >
2012-09-23 08:00:25 +00:00
< ? if ( check_perms ( 'site_delete_tag' )) { ?>
2011-03-28 14:21:28 +00:00
< a href = " artist.php?action=delete_similar&similarid=<?= $SimilarID ?>&auth=<?= $LoggedUser['AuthKey'] ?> " > [ X ] </ a >
2012-09-23 08:00:25 +00:00
< ? } ?>
2011-03-28 14:21:28 +00:00
</ div >
< br style = " clear:both " />
</ li >
< ? } ?>
</ ul >
</ div >
2012-08-17 08:00:13 +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 ?> " />
< 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 ) {
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 = " requests_table border " width = " 100% " id = " requests " >
2011-03-28 14:21:28 +00:00
< 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 ;
2012-09-23 08:00:25 +00:00
2011-03-28 14:21:28 +00:00
$CategoryName = $Categories [ $CategoryID - 1 ];
2012-09-23 08:00:25 +00:00
2011-03-28 14:21:28 +00:00
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> " ;
}
2012-09-23 08:00:25 +00:00
2011-03-28 14:21:28 +00:00
$Row = ( $Row == 'a' ) ? 'b' : 'a' ;
2012-09-23 08:00:25 +00:00
2011-03-28 14:21:28 +00:00
$Tags = get_request_tags ( $RequestID );
?>
< tr class = " row<?= $Row ?> " >
< td >
< ? = $FullName ?>
< div class = " tags " >
2012-09-23 08:00:25 +00:00
< ?
2011-03-28 14:21:28 +00:00
$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 >
2012-09-23 08:00:25 +00:00
< ? = $Votes ?>
2011-03-28 14:21:28 +00:00
< ? if ( check_perms ( 'site_vote' )){ ?>
< input type = " hidden " id = " auth " name = " auth " value = " <?= $LoggedUser['AuthKey'] ?> " />
2011-06-27 08:00:06 +00:00
& nbsp ; & nbsp ; < a href = " javascript:Vote(0) " >< strong > ( + ) </ strong ></ a >
2011-03-28 14:21:28 +00:00
< ? } ?>
</ td >
< td >
< ? = get_size ( $Bounty ) ?>
</ td >
< td >
< ? = time_diff ( $TimeAdded ) ?>
</ td >
</ tr >
< ? } ?>
</ table >
< ?
}
// Similar artist map
if ( $NumSimilar > 0 ) {
$SimilarData = $Cache -> get_value ( 'similar_positions_' . $ArtistID );
2012-09-23 08:00:25 +00:00
2011-03-28 14:21:28 +00:00
if ( ! $Data ) {
include ( SERVER_ROOT . '/classes/class_image.php' );
$Img = new IMAGE ;
$Img -> create ( WIDTH , HEIGHT );
$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
2011-03-28 14:21:28 +00:00
$Cache -> cache_value ( 'similar_positions_' . $ArtistID , $SimilarData , 3600 * 24 );
} else {
$Similar = new ARTISTS_SIMILAR ( $ArtistID );
$Similar -> load_data ( $SimilarData );
}
?>
< 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 >
2012-09-23 08:00:25 +00:00
< ? } // if $NumSimilar>0 ?>
2011-03-28 14:21:28 +00:00
< 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
2012-09-23 08:00:25 +00:00
if ( $RevisionID ) {
2011-03-28 14:21:28 +00:00
$Key = " artist_ $ArtistID " . " _revision_ $RevisionID " ;
2012-09-23 08:00:25 +00:00
} else {
2011-03-28 14:21:28 +00:00
$Key = 'artist_' . $ArtistID ;
}
$Data = serialize ( array ( array ( $Name , $Image , $Body , $NumSimilar , $SimilarArray , $TorrentList , $GroupMeta )));
$Cache -> cache_value ( $Key , $Data , 3600 );
?>