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.

editgroup.php 8.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370
  1. <?php
  2. declare(strict_types = 1);
  3. /**
  4. * Edit torrent group wiki page
  5. *
  6. * The page inserts a new revision into the wiki_torrents table,
  7. * and clears the cache for the torrent group page.
  8. */
  9. Security::CheckID($_GET['groupid']);
  10. // Get the torrent group name and the body of the last revision
  11. $DB->query("
  12. SELECT
  13. tg.`Name`,
  14. tg.`Title2`,
  15. tg.`NameJP`,
  16. wt.`Image`,
  17. wt.`Body`,
  18. tg.`WikiImage`,
  19. tg.`WikiBody`,
  20. tg.`Year`,
  21. tg.`Studio`,
  22. tg.`Series`,
  23. tg.`CatalogueNumber`,
  24. tg.`CategoryID`
  25. FROM
  26. `torrents_group` AS tg
  27. LEFT JOIN `wiki_torrents` AS wt
  28. ON
  29. wt.`RevisionID` = tg.`RevisionID`
  30. WHERE
  31. tg.`ID` = '".db_string($GroupID)."'
  32. ");
  33. if (!$DB->has_results()) {
  34. error(404);
  35. }
  36. list($Name, $Title2, $NameJP, $Image, $Body, $WikiImage, $WikiBody, $Year, $Studio, $Series, $CatalogueNumber, $CategoryID) = $DB->next_record();
  37. $DB->query("
  38. SELECT
  39. `ID`,
  40. `UserID`,
  41. `Time`,
  42. `URI`
  43. FROM
  44. `torrents_doi`
  45. WHERE
  46. `TorrentID` = '$GroupID'
  47. ");
  48. if ($DB->has_results()) {
  49. $Screenshots = [];
  50. while ($S = $DB->next_record(MYSQLI_ASSOC, true)) {
  51. $Screenshots[] = $S;
  52. }
  53. }
  54. $Artists = Artists::get_artists(array($GroupID))[$GroupID];
  55. if (!$Body) {
  56. $Body = $WikiBody;
  57. $Image = $WikiImage;
  58. }
  59. View::show_header(
  60. 'Edit torrent group',
  61. 'upload,bbcode,vendor/easymde.min',
  62. 'vendor/easymde.min'
  63. ); ?>
  64. <h2 class="header">
  65. Edit
  66. <a href="torrents.php?id=<?=$GroupID?>"><?=($Name ? $Name : ($Title2 ? $Title2 : $NameJP))?></a>
  67. </h2>
  68. <div class="box pad">
  69. <form class="edit_form" name="torrent_group" action="torrents.php" method="post">
  70. <input type="hidden" name="action" value="takegroupedit" />
  71. <input type="hidden" name="auth"
  72. value="<?=$LoggedUser['AuthKey']?>" />
  73. <input type="hidden" name="groupid" value="<?=$GroupID?>" />
  74. <h3>
  75. Picture
  76. </h3>
  77. <input type="text" name="image" size="80" value="<?=$Image?>" />
  78. <br /><br />
  79. <h3>
  80. Torrent Group Description
  81. </h3>
  82. <?php
  83. new TEXTAREA_PREVIEW(
  84. 'body', # $Name breaks "Rename (will not merge)"
  85. $ID = 'body',
  86. $Value = display_str($Body) ?? '',
  87. );
  88. $DB->query("
  89. SELECT
  90. `UserID`
  91. FROM
  92. `torrents`
  93. WHERE
  94. `GroupID` = '$GroupID'
  95. ");
  96. $Contributed = in_array($LoggedUser['ID'], $DB->collect('UserID'));
  97. ?>
  98. <h3>
  99. Edit Summary
  100. </h3>
  101. <input type="text" name="summary" size="80" />
  102. <br />
  103. <div class="center pad">
  104. <input type="submit" value="Submit" />
  105. </div>
  106. </form>
  107. </div>
  108. <?php
  109. if ($Contributed
  110. || check_perms('torrents_edit')
  111. || check_perms('screenshots_delete')
  112. || check_perms('screenshots_add')) { ?>
  113. <h2 id="screenshots_section">
  114. Publications
  115. </h2>
  116. <div class="box pad">
  117. <form class="edit_form" name="screenshots_form" action="torrents.php" method="post">
  118. <input type="hidden" name="action" value="screenshotedit" />
  119. <input type="hidden" name="auth"
  120. value="<?=$LoggedUser['AuthKey']?>" />
  121. <input type="hidden" name="groupid" value="<?=$GroupID?>" />
  122. <table cellpadding="3" cellspacing="1" border="0" class="layout" width="100%">
  123. <tr>
  124. <td class="label">
  125. Publications
  126. </td>
  127. <td id="screenshots">
  128. <?php
  129. if ($Contributed || check_perms('screenshots_add') || check_perms('torrents_edit')) { ?>
  130. <a class="float_right brackets" onclick="AddScreenshotField()">+</a>
  131. <?php } ?>
  132. </td>
  133. </tr>
  134. </table>
  135. <div class="center pad">
  136. <input type="submit" value="Submit" />
  137. </div>
  138. </form>
  139. </div>
  140. <?php
  141. }
  142. // Users can edit the group info if they've uploaded a torrent to the group or have torrents_edit
  143. if ($Contributed || check_perms('torrents_edit')) { ?>
  144. <h2>
  145. Non-wiki torrent group editing
  146. </h2>
  147. <div class="box pad">
  148. <form class="edit_form" name="torrent_group" action="torrents.php" method="post">
  149. <input type="hidden" name="action" value="nonwikiedit" />
  150. <input type="hidden" name="auth"
  151. value="<?=$LoggedUser['AuthKey']?>" />
  152. <input type="hidden" name="groupid" value="<?=$GroupID?>" />
  153. <table cellpadding="3" cellspacing="1" border="0" class="layout" width="100%">
  154. <tr>
  155. <td class="label">
  156. Author(s)
  157. </td>
  158. <td id="idolfields">
  159. <input type="text" id="idols_0" name="idols[]" size="45"
  160. value="<?=$Artists[0]['name']?>"
  161. <?php Users::has_autocomplete_enabled('other'); ?>/>
  162. <a class="add_artist_button brackets">+</a> <a class="remove_artist_button brackets">&minus;</a>
  163. <?php
  164. for ($i = 1; $i < count($Artists); $i++) {
  165. echo '<br /><input type="text" id="idol_'.$i.'" name="idols[]" size="45" value="'.$Artists[$i]['name'].'"/>';
  166. } ?>
  167. </td>
  168. </tr>
  169. <tr>
  170. <td class="label">
  171. Department/Lab
  172. </td>
  173. <td>
  174. <input type="text" id="studio" name="studio" size="60"
  175. value="<?=$Studio?>" />
  176. </td>
  177. </tr>
  178. <tr>
  179. <td class="label">
  180. Location
  181. </td>
  182. <td>
  183. <input type="text" id="series" name="series" size="60"
  184. value="<?=$Series?>" />
  185. </td>
  186. </tr>
  187. <tr>
  188. <td class="label">
  189. Year
  190. </td>
  191. <td>
  192. <input type="text" name="year" size="10"
  193. value="<?=$Year?>" />
  194. </td>
  195. </tr>
  196. <tr>
  197. <td class="label">
  198. Accession Number
  199. </td>
  200. <td>
  201. <input type="text" name="catalogue" size="40"
  202. value="<?=$CatalogueNumber?>" />
  203. </td>
  204. </tr>
  205. <?php if (check_perms('torrents_freeleech')) { ?>
  206. <tr>
  207. <td class="label">
  208. Torrent <strong>group</strong> leech status
  209. </td>
  210. <td>
  211. <input type="checkbox" id="unfreeleech" name="unfreeleech" />
  212. <label for="unfreeleech"> Reset</label>
  213. <input type="checkbox" id="freeleech" name="freeleech" />
  214. <label for="freeleech"> Freeleech</label>
  215. <input type="checkbox" id="neutralleech" name="neutralleech" />
  216. <label for="neutralleech"> Neutral Leech</label>
  217. because
  218. <select name="freeleechtype">
  219. <?php $FL = array('N/A', 'Staff Pick', 'Perma-FL', 'Freeleechizer', 'Site-Wide FL');
  220. foreach ($FL as $Key => $FLType) { ?>
  221. <option value="<?=$Key?>" <?=($Key == $Torrent['FreeLeechType'] ? ' selected="selected"' : '')?>><?=$FLType?>
  222. </option>
  223. <?php } ?>
  224. </select>
  225. </td>
  226. </tr>
  227. <?php } ?>
  228. </table>
  229. <div class="center pad">
  230. <input type="submit" value="Edit" />
  231. </div>
  232. </form>
  233. </div>
  234. <?php
  235. }
  236. if ($Contributed || check_perms('torrents_edit')) { ?>
  237. <h2>
  238. Rename (will not merge)
  239. </h2>
  240. <div class="box pad">
  241. <form class="rename_form" name="torrent_group" action="torrents.php" method="post">
  242. <table cellpadding="3" cellspacing="1" border="0" class="layout" width="100%">
  243. <input type="hidden" name="action" value="rename" />
  244. <input type="hidden" name="auth"
  245. value="<?=$LoggedUser['AuthKey']?>" />
  246. <input type="hidden" name="groupid" value="<?=$GroupID?>" />
  247. <tr>
  248. <td class="label">
  249. Torrent Title
  250. </td>
  251. <td>
  252. <input type="text" name="name" size="70"
  253. value="<?=$Name?>" />
  254. </td>
  255. </tr>
  256. <tr>
  257. <td class="label">
  258. Organism
  259. </td>
  260. <td>
  261. <input type="text" name="Title2" size="70"
  262. value="<?=$Title2?>" />
  263. </td>
  264. </tr>
  265. <tr>
  266. <td class="label">
  267. Strain/Variety
  268. </td>
  269. <td>
  270. <input type="text" name="namejp" size="70"
  271. value="<?=$NameJP?>" />
  272. </td>
  273. </tr>
  274. </table>
  275. <div class="center pad">
  276. <input type="submit" value="Rename" />
  277. </div>
  278. </form>
  279. </div>
  280. <?php
  281. }
  282. if (check_perms('torrents_edit')) { ?>
  283. <h2>
  284. Merge with another group
  285. </h2>
  286. <div class="box pad">
  287. <form class="merge_form" name="torrent_group" action="torrents.php" method="post">
  288. <input type="hidden" name="action" value="merge" />
  289. <input type="hidden" name="auth"
  290. value="<?=$LoggedUser['AuthKey']?>" />
  291. <input type="hidden" name="groupid" value="<?=$GroupID?>" />
  292. <h3>
  293. Target torrent group ID
  294. <input type="text" name="targetgroupid" size="10" />
  295. </h3>
  296. <div class="center pad">
  297. <input type="submit" value="Merge" />
  298. </div>
  299. </form>
  300. </div>
  301. <?php
  302. }
  303. View::show_footer();