PageRenderTime 27ms CodeModel.GetById 33ms RepoModel.GetById 0ms app.codeStats 0ms

/templates/we1rdo/spots.inc.php

https://github.com/caddyladdy/spotweb
PHP | 188 lines | 158 code | 21 blank | 9 comment | 53 complexity | 9a4bdfdd9775e5aa44a77788b3db82f1 MD5 | raw file
  1. <?php
  2. /* Render de header en filter templates */
  3. if (!isset($data['spotsonly'])) {
  4. require_once "includes/header.inc.php";
  5. require_once "includes/filters.inc.php";
  6. } # if
  7. // We definieeren hier een aantal settings zodat we niet steeds dezelfde check hoeven uit te voeren
  8. $show_nzb_button = $tplHelper->allowed(SpotSecurity::spotsec_retrieve_nzb, '');
  9. $show_watchlist_button = ($currentSession['user']['prefs']['keep_watchlist'] && $tplHelper->allowed(SpotSecurity::spotsec_keep_own_watchlist, ''));
  10. $show_comments = ($settings->get('retrieve_comments') && $tplHelper->allowed(SpotSecurity::spotsec_view_comments, ''));
  11. $show_filesize = $currentSession['user']['prefs']['show_filesize'];
  12. $show_multinzb_checkbox = ($tplHelper->allowed(SpotSecurity::spotsec_retrieve_nzb, '') && ($currentSession['user']['prefs']['show_multinzb']));
  13. ?>
  14. <div class="spots">
  15. <table class="spots" summary="Spots">
  16. <thead>
  17. <tr class="head">
  18. <th class='category'> <a href="<?php echo $tplHelper->makeSortUrl('index', 'category', ''); ?>" title="Sorteren op Categorie">Cat.</a> </th>
  19. <th class='title'> <span class="sortby"><a class="up" href="<?php echo $tplHelper->makeSortUrl('index', 'title', 'ASC'); ?>" title="Sorteren op Titel [0-Z]"> </a> <a class="down" href="<?php echo $tplHelper->makeSortUrl('index', 'title', 'DESC'); ?>" title="Sorteren op Titel [Z-0]"> </a></span> Titel </th>
  20. <?php if ($show_watchlist_button) { ?>
  21. <th class='watch'> </th>
  22. <?php }
  23. if ($show_comments) {
  24. echo "<th class='comments'> <a title='Aantal reacties'>#</a> </th>";
  25. } # if ?>
  26. <th class='genre'> Genre </th>
  27. <th class='poster'> <span class="sortby"><a class="up" href="<?php echo $tplHelper->makeSortUrl('index', 'poster', 'ASC'); ?>" title="Sorteren op Afzender [0-Z]"> </a> <a class="down" href="<?php echo $tplHelper->makeSortUrl('index', 'poster', 'DESC'); ?>" title="Sorteren op Afzender [Z-0]"> </a></span> Afzender </th>
  28. <th class='date'> <span class="sortby"><a class="up" href="<?php echo $tplHelper->makeSortUrl('index', 'stamp', 'DESC'); ?>" title="Sorteren op Leeftijd [oplopend]"> </a> <a class="down" href="<?php echo $tplHelper->makeSortUrl('index', 'stamp', 'ASC'); ?>" title="Sorteren op Leeftijd [aflopend]"> </a></span> <?php echo ($currentSession['user']['prefs']['date_formatting'] == 'human') ? "Leeftijd" : "Datum"; ?> </th>
  29. <?php if ($show_filesize) { ?>
  30. <th class='filesize'> <span class="sortby"><a class="up" href="<?php echo $tplHelper->makeSortUrl('index', 'filesize', 'DESC'); ?>" title="Sorteren op Omvang [aflopend]"> </a> <a class="down" href="<?php echo $tplHelper->makeSortUrl('index', 'filesize', 'ASC'); ?>" title="Sorteren op Omvang [oplopend]"> </a></span> Size </th>
  31. <?php } ?>
  32. <?php if ($show_nzb_button) { ?>
  33. <th class='nzb'> NZB </th>
  34. <?php } ?>
  35. <?php if ($show_multinzb_checkbox && !count($spots) == 0) { ?>
  36. <th class='multinzb'>
  37. <form action="" method="GET" id="checkboxget" name="checkboxget">
  38. <input type='hidden' name='page' value='getnzb'>
  39. <input type='checkbox' name='checkall' onclick='checkedAll("checkboxget");'>
  40. </th>
  41. <?php } ?>
  42. <?php $nzbHandlingTmp = $currentSession['user']['prefs']['nzbhandling'];
  43. if (($tplHelper->allowed(SpotSecurity::spotsec_download_integration, $nzbHandlingTmp['action'])) && ($nzbHandlingTmp['action'] != 'disable')) { ?>
  44. <th class='sabnzbd'><a class="toggle" onclick="toggleSidebarPanel('.sabnzbdPanel')" title='Open "SabNZBd paneel"'></a></th>
  45. <?php } ?>
  46. </tr>
  47. </thead>
  48. <tbody id="spots">
  49. <?php
  50. if (count($spots) == 0) {
  51. $colSpan = 5;
  52. $nzbHandlingTmp = $currentSession['user']['prefs']['nzbhandling'];
  53. if ($show_comments) { $colSpan++; }
  54. if ($show_nzb_button) { $colSpan++; }
  55. if ($show_filesize) { $colSpan++; }
  56. if ($show_multinzb_checkbox) { $colSpan++; }
  57. if ($show_watchlist_button) { $colSpan++; }
  58. if ($nzbHandlingTmp['action'] != 'disable') { $colSpan++; }
  59. echo "\t\t\t\t\t\t\t<tr class='noresults'><td colspan='" . $colSpan . "'>Geen resultaten gevonden</td></tr>\r\n";
  60. } # if
  61. foreach($spots as $spot) {
  62. # Format the spot header
  63. $spot = $tplHelper->formatSpotHeader($spot);
  64. $newSpotClass = ($tplHelper->isSpotNew($spot)) ? 'new' : '';
  65. if($spot['rating'] == 0) {
  66. $rating = '';
  67. } elseif($spot['rating'] == 1) {
  68. $rating = '<span class="rating" title="Deze spot heeft '.$spot['rating'].' ster"><span style="width:' . $spot['rating'] * 4 . 'px;"></span></span>';
  69. } else {
  70. $rating = '<span class="rating" title="Deze spot heeft '.$spot['rating'].' sterren"><span style="width:' . $spot['rating'] * 4 . 'px;"></span></span>';
  71. }
  72. if($tplHelper->isModerated($spot)) {
  73. $markSpot = '<span class="markSpot">!</span>';
  74. } else {
  75. $markSpot = '';
  76. }
  77. echo "\t\t\t\t\t\t\t";
  78. echo "<tr class='" . $tplHelper->cat2color($spot);
  79. if ($spot['hasbeendownloaded']) {
  80. echo " downloadedspot";
  81. } # if
  82. echo "'>";
  83. echo "<td class='category'><a href='" . $spot['caturl'] . "' title='Ga naar de categorie \"" . $spot['catshortdesc'] . "\"'>" . $spot['catshortdesc'] . "</a></td>" .
  84. "<td class='title " . $newSpotClass . "'><a onclick='openSpot(this,\"".$spot['spoturl']."\")' href='".$spot['spoturl']."' title='" . $spot['title'] . "' class='spotlink'>" . $rating . $markSpot . $spot['title'] . "</a></td>";
  85. if ($show_watchlist_button) {
  86. echo "<td class='watch'>";
  87. echo "<a class='remove watchremove_".$spot['id']."' onclick=\"toggleWatchSpot('".$spot['messageid']."','remove',".$spot['id'].")\""; if(!$spot['isbeingwatched']) { echo " style='display: none;'"; } echo " title='Verwijder uit watchlist (w)'> </a>";
  88. echo "<a class='add watchadd_".$spot['id']."' onclick=\"toggleWatchSpot('".$spot['messageid']."','add',".$spot['id'].")\""; if($spot['isbeingwatched']) { echo " style='display: none;'"; } echo " title='Plaats in watchlist (w)'> </a>";
  89. echo "</td>";
  90. }
  91. if ($show_comments) {
  92. echo "<td class='comments'><a onclick='openSpot(this,\"".$spot['spoturl']."\")' class='spotlink' href='" . $spot['spoturl'] . "#comments' title='" . $spot['commentcount'] . " comments bij \"" . $spot['title'] . "\"'>" . $spot['commentcount'] . "</a></td>";
  93. } # if
  94. echo "<td class='genre'><a href='" . $spot['subcaturl'] . "' title='Zoek spots in de categorie " . $spot['catdesc'] . "'>" . $spot['catdesc'] . "</a></td>" .
  95. "<td class='poster'><a href='" . $spot['posterurl'] . "' title='Zoek spots van " . $spot['poster'] . "'>" . $spot['poster'] . "</a></td>" .
  96. "<td class='date'>" . $tplHelper->formatDate($spot['stamp'], 'spotlist') . "</td>";
  97. if ($show_filesize) {
  98. echo "<td class='filesize'>" . $tplHelper->format_size($spot['filesize']) . "</td>";
  99. }
  100. # only display the NZB button from 24 nov or later
  101. if ($spot['stamp'] > 1290578400 ) {
  102. if ($show_nzb_button) {
  103. echo "<td class='nzb'><a href='" . $tplHelper->makeNzbUrl($spot) . "' title ='Download NZB (n)' class='nzb'>NZB";
  104. if ($spot['hasbeendownloaded']) {
  105. echo '*';
  106. } # if
  107. echo "</a></td>";
  108. } # if
  109. if ($show_multinzb_checkbox) {
  110. $multispotid = htmlspecialchars($spot['messageid']);
  111. echo "<td class='multinzb'>";
  112. echo "<input onclick='multinzb()' type='checkbox' name='".htmlspecialchars('messageid[]')."' value='".$multispotid."'>";
  113. echo "</td>";
  114. } # if
  115. # display the sabnzbd button
  116. if (!empty($spot['sabnzbdurl'])) {
  117. if ($spot['hasbeendownloaded']) {
  118. echo "<td class='sabnzbd'><a onclick=\"downloadSabnzbd('".$spot['id']."','".$spot['sabnzbdurl']."')\" class='sab_".$spot['id']." sabnzbd-button succes' title='Add NZB to SabNZBd queue (you already downloaded this spot) (s)'> </a></td>";
  119. } else {
  120. echo "<td class='sabnzbd'><a onclick=\"downloadSabnzbd('".$spot['id']."','".$spot['sabnzbdurl']."')\" class='sab_".$spot['id']." sabnzbd-button' title='Add NZB to SabNZBd queue (s)'> </a></td>";
  121. } # else
  122. } # if
  123. } else {
  124. if ($show_nzb_button) {
  125. echo "<td class='nzb'> &nbsp; </td>";
  126. } # if
  127. # display (empty) MultiNZB td
  128. if ($show_multinzb_checkbox) {
  129. echo "<td class='multinzb'> &nbsp; </td>";
  130. }
  131. # display the sabnzbd button
  132. if (!empty($spot['sabnzbdurl'])) {
  133. echo "<td class='sabnzbd'> &nbsp; </td>";
  134. } # if
  135. } # else
  136. echo "</tr>\r\n";
  137. }
  138. ?>
  139. </tbody>
  140. </table>
  141. <?php if ($prevPage >= 0 || $nextPage > 0) { ?>
  142. <table class="footer" summary="Footer">
  143. <tbody>
  144. <tr>
  145. <?php if ($prevPage >= 0) { ?>
  146. <td class="prev"><a href="?direction=prev&amp;pagenr=<?php echo $prevPage . $tplHelper->convertSortToQueryParams() . $tplHelper->convertFilterToQueryParams(); ?>">&lt;&lt;</a></td>
  147. <?php }?>
  148. <td class="button<?php if ($nextPage <= 0) {echo " last";} ?>"></td>
  149. <?php if ($nextPage > 0) { ?>
  150. <td class="next"><a href="?direction=next&amp;pagenr=<?php echo $nextPage . $tplHelper->convertSortToQueryParams() . $tplHelper->convertFilterToQueryParams(); ?>">&gt;&gt;</a></td>
  151. <?php } ?>
  152. </tr>
  153. </tbody>
  154. </table>
  155. <?php if ($show_multinzb_checkbox) { echo "</form>"; } ?>
  156. <input type="hidden" id="perPage" value="<?php echo $currentSession['user']['prefs']['perpage'] ?>">
  157. <input type="hidden" id="nextPage" value="<?php echo $nextPage; ?>">
  158. <input type="hidden" id="getURL" value="<?php echo $tplHelper->convertSortToQueryParams() . $tplHelper->convertFilterToQueryParams(); ?>">
  159. <?php } ?>
  160. </div>
  161. <div class="clear"></div>
  162. <?php
  163. /* Render de header en filter templates */
  164. if (!isset($data['spotsonly'])) {
  165. /* Render de footer template */
  166. require_once "includes/footer.inc.php";
  167. } # if