|
@@ -89,12 +89,16 @@ if (isset($Properties['GroupID'])) {
|
89
|
89
|
$Properties['Artists'] = Artists::get_artist($Properties['GroupID']);
|
90
|
90
|
}
|
91
|
91
|
|
92
|
|
-if ($Type == 'Movies' || $Type == 'Manga' || $Type == 'Anime' || $Type == 'Games' ) {
|
|
92
|
+if ($Type == 'Movies' || $Type == 'Manga' || $Type == 'Anime' || $Type == 'Games') {
|
93
|
93
|
if (empty($_POST['idols'])) {
|
94
|
94
|
$Err = "You didn't enter any goils";
|
95
|
95
|
} else {
|
96
|
96
|
$Artists = $_POST['idols'];
|
97
|
97
|
}
|
|
98
|
+} elseif ($Type == 'Other') {
|
|
99
|
+ if (!empty($_POST['idols'])) {
|
|
100
|
+ $Artists = $_POST['idols'];
|
|
101
|
+ }
|
98
|
102
|
}
|
99
|
103
|
|
100
|
104
|
if (!empty($_POST['requestid'])) {
|
|
@@ -193,7 +197,7 @@ if (!is_uploaded_file($TorrentName) || !filesize($TorrentName)) {
|
193
|
197
|
//Multiple artists!
|
194
|
198
|
|
195
|
199
|
$LogName = '';
|
196
|
|
-if (empty($Properties['GroupID']) && empty($ArtistForm) && ($Type == 'Movies' || $Type == 'Anime' || $Type == 'Manga' || $Type == 'Games')) {
|
|
200
|
+if (empty($Properties['GroupID']) && empty($ArtistForm)) {
|
197
|
201
|
$ArtistNames = [];
|
198
|
202
|
$ArtistForm = [];
|
199
|
203
|
for ($i = 0; $i < count($Artists); $i++) {
|
|
@@ -205,7 +209,7 @@ if (empty($Properties['GroupID']) && empty($ArtistForm) && ($Type == 'Movies' ||
|
205
|
209
|
}
|
206
|
210
|
}
|
207
|
211
|
$LogName .= Artists::display_artists($ArtistForm, false, true, false);
|
208
|
|
-} elseif (($Type == 'Movies' || $Type == 'Anime' || $Type == 'Manga' || $Type == 'Games') && empty($ArtistForm)) {
|
|
212
|
+} elseif (empty($ArtistForm)) {
|
209
|
213
|
$DB->query("
|
210
|
214
|
SELECT ta.ArtistID, ag.Name
|
211
|
215
|
FROM torrents_artists AS ta
|
|
@@ -327,24 +331,53 @@ if (!preg_match('/^'.IMAGE_REGEX.'$/i', $Properties['Image'])) {
|
327
|
331
|
$T['Image'] = "''";
|
328
|
332
|
}
|
329
|
333
|
|
330
|
|
-if ($Type == 'Movies' || $Type == 'Anime' || $Type == 'Manga' || $Type == 'Games') {
|
331
|
|
- // Does it belong in a group?
|
332
|
|
- if ($Properties['GroupID']) {
|
333
|
|
- $DB->query("
|
|
334
|
+// Does it belong in a group?
|
|
335
|
+if ($Properties['GroupID']) {
|
|
336
|
+ $DB->query("
|
|
337
|
+ SELECT
|
|
338
|
+ ID,
|
|
339
|
+ WikiImage,
|
|
340
|
+ WikiBody,
|
|
341
|
+ RevisionID,
|
|
342
|
+ Name,
|
|
343
|
+ Year,
|
|
344
|
+ TagList
|
|
345
|
+ FROM torrents_group
|
|
346
|
+ WHERE id = ".$Properties['GroupID']);
|
|
347
|
+ if ($DB->has_results()) {
|
|
348
|
+ // Don't escape tg.Name. It's written directly to the log table
|
|
349
|
+ list($GroupID, $WikiImage, $WikiBody, $RevisionID, $Properties['Title'], $Properties['Year'], $Properties['TagList']) = $DB->next_record(MYSQLI_NUM, array(4));
|
|
350
|
+ $Properties['TagList'] = str_replace(array(' ', '.', '_'), array(', ', '.', '.'), $Properties['TagList']);
|
|
351
|
+ if (!$Properties['Image'] && $WikiImage) {
|
|
352
|
+ $Properties['Image'] = $WikiImage;
|
|
353
|
+ $T['Image'] = "'".db_string($WikiImage)."'";
|
|
354
|
+ }
|
|
355
|
+ if (strlen($WikiBody) > strlen($Body)) {
|
|
356
|
+ $Body = $WikiBody;
|
|
357
|
+ if (!$Properties['Image'] || $Properties['Image'] == $WikiImage) {
|
|
358
|
+ $NoRevision = true;
|
|
359
|
+ }
|
|
360
|
+ }
|
|
361
|
+ $Properties['Artist'] = Artists::display_artists(Artists::get_artist($GroupID), false, false);
|
|
362
|
+ }
|
|
363
|
+}
|
|
364
|
+if (!isset($GroupID) || !$GroupID) {
|
|
365
|
+ foreach ($ArtistForm as $Num => $Artist) {
|
|
366
|
+ /*$DB->query("
|
334
|
367
|
SELECT
|
335
|
|
- ID,
|
336
|
|
- WikiImage,
|
337
|
|
- WikiBody,
|
338
|
|
- RevisionID,
|
339
|
|
- Name,
|
340
|
|
- Year,
|
341
|
|
- TagList
|
342
|
|
- FROM torrents_group
|
343
|
|
- WHERE id = ".$Properties['GroupID']);
|
|
368
|
+ tg.id,
|
|
369
|
+ tg.WikiImage,
|
|
370
|
+ tg.WikiBody,
|
|
371
|
+ tg.RevisionID
|
|
372
|
+ FROM torrents_group AS tg
|
|
373
|
+ LEFT JOIN torrents_artists AS ta ON ta.GroupID = tg.ID
|
|
374
|
+ LEFT JOIN artists_group AS ag ON ta.ArtistID = ag.ArtistID
|
|
375
|
+ WHERE ag.Name = '".db_string($Artist['name'])."'
|
|
376
|
+ AND tg.Name = ".$T['Title']."
|
|
377
|
+ AND tg.Year = ".$T['Year']);
|
|
378
|
+
|
344
|
379
|
if ($DB->has_results()) {
|
345
|
|
- // Don't escape tg.Name. It's written directly to the log table
|
346
|
|
- list($GroupID, $WikiImage, $WikiBody, $RevisionID, $Properties['Title'], $Properties['Year'], $Properties['TagList']) = $DB->next_record(MYSQLI_NUM, array(4));
|
347
|
|
- $Properties['TagList'] = str_replace(array(' ', '.', '_'), array(', ', '.', '.'), $Properties['TagList']);
|
|
380
|
+ list($GroupID, $WikiImage, $WikiBody, $RevisionID) = $DB->next_record();
|
348
|
381
|
if (!$Properties['Image'] && $WikiImage) {
|
349
|
382
|
$Properties['Image'] = $WikiImage;
|
350
|
383
|
$T['Image'] = "'".db_string($WikiImage)."'";
|
|
@@ -355,58 +388,27 @@ if ($Type == 'Movies' || $Type == 'Anime' || $Type == 'Manga' || $Type == 'Games
|
355
|
388
|
$NoRevision = true;
|
356
|
389
|
}
|
357
|
390
|
}
|
358
|
|
- $Properties['Artist'] = Artists::display_artists(Artists::get_artist($GroupID), false, false);
|
359
|
|
- }
|
360
|
|
- }
|
361
|
|
- if (!isset($GroupID) || !$GroupID) {
|
362
|
|
- foreach ($ArtistForm as $Num => $Artist) {
|
363
|
|
- /*$DB->query("
|
364
|
|
- SELECT
|
365
|
|
- tg.id,
|
366
|
|
- tg.WikiImage,
|
367
|
|
- tg.WikiBody,
|
368
|
|
- tg.RevisionID
|
369
|
|
- FROM torrents_group AS tg
|
370
|
|
- LEFT JOIN torrents_artists AS ta ON ta.GroupID = tg.ID
|
371
|
|
- LEFT JOIN artists_group AS ag ON ta.ArtistID = ag.ArtistID
|
372
|
|
- WHERE ag.Name = '".db_string($Artist['name'])."'
|
373
|
|
- AND tg.Name = ".$T['Title']."
|
374
|
|
- AND tg.Year = ".$T['Year']);
|
|
391
|
+ $ArtistForm = Artists::get_artist($GroupID);
|
|
392
|
+ //This torrent belongs in a group
|
|
393
|
+ break;
|
375
|
394
|
|
|
395
|
+ } else {*/
|
|
396
|
+ // The album hasn't been uploaded. Try to get the artist IDs
|
|
397
|
+ $DB->query("
|
|
398
|
+ SELECT
|
|
399
|
+ ArtistID,
|
|
400
|
+ Name
|
|
401
|
+ FROM artists_group
|
|
402
|
+ WHERE Name = '".db_string($Artist['name'])."'");
|
376
|
403
|
if ($DB->has_results()) {
|
377
|
|
- list($GroupID, $WikiImage, $WikiBody, $RevisionID) = $DB->next_record();
|
378
|
|
- if (!$Properties['Image'] && $WikiImage) {
|
379
|
|
- $Properties['Image'] = $WikiImage;
|
380
|
|
- $T['Image'] = "'".db_string($WikiImage)."'";
|
381
|
|
- }
|
382
|
|
- if (strlen($WikiBody) > strlen($Body)) {
|
383
|
|
- $Body = $WikiBody;
|
384
|
|
- if (!$Properties['Image'] || $Properties['Image'] == $WikiImage) {
|
385
|
|
- $NoRevision = true;
|
386
|
|
- }
|
387
|
|
- }
|
388
|
|
- $ArtistForm = Artists::get_artist($GroupID);
|
389
|
|
- //This torrent belongs in a group
|
390
|
|
- break;
|
391
|
|
-
|
392
|
|
- } else {*/
|
393
|
|
- // The album hasn't been uploaded. Try to get the artist IDs
|
394
|
|
- $DB->query("
|
395
|
|
- SELECT
|
396
|
|
- ArtistID,
|
397
|
|
- Name
|
398
|
|
- FROM artists_group
|
399
|
|
- WHERE Name = '".db_string($Artist['name'])."'");
|
400
|
|
- if ($DB->has_results()) {
|
401
|
|
- while (list($ArtistID, $Name) = $DB->next_record(MYSQLI_NUM, false)) {
|
402
|
|
- if (!strcasecmp($Artist['name'], $Name)) {
|
403
|
|
- $ArtistForm[$Num] = array('id' => $ArtistID, 'name' => $Name);
|
404
|
|
- break;
|
405
|
|
- }
|
|
404
|
+ while (list($ArtistID, $Name) = $DB->next_record(MYSQLI_NUM, false)) {
|
|
405
|
+ if (!strcasecmp($Artist['name'], $Name)) {
|
|
406
|
+ $ArtistForm[$Num] = array('id' => $ArtistID, 'name' => $Name);
|
|
407
|
+ break;
|
406
|
408
|
}
|
407
|
409
|
}
|
408
|
|
- //}
|
409
|
|
- }
|
|
410
|
+ }
|
|
411
|
+ //}
|
410
|
412
|
}
|
411
|
413
|
}
|
412
|
414
|
|
|
@@ -417,7 +419,7 @@ $LogName .= $Properties['Title'];
|
417
|
419
|
$IsNewGroup = !isset($GroupID) || !$GroupID;
|
418
|
420
|
|
419
|
421
|
//----- Start inserts
|
420
|
|
-if ((!isset($GroupID) || !$GroupID) && ($Type != 'Other')) {
|
|
422
|
+if ((!isset($GroupID) || !$GroupID)) {
|
421
|
423
|
//array to store which artists we have added already, to prevent adding an artist twice
|
422
|
424
|
$ArtistsAdded = [];
|
423
|
425
|
foreach ($ArtistForm as $Num => $Artist) {
|
|
@@ -454,14 +456,12 @@ if (!isset($GroupID) || !$GroupID) {
|
454
|
456
|
VALUES
|
455
|
457
|
($TypeID, ".$T['Title'].", ".$T['TitleRJ'].", ".$T['TitleJP'].", ".$T['Year'].", ".$T['Series'].", ".$T['Studio'].", ".$T['CatalogueNumber'].", " . $T['Pages'] . ", '".sqltime()."', '".db_string($Body)."', ".$T['Image'].", ".$T['DLsiteID'].")");
|
456
|
458
|
$GroupID = $DB->inserted_id();
|
457
|
|
- if ($Type == 'Movies' || $Type == 'Anime' || $Type == 'Manga' || $Type == 'Games') {
|
458
|
|
- foreach ($ArtistForm as $Num => $Artist) {
|
459
|
|
- $DB->query("
|
460
|
|
- INSERT IGNORE INTO torrents_artists (GroupID, ArtistID, UserID)
|
461
|
|
- VALUES ($GroupID, ".$Artist['id'].', '.$LoggedUser['ID'].")");
|
462
|
|
- $Cache->increment('stats_album_count');
|
463
|
|
- $Cache->delete_value('artist_groups_'.$Artist['id']);
|
464
|
|
- }
|
|
459
|
+ foreach ($ArtistForm as $Num => $Artist) {
|
|
460
|
+ $DB->query("
|
|
461
|
+ INSERT IGNORE INTO torrents_artists (GroupID, ArtistID, UserID)
|
|
462
|
+ VALUES ($GroupID, ".$Artist['id'].', '.$LoggedUser['ID'].")");
|
|
463
|
+ $Cache->increment('stats_album_count');
|
|
464
|
+ $Cache->delete_value('artist_groups_'.$Artist['id']);
|
465
|
465
|
}
|
466
|
466
|
$Cache->increment('stats_group_count');
|
467
|
467
|
|
|
@@ -694,9 +694,8 @@ if (function_exists('fastcgi_finish_request')) {
|
694
|
694
|
//--------------------------- IRC announce and feeds ---------------------------//
|
695
|
695
|
$Announce = '';
|
696
|
696
|
|
697
|
|
-if ($Type != 'Other') {
|
698
|
|
- $Announce .= Artists::display_artists($ArtistForm, false);
|
699
|
|
-}
|
|
697
|
+$Announce .= Artists::display_artists($ArtistForm, false);
|
|
698
|
+
|
700
|
699
|
$Announce .= empty($Properties['Title']) ? (empty($Properties['TitleRJ']) ? trim($Properties['TitleJP']) : trim($Properties['TitleRJ'])) : trim($Properties['Title']);
|
701
|
700
|
$Announce .= ' ';
|
702
|
701
|
if ($Type != 'Other') {
|