|
@@ -1,4 +1,5 @@
|
1
|
|
-<?
|
|
1
|
+<?php
|
|
2
|
+
|
2
|
3
|
//******************************************************************************//
|
3
|
4
|
//--------------- Take edit ----------------------------------------------------//
|
4
|
5
|
// This pages handles the backend of the 'edit torrent' function. It checks //
|
|
@@ -10,7 +11,6 @@ enforce_login();
|
10
|
11
|
authorize();
|
11
|
12
|
|
12
|
13
|
require_once(SERVER_ROOT.'/classes/validate.class.php');
|
13
|
|
-
|
14
|
14
|
$Validate = new Validate;
|
15
|
15
|
|
16
|
16
|
//******************************************************************************//
|
|
@@ -24,21 +24,45 @@ $_POST['type'] = $_POST['type'] + 1;
|
24
|
24
|
$TypeID = (int)$_POST['type'];
|
25
|
25
|
$Type = $Categories[$TypeID-1];
|
26
|
26
|
$TorrentID = (int)$_POST['torrentid'];
|
|
27
|
+
|
|
28
|
+# todo: Associate containers with categories beforehand
|
|
29
|
+# It may have to happen structurally in config.php, e.g.,
|
|
30
|
+# $Categories = [
|
|
31
|
+# 'GazelleName' => [$Name, $Icon, $Description, $Containers],
|
|
32
|
+# ...
|
|
33
|
+# ];
|
|
34
|
+$Properties['FileTypes'] = [
|
|
35
|
+ 'DNA' => $Containers,
|
|
36
|
+ 'RNA' => $Containers,
|
|
37
|
+ 'Proteins' => $ContainersProt,
|
|
38
|
+ 'Imaging' => $ContainersGames,
|
|
39
|
+ 'Extras' => $ContainersExtra
|
|
40
|
+];
|
|
41
|
+$Properties['ArchiveTypes'] = [
|
|
42
|
+ 'DNA' => $Archives,
|
|
43
|
+ 'RNA' => $Archives,
|
|
44
|
+ 'Proteins' => $Archives,
|
|
45
|
+ 'Imaging' => $Archives,
|
|
46
|
+ 'Extras' => $Archives
|
|
47
|
+];
|
|
48
|
+
|
27
|
49
|
$Properties['Remastered'] = (isset($_POST['remaster']))? 1 : 0;
|
28
|
50
|
if ($Properties['Remastered']) {
|
29
|
|
- $Properties['UnknownRelease'] = (isset($_POST['unknown'])) ? 1 : 0;
|
|
51
|
+ $Properties['UnknownRelease'] = (isset($_POST['unknown'])) ? 1 : 0;
|
30
|
52
|
}
|
31
|
53
|
if (!$Properties['Remastered']) {
|
32
|
|
- $Properties['UnknownRelease'] = 0;
|
|
54
|
+ $Properties['UnknownRelease'] = 0;
|
33
|
55
|
}
|
|
56
|
+
|
34
|
57
|
$Properties['BadTags'] = (isset($_POST['bad_tags']))? 1 : 0;
|
35
|
58
|
$Properties['BadFolders'] = (isset($_POST['bad_folders']))? 1 : 0;
|
36
|
59
|
$Properties['BadFiles'] = (isset($_POST['bad_files'])) ? 1 : 0;
|
|
60
|
+$Properties['Trumpable'] = (isset($_POST['make_trumpable'])) ? 1 : 0;
|
|
61
|
+
|
37
|
62
|
$Properties['Format'] = $_POST['format'];
|
38
|
63
|
$Properties['Media'] = $_POST['media'];
|
39
|
64
|
$Properties['Bitrate'] = $_POST['bitrate'];
|
40
|
65
|
$Properties['Encoding'] = $_POST['bitrate'];
|
41
|
|
-$Properties['Trumpable'] = (isset($_POST['make_trumpable'])) ? 1 : 0;
|
42
|
66
|
$Properties['TorrentDescription'] = $_POST['release_desc'];
|
43
|
67
|
$Properties['MediaInfo'] = $_POST['mediainfo'];
|
44
|
68
|
$Properties['Name'] = $_POST['title'];
|
|
@@ -49,29 +73,31 @@ $Properties['AudioFormat'] = $_POST['audioformat'];
|
49
|
73
|
$Properties['Subbing'] = $_POST['sub'];
|
50
|
74
|
$Properties['Language'] = $_POST['lang'];
|
51
|
75
|
$Properties['Subber']= $_POST['subber'];
|
|
76
|
+
|
52
|
77
|
$Properties['Censored'] = (isset($_POST['censored'])) ? '1' : '0';
|
53
|
78
|
$Properties['Anonymous'] = (isset($_POST['anonymous'])) ? '1' : '0';
|
54
|
79
|
$Properties['Archive'] = (isset($_POST['archive']) && $_POST['archive'] != '---') ? $_POST['archive'] : '';
|
55
|
80
|
|
56
|
81
|
if ($_POST['album_desc']) {
|
57
|
|
- $Properties['GroupDescription'] = $_POST['album_desc'];
|
|
82
|
+ $Properties['GroupDescription'] = $_POST['album_desc'];
|
58
|
83
|
}
|
|
84
|
+
|
59
|
85
|
if (check_perms('torrents_freeleech')) {
|
60
|
|
- $Free = (int)$_POST['freeleech'];
|
61
|
|
- if (!in_array($Free, array(0, 1, 2))) {
|
62
|
|
- error(404);
|
63
|
|
- }
|
64
|
|
- $Properties['FreeLeech'] = $Free;
|
65
|
|
-
|
66
|
|
- if ($Free == 0) {
|
67
|
|
- $FreeType = 0;
|
68
|
|
- } else {
|
69
|
|
- $FreeType = (int)$_POST['freeleechtype'];
|
70
|
|
- if (!in_array($Free, array(0, 1, 2, 3))) {
|
71
|
|
- error(404);
|
|
86
|
+ $Free = (int)$_POST['freeleech'];
|
|
87
|
+ if (!in_array($Free, array(0, 1, 2))) {
|
|
88
|
+ error(404);
|
72
|
89
|
}
|
73
|
|
- }
|
74
|
|
- $Properties['FreeLeechType'] = $FreeType;
|
|
90
|
+ $Properties['FreeLeech'] = $Free;
|
|
91
|
+
|
|
92
|
+ if ($Free === 0) {
|
|
93
|
+ $FreeType = 0;
|
|
94
|
+ } else {
|
|
95
|
+ $FreeType = (int)$_POST['freeleechtype'];
|
|
96
|
+ if (!in_array($Free, array(0, 1, 2, 3))) {
|
|
97
|
+ error(404);
|
|
98
|
+ }
|
|
99
|
+ }
|
|
100
|
+ $Properties['FreeLeechType'] = $FreeType;
|
75
|
101
|
}
|
76
|
102
|
|
77
|
103
|
//******************************************************************************//
|
|
@@ -83,162 +109,204 @@ $DB->query("
|
83
|
109
|
FROM torrents
|
84
|
110
|
WHERE ID = $TorrentID");
|
85
|
111
|
*/
|
|
112
|
+
|
86
|
113
|
$DB->query("
|
87
|
114
|
SELECT UserID, FreeTorrent
|
88
|
115
|
FROM torrents
|
89
|
116
|
WHERE ID = $TorrentID");
|
|
117
|
+
|
90
|
118
|
if (!$DB->has_results()) {
|
91
|
|
- error(404);
|
|
119
|
+ error(404);
|
92
|
120
|
}
|
|
121
|
+
|
93
|
122
|
// list($UserID, $Remastered, $RemasterYear, $CurFreeLeech) = $DB->next_record(MYSQLI_BOTH, false);
|
94
|
123
|
list($UserID, $CurFreeLeech) = $DB->next_record(MYSQLI_BOTH, false);
|
95
|
124
|
|
96
|
125
|
if ($LoggedUser['ID'] != $UserID && !check_perms('torrents_edit')) {
|
97
|
|
- error(403);
|
|
126
|
+ error(403);
|
98
|
127
|
}
|
99
|
128
|
|
100
|
|
-/*
|
101
|
|
-if ($Remastered == '1' && !$RemasterYear && !check_perms('edit_unknowns')) {
|
|
129
|
+/* todo: Check strict equality and untangle features
|
|
130
|
+if ($Remastered === '1' && !$RemasterYear && !check_perms('edit_unknowns')) {
|
102
|
131
|
error(403);
|
103
|
132
|
}
|
104
|
133
|
*/
|
105
|
134
|
|
106
|
|
-if ($Properties['UnknownRelease'] && !($Remastered == '1' && !$RemasterYear) && !check_perms('edit_unknowns')) {
|
107
|
|
- //It's Unknown now, and it wasn't before
|
108
|
|
- if ($LoggedUser['ID'] != $UserID) {
|
109
|
|
- //Hax
|
110
|
|
- die();
|
111
|
|
- }
|
|
135
|
+if ($Properties['UnknownRelease'] && !($Remastered === '1' && !$RemasterYear) && !check_perms('edit_unknowns')) {
|
|
136
|
+ // It's Unknown now, and it wasn't before
|
|
137
|
+ if ($LoggedUser['ID'] !== $UserID) {
|
|
138
|
+ // Hax
|
|
139
|
+ die();
|
|
140
|
+ }
|
112
|
141
|
}
|
113
|
142
|
|
114
|
|
-$Validate->SetFields('type', '1', 'number', 'Not a valid type.', array('maxlength' => count($Categories), 'minlength' => 1));
|
|
143
|
+$Validate->SetFields(
|
|
144
|
+ 'type',
|
|
145
|
+ '1',
|
|
146
|
+ 'number',
|
|
147
|
+ 'Not a valid type',
|
|
148
|
+ array('maxlength' => count($Categories), 'minlength' => 1)
|
|
149
|
+);
|
|
150
|
+
|
|
151
|
+/* Ugh
|
115
|
152
|
switch ($Type) {
|
116
|
153
|
case 'Music':
|
117
|
154
|
if (!empty($Properties['Remastered']) && !$Properties['UnknownRelease']) {
|
118
|
|
- $Validate->SetFields('remaster_year', '1', 'number', 'Year of remaster/re-issue must be entered.');
|
|
155
|
+ $Validate->SetFields(
|
|
156
|
+ 'remaster_year',
|
|
157
|
+ '1',
|
|
158
|
+ 'number',
|
|
159
|
+ 'Year of remaster/re-issue must be entered'
|
|
160
|
+ );
|
119
|
161
|
} else {
|
120
|
|
- $Validate->SetFields('remaster_year', '0','number', 'Invalid remaster year.');
|
|
162
|
+ $Validate->SetFields(
|
|
163
|
+ 'remaster_year',
|
|
164
|
+ '0',
|
|
165
|
+ 'number',
|
|
166
|
+ 'Invalid remaster year'
|
|
167
|
+ );
|
121
|
168
|
}
|
122
|
169
|
|
123
|
|
- if (!empty($Properties['Remastered']) && !$Properties['UnknownRelease'] && $Properties['RemasterYear'] < 1982 && $Properties['Media'] == 'CD') {
|
124
|
|
- error('You have selected a year for an album that predates the medium you say it was created on.');
|
125
|
|
- header("Location: torrents.php?action=edit&id=$TorrentID");
|
126
|
|
- die();
|
127
|
|
- }
|
128
|
|
-
|
129
|
|
- $Validate->SetFields('remaster_title', '0', 'string', 'Remaster title must be between 2 and 80 characters.', array('maxlength' => 80, 'minlength' => 2));
|
130
|
|
-
|
131
|
|
- if ($Properties['RemasterTitle'] == 'Original Release') {
|
132
|
|
- error('"Original Release" is not a valid remaster title.');
|
133
|
|
- header("Location: torrents.php?action=edit&id=$TorrentID");
|
134
|
|
- die();
|
|
170
|
+ if (!empty($Properties['Remastered']) && !$Properties['UnknownRelease'] && $Properties['RemasterYear'] < 1982 && $Properties['Media'] === 'CD') {
|
|
171
|
+ error('You have selected a year for an album that predates the medium you say it was created on');
|
|
172
|
+ header("Location: torrents.php?action=edit&id=$TorrentID");
|
|
173
|
+ die();
|
135
|
174
|
}
|
136
|
175
|
|
137
|
|
- $Validate->SetFields('remaster_record_label', '0', 'string', 'Remaster record label must be between 2 and 80 characters.', array('maxlength' => 80, 'minlength' => 2));
|
138
|
|
-
|
139
|
|
- $Validate->SetFields('remaster_catalogue_number', '0', 'string', 'Remaster catalogue number must be between 2 and 80 characters.', array('maxlength' => 80, 'minlength' => 2));
|
140
|
|
-
|
141
|
|
-
|
142
|
|
- $Validate->SetFields('format', '1', 'inarray', 'Not a valid format.', array('inarray' => $Formats));
|
143
|
|
-
|
144
|
|
- $Validate->SetFields('bitrate', '1', 'inarray', 'You must choose a bitrate.', array('inarray' => $Bitrates));
|
145
|
|
-
|
146
|
|
-
|
147
|
|
- // Handle 'other' bitrates
|
148
|
|
- if ($Properties['Encoding'] == 'Other') {
|
149
|
|
- $Validate->SetFields('other_bitrate', '1', 'text', 'You must enter the other bitrate (max length: 9 characters).', array('maxlength' => 9));
|
150
|
|
- $enc = trim($_POST['other_bitrate']);
|
151
|
|
- if (isset($_POST['vbr'])) {
|
152
|
|
- $enc .= ' (VBR)';
|
153
|
|
- }
|
154
|
|
-
|
155
|
|
- $Properties['Encoding'] = $enc;
|
156
|
|
- $Properties['Bitrate'] = $enc;
|
157
|
|
- } else {
|
158
|
|
- $Validate->SetFields('bitrate', '1', 'inarray', 'You must choose a bitrate.', array('inarray' => $Bitrates));
|
|
176
|
+ $Validate->SetFields(
|
|
177
|
+ 'remaster_title',
|
|
178
|
+ '0',
|
|
179
|
+ 'string',
|
|
180
|
+ 'Remaster title must be between 2 and 80 characters',
|
|
181
|
+ array('maxlength' => 80, 'minlength' => 2)
|
|
182
|
+ );
|
|
183
|
+
|
|
184
|
+ if ($Properties['RemasterTitle'] === 'Original Release') {
|
|
185
|
+ error('"Original Release" is not a valid remaster title');
|
|
186
|
+ header("Location: torrents.php?action=edit&id=$TorrentID");
|
|
187
|
+ die();
|
159
|
188
|
}
|
160
|
189
|
|
161
|
|
- $Validate->SetFields('media', '1', 'inarray', 'Not a valid media.', array('inarray' => $Media));
|
162
|
|
-
|
163
|
|
- $Validate->SetFields('release_desc', '0', 'string', 'Invalid release description.', array('maxlength' => 1000000, 'minlength' => 0));
|
164
|
|
-
|
165
|
|
- break;
|
166
|
|
-
|
167
|
|
- case 'Audiobooks':
|
168
|
|
- case 'Comedy':
|
169
|
|
- /*$Validate->SetFields('title', '1', 'string', 'Title must be between 2 and 300 characters.', array('maxlength' => 300, 'minlength' => 2));
|
170
|
|
- ^ this is commented out because there is no title field on these pages*/
|
171
|
|
- $Validate->SetFields('year', '1', 'number', 'The year of the release must be entered.');
|
172
|
|
-
|
173
|
|
- $Validate->SetFields('format', '1', 'inarray', 'Not a valid format.', array('inarray' => $Formats));
|
174
|
|
-
|
175
|
|
- $Validate->SetFields('bitrate', '1', 'inarray', 'You must choose a bitrate.', array('inarray' => $Bitrates));
|
|
190
|
+ $Validate->SetFields(
|
|
191
|
+ 'remaster_record_label',
|
|
192
|
+ '0',
|
|
193
|
+ 'string',
|
|
194
|
+ 'Remaster record label must be between 2 and 80 characters',
|
|
195
|
+ array('maxlength' => 80, 'minlength' => 2)
|
|
196
|
+ );
|
|
197
|
+
|
|
198
|
+ $Validate->SetFields(
|
|
199
|
+ 'remaster_catalogue_number',
|
|
200
|
+ '0',
|
|
201
|
+ 'string',
|
|
202
|
+ 'Remaster catalogue number must be between 2 and 80 characters',
|
|
203
|
+ array('maxlength' => 80, 'minlength' => 2)
|
|
204
|
+ );
|
|
205
|
+
|
|
206
|
+ $Validate->SetFields(
|
|
207
|
+ 'format',
|
|
208
|
+ '1',
|
|
209
|
+ 'inarray',
|
|
210
|
+ 'Not a valid format',
|
|
211
|
+ array('inarray' => $Formats)
|
|
212
|
+ );
|
|
213
|
+
|
|
214
|
+ $Validate->SetFields(
|
|
215
|
+ 'bitrate',
|
|
216
|
+ '1',
|
|
217
|
+ 'inarray',
|
|
218
|
+ 'You must choose a bitrate',
|
|
219
|
+ array('inarray' => $Bitrates)
|
|
220
|
+ );
|
176
|
221
|
|
177
|
222
|
|
178
|
223
|
// Handle 'other' bitrates
|
179
|
|
- if ($Properties['Encoding'] == 'Other') {
|
180
|
|
- $Validate->SetFields('other_bitrate', '1', 'text', 'You must enter the other bitrate (max length: 9 characters).', array('maxlength' => 9));
|
181
|
|
- $enc = trim($_POST['other_bitrate']);
|
182
|
|
- if (isset($_POST['vbr'])) {
|
183
|
|
- $enc .= ' (VBR)';
|
184
|
|
- }
|
185
|
|
-
|
186
|
|
- $Properties['Encoding'] = $enc;
|
187
|
|
- $Properties['Bitrate'] = $enc;
|
|
224
|
+ if ($Properties['Encoding'] === 'Other') {
|
|
225
|
+ $Validate->SetFields(
|
|
226
|
+ 'other_bitrate',
|
|
227
|
+ '1',
|
|
228
|
+ 'text',
|
|
229
|
+ 'You must enter the other bitrate (max length: 9 characters)',
|
|
230
|
+ array('maxlength' => 9)
|
|
231
|
+ );
|
|
232
|
+
|
|
233
|
+ $enc = trim($_POST['other_bitrate']);
|
|
234
|
+ if (isset($_POST['vbr'])) {
|
|
235
|
+ $enc .= ' (VBR)';
|
|
236
|
+ }
|
|
237
|
+
|
|
238
|
+ $Properties['Encoding'] = $enc;
|
|
239
|
+ $Properties['Bitrate'] = $enc;
|
188
|
240
|
} else {
|
189
|
|
- $Validate->SetFields('bitrate', '1', 'inarray', 'You must choose a bitrate.', array('inarray' => $Bitrates));
|
|
241
|
+ $Validate->SetFields(
|
|
242
|
+ 'bitrate',
|
|
243
|
+ '1',
|
|
244
|
+ 'inarray',
|
|
245
|
+ 'You must choose a bitrate',
|
|
246
|
+ array('inarray' => $Bitrates)
|
|
247
|
+ );
|
190
|
248
|
}
|
191
|
249
|
|
192
|
|
- $Validate->SetFields('release_desc', '0', 'string', 'The release description has a minimum length of 10 characters.', array('maxlength' => 1000000, 'minlength' => 10));
|
193
|
|
-
|
|
250
|
+ $Validate->SetFields(
|
|
251
|
+ 'media',
|
|
252
|
+ '1',
|
|
253
|
+ 'inarray',
|
|
254
|
+ 'Not a valid media',
|
|
255
|
+ array('inarray' => $Media)
|
|
256
|
+ );
|
|
257
|
+
|
|
258
|
+ $Validate->SetFields(
|
|
259
|
+ 'release_desc',
|
|
260
|
+ '0',
|
|
261
|
+ 'string',
|
|
262
|
+ 'Invalid release description',
|
|
263
|
+ array('maxlength' => 1000000, 'minlength' => 0)
|
|
264
|
+ );
|
194
|
265
|
break;
|
195
|
266
|
|
196
|
|
- case 'Applications':
|
197
|
|
- case 'Comics':
|
198
|
|
- case 'E-Books':
|
199
|
|
- case 'E-Learning Videos':
|
200
|
|
- /*$Validate->SetFields('title', '1', 'string', 'Title must be between 2 and 300 characters.', array('maxlength' => 300, 'minlength' => 2));
|
201
|
|
- ^ this is commented out because there is no title field on these pages*/
|
|
267
|
+ default:
|
202
|
268
|
break;
|
203
|
269
|
}
|
|
270
|
+*/
|
204
|
271
|
|
205
|
272
|
$Err = $Validate->ValidateForm($_POST); // Validate the form
|
206
|
273
|
|
207
|
274
|
if ($Properties['Remastered'] && !$Properties['RemasterYear']) {
|
208
|
|
- //Unknown Edit!
|
209
|
|
- if ($LoggedUser['ID'] == $UserID || check_perms('edit_unknowns')) {
|
210
|
|
- //Fine!
|
211
|
|
- } else {
|
212
|
|
- $Err = "You may not edit someone else's upload to unknown release.";
|
213
|
|
- }
|
|
275
|
+ // Unknown Edit!
|
|
276
|
+ if ($LoggedUser['ID'] === $UserID || check_perms('edit_unknowns')) {
|
|
277
|
+ // Fine!
|
|
278
|
+ } else {
|
|
279
|
+ $Err = "You may not edit someone else's upload to unknown release";
|
|
280
|
+ }
|
214
|
281
|
}
|
215
|
282
|
|
216
|
283
|
// Strip out Amazon's padding
|
|
284
|
+/*
|
217
|
285
|
$AmazonReg = '/(http:\/\/ecx.images-amazon.com\/images\/.+)(\._.*_\.jpg)/i';
|
218
|
286
|
$Matches = [];
|
219
|
287
|
if (preg_match($RegX, $Properties['Image'], $Matches)) {
|
220
|
|
- $Properties['Image'] = $Matches[1].'.jpg';
|
|
288
|
+ $Properties['Image'] = $Matches[1].'.jpg';
|
221
|
289
|
}
|
222
|
290
|
ImageTools::blacklisted($Properties['Image']);
|
|
291
|
+*/
|
223
|
292
|
|
224
|
293
|
if ($Err) { // Show the upload form, with the data the user entered
|
225
|
|
- if (check_perms('site_debug')) {
|
226
|
|
- die($Err);
|
227
|
|
- }
|
228
|
|
- error($Err);
|
|
294
|
+ if (check_perms('site_debug')) {
|
|
295
|
+ die($Err);
|
|
296
|
+ }
|
|
297
|
+ error($Err);
|
229
|
298
|
}
|
230
|
299
|
|
231
|
|
-
|
232
|
300
|
//******************************************************************************//
|
233
|
301
|
//--------------- Make variables ready for database input ----------------------//
|
234
|
302
|
|
235
|
303
|
// Shorten and escape $Properties for database input
|
236
|
304
|
$T = [];
|
237
|
305
|
foreach ($Properties as $Key => $Value) {
|
238
|
|
- $T[$Key] = "'".db_string(trim($Value))."'";
|
239
|
|
- if (!$T[$Key]) {
|
240
|
|
- $T[$Key] = null;
|
241
|
|
- }
|
|
306
|
+ $T[$Key] = "'".db_string(trim($Value))."'";
|
|
307
|
+ if (!$T[$Key]) {
|
|
308
|
+ $T[$Key] = null;
|
|
309
|
+ }
|
242
|
310
|
}
|
243
|
311
|
|
244
|
312
|
$T['Censored'] = $Properties['Censored'];
|
|
@@ -257,20 +325,20 @@ $DBTorVals = $DB->to_array(false, MYSQLI_ASSOC);
|
257
|
325
|
$DBTorVals = $DBTorVals[0];
|
258
|
326
|
$LogDetails = '';
|
259
|
327
|
foreach ($DBTorVals as $Key => $Value) {
|
260
|
|
- $Value = "'$Value'";
|
261
|
|
- if ($Value != $T[$Key]) {
|
262
|
|
- if (!isset($T[$Key])) {
|
263
|
|
- continue;
|
264
|
|
- }
|
265
|
|
- if ((empty($Value) && empty($T[$Key])) || ($Value == "'0'" && $T[$Key] == "''")) {
|
266
|
|
- continue;
|
267
|
|
- }
|
268
|
|
- if ($LogDetails == '') {
|
269
|
|
- $LogDetails = "$Key: $Value -> ".$T[$Key];
|
270
|
|
- } else {
|
271
|
|
- $LogDetails = "$LogDetails, $Key: $Value -> ".$T[$Key];
|
|
328
|
+ $Value = "'$Value'";
|
|
329
|
+ if ($Value != $T[$Key]) {
|
|
330
|
+ if (!isset($T[$Key])) {
|
|
331
|
+ continue;
|
|
332
|
+ }
|
|
333
|
+ if ((empty($Value) && empty($T[$Key])) || ($Value == "'0'" && $T[$Key] == "''")) {
|
|
334
|
+ continue;
|
|
335
|
+ }
|
|
336
|
+ if ($LogDetails == '') {
|
|
337
|
+ $LogDetails = "$Key: $Value -> ".$T[$Key];
|
|
338
|
+ } else {
|
|
339
|
+ $LogDetails = "$LogDetails, $Key: $Value -> ".$T[$Key];
|
|
340
|
+ }
|
272
|
341
|
}
|
273
|
|
- }
|
274
|
342
|
}
|
275
|
343
|
$T['Censored'] = $Properties['Censored'];
|
276
|
344
|
$T['Anonymous'] = $Properties['Anonymous'];
|
|
@@ -308,92 +376,92 @@ $SQL = "
|
308
|
376
|
Anonymous = $T[Anonymous],";
|
309
|
377
|
|
310
|
378
|
if (check_perms('torrents_freeleech')) {
|
311
|
|
- $SQL .= "FreeTorrent = $T[FreeLeech],";
|
312
|
|
- $SQL .= "FreeLeechType = $T[FreeLeechType],";
|
|
379
|
+ $SQL .= "FreeTorrent = $T[FreeLeech],";
|
|
380
|
+ $SQL .= "FreeLeechType = $T[FreeLeechType],";
|
313
|
381
|
}
|
314
|
382
|
|
315
|
383
|
if (check_perms('users_mod')) {
|
316
|
|
-/* if ($T[Format] != "'FLAC'") {
|
317
|
|
- $SQL .= "
|
318
|
|
- HasLog = '0',
|
319
|
|
- HasCue = '0',";
|
320
|
|
- } else {
|
321
|
|
- $SQL .= "
|
322
|
|
- HasLog = $T[HasLog],
|
323
|
|
- HasCue = $T[HasCue],";
|
324
|
|
- }
|
325
|
|
-*/
|
326
|
|
- $DB->query("
|
|
384
|
+ /* if ($T[Format] != "'FLAC'") {
|
|
385
|
+ $SQL .= "
|
|
386
|
+ HasLog = '0',
|
|
387
|
+ HasCue = '0',";
|
|
388
|
+ } else {
|
|
389
|
+ $SQL .= "
|
|
390
|
+ HasLog = $T[HasLog],
|
|
391
|
+ HasCue = $T[HasCue],";
|
|
392
|
+ }
|
|
393
|
+ */
|
|
394
|
+ $DB->query("
|
327
|
395
|
SELECT TorrentID
|
328
|
396
|
FROM torrents_bad_tags
|
329
|
397
|
WHERE TorrentID = '$TorrentID'");
|
330
|
|
- list($btID) = $DB->next_record();
|
|
398
|
+ list($btID) = $DB->next_record();
|
331
|
399
|
|
332
|
|
- if (!$btID && $Properties['BadTags']) {
|
333
|
|
- $DB->query("
|
|
400
|
+ if (!$btID && $Properties['BadTags']) {
|
|
401
|
+ $DB->query("
|
334
|
402
|
INSERT INTO torrents_bad_tags
|
335
|
403
|
VALUES ($TorrentID, $LoggedUser[ID], NOW())");
|
336
|
|
- }
|
337
|
|
- if ($btID && !$Properties['BadTags']) {
|
338
|
|
- $DB->query("
|
|
404
|
+ }
|
|
405
|
+ if ($btID && !$Properties['BadTags']) {
|
|
406
|
+ $DB->query("
|
339
|
407
|
DELETE FROM torrents_bad_tags
|
340
|
408
|
WHERE TorrentID = '$TorrentID'");
|
341
|
|
- }
|
|
409
|
+ }
|
342
|
410
|
|
343
|
|
- $DB->query("
|
|
411
|
+ $DB->query("
|
344
|
412
|
SELECT TorrentID
|
345
|
413
|
FROM torrents_bad_folders
|
346
|
414
|
WHERE TorrentID = '$TorrentID'");
|
347
|
|
- list($bfID) = $DB->next_record();
|
|
415
|
+ list($bfID) = $DB->next_record();
|
348
|
416
|
|
349
|
|
- if (!$bfID && $Properties['BadFolders']) {
|
350
|
|
- $DB->query("
|
|
417
|
+ if (!$bfID && $Properties['BadFolders']) {
|
|
418
|
+ $DB->query("
|
351
|
419
|
INSERT INTO torrents_bad_folders
|
352
|
420
|
VALUES ($TorrentID, $LoggedUser[ID], NOW())");
|
353
|
|
- }
|
354
|
|
- if ($bfID && !$Properties['BadFolders']) {
|
355
|
|
- $DB->query("
|
|
421
|
+ }
|
|
422
|
+ if ($bfID && !$Properties['BadFolders']) {
|
|
423
|
+ $DB->query("
|
356
|
424
|
DELETE FROM torrents_bad_folders
|
357
|
425
|
WHERE TorrentID = '$TorrentID'");
|
358
|
|
- }
|
|
426
|
+ }
|
359
|
427
|
|
360
|
|
- $DB->query("
|
|
428
|
+ $DB->query("
|
361
|
429
|
SELECT TorrentID
|
362
|
430
|
FROM torrents_bad_files
|
363
|
431
|
WHERE TorrentID = '$TorrentID'");
|
364
|
|
- list($bfiID) = $DB->next_record();
|
|
432
|
+ list($bfiID) = $DB->next_record();
|
365
|
433
|
|
366
|
|
- if (!$bfiID && $Properties['BadFiles']) {
|
367
|
|
- $DB->query("
|
|
434
|
+ if (!$bfiID && $Properties['BadFiles']) {
|
|
435
|
+ $DB->query("
|
368
|
436
|
INSERT INTO torrents_bad_files
|
369
|
437
|
VALUES ($TorrentID, $LoggedUser[ID], NOW())");
|
370
|
|
- }
|
371
|
|
- if ($bfiID && !$Properties['BadFiles']) {
|
372
|
|
- $DB->query("
|
|
438
|
+ }
|
|
439
|
+ if ($bfiID && !$Properties['BadFiles']) {
|
|
440
|
+ $DB->query("
|
373
|
441
|
DELETE FROM torrents_bad_files
|
374
|
442
|
WHERE TorrentID = '$TorrentID'");
|
375
|
|
- }
|
|
443
|
+ }
|
376
|
444
|
|
377
|
|
- $DB->query("
|
|
445
|
+ $DB->query("
|
378
|
446
|
SELECT TorrentID
|
379
|
447
|
FROM library_contest
|
380
|
448
|
WHERE TorrentID = '$TorrentID'");
|
381
|
|
- list($lbID) = $DB->next_record();
|
382
|
|
- if (!$lbID && $Properties['LibraryUpload'] && $Properties['LibraryPoints'] > 0) {
|
383
|
|
- $DB->query("
|
|
449
|
+ list($lbID) = $DB->next_record();
|
|
450
|
+ if (!$lbID && $Properties['LibraryUpload'] && $Properties['LibraryPoints'] > 0) {
|
|
451
|
+ $DB->query("
|
384
|
452
|
SELECT UserID
|
385
|
453
|
FROM torrents
|
386
|
454
|
WHERE ID = $TorrentID");
|
387
|
|
- list($UploaderID) = $DB->next_record();
|
388
|
|
- $DB->query("
|
|
455
|
+ list($UploaderID) = $DB->next_record();
|
|
456
|
+ $DB->query("
|
389
|
457
|
INSERT INTO library_contest
|
390
|
458
|
VALUES ($UploaderID, $TorrentID, $Properties[LibraryPoints])");
|
391
|
|
- }
|
392
|
|
- if ($lbID && !$Properties['LibraryUpload']) {
|
393
|
|
- $DB->query("
|
|
459
|
+ }
|
|
460
|
+ if ($lbID && !$Properties['LibraryUpload']) {
|
|
461
|
+ $DB->query("
|
394
|
462
|
DELETE FROM library_contest
|
395
|
463
|
WHERE TorrentID = '$TorrentID'");
|
396
|
|
- }
|
|
464
|
+ }
|
397
|
465
|
}
|
398
|
466
|
|
399
|
467
|
$SQL .= "
|
|
@@ -402,7 +470,7 @@ $SQL .= "
|
402
|
470
|
$DB->query($SQL);
|
403
|
471
|
|
404
|
472
|
if (check_perms('torrents_freeleech') && $Properties['FreeLeech'] != $CurFreeLeech) {
|
405
|
|
- Torrents::freeleech_torrents($TorrentID, $Properties['FreeLeech'], $Properties['FreeLeechType']);
|
|
473
|
+ Torrents::freeleech_torrents($TorrentID, $Properties['FreeLeech'], $Properties['FreeLeechType']);
|
406
|
474
|
}
|
407
|
475
|
|
408
|
476
|
$DB->query("
|
|
@@ -413,11 +481,11 @@ list($GroupID, $Time) = $DB->next_record();
|
413
|
481
|
|
414
|
482
|
// Competition
|
415
|
483
|
if (strtotime($Time) > 1241352173) {
|
416
|
|
- if ($_POST['log_score'] == '100') {
|
417
|
|
- $DB->query("
|
|
484
|
+ if ($_POST['log_score'] == '100') {
|
|
485
|
+ $DB->query("
|
418
|
486
|
INSERT IGNORE into users_points (GroupID, UserID, Points)
|
419
|
487
|
VALUES ('$GroupID', '$UserID', '1')");
|
420
|
|
- }
|
|
488
|
+ }
|
421
|
489
|
}
|
422
|
490
|
// End competiton
|
423
|
491
|
|
|
@@ -442,4 +510,3 @@ Torrents::update_hash($GroupID);
|
442
|
510
|
// All done!
|
443
|
511
|
|
444
|
512
|
header("Location: torrents.php?id=$GroupID");
|
445
|
|
-?>
|