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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577
  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 .= 'onmouseover="getCover(event)" data-cover="'.ImageTools::process($WikiImage, 'thumb').'" onmouseleave="ungetCover(event)" ';
  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. <strong><?=$DisplayName?></strong>
  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. <strong><?=$DisplayName?></strong>
  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. for ($i = 0; $i < $NumGroups / $CollageCovers; $i++) {
  217. $Groups = array_slice($Collage, $i * $CollageCovers, $CollageCovers);
  218. $CollagePage = '';
  219. foreach ($Groups as $Group) {
  220. $CollagePage .= $Group;
  221. }
  222. $CollagePages[] = $CollagePage;
  223. }
  224. View::show_header($Name, 'browse,collage,bbcode,recommend,wall');
  225. ?>
  226. <div class="thin">
  227. <div class="header">
  228. <h2><?=$Name?></h2>
  229. <div class="linkbox">
  230. <a href="collages.php" class="brackets">List of collections</a>
  231. <? if (check_perms('site_collages_create')) { ?>
  232. <a href="collages.php?action=new" class="brackets">New collection</a>
  233. <? } ?>
  234. <br /><br />
  235. <? if (check_perms('site_collages_subscribe')) { ?>
  236. <a href="#" id="subscribelink<?=$CollageID?>" class="brackets" onclick="CollageSubscribe(<?=$CollageID?>); return false;"><?=(in_array($CollageID, $CollageSubscriptions) ? 'Unsubscribe' : 'Subscribe')?></a>
  237. <?
  238. }
  239. if (check_perms('site_collages_delete') || (check_perms('site_edit_wiki') && !$Locked)) {
  240. ?>
  241. <a href="collages.php?action=edit&amp;collageid=<?=$CollageID?>" class="brackets">Edit description</a>
  242. <? } else { ?>
  243. <span class="brackets">Locked</span>
  244. <?
  245. }
  246. if (Bookmarks::has_bookmarked('collage', $CollageID)) {
  247. ?>
  248. <a href="#" id="bookmarklink_collage_<?=$CollageID?>" class="brackets" onclick="Unbookmark('collage', <?=$CollageID?>, 'Bookmark'); return false;">Remove bookmark</a>
  249. <? } else { ?>
  250. <a href="#" id="bookmarklink_collage_<?=$CollageID?>" class="brackets" onclick="Bookmark('collage', <?=$CollageID?>, 'Remove bookmark'); return false;">Bookmark</a>
  251. <? } ?>
  252. <!-- <a href="#" id="recommend" class="brackets">Recommend</a> -->
  253. <?
  254. if (check_perms('site_collages_manage') && !$Locked) {
  255. ?>
  256. <a href="collages.php?action=manage&amp;collageid=<?=$CollageID?>" class="brackets">Manage torrents</a>
  257. <? } ?>
  258. <a href="reports.php?action=report&amp;type=collage&amp;id=<?=$CollageID?>" class="brackets">Report collection</a>
  259. <? if (check_perms('site_collages_delete') || $CreatorID == $LoggedUser['ID']) { ?>
  260. <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>
  261. <? } ?>
  262. </div>
  263. </div>
  264. <? /* Misc::display_recommend($CollageID, "collage"); */ ?>
  265. <div class="sidebar">
  266. <div class="box box_category">
  267. <div class="head"><strong>Category</strong></div>
  268. <div class="pad"><a href="collages.php?action=search&amp;cats[<?=(int)$CollageCategoryID?>]=1"><?=$CollageCats[(int)$CollageCategoryID]?></a></div>
  269. </div>
  270. <div class="box box_description">
  271. <div class="head"><strong>Description</strong></div>
  272. <div class="pad"><?=Text::full_format($Description)?></div>
  273. </div>
  274. <?
  275. // I'm actually commenting this out
  276. /*
  277. if (check_perms('zip_downloader')) {
  278. if (isset($LoggedUser['Collector'])) {
  279. list($ZIPList, $ZIPPrefs) = $LoggedUser['Collector'];
  280. $ZIPList = explode(':', $ZIPList);
  281. } else {
  282. $ZIPList = array('00', '11');
  283. $ZIPPrefs = 1;
  284. }
  285. ?>
  286. <div class="box box_zipdownload">
  287. <div class="head colhead_dark"><strong>Collector</strong></div>
  288. <div class="pad">
  289. <form class="download_form" name="zip" action="collages.php" method="post">
  290. <input type="hidden" name="action" value="download" />
  291. <input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
  292. <input type="hidden" name="collageid" value="<?=$CollageID?>" />
  293. <ul id="list" class="nobullet">
  294. <? foreach ($ZIPList as $ListItem) { ?>
  295. <li id="list<?=$ListItem?>">
  296. <input type="hidden" name="list[]" value="<?=$ListItem?>" />
  297. <span class="float_left"><?=$ZIPOptions[$ListItem]['2']?></span>
  298. <span class="remove remove_collector"><a href="#" onclick="remove_selection('<?=$ListItem?>'); return false;" class="float_right brackets">X</a></span>
  299. <br style="clear: all;" />
  300. </li>
  301. <? } ?>
  302. </ul>
  303. <select id="formats" style="width: 180px;">
  304. <?
  305. $OpenGroup = false;
  306. $LastGroupID = -1;
  307. foreach ($ZIPOptions as $Option) {
  308. list($GroupID, $OptionID, $OptName) = $Option;
  309. if ($GroupID != $LastGroupID) {
  310. $LastGroupID = $GroupID;
  311. if ($OpenGroup) {
  312. ?>
  313. </optgroup>
  314. <? } ?>
  315. <optgroup label="<?=$ZIPGroups[$GroupID]?>">
  316. <?
  317. $OpenGroup = true;
  318. }
  319. ?>
  320. <option id="opt<?=$GroupID.$OptionID?>" value="<?=$GroupID.$OptionID?>"<? if (in_array($GroupID.$OptionID, $ZIPList)) { echo ' disabled="disabled"'; }?>><?=$OptName?></option>
  321. <?
  322. }
  323. ?>
  324. </optgroup>
  325. </select>
  326. <button type="button" onclick="add_selection();">+</button>
  327. <select name="preference" style="width: 210px;">
  328. <option value="0"<? if ($ZIPPrefs == 0) { echo ' selected="selected"'; } ?>>Prefer Original</option>
  329. <option value="1"<? if ($ZIPPrefs == 1) { echo ' selected="selected"'; } ?>>Prefer Best Seeded</option>
  330. <option value="2"<? if ($ZIPPrefs == 2) { echo ' selected="selected"'; } ?>>Prefer Bonus Tracks</option>
  331. </select>
  332. <input type="submit" style="width: 210px;" value="Download" />
  333. </form>
  334. </div>
  335. </div>
  336. <? }
  337. */
  338. ?>
  339. <div class="box box_info box_statistics_collage_torrents">
  340. <div class="head"><strong>Statistics</strong></div>
  341. <ul class="stats nobullet">
  342. <li>Torrents: <?=number_format($NumGroups)?></li>
  343. <? if (!empty($TopArtists)) { ?>
  344. <li>Artists: <?=number_format(count($TopArtists))?></li>
  345. <? } ?>
  346. <li>Subscribers: <?=number_format((int)$Subscribers)?></li>
  347. <li>Built by <?=number_format(count($UserAdditions))?> user<?=(count($UserAdditions) > 1 ? 's' : '')?></li>
  348. <li>Last updated: <?=time_diff($Updated)?></li>
  349. </ul>
  350. </div>
  351. <div class="box box_tags">
  352. <div class="head"><strong>Top Tags</strong></div>
  353. <div class="pad tags">
  354. <ol style="padding-left: 5px">
  355. <?
  356. Tags::format_top(5, 'collages.php?action=search&amp;tags=');
  357. ?>
  358. </ol>
  359. </div>
  360. </div>
  361. <? if (!empty($TopArtists)) { ?>
  362. <div class="box box_artists">
  363. <div class="head"><strong>Top Artists</strong></div>
  364. <div class="pad">
  365. <ol style="padding-left: 5px;">
  366. <?
  367. uasort($TopArtists, 'compare');
  368. $i = 0;
  369. foreach ($TopArtists as $ID => $Artist) {
  370. $i++;
  371. if ($i > 10) {
  372. break;
  373. }
  374. ?>
  375. <li><a href="artist.php?id=<?=$ID?>"><?=$Artist['name']?></a> (<?=number_format($Artist['count'])?>)</li>
  376. <?
  377. }
  378. ?>
  379. </ol>
  380. </div>
  381. </div>
  382. <? } ?>
  383. <div class="box box_contributors">
  384. <div class="head"><strong>Top Contributors</strong></div>
  385. <div class="pad">
  386. <ol style="padding-left: 5px;">
  387. <?
  388. arsort($UserAdditions);
  389. $i = 0;
  390. foreach ($UserAdditions as $UserID => $Additions) {
  391. $i++;
  392. if ($i > 5) {
  393. break;
  394. }
  395. ?>
  396. <li><?=Users::format_username($UserID, false, false, false)?> (<?=number_format($Additions)?>)</li>
  397. <?
  398. }
  399. ?>
  400. </ol>
  401. </div>
  402. </div>
  403. <? if (check_perms('site_collages_manage') && !isset($PreventAdditions)) { ?>
  404. <div class="box box_addtorrent">
  405. <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>
  406. <div class="pad add_torrent_container">
  407. <form class="add_form" name="torrent" action="collages.php" method="post">
  408. <input type="hidden" name="action" value="add_torrent" />
  409. <input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
  410. <input type="hidden" name="collageid" value="<?=$CollageID?>" />
  411. <div class="field_div">
  412. <input type="text" size="20" name="url" />
  413. </div>
  414. <div class="submit_div">
  415. <input type="submit" value="Add" />
  416. </div>
  417. <span style="font-style: italic;">Enter the URL of a torrent group on the site.</span>
  418. </form>
  419. </div>
  420. <div class="pad hidden add_torrent_container">
  421. <form class="add_form" name="torrents" action="collages.php" method="post">
  422. <input type="hidden" name="action" value="add_torrent_batch" />
  423. <input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
  424. <input type="hidden" name="collageid" value="<?=$CollageID?>" />
  425. <div class="field_div">
  426. <textarea name="urls" rows="5" cols="25" style="white-space: pre; word-wrap: normal; overflow: auto;"></textarea>
  427. </div>
  428. <div class="submit_div">
  429. <input type="submit" value="Add" />
  430. </div>
  431. <span style="font-style: italic;">Enter the URLs of torrent groups on the site, one per line.</span>
  432. </form>
  433. </div>
  434. </div>
  435. <? } ?>
  436. <h3>Comments</h3>
  437. <?
  438. if ($CommentList === null) {
  439. $DB->query("
  440. SELECT
  441. c.ID,
  442. c.Body,
  443. c.AuthorID,
  444. um.Username,
  445. c.AddedTime
  446. FROM comments AS c
  447. LEFT JOIN users_main AS um ON um.ID = c.AuthorID
  448. WHERE c.Page = 'collages'
  449. AND c.PageID = $CollageID
  450. ORDER BY c.ID DESC
  451. LIMIT 15");
  452. $CommentList = $DB->to_array(false, MYSQLI_NUM);
  453. }
  454. foreach ($CommentList as $Comment) {
  455. list($CommentID, $Body, $UserID, $Username, $CommentTime) = $Comment;
  456. ?>
  457. <div class="box comment">
  458. <div class="head">
  459. <?=Users::format_username($UserID, false, false, false) ?> <?=time_diff($CommentTime) ?>
  460. <br />
  461. <a href="reports.php?action=report&amp;type=comment&amp;id=<?=$CommentID?>" class="brackets">Report</a>
  462. </div>
  463. <div class="pad"><?=Text::full_format($Body)?></div>
  464. </div>
  465. <?
  466. }
  467. ?>
  468. <div class="box pad">
  469. <a href="collages.php?action=comments&amp;collageid=<?=$CollageID?>" class="brackets">View all comments</a>
  470. </div>
  471. <?
  472. if (!$LoggedUser['DisablePosting']) {
  473. ?>
  474. <div class="box box_addcomment">
  475. <div class="head"><strong>Add comment</strong></div>
  476. <form class="send_form" name="comment" id="quickpostform" onsubmit="quickpostform.submit_button.disabled = true;" action="comments.php" method="post">
  477. <input type="hidden" name="action" value="take_post" />
  478. <input type="hidden" name="page" value="collages" />
  479. <input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
  480. <input type="hidden" name="pageid" value="<?=$CollageID?>" />
  481. <div class="pad">
  482. <div class="field_div">
  483. <textarea name="body" cols="24" rows="5"></textarea>
  484. </div>
  485. <div class="submit_div">
  486. <input type="submit" id="submit_button" value="Add comment" />
  487. </div>
  488. </div>
  489. </form>
  490. </div>
  491. <?
  492. }
  493. ?>
  494. </div>
  495. <div class="main_column">
  496. <?
  497. if ($CollageCovers != 0) { ?>
  498. <div id="coverart" class="box">
  499. <div class="head" id="coverhead"><strong>Cover Art</strong></div>
  500. <div class="collage_images" id="collage_page0" data-wall-child=".collage_image" data-wall-size="4" data-wall-min="2">
  501. <?
  502. $Page1 = array_slice($Collage, 0, $CollageCovers);
  503. foreach ($Page1 as $Group) {
  504. echo $Group;
  505. }
  506. ?>
  507. </div>
  508. </div>
  509. <? if ($NumGroups > $CollageCovers) { ?>
  510. <div class="linkbox pager" style="clear: left;" id="pageslinksdiv">
  511. <span id="firstpage" class="invisible"><a href="#" class="pageslink" onclick="collageShow.page(0, this); return false;"><strong>&lt;&lt; First</strong></a> | </span>
  512. <span id="prevpage" class="invisible"><a href="#" class="pageslink" onclick="collageShow.prevPage(); return false;"><strong>&lt; Prev</strong></a> | </span>
  513. <? for ($i = 0; $i < $NumGroups / $CollageCovers; $i++) { ?>
  514. <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>
  515. <? } ?>
  516. <span id="nextbar" class="<?=($NumGroups / $CollageCovers > 5) ? 'hidden' : ''?>"> | </span>
  517. <span id="nextpage"><a href="#" class="pageslink" onclick="collageShow.nextPage(); return false;"><strong>Next &gt;</strong></a></span>
  518. <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>
  519. </div>
  520. <script type="text/javascript">//<![CDATA[
  521. $(document).ready(function(){collageShow.init(<?=json_encode($CollagePages)?>)});
  522. //]]></script>
  523. <?
  524. }
  525. }
  526. ?>
  527. <div class="box">
  528. <table class="torrent_table grouping cats" id="discog_table">
  529. <tr class="colhead_dark">
  530. <td><!-- expand/collapse --></td>
  531. <td><!-- Category --></td>
  532. <td width="70%"><strong>Torrents</strong></td>
  533. <td>Size</td>
  534. <td class="sign snatches">
  535. <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>
  536. </td>
  537. <td class="sign seeders">
  538. <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>
  539. </td>
  540. <td class="sign leechers">
  541. <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>
  542. </td>
  543. </tr>
  544. <?=$TorrentTable?>
  545. </table>
  546. </div>
  547. </div>
  548. </div>
  549. <?
  550. View::show_footer();
  551. ?>