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.

torrent_collage.php 25KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785
  1. <?php
  2. #declare(strict_types = 1);
  3. function compare($X, $Y)
  4. {
  5. return($Y['count'] - $X['count']);
  6. }
  7. // Build the data for the collage and the torrent list
  8. // todo: Cache this
  9. $DB->query("
  10. SELECT
  11. ct.`GroupID`,
  12. ct.`UserID`
  13. FROM `collages_torrents` AS ct
  14. JOIN `torrents_group` AS tg ON tg.`ID` = ct.`GroupID`
  15. WHERE ct.`CollageID` = '$CollageID'
  16. ORDER BY ct.`Sort`
  17. ");
  18. $GroupIDs = $DB->collect('GroupID');
  19. $Contributors = $DB->to_pair('GroupID', 'UserID', false);
  20. if (count($GroupIDs) > 0) {
  21. $TorrentList = Torrents::get_groups($GroupIDs);
  22. } else {
  23. $TorrentList = [];
  24. }
  25. // Loop through the result set, building up $Collage and $TorrentTable
  26. // Then we print them.
  27. $Collage = [];
  28. $TorrentTable = '';
  29. $NumGroups = count($TorrentList);
  30. $NumGroupsByUser = 0;
  31. $TopArtists = [];
  32. $UserAdditions = [];
  33. $Number = 0;
  34. foreach ($GroupIDs as $GroupID) {
  35. if (!isset($TorrentList[$GroupID])) {
  36. continue;
  37. }
  38. $Group = $TorrentList[$GroupID];
  39. extract(Torrents::array_group($Group));
  40. $UserID = $Contributors[$GroupID];
  41. $TorrentTags = new Tags($tag_list);
  42. // Handle stats and stuff
  43. $Number++;
  44. if ($UserID === $LoggedUser['ID']) {
  45. $NumGroupsByUser++;
  46. }
  47. $CountArtists = $Artists;
  48. if ($CountArtists) {
  49. foreach ($CountArtists as $Artist) {
  50. if (!isset($TopArtists[$Artist['id']])) {
  51. $TopArtists[$Artist['id']] = array('name' => $Artist['name'], 'count' => 1);
  52. } else {
  53. $TopArtists[$Artist['id']]['count']++;
  54. }
  55. }
  56. }
  57. if (!isset($UserAdditions[$UserID])) {
  58. $UserAdditions[$UserID] = 0;
  59. }
  60. $UserAdditions[$UserID]++;
  61. $DisplayName = "$Number. ";
  62. $DisplayName .= "<a class='torrent_title' href='torrents.php?id=$GroupID' ";
  63. if (!isset($LoggedUser['CoverArt']) || $LoggedUser['CoverArt']) {
  64. $DisplayName .= 'data-cover="'.ImageTools::process($picture, 'thumb').'" ';
  65. }
  66. $title = empty($title) ? (empty($subject) ? $object : $subject) : $title;
  67. $DisplayName .= "dir='ltr'>$title</a>";
  68. # Year
  69. if ($published) {
  70. $Label = '<br />📅&nbsp;';
  71. $DisplayName .= $Label."<a href='torrents.php?action=search&year=$published'>$published</a>";
  72. }
  73. # Studio
  74. if ($workgroup) {
  75. $Label = '&ensp;📍&nbsp;';
  76. $DisplayName .= $Label."<a href='torrents.php?action=search&location=$workgroup'>$workgroup</a>";
  77. }
  78. # Catalogue Number
  79. if ($identifier) {
  80. $Label = '&ensp;🔑&nbsp;';
  81. $DisplayName .= $Label."<a href='torrents.php?action=search&numbers=$identifier'>$identifier</a>";
  82. }
  83. # Authors
  84. if ($Artists) {
  85. # Emoji in classes/astists.class.php
  86. $Label = '&ensp;';
  87. $DisplayName .= $Label.'<div class="torrent_artists">'.Artists::display_artists($Artists).'</div>';
  88. }
  89. $SnatchedGroupClass = ($GroupFlags['IsSnatched'] ? ' snatched_group' : '');
  90. // Start an output buffer, so we can store this output in $TorrentTable
  91. ob_start();
  92. if (count($Torrents) > 1) {
  93. // Grouped torrents
  94. $ShowGroups = !(!empty($LoggedUser['TorrentGrouping']) && $LoggedUser['TorrentGrouping'] === 1); ?>
  95. <tr class="group <?=$SnatchedGroupClass?>"
  96. id="group_<?=$GroupID?>">
  97. <td class="center">
  98. <div id="showimg_<?=$GroupID?>"
  99. class="<?=($ShowGroups ? 'hide' : 'show')?>_torrents">
  100. <a class="tooltip show_torrents_link"
  101. onclick="toggle_group(<?=$GroupID?>, this, event);"
  102. title="Collapse this group. Hold &quot;Ctrl&quot; while clicking to collapse all groups on this page."></a>
  103. </div>
  104. </td>
  105. <td class="center">
  106. <div title="<?=$TorrentTags->title()?>"
  107. class="tooltip <?=Format::css_category($GroupCategoryID)?> <?=$TorrentTags->css_name()?>">
  108. </div>
  109. </td>
  110. <td colspan="5">
  111. <?=$DisplayName?>
  112. <?php if (Bookmarks::has_bookmarked('torrent', $GroupID)) { ?>
  113. <span class="remove_bookmark float_right">
  114. <a class="float_right" href="#"
  115. id="bookmarklink_torrent_<?=$GroupID?>"
  116. class="remove_bookmark brackets"
  117. onclick="Unbookmark('torrent', <?=$GroupID?>, 'Bookmark'); return false;">Remove
  118. bookmark</a>
  119. </span>
  120. <?php } else { ?>
  121. <span class="add_bookmark float_right">
  122. <a class="float_right" href="#"
  123. id="bookmarklink_torrent_<?=$GroupID?>"
  124. class="add_bookmark brackets"
  125. onclick="Bookmark('torrent', <?=$GroupID?>, 'Remove bookmark'); return false;">Bookmark</a>
  126. </span>
  127. <?php
  128. } ?>
  129. <div class="tags"><?=$TorrentTags->format()?>
  130. </div>
  131. </td>
  132. </tr>
  133. <?php
  134. foreach ($Torrents as $TorrentID => $Torrent) {
  135. $SnatchedTorrentClass = $Torrent['IsSnatched'] ? ' snatched_torrent' : ''; ?>
  136. <tr
  137. class="group_torrent torrent_row groupid_<?=$GroupID?> <?=$SnatchedTorrentClass . $SnatchedGroupClass . (!empty($LoggedUser['TorrentGrouping']) && $LoggedUser['TorrentGrouping'] === 1 ? ' hidden' : '')?>">
  138. <td colspan="3">
  139. <span class="brackets">
  140. <a href="torrents.php?action=download&amp;id=<?=$TorrentID?>&amp;authkey=<?=$LoggedUser['AuthKey']?>&amp;torrent_pass=<?=$LoggedUser['torrent_pass']?>"
  141. class="tooltip" title="Download">DL</a>
  142. <?php if (Torrents::can_use_token($Torrent)) { ?>
  143. | <a
  144. href="torrents.php?action=download&amp;id=<?=$TorrentID ?>&amp;authkey=<?=$LoggedUser['AuthKey']?>&amp;torrent_pass=<?=$LoggedUser['torrent_pass']?>&amp;usetoken=1"
  145. class="tooltip" title="Use a FL Token"
  146. onclick="return confirm('Are you sure you want to use a freeleech token here?');">FL</a>
  147. <?php } ?>
  148. | <a href="reportsv2.php?action=report&amp;id=<?=$TorrentID?>"
  149. class="tooltip" title="Report">RP</a>
  150. </span>
  151. &nbsp;&nbsp;&raquo;&nbsp;
  152. <a
  153. href="torrents.php?id=<?=$GroupID?>&amp;torrentid=<?=$TorrentID?>"><?=Torrents::torrent_info($Torrent)?></a>
  154. </td>
  155. <td class="number_column nobr">
  156. <?=Format::get_size($Torrent['Size'])?>
  157. </td>
  158. <td class="number_column">
  159. <?=number_format($Torrent['Snatched'])?>
  160. </td>
  161. <td
  162. class="number_column<?=(($Torrent['Seeders'] === 0) ? ' r00' : '')?>">
  163. <?=number_format($Torrent['Seeders'])?>
  164. </td>
  165. <td class="number_column"><?=number_format($Torrent['Leechers'])?>
  166. </td>
  167. </tr>
  168. <?php
  169. }
  170. } else {
  171. // Viewing a type that does not require grouping
  172. $Data = current($Torrents);
  173. $ExtraInfo = Torrents::torrent_info($Data, true, true);
  174. $DisplayName .= "<span style='font-weight: normal;'>$ExtraInfo</span>";
  175. /*
  176. $TorrentID = key($Torrents);
  177. $Torrent = current($Torrents);
  178. if ($Torrent['IsLeeching']) {
  179. $DisplayName .= ' ' . Format::torrent_label('Leeching', 'important_text');
  180. } elseif ($Torrent['IsSeeding']) {
  181. $DisplayName .= ' ' . Format::torrent_label('Seeding', 'important_text_alt');
  182. } elseif ($Torrent['IsSnatched']) {
  183. $DisplayName .= ' ' . Format::torrent_label('Snatched', 'bold');
  184. }
  185. if ($Torrent['FreeTorrent'] == '1') {
  186. $DisplayName .= ' | ' . Format::torrent_label('Freeleech!', 'important_text_alt');
  187. } elseif ($Torrent['FreeTorrent'] == '2') {
  188. $DisplayName .= ' | ' . Format::torrent_label('Neutral Leech!', 'bold');
  189. } elseif ($Torrent['PersonalFL']) {
  190. $DisplayName .= ' | ' . Format::torrent_label('Personal Freeleech!', 'important_text_alt');
  191. }
  192. $SnatchedTorrentClass = ($Torrent['IsSnatched'] ? ' snatched_torrent' : ''); ?>
  193. */ ?>
  194. <tr
  195. class="torrent torrent_row<?=$SnatchedTorrentClass . $SnatchedGroupClass?>"
  196. id="group_<?=$GroupID?>">
  197. <td></td>
  198. <td></td>
  199. <td>
  200. <span class="brackets">
  201. <a href="torrents.php?action=download&amp;id=<?=$TorrentID?>&amp;authkey=<?=$LoggedUser['AuthKey']?>&amp;torrent_pass=<?=$LoggedUser['torrent_pass']?>"
  202. class="tooltip" title="Download">DL</a>
  203. <?php if (Torrents::can_use_token($Torrent)) { ?>
  204. | <a
  205. href="torrents.php?action=download&amp;id=<?=$TorrentID ?>&amp;authkey=<?=$LoggedUser['AuthKey']?>&amp;torrent_pass=<?=$LoggedUser['torrent_pass']?>&amp;usetoken=1"
  206. class="tooltip" title="Use a FL Token"
  207. onclick="return confirm('Are you sure you want to use a freeleech token here?');">FL</a>
  208. <?php } ?>
  209. | <a href="reportsv2.php?action=report&amp;id=<?=$TorrentID?>"
  210. class="tooltip" title="Report">RP</a>
  211. </span>
  212. <?=$DisplayName?>
  213. <div class="tags"><?=$TorrentTags->format()?>
  214. </div>
  215. </td>
  216. <td class="number_column nobr">
  217. <?=Format::get_size($Torrent['Size'])?>
  218. </td>
  219. <td class="number_column">
  220. <?=number_format($Torrent['Snatched'])?>
  221. </td>
  222. <td
  223. class="number_column<?=(($Torrent['Seeders'] === 0) ? ' r00' : '')?>">
  224. <?=number_format($Torrent['Seeders'])?>
  225. </td>
  226. <td class="number_column">
  227. <?=number_format($Torrent['Leechers'])?>
  228. </td>
  229. </tr>
  230. <?php
  231. }
  232. $TorrentTable .= ob_get_clean();
  233. // Album art
  234. ob_start();
  235. $DisplayName = '';
  236. #$DisplayName .= Artists::display_artists($Artists, false);
  237. $DisplayName .= $title;
  238. if ($GroupYear > 0) {
  239. $DisplayName = "$DisplayName [$GroupYear]";
  240. }
  241. $Tags = display_str($TorrentTags->format());
  242. $PlainTags = implode(', ', $TorrentTags->get_tags()); ?>
  243. <div class="collage_image image_group_<?=$GroupID?>">
  244. <a href="torrents.php?id=<?=$GroupID?>">
  245. <?php if (!$picture) {
  246. $picture = STATIC_SERVER.'common/noartwork/music.png';
  247. } ?>
  248. <img class="tooltip_interactive"
  249. src="<?=ImageTools::process($picture, 'thumb')?>"
  250. alt="<?=$DisplayName?>"
  251. title="<?=$DisplayName?>"
  252. data-title-plain="<?="$DisplayName ($PlainTags)"?>"
  253. width="100%" />
  254. </a>
  255. </div>
  256. <?php
  257. $Collage[] = ob_get_clean();
  258. }
  259. if ($CollageCategoryID === '0' && !check_perms('site_collages_delete')) {
  260. if (!check_perms('site_collages_personal') || $CreatorID !== $LoggedUser['ID']) {
  261. $PreventAdditions = true;
  262. }
  263. }
  264. if (!check_perms('site_collages_delete')
  265. && (
  266. $Locked
  267. || ($MaxGroups > 0 && $NumGroups >= $MaxGroups)
  268. || ($MaxGroupsPerUser > 0 && $NumGroupsByUser >= $MaxGroupsPerUser)
  269. )
  270. ) {
  271. $PreventAdditions = true;
  272. }
  273. // Silly hack for people who are on the old setting
  274. $CollageCovers = isset($LoggedUser['CollageCovers']) ? $LoggedUser['CollageCovers'] : 25 * (abs($LoggedUser['HideCollage'] - 1));
  275. $CollagePages = [];
  276. if ($CollageCovers) {
  277. for ($i = 0; $i < $NumGroups / $CollageCovers; $i++) {
  278. $Groups = array_slice($Collage, $i * $CollageCovers, $CollageCovers);
  279. $CollagePage = '';
  280. foreach ($Groups as $Group) {
  281. $CollagePage .= $Group;
  282. }
  283. $CollagePages[] = $CollagePage;
  284. }
  285. }
  286. View::show_header(
  287. $Name,
  288. 'browse,collage,bbcode,recommend,wall'
  289. );
  290. ?>
  291. <div>
  292. <div class="header">
  293. <h2><?=$Name?>
  294. </h2>
  295. <div class="linkbox">
  296. <a href="collages.php" class="brackets">List of collections</a>
  297. <?php if (check_perms('site_collages_create')) { ?>
  298. <a href="collages.php?action=new" class="brackets">New collection</a>
  299. <?php } ?>
  300. <br /><br />
  301. <?php if (check_perms('site_collages_subscribe')) { ?>
  302. <a href="#" id="subscribelink<?=$CollageID?>" class="brackets"
  303. onclick="CollageSubscribe(<?=$CollageID?>); return false;"><?=(in_array($CollageID, $CollageSubscriptions) ? 'Unsubscribe' : 'Subscribe')?></a>
  304. <?php
  305. }
  306. if (check_perms('site_collages_delete') || (check_perms('site_edit_wiki') && !$Locked)) {
  307. ?>
  308. <a href="collages.php?action=edit&amp;collageid=<?=$CollageID?>"
  309. class="brackets">Edit description</a>
  310. <?php
  311. } else { ?>
  312. <span class="brackets">Locked</span>
  313. <?php
  314. }
  315. if (Bookmarks::has_bookmarked('collage', $CollageID)) {
  316. ?>
  317. <a href="#" id="bookmarklink_collage_<?=$CollageID?>"
  318. class="brackets"
  319. onclick="Unbookmark('collage', <?=$CollageID?>, 'Bookmark'); return false;">Remove
  320. bookmark</a>
  321. <?php
  322. } else { ?>
  323. <a href="#" id="bookmarklink_collage_<?=$CollageID?>"
  324. class="brackets"
  325. onclick="Bookmark('collage', <?=$CollageID?>, 'Remove bookmark'); return false;">Bookmark</a>
  326. <?php } ?>
  327. <!-- <a href="#" id="recommend" class="brackets">Recommend</a> -->
  328. <?php
  329. if (check_perms('site_collages_manage') && !$Locked) {
  330. ?>
  331. <a href="collages.php?action=manage&amp;collageid=<?=$CollageID?>"
  332. class="brackets">Manage torrents</a>
  333. <?php
  334. } ?>
  335. <a href="reports.php?action=report&amp;type=collage&amp;id=<?=$CollageID?>"
  336. class="brackets">Report collection</a>
  337. <?php if (check_perms('site_collages_delete') || $CreatorID == $LoggedUser['ID']) { ?>
  338. <a href="collages.php?action=delete&amp;collageid=<?=$CollageID?>&amp;auth=<?=$LoggedUser['AuthKey']?>"
  339. class="brackets" onclick="return confirm('Are you sure you want to delete this collage?');">Delete</a>
  340. <?php } ?>
  341. </div>
  342. </div>
  343. <?php /* Misc::display_recommend($CollageID, "collage"); */ ?>
  344. <div class="sidebar">
  345. <div class="box box_category">
  346. <div class="head"><strong>Category</strong></div>
  347. <div class="pad"><a
  348. href="collages.php?action=search&amp;cats[<?=(int)$CollageCategoryID?>]=1"><?=$CollageCats[(int)$CollageCategoryID]?></a></div>
  349. </div>
  350. <div class="box box_description">
  351. <div class="head"><strong>Description</strong></div>
  352. <div class="pad"><?=Text::full_format($Description)?>
  353. </div>
  354. </div>
  355. <?php
  356. // I'm actually commenting this out
  357. /*
  358. if (check_perms('zip_downloader')) {
  359. if (isset($LoggedUser['Collector'])) {
  360. list($ZIPList, $ZIPPrefs) = $LoggedUser['Collector'];
  361. $ZIPList = explode(':', $ZIPList);
  362. } else {
  363. $ZIPList = array('00', '11');
  364. $ZIPPrefs = 1;
  365. }
  366. ?>
  367. <div class="box box_zipdownload">
  368. <div class="head colhead_dark"><strong>Collector</strong></div>
  369. <div class="pad">
  370. <form class="download_form" name="zip" action="collages.php" method="post">
  371. <input type="hidden" name="action" value="download" />
  372. <input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
  373. <input type="hidden" name="collageid" value="<?=$CollageID?>" />
  374. <ul id="list" class="nobullet">
  375. <? foreach ($ZIPList as $ListItem) { ?>
  376. <li id="list<?=$ListItem?>">
  377. <input type="hidden" name="list[]" value="<?=$ListItem?>" />
  378. <span class="float_left"><?=$ZIPOptions[$ListItem]['2']?></span>
  379. <span class="remove remove_collector"><a href="#" onclick="remove_selection('<?=$ListItem?>'); return false;" class="float_right brackets">X</a></span>
  380. <br style="clear: all;" />
  381. </li>
  382. <? } ?>
  383. </ul>
  384. <select id="formats" style="width: 180px;">
  385. <?
  386. $OpenGroup = false;
  387. $LastGroupID = -1;
  388. foreach ($ZIPOptions as $Option) {
  389. list($GroupID, $OptionID, $OptName) = $Option;
  390. if ($GroupID != $LastGroupID) {
  391. $LastGroupID = $GroupID;
  392. if ($OpenGroup) {
  393. ?>
  394. </optgroup>
  395. <?php } ?>
  396. <optgroup label="<?=$ZIPGroups[$GroupID]?>">
  397. <?
  398. $OpenGroup = true;
  399. }
  400. ?>
  401. <option id="opt<?=$GroupID.$OptionID?>" value="<?=$GroupID.$OptionID?>"<? if (in_array($GroupID.$OptionID, $ZIPList)) { echo ' disabled="disabled"'; }?>><?=$OptName?></option>
  402. <?
  403. }
  404. ?>
  405. </optgroup>
  406. </select>
  407. <button type="button" onclick="add_selection();">+</button>
  408. <select name="preference" style="width: 210px;">
  409. <option value="0"<? if ($ZIPPrefs == 0) { echo ' selected="selected"'; } ?>>Prefer Original</option>
  410. <option value="1"<? if ($ZIPPrefs == 1) { echo ' selected="selected"'; } ?>>Prefer Best Seeded</option>
  411. <option value="2"<? if ($ZIPPrefs == 2) { echo ' selected="selected"'; } ?>>Prefer Bonus Tracks</option>
  412. </select>
  413. <input type="submit" style="width: 210px;" value="Download" />
  414. </form>
  415. </div>
  416. </div>
  417. <? }
  418. */
  419. ?>
  420. <div class="box box_info box_statistics_collage_torrents">
  421. <div class="head">
  422. <strong>Statistics</strong>
  423. </div>
  424. <ul class="stats nobullet">
  425. <li>
  426. Torrents: <?=number_format($NumGroups)?>
  427. </li>
  428. <?php if (!empty($TopArtists)) { ?>
  429. <li>
  430. Artists: <?=number_format(count($TopArtists))?>
  431. </li>
  432. <?php } ?>
  433. <li>
  434. Subscribers: <?=number_format((int)$Subscribers)?>
  435. </li>
  436. <li>
  437. Built by <?=number_format(count($UserAdditions))?>
  438. user<?=(count($UserAdditions) > 1 ? 's' : '')?>
  439. </li>
  440. <li>
  441. Last updated: <?=time_diff($Updated)?>
  442. </li>
  443. </ul>
  444. </div>
  445. <div class="box box_tags">
  446. <div class="head">
  447. <strong>Top Tags</strong>
  448. </div>
  449. <div class="pad tags">
  450. <ol style="padding-left: 5px">
  451. <?php Tags::format_top(5, 'collages.php?action=search&amp;tags='); ?>
  452. </ol>
  453. </div>
  454. </div>
  455. <?php if (!empty($TopArtists)) { ?>
  456. <div class="box box_artists">
  457. <div class="head">
  458. <strong>Top Artists</strong>
  459. </div>
  460. <div class="pad">
  461. <ol style="padding-left: 5px;">
  462. <?php
  463. uasort($TopArtists, 'compare');
  464. $i = 0;
  465. foreach ($TopArtists as $ID => $Artist) {
  466. $i++;
  467. if ($i > 10) {
  468. break;
  469. } ?>
  470. <li>
  471. <a href="artist.php?id=<?=$ID?>"><?=$Artist['name']?></a> (<?=number_format($Artist['count'])?>)
  472. </li>
  473. <?php
  474. } ?>
  475. </ol>
  476. </div>
  477. </div>
  478. <?php } ?>
  479. <div class="box box_contributors">
  480. <div class="head"><strong>Top Contributors</strong></div>
  481. <div class="pad">
  482. <ol style="padding-left: 5px;">
  483. <?php
  484. arsort($UserAdditions);
  485. $i = 0;
  486. foreach ($UserAdditions as $UserID => $Additions) {
  487. $i++;
  488. if ($i > 5) {
  489. break;
  490. } ?>
  491. <li>
  492. <?=Users::format_username($UserID, false, false, false)?>
  493. (<?=number_format($Additions)?>)
  494. </li>
  495. <?php
  496. } ?>
  497. </ol>
  498. </div>
  499. </div>
  500. <?php if (check_perms('site_collages_manage') && !isset($PreventAdditions)) { ?>
  501. <div class="box box_addtorrent">
  502. <div class="head"><strong>Add Torrent Group</strong><span class="float_right"><a href="#"
  503. onclick="$('.add_torrent_container').toggle_class('hidden'); this.innerHTML = (this.innerHTML == 'Batch add' ? 'Individual add' : 'Batch add'); return false;"
  504. class="brackets">Batch add</a></span></div>
  505. <div class="pad add_torrent_container">
  506. <form class="add_form" name="torrent" action="collages.php" method="post">
  507. <input type="hidden" name="action" value="add_torrent" />
  508. <input type="hidden" name="auth"
  509. value="<?=$LoggedUser['AuthKey']?>" />
  510. <input type="hidden" name="collageid"
  511. value="<?=$CollageID?>" />
  512. <div>
  513. <input type="text" size="20" name="url" />
  514. </div>
  515. <div class="submit_div">
  516. <input type="submit" value="Add" />
  517. </div>
  518. <span style="font-style: italic;">Enter the URL of a torrent group on the site.</span>
  519. </form>
  520. </div>
  521. <div class="pad hidden add_torrent_container">
  522. <form class="add_form" name="torrents" action="collages.php" method="post">
  523. <input type="hidden" name="action" value="add_torrent_batch" />
  524. <input type="hidden" name="auth"
  525. value="<?=$LoggedUser['AuthKey']?>" />
  526. <input type="hidden" name="collageid"
  527. value="<?=$CollageID?>" />
  528. <div>
  529. <textarea name="urls" rows="5" cols="25"
  530. style="white-space: pre; word-wrap: normal; overflow: auto;"></textarea>
  531. </div>
  532. <div class="submit_div">
  533. <input type="submit" value="Add" />
  534. </div>
  535. <span style="font-style: italic;">Enter the URLs of torrent groups on the site, one per line.</span>
  536. </form>
  537. </div>
  538. </div>
  539. <?php } ?>
  540. <h3>Comments</h3>
  541. <?php
  542. if ($CommentList === null) {
  543. $DB->query("
  544. SELECT
  545. c.ID,
  546. c.Body,
  547. c.AuthorID,
  548. um.Username,
  549. c.AddedTime
  550. FROM comments AS c
  551. LEFT JOIN users_main AS um ON um.ID = c.AuthorID
  552. WHERE c.Page = 'collages'
  553. AND c.PageID = $CollageID
  554. ORDER BY c.ID DESC
  555. LIMIT 15");
  556. $CommentList = $DB->to_array(false, MYSQLI_NUM);
  557. }
  558. foreach ($CommentList as $Comment) {
  559. list($CommentID, $Body, $UserID, $Username, $CommentTime) = $Comment; ?>
  560. <div class="box comment">
  561. <div class="head">
  562. <?=Users::format_username($UserID, false, false, false) ?>
  563. <?=time_diff($CommentTime) ?>
  564. <br />
  565. <a href="reports.php?action=report&amp;type=comment&amp;id=<?=$CommentID?>"
  566. class="brackets">Report</a>
  567. </div>
  568. <div class="pad"><?=Text::full_format($Body)?>
  569. </div>
  570. </div>
  571. <?php
  572. }
  573. ?>
  574. <div class="box pad">
  575. <a href="collages.php?action=comments&amp;collageid=<?=$CollageID?>"
  576. class="brackets">View all comments</a>
  577. </div>
  578. <?php
  579. if (!$LoggedUser['DisablePosting']) {
  580. ?>
  581. <div class="box box_addcomment">
  582. <div class="head"><strong>Comment</strong></div>
  583. <form class="send_form" name="comment" id="quickpostform" onsubmit="quickpostform.submit_button.disabled = true;"
  584. action="comments.php" method="post">
  585. <input type="hidden" name="action" value="take_post" />
  586. <input type="hidden" name="page" value="collages" />
  587. <input type="hidden" name="auth"
  588. value="<?=$LoggedUser['AuthKey']?>" />
  589. <input type="hidden" name="pageid" value="<?=$CollageID?>" />
  590. <div class="pad">
  591. <div>
  592. <textarea name="body" cols="24" rows="5"></textarea>
  593. </div>
  594. <div class="submit_div">
  595. <input type="submit" id="submit_button" value="Post" />
  596. </div>
  597. </div>
  598. </form>
  599. </div>
  600. <?php
  601. }
  602. ?>
  603. </div>
  604. <div class="main_column">
  605. <?php
  606. if ($CollageCovers != 0) { ?>
  607. <div id="coverart" class="box">
  608. <div class="head" id="coverhead"><strong>Pictures</strong></div>
  609. <div class="collage_images" id="collage_page0" data-wall-child=".collage_image" data-wall-size="4"
  610. data-wall-min="2">
  611. <?php
  612. $Page1 = array_slice($Collage, 0, $CollageCovers);
  613. foreach ($Page1 as $Group) {
  614. echo $Group;
  615. }
  616. ?>
  617. </div>
  618. </div>
  619. <?php if ($NumGroups > $CollageCovers) { ?>
  620. <div class="linkbox pager" style="clear: left;" id="pageslinksdiv">
  621. <span id="firstpage" class="invisible">
  622. <a href="#" class="pageslink" onclick="collageShow.page(0, this); return false;">
  623. <strong>&laquo; First</strong>
  624. </a> |
  625. </span>
  626. <span id="prevpage" class="invisible">
  627. <a href="#" class="pageslink" onclick="collageShow.prevPage(); return false;">
  628. <strong>&lsaquo; Prev</strong>
  629. </a> |
  630. </span>
  631. <?php for ($i = 0; $i < $NumGroups / $CollageCovers; $i++) { ?>
  632. <span id="pagelink<?=$i?>"
  633. class="<?=(($i > 4) ? 'hidden' : '')?><?=(($i == 0) ? 'selected' : '')?>">
  634. <a href="#" class="pageslink"
  635. onclick="collageShow.page(<?=$i?>, this); return false;">
  636. <strong><?=$CollageCovers * $i + 1?>-<?=min($NumGroups, $CollageCovers * ($i + 1))?></strong>
  637. </a>
  638. <?=(($i != ceil($NumGroups / $CollageCovers) - 1) ? ' | ' : '')?>
  639. </span>
  640. <?php } ?>
  641. <span id="nextbar"
  642. class="<?=($NumGroups / $CollageCovers > 5) ? 'hidden' : ''?>">
  643. | </span>
  644. <span id="nextpage">
  645. <a href="#" class="pageslink" onclick="collageShow.nextPage(); return false;">
  646. <strong>Next &rsaquo;</strong>
  647. </a>
  648. </span>
  649. <span id="lastpage"
  650. class="<?=(ceil($NumGroups / $CollageCovers) == 2 ? 'invisible' : '')?>">
  651. |
  652. <a href="#" class="pageslink"
  653. onclick="collageShow.page(<?=ceil($NumGroups / $CollageCovers) - 1?>, this); return false;">
  654. <strong>Last&nbsp;&raquo;</strong>
  655. </a>
  656. </span>
  657. </div>
  658. <script type="text/javascript">
  659. $(() => collageShow.init( <?=json_encode($CollagePages)?> ));
  660. </script>
  661. <?php
  662. }
  663. }
  664. ?>
  665. <div class="box">
  666. <table class="torrent_table grouping cats" id="discog_table">
  667. <tr class="colhead_dark">
  668. <td>
  669. <!-- Expand/Collapse -->
  670. </td>
  671. <td>
  672. <!-- Category -->
  673. </td>
  674. <td width="70%"><strong>Torrents</strong></td>
  675. <td>Size</td>
  676. <td class="sign snatches">
  677. </td>
  678. <td class="sign seeders">
  679. &uarr;
  680. </td>
  681. <td class="sign leechers">
  682. &darr;
  683. </td>
  684. </tr>
  685. <?=$TorrentTable?>
  686. </table>
  687. </div>
  688. </div>
  689. </div>
  690. <?php View::show_footer();