Browse Source

Update torrent group edit form

pjc 5 years ago
parent
commit
59a8eb2e59
1 changed files with 118 additions and 119 deletions
  1. 118
    119
      sections/torrents/editgroup.php

+ 118
- 119
sections/torrents/editgroup.php View File

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

Loading…
Cancel
Save