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 27KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747
  1. <?
  2. //~~~~~~~~~~~ Main artist page ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
  3. //For sorting tags
  4. function compare($X, $Y) {
  5. return($Y['count'] - $X['count']);
  6. }
  7. $ArtistID = $_GET['id'];
  8. if (!is_number($ArtistID)) {
  9. error(0);
  10. }
  11. if (!empty($_GET['revisionid'])) { // if they're viewing an old revision
  12. $RevisionID = $_GET['revisionid'];
  13. if (!is_number($RevisionID)) {
  14. error(0);
  15. }
  16. $Data = $Cache->get_value("artist_{$ArtistID}_revision_$RevisionID", true);
  17. } else { // viewing the live version
  18. $Data = $Cache->get_value("artist_$ArtistID", true);
  19. $RevisionID = false;
  20. }
  21. if ($Data) {
  22. list($K, list($Name, $Image, $Body)) = each($Data);
  23. } else {
  24. if ($RevisionID) {
  25. $sql = "
  26. SELECT
  27. a.Name,
  28. wiki.Image,
  29. wiki.body
  30. FROM wiki_artists AS wiki
  31. LEFT JOIN artists_group AS a ON wiki.RevisionID = a.RevisionID
  32. WHERE wiki.RevisionID = '$RevisionID' ";
  33. } else {
  34. $sql = "
  35. SELECT
  36. a.Name,
  37. wiki.Image,
  38. wiki.body
  39. FROM artists_group AS a
  40. LEFT JOIN wiki_artists AS wiki ON wiki.RevisionID = a.RevisionID
  41. WHERE a.ArtistID = '$ArtistID' ";
  42. }
  43. $sql .= "
  44. GROUP BY a.ArtistID";
  45. $DB->query($sql);
  46. if (!$DB->has_results()) {
  47. error(404);
  48. }
  49. list($Name, $Image, $Body) = $DB->next_record(MYSQLI_NUM, array(0));
  50. }
  51. //----------------- Build list and get stats
  52. ob_start();
  53. // Requests
  54. $Requests = [];
  55. if (empty($LoggedUser['DisableRequests'])) {
  56. $Requests = $Cache->get_value("artists_requests_$ArtistID");
  57. if (!is_array($Requests)) {
  58. $DB->query("
  59. SELECT
  60. r.ID,
  61. r.CategoryID,
  62. r.Title,
  63. r.TitleRJ,
  64. r.TitleJP,
  65. r.CatalogueNumber,
  66. r.DLSiteID,
  67. r.TimeAdded,
  68. COUNT(rv.UserID) AS Votes,
  69. SUM(rv.Bounty) AS Bounty
  70. FROM requests AS r
  71. LEFT JOIN requests_votes AS rv ON rv.RequestID = r.ID
  72. LEFT JOIN requests_artists AS ra ON r.ID = ra.RequestID
  73. WHERE ra.ArtistID = $ArtistID
  74. AND r.TorrentID = 0
  75. GROUP BY r.ID
  76. ORDER BY Votes DESC");
  77. if ($DB->has_results()) {
  78. $Requests = $DB->to_array('ID', MYSQLI_ASSOC, false);
  79. } else {
  80. $Requests = [];
  81. }
  82. $Cache->cache_value("artists_requests_$ArtistID", $Requests);
  83. }
  84. }
  85. $NumRequests = count($Requests);
  86. if (($GroupIDs = $Cache->get_value("artist_groups_$ArtistID")) === false) {
  87. $DB->query("
  88. SELECT
  89. DISTINCTROW ta.GroupID
  90. FROM torrents_artists AS ta
  91. WHERE ta.ArtistID = '$ArtistID'");
  92. $GroupIDs = $DB->collect('GroupID');
  93. $Cache->cache_value("artist_groups_$ArtistID", $GroupIDs, 0);
  94. }
  95. if (count($GroupIDs) > 0) {
  96. $TorrentList = Torrents::get_groups($GroupIDs, true, true);
  97. } else {
  98. $TorrentList = [];
  99. }
  100. $NumGroups = count($TorrentList);
  101. if (!empty($TorrentList)) {
  102. ?>
  103. <div id="discog_table" class="box">
  104. <?
  105. }
  106. // Deal with torrents without release types, which can end up here
  107. // if they're uploaded with a non-grouping category ID
  108. $UnknownRT = array_search('Unknown', $ReleaseTypes);
  109. if ($UnknownRT === false) {
  110. $UnknownRT = 1025;
  111. $ReleaseTypes[$UnknownRT] = 'Unknown';
  112. }
  113. //Custom sorting for releases
  114. if (!empty($LoggedUser['SortHide'])) {
  115. $SortOrder = array_flip(array_keys($LoggedUser['SortHide']));
  116. } else {
  117. $SortOrder = $ReleaseTypes;
  118. }
  119. // If the $SortOrder array doesn't have all release types, put the missing ones at the end
  120. $MissingTypes = array_diff_key($ReleaseTypes, $SortOrder);
  121. if (!empty($MissingTypes)) {
  122. $MaxOrder = max($SortOrder);
  123. foreach (array_keys($MissingTypes) as $Missing) {
  124. $SortOrder[$Missing] = ++$MaxOrder;
  125. }
  126. }
  127. // Sort the anchors at the top of the page the same way as release types
  128. reset($TorrentList);
  129. $NumTorrents = 0;
  130. $NumSeeders = 0;
  131. $NumLeechers = 0;
  132. $NumSnatches = 0;
  133. foreach ($TorrentList as $GroupID => $Group) {
  134. // $Tags array is for the sidebar on the right.
  135. $TorrentTags = new Tags($Group['TagList'], true);
  136. foreach ($Group['Torrents'] as $TorrentID => $Torrent) {
  137. $NumTorrents++;
  138. $Torrent['Seeders'] = (int)$Torrent['Seeders'];
  139. $Torrent['Leechers'] = (int)$Torrent['Leechers'];
  140. $Torrent['Snatched'] = (int)$Torrent['Snatched'];
  141. $NumSeeders += $Torrent['Seeders'];
  142. $NumLeechers += $Torrent['Leechers'];
  143. $NumSnatches += $Torrent['Snatched'];
  144. }
  145. }
  146. $OpenTable = false;
  147. $ShowGroups = !isset($LoggedUser['TorrentGrouping']) || $LoggedUser['TorrentGrouping'] == 0;
  148. $HideTorrents = ($ShowGroups ? '' : ' hidden');
  149. $OldGroupID = 0;
  150. ?>
  151. <table class="torrent_table grouped release_table">
  152. <tr class="colhead_dark">
  153. <td class="small"><!-- expand/collapse --></td>
  154. <td width="70%"><a href="#">&uarr;</a>&nbsp;<strong>Name</strong></td>
  155. <td>Size</td>
  156. <td class="sign snatches">
  157. <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>
  158. </td>
  159. <td class="sign seeders">
  160. <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>
  161. </td>
  162. <td class="sign leechers">
  163. <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>
  164. </td>
  165. </tr>
  166. <?
  167. foreach ($TorrentList as $Group) {
  168. extract(Torrents::array_group($TorrentList[$Group['ID']]), EXTR_OVERWRITE);
  169. if ($GroupID == $OldGroupID) {
  170. continue;
  171. } else {
  172. $OldGroupID = $GroupID;
  173. }
  174. if (count($Torrents) > 1) {
  175. $TorrentTags = new Tags($TagList, false);
  176. $DisplayName = Artists::display_artists(Artists::get_artist($GroupID), true, true);
  177. $DisplayName .= "<a href=\"torrents.php?id=$GroupID\" class=\"tooltip\" title=\"View torrent group\" ";
  178. if (!isset($LoggedUser['CoverArt']) || $LoggedUser['CoverArt']) {
  179. $DisplayName .= 'onmouseover="getCover(event)" data-cover="'.ImageTools::process($WikiImage, true).'" onmouseleave="ungetCover()" ';
  180. }
  181. $GroupName = empty($GroupName) ? (empty($GroupNameRJ) ? $GroupNameJP : $GroupNameRJ) : $GroupName;
  182. $DisplayName .= "dir=\"ltr\">$GroupName</a>";
  183. if ($GroupYear) {
  184. $DisplayName .= " [$GroupYear]";
  185. }
  186. if ($GroupStudio) {
  187. $DisplayName .= " [$GroupStudio]";
  188. }
  189. if ($GroupCatalogueNumber) {
  190. $DisplayName .= " [$GroupCatalogueNumber]";
  191. }
  192. if ($GroupPages) {
  193. $DisplayName .= " [{$GroupPages}p]";
  194. }
  195. if ($GroupDLSiteID) {
  196. $DisplayName .= " [$GroupDLSiteID]";
  197. }
  198. if (check_perms('users_mod') || check_perms('torrents_fix_ghosts')) {
  199. $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>';
  200. }
  201. $SnatchedGroupClass = ($GroupFlags['IsSnatched'] ? ' snatched_group' : '');
  202. ?>
  203. <tr class="group<?=$SnatchedGroupClass?>">
  204. <?
  205. $ShowGroups = !(!empty($LoggedUser['TorrentGrouping']) && $LoggedUser['TorrentGrouping'] == 1);
  206. ?>
  207. <td class="center">
  208. <div id="showimg_<?=$GroupID?>" class="<?=($ShowGroups ? 'hide' : 'show')?>_torrents">
  209. <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>
  210. </div>
  211. </td>
  212. <td colspan="5" class="big_info">
  213. <div class="group_info clear">
  214. <strong><?=$DisplayName?></strong>
  215. <? if (Bookmarks::has_bookmarked('torrent', $GroupID)) { ?>
  216. <span class="remove_bookmark float_right">
  217. <a style="float: right;" href="#" id="bookmarklink_torrent_<?=$GroupID?>" class="brackets" onclick="Unbookmark('torrent', <?=$GroupID?>, 'Bookmark'); return false;">Remove bookmark</a>
  218. </span>
  219. <? } else { ?>
  220. <span class="add_bookmark float_right">
  221. <a style="float: right;" href="#" id="bookmarklink_torrent_<?=$GroupID?>" class="brackets" onclick="Bookmark('torrent', <?=$GroupID?>, 'Remove bookmark'); return false;">Bookmark</a>
  222. </span>
  223. <? } ?>
  224. <div class="tags"><?=$TorrentTags->format('torrents.php?taglist=', $Name)?></div>
  225. </div>
  226. </td>
  227. <?
  228. foreach($Torrents as $TorrentID => $Torrent) {
  229. $Reported = false;
  230. $Reports = Torrents::get_reports($TorrentID);
  231. if (count($Reports) > 0) {
  232. $Reported = true;
  233. }
  234. $SnatchedTorrentClass = $Torrent['IsSnatched'] ? ' snatched_torrent' : '';
  235. $TorrentDL = "torrents.php?action=download&amp;id=".$TorrentID."&amp;authkey=".$LoggedUser['AuthKey']."&amp;torrent_pass=".$LoggedUser['torrent_pass'];
  236. if (!empty(G::$LoggedUser) && (G::$LoggedUser['ShowMagnets'] ?? false)) {
  237. $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'];
  238. }
  239. ?>
  240. <tr class="torrent_row groupid_<?=$GroupID?> group_torrent discog<?=$SnatchedTorrentClass . $SnatchedGroupClass . $HideTorrents?>">
  241. <td colspan="2">
  242. <span>
  243. [ <a href="<?=$TorrentDL?>" class="tooltip" title="Download">DL</a>
  244. <? if (isset($TorrentMG)) { ?>
  245. | <a href="<?=$TorrentMG?>" class="tooltip" title="Magnet Link">MG</a>
  246. <? }
  247. if (Torrents::can_use_token($Torrent)) { ?>
  248. | <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>
  249. <? } ?>
  250. | <a href="reportsv2.php?action=report&amp;id=<?=$TorrentID?>" class="tooltip" title="Report">RP</a> ]
  251. </span>
  252. &nbsp;&nbsp;&raquo;&nbsp; <a href="torrents.php?id=<?=$GroupID?>&amp;torrentid=<?=$TorrentID?>"><?=Torrents::torrent_info($Torrent)?></a>
  253. </td>
  254. <td class="number_column nobr"><?=Format::get_size($Torrent['Size'])?></td>
  255. <td class="number_column"><?=number_format($Torrent['Snatched'])?></td>
  256. <td class="number_column<?=(($Torrent['Seeders'] == 0) ? ' r00' : '')?>"><?=number_format($Torrent['Seeders'])?></td>
  257. <td class="number_column"><?=number_format($Torrent['Leechers'])?></td>
  258. </tr>
  259. <?
  260. }
  261. } else {
  262. list($TorrentID, $Torrent) = each($Torrents);
  263. if (!$TorrentID) { continue; }
  264. $TorrentTags = new Tags($TagList, false);
  265. $DisplayName = Artists::display_artists(Artists::get_artist($GroupID), true, true);
  266. $Reported = false;
  267. $Reports = Torrents::get_reports($TorrentID);
  268. if (count($Reports) > 0) {
  269. $Reported = true;
  270. }
  271. $DisplayName .= "<a class=\"torrent_name\" href=\"torrents.php?id=$GroupID&amp;torrentid=$TorrentID#torrent$TorrentID\" ";
  272. if (!isset($LoggedUser['CoverArt']) || $LoggedUser['CoverArt']) {
  273. $DisplayName .= "onmouseover=\"getCover(event)\" data-cover=\"".ImageTools::process($WikiImage, true)."\" onmouseleave=\"ungetCover(event)\" ";
  274. }
  275. $GroupName = empty($GroupName) ? (empty($GroupNameRJ) ? $GroupNameJP : $GroupNameRJ) : $GroupName;
  276. $DisplayName .= "dir=\"ltr\">$GroupName</a>";
  277. if ($GroupYear) {
  278. $DisplayName .= " [$GroupYear]";
  279. }
  280. if ($GroupStudio) {
  281. $DisplayName .= " [$GroupStudio]";
  282. }
  283. if ($GroupCatalogueNumber) {
  284. $DisplayName .= " [$GroupCatalogueNumber]";
  285. }
  286. if ($GroupPages) {
  287. $DisplayName .= " [{$GroupPages}p]";
  288. }
  289. if ($GroupDLSiteID) {
  290. $DisplayName .= " [$GroupDLSiteID]";
  291. }
  292. if (check_perms('users_mod') || check_perms('torrents_fix_ghosts')) {
  293. $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>';
  294. }
  295. $ExtraInfo = Torrents::torrent_info($Torrent, true, true);
  296. $SnatchedGroupClass = ($GroupFlags['IsSnatched'] ? ' snatched_group' : '');
  297. $SnatchedTorrentClass = $Torrent['IsSnatched'] ? ' snatched_torrent' : '';
  298. $TorrentDL = "torrents.php?action=download&amp;id=".$TorrentID."&amp;authkey=".$LoggedUser['AuthKey']."&amp;torrent_pass=".$LoggedUser['torrent_pass'];
  299. if (!empty(G::$LoggedUser) && (G::$LoggedUser['ShowMagnets'] ?? false)) {
  300. $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'];
  301. }
  302. ?>
  303. <tr class="torrent<?=$SnatchedTorrentClass . $SnatchedGroupClass?>">
  304. <td class="center">
  305. </td>
  306. <td class="big_info">
  307. <div class="group_info clear">
  308. <div class="float_right">
  309. <span>
  310. [ <a href="<?=$TorrentDL?>" class="tooltip" title="Download">DL</a>
  311. <? if (isset($TorrentMG)) { ?>
  312. | <a href="<?=$TorrentMG?>" class="tooltip" title="Magnet Link">MG</a>
  313. <? }
  314. if (Torrents::can_use_token($Torrent)) { ?>
  315. | <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>
  316. <? } ?>
  317. | <a href="reportsv2.php?action=report&amp;id=<?=$TorrentID?>" class="tooltip" title="Report">RP</a> ]
  318. </span>
  319. <br />
  320. <? if (Bookmarks::has_bookmarked('torrent', $GroupID)) { ?>
  321. <span class="remove_bookmark float_right">
  322. <a href="#" id="bookmarklink_torrent_<?=$GroupID?>" class="brackets" onclick="Unbookmark('torrent', <?=$GroupID?>, 'Bookmark'); return false;">Remove bookmark</a>
  323. </span>
  324. <? } else { ?>
  325. <span class="add_bookmark float_right">
  326. <a href="#" id="bookmarklink_torrent_<?=$GroupID?>" class="brackets" onclick="Bookmark('torrent', <?=$GroupID?>, 'Remove bookmark'); return false;">Bookmark</a>
  327. </span>
  328. <? } ?>
  329. </div>
  330. <?=$DisplayName?>
  331. <br />
  332. <div style="display: inline;" class="torrent_info"><?=$ExtraInfo?><? if ($Reported) { ?> / <strong class="torrent_label tl_reported">Reported</strong><? } ?></div>
  333. <div class="tags"><?=$TorrentTags->format('torrents.php?taglist=', $Name)?></div>
  334. </div>
  335. </td>
  336. <td class="number_column nobr"><?=Format::get_size($Torrent['Size'])?></td>
  337. <td class="number_column"><?=number_format($Torrent['Snatched'])?></td>
  338. <td class="number_column<?=(($Torrent['Seeders'] == 0) ? ' r00' : '')?>"><?=number_format($Torrent['Seeders'])?></td>
  339. <td class="number_column"><?=number_format($Torrent['Leechers'])?></td>
  340. </tr>
  341. <?
  342. }
  343. }
  344. ?>
  345. </table>
  346. </div>
  347. <?
  348. $TorrentDisplayList = ob_get_clean();
  349. //----------------- End building list and getting stats
  350. // Comments (must be loaded before View::show_header so that subscriptions and quote notifications are handled properly)
  351. list($NumComments, $Page, $Thread, $LastRead) = Comments::load('artist', $ArtistID);
  352. View::show_header($Name, 'browse,requests,bbcode,comments,recommend,subscriptions');
  353. ?>
  354. <div class="thin">
  355. <div class="header">
  356. <h2><?=display_str($Name)?><? if ($RevisionID) { ?> (Revision #<?=$RevisionID?>)<? } ?></h2>
  357. <div class="linkbox">
  358. <? if (check_perms('site_submit_requests')) { ?>
  359. <a href="requests.php?action=new&amp;artistid=<?=$ArtistID?>" class="brackets">Add request</a>
  360. <?
  361. }
  362. if (check_perms('site_torrents_notify')) {
  363. if (($Notify = $Cache->get_value('notify_artists_'.$LoggedUser['ID'])) === false) {
  364. $DB->query("
  365. SELECT ID, Artists
  366. FROM users_notify_filters
  367. WHERE UserID = '$LoggedUser[ID]'
  368. AND Label = 'Artist notifications'
  369. LIMIT 1");
  370. $Notify = $DB->next_record(MYSQLI_ASSOC, false);
  371. $Cache->cache_value('notify_artists_'.$LoggedUser['ID'], $Notify, 0);
  372. }
  373. if (stripos($Notify['Artists'], "|$Name|") === false) {
  374. ?>
  375. <a href="artist.php?action=notify&amp;artistid=<?=$ArtistID?>&amp;auth=<?=$LoggedUser['AuthKey']?>" class="brackets">Notify of new uploads</a>
  376. <? } else { ?>
  377. <a href="artist.php?action=notifyremove&amp;artistid=<?=$ArtistID?>&amp;auth=<?=$LoggedUser['AuthKey']?>" class="brackets">Do not notify of new uploads</a>
  378. <?
  379. }
  380. }
  381. if (Bookmarks::has_bookmarked('artist', $ArtistID)) {
  382. ?>
  383. <a href="#" id="bookmarklink_artist_<?=$ArtistID?>" onclick="Unbookmark('artist', <?=$ArtistID?>, 'Bookmark'); return false;" class="brackets">Remove bookmark</a>
  384. <? } else { ?>
  385. <a href="#" id="bookmarklink_artist_<?=$ArtistID?>" onclick="Bookmark('artist', <?=$ArtistID?>, 'Remove bookmark'); return false;" class="brackets">Bookmark</a>
  386. <? } ?>
  387. <a href="#" id="subscribelink_artist<?=$ArtistID?>" class="brackets" onclick="SubscribeComments('artist', <?=$ArtistID?>);return false;"><?=Subscriptions::has_subscribed_comments('artist', $ArtistID) !== false ? 'Unsubscribe' : 'Subscribe'?></a>
  388. <!-- <a href="#" id="recommend" class="brackets">Recommend</a> -->
  389. <?
  390. if (check_perms('site_edit_wiki')) {
  391. ?>
  392. <a href="artist.php?action=edit&amp;artistid=<?=$ArtistID?>" class="brackets">Edit</a>
  393. <? } ?>
  394. <a href="artist.php?action=history&amp;artistid=<?=$ArtistID?>" class="brackets">View history</a>
  395. <? if ($RevisionID && check_perms('site_edit_wiki')) { ?>
  396. <a href="artist.php?action=revert&amp;artistid=<?=$ArtistID?>&amp;revisionid=<?=$RevisionID?>&amp;auth=<?=$LoggedUser['AuthKey']?>" class="brackets">Revert to this revision</a>
  397. <? } ?>
  398. <a href="artist.php?id=<?=$ArtistID?>#info" class="brackets">Info</a>
  399. <a href="artist.php?id=<?=$ArtistID?>#artistcomments" class="brackets">Comments</a>
  400. <? if (check_perms('site_delete_artist') && check_perms('torrents_delete')) { ?>
  401. <a href="artist.php?action=delete&amp;artistid=<?=$ArtistID?>&amp;auth=<?=$LoggedUser['AuthKey']?>" class="brackets">Delete</a>
  402. <? } ?>
  403. </div>
  404. </div>
  405. <? /* Misc::display_recommend($ArtistID, "artist"); */ ?>
  406. <div class="sidebar">
  407. <? if ($Image) { ?>
  408. <div class="box box_image">
  409. <div class="head"><strong><?=$Name?></strong></div>
  410. <div style="text-align: center; padding: 10px 0px;">
  411. <img style="max-width: 220px;" class="lightbox-init" src="<?=ImageTools::process($Image, true)?>" alt="<?=$Name?>" />
  412. </div>
  413. </div>
  414. <? } ?>
  415. <div class="box box_search">
  416. <div class="head"><strong>File Lists Search</strong></div>
  417. <ul class="nobullet">
  418. <li>
  419. <form class="search_form" name="filelists" action="torrents.php">
  420. <input type="hidden" name="artistname" value="<?=$Name?>" />
  421. <input type="hidden" name="action" value="advanced" />
  422. <input type="text" autocomplete="off" id="filelist" name="filelist" size="20" />
  423. <input type="submit" value="&gt;" />
  424. </form>
  425. </li>
  426. </ul>
  427. </div>
  428. <?
  429. /* if (check_perms('zip_downloader')) {
  430. if (isset($LoggedUser['Collector'])) {
  431. list($ZIPList, $ZIPPrefs) = $LoggedUser['Collector'];
  432. $ZIPList = explode(':', $ZIPList);
  433. } else {
  434. $ZIPList = array('00', '11');
  435. $ZIPPrefs = 1;
  436. }
  437. ?>
  438. <div class="box box_zipdownload">
  439. <div class="head colhead_dark"><strong>Collector</strong></div>
  440. <div class="pad">
  441. <form class="download_form" name="zip" action="artist.php" method="post">
  442. <input type="hidden" name="action" value="download" />
  443. <input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
  444. <input type="hidden" name="artistid" value="<?=$ArtistID?>" />
  445. <ul id="list" class="nobullet">
  446. <? foreach ($ZIPList as $ListItem) { ?>
  447. <li id="list<?=$ListItem?>">
  448. <input type="hidden" name="list[]" value="<?=$ListItem?>" />
  449. <span style="float: left;"><?=$ZIPOptions[$ListItem]['2']?></span>
  450. <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>
  451. <br style="clear: all;" />
  452. </li>
  453. <? } ?>
  454. </ul>
  455. <select id="formats" style="width: 180px;">
  456. <?
  457. $OpenGroup = false;
  458. $LastGroupID = -1;
  459. foreach ($ZIPOptions as $Option) {
  460. list($GroupID, $OptionID, $OptName) = $Option;
  461. if ($GroupID != $LastGroupID) {
  462. $LastGroupID = $GroupID;
  463. if ($OpenGroup) { ?>
  464. </optgroup>
  465. <? } ?>
  466. <optgroup label="<?=$ZIPGroups[$GroupID]?>">
  467. <? $OpenGroup = true;
  468. }
  469. ?>
  470. <option id="opt<?=$GroupID.$OptionID?>" value="<?=$GroupID.$OptionID?>"<? if (in_array($GroupID.$OptionID, $ZIPList)) { echo ' disabled="disabled"'; } ?>><?=$OptName?></option>
  471. <?
  472. }
  473. ?>
  474. </optgroup>
  475. </select>
  476. <button type="button" onclick="add_selection()">+</button>
  477. <select name="preference" style="width: 210px;">
  478. <option value="0"<? if ($ZIPPrefs == 0) { echo ' selected="selected"'; } ?>>Prefer Original</option>
  479. <option value="1"<? if ($ZIPPrefs == 1) { echo ' selected="selected"'; } ?>>Prefer Best Seeded</option>
  480. <option value="2"<? if ($ZIPPrefs == 2) { echo ' selected="selected"'; } ?>>Prefer Bonus Tracks</option>
  481. </select>
  482. <input type="submit" style="width: 210px;" value="Download" />
  483. </form>
  484. </div>
  485. </div>
  486. <?
  487. } //if (check_perms('zip_downloader'))*/ ?>
  488. <div class="box box_tags">
  489. <div class="head"><strong>Tags</strong></div>
  490. <ul class="stats nobullet">
  491. <? Tags::format_top(50, 'torrents.php?taglist=', $Name); ?>
  492. </ul>
  493. </div>
  494. <?
  495. // Stats
  496. ?>
  497. <div class="box box_info box_statistics_artist">
  498. <div class="head"><strong>Statistics</strong></div>
  499. <ul class="stats nobullet">
  500. <li>Number of groups: <?=number_format($NumGroups)?></li>
  501. <li>Number of torrents: <?=number_format($NumTorrents)?></li>
  502. <li>Number of seeders: <?=number_format($NumSeeders)?></li>
  503. <li>Number of leechers: <?=number_format($NumLeechers)?></li>
  504. <li>Number of snatches: <?=number_format($NumSnatches)?></li>
  505. </ul>
  506. </div>
  507. </div>
  508. <div class="main_column">
  509. <div id="artist_information" class="box">
  510. <div id="info" class="head">
  511. <a href="#">&uarr;</a>&nbsp;
  512. <strong>Information</strong>
  513. <a class="brackets" data-toggle-target="#body">Toggle</a>
  514. </div>
  515. <div id="body" class="body"><?=Text::full_format($Body)?></div>
  516. </div>
  517. <?
  518. echo $TorrentDisplayList;
  519. $Collages = $Cache->get_value("artists_collages_$ArtistID");
  520. if (!is_array($Collages)) {
  521. $DB->query("
  522. SELECT c.Name, c.NumTorrents, c.ID
  523. FROM collages AS c
  524. JOIN collages_artists AS ca ON ca.CollageID = c.ID
  525. WHERE ca.ArtistID = '$ArtistID'
  526. AND Deleted = '0'
  527. AND CategoryID = '7'");
  528. $Collages = $DB->to_array();
  529. $Cache->cache_value("artists_collages_$ArtistID", $Collages, 3600 * 6);
  530. }
  531. if (count($Collages) > 0) {
  532. if (count($Collages) > MAX_COLLAGES) {
  533. // Pick some at random
  534. $Range = range(0,count($Collages) - 1);
  535. shuffle($Range);
  536. $Indices = array_slice($Range, 0, MAX_COLLAGES);
  537. $SeeAll = ' <a data-toggle-target=".collage_rows">(See all)</a>';
  538. } else {
  539. $Indices = range(0, count($Collages)-1);
  540. $SeeAll = '';
  541. }
  542. ?>
  543. <table class="collage_table" id="collages">
  544. <tr class="colhead">
  545. <td width="85%"><a href="#">&uarr;</a>&nbsp;This artist is in <?=number_format(count($Collages))?> collage<?=((count($Collages) > 1) ? 's' : '')?><?=$SeeAll?></td>
  546. <td># artists</td>
  547. </tr>
  548. <?
  549. foreach ($Indices as $i) {
  550. list($CollageName, $CollageArtists, $CollageID) = $Collages[$i];
  551. unset($Collages[$i]);
  552. ?>
  553. <tr>
  554. <td><a href="collages.php?id=<?=$CollageID?>"><?=$CollageName?></a></td>
  555. <td><?=number_format($CollageArtists)?></td>
  556. </tr>
  557. <?
  558. }
  559. foreach ($Collages as $Collage) {
  560. list($CollageName, $CollageArtists, $CollageID) = $Collage;
  561. ?>
  562. <tr class="collage_rows hidden">
  563. <td><a href="collages.php?id=<?=$CollageID?>"><?=$CollageName?></a></td>
  564. <td><?=number_format($CollageArtists)?></td>
  565. </tr>
  566. <? } ?>
  567. </table>
  568. <?
  569. }
  570. if ($NumRequests > 0) {
  571. ?>
  572. <table cellpadding="6" cellspacing="1" border="0" class="request_table border" width="100%" id="requests">
  573. <tr class="colhead_dark">
  574. <td style="width: 48%;">
  575. <a href="#">&uarr;</a>&nbsp;
  576. <strong>Request Name</strong>
  577. </td>
  578. <td class="nobr">
  579. <strong>Vote</strong>
  580. </td>
  581. <td class="nobr">
  582. <strong>Bounty</strong>
  583. </td>
  584. <td>
  585. <strong>Added</strong>
  586. </td>
  587. </tr>
  588. <?
  589. $Tags = Requests::get_tags(array_keys($Requests));
  590. foreach ($Requests as $RequestID => $Request) {
  591. $CategoryName = $Categories[$Request['CategoryID'] - 1];
  592. $Title = empty($Request['Title']) ? (empty($Request['TitleRJ']) ? display_str($Request['TitleJP']) : display_str($Request['TitleRJ'])) : display_str($Request['Title']);
  593. if ($CategoryName != 'Other') {
  594. $ArtistForm = Requests::get_artists($RequestID);
  595. $ArtistLink = Artists::display_artists($ArtistForm, true, true);
  596. $FullName = $ArtistLink."<a href=\"requests.php?action=view&amp;id=$RequestID\"><span dir=\"ltr\">$Title</span></a>";
  597. if ($Request['CatalogueNumber']) {
  598. $FullName .= " [$Request[CatalogueNumber]]";
  599. }
  600. if ($Request['DLSiteID']) {
  601. $FullName.= " [$Request[DLSiteID]]";
  602. }
  603. } else {
  604. $FullName = "<a href=\"requests.php?action=view&amp;id=$RequestID\" dir=\"ltr\">$Title</a>";
  605. }
  606. if (!empty($Tags[$RequestID])) {
  607. $ReqTagList = [];
  608. foreach ($Tags[$RequestID] as $TagID => $TagName) {
  609. $ReqTagList[] = "<a href=\"requests.php?tags=$TagName\">".display_str($TagName).'</a>';
  610. }
  611. $ReqTagList = implode(', ', $ReqTagList);
  612. } else {
  613. $ReqTagList = '';
  614. }
  615. ?>
  616. <tr class="row">
  617. <td>
  618. <?=$FullName?>
  619. <div class="tags"><?=$ReqTagList?></div>
  620. </td>
  621. <td class="nobr">
  622. <span id="vote_count_<?=$RequestID?>"><?=$Request['Votes']?></span>
  623. <? if (check_perms('site_vote')) { ?>
  624. <input type="hidden" id="auth" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
  625. &nbsp;&nbsp; <a href="javascript:Vote(0, <?=$RequestID?>)" class="brackets"><strong>+</strong></a>
  626. <? } ?>
  627. </td>
  628. <td class="nobr">
  629. <span id="bounty_<?=$RequestID?>"><?=Format::get_size($Request['Bounty'])?></span>
  630. </td>
  631. <td>
  632. <?=time_diff($Request['TimeAdded'])?>
  633. </td>
  634. </tr>
  635. <? } ?>
  636. </table>
  637. <?
  638. }
  639. // --- Comments ---
  640. $Pages = Format::get_pages($Page, $NumComments, TORRENT_COMMENTS_PER_PAGE, 9, '#comments');
  641. ?>
  642. <div id="artistcomments">
  643. <div class="linkbox"><a name="comments"></a>
  644. <?=($Pages)?>
  645. </div>
  646. <?
  647. //---------- Begin printing
  648. CommentsView::render_comments($Thread, $LastRead, "artist.php?id=$ArtistID");
  649. ?>
  650. <div class="linkbox">
  651. <?=($Pages)?>
  652. </div>
  653. <?
  654. View::parse('generic/reply/quickreply.php', array(
  655. 'InputName' => 'pageid',
  656. 'InputID' => $ArtistID,
  657. 'Action' => 'comments.php?page=artist',
  658. 'InputAction' => 'take_post',
  659. 'SubscribeBox' => true
  660. ));
  661. ?>
  662. </div>
  663. </div>
  664. </div>
  665. <?
  666. View::show_footer();
  667. // Cache page for later use
  668. if ($RevisionID) {
  669. $Key = "artist_$ArtistID" . "_revision_$RevisionID";
  670. } else {
  671. $Key = "artist_$ArtistID";
  672. }
  673. $Data = array(array($Name, $Image, $Body));
  674. $Cache->cache_value($Key, $Data, 3600);
  675. ?>