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.

manage.php 5.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. <?php
  2. #declare(strict_types = 1);
  3. $CollageID = $_GET['collageid'];
  4. if (!is_number($CollageID)) {
  5. error(0);
  6. }
  7. $DB->query("
  8. SELECT Name, UserID, CategoryID
  9. FROM collages
  10. WHERE ID = '$CollageID'");
  11. list($Name, $UserID, $CategoryID) = $DB->next_record();
  12. if ($CategoryID == 0 && $UserID != $LoggedUser['ID'] && !check_perms('site_collages_delete')) {
  13. error(403);
  14. }
  15. if ($CategoryID == array_search(ARTIST_COLLAGE, $CollageCats)) {
  16. error(404);
  17. }
  18. $DB->query("
  19. SELECT
  20. ct.GroupID,
  21. um.ID,
  22. um.Username,
  23. ct.Sort,
  24. tg.CatalogueNumber
  25. FROM collages_torrents AS ct
  26. JOIN torrents_group AS tg ON tg.ID = ct.GroupID
  27. LEFT JOIN users_main AS um ON um.ID = ct.UserID
  28. WHERE ct.CollageID = '$CollageID'
  29. ORDER BY ct.Sort");
  30. $GroupIDs = $DB->collect('GroupID');
  31. $CollageDataList = $DB->to_array('GroupID', MYSQLI_ASSOC);
  32. if (count($GroupIDs) > 0) {
  33. $TorrentList = Torrents::get_groups($GroupIDs);
  34. } else {
  35. $TorrentList = [];
  36. }
  37. View::show_header(
  38. "Manage collection: $Name",
  39. 'vendor/jquery.tablesorter.min,sort'
  40. );
  41. ?>
  42. <div>
  43. <div class="header">
  44. <h2>Manage collection <a
  45. href="collages.php?id=<?=$CollageID?>"><?=$Name?></a></h2>
  46. </div>
  47. <table width="100%" class="layout">
  48. <tr class="colhead">
  49. <td id="sorting_head">Sorting</td>
  50. </tr>
  51. <tr>
  52. <td id="drag_drop_textnote">
  53. <ul>
  54. <li>Click on the headings to organize columns automatically.</li>
  55. <li>Sort multiple columns simultaneously by holding down the shift key and clicking other column headers.</li>
  56. <li>Click and drag any row to change its order.</li>
  57. <li>Press "Save All Changes" when you are finished sorting.</li>
  58. <li>Press "Edit" or "Remove" to simply modify one entry.</li>
  59. </ul>
  60. </td>
  61. </tr>
  62. </table>
  63. <div class="drag_drop_save hidden">
  64. <input type="button" name="submit" value="Save All Changes" class="save_sortable_collage" />
  65. </div>
  66. <table id="manage_collage_table">
  67. <thead>
  68. <tr class="colhead">
  69. <th style="width: 7%;" data-sorter="false">Order</th>
  70. <th style="width: 1%;"><span><abbr class="tooltip" title="Current rank">#</abbr></span></th>
  71. <th style="width: 7%;"><span>Cat.&nbsp;#</span></th>
  72. <th style="width: 1%;"><span>Year</span></th>
  73. <th style="width: 15%;" data-sorter="ignoreArticles"><span>Artist</span></th>
  74. <th data-sorter="ignoreArticles"><span>Torrent</span></th>
  75. <th style="width: 1%;"><span>User</span></th>
  76. <th style="width: 1%; text-align: right;" class="nobr" data-sorter="false"><span><abbr class="tooltip"
  77. title="Modify an individual row">Tweak</abbr></span></th>
  78. </tr>
  79. </thead>
  80. <tbody>
  81. <?php
  82. $Number = 0;
  83. foreach ($GroupIDs as $GroupID) {
  84. if (!isset($TorrentList[$GroupID])) {
  85. continue;
  86. }
  87. $Group = $TorrentList[$GroupID];
  88. extract(Torrents::array_group($Group));
  89. list(, $UserID, $Username, $Sort, $CatNum) = array_values($CollageDataList[$GroupID]);
  90. $Number++;
  91. $DisplayName = '';
  92. if (!empty($ExtendedArtists[1]) || !empty($ExtendedArtists[4]) || !empty($ExtendedArtists[5]) || !empty($ExtendedArtists[6])) {
  93. unset($ExtendedArtists[2]);
  94. unset($ExtendedArtists[3]);
  95. $DisplayName .= Artists::display_artists($ExtendedArtists, true, false);
  96. } elseif (count($Artists) > 0) {
  97. $DisplayName .= Artists::display_artists($Artists, true, false);
  98. }
  99. $GroupNameLang = $GroupName ? $GroupName : ($GroupTitle2 ? $GroupTitle2 : $GroupNameJP);
  100. $TorrentLink = "<a href=\"torrents.php?id=$GroupID\" class=\"tooltip\" title=\"View torrent group\">$GroupNameLang</a>";
  101. $GroupYear = $GroupYear > 0 ? $GroupYear : ''; ?>
  102. <tr class="drag row" id="li_<?=$GroupID?>">
  103. <form class="manage_form" name="collage" action="collages.php" method="post">
  104. <td>
  105. <input class="sort_numbers" type="text" name="sort"
  106. value="<?=$Sort?>"
  107. id="sort_<?=$GroupID?>" size="4" />
  108. </td>
  109. <td><?=$Number?>
  110. </td>
  111. <td><?=trim($CatNum) ?: '&nbsp;'?>
  112. </td>
  113. <td><?=trim($GroupYear) ?: '&nbsp;'?>
  114. </td>
  115. <td><?=trim($DisplayName) ?: '&nbsp;'?>
  116. </td>
  117. <td><?=trim($TorrentLink)?>
  118. </td>
  119. <td class="nobr"><?=Users::format_username($UserID, $Username, false, false, false)?>
  120. </td>
  121. <td class="nobr">
  122. <input type="hidden" name="action" value="manage_handle" />
  123. <input type="hidden" name="auth"
  124. value="<?=$LoggedUser['AuthKey']?>" />
  125. <input type="hidden" name="collageid"
  126. value="<?=$CollageID?>" />
  127. <input type="hidden" name="groupid"
  128. value="<?=$GroupID?>" />
  129. <input type="submit" name="submit" value="Edit" />
  130. <input type="submit" name="submit" value="Remove" />
  131. </td>
  132. </form>
  133. </tr>
  134. <?php
  135. } ?>
  136. </tbody>
  137. </table>
  138. <div class="drag_drop_save hidden">
  139. <input type="button" name="submit" value="Save All Changes" class="save_sortable_collage" />
  140. </div>
  141. <form class="dragdrop_form hidden" name="collage" action="collages.php" method="post" id="drag_drop_collage_form">
  142. <div>
  143. <input type="hidden" name="action" value="manage_handle" />
  144. <input type="hidden" name="auth"
  145. value="<?=$LoggedUser['AuthKey']?>" />
  146. <input type="hidden" name="collageid"
  147. value="<?=$CollageID?>" />
  148. <input type="hidden" name="groupid" value="1" />
  149. <input type="hidden" name="drag_drop_collage_sort_order" id="drag_drop_collage_sort_order" readonly="readonly"
  150. value="" />
  151. </div>
  152. </form>
  153. </div>
  154. <?php View::show_footer(); ?>