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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744
  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($Name, $Image, $Body) = current($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 class="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 class="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. $TorrentID = key($Torrents);
  263. $Torrent = current($Torrents);
  264. if (!$TorrentID) { continue; }
  265. $TorrentTags = new Tags($TagList, false);
  266. $DisplayName = Artists::display_artists(Artists::get_artist($GroupID), true, true);
  267. $Reported = false;
  268. $Reports = Torrents::get_reports($TorrentID);
  269. if (count($Reports) > 0) {
  270. $Reported = true;
  271. }
  272. $DisplayName .= "<a class=\"torrent_name\" href=\"torrents.php?id=$GroupID&amp;torrentid=$TorrentID#torrent$TorrentID\" ";
  273. if (!isset($LoggedUser['CoverArt']) || $LoggedUser['CoverArt']) {
  274. $DisplayName .= "onmouseover=\"getCover(event)\" data-cover=\"".ImageTools::process($WikiImage, true)."\" onmouseleave=\"ungetCover(event)\" ";
  275. }
  276. $GroupName = empty($GroupName) ? (empty($GroupNameRJ) ? $GroupNameJP : $GroupNameRJ) : $GroupName;
  277. $DisplayName .= "dir=\"ltr\">$GroupName</a>";
  278. if ($GroupYear) {
  279. $DisplayName .= " [$GroupYear]";
  280. }
  281. if ($GroupStudio) {
  282. $DisplayName .= " [$GroupStudio]";
  283. }
  284. if ($GroupCatalogueNumber) {
  285. $DisplayName .= " [$GroupCatalogueNumber]";
  286. }
  287. if ($GroupPages) {
  288. $DisplayName .= " [{$GroupPages}p]";
  289. }
  290. if ($GroupDLSiteID) {
  291. $DisplayName .= " [$GroupDLSiteID]";
  292. }
  293. if (check_perms('users_mod') || check_perms('torrents_fix_ghosts')) {
  294. $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>';
  295. }
  296. $ExtraInfo = Torrents::torrent_info($Torrent, true, true);
  297. $SnatchedGroupClass = ($GroupFlags['IsSnatched'] ? ' snatched_group' : '');
  298. $SnatchedTorrentClass = $Torrent['IsSnatched'] ? ' snatched_torrent' : '';
  299. $TorrentDL = "torrents.php?action=download&amp;id=".$TorrentID."&amp;authkey=".$LoggedUser['AuthKey']."&amp;torrent_pass=".$LoggedUser['torrent_pass'];
  300. if (!empty(G::$LoggedUser) && (G::$LoggedUser['ShowMagnets'] ?? false)) {
  301. $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'];
  302. }
  303. ?>
  304. <tr class="torrent<?=$SnatchedTorrentClass . $SnatchedGroupClass?>">
  305. <td class="center">
  306. </td>
  307. <td class="big_info">
  308. <div class="group_info clear">
  309. <div class="float_right">
  310. <span>
  311. [ <a href="<?=$TorrentDL?>" class="tooltip" title="Download">DL</a>
  312. <? if (isset($TorrentMG)) { ?>
  313. | <a href="<?=$TorrentMG?>" class="tooltip" title="Magnet Link">MG</a>
  314. <? }
  315. if (Torrents::can_use_token($Torrent)) { ?>
  316. | <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>
  317. <? } ?>
  318. | <a href="reportsv2.php?action=report&amp;id=<?=$TorrentID?>" class="tooltip" title="Report">RP</a> ]
  319. </span>
  320. <br />
  321. <? if (Bookmarks::has_bookmarked('torrent', $GroupID)) { ?>
  322. <span class="remove_bookmark float_right">
  323. <a href="#" id="bookmarklink_torrent_<?=$GroupID?>" class="brackets" onclick="Unbookmark('torrent', <?=$GroupID?>, 'Bookmark'); return false;">Remove bookmark</a>
  324. </span>
  325. <? } else { ?>
  326. <span class="add_bookmark float_right">
  327. <a href="#" id="bookmarklink_torrent_<?=$GroupID?>" class="brackets" onclick="Bookmark('torrent', <?=$GroupID?>, 'Remove bookmark'); return false;">Bookmark</a>
  328. </span>
  329. <? } ?>
  330. </div>
  331. <?=$DisplayName?>
  332. <br />
  333. <div style="display: inline;" class="torrent_info"><?=$ExtraInfo?><? if ($Reported) { ?> / <strong class="torrent_label tl_reported">Reported</strong><? } ?></div>
  334. <div class="tags"><?=$TorrentTags->format('torrents.php?taglist=', $Name)?></div>
  335. </div>
  336. </td>
  337. <td class="number_column nobr"><?=Format::get_size($Torrent['Size'])?></td>
  338. <td class="number_column"><?=number_format($Torrent['Snatched'])?></td>
  339. <td class="number_column<?=(($Torrent['Seeders'] == 0) ? ' r00' : '')?>"><?=number_format($Torrent['Seeders'])?></td>
  340. <td class="number_column"><?=number_format($Torrent['Leechers'])?></td>
  341. </tr>
  342. <?
  343. }
  344. }
  345. ?>
  346. </table>
  347. </div>
  348. <?
  349. $TorrentDisplayList = ob_get_clean();
  350. //----------------- End building list and getting stats
  351. // Comments (must be loaded before View::show_header so that subscriptions and quote notifications are handled properly)
  352. list($NumComments, $Page, $Thread, $LastRead) = Comments::load('artist', $ArtistID);
  353. View::show_header($Name, 'browse,requests,bbcode,comments,recommend,subscriptions');
  354. ?>
  355. <div class="thin">
  356. <div class="header">
  357. <h2><?=display_str($Name)?><? if ($RevisionID) { ?> (Revision #<?=$RevisionID?>)<? } ?></h2>
  358. <div class="linkbox">
  359. <? if (check_perms('site_submit_requests')) { ?>
  360. <a href="requests.php?action=new&amp;artistid=<?=$ArtistID?>" class="brackets">Add request</a>
  361. <?
  362. }
  363. if (check_perms('site_torrents_notify')) {
  364. if (($Notify = $Cache->get_value('notify_artists_'.$LoggedUser['ID'])) === false) {
  365. $DB->query("
  366. SELECT ID, Artists
  367. FROM users_notify_filters
  368. WHERE UserID = '$LoggedUser[ID]'
  369. AND Label = 'Artist notifications'
  370. LIMIT 1");
  371. $Notify = $DB->next_record(MYSQLI_ASSOC, false);
  372. $Cache->cache_value('notify_artists_'.$LoggedUser['ID'], $Notify, 0);
  373. }
  374. if (stripos($Notify['Artists'], "|$Name|") === false) {
  375. ?>
  376. <a href="artist.php?action=notify&amp;artistid=<?=$ArtistID?>&amp;auth=<?=$LoggedUser['AuthKey']?>" class="brackets">Notify of new uploads</a>
  377. <? } else { ?>
  378. <a href="artist.php?action=notifyremove&amp;artistid=<?=$ArtistID?>&amp;auth=<?=$LoggedUser['AuthKey']?>" class="brackets">Do not notify of new uploads</a>
  379. <?
  380. }
  381. }
  382. if (Bookmarks::has_bookmarked('artist', $ArtistID)) {
  383. ?>
  384. <a href="#" id="bookmarklink_artist_<?=$ArtistID?>" onclick="Unbookmark('artist', <?=$ArtistID?>, 'Bookmark'); return false;" class="brackets">Remove bookmark</a>
  385. <? } else { ?>
  386. <a href="#" id="bookmarklink_artist_<?=$ArtistID?>" onclick="Bookmark('artist', <?=$ArtistID?>, 'Remove bookmark'); return false;" class="brackets">Bookmark</a>
  387. <? } ?>
  388. <a href="#" id="subscribelink_artist<?=$ArtistID?>" class="brackets" onclick="SubscribeComments('artist', <?=$ArtistID?>);return false;"><?=Subscriptions::has_subscribed_comments('artist', $ArtistID) !== false ? 'Unsubscribe' : 'Subscribe'?></a>
  389. <!-- <a href="#" id="recommend" class="brackets">Recommend</a> -->
  390. <?
  391. if (check_perms('site_edit_wiki')) {
  392. ?>
  393. <a href="artist.php?action=edit&amp;artistid=<?=$ArtistID?>" class="brackets">Edit</a>
  394. <? } ?>
  395. <a href="artist.php?action=history&amp;artistid=<?=$ArtistID?>" class="brackets">View history</a>
  396. <? if ($RevisionID && check_perms('site_edit_wiki')) { ?>
  397. <a href="artist.php?action=revert&amp;artistid=<?=$ArtistID?>&amp;revisionid=<?=$RevisionID?>&amp;auth=<?=$LoggedUser['AuthKey']?>" class="brackets">Revert to this revision</a>
  398. <? } ?>
  399. <a href="artist.php?id=<?=$ArtistID?>#info" class="brackets">Info</a>
  400. <a href="artist.php?id=<?=$ArtistID?>#artistcomments" class="brackets">Comments</a>
  401. <? if (check_perms('site_delete_artist') && check_perms('torrents_delete')) { ?>
  402. <a href="artist.php?action=delete&amp;artistid=<?=$ArtistID?>&amp;auth=<?=$LoggedUser['AuthKey']?>" class="brackets">Delete</a>
  403. <? } ?>
  404. </div>
  405. </div>
  406. <? /* Misc::display_recommend($ArtistID, "artist"); */ ?>
  407. <div class="sidebar">
  408. <? if ($Image) { ?>
  409. <div class="box box_image">
  410. <div class="head"><strong><?=$Name?></strong></div>
  411. <div style="text-align: center; padding: 10px 0px;">
  412. <img style="max-width: 220px;" class="lightbox-init" src="<?=ImageTools::process($Image, true)?>" alt="<?=$Name?>" />
  413. </div>
  414. </div>
  415. <? } ?>
  416. <div class="box box_search">
  417. <div class="head"><strong>File Lists Search</strong></div>
  418. <ul class="nobullet">
  419. <li>
  420. <form class="search_form" name="filelists" action="torrents.php">
  421. <input type="hidden" name="artistname" value="<?=$Name?>" />
  422. <input type="hidden" name="action" value="advanced" />
  423. <input type="text" autocomplete="off" id="filelist" name="filelist" size="20" />
  424. <input type="submit" value="&gt;" />
  425. </form>
  426. </li>
  427. </ul>
  428. </div>
  429. <?
  430. /* if (check_perms('zip_downloader')) {
  431. if (isset($LoggedUser['Collector'])) {
  432. list($ZIPList, $ZIPPrefs) = $LoggedUser['Collector'];
  433. $ZIPList = explode(':', $ZIPList);
  434. } else {
  435. $ZIPList = array('00', '11');
  436. $ZIPPrefs = 1;
  437. }
  438. ?>
  439. <div class="box box_zipdownload">
  440. <div class="head colhead_dark"><strong>Collector</strong></div>
  441. <div class="pad">
  442. <form class="download_form" name="zip" action="artist.php" method="post">
  443. <input type="hidden" name="action" value="download" />
  444. <input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
  445. <input type="hidden" name="artistid" value="<?=$ArtistID?>" />
  446. <ul id="list" class="nobullet">
  447. <? foreach ($ZIPList as $ListItem) { ?>
  448. <li id="list<?=$ListItem?>">
  449. <input type="hidden" name="list[]" value="<?=$ListItem?>" />
  450. <span class="float_left"><?=$ZIPOptions[$ListItem]['2']?></span>
  451. <span class="remove remove_collector"><a href="#" onclick="remove_selection('<?=$ListItem?>'); return false;" class="float_right brackets tooltip" title="Remove format from the Collector">X</a></span>
  452. <br style="clear: all;" />
  453. </li>
  454. <? } ?>
  455. </ul>
  456. <select id="formats" style="width: 180px;">
  457. <?
  458. $OpenGroup = false;
  459. $LastGroupID = -1;
  460. foreach ($ZIPOptions as $Option) {
  461. list($GroupID, $OptionID, $OptName) = $Option;
  462. if ($GroupID != $LastGroupID) {
  463. $LastGroupID = $GroupID;
  464. if ($OpenGroup) { ?>
  465. </optgroup>
  466. <? } ?>
  467. <optgroup label="<?=$ZIPGroups[$GroupID]?>">
  468. <? $OpenGroup = true;
  469. }
  470. ?>
  471. <option id="opt<?=$GroupID.$OptionID?>" value="<?=$GroupID.$OptionID?>"<? if (in_array($GroupID.$OptionID, $ZIPList)) { echo ' disabled="disabled"'; } ?>><?=$OptName?></option>
  472. <?
  473. }
  474. ?>
  475. </optgroup>
  476. </select>
  477. <button type="button" onclick="add_selection()">+</button>
  478. <select name="preference" style="width: 210px;">
  479. <option value="0"<? if ($ZIPPrefs == 0) { echo ' selected="selected"'; } ?>>Prefer Original</option>
  480. <option value="1"<? if ($ZIPPrefs == 1) { echo ' selected="selected"'; } ?>>Prefer Best Seeded</option>
  481. <option value="2"<? if ($ZIPPrefs == 2) { echo ' selected="selected"'; } ?>>Prefer Bonus Tracks</option>
  482. </select>
  483. <input type="submit" style="width: 210px;" value="Download" />
  484. </form>
  485. </div>
  486. </div>
  487. <?
  488. } //if (check_perms('zip_downloader'))*/ ?>
  489. <div class="box box_tags">
  490. <div class="head"><strong>Tags</strong></div>
  491. <ul class="stats nobullet">
  492. <? Tags::format_top(50, 'torrents.php?taglist=', $Name); ?>
  493. </ul>
  494. </div>
  495. <?
  496. // Stats
  497. ?>
  498. <div class="box box_info box_statistics_artist">
  499. <div class="head"><strong>Statistics</strong></div>
  500. <ul class="stats nobullet">
  501. <li>Number of groups: <?=number_format($NumGroups)?></li>
  502. <li>Number of torrents: <?=number_format($NumTorrents)?></li>
  503. <li>Number of seeders: <?=number_format($NumSeeders)?></li>
  504. <li>Number of leechers: <?=number_format($NumLeechers)?></li>
  505. <li>Number of snatches: <?=number_format($NumSnatches)?></li>
  506. </ul>
  507. </div>
  508. </div>
  509. <div class="main_column">
  510. <div id="artist_information" class="box">
  511. <div id="info" class="head">
  512. <a href="#">&uarr;</a>&nbsp;
  513. <strong>Information</strong>
  514. <a class="brackets" data-toggle-target="#body">Toggle</a>
  515. </div>
  516. <div id="body" class="body"><?=Text::full_format($Body)?></div>
  517. </div>
  518. <?
  519. echo $TorrentDisplayList;
  520. $Collages = $Cache->get_value("artists_collages_$ArtistID");
  521. if (!is_array($Collages)) {
  522. $DB->query("
  523. SELECT c.Name, c.NumTorrents, c.ID
  524. FROM collages AS c
  525. JOIN collages_artists AS ca ON ca.CollageID = c.ID
  526. WHERE ca.ArtistID = '$ArtistID'
  527. AND Deleted = '0'
  528. AND CategoryID = '7'");
  529. $Collages = $DB->to_array();
  530. $Cache->cache_value("artists_collages_$ArtistID", $Collages, 3600 * 6);
  531. }
  532. if (count($Collages) > 0) {
  533. if (count($Collages) > MAX_COLLAGES) {
  534. // Pick some at random
  535. $Range = range(0,count($Collages) - 1);
  536. shuffle($Range);
  537. $Indices = array_slice($Range, 0, MAX_COLLAGES);
  538. $SeeAll = ' <a data-toggle-target=".collage_rows">(See all)</a>';
  539. } else {
  540. $Indices = range(0, count($Collages)-1);
  541. $SeeAll = '';
  542. }
  543. ?>
  544. <table class="collage_table" id="collages">
  545. <tr class="colhead">
  546. <td width="85%"><a href="#">&uarr;</a>&nbsp;This artist is in <?=number_format(count($Collages))?> collage<?=((count($Collages) > 1) ? 's' : '')?><?=$SeeAll?></td>
  547. <td># artists</td>
  548. </tr>
  549. <?
  550. foreach ($Indices as $i) {
  551. list($CollageName, $CollageArtists, $CollageID) = $Collages[$i];
  552. unset($Collages[$i]);
  553. ?>
  554. <tr>
  555. <td><a href="collages.php?id=<?=$CollageID?>"><?=$CollageName?></a></td>
  556. <td><?=number_format($CollageArtists)?></td>
  557. </tr>
  558. <?
  559. }
  560. foreach ($Collages as $Collage) {
  561. list($CollageName, $CollageArtists, $CollageID) = $Collage;
  562. ?>
  563. <tr class="collage_rows hidden">
  564. <td><a href="collages.php?id=<?=$CollageID?>"><?=$CollageName?></a></td>
  565. <td><?=number_format($CollageArtists)?></td>
  566. </tr>
  567. <? } ?>
  568. </table>
  569. <?
  570. }
  571. if ($NumRequests > 0) {
  572. ?>
  573. <table cellpadding="6" cellspacing="1" border="0" class="request_table border" width="100%" id="requests">
  574. <tr class="colhead_dark">
  575. <td style="width: 48%;">
  576. <a href="#">&uarr;</a>&nbsp;
  577. <strong>Request Name</strong>
  578. </td>
  579. <td class="nobr">
  580. <strong>Vote</strong>
  581. </td>
  582. <td class="nobr">
  583. <strong>Bounty</strong>
  584. </td>
  585. <td>
  586. <strong>Added</strong>
  587. </td>
  588. </tr>
  589. <?
  590. $Tags = Requests::get_tags(array_keys($Requests));
  591. foreach ($Requests as $RequestID => $Request) {
  592. $CategoryName = $Categories[$Request['CategoryID'] - 1];
  593. $Title = empty($Request['Title']) ? (empty($Request['TitleRJ']) ? display_str($Request['TitleJP']) : display_str($Request['TitleRJ'])) : display_str($Request['Title']);
  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. if (!empty($Tags[$RequestID])) {
  604. $ReqTagList = [];
  605. foreach ($Tags[$RequestID] as $TagID => $TagName) {
  606. $ReqTagList[] = "<a href=\"requests.php?tags=$TagName\">".display_str($TagName).'</a>';
  607. }
  608. $ReqTagList = implode(', ', $ReqTagList);
  609. } else {
  610. $ReqTagList = '';
  611. }
  612. ?>
  613. <tr class="row">
  614. <td>
  615. <?=$FullName?>
  616. <div class="tags"><?=$ReqTagList?></div>
  617. </td>
  618. <td class="nobr">
  619. <span id="vote_count_<?=$RequestID?>"><?=$Request['Votes']?></span>
  620. <? if (check_perms('site_vote')) { ?>
  621. <input type="hidden" id="auth" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
  622. &nbsp;&nbsp; <a href="javascript:Vote(0, <?=$RequestID?>)" class="brackets"><strong>+</strong></a>
  623. <? } ?>
  624. </td>
  625. <td class="nobr">
  626. <span id="bounty_<?=$RequestID?>"><?=Format::get_size($Request['Bounty'])?></span>
  627. </td>
  628. <td>
  629. <?=time_diff($Request['TimeAdded'])?>
  630. </td>
  631. </tr>
  632. <? } ?>
  633. </table>
  634. <?
  635. }
  636. // --- Comments ---
  637. $Pages = Format::get_pages($Page, $NumComments, TORRENT_COMMENTS_PER_PAGE, 9, '#comments');
  638. ?>
  639. <div id="artistcomments">
  640. <div class="linkbox"><a name="comments"></a>
  641. <?=($Pages)?>
  642. </div>
  643. <?
  644. //---------- Begin printing
  645. CommentsView::render_comments($Thread, $LastRead, "artist.php?id=$ArtistID");
  646. ?>
  647. <div class="linkbox">
  648. <?=($Pages)?>
  649. </div>
  650. <?
  651. View::parse('generic/reply/quickreply.php', array(
  652. 'InputName' => 'pageid',
  653. 'InputID' => $ArtistID,
  654. 'Action' => 'comments.php?page=artist',
  655. 'InputAction' => 'take_post',
  656. 'SubscribeBox' => true
  657. ));
  658. ?>
  659. </div>
  660. </div>
  661. </div>
  662. <?
  663. View::show_footer();
  664. // Cache page for later use
  665. if ($RevisionID) {
  666. $Key = "artist_$ArtistID" . "_revision_$RevisionID";
  667. } else {
  668. $Key = "artist_$ArtistID";
  669. }
  670. $Data = array(array($Name, $Image, $Body));
  671. $Cache->cache_value($Key, $Data, 3600);
  672. ?>