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.8KB

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