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

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