Oppaitime'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

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