Browse Source

Minor torrent editing bug fixes

biotorrents 4 years ago
parent
commit
12bf8ee2da

+ 1
- 1
classes/torrents.class.php View File

646
           g.`subject`,
646
           g.`subject`,
647
           g.`object`,
647
           g.`object`,
648
           g.`tag_list`,
648
           g.`tag_list`,
649
-          g.`published`,
649
+          g.`year`,
650
           g.`identifier`,
650
           g.`identifier`,
651
           g.`category_id`,
651
           g.`category_id`,
652
           UNIX_TIMESTAMP(t.`Time`),
652
           UNIX_TIMESTAMP(t.`Time`),

+ 1
- 1
sections/schedule/daily/top10_daily.php View File

17
       g.`picture`,
17
       g.`picture`,
18
       g.`tag_list`,
18
       g.`tag_list`,
19
       t.`Media`,
19
       t.`Media`,
20
-      g.`published`,
20
+      g.`year`,
21
       t.`Snatched`,
21
       t.`Snatched`,
22
       t.`Seeders`,
22
       t.`Seeders`,
23
       t.`Leechers`,
23
       t.`Leechers`,

+ 1
- 1
sections/schedule/weekly/top10_weekly.php View File

17
       g.`picture`,
17
       g.`picture`,
18
       g.`tag_list`,
18
       g.`tag_list`,
19
       t.`Media`,
19
       t.`Media`,
20
-      g.`published`,
20
+      g.`year`,
21
       t.`Snatched`,
21
       t.`Snatched`,
22
       t.`Seeders`,
22
       t.`Seeders`,
23
       t.`Leechers`,
23
       t.`Leechers`,

+ 1
- 1
sections/top10/torrents.php View File

175
   g.`picture`,
175
   g.`picture`,
176
   g.`tag_list`,
176
   g.`tag_list`,
177
   t.`Media`,
177
   t.`Media`,
178
-  g.`published`,
178
+  g.`year`,
179
   g.`workgroup`,
179
   g.`workgroup`,
180
   t.`Snatched`,
180
   t.`Snatched`,
181
   t.`Seeders`,
181
   t.`Seeders`,

+ 1
- 1
sections/torrents/edit.php View File

36
   tg.`title` AS title,
36
   tg.`title` AS title,
37
   tg.`subject` AS subject,
37
   tg.`subject` AS subject,
38
   tg.`object` AS object,
38
   tg.`object` AS object,
39
-  tg.`published`,
39
+  tg.`year`,
40
   tg.`workgroup`,
40
   tg.`workgroup`,
41
   tg.`location`,
41
   tg.`location`,
42
   tg.`identifier`,
42
   tg.`identifier`,

+ 17
- 17
sections/torrents/editgroup.php View File

8
  * and clears the cache for the torrent group page.
8
  * and clears the cache for the torrent group page.
9
  */
9
  */
10
 
10
 
11
-$GroupID = (int) $_GET['groupid'];
12
-Security::checkInt($GroupID);
11
+$group_id = (int) $_GET['groupid'];
12
+Security::checkInt($group_id);
13
 
13
 
14
 // Get the torrent group name and the body of the last revision
14
 // Get the torrent group name and the body of the last revision
15
 $DB->prepare_query("
15
 $DB->prepare_query("
21
   wt.`Body`,
21
   wt.`Body`,
22
   tg.`picture`,
22
   tg.`picture`,
23
   tg.`description`,
23
   tg.`description`,
24
-  tg.`published`,
24
+  tg.`year`,
25
   tg.`workgroup`,
25
   tg.`workgroup`,
26
   tg.`location`,
26
   tg.`location`,
27
   tg.`identifier`,
27
   tg.`identifier`,
32
 ON
32
 ON
33
   wt.`RevisionID` = tg.`revision_id`
33
   wt.`RevisionID` = tg.`revision_id`
34
 WHERE
34
 WHERE
35
-  tg.`id` = '$GroupID'
35
+  tg.`id` = '$group_id'
36
 ");
36
 ");
37
 $DB->exec_prepared_query();
37
 $DB->exec_prepared_query();
38
 
38
 
50
 FROM
50
 FROM
51
   `torrents_doi`
51
   `torrents_doi`
52
 WHERE
52
 WHERE
53
-  `TorrentID` = '$GroupID'
53
+  `TorrentID` = '$group_id'
54
 ");
54
 ");
55
 $DB->exec_prepared_query();
55
 $DB->exec_prepared_query();
56
 
56
 
61
     }
61
     }
62
 }
62
 }
63
 
63
 
64
-$Artists = Artists::get_artists(array($GroupID))[$GroupID];
64
+$Artists = Artists::get_artists(array($group_id))[$group_id];
65
 
65
 
66
 if (!$Body) {
66
 if (!$Body) {
67
     $Body = $description;
67
     $Body = $description;
76
 
76
 
77
 <h2 class="header">
77
 <h2 class="header">
78
   Edit
78
   Edit
79
-  <a href="torrents.php?id=<?=$GroupID?>"><?=($title ? $title : ($subject ? $subject : $object))?></a>
79
+  <a href="torrents.php?id=<?=$group_id?>"><?=($title ? $title : ($subject ? $subject : $object))?></a>
80
 </h2>
80
 </h2>
81
 
81
 
82
 <div class="box pad">
82
 <div class="box pad">
86
     <input type="hidden" name="auth"
86
     <input type="hidden" name="auth"
87
       value="<?=$LoggedUser['AuthKey']?>" />
87
       value="<?=$LoggedUser['AuthKey']?>" />
88
 
88
 
89
-    <input type="hidden" name="groupid" value="<?=$GroupID?>" />
89
+    <input type="hidden" name="groupid" value="<?=$group_id?>" />
90
 
90
 
91
     <h3>
91
     <h3>
92
       Picture
92
       Picture
112
   FROM
112
   FROM
113
     `torrents`
113
     `torrents`
114
   WHERE
114
   WHERE
115
-    `GroupID` = '$GroupID'
115
+    `GroupID` = '$group_id'
116
   ");
116
   ");
117
   $Contributed = in_array($LoggedUser['ID'], $DB->collect('UserID'));
117
   $Contributed = in_array($LoggedUser['ID'], $DB->collect('UserID'));
118
 ?>
118
 ?>
146
     <input type="hidden" name="auth"
146
     <input type="hidden" name="auth"
147
       value="<?=$LoggedUser['AuthKey']?>" />
147
       value="<?=$LoggedUser['AuthKey']?>" />
148
 
148
 
149
-    <input type="hidden" name="groupid" value="<?=$GroupID?>" />
149
+    <input type="hidden" name="groupid" value="<?=$group_id?>" />
150
 
150
 
151
     <table cellpadding="3" cellspacing="1" border="0" class="layout" width="100%">
151
     <table cellpadding="3" cellspacing="1" border="0" class="layout" width="100%">
152
       <tr>
152
       <tr>
184
     <input type="hidden" name="auth"
184
     <input type="hidden" name="auth"
185
       value="<?=$LoggedUser['AuthKey']?>" />
185
       value="<?=$LoggedUser['AuthKey']?>" />
186
 
186
 
187
-    <input type="hidden" name="groupid" value="<?=$GroupID?>" />
187
+    <input type="hidden" name="groupid" value="<?=$group_id?>" />
188
 
188
 
189
     <table cellpadding="3" cellspacing="1" border="0" class="layout" width="100%">
189
     <table cellpadding="3" cellspacing="1" border="0" class="layout" width="100%">
190
       <tr>
190
       <tr>
211
 
211
 
212
         <td>
212
         <td>
213
           <input type="text" id="studio" name="studio" size="60"
213
           <input type="text" id="studio" name="studio" size="60"
214
-            value="<?=$Studio?>" />
214
+            value="<?=$workgroup?>" />
215
         </td>
215
         </td>
216
       </tr>
216
       </tr>
217
 
217
 
222
 
222
 
223
         <td>
223
         <td>
224
           <input type="text" id="series" name="series" size="60"
224
           <input type="text" id="series" name="series" size="60"
225
-            value="<?=$Series?>" />
225
+            value="<?=$location?>" />
226
         </td>
226
         </td>
227
       </tr>
227
       </tr>
228
 
228
 
233
 
233
 
234
         <td>
234
         <td>
235
           <input type="text" name="year" size="10"
235
           <input type="text" name="year" size="10"
236
-            value="<?=$Year?>" />
236
+            value="<?=$year?>" />
237
         </td>
237
         </td>
238
       </tr>
238
       </tr>
239
 
239
 
244
 
244
 
245
         <td>
245
         <td>
246
           <input type="text" name="catalogue" size="40"
246
           <input type="text" name="catalogue" size="40"
247
-            value="<?=$CatalogueNumber?>" />
247
+            value="<?=$identifier?>" />
248
         </td>
248
         </td>
249
       </tr>
249
       </tr>
250
 
250
 
299
       <input type="hidden" name="auth"
299
       <input type="hidden" name="auth"
300
         value="<?=$LoggedUser['AuthKey']?>" />
300
         value="<?=$LoggedUser['AuthKey']?>" />
301
 
301
 
302
-      <input type="hidden" name="groupid" value="<?=$GroupID?>" />
302
+      <input type="hidden" name="groupid" value="<?=$group_id?>" />
303
 
303
 
304
       <tr>
304
       <tr>
305
         <td class="label">
305
         <td class="label">
355
     <input type="hidden" name="auth"
355
     <input type="hidden" name="auth"
356
       value="<?=$LoggedUser['AuthKey']?>" />
356
       value="<?=$LoggedUser['AuthKey']?>" />
357
 
357
 
358
-    <input type="hidden" name="groupid" value="<?=$GroupID?>" />
358
+    <input type="hidden" name="groupid" value="<?=$group_id?>" />
359
 
359
 
360
     <h3>
360
     <h3>
361
       Target torrent group ID
361
       Target torrent group ID

+ 1
- 1
sections/torrents/functions.php View File

27
           g.`title`,
27
           g.`title`,
28
           g.`subject`,
28
           g.`subject`,
29
           g.`object`,
29
           g.`object`,
30
-          g.`published`,
30
+          g.`year`,
31
           g.`workgroup`,
31
           g.`workgroup`,
32
           g.`location`,
32
           g.`location`,
33
           g.`identifier`,
33
           g.`identifier`,

+ 38
- 24
sections/torrents/nonwikiedit.php View File

3
 
3
 
4
 authorize();
4
 authorize();
5
 
5
 
6
-$GroupID = (int) $_GET['groupid'];
7
-Security::checkInt($GroupID);
6
+$group_id = (int) $_REQUEST['groupid'];
7
+Security::checkInt($group_id);
8
 
8
 
9
 // Usual perm checks
9
 // Usual perm checks
10
 if (!check_perms('torrents_edit')) {
10
 if (!check_perms('torrents_edit')) {
11
-    $DB->query("
11
+    $DB->prepare_query("
12
     SELECT
12
     SELECT
13
       `UserID`
13
       `UserID`
14
     FROM
14
     FROM
15
       `torrents`
15
       `torrents`
16
     WHERE
16
     WHERE
17
-      `GroupID` = '$group_id'
17
+      `GroupID` = '$GroupID'
18
     ");
18
     ");
19
+    $DB->exec_prepared_query();
19
 
20
 
20
     if (!in_array($LoggedUser['ID'], $DB->collect('UserID'))) {
21
     if (!in_array($LoggedUser['ID'], $DB->collect('UserID'))) {
21
         error(403);
22
         error(403);
22
     }
23
     }
23
 }
24
 }
24
 
25
 
26
+# ?
25
 if (check_perms('torrents_freeleech')
27
 if (check_perms('torrents_freeleech')
26
-  && (isset($_POST['freeleech'])
27
-  xor isset($_POST['neutralleech'])
28
-  xor isset($_POST['unfreeleech']))) {
28
+    && (isset($_POST['freeleech'])
29
+        xor isset($_POST['neutralleech'])
30
+        xor isset($_POST['unfreeleech']))) {
29
     if (isset($_POST['freeleech'])) {
31
     if (isset($_POST['freeleech'])) {
30
         $Free = 1;
32
         $Free = 1;
31
     } elseif (isset($_POST['neutralleech'])) {
33
     } elseif (isset($_POST['neutralleech'])) {
48
 // Escape fields
50
 // Escape fields
49
 $workgroup = db_string($_POST['studio']);
51
 $workgroup = db_string($_POST['studio']);
50
 $location = db_string($_POST['series']);
52
 $location = db_string($_POST['series']);
51
-$published = db_string((int)$_POST['year']);
53
+$year = db_string((int)$_POST['year']);
52
 $identifier = db_string($_POST['catalogue']);
54
 $identifier = db_string($_POST['catalogue']);
53
 
55
 
54
 // Get some info for the group log
56
 // Get some info for the group log
55
-$DB->query("
57
+$DB->prepare_query("
56
 SELECT
58
 SELECT
57
-  `published`
59
+  `year`
58
 FROM
60
 FROM
59
   `torrents_group`
61
   `torrents_group`
60
 WHERE
62
 WHERE
61
   `id` = '$group_id'
63
   `id` = '$group_id'
62
 ");
64
 ");
65
+$DB->exec_prepared_query();
63
 list($OldYear) = $DB->next_record();
66
 list($OldYear) = $DB->next_record();
64
 
67
 
65
-$DB->query("
68
+$DB->prepare_query("
66
 UPDATE
69
 UPDATE
67
   `torrents_group`
70
   `torrents_group`
68
 SET
71
 SET
69
-  `published` = '$published',
72
+  `year` = '$year',
70
   `identifier` = '$identifier',
73
   `identifier` = '$identifier',
71
   `workgroup` = '$workgroup',
74
   `workgroup` = '$workgroup',
72
   `location` = '$location'
75
   `location` = '$location'
73
 WHERE
76
 WHERE
74
   `id` = '$group_id'
77
   `id` = '$group_id'
75
 ");
78
 ");
79
+$DB->exec_prepared_query();
76
 
80
 
77
-if ($OldYear !== $published) {
78
-    $Message = db_string("Year changed from $OldYear to $published");
81
+if ($OldYear !== $year) {
82
+    $Message = db_string("Year changed from $OldYear to $year");
79
 
83
 
80
-    $DB->query("
84
+    $DB->prepare_query("
81
     INSERT INTO `group_log`(`GroupID`, `UserID`, `Time`, `Info`)
85
     INSERT INTO `group_log`(`GroupID`, `UserID`, `Time`, `Info`)
82
     VALUES(
86
     VALUES(
83
       '$group_id',
87
       '$group_id',
85
       NOW(),
89
       NOW(),
86
       '$Message')
90
       '$Message')
87
     ");
91
     ");
92
+    $DB->exec_prepared_query();
88
 }
93
 }
89
 
94
 
90
-$DB->query("
95
+$DB->prepare_query("
91
 SELECT
96
 SELECT
92
   ag.`Name`
97
   ag.`Name`
93
 FROM
98
 FROM
98
 WHERE
103
 WHERE
99
   ta.`GroupID` = '$group_id'
104
   ta.`GroupID` = '$group_id'
100
 ");
105
 ");
106
+$DB->exec_prepared_query();
101
 
107
 
102
 while ($r = $DB->next_record(MYSQLI_ASSOC, true)) {
108
 while ($r = $DB->next_record(MYSQLI_ASSOC, true)) {
103
     $CurrArtists[] = $r['Name'];
109
     $CurrArtists[] = $r['Name'];
106
 foreach ($Artists as $Artist) {
112
 foreach ($Artists as $Artist) {
107
     if (!in_array($Artist, $CurrArtists)) {
113
     if (!in_array($Artist, $CurrArtists)) {
108
         $Artist = db_string($Artist);
114
         $Artist = db_string($Artist);
109
-        $DB->query("
115
+        $DB->prepare_query("
110
         SELECT
116
         SELECT
111
           `ArtistID`
117
           `ArtistID`
112
         FROM
118
         FROM
114
         WHERE
120
         WHERE
115
           `Name` = '$Artist'
121
           `Name` = '$Artist'
116
         ");
122
         ");
123
+        $DB->exec_prepared_query();
117
 
124
 
118
         if ($DB->has_results()) {
125
         if ($DB->has_results()) {
119
             list($ArtistID) = $DB->next_record();
126
             list($ArtistID) = $DB->next_record();
120
         } else {
127
         } else {
121
-            $DB->query("
128
+            $DB->prepare_query("
122
             INSERT INTO `artists_group`(`Name`)
129
             INSERT INTO `artists_group`(`Name`)
123
             VALUES('$Artist')
130
             VALUES('$Artist')
124
             ");
131
             ");
132
+            $DB->exec_prepared_query();
125
             $ArtistID = $DB->inserted_id();
133
             $ArtistID = $DB->inserted_id();
126
         }
134
         }
127
 
135
 
128
-        $DB->query("
136
+        $DB->prepare_query("
129
         INSERT INTO `torrents_artists`(`GroupID`, `ArtistID`, `UserID`)
137
         INSERT INTO `torrents_artists`(`GroupID`, `ArtistID`, `UserID`)
130
         VALUES(
138
         VALUES(
131
           '$group_id',
139
           '$group_id',
136
         UPDATE
144
         UPDATE
137
           `UserID` = '$LoggedUser[ID]'
145
           `UserID` = '$LoggedUser[ID]'
138
         "); // Why does this even happen
146
         "); // Why does this even happen
147
+        $DB->exec_prepared_query();
139
         $Cache->delete_value('artist_groups_'.$ArtistID);
148
         $Cache->delete_value('artist_groups_'.$ArtistID);
140
     }
149
     }
141
 }
150
 }
144
     if (!in_array($CurrArtist, $Artists)) {
153
     if (!in_array($CurrArtist, $Artists)) {
145
         $CurrArtist = db_string($CurrArtist);
154
         $CurrArtist = db_string($CurrArtist);
146
 
155
 
147
-        $DB->query("
156
+        $DB->prepare_query("
148
         SELECT
157
         SELECT
149
           `ArtistID`
158
           `ArtistID`
150
         FROM
159
         FROM
152
         WHERE
161
         WHERE
153
           `Name` = '$CurrArtist'
162
           `Name` = '$CurrArtist'
154
         ");
163
         ");
164
+        $DB->exec_prepared_query();
155
 
165
 
156
         if ($DB->has_results()) {
166
         if ($DB->has_results()) {
157
             list($ArtistID) = $DB->next_record();
167
             list($ArtistID) = $DB->next_record();
158
 
168
 
159
-            $DB->query("
169
+            $DB->prepare_query("
160
             DELETE
170
             DELETE
161
             FROM
171
             FROM
162
               `torrents_artists`
172
               `torrents_artists`
164
               `ArtistID` = '$ArtistID'
174
               `ArtistID` = '$ArtistID'
165
               AND `GroupID` = '$group_id'
175
               AND `GroupID` = '$group_id'
166
             ");
176
             ");
177
+            $DB->exec_prepared_query();
167
 
178
 
168
-            $DB->query("
179
+            $DB->prepare_query("
169
             SELECT
180
             SELECT
170
               `GroupID`
181
               `GroupID`
171
             FROM
182
             FROM
173
             WHERE
184
             WHERE
174
               `ArtistID` = '$ArtistID'
185
               `ArtistID` = '$ArtistID'
175
             ");
186
             ");
187
+            $DB->exec_prepared_query();
176
 
188
 
177
             $Cache->delete_value('artist_groups_'.$ArtistID);
189
             $Cache->delete_value('artist_groups_'.$ArtistID);
178
 
190
 
179
             if (!$DB->has_results()) {
191
             if (!$DB->has_results()) {
180
-                $DB->query("
192
+                $DB->prepare_query("
181
                 SELECT
193
                 SELECT
182
                   `RequestID`
194
                   `RequestID`
183
                 FROM
195
                 FROM
186
                   `ArtistID` = '$ArtistID'
198
                   `ArtistID` = '$ArtistID'
187
                   AND `ArtistID` != 0
199
                   AND `ArtistID` != 0
188
                 ");
200
                 ");
201
+                $DB->exec_prepared_query();
189
 
202
 
190
                 if (!$DB->has_results()) {
203
                 if (!$DB->has_results()) {
191
                     Artists::delete_artist($ArtistID);
204
                     Artists::delete_artist($ArtistID);
195
     }
208
     }
196
 }
209
 }
197
 
210
 
198
-$DB->query("
211
+$DB->prepare_query("
199
 SELECT
212
 SELECT
200
   `ID`
213
   `ID`
201
 FROM
214
 FROM
203
 WHERE
216
 WHERE
204
   `GroupID` = '$group_id'
217
   `GroupID` = '$group_id'
205
 ");
218
 ");
219
+$DB->exec_prepared_query();
206
 
220
 
207
 while (list($TorrentID) = $DB->next_record()) {
221
 while (list($TorrentID) = $DB->next_record()) {
208
     $Cache->delete_value("torrent_download_$TorrentID");
222
     $Cache->delete_value("torrent_download_$TorrentID");

Loading…
Cancel
Save