Browse Source

Merge branch 'other-creators' of tricidious/Gazelle into master

spaghetti 7 years ago
parent
commit
f3ad44be76

+ 24
- 0
classes/torrent_form.class.php View File

916
         <td><input type="text" id="title_jp" name="title_jp" size="60" value="<?=display_str($Torrent['TitleJP'])?>" <?=$this->Disabled?>/></td>
916
         <td><input type="text" id="title_jp" name="title_jp" size="60" value="<?=display_str($Torrent['TitleJP'])?>" <?=$this->Disabled?>/></td>
917
       </tr>
917
       </tr>
918
 <? } ?>
918
 <? } ?>
919
+      <tr>
920
+        <td class="label">Creators/Authors (Optional):</td>
921
+        <td id="idolfields">
922
+      <?      if (!empty($Torrent['Artists'])) {
923
+          foreach ($Torrent['Artists'] as $Num => $Artist) { ?>
924
+            <input type="text" id="idols_<?=$Num?>" name="idols[]" size="45" value="<?=display_str($Artist['name'])?>" <?=$this->Disabled?> />
925
+            <? if ($Num == 0) { ?>
926
+              <a class="add_artist_button brackets">+</a> <a class="remove_artist_button brackets">&minus;</a>
927
+            <? }
928
+            }
929
+          } else { ?>
930
+            <input type="text" id="idols_0" name="idols[]" size="45" value="" <?=$this->Disabled?> />
931
+            <a class="add_artist_button brackets">+</a> <a class="remove_artist_button brackets">&minus;</a>
932
+      <?        } ?>
933
+        </td>
934
+      </tr>
935
+      <tr>
936
+        <td class="label">Publisher (Optional):</td>
937
+        <td><input type="text" id="studio" name="studio" size="60" value="<?=display_str($Torrent['Studio']) ?>" <?=$this->Disabled?>/></td>
938
+      </tr>
939
+      <tr>
940
+        <td class="label">DLsite ID:</td>
941
+        <td><input type="text" id="dlsiteid" name="dlsiteid" size="8" maxlength="8" value="<?=display_str($Torrent['DLsiteID'])?>" <?=$this->Disabled?>/></td>
942
+      </tr>
919
       <tr>
943
       <tr>
920
         <td class="label">Censored?:</td>
944
         <td class="label">Censored?:</td>
921
         <td>
945
         <td>

+ 8
- 12
sections/artist/artist.php View File

652
   foreach ($Requests as $RequestID => $Request) {
652
   foreach ($Requests as $RequestID => $Request) {
653
       $CategoryName = $Categories[$Request['CategoryID'] - 1];
653
       $CategoryName = $Categories[$Request['CategoryID'] - 1];
654
       $Title = empty($Request['Title']) ? (empty($Request['TitleRJ']) ? display_str($Request['TitleJP']) : display_str($Request['TitleRJ'])) : display_str($Request['Title']);
654
       $Title = empty($Request['Title']) ? (empty($Request['TitleRJ']) ? display_str($Request['TitleJP']) : display_str($Request['TitleRJ'])) : display_str($Request['Title']);
655
-      if ($CategoryName != 'Other') {
656
-        $ArtistForm = Requests::get_artists($RequestID);
657
-        $ArtistLink = Artists::display_artists($ArtistForm, true, true);
658
-        $FullName = $ArtistLink."<a href=\"requests.php?action=view&amp;id=$RequestID\"><span dir=\"ltr\">$Title</span></a>";
655
+      $ArtistForm = Requests::get_artists($RequestID);
656
+      $ArtistLink = Artists::display_artists($ArtistForm, true, true);
657
+      $FullName = $ArtistLink."<a href=\"requests.php?action=view&amp;id=$RequestID\"><span dir=\"ltr\">$Title</span></a>";
659
 
658
 
660
-        if ($Request['CatalogueNumber']) {
661
-          $FullName .= " [$Request[CatalogueNumber]]";
662
-        }
663
-        if ($Request['DLSiteID']) {
664
-          $FullName.= " [$Request[DLSiteID]]";
665
-        }
666
-      } else {
667
-        $FullName = "<a href=\"requests.php?action=view&amp;id=$RequestID\" dir=\"ltr\">$Title</a>";
659
+      if ($Request['CatalogueNumber']) {
660
+        $FullName .= " [$Request[CatalogueNumber]]";
661
+      }
662
+      if ($Request['DLSiteID']) {
663
+        $FullName.= " [$Request[DLSiteID]]";
668
       }
664
       }
669
 
665
 
670
       if (!empty($Tags[$RequestID])) {
666
       if (!empty($Tags[$RequestID])) {

+ 1
- 3
sections/requests/new_edit.php View File

53
       error(403);
53
       error(403);
54
     }
54
     }
55
 
55
 
56
-    if ($CategoryName != 'Other') {
57
-      $ArtistForm = Requests::get_artists($RequestID);
58
-    }
56
+    $ArtistForm = Requests::get_artists($RequestID);
59
 
57
 
60
     $Tags = implode(', ', $Request['Tags']);
58
     $Tags = implode(', ', $Request['Tags']);
61
   }
59
   }

+ 28
- 37
sections/requests/request.php View File

30
 $Title = empty($Request['Title']) ? (empty($Request['TitleRJ']) ? $Request['TitleJP'] : $Request['TitleRJ']) : $Request['Title'];
30
 $Title = empty($Request['Title']) ? (empty($Request['TitleRJ']) ? $Request['TitleJP'] : $Request['TitleRJ']) : $Request['Title'];
31
 
31
 
32
 //Do we need to get artists?
32
 //Do we need to get artists?
33
-if ($CategoryName != 'Other') {
34
-  $ArtistForm = Requests::get_artists($RequestID);
35
-  $ArtistName = Artists::display_artists($ArtistForm, false, true);
36
-  $ArtistLink = Artists::display_artists($ArtistForm, true, true);
37
-
38
-  if ($IsFilled) {
39
-    $DisplayLink = "$ArtistLink<a href=\"torrents.php?torrentid=$Request[TorrentID]\" dir=\"ltr\">$Title</a>";
40
-  } else {
41
-    $DisplayLink = $ArtistLink.'<span dir="ltr">'.$Title."</span>";
42
-  }
43
-
44
-  $FullName = $ArtistName.$Title;
33
+$ArtistForm = Requests::get_artists($RequestID);
34
+$ArtistName = Artists::display_artists($ArtistForm, false, true);
35
+$ArtistLink = Artists::display_artists($ArtistForm, true, true);
45
 
36
 
37
+if ($IsFilled) {
38
+  $DisplayLink = "$ArtistLink<a href=\"torrents.php?torrentid=$Request[TorrentID]\" dir=\"ltr\">$Title</a>";
46
 } else {
39
 } else {
47
-  if ($IsFilled) {
48
-    $DisplayLink = "<a href=\"torrents.php?torrentid=$Request[TorrentID]\" dir=\"ltr\">$Title</a>";
49
-  } else {
50
-    $DisplayLink = "<span dir=\"ltr\">$Title</span>";
51
-  }
52
-  $FullName = $Title;
40
+  $DisplayLink = $ArtistLink.'<span dir="ltr">'.$Title."</span>";
53
 }
41
 }
54
 
42
 
43
+$FullName = $ArtistName.$Title;
44
+
55
 $Extra = "";
45
 $Extra = "";
56
 
46
 
57
 if (!empty($Request['TitleRJ']) && $Request['TitleRJ'] != $Title) {
47
 if (!empty($Request['TitleRJ']) && $Request['TitleRJ'] != $Title) {
135
     </div>
125
     </div>
136
 <?
126
 <?
137
   }
127
   }
138
-  if ($CategoryName != 'Other') {
139
-    $ArtistVariant = "";
140
-    switch ($CategoryName) {
141
-      case "Movies":
142
-        $ArtistVariant = "Idols";
143
-        break;
144
-      case "Anime":
145
-        $ArtistVariant = "Studios";
146
-        break;
147
-      case "Manga":
148
-        $ArtistVariant = "Artists";
149
-        break;
150
-      case "Games":
151
-        $ArtistVariant = "Developers";
152
-        break;
153
-      default:
154
-        $ArtistVariant = "Artists";
155
-    }
128
+  $ArtistVariant = "";
129
+  switch ($CategoryName) {
130
+    case "Movies":
131
+      $ArtistVariant = "Idols";
132
+      break;
133
+    case "Anime":
134
+      $ArtistVariant = "Studios";
135
+      break;
136
+    case "Manga":
137
+      $ArtistVariant = "Artists";
138
+      break;
139
+    case "Games":
140
+      $ArtistVariant = "Developers";
141
+      break;
142
+    case "Other":
143
+      $ArtistVariant = "Creators";
144
+      break;
145
+    default:
146
+      $ArtistVariant = "Artists";
147
+  }
156
 ?>
148
 ?>
157
     <div class="box box_artists">
149
     <div class="box box_artists">
158
       <div class="head"><strong><?=$ArtistVariant?></strong></div>
150
       <div class="head"><strong><?=$ArtistVariant?></strong></div>
164
 <?    } ?>
156
 <?    } ?>
165
       </ul>
157
       </ul>
166
     </div>
158
     </div>
167
-<?  } ?>
168
     <div class="box box_tags">
159
     <div class="box box_tags">
169
       <div class="head"><strong>Tags</strong></div>
160
       <div class="head"><strong>Tags</strong></div>
170
       <ul class="stats nobullet">
161
       <ul class="stats nobullet">

+ 16
- 20
sections/requests/requests.php View File

493
 
493
 
494
     $Title = empty($Request['Title']) ? (empty($Request['TitleRJ']) ? $Request['TitleJP'] : $Request['TitleRJ']) : $Request['Title'];
494
     $Title = empty($Request['Title']) ? (empty($Request['TitleRJ']) ? $Request['TitleJP'] : $Request['TitleRJ']) : $Request['Title'];
495
 
495
 
496
-    if ($CategoryName != 'Other') {
497
-      $ArtistForm = Requests::get_artists($RequestID);
498
-      $ArtistLink = Artists::display_artists($ArtistForm, true, true);
499
-      $FullName = "$ArtistLink<a href=\"requests.php?action=view&amp;id=$RequestID\"><span ";
500
-      if (!isset($LoggedUser['CoverArt']) || $LoggedUser['CoverArt']) {
501
-        $FullName .= 'onmouseover="getCover(event)" data-cover="'.ImageTools::process($Request['Image']).'" onmouseleave="ungetCover(event)" ';
502
-      }
503
-      $FullName .= "dir=\"ltr\">$Title</span></a>";
496
+    $ArtistForm = Requests::get_artists($RequestID);
497
+    $ArtistLink = Artists::display_artists($ArtistForm, true, true);
498
+    $FullName = "$ArtistLink<a href=\"requests.php?action=view&amp;id=$RequestID\"><span ";
499
+    if (!isset($LoggedUser['CoverArt']) || $LoggedUser['CoverArt']) {
500
+      $FullName .= 'onmouseover="getCover(event)" data-cover="'.ImageTools::process($Request['Image']).'" onmouseleave="ungetCover(event)" ';
501
+    }
502
+    $FullName .= "dir=\"ltr\">$Title</span></a>";
504
 
503
 
505
-      $ExtraInfo = '';
504
+    $ExtraInfo = '';
506
 
505
 
507
-      if (!empty($Request['CatalogueNumber'])) {
508
-        $ExtraInfo .= " [$Request[CatalogueNumber]]";
509
-      }
506
+    if (!empty($Request['CatalogueNumber'])) {
507
+      $ExtraInfo .= " [$Request[CatalogueNumber]]";
508
+    }
510
 
509
 
511
-      if (!empty($Request['DLsiteID'])) {
512
-        $ExtraInfo .= " [$Request[DLsiteID]]";
513
-      }
514
-      if ($ExtraInfo) {
515
-        $FullName .= " $ExtraInfo";
516
-      }
517
-    } else {
518
-      $FullName = "<a href=\"requests.php?action=view&amp;id=$RequestID\" dir=\"ltr\">$Title</a>";
510
+    if (!empty($Request['DLsiteID'])) {
511
+      $ExtraInfo .= " [$Request[DLsiteID]]";
512
+    }
513
+    if ($ExtraInfo) {
514
+      $FullName .= " $ExtraInfo";
519
     }
515
     }
520
     $Tags = $Request['Tags'];
516
     $Tags = $Request['Tags'];
521
 ?>
517
 ?>

+ 10
- 17
sections/requests/take_fill.php View File

89
 
89
 
90
 $CategoryName = $Categories[$RequestCategoryID - 1];
90
 $CategoryName = $Categories[$RequestCategoryID - 1];
91
 
91
 
92
-if ($CategoryName != 'Other') {
93
-  if ($RequestCatalogueNumber) {
94
-    if (str_replace('-', '', strtolower($TorrentCatalogueNumber)) !== str_replace('-', '', strtolower($RequestCatalogueNumber))) {
95
-      $Err = "This request requires the catalogue number $RequestCatalogueNumber";
96
-    }
92
+if ($RequestCatalogueNumber) {
93
+  if (str_replace('-', '', strtolower($TorrentCatalogueNumber)) !== str_replace('-', '', strtolower($RequestCatalogueNumber))) {
94
+    $Err = "This request requires the catalogue number $RequestCatalogueNumber";
97
   }
95
   }
96
+}
98
 
97
 
99
-  if ($RequestDLSiteID) {
100
-    if (strtolower($TorrentDLSiteID) !== strtolower($RequestDLSiteID)) {
101
-      $Err = "This request requires DLSite ID $RequestDLSiteID";
102
-    }
98
+if ($RequestDLSiteID) {
99
+  if (strtolower($TorrentDLSiteID) !== strtolower($RequestDLSiteID)) {
100
+    $Err = "This request requires DLSite ID $RequestDLSiteID";
103
   }
101
   }
104
-
105
 }
102
 }
106
 
103
 
107
 // Fill request
104
 // Fill request
117
     TimeFilled = '".sqltime()."'
114
     TimeFilled = '".sqltime()."'
118
   WHERE ID = $RequestID");
115
   WHERE ID = $RequestID");
119
 
116
 
120
-if ($CategoryName != 'Other') {
121
-  $ArtistForm = Requests::get_artists($RequestID);
122
-  $ArtistName = Artists::display_artists($ArtistForm, false, true);
123
-  $FullName = $ArtistName.$Title;
124
-} else {
125
-  $FullName = $Title;
126
-}
117
+$ArtistForm = Requests::get_artists($RequestID);
118
+$ArtistName = Artists::display_artists($ArtistForm, false, true);
119
+$FullName = $ArtistName.$Title;
127
 
120
 
128
 $DB->query("
121
 $DB->query("
129
   SELECT UserID
122
   SELECT UserID

+ 27
- 36
sections/requests/take_new_edit.php View File

106
   $Description = trim($_POST['description']);
106
   $Description = trim($_POST['description']);
107
 }
107
 }
108
 
108
 
109
-if ($CategoryName != 'Other') {
110
-  if (empty($_POST['artists'])) {
111
-    $Err = 'You did not enter any artists.';
112
-  } else {
113
-    $Artists = $_POST['artists'];
114
-  }
115
-
116
-  //Not required
117
-  if (!empty($_POST['cataloguenumber']) && $CategoryName == 'Movies') {
118
-    $CatalogueNumber = trim($_POST['cataloguenumber']);
119
-  } else {
120
-    $CatalogueNumber = '';
121
-  }
122
-  if (!empty($_POST['dlsiteid']) && $CategoryName == 'Games') {
123
-    $DLSiteID = trim($_POST['dlsiteid']);
124
-  } else {
125
-    $DLSiteID = '';
126
-  }
109
+if (empty($_POST['artists']) && $CategoryName != 'Other') {
110
+  $Err = 'You did not enter any artists.';
111
+} else {
112
+  $Artists = $_POST['artists'];
113
+}
127
 
114
 
115
+//Not required
116
+if (!empty($_POST['cataloguenumber']) && $CategoryName == 'Movies') {
117
+  $CatalogueNumber = trim($_POST['cataloguenumber']);
118
+} else {
119
+  $CatalogueNumber = '';
120
+}
121
+if (!empty($_POST['dlsiteid']) && $CategoryName == 'Games') {
122
+  $DLSiteID = trim($_POST['dlsiteid']);
123
+} else {
124
+  $DLSiteID = '';
128
 }
125
 }
129
 
126
 
130
 // GroupID
127
 // GroupID
150
 }
147
 }
151
 
148
 
152
 //For refilling on error
149
 //For refilling on error
153
-if ($CategoryName != 'Other') {
154
-  $ArtistNames = [];
155
-  $ArtistForm = [];
156
-  for ($i = 0; $i < count($Artists); $i++) {
157
-    if (trim($Artists[$i]) !== '') {
158
-      if (!in_array($Artists[$i], $ArtistNames)) {
159
-        $ArtistForm[] = array('name' => trim($Artists[$i]));
160
-        $ArtistNames[] = trim($Artists[$i]);
161
-      }
150
+$ArtistNames = [];
151
+$ArtistForm = [];
152
+for ($i = 0; $i < count($Artists); $i++) {
153
+  if (trim($Artists[$i]) !== '') {
154
+    if (!in_array($Artists[$i], $ArtistNames)) {
155
+      $ArtistForm[] = array('name' => trim($Artists[$i]));
156
+      $ArtistNames[] = trim($Artists[$i]);
162
     }
157
     }
163
   }
158
   }
164
-  if (!isset($ArtistNames[0])) {
165
-    unset($ArtistForm);
166
-  }
159
+}
160
+if (!isset($ArtistNames[0])) {
161
+  unset($ArtistForm);
167
 }
162
 }
168
 
163
 
169
 if (!empty($Err)) {
164
 if (!empty($Err)) {
291
  * 2. For each artist that didn't exist, create an artist.
286
  * 2. For each artist that didn't exist, create an artist.
292
  * 3. Create a row in the requests_artists table for each artist, based on the ID.
287
  * 3. Create a row in the requests_artists table for each artist, based on the ID.
293
  */
288
  */
294
-if (isset($CategoryName) && $CategoryName != "Other" && isset($ArtistForm)) {
289
+if (isset($ArtistForm)) {
295
   foreach ($ArtistForm as $Num => $Artist) {
290
   foreach ($ArtistForm as $Num => $Artist) {
296
     //1. See if each artist given already exists and if it does, grab the ID.
291
     //1. See if each artist given already exists and if it does, grab the ID.
297
     $DB->query("
292
     $DB->query("
416
 
411
 
417
   $AnnounceTitle = empty($Title) ? (empty($TitleRJ) ? $TitleJP : $TitleRJ) : $Title;
412
   $AnnounceTitle = empty($Title) ? (empty($TitleRJ) ? $TitleJP : $TitleRJ) : $Title;
418
 
413
 
419
-  if ($CategoryName != 'Other') {
420
-    $Announce = "\"$AnnounceTitle\"".(isset($ArtistForm)?(' - '.Artists::display_artists($ArtistForm, false, false)):'').' '.site_url()."requests.php?action=view&id=$RequestID - ".implode(' ', $Tags);
421
-  } else {
422
-    $Announce = "\"$AnnounceTitle\" - ".site_url()."requests.php?action=view&id=$RequestID - ".implode(' ', $Tags);
423
-  }
414
+  $Announce = "\"$AnnounceTitle\"".(isset($ArtistForm)?(' - '.Artists::display_artists($ArtistForm, false, false)):'').' '.site_url()."requests.php?action=view&id=$RequestID - ".implode(' ', $Tags);
424
   send_irc('PRIVMSG '.BOT_REQUEST_CHAN.' '.$Announce);
415
   send_irc('PRIVMSG '.BOT_REQUEST_CHAN.' '.$Announce);
425
 
416
 
426
 } else {
417
 } else {

+ 3
- 7
sections/requests/take_unfill.php View File

45
 
45
 
46
 $CategoryName = $Categories[$CategoryID - 1];
46
 $CategoryName = $Categories[$CategoryID - 1];
47
 
47
 
48
-if ($CategoryName != 'Other') {
49
-  $ArtistForm = Requests::get_artists($RequestID);
50
-  $ArtistName = Artists::display_artists($ArtistForm, false, true);
51
-  $FullName = $ArtistName.$Title;
52
-} else {
53
-  $FullName = $Title;
54
-}
48
+$ArtistForm = Requests::get_artists($RequestID);
49
+$ArtistName = Artists::display_artists($ArtistForm, false, true);
50
+$FullName = $ArtistName.$Title;
55
 
51
 
56
 $RequestVotes = Requests::get_votes_array($RequestID);
52
 $RequestVotes = Requests::get_votes_array($RequestID);
57
 
53
 

+ 0
- 5
sections/torrents/details.php View File

243
 <?    } ?>
243
 <?    } ?>
244
 
244
 
245
   </div>
245
   </div>
246
-<?
247
-if ($Categories[$GroupCategoryID - 1] != 'Other') {
248
-  $ShownWith = false;
249
-?>
250
     <div class="box box_artists">
246
     <div class="box box_artists">
251
       <div class="head"><strong>Artists</strong>
247
       <div class="head"><strong>Artists</strong>
252
       <?=check_perms('torrents_edit') ? '<span class="edit_artists"><a onclick="ArtistManager(); return false;" href="#" class="brackets float_right">Edit</a></span>' : ''?>
248
       <?=check_perms('torrents_edit') ? '<span class="edit_artists"><a onclick="ArtistManager(); return false;" href="#" class="brackets float_right">Edit</a></span>' : ''?>
276
     </div>
272
     </div>
277
 <?
273
 <?
278
     }
274
     }
279
-  }
280
 ?>
275
 ?>
281
     <div class="box box_tags">
276
     <div class="box box_tags">
282
       <div class="head">
277
       <div class="head">

+ 1
- 5
sections/torrents/user.php View File

506
 
506
 
507
     $TorrentTags = new Tags($TagList);
507
     $TorrentTags = new Tags($TagList);
508
 
508
 
509
-    if ($Categories[$GroupCategoryID-1] != 'Other') {
510
-      $DisplayName = Artists::display_artists($Artists);
511
-    } else {
512
-      $DisplayName = '';
513
-    }
509
+    $DisplayName = Artists::display_artists($Artists);
514
     $DisplayName .= '<a href="torrents.php?id='.$GroupID.'&amp;torrentid='.$TorrentID.'" ';
510
     $DisplayName .= '<a href="torrents.php?id='.$GroupID.'&amp;torrentid='.$TorrentID.'" ';
515
     if (!isset($LoggedUser['CoverArt']) || $LoggedUser['CoverArt']) {
511
     if (!isset($LoggedUser['CoverArt']) || $LoggedUser['CoverArt']) {
516
       $DisplayName .= 'onmouseover="getCover(event)" data-cover="'.ImageTools::process($WikiImage).'" onmouseleave="ungetCover()" ';
512
       $DisplayName .= 'onmouseover="getCover(event)" data-cover="'.ImageTools::process($WikiImage).'" onmouseleave="ungetCover()" ';

+ 78
- 79
sections/upload/upload_handle.php View File

89
   $Properties['Artists'] = Artists::get_artist($Properties['GroupID']);
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
   if (empty($_POST['idols'])) {
93
   if (empty($_POST['idols'])) {
94
     $Err = "You didn't enter any goils";
94
     $Err = "You didn't enter any goils";
95
   } else {
95
   } else {
96
     $Artists = $_POST['idols'];
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
 if (!empty($_POST['requestid'])) {
104
 if (!empty($_POST['requestid'])) {
193
 //Multiple artists!
197
 //Multiple artists!
194
 
198
 
195
 $LogName = '';
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
   $ArtistNames = [];
201
   $ArtistNames = [];
198
   $ArtistForm = [];
202
   $ArtistForm = [];
199
   for ($i = 0; $i < count($Artists); $i++) {
203
   for ($i = 0; $i < count($Artists); $i++) {
205
     }
209
     }
206
   }
210
   }
207
   $LogName .= Artists::display_artists($ArtistForm, false, true, false);
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
   $DB->query("
213
   $DB->query("
210
     SELECT ta.ArtistID, ag.Name
214
     SELECT ta.ArtistID, ag.Name
211
     FROM torrents_artists AS ta
215
     FROM torrents_artists AS ta
327
   $T['Image'] = "''";
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
       SELECT
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
     if ($DB->has_results()) {
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
       if (!$Properties['Image'] && $WikiImage) {
381
       if (!$Properties['Image'] && $WikiImage) {
349
         $Properties['Image'] = $WikiImage;
382
         $Properties['Image'] = $WikiImage;
350
         $T['Image'] = "'".db_string($WikiImage)."'";
383
         $T['Image'] = "'".db_string($WikiImage)."'";
355
           $NoRevision = true;
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
       if ($DB->has_results()) {
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
 $IsNewGroup = !isset($GroupID) || !$GroupID;
419
 $IsNewGroup = !isset($GroupID) || !$GroupID;
418
 
420
 
419
 //----- Start inserts
421
 //----- Start inserts
420
-if ((!isset($GroupID) || !$GroupID) && ($Type != 'Other')) {
422
+if ((!isset($GroupID) || !$GroupID)) {
421
   //array to store which artists we have added already, to prevent adding an artist twice
423
   //array to store which artists we have added already, to prevent adding an artist twice
422
   $ArtistsAdded = [];
424
   $ArtistsAdded = [];
423
   foreach ($ArtistForm as $Num => $Artist) {
425
   foreach ($ArtistForm as $Num => $Artist) {
454
     VALUES
456
     VALUES
455
       ($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'].")");
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
   $GroupID = $DB->inserted_id();
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
   $Cache->increment('stats_group_count');
466
   $Cache->increment('stats_group_count');
467
 
467
 
694
 //--------------------------- IRC announce and feeds ---------------------------//
694
 //--------------------------- IRC announce and feeds ---------------------------//
695
 $Announce = '';
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
 $Announce .= empty($Properties['Title']) ? (empty($Properties['TitleRJ']) ? trim($Properties['TitleJP']) : trim($Properties['TitleRJ'])) : trim($Properties['Title']);
699
 $Announce .= empty($Properties['Title']) ? (empty($Properties['TitleRJ']) ? trim($Properties['TitleJP']) : trim($Properties['TitleRJ'])) : trim($Properties['Title']);
701
 $Announce .= ' ';
700
 $Announce .= ' ';
702
 if ($Type != 'Other') {
701
 if ($Type != 'Other') {

Loading…
Cancel
Save