Oppaitime'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 23KB

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