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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789
  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 class="center">
  199. <div title="<?=$TorrentTags->title()?>"
  200. class="tooltip <?=Format::css_category($GroupCategoryID)?> <?=$TorrentTags->css_name()?>">
  201. </div>
  202. </td>
  203. <td>
  204. <span class="brackets">
  205. <a href="torrents.php?action=download&amp;id=<?=$TorrentID?>&amp;authkey=<?=$LoggedUser['AuthKey']?>&amp;torrent_pass=<?=$LoggedUser['torrent_pass']?>"
  206. class="tooltip" title="Download">DL</a>
  207. <?php if (Torrents::can_use_token($Torrent)) { ?>
  208. | <a
  209. href="torrents.php?action=download&amp;id=<?=$TorrentID ?>&amp;authkey=<?=$LoggedUser['AuthKey']?>&amp;torrent_pass=<?=$LoggedUser['torrent_pass']?>&amp;usetoken=1"
  210. class="tooltip" title="Use a FL Token"
  211. onclick="return confirm('Are you sure you want to use a freeleech token here?');">FL</a>
  212. <?php } ?>
  213. | <a href="reportsv2.php?action=report&amp;id=<?=$TorrentID?>"
  214. class="tooltip" title="Report">RP</a>
  215. </span>
  216. <?=$DisplayName?>
  217. <div class="tags"><?=$TorrentTags->format()?>
  218. </div>
  219. </td>
  220. <td class="number_column nobr">
  221. <?=Format::get_size($Torrent['Size'])?>
  222. </td>
  223. <td class="number_column">
  224. <?=number_format($Torrent['Snatched'])?>
  225. </td>
  226. <td
  227. class="number_column<?=(($Torrent['Seeders'] === 0) ? ' r00' : '')?>">
  228. <?=number_format($Torrent['Seeders'])?>
  229. </td>
  230. <td class="number_column">
  231. <?=number_format($Torrent['Leechers'])?>
  232. </td>
  233. </tr>
  234. <?php
  235. }
  236. $TorrentTable .= ob_get_clean();
  237. // Album art
  238. ob_start();
  239. $DisplayName = '';
  240. #$DisplayName .= Artists::display_artists($Artists, false);
  241. $DisplayName .= $title;
  242. if ($GroupYear > 0) {
  243. $DisplayName = "$DisplayName [$GroupYear]";
  244. }
  245. $Tags = display_str($TorrentTags->format());
  246. $PlainTags = implode(', ', $TorrentTags->get_tags()); ?>
  247. <div class="collage_image image_group_<?=$GroupID?>">
  248. <a href="torrents.php?id=<?=$GroupID?>">
  249. <?php if (!$picture) {
  250. $picture = STATIC_SERVER.'common/noartwork/music.png';
  251. } ?>
  252. <img class="tooltip_interactive"
  253. src="<?=ImageTools::process($picture, 'thumb')?>"
  254. alt="<?=$DisplayName?>"
  255. title="<?=$DisplayName?>"
  256. data-title-plain="<?="$DisplayName ($PlainTags)"?>"
  257. width="100%" />
  258. </a>
  259. </div>
  260. <?php
  261. $Collage[] = ob_get_clean();
  262. }
  263. if ($CollageCategoryID === '0' && !check_perms('site_collages_delete')) {
  264. if (!check_perms('site_collages_personal') || $CreatorID !== $LoggedUser['ID']) {
  265. $PreventAdditions = true;
  266. }
  267. }
  268. if (!check_perms('site_collages_delete')
  269. && (
  270. $Locked
  271. || ($MaxGroups > 0 && $NumGroups >= $MaxGroups)
  272. || ($MaxGroupsPerUser > 0 && $NumGroupsByUser >= $MaxGroupsPerUser)
  273. )
  274. ) {
  275. $PreventAdditions = true;
  276. }
  277. // Silly hack for people who are on the old setting
  278. $CollageCovers = isset($LoggedUser['CollageCovers']) ? $LoggedUser['CollageCovers'] : 25 * (abs($LoggedUser['HideCollage'] - 1));
  279. $CollagePages = [];
  280. if ($CollageCovers) {
  281. for ($i = 0; $i < $NumGroups / $CollageCovers; $i++) {
  282. $Groups = array_slice($Collage, $i * $CollageCovers, $CollageCovers);
  283. $CollagePage = '';
  284. foreach ($Groups as $Group) {
  285. $CollagePage .= $Group;
  286. }
  287. $CollagePages[] = $CollagePage;
  288. }
  289. }
  290. View::show_header(
  291. $Name,
  292. 'browse,collage,bbcode,recommend,wall'
  293. );
  294. ?>
  295. <div>
  296. <div class="header">
  297. <h2><?=$Name?>
  298. </h2>
  299. <div class="linkbox">
  300. <a href="collages.php" class="brackets">List of collections</a>
  301. <?php if (check_perms('site_collages_create')) { ?>
  302. <a href="collages.php?action=new" class="brackets">New collection</a>
  303. <?php } ?>
  304. <br /><br />
  305. <?php if (check_perms('site_collages_subscribe')) { ?>
  306. <a href="#" id="subscribelink<?=$CollageID?>" class="brackets"
  307. onclick="CollageSubscribe(<?=$CollageID?>); return false;"><?=(in_array($CollageID, $CollageSubscriptions) ? 'Unsubscribe' : 'Subscribe')?></a>
  308. <?php
  309. }
  310. if (check_perms('site_collages_delete') || (check_perms('site_edit_wiki') && !$Locked)) {
  311. ?>
  312. <a href="collages.php?action=edit&amp;collageid=<?=$CollageID?>"
  313. class="brackets">Edit description</a>
  314. <?php
  315. } else { ?>
  316. <span class="brackets">Locked</span>
  317. <?php
  318. }
  319. if (Bookmarks::has_bookmarked('collage', $CollageID)) {
  320. ?>
  321. <a href="#" id="bookmarklink_collage_<?=$CollageID?>"
  322. class="brackets"
  323. onclick="Unbookmark('collage', <?=$CollageID?>, 'Bookmark'); return false;">Remove
  324. bookmark</a>
  325. <?php
  326. } else { ?>
  327. <a href="#" id="bookmarklink_collage_<?=$CollageID?>"
  328. class="brackets"
  329. onclick="Bookmark('collage', <?=$CollageID?>, 'Remove bookmark'); return false;">Bookmark</a>
  330. <?php } ?>
  331. <!-- <a href="#" id="recommend" class="brackets">Recommend</a> -->
  332. <?php
  333. if (check_perms('site_collages_manage') && !$Locked) {
  334. ?>
  335. <a href="collages.php?action=manage&amp;collageid=<?=$CollageID?>"
  336. class="brackets">Manage torrents</a>
  337. <?php
  338. } ?>
  339. <a href="reports.php?action=report&amp;type=collage&amp;id=<?=$CollageID?>"
  340. class="brackets">Report collection</a>
  341. <?php if (check_perms('site_collages_delete') || $CreatorID == $LoggedUser['ID']) { ?>
  342. <a href="collages.php?action=delete&amp;collageid=<?=$CollageID?>&amp;auth=<?=$LoggedUser['AuthKey']?>"
  343. class="brackets" onclick="return confirm('Are you sure you want to delete this collage?');">Delete</a>
  344. <?php } ?>
  345. </div>
  346. </div>
  347. <?php /* Misc::display_recommend($CollageID, "collage"); */ ?>
  348. <div class="sidebar">
  349. <div class="box box_category">
  350. <div class="head"><strong>Category</strong></div>
  351. <div class="pad"><a
  352. href="collages.php?action=search&amp;cats[<?=(int)$CollageCategoryID?>]=1"><?=$CollageCats[(int)$CollageCategoryID]?></a></div>
  353. </div>
  354. <div class="box box_description">
  355. <div class="head"><strong>Description</strong></div>
  356. <div class="pad"><?=Text::full_format($Description)?>
  357. </div>
  358. </div>
  359. <?php
  360. // I'm actually commenting this out
  361. /*
  362. if (check_perms('zip_downloader')) {
  363. if (isset($LoggedUser['Collector'])) {
  364. list($ZIPList, $ZIPPrefs) = $LoggedUser['Collector'];
  365. $ZIPList = explode(':', $ZIPList);
  366. } else {
  367. $ZIPList = array('00', '11');
  368. $ZIPPrefs = 1;
  369. }
  370. ?>
  371. <div class="box box_zipdownload">
  372. <div class="head colhead_dark"><strong>Collector</strong></div>
  373. <div class="pad">
  374. <form class="download_form" name="zip" action="collages.php" method="post">
  375. <input type="hidden" name="action" value="download" />
  376. <input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
  377. <input type="hidden" name="collageid" value="<?=$CollageID?>" />
  378. <ul id="list" class="nobullet">
  379. <? foreach ($ZIPList as $ListItem) { ?>
  380. <li id="list<?=$ListItem?>">
  381. <input type="hidden" name="list[]" value="<?=$ListItem?>" />
  382. <span class="float_left"><?=$ZIPOptions[$ListItem]['2']?></span>
  383. <span class="remove remove_collector"><a href="#" onclick="remove_selection('<?=$ListItem?>'); return false;" class="float_right brackets">X</a></span>
  384. <br style="clear: all;" />
  385. </li>
  386. <? } ?>
  387. </ul>
  388. <select id="formats" style="width: 180px;">
  389. <?
  390. $OpenGroup = false;
  391. $LastGroupID = -1;
  392. foreach ($ZIPOptions as $Option) {
  393. list($GroupID, $OptionID, $OptName) = $Option;
  394. if ($GroupID != $LastGroupID) {
  395. $LastGroupID = $GroupID;
  396. if ($OpenGroup) {
  397. ?>
  398. </optgroup>
  399. <?php } ?>
  400. <optgroup label="<?=$ZIPGroups[$GroupID]?>">
  401. <?
  402. $OpenGroup = true;
  403. }
  404. ?>
  405. <option id="opt<?=$GroupID.$OptionID?>" value="<?=$GroupID.$OptionID?>"<? if (in_array($GroupID.$OptionID, $ZIPList)) { echo ' disabled="disabled"'; }?>><?=$OptName?></option>
  406. <?
  407. }
  408. ?>
  409. </optgroup>
  410. </select>
  411. <button type="button" onclick="add_selection();">+</button>
  412. <select name="preference" style="width: 210px;">
  413. <option value="0"<? if ($ZIPPrefs == 0) { echo ' selected="selected"'; } ?>>Prefer Original</option>
  414. <option value="1"<? if ($ZIPPrefs == 1) { echo ' selected="selected"'; } ?>>Prefer Best Seeded</option>
  415. <option value="2"<? if ($ZIPPrefs == 2) { echo ' selected="selected"'; } ?>>Prefer Bonus Tracks</option>
  416. </select>
  417. <input type="submit" style="width: 210px;" value="Download" />
  418. </form>
  419. </div>
  420. </div>
  421. <? }
  422. */
  423. ?>
  424. <div class="box box_info box_statistics_collage_torrents">
  425. <div class="head">
  426. <strong>Statistics</strong>
  427. </div>
  428. <ul class="stats nobullet">
  429. <li>
  430. Torrents: <?=number_format($NumGroups)?>
  431. </li>
  432. <?php if (!empty($TopArtists)) { ?>
  433. <li>
  434. Artists: <?=number_format(count($TopArtists))?>
  435. </li>
  436. <?php } ?>
  437. <li>
  438. Subscribers: <?=number_format((int)$Subscribers)?>
  439. </li>
  440. <li>
  441. Built by <?=number_format(count($UserAdditions))?>
  442. user<?=(count($UserAdditions) > 1 ? 's' : '')?>
  443. </li>
  444. <li>
  445. Last updated: <?=time_diff($Updated)?>
  446. </li>
  447. </ul>
  448. </div>
  449. <div class="box box_tags">
  450. <div class="head">
  451. <strong>Top Tags</strong>
  452. </div>
  453. <div class="pad tags">
  454. <ol style="padding-left: 5px">
  455. <?php Tags::format_top(5, 'collages.php?action=search&amp;tags='); ?>
  456. </ol>
  457. </div>
  458. </div>
  459. <?php if (!empty($TopArtists)) { ?>
  460. <div class="box box_artists">
  461. <div class="head">
  462. <strong>Top Artists</strong>
  463. </div>
  464. <div class="pad">
  465. <ol style="padding-left: 5px;">
  466. <?php
  467. uasort($TopArtists, 'compare');
  468. $i = 0;
  469. foreach ($TopArtists as $ID => $Artist) {
  470. $i++;
  471. if ($i > 10) {
  472. break;
  473. } ?>
  474. <li>
  475. <a href="artist.php?id=<?=$ID?>"><?=$Artist['name']?></a> (<?=number_format($Artist['count'])?>)
  476. </li>
  477. <?php
  478. } ?>
  479. </ol>
  480. </div>
  481. </div>
  482. <?php } ?>
  483. <div class="box box_contributors">
  484. <div class="head"><strong>Top Contributors</strong></div>
  485. <div class="pad">
  486. <ol style="padding-left: 5px;">
  487. <?php
  488. arsort($UserAdditions);
  489. $i = 0;
  490. foreach ($UserAdditions as $UserID => $Additions) {
  491. $i++;
  492. if ($i > 5) {
  493. break;
  494. } ?>
  495. <li>
  496. <?=Users::format_username($UserID, false, false, false)?>
  497. (<?=number_format($Additions)?>)
  498. </li>
  499. <?php
  500. } ?>
  501. </ol>
  502. </div>
  503. </div>
  504. <?php if (check_perms('site_collages_manage') && !isset($PreventAdditions)) { ?>
  505. <div class="box box_addtorrent">
  506. <div class="head"><strong>Add Torrent Group</strong><span class="float_right"><a href="#"
  507. onclick="$('.add_torrent_container').toggle_class('hidden'); this.innerHTML = (this.innerHTML == 'Batch add' ? 'Individual add' : 'Batch add'); return false;"
  508. class="brackets">Batch add</a></span></div>
  509. <div class="pad add_torrent_container">
  510. <form class="add_form" name="torrent" action="collages.php" method="post">
  511. <input type="hidden" name="action" value="add_torrent" />
  512. <input type="hidden" name="auth"
  513. value="<?=$LoggedUser['AuthKey']?>" />
  514. <input type="hidden" name="collageid"
  515. value="<?=$CollageID?>" />
  516. <div>
  517. <input type="text" size="20" name="url" />
  518. </div>
  519. <div class="submit_div">
  520. <input type="submit" value="Add" />
  521. </div>
  522. <span style="font-style: italic;">Enter the URL of a torrent group on the site.</span>
  523. </form>
  524. </div>
  525. <div class="pad hidden add_torrent_container">
  526. <form class="add_form" name="torrents" action="collages.php" method="post">
  527. <input type="hidden" name="action" value="add_torrent_batch" />
  528. <input type="hidden" name="auth"
  529. value="<?=$LoggedUser['AuthKey']?>" />
  530. <input type="hidden" name="collageid"
  531. value="<?=$CollageID?>" />
  532. <div>
  533. <textarea name="urls" rows="5" cols="25"
  534. style="white-space: pre; word-wrap: normal; overflow: auto;"></textarea>
  535. </div>
  536. <div class="submit_div">
  537. <input type="submit" value="Add" />
  538. </div>
  539. <span style="font-style: italic;">Enter the URLs of torrent groups on the site, one per line.</span>
  540. </form>
  541. </div>
  542. </div>
  543. <?php } ?>
  544. <h3>Comments</h3>
  545. <?php
  546. if ($CommentList === null) {
  547. $DB->query("
  548. SELECT
  549. c.ID,
  550. c.Body,
  551. c.AuthorID,
  552. um.Username,
  553. c.AddedTime
  554. FROM comments AS c
  555. LEFT JOIN users_main AS um ON um.ID = c.AuthorID
  556. WHERE c.Page = 'collages'
  557. AND c.PageID = $CollageID
  558. ORDER BY c.ID DESC
  559. LIMIT 15");
  560. $CommentList = $DB->to_array(false, MYSQLI_NUM);
  561. }
  562. foreach ($CommentList as $Comment) {
  563. list($CommentID, $Body, $UserID, $Username, $CommentTime) = $Comment; ?>
  564. <div class="box comment">
  565. <div class="head">
  566. <?=Users::format_username($UserID, false, false, false) ?>
  567. <?=time_diff($CommentTime) ?>
  568. <br />
  569. <a href="reports.php?action=report&amp;type=comment&amp;id=<?=$CommentID?>"
  570. class="brackets">Report</a>
  571. </div>
  572. <div class="pad"><?=Text::full_format($Body)?>
  573. </div>
  574. </div>
  575. <?php
  576. }
  577. ?>
  578. <div class="box pad">
  579. <a href="collages.php?action=comments&amp;collageid=<?=$CollageID?>"
  580. class="brackets">View all comments</a>
  581. </div>
  582. <?php
  583. if (!$LoggedUser['DisablePosting']) {
  584. ?>
  585. <div class="box box_addcomment">
  586. <div class="head"><strong>Comment</strong></div>
  587. <form class="send_form" name="comment" id="quickpostform" onsubmit="quickpostform.submit_button.disabled = true;"
  588. action="comments.php" method="post">
  589. <input type="hidden" name="action" value="take_post" />
  590. <input type="hidden" name="page" value="collages" />
  591. <input type="hidden" name="auth"
  592. value="<?=$LoggedUser['AuthKey']?>" />
  593. <input type="hidden" name="pageid" value="<?=$CollageID?>" />
  594. <div class="pad">
  595. <div>
  596. <textarea name="body" cols="24" rows="5"></textarea>
  597. </div>
  598. <div class="submit_div">
  599. <input type="submit" id="submit_button" value="Post" />
  600. </div>
  601. </div>
  602. </form>
  603. </div>
  604. <?php
  605. }
  606. ?>
  607. </div>
  608. <div class="main_column">
  609. <?php
  610. if ($CollageCovers != 0) { ?>
  611. <div id="coverart" class="box">
  612. <div class="head" id="coverhead"><strong>Pictures</strong></div>
  613. <div class="collage_images" id="collage_page0" data-wall-child=".collage_image" data-wall-size="4"
  614. data-wall-min="2">
  615. <?php
  616. $Page1 = array_slice($Collage, 0, $CollageCovers);
  617. foreach ($Page1 as $Group) {
  618. echo $Group;
  619. }
  620. ?>
  621. </div>
  622. </div>
  623. <?php if ($NumGroups > $CollageCovers) { ?>
  624. <div class="linkbox pager" style="clear: left;" id="pageslinksdiv">
  625. <span id="firstpage" class="invisible">
  626. <a href="#" class="pageslink" onclick="collageShow.page(0, this); return false;">
  627. <strong>&laquo; First</strong>
  628. </a> |
  629. </span>
  630. <span id="prevpage" class="invisible">
  631. <a href="#" class="pageslink" onclick="collageShow.prevPage(); return false;">
  632. <strong>&lsaquo; Prev</strong>
  633. </a> |
  634. </span>
  635. <?php for ($i = 0; $i < $NumGroups / $CollageCovers; $i++) { ?>
  636. <span id="pagelink<?=$i?>"
  637. class="<?=(($i > 4) ? 'hidden' : '')?><?=(($i == 0) ? 'selected' : '')?>">
  638. <a href="#" class="pageslink"
  639. onclick="collageShow.page(<?=$i?>, this); return false;">
  640. <strong><?=$CollageCovers * $i + 1?>-<?=min($NumGroups, $CollageCovers * ($i + 1))?></strong>
  641. </a>
  642. <?=(($i != ceil($NumGroups / $CollageCovers) - 1) ? ' | ' : '')?>
  643. </span>
  644. <?php } ?>
  645. <span id="nextbar"
  646. class="<?=($NumGroups / $CollageCovers > 5) ? 'hidden' : ''?>">
  647. | </span>
  648. <span id="nextpage">
  649. <a href="#" class="pageslink" onclick="collageShow.nextPage(); return false;">
  650. <strong>Next &rsaquo;</strong>
  651. </a>
  652. </span>
  653. <span id="lastpage"
  654. class="<?=(ceil($NumGroups / $CollageCovers) == 2 ? 'invisible' : '')?>">
  655. |
  656. <a href="#" class="pageslink"
  657. onclick="collageShow.page(<?=ceil($NumGroups / $CollageCovers) - 1?>, this); return false;">
  658. <strong>Last&nbsp;&raquo;</strong>
  659. </a>
  660. </span>
  661. </div>
  662. <script type="text/javascript">
  663. $(() => collageShow.init( <?=json_encode($CollagePages)?> ));
  664. </script>
  665. <?php
  666. }
  667. }
  668. ?>
  669. <div class="box">
  670. <table class="torrent_table grouping cats" id="discog_table">
  671. <tr class="colhead_dark">
  672. <td>
  673. <!-- Expand/Collapse -->
  674. </td>
  675. <td>
  676. <!-- Category -->
  677. </td>
  678. <td width="70%"><strong>Torrents</strong></td>
  679. <td>Size</td>
  680. <td class="sign snatches">
  681. </td>
  682. <td class="sign seeders">
  683. &uarr;
  684. </td>
  685. <td class="sign leechers">
  686. &darr;
  687. </td>
  688. </tr>
  689. <?=$TorrentTable?>
  690. </table>
  691. </div>
  692. </div>
  693. </div>
  694. <?php View::show_footer();