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.

subscribed_collages.php 9.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  1. <?
  2. /*
  3. User collage subscription page
  4. */
  5. if (!check_perms('site_collages_subscribe')) {
  6. error(403);
  7. }
  8. View::show_header('Subscribed collections','browse,collage');
  9. $ShowAll = !empty($_GET['showall']);
  10. if (!$ShowAll) {
  11. $sql = "
  12. SELECT
  13. c.ID,
  14. c.Name,
  15. c.NumTorrents,
  16. s.LastVisit
  17. FROM collages AS c
  18. JOIN users_collage_subs AS s ON s.CollageID = c.ID
  19. JOIN collages_torrents AS ct ON ct.CollageID = c.ID
  20. WHERE s.UserID = $LoggedUser[ID] AND c.Deleted = '0'
  21. AND ct.AddedOn > s.LastVisit
  22. GROUP BY c.ID";
  23. } else {
  24. $sql = "
  25. SELECT
  26. c.ID,
  27. c.Name,
  28. c.NumTorrents,
  29. s.LastVisit
  30. FROM collages AS c
  31. JOIN users_collage_subs AS s ON s.CollageID = c.ID
  32. LEFT JOIN collages_torrents AS ct ON ct.CollageID = c.ID
  33. WHERE s.UserID = $LoggedUser[ID] AND c.Deleted = '0'
  34. GROUP BY c.ID";
  35. }
  36. $DB->query($sql);
  37. $NumResults = $DB->record_count();
  38. $CollageSubs = $DB->to_array();
  39. ?>
  40. <div class="thin">
  41. <div class="header">
  42. <h2>Subscribed collections<?=($ShowAll ? '' : ' with new additions')?></h2>
  43. <div class="linkbox">
  44. <?
  45. if ($ShowAll) {
  46. ?>
  47. <br /><br />
  48. <a href="userhistory.php?action=subscribed_collages&amp;showall=0" class="brackets">Only display collections with new additions</a>&nbsp;&nbsp;&nbsp;
  49. <?
  50. } else {
  51. ?>
  52. <br /><br />
  53. <a href="userhistory.php?action=subscribed_collages&amp;showall=1" class="brackets">Show all subscribed collections</a>&nbsp;&nbsp;&nbsp;
  54. <?
  55. }
  56. ?>
  57. <a href="userhistory.php?action=catchup_collages&amp;auth=<?=$LoggedUser['AuthKey']?>" class="brackets">Catch up</a>&nbsp;&nbsp;&nbsp;
  58. </div>
  59. </div>
  60. <?
  61. if (!$NumResults) {
  62. ?>
  63. <div class="center">
  64. No subscribed collections<?=($ShowAll ? '' : ' with new additions')?>
  65. </div>
  66. <?
  67. } else {
  68. $HideGroup = '';
  69. $ActionTitle = 'Hide';
  70. $ActionURL = 'hide';
  71. $ShowGroups = 0;
  72. foreach ($CollageSubs as $Collage) {
  73. unset($TorrentTable);
  74. list($CollageID, $CollageName, $CollageSize, $LastVisit) = $Collage;
  75. $RS = $DB->query("
  76. SELECT GroupID
  77. FROM collages_torrents
  78. WHERE CollageID = $CollageID
  79. AND AddedOn > '" . db_string($LastVisit) . "'
  80. ORDER BY AddedOn");
  81. $NewTorrentCount = $DB->record_count();
  82. $GroupIDs = $DB->collect('GroupID', false);
  83. if (count($GroupIDs) > 0) {
  84. $TorrentList = Torrents::get_groups($GroupIDs);
  85. } else {
  86. $TorrentList = [];
  87. }
  88. $Artists = Artists::get_artists($GroupIDs);
  89. $Number = 0;
  90. foreach ($GroupIDs as $GroupID) {
  91. if (!isset($TorrentList[$GroupID])) {
  92. continue;
  93. }
  94. $Group = $TorrentList[$GroupID];
  95. extract(Torrents::array_group($Group));
  96. $DisplayName = '';
  97. $TorrentTags = new Tags($TagList);
  98. if (!empty($ExtendedArtists[1]) || !empty($ExtendedArtists[4]) || !empty($ExtendedArtists[5]) || !empty($ExtendedArtists[6])) {
  99. unset($ExtendedArtists[2]);
  100. unset($ExtendedArtists[3]);
  101. $DisplayName .= Artists::display_artists($ExtendedArtists);
  102. } elseif (count($Artists) > 0) {
  103. $DisplayName .= Artists::display_artists(array('1' => $Artists));
  104. }
  105. $DisplayName .= "<a href=\"torrents.php?id=$GroupID\" class=\"tooltip\" title=\"View torrent group\" ";
  106. if (!isset($LoggedUser['CoverArt']) || $LoggedUser['CoverArt']) {
  107. $DisplayName .= "onmouseover=\"getCover(event)\" data-cover=\"".ImageTools::process($WikiImage)."\" onmouseleave=\"ungetCover(event)\" ";
  108. }
  109. $DisplayName .= "dir=\"ltr\">$GroupName</a>";
  110. if ($GroupYear > 0) {
  111. $DisplayName = "$DisplayName [$GroupYear]";
  112. }
  113. $SnatchedGroupClass = $GroupFlags['IsSnatched'] ? ' snatched_group' : '';
  114. // Start an output buffer, so we can store this output in $TorrentTable
  115. ob_start();
  116. if (count($Torrents) > 1 || $GroupCategoryID == 1) {
  117. ?>
  118. <tr class="group discog<?=$SnatchedGroupClass?>" id="group_<?=$CollageID?><?=$GroupID?>">
  119. <td class="center">
  120. <div id="showimg_<?=$CollageID?><?=$GroupID?>" class="<?=($ShowGroups ? 'hide' : 'show')?>_torrents">
  121. <a href="#" class="tooltip show_torrents_link" onclick="toggle_group(<?=$CollageID?><?=$GroupID?>, this, event);" title="Expand this group. Hold &quot;Ctrl&quot; while clicking to expand all groups on this page."></a>
  122. </div>
  123. </td>
  124. <td colspan="5" class="big_info">
  125. <div class="group_info clear">
  126. <strong><?=$DisplayName?></strong>
  127. <div class="tags"><?=$TorrentTags->format()?></tags>
  128. </div>
  129. </td>
  130. </tr>
  131. <?
  132. foreach ($Torrents as $TorrentID => $Torrent) {
  133. $SnatchedTorrentClass = $Torrent['IsSnatched'] ? ' snatched_torrent' : '';
  134. ?>
  135. <tr class="group_torrent groupid_<?=$CollageID . $GroupID?> edition_<?=$EditionID?> hidden<?=$SnatchedTorrentClass . $SnatchedGroupClass?>">
  136. <td colspan="2">
  137. <span>
  138. <a href="torrents.php?action=download&amp;id=<?=$TorrentID?>&amp;authkey=<?=$LoggedUser['AuthKey']?>&amp;torrent_pass=<?=$LoggedUser['torrent_pass']?>" title="Download" class="brackets tooltip">DL</a>
  139. </span>
  140. &nbsp;&nbsp;&raquo;&nbsp; <a href="torrents.php?id=<?=$GroupID?>&amp;torrentid=<?=$TorrentID?>"><?=Torrents::torrent_info($Torrent)?></a>
  141. </td>
  142. <td class="number_column nobr"><?=Format::get_size($Torrent['Size'])?></td>
  143. <td class="number_column"><?=number_format($Torrent['Snatched'])?></td>
  144. <td class="number_column<?=($Torrent['Seeders'] == 0) ? ' r00' : ''?>"><?=number_format($Torrent['Seeders'])?></td>
  145. <td class="number_column"><?=number_format($Torrent['Leechers'])?></td>
  146. </tr>
  147. <?
  148. }
  149. } else {
  150. // Viewing a type that does not require grouping
  151. list($TorrentID, $Torrent) = each($Torrents);
  152. $DisplayName = "<a href=\"torrents.php?id=$GroupID\" class=\"tooltip\" title=\"View torrent group\" ";
  153. if (!isset($LoggedUser['CoverArt']) || $LoggedUser['CoverArt']) {
  154. $DisplayName .= "onmouseover=\"getCover(event)\" data-cover=\"".ImageTools::process($WikiImage)."\" onmouseleave=\"ungetCover(event)\" ";
  155. }
  156. $DisplayName .= "dir=\"ltr\">$GroupName</a>";
  157. if ($Torrent['IsSnatched']) {
  158. $DisplayName .= ' ' . Format::torrent_label('Snatched!');
  159. }
  160. if (!empty($Torrent['FreeTorrent'])) {
  161. $DisplayName .= ' ' . Format::torrent_label('Freeleech!');
  162. }
  163. $SnatchedTorrentClass = $Torrent['IsSnatched'] ? ' snatched_torrent' : '';
  164. ?>
  165. <tr class="torrent<?=$SnatchedTorrentClass?>" id="group_<?=$CollageID . $GroupID?>">
  166. <td></td>
  167. <td class="center">
  168. <div title="<?=$TorrentTags->title()?>" class="tooltip <?=Format::css_category($GroupCategoryID)?> <?=$TorrentTags->css_name()?>">
  169. </div>
  170. </td>
  171. <td class="big_info">
  172. <div class="group_info clear">
  173. <span>
  174. [ <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>
  175. | <a href="reportsv2.php?action=report&amp;id=<?=$TorrentID?>" class="tooltip" title="Report">RP</a> ]
  176. </span>
  177. <strong><?=$DisplayName?></strong>
  178. <div class="tags"><?=$TorrentTags->format()?></div>
  179. </div>
  180. </td>
  181. <td class="number_column nobr"><?=Format::get_size($Torrent['Size'])?></td>
  182. <td class="number_column"><?=number_format($Torrent['Snatched'])?></td>
  183. <td class="number_column<?=($Torrent['Seeders'] == 0) ? ' r00' : ''?>"><?=number_format($Torrent['Seeders'])?></td>
  184. <td class="number_column"><?=number_format($Torrent['Leechers'])?></td>
  185. </tr>
  186. <?
  187. }
  188. $TorrentTable .= ob_get_clean();
  189. } ?>
  190. <!-- I hate that proton is making me do it like this -->
  191. <!--<div class="head colhead_dark" style="margin-top: 8px;">-->
  192. <table style="margin-top: 8px;" class="subscribed_collages_table">
  193. <tr class="colhead_dark">
  194. <td>
  195. <span class="float_left">
  196. <strong><a href="collage.php?id=<?=$CollageID?>"><?=$CollageName?></a></strong> (<?=$NewTorrentCount?> new torrent<?=($NewTorrentCount == 1 ? '' : 's')?>)
  197. </span>&nbsp;
  198. <span class="float_right">
  199. <a data-toggle-target="#discog_table_<?=$CollageID?>" data-toggle-replace="<?=($ShowAll ? 'Hide' : 'Show')?>" class="brackets"><?=($ShowAll ? 'Show' : 'Hide')?></a>&nbsp;&nbsp;&nbsp;<a href="userhistory.php?action=catchup_collages&amp;auth=<?=$LoggedUser['AuthKey']?>&amp;collageid=<?=$CollageID?>" class="brackets">Catch up</a>&nbsp;&nbsp;&nbsp;<a href="#" onclick="CollageSubscribe(<?=$CollageID?>); return false;" id="subscribelink<?=$CollageID?>" class="brackets">Unsubscribe</a>
  200. </span>
  201. </td>
  202. </tr>
  203. </table>
  204. <!--</div>-->
  205. <table class="torrent_table<?=$ShowAll ? ' hidden' : ''?>" id="discog_table_<?=$CollageID?>">
  206. <tr class="colhead">
  207. <td width="1%"></td>
  208. <td></td>
  209. <td width="70%"><strong>Torrents</strong></td>
  210. <td>Size</td>
  211. <td class="sign snatches">
  212. <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>
  213. </td>
  214. <td class="sign seeders">
  215. <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>
  216. </td>
  217. <td class="sign leechers">
  218. <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>
  219. </td>
  220. </tr>
  221. <?=$TorrentTable?>
  222. </table>
  223. <?
  224. } // foreach ()
  225. } // else -- if (empty($NumResults))
  226. ?>
  227. </div>
  228. <?
  229. View::show_footer();
  230. ?>