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

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