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 11KB

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