BioTorrents.de’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 29KB

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