Browse Source

Minor torrent editing bug fixes

biotorrents 3 years ago
parent
commit
12bf8ee2da

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

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

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

@@ -17,7 +17,7 @@ if ($Top10 === false) {
17 17
       g.`picture`,
18 18
       g.`tag_list`,
19 19
       t.`Media`,
20
-      g.`published`,
20
+      g.`year`,
21 21
       t.`Snatched`,
22 22
       t.`Seeders`,
23 23
       t.`Leechers`,

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

@@ -17,7 +17,7 @@ if ($Top10 === false) {
17 17
       g.`picture`,
18 18
       g.`tag_list`,
19 19
       t.`Media`,
20
-      g.`published`,
20
+      g.`year`,
21 21
       t.`Snatched`,
22 22
       t.`Seeders`,
23 23
       t.`Leechers`,

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

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

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

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

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

@@ -8,8 +8,8 @@ declare(strict_types = 1);
8 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 14
 // Get the torrent group name and the body of the last revision
15 15
 $DB->prepare_query("
@@ -21,7 +21,7 @@ SELECT
21 21
   wt.`Body`,
22 22
   tg.`picture`,
23 23
   tg.`description`,
24
-  tg.`published`,
24
+  tg.`year`,
25 25
   tg.`workgroup`,
26 26
   tg.`location`,
27 27
   tg.`identifier`,
@@ -32,7 +32,7 @@ LEFT JOIN `wiki_torrents` AS wt
32 32
 ON
33 33
   wt.`RevisionID` = tg.`revision_id`
34 34
 WHERE
35
-  tg.`id` = '$GroupID'
35
+  tg.`id` = '$group_id'
36 36
 ");
37 37
 $DB->exec_prepared_query();
38 38
 
@@ -50,7 +50,7 @@ SELECT
50 50
 FROM
51 51
   `torrents_doi`
52 52
 WHERE
53
-  `TorrentID` = '$GroupID'
53
+  `TorrentID` = '$group_id'
54 54
 ");
55 55
 $DB->exec_prepared_query();
56 56
 
@@ -61,7 +61,7 @@ if ($DB->has_results()) {
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 66
 if (!$Body) {
67 67
     $Body = $description;
@@ -76,7 +76,7 @@ View::show_header(
76 76
 
77 77
 <h2 class="header">
78 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 80
 </h2>
81 81
 
82 82
 <div class="box pad">
@@ -86,7 +86,7 @@ View::show_header(
86 86
     <input type="hidden" name="auth"
87 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 91
     <h3>
92 92
       Picture
@@ -112,7 +112,7 @@ new TEXTAREA_PREVIEW(
112 112
   FROM
113 113
     `torrents`
114 114
   WHERE
115
-    `GroupID` = '$GroupID'
115
+    `GroupID` = '$group_id'
116 116
   ");
117 117
   $Contributed = in_array($LoggedUser['ID'], $DB->collect('UserID'));
118 118
 ?>
@@ -146,7 +146,7 @@ new TEXTAREA_PREVIEW(
146 146
     <input type="hidden" name="auth"
147 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 151
     <table cellpadding="3" cellspacing="1" border="0" class="layout" width="100%">
152 152
       <tr>
@@ -184,7 +184,7 @@ new TEXTAREA_PREVIEW(
184 184
     <input type="hidden" name="auth"
185 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 189
     <table cellpadding="3" cellspacing="1" border="0" class="layout" width="100%">
190 190
       <tr>
@@ -211,7 +211,7 @@ new TEXTAREA_PREVIEW(
211 211
 
212 212
         <td>
213 213
           <input type="text" id="studio" name="studio" size="60"
214
-            value="<?=$Studio?>" />
214
+            value="<?=$workgroup?>" />
215 215
         </td>
216 216
       </tr>
217 217
 
@@ -222,7 +222,7 @@ new TEXTAREA_PREVIEW(
222 222
 
223 223
         <td>
224 224
           <input type="text" id="series" name="series" size="60"
225
-            value="<?=$Series?>" />
225
+            value="<?=$location?>" />
226 226
         </td>
227 227
       </tr>
228 228
 
@@ -233,7 +233,7 @@ new TEXTAREA_PREVIEW(
233 233
 
234 234
         <td>
235 235
           <input type="text" name="year" size="10"
236
-            value="<?=$Year?>" />
236
+            value="<?=$year?>" />
237 237
         </td>
238 238
       </tr>
239 239
 
@@ -244,7 +244,7 @@ new TEXTAREA_PREVIEW(
244 244
 
245 245
         <td>
246 246
           <input type="text" name="catalogue" size="40"
247
-            value="<?=$CatalogueNumber?>" />
247
+            value="<?=$identifier?>" />
248 248
         </td>
249 249
       </tr>
250 250
 
@@ -299,7 +299,7 @@ new TEXTAREA_PREVIEW(
299 299
       <input type="hidden" name="auth"
300 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 304
       <tr>
305 305
         <td class="label">
@@ -355,7 +355,7 @@ new TEXTAREA_PREVIEW(
355 355
     <input type="hidden" name="auth"
356 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 360
     <h3>
361 361
       Target torrent group ID

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

@@ -27,7 +27,7 @@ function get_group_info($GroupID, $Return = true, $RevisionID = 0, $PersonalProp
27 27
           g.`title`,
28 28
           g.`subject`,
29 29
           g.`object`,
30
-          g.`published`,
30
+          g.`year`,
31 31
           g.`workgroup`,
32 32
           g.`location`,
33 33
           g.`identifier`,

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

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

Loading…
Cancel
Save