Oppaitime's version of Gazelle
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

artist.php 34KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925
  1. <?
  2. //~~~~~~~~~~~ Main artist page ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
  3. //For sorting tags
  4. function compare($X, $Y) {
  5. return($Y['count'] - $X['count']);
  6. }
  7. // Similar Artist Map
  8. include(SERVER_ROOT.'/classes/artists_similar.class.php');
  9. $UserVotes = Votes::get_user_votes($LoggedUser['ID']);
  10. $ArtistID = $_GET['id'];
  11. if (!is_number($ArtistID)) {
  12. error(0);
  13. }
  14. if (!empty($_GET['revisionid'])) { // if they're viewing an old revision
  15. $RevisionID = $_GET['revisionid'];
  16. if (!is_number($RevisionID)) {
  17. error(0);
  18. }
  19. $Data = $Cache->get_value("artist_{$ArtistID}_revision_$RevisionID", true);
  20. } else { // viewing the live version
  21. $Data = $Cache->get_value("artist_$ArtistID", true);
  22. $RevisionID = false;
  23. }
  24. if ($Data) {
  25. #list($K, list($Name, $Image, $Body, $NumSimilar, $SimilarArray, , , $VanityHouseArtist)) = each($Data);
  26. list($K, list($Name, $Image, $Body, $NumSimilar, $SimilarArray)) = each($Data);
  27. } else {
  28. if ($RevisionID) {
  29. $sql = "
  30. SELECT
  31. a.Name,
  32. wiki.Image,
  33. wiki.body
  34. FROM wiki_artists AS wiki
  35. LEFT JOIN artists_group AS a ON wiki.RevisionID = a.RevisionID
  36. WHERE wiki.RevisionID = '$RevisionID' ";
  37. } else {
  38. $sql = "
  39. SELECT
  40. a.Name,
  41. wiki.Image,
  42. wiki.body
  43. FROM artists_group AS a
  44. LEFT JOIN wiki_artists AS wiki ON wiki.RevisionID = a.RevisionID
  45. WHERE a.ArtistID = '$ArtistID' ";
  46. }
  47. $sql .= "
  48. GROUP BY a.ArtistID";
  49. $DB->query($sql);
  50. if (!$DB->has_results()) {
  51. error(404);
  52. }
  53. list($Name, $Image, $Body) = $DB->next_record(MYSQLI_NUM, array(0));
  54. }
  55. //----------------- Build list and get stats
  56. ob_start();
  57. // Requests
  58. $Requests = [];
  59. if (empty($LoggedUser['DisableRequests'])) {
  60. $Requests = $Cache->get_value("artists_requests_$ArtistID");
  61. if (!is_array($Requests)) {
  62. $DB->query("
  63. SELECT
  64. r.ID,
  65. r.CategoryID,
  66. r.Title,
  67. r.TitleRJ,
  68. r.TitleJP,
  69. r.CatalogueNumber,
  70. r.DLSiteID,
  71. r.TimeAdded,
  72. COUNT(rv.UserID) AS Votes,
  73. SUM(rv.Bounty) AS Bounty
  74. FROM requests AS r
  75. LEFT JOIN requests_votes AS rv ON rv.RequestID = r.ID
  76. LEFT JOIN requests_artists AS ra ON r.ID = ra.RequestID
  77. WHERE ra.ArtistID = $ArtistID
  78. AND r.TorrentID = 0
  79. GROUP BY r.ID
  80. ORDER BY Votes DESC");
  81. if ($DB->has_results()) {
  82. $Requests = $DB->to_array('ID', MYSQLI_ASSOC, false);
  83. } else {
  84. $Requests = [];
  85. }
  86. $Cache->cache_value("artists_requests_$ArtistID", $Requests);
  87. }
  88. }
  89. $NumRequests = count($Requests);
  90. if (($GroupIDs = $Cache->get_value("artist_groups_$ArtistID")) === false) {
  91. $DB->query("
  92. SELECT
  93. DISTINCTROW ta.GroupID
  94. FROM torrents_artists AS ta
  95. WHERE ta.ArtistID = '$ArtistID'");
  96. $GroupIDs = $DB->collect('GroupID');
  97. $Cache->cache_value("artist_groups_$ArtistID", $GroupIDs, 0);
  98. }
  99. if (count($GroupIDs) > 0) {
  100. $TorrentList = Torrents::get_groups($GroupIDs, true, true);
  101. } else {
  102. $TorrentList = [];
  103. }
  104. $NumGroups = count($TorrentList);
  105. if (!empty($TorrentList)) {
  106. ?>
  107. <div id="discog_table" class="box">
  108. <?
  109. }
  110. // Deal with torrents without release types, which can end up here
  111. // if they're uploaded with a non-grouping category ID
  112. $UnknownRT = array_search('Unknown', $ReleaseTypes);
  113. if ($UnknownRT === false) {
  114. $UnknownRT = 1025;
  115. $ReleaseTypes[$UnknownRT] = 'Unknown';
  116. }
  117. //Custom sorting for releases
  118. if (!empty($LoggedUser['SortHide'])) {
  119. $SortOrder = array_flip(array_keys($LoggedUser['SortHide']));
  120. } else {
  121. $SortOrder = $ReleaseTypes;
  122. }
  123. // If the $SortOrder array doesn't have all release types, put the missing ones at the end
  124. $MissingTypes = array_diff_key($ReleaseTypes, $SortOrder);
  125. if (!empty($MissingTypes)) {
  126. $MaxOrder = max($SortOrder);
  127. foreach (array_keys($MissingTypes) as $Missing) {
  128. $SortOrder[$Missing] = ++$MaxOrder;
  129. }
  130. }
  131. // Sort the anchors at the top of the page the same way as release types
  132. reset($TorrentList);
  133. $NumTorrents = 0;
  134. $NumSeeders = 0;
  135. $NumLeechers = 0;
  136. $NumSnatches = 0;
  137. foreach ($TorrentList as $GroupID => $Group) {
  138. // $Tags array is for the sidebar on the right.
  139. $TorrentTags = new Tags($Group['TagList'], true);
  140. foreach ($Group['Torrents'] as $TorrentID => $Torrent) {
  141. $NumTorrents++;
  142. $Torrent['Seeders'] = (int)$Torrent['Seeders'];
  143. $Torrent['Leechers'] = (int)$Torrent['Leechers'];
  144. $Torrent['Snatched'] = (int)$Torrent['Snatched'];
  145. $NumSeeders += $Torrent['Seeders'];
  146. $NumLeechers += $Torrent['Leechers'];
  147. $NumSnatches += $Torrent['Snatched'];
  148. }
  149. }
  150. $OpenTable = false;
  151. $ShowGroups = !isset($LoggedUser['TorrentGrouping']) || $LoggedUser['TorrentGrouping'] == 0;
  152. $HideTorrents = ($ShowGroups ? '' : ' hidden');
  153. $OldGroupID = 0;
  154. ?>
  155. <table class="torrent_table grouped release_table">
  156. <tr class="colhead_dark">
  157. <td class="small"><!-- expand/collapse --></td>
  158. <td width="70%"><a href="#">&uarr;</a>&nbsp;<strong>Name</strong></td>
  159. <td>Size</td>
  160. <td class="sign snatches">
  161. <a><svg width="15" height="15" fill="white" class="tooltip" alt="Snatches" title="Snatches" viewBox="3 0 88 98"><path d="M20 20 A43 43,0,1,0,77 23 L90 10 L55 10 L55 45 L68 32 A30.27 30.27,0,1,1,28 29"></path></svg></a>
  162. </td>
  163. <td class="sign seeders">
  164. <a><svg width="11" height="15" fill="white" class="tooltip" alt="Seeders" title="Seeders"><polygon points="0,7 5.5,0 11,7 8,7 8,15 3,15 3,7"></polygon></svg></a>
  165. </td>
  166. <td class="sign leechers">
  167. <a><svg width="11" height="15" fill="white" class="tooltip" alt="Leechers" title="Leechers"><polygon points="0,8 5.5,15 11,8 8,8 8,0 3,0 3,8"></polygon></svg></a>
  168. </td>
  169. </tr>
  170. <?
  171. foreach ($TorrentList as $Group) {
  172. extract(Torrents::array_group($TorrentList[$Group['ID']]), EXTR_OVERWRITE);
  173. if ($GroupID == $OldGroupID) {
  174. continue;
  175. } else {
  176. $OldGroupID = $GroupID;
  177. }
  178. if (count($Torrents) > 1) {
  179. $TorrentTags = new Tags($TagList, false);
  180. $DisplayName = Artists::display_artists(Artists::get_artist($GroupID), true, true);
  181. $DisplayName .= "<a href=\"torrents.php?id=$GroupID\" class=\"tooltip\" title=\"View torrent group\" ";
  182. if (!isset($LoggedUser['CoverArt']) || $LoggedUser['CoverArt']) {
  183. $DisplayName .= 'onmouseover="getCover(event)" data-cover="'.ImageTools::process($WikiImage, true).'" onmouseleave="ungetCover()" ';
  184. }
  185. $GroupName = empty($GroupName) ? (empty($GroupNameRJ) ? $GroupNameJP : $GroupNameRJ) : $GroupName;
  186. $DisplayName .= "dir=\"ltr\">$GroupName</a>";
  187. if ($GroupYear) {
  188. $DisplayName .= " [$GroupYear]";
  189. }
  190. if ($GroupStudio) {
  191. $DisplayName .= " [$GroupStudio]";
  192. }
  193. if ($GroupCatalogueNumber) {
  194. $DisplayName .= " [$GroupCatalogueNumber]";
  195. }
  196. if ($GroupPages) {
  197. $DisplayName .= " [{$GroupPages}p]";
  198. }
  199. if ($GroupDLSiteID) {
  200. $DisplayName .= " [$GroupDLSiteID]";
  201. }
  202. if (check_perms('users_mod') || check_perms('torrents_fix_ghosts')) {
  203. $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>';
  204. }
  205. $SnatchedGroupClass = ($GroupFlags['IsSnatched'] ? ' snatched_group' : '');
  206. ?>
  207. <tr class="group<?=$SnatchedGroupClass?>">
  208. <?
  209. $ShowGroups = !(!empty($LoggedUser['TorrentGrouping']) && $LoggedUser['TorrentGrouping'] == 1);
  210. ?>
  211. <td class="center">
  212. <div id="showimg_<?=$GroupID?>" class="<?=($ShowGroups ? 'hide' : 'show')?>_torrents">
  213. <a class="tooltip show_torrents_link" onclick="toggle_group(<?=$GroupID?>, this, event);" title="Toggle this group (Hold &quot;Shift&quot; to toggle all groups)"></a>
  214. </div>
  215. </td>
  216. <td colspan="5" class="big_info">
  217. <div class="group_info clear">
  218. <strong><?=$DisplayName?></strong>
  219. <? if (Bookmarks::has_bookmarked('torrent', $GroupID)) { ?>
  220. <span class="remove_bookmark float_right">
  221. <a style="float: right;" href="#" id="bookmarklink_torrent_<?=$GroupID?>" class="brackets" onclick="Unbookmark('torrent', <?=$GroupID?>, 'Bookmark'); return false;">Remove bookmark</a>
  222. </span>
  223. <? } else { ?>
  224. <span class="add_bookmark float_right">
  225. <a style="float: right;" href="#" id="bookmarklink_torrent_<?=$GroupID?>" class="brackets" onclick="Bookmark('torrent', <?=$GroupID?>, 'Remove bookmark'); return false;">Bookmark</a>
  226. </span>
  227. <? }
  228. $VoteType = isset($UserVotes[$GroupID]['Type']) ? $UserVotes[$GroupID]['Type'] : '';
  229. Votes::vote_link($GroupID, $VoteType);
  230. ?>
  231. <div class="tags"><?=$TorrentTags->format('torrents.php?taglist=', $Name)?></div>
  232. </div>
  233. </td>
  234. <?
  235. foreach($Torrents as $TorrentID => $Torrent) {
  236. $Reported = false;
  237. $Reports = Torrents::get_reports($TorrentID);
  238. if (count($Reports) > 0) {
  239. $Reported = true;
  240. }
  241. $SnatchedTorrentClass = $Torrent['IsSnatched'] ? ' snatched_torrent' : '';
  242. $TorrentDL = "torrents.php?action=download&amp;id=".$TorrentID."&amp;authkey=".$LoggedUser['AuthKey']."&amp;torrent_pass=".$LoggedUser['torrent_pass'];
  243. if (!empty(G::$LoggedUser) && (G::$LoggedUser['ShowMagnets'] ?? false)) {
  244. $TorrentMG = "magnet:?xt=urn:btih:".$Torrent['info_hash']."&as=https://".SITE_DOMAIN."/".str_replace('&amp;','%26',$TorrentDL)."&tr=".implode("/".$LoggedUser['torrent_pass']."/announce&tr=",ANNOUNCE_URLS[0])."/".$LoggedUser['torrent_pass']."/announce&xl=".$Torrent['Size'];
  245. }
  246. ?>
  247. <tr class="torrent_row groupid_<?=$GroupID?> group_torrent discog<?=$SnatchedTorrentClass . $SnatchedGroupClass . $HideTorrents?>">
  248. <td colspan="2">
  249. <span>
  250. [ <a href="<?=$TorrentDL?>" class="tooltip" title="Download">DL</a>
  251. <? if (isset($TorrentMG)) { ?>
  252. | <a href="<?=$TorrentMG?>" class="tooltip" title="Magnet Link">MG</a>
  253. <? }
  254. if (Torrents::can_use_token($Torrent)) { ?>
  255. | <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>
  256. <? } ?>
  257. | <a href="reportsv2.php?action=report&amp;id=<?=$TorrentID?>" class="tooltip" title="Report">RP</a> ]
  258. </span>
  259. &nbsp;&nbsp;&raquo;&nbsp; <a href="torrents.php?id=<?=$GroupID?>&amp;torrentid=<?=$TorrentID?>"><?=Torrents::torrent_info($Torrent)?></a>
  260. </td>
  261. <td class="number_column nobr"><?=Format::get_size($Torrent['Size'])?></td>
  262. <td class="number_column"><?=number_format($Torrent['Snatched'])?></td>
  263. <td class="number_column<?=(($Torrent['Seeders'] == 0) ? ' r00' : '')?>"><?=number_format($Torrent['Seeders'])?></td>
  264. <td class="number_column"><?=number_format($Torrent['Leechers'])?></td>
  265. </tr>
  266. <?
  267. }
  268. } else {
  269. list($TorrentID, $Torrent) = each($Torrents);
  270. if (!$TorrentID) { continue; }
  271. $TorrentTags = new Tags($TagList, false);
  272. $DisplayName = Artists::display_artists(Artists::get_artist($GroupID), true, true);
  273. $Reported = false;
  274. $Reports = Torrents::get_reports($TorrentID);
  275. if (count($Reports) > 0) {
  276. $Reported = true;
  277. }
  278. $DisplayName .= "<a class=\"torrent_name\" href=\"torrents.php?id=$GroupID&amp;torrentid=$TorrentID#torrent$TorrentID\" ";
  279. if (!isset($LoggedUser['CoverArt']) || $LoggedUser['CoverArt']) {
  280. $DisplayName .= "onmouseover=\"getCover(event)\" data-cover=\"".ImageTools::process($WikiImage, true)."\" onmouseleave=\"ungetCover(event)\" ";
  281. }
  282. $GroupName = empty($GroupName) ? (empty($GroupNameRJ) ? $GroupNameJP : $GroupNameRJ) : $GroupName;
  283. $DisplayName .= "dir=\"ltr\">$GroupName</a>";
  284. if ($GroupYear) {
  285. $DisplayName .= " [$GroupYear]";
  286. }
  287. if ($GroupStudio) {
  288. $DisplayName .= " [$GroupStudio]";
  289. }
  290. if ($GroupCatalogueNumber) {
  291. $DisplayName .= " [$GroupCatalogueNumber]";
  292. }
  293. if ($GroupPages) {
  294. $DisplayName .= " [{$GroupPages}p]";
  295. }
  296. if ($GroupDLSiteID) {
  297. $DisplayName .= " [$GroupDLSiteID]";
  298. }
  299. if (check_perms('users_mod') || check_perms('torrents_fix_ghosts')) {
  300. $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>';
  301. }
  302. $ExtraInfo = Torrents::torrent_info($Torrent, true, true);
  303. $SnatchedGroupClass = ($GroupFlags['IsSnatched'] ? ' snatched_group' : '');
  304. $SnatchedTorrentClass = $Torrent['IsSnatched'] ? ' snatched_torrent' : '';
  305. $TorrentDL = "torrents.php?action=download&amp;id=".$TorrentID."&amp;authkey=".$LoggedUser['AuthKey']."&amp;torrent_pass=".$LoggedUser['torrent_pass'];
  306. if (!empty(G::$LoggedUser) && (G::$LoggedUser['ShowMagnets'] ?? false)) {
  307. $TorrentMG = "magnet:?xt=urn:btih:".$Torrent['info_hash']."&as=https://".SITE_DOMAIN."/".str_replace('&amp;','%26',$TorrentDL)."&tr=".implode("/".$LoggedUser['torrent_pass']."/announce&tr=",ANNOUNCE_URLS[0])."/".$LoggedUser['torrent_pass']."/announce&xl=".$Torrent['Size'];
  308. }
  309. ?>
  310. <tr class="torrent<?=$SnatchedTorrentClass . $SnatchedGroupClass?>">
  311. <td class="center">
  312. </td>
  313. <td class="big_info">
  314. <div class="group_info clear">
  315. <div class="float_right">
  316. <span>
  317. [ <a href="<?=$TorrentDL?>" class="tooltip" title="Download">DL</a>
  318. <? if (isset($TorrentMG)) { ?>
  319. | <a href="<?=$TorrentMG?>" class="tooltip" title="Magnet Link">MG</a>
  320. <? }
  321. if (Torrents::can_use_token($Torrent)) { ?>
  322. | <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>
  323. <? } ?>
  324. | <a href="reportsv2.php?action=report&amp;id=<?=$TorrentID?>" class="tooltip" title="Report">RP</a> ]
  325. </span>
  326. <br />
  327. <? if (Bookmarks::has_bookmarked('torrent', $GroupID)) { ?>
  328. <span class="remove_bookmark float_right">
  329. <a href="#" id="bookmarklink_torrent_<?=$GroupID?>" class="brackets" onclick="Unbookmark('torrent', <?=$GroupID?>, 'Bookmark'); return false;">Remove bookmark</a>
  330. </span>
  331. <? } else { ?>
  332. <span class="add_bookmark float_right">
  333. <a href="#" id="bookmarklink_torrent_<?=$GroupID?>" class="brackets" onclick="Bookmark('torrent', <?=$GroupID?>, 'Remove bookmark'); return false;">Bookmark</a>
  334. </span>
  335. <? } ?>
  336. </div>
  337. <?=$DisplayName?>
  338. <br />
  339. <div style="display: inline;" class="torrent_info"><?=$ExtraInfo?><? if ($Reported) { ?> / <strong class="torrent_label tl_reported">Reported</strong><? } ?></div>
  340. <div class="tags"><?=$TorrentTags->format('torrents.php?taglist=', $Name)?></div>
  341. </div>
  342. </td>
  343. <td class="number_column nobr"><?=Format::get_size($Torrent['Size'])?></td>
  344. <td class="number_column"><?=number_format($Torrent['Snatched'])?></td>
  345. <td class="number_column<?=(($Torrent['Seeders'] == 0) ? ' r00' : '')?>"><?=number_format($Torrent['Seeders'])?></td>
  346. <td class="number_column"><?=number_format($Torrent['Leechers'])?></td>
  347. </tr>
  348. <?
  349. }
  350. }
  351. ?>
  352. </table>
  353. </div>
  354. <?
  355. $TorrentDisplayList = ob_get_clean();
  356. //----------------- End building list and getting stats
  357. // Comments (must be loaded before View::show_header so that subscriptions and quote notifications are handled properly)
  358. list($NumComments, $Page, $Thread, $LastRead) = Comments::load('artist', $ArtistID);
  359. View::show_header($Name, 'browse,requests,bbcode,comments,voting,recommend,subscriptions');
  360. ?>
  361. <div class="thin">
  362. <div class="header">
  363. <h2><?=display_str($Name)?><? if ($RevisionID) { ?> (Revision #<?=$RevisionID?>)<? } ?></h2>
  364. <div class="linkbox">
  365. <? if (check_perms('site_submit_requests')) { ?>
  366. <a href="requests.php?action=new&amp;artistid=<?=$ArtistID?>" class="brackets">Add request</a>
  367. <?
  368. }
  369. if (check_perms('site_torrents_notify')) {
  370. if (($Notify = $Cache->get_value('notify_artists_'.$LoggedUser['ID'])) === false) {
  371. $DB->query("
  372. SELECT ID, Artists
  373. FROM users_notify_filters
  374. WHERE UserID = '$LoggedUser[ID]'
  375. AND Label = 'Artist notifications'
  376. LIMIT 1");
  377. $Notify = $DB->next_record(MYSQLI_ASSOC, false);
  378. $Cache->cache_value('notify_artists_'.$LoggedUser['ID'], $Notify, 0);
  379. }
  380. if (stripos($Notify['Artists'], "|$Name|") === false) {
  381. ?>
  382. <a href="artist.php?action=notify&amp;artistid=<?=$ArtistID?>&amp;auth=<?=$LoggedUser['AuthKey']?>" class="brackets">Notify of new uploads</a>
  383. <? } else { ?>
  384. <a href="artist.php?action=notifyremove&amp;artistid=<?=$ArtistID?>&amp;auth=<?=$LoggedUser['AuthKey']?>" class="brackets">Do not notify of new uploads</a>
  385. <?
  386. }
  387. }
  388. if (Bookmarks::has_bookmarked('artist', $ArtistID)) {
  389. ?>
  390. <a href="#" id="bookmarklink_artist_<?=$ArtistID?>" onclick="Unbookmark('artist', <?=$ArtistID?>, 'Bookmark'); return false;" class="brackets">Remove bookmark</a>
  391. <? } else { ?>
  392. <a href="#" id="bookmarklink_artist_<?=$ArtistID?>" onclick="Bookmark('artist', <?=$ArtistID?>, 'Remove bookmark'); return false;" class="brackets">Bookmark</a>
  393. <? } ?>
  394. <a href="#" id="subscribelink_artist<?=$ArtistID?>" class="brackets" onclick="SubscribeComments('artist', <?=$ArtistID?>);return false;"><?=Subscriptions::has_subscribed_comments('artist', $ArtistID) !== false ? 'Unsubscribe' : 'Subscribe'?></a>
  395. <!-- <a href="#" id="recommend" class="brackets">Recommend</a> -->
  396. <?
  397. if (check_perms('site_edit_wiki')) {
  398. ?>
  399. <a href="artist.php?action=edit&amp;artistid=<?=$ArtistID?>" class="brackets">Edit</a>
  400. <? } ?>
  401. <a href="artist.php?action=history&amp;artistid=<?=$ArtistID?>" class="brackets">View history</a>
  402. <? if ($RevisionID && check_perms('site_edit_wiki')) { ?>
  403. <a href="artist.php?action=revert&amp;artistid=<?=$ArtistID?>&amp;revisionid=<?=$RevisionID?>&amp;auth=<?=$LoggedUser['AuthKey']?>" class="brackets">Revert to this revision</a>
  404. <? } ?>
  405. <a href="artist.php?id=<?=$ArtistID?>#info" class="brackets">Info</a>
  406. <a href="artist.php?id=<?=$ArtistID?>#artistcomments" class="brackets">Comments</a>
  407. <? if (check_perms('site_delete_artist') && check_perms('torrents_delete')) { ?>
  408. <a href="artist.php?action=delete&amp;artistid=<?=$ArtistID?>&amp;auth=<?=$LoggedUser['AuthKey']?>" class="brackets">Delete</a>
  409. <? } ?>
  410. </div>
  411. </div>
  412. <? /* Misc::display_recommend($ArtistID, "artist"); */ ?>
  413. <div class="sidebar">
  414. <? if ($Image) { ?>
  415. <div class="box box_image">
  416. <div class="head"><strong><?=$Name?></strong></div>
  417. <div style="text-align: center; padding: 10px 0px;">
  418. <img style="max-width: 220px;" class="lightbox-init" src="<?=ImageTools::process($Image, true)?>" alt="<?=$Name?>" />
  419. </div>
  420. </div>
  421. <? } ?>
  422. <div class="box box_search">
  423. <div class="head"><strong>File Lists Search</strong></div>
  424. <ul class="nobullet">
  425. <li>
  426. <form class="search_form" name="filelists" action="torrents.php">
  427. <input type="hidden" name="artistname" value="<?=$Name?>" />
  428. <input type="hidden" name="action" value="advanced" />
  429. <input type="text" autocomplete="off" id="filelist" name="filelist" size="20" />
  430. <input type="submit" value="&gt;" />
  431. </form>
  432. </li>
  433. </ul>
  434. </div>
  435. <?
  436. /* if (check_perms('zip_downloader')) {
  437. if (isset($LoggedUser['Collector'])) {
  438. list($ZIPList, $ZIPPrefs) = $LoggedUser['Collector'];
  439. $ZIPList = explode(':', $ZIPList);
  440. } else {
  441. $ZIPList = array('00', '11');
  442. $ZIPPrefs = 1;
  443. }
  444. ?>
  445. <div class="box box_zipdownload">
  446. <div class="head colhead_dark"><strong>Collector</strong></div>
  447. <div class="pad">
  448. <form class="download_form" name="zip" action="artist.php" method="post">
  449. <input type="hidden" name="action" value="download" />
  450. <input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
  451. <input type="hidden" name="artistid" value="<?=$ArtistID?>" />
  452. <ul id="list" class="nobullet">
  453. <? foreach ($ZIPList as $ListItem) { ?>
  454. <li id="list<?=$ListItem?>">
  455. <input type="hidden" name="list[]" value="<?=$ListItem?>" />
  456. <span style="float: left;"><?=$ZIPOptions[$ListItem]['2']?></span>
  457. <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>
  458. <br style="clear: all;" />
  459. </li>
  460. <? } ?>
  461. </ul>
  462. <select id="formats" style="width: 180px;">
  463. <?
  464. $OpenGroup = false;
  465. $LastGroupID = -1;
  466. foreach ($ZIPOptions as $Option) {
  467. list($GroupID, $OptionID, $OptName) = $Option;
  468. if ($GroupID != $LastGroupID) {
  469. $LastGroupID = $GroupID;
  470. if ($OpenGroup) { ?>
  471. </optgroup>
  472. <? } ?>
  473. <optgroup label="<?=$ZIPGroups[$GroupID]?>">
  474. <? $OpenGroup = true;
  475. }
  476. ?>
  477. <option id="opt<?=$GroupID.$OptionID?>" value="<?=$GroupID.$OptionID?>"<? if (in_array($GroupID.$OptionID, $ZIPList)) { echo ' disabled="disabled"'; } ?>><?=$OptName?></option>
  478. <?
  479. }
  480. ?>
  481. </optgroup>
  482. </select>
  483. <button type="button" onclick="add_selection()">+</button>
  484. <select name="preference" style="width: 210px;">
  485. <option value="0"<? if ($ZIPPrefs == 0) { echo ' selected="selected"'; } ?>>Prefer Original</option>
  486. <option value="1"<? if ($ZIPPrefs == 1) { echo ' selected="selected"'; } ?>>Prefer Best Seeded</option>
  487. <option value="2"<? if ($ZIPPrefs == 2) { echo ' selected="selected"'; } ?>>Prefer Bonus Tracks</option>
  488. </select>
  489. <input type="submit" style="width: 210px;" value="Download" />
  490. </form>
  491. </div>
  492. </div>
  493. <?
  494. } //if (check_perms('zip_downloader'))*/ ?>
  495. <div class="box box_tags">
  496. <div class="head"><strong>Tags</strong></div>
  497. <ul class="stats nobullet">
  498. <? Tags::format_top(50, 'torrents.php?taglist=', $Name); ?>
  499. </ul>
  500. </div>
  501. <?
  502. // Stats
  503. ?>
  504. <div class="box box_info box_statistics_artist">
  505. <div class="head"><strong>Statistics</strong></div>
  506. <ul class="stats nobullet">
  507. <li>Number of groups: <?=number_format($NumGroups)?></li>
  508. <li>Number of torrents: <?=number_format($NumTorrents)?></li>
  509. <li>Number of seeders: <?=number_format($NumSeeders)?></li>
  510. <li>Number of leechers: <?=number_format($NumLeechers)?></li>
  511. <li>Number of snatches: <?=number_format($NumSnatches)?></li>
  512. </ul>
  513. </div>
  514. <?
  515. if (empty($SimilarArray)) {
  516. $DB->query("
  517. SELECT
  518. s2.ArtistID,
  519. a.Name,
  520. ass.Score,
  521. ass.SimilarID
  522. FROM artists_similar AS s1
  523. JOIN artists_similar AS s2 ON s1.SimilarID = s2.SimilarID AND s1.ArtistID != s2.ArtistID
  524. JOIN artists_similar_scores AS ass ON ass.SimilarID = s1.SimilarID
  525. JOIN artists_group AS a ON a.ArtistID = s2.ArtistID
  526. WHERE s1.ArtistID = '$ArtistID'
  527. ORDER BY ass.Score DESC
  528. LIMIT 30
  529. ");
  530. $SimilarArray = $DB->to_array();
  531. $NumSimilar = count($SimilarArray);
  532. }
  533. ?>
  534. <div class="box box_artists">
  535. <div class="head"><strong>Similar</strong></div>
  536. <ul class="stats nobullet">
  537. <? if ($NumSimilar == 0) { ?>
  538. <li><span style="font-style: italic;">None found</span></li>
  539. <?
  540. }
  541. $First = true;
  542. foreach ($SimilarArray as $SimilarArtist) {
  543. list($Artist2ID, $Artist2Name, $Score, $SimilarID) = $SimilarArtist;
  544. $Score = $Score / 100;
  545. if ($First) {
  546. $Max = $Score + 1;
  547. $First = false;
  548. }
  549. $FontSize = (ceil(((($Score - 2) / $Max - 2) * 4))) + 8;
  550. ?>
  551. <li>
  552. <span class="tooltip" title="<?=$Score?>"><a href="artist.php?id=<?=$Artist2ID?>" style="float: left; display: block;"><?=$Artist2Name?></a></span>
  553. <div style="float: right; display: block; letter-spacing: -1px;">
  554. <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>
  555. <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>
  556. <? if (check_perms('site_delete_tag')) { ?>
  557. <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>
  558. <? } ?>
  559. </div>
  560. <br style="clear: both;" />
  561. </li>
  562. <? } ?>
  563. </ul>
  564. </div>
  565. <div class="box box_addartists box_addartists_similar">
  566. <div class="head"><strong>Add similar</strong></div>
  567. <ul class="nobullet">
  568. <li>
  569. <form class="add_form" name="similar_artists" action="artist.php" method="post">
  570. <input type="hidden" name="action" value="add_similar" />
  571. <input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
  572. <input type="hidden" name="artistid" value="<?=$ArtistID?>" />
  573. <input type="text" autocomplete="off" id="artistsimilar" name="artistname" size="20"<? Users::has_autocomplete_enabled('other'); ?> />
  574. <input type="submit" value="+" />
  575. </form>
  576. </li>
  577. </ul>
  578. </div>
  579. </div>
  580. <div class="main_column">
  581. <div id="artist_information" class="box">
  582. <div id="info" class="head">
  583. <a href="#">&uarr;</a>&nbsp;
  584. <strong>Information</strong>
  585. <a class="brackets" data-toggle-target="#body">Toggle</a>
  586. </div>
  587. <div id="body" class="body"><?=Text::full_format($Body)?></div>
  588. </div>
  589. <?
  590. echo $TorrentDisplayList;
  591. $Collages = $Cache->get_value("artists_collages_$ArtistID");
  592. if (!is_array($Collages)) {
  593. $DB->query("
  594. SELECT c.Name, c.NumTorrents, c.ID
  595. FROM collages AS c
  596. JOIN collages_artists AS ca ON ca.CollageID = c.ID
  597. WHERE ca.ArtistID = '$ArtistID'
  598. AND Deleted = '0'
  599. AND CategoryID = '7'");
  600. $Collages = $DB->to_array();
  601. $Cache->cache_value("artists_collages_$ArtistID", $Collages, 3600 * 6);
  602. }
  603. if (count($Collages) > 0) {
  604. if (count($Collages) > MAX_COLLAGES) {
  605. // Pick some at random
  606. $Range = range(0,count($Collages) - 1);
  607. shuffle($Range);
  608. $Indices = array_slice($Range, 0, MAX_COLLAGES);
  609. $SeeAll = ' <a data-toggle-target=".collage_rows">(See all)</a>';
  610. } else {
  611. $Indices = range(0, count($Collages)-1);
  612. $SeeAll = '';
  613. }
  614. ?>
  615. <table class="collage_table" id="collages">
  616. <tr class="colhead">
  617. <td width="85%"><a href="#">&uarr;</a>&nbsp;This artist is in <?=number_format(count($Collages))?> collage<?=((count($Collages) > 1) ? 's' : '')?><?=$SeeAll?></td>
  618. <td># artists</td>
  619. </tr>
  620. <?
  621. foreach ($Indices as $i) {
  622. list($CollageName, $CollageArtists, $CollageID) = $Collages[$i];
  623. unset($Collages[$i]);
  624. ?>
  625. <tr>
  626. <td><a href="collages.php?id=<?=$CollageID?>"><?=$CollageName?></a></td>
  627. <td><?=number_format($CollageArtists)?></td>
  628. </tr>
  629. <?
  630. }
  631. foreach ($Collages as $Collage) {
  632. list($CollageName, $CollageArtists, $CollageID) = $Collage;
  633. ?>
  634. <tr class="collage_rows hidden">
  635. <td><a href="collages.php?id=<?=$CollageID?>"><?=$CollageName?></a></td>
  636. <td><?=number_format($CollageArtists)?></td>
  637. </tr>
  638. <? } ?>
  639. </table>
  640. <?
  641. }
  642. if ($NumRequests > 0) {
  643. ?>
  644. <table cellpadding="6" cellspacing="1" border="0" class="request_table border" width="100%" id="requests">
  645. <tr class="colhead_dark">
  646. <td style="width: 48%;">
  647. <a href="#">&uarr;</a>&nbsp;
  648. <strong>Request Name</strong>
  649. </td>
  650. <td class="nobr">
  651. <strong>Vote</strong>
  652. </td>
  653. <td class="nobr">
  654. <strong>Bounty</strong>
  655. </td>
  656. <td>
  657. <strong>Added</strong>
  658. </td>
  659. </tr>
  660. <?
  661. $Tags = Requests::get_tags(array_keys($Requests));
  662. foreach ($Requests as $RequestID => $Request) {
  663. $CategoryName = $Categories[$Request['CategoryID'] - 1];
  664. $Title = empty($Request['Title']) ? (empty($Request['TitleRJ']) ? display_str($Request['TitleJP']) : display_str($Request['TitleRJ'])) : display_str($Request['Title']);
  665. if ($CategoryName != 'Other') {
  666. $ArtistForm = Requests::get_artists($RequestID);
  667. $ArtistLink = Artists::display_artists($ArtistForm, true, true);
  668. $FullName = $ArtistLink."<a href=\"requests.php?action=view&amp;id=$RequestID\"><span dir=\"ltr\">$Title</span></a>";
  669. if ($Request['CatalogueNumber']) {
  670. $FullName .= " [$Request[CatalogueNumber]]";
  671. }
  672. if ($Request['DLSiteID']) {
  673. $FullName.= " [$Request[DLSiteID]]";
  674. }
  675. } else {
  676. $FullName = "<a href=\"requests.php?action=view&amp;id=$RequestID\" dir=\"ltr\">$Title</a>";
  677. }
  678. if (!empty($Tags[$RequestID])) {
  679. $ReqTagList = [];
  680. foreach ($Tags[$RequestID] as $TagID => $TagName) {
  681. $ReqTagList[] = "<a href=\"requests.php?tags=$TagName\">".display_str($TagName).'</a>';
  682. }
  683. $ReqTagList = implode(', ', $ReqTagList);
  684. } else {
  685. $ReqTagList = '';
  686. }
  687. ?>
  688. <tr class="row">
  689. <td>
  690. <?=$FullName?>
  691. <div class="tags"><?=$ReqTagList?></div>
  692. </td>
  693. <td class="nobr">
  694. <span id="vote_count_<?=$RequestID?>"><?=$Request['Votes']?></span>
  695. <? if (check_perms('site_vote')) { ?>
  696. <input type="hidden" id="auth" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
  697. &nbsp;&nbsp; <a href="javascript:Vote(0, <?=$RequestID?>)" class="brackets"><strong>+</strong></a>
  698. <? } ?>
  699. </td>
  700. <td class="nobr">
  701. <span id="bounty_<?=$RequestID?>"><?=Format::get_size($Request['Bounty'])?></span>
  702. </td>
  703. <td>
  704. <?=time_diff($Request['TimeAdded'])?>
  705. </td>
  706. </tr>
  707. <? } ?>
  708. </table>
  709. <?
  710. }
  711. // Similar Artist Map
  712. if ($NumSimilar > 0) {
  713. if ($SimilarData = $Cache->get_value("similar_positions_$ArtistID")) {
  714. $Similar = new ARTISTS_SIMILAR($ArtistID, $Name);
  715. $Similar->load_data($SimilarData);
  716. if (!(current($Similar->Artists)->NameLength)) {
  717. unset($Similar);
  718. }
  719. }
  720. if (empty($Similar) || empty($Similar->Artists)) {
  721. include(SERVER_ROOT.'/classes/image.class.php');
  722. $Img = new IMAGE;
  723. $Img->create(WIDTH, HEIGHT);
  724. $Img->color(255, 255, 255, 127);
  725. $Similar = new ARTISTS_SIMILAR($ArtistID, $Name);
  726. $Similar->set_up();
  727. $Similar->set_positions();
  728. $Similar->background_image();
  729. $SimilarData = $Similar->dump_data();
  730. $Cache->cache_value("similar_positions_$ArtistID", $SimilarData, 3600 * 24);
  731. }
  732. ?>
  733. <div id="similar_artist_map" class="box">
  734. <div id="flipper_head" class="head">
  735. <a href="#">&uarr;</a>&nbsp;
  736. <strong id="flipper_title">Similar Map</strong>
  737. <a id="flip_to" class="brackets" href="#" onclick="flipView(); return false;">Switch to cloud</a>
  738. </div>
  739. <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())?>);">
  740. <?
  741. $Similar->write_artists();
  742. ?>
  743. </div>
  744. <div id="flip_view_2" style="display: none; width: <?=WIDTH?>px; height: <?=HEIGHT?>px;">
  745. <canvas width="<?=WIDTH?>px" height="<?=(HEIGHT - 20)?>px" id="similarArtistsCanvas"></canvas>
  746. <div id="artistTags" style="display: none;">
  747. <ul><li></li></ul>
  748. </div>
  749. <strong style="margin-left: 10px;"><a id="currentArtist" href="#null">Loading...</a></strong>
  750. </div>
  751. </div>
  752. <script type="text/javascript">//<![CDATA[
  753. var cloudLoaded = false;
  754. function flipView() {
  755. var state = document.getElementById('flip_view_1').style.display == 'block';
  756. if (state) {
  757. document.getElementById('flip_view_1').style.display = 'none';
  758. document.getElementById('flip_view_2').style.display = 'block';
  759. document.getElementById('flipper_title').innerHTML = 'Similar Cloud';
  760. document.getElementById('flip_to').innerHTML = 'Switch to map';
  761. if (!cloudLoaded) {
  762. require("static/functions/tagcanvas.js", function () {
  763. require("static/functions/artist_cloud.js", function () {
  764. });
  765. });
  766. cloudLoaded = true;
  767. }
  768. }
  769. else {
  770. document.getElementById('flip_view_1').style.display = 'block';
  771. document.getElementById('flip_view_2').style.display = 'none';
  772. document.getElementById('flipper_title').innerHTML = 'Similar Map';
  773. document.getElementById('flip_to').innerHTML = 'Switch to cloud';
  774. }
  775. }
  776. //TODO move this to global, perhaps it will be used elsewhere in the future
  777. //http://stackoverflow.com/questions/7293344/load-javascript-dynamically
  778. function require(file, callback) {
  779. var script = document.getElementsByTagName('script')[0],
  780. newjs = document.createElement('script');
  781. // IE
  782. newjs.onreadystatechange = function () {
  783. if (newjs.readyState === 'loaded' || newjs.readyState === 'complete') {
  784. newjs.onreadystatechange = null;
  785. callback();
  786. }
  787. };
  788. // others
  789. newjs.onload = function () {
  790. callback();
  791. };
  792. newjs.src = file;
  793. script.parentNode.insertBefore(newjs, script);
  794. }
  795. //]]>
  796. </script>
  797. <? }
  798. // --- Comments ---
  799. $Pages = Format::get_pages($Page, $NumComments, TORRENT_COMMENTS_PER_PAGE, 9, '#comments');
  800. ?>
  801. <div id="artistcomments">
  802. <div class="linkbox"><a name="comments"></a>
  803. <?=($Pages)?>
  804. </div>
  805. <?
  806. //---------- Begin printing
  807. CommentsView::render_comments($Thread, $LastRead, "artist.php?id=$ArtistID");
  808. ?>
  809. <div class="linkbox">
  810. <?=($Pages)?>
  811. </div>
  812. <?
  813. View::parse('generic/reply/quickreply.php', array(
  814. 'InputName' => 'pageid',
  815. 'InputID' => $ArtistID,
  816. 'Action' => 'comments.php?page=artist',
  817. 'InputAction' => 'take_post',
  818. 'SubscribeBox' => true
  819. ));
  820. ?>
  821. </div>
  822. </div>
  823. </div>
  824. <?
  825. View::show_footer();
  826. // Cache page for later use
  827. if ($RevisionID) {
  828. $Key = "artist_$ArtistID" . "_revision_$RevisionID";
  829. } else {
  830. $Key = "artist_$ArtistID";
  831. }
  832. $Data = array(array($Name, $Image, $Body, $NumSimilar, $SimilarArray, [], [], $VanityHouseArtist));
  833. $Cache->cache_value($Key, $Data, 3600);
  834. ?>