Browse Source

Please kill me

pjc 5 years ago
parent
commit
ca3684b868
1 changed files with 21 additions and 21 deletions
  1. 21
    21
      sections/upload/upload_handle.php

+ 21
- 21
sections/upload/upload_handle.php View File

@@ -64,7 +64,7 @@ $Properties['Subber'] = isset($_POST['subber']) ? $_POST['subber'] : '';
64 64
 $Properties['DLsiteID'] = (isset($_POST['dlsiteid'])) ? $_POST['dlsiteid'] : '';
65 65
 $Properties['Censored'] = (isset($_POST['censored'])) ? '1' : '0';
66 66
 $Properties['Anonymous'] = (isset($_POST['anonymous'])) ? '1' : '0';
67
-$Properties['Archive'] = (isset($_POST['archive']) && $_POST['archive'] != '---') ? $_POST['archive'] : '';
67
+$Properties['Archive'] = (isset($_POST['archive']) && $_POST['archive'] !== '---') ? $_POST['archive'] : '';
68 68
 if (isset($_POST['library_image'])) {
69 69
     $Properties['LibraryImage'] = $_POST['library_image'];
70 70
 }
@@ -99,7 +99,7 @@ if (isset($Properties['GroupID'])) {
99 99
     $Properties['Artists'] = Artists::get_artist($Properties['GroupID']);
100 100
 }
101 101
 
102
-if ($Type == 'Movies' || $Type == 'Manga' || $Type == 'Anime' || $Type == 'Games') {
102
+if ($Type === 'Movies' || $Type === 'Manga' || $Type === 'Anime' || $Type === 'Games') {
103 103
     if (empty($_POST['idols'])) {
104 104
         $Err = "You didn't enter any artists/idols";
105 105
     } else {
@@ -146,7 +146,7 @@ switch ($Type) {
146 146
     if (!isset($_POST['groupid']) || !$_POST['groupid']) {
147 147
       $Validate->SetFields('year',
148 148
         '1','number','The year of the original release must be entered.', array('maxlength'=>3000, 'minlength'=>1800));
149
-      if ($Type == 'Manga') {
149
+      if ($Type === 'Manga') {
150 150
         $Validate->SetFields('pages',
151 151
           '1', 'number', 'That is not a valid page count', array('minlength'=>1));
152 152
       }
@@ -239,7 +239,7 @@ if (empty($Properties['GroupID']) && empty($ArtistForm)) {
239 239
     $ArtistNames = [];
240 240
     $ArtistForm = [];
241 241
     for ($i = 0; $i < count($Artists); $i++) {
242
-        if (trim($Artists[$i]) != '') {
242
+        if (trim($Artists[$i]) !== '') {
243 243
             if (!in_array($Artists[$i], $ArtistNames)) {
244 244
                 $ArtistForm[$i] = array('name' => Artists::normalise_artist_name($Artists[$i]));
245 245
                 array_push($ArtistNames, $ArtistForm[$i]['name']);
@@ -352,7 +352,7 @@ if ($T['GroupID']) {
352 352
         }
353 353
         if (strlen($WikiBody) > strlen($Body)) {
354 354
             $Body = $WikiBody;
355
-            if (!$T['Image'] || $T['Image'] == $WikiImage) {
355
+            if (!$T['Image'] || $T['Image'] === $WikiImage) {
356 356
                 $NoRevision = true;
357 357
             }
358 358
         }
@@ -379,15 +379,15 @@ if (!isset($GroupID) || !$GroupID) {
379 379
     }
380 380
 }
381 381
 
382
-//Needs to be here as it isn't set for add format until now
382
+// Needs to be here as it isn't set for add format until now
383 383
 $LogName .= $T['Title'];
384 384
 
385
-//For notifications--take note now whether it's a new group
385
+// For notifications---take note now whether it's a new group
386 386
 $IsNewGroup = !isset($GroupID) || !$GroupID;
387 387
 
388 388
 //----- Start inserts
389 389
 if ((!isset($GroupID) || !$GroupID)) {
390
-    //array to store which artists we have added already, to prevent adding an artist twice
390
+    // Array to store which artists we have added already, to prevent adding an artist twice
391 391
     $ArtistsAdded = [];
392 392
     foreach ($ArtistForm as $Num => $Artist) {
393 393
         if (!isset($Artist['id']) || !$Artist['id']) {
@@ -527,7 +527,7 @@ $DB->query("
527 527
 if ($DB->has_results()) {
528 528
     $FreeLeechTags = $DB->to_array('Name');
529 529
     foreach ($FreeLeechTags as $Tag => $Exp) {
530
-        if ($Tag == 'global' || in_array($Tag, $Tags)) {
530
+        if ($Tag === 'global' || in_array($Tag, $Tags)) {
531 531
             $T['FreeTorrent'] = '1';
532 532
             $T['FreeLeechType'] = '3';
533 533
             break;
@@ -537,7 +537,7 @@ if ($DB->has_results()) {
537 537
 
538 538
 // Movie and anime ISOs are neutral leech, and receive a BP bounty
539 539
 /*
540
-if (($Type == 'Movies' || $Type == 'Anime') && ($T['Container'] == 'ISO' || $T['Container'] == 'M2TS' || $T['Container'] == 'VOB IFO')) {
540
+if (($Type === 'Movies' || $Type === 'Anime') && ($T['Container'] === 'ISO' || $T['Container'] === 'M2TS' || $T['Container'] === 'VOB IFO')) {
541 541
   $T['FreeTorrent'] = '2';
542 542
   $T['FreeLeechType'] = '2';
543 543
 }
@@ -580,8 +580,8 @@ $DB->query(
580 580
     $T['FreeLeechType']
581 581
 );
582 582
 
583
-$Cache->increment('stats_torrent_count');
584 583
 $TorrentID = $DB->inserted_id();
584
+$Cache->increment('stats_torrent_count');
585 585
 $Tor->Dec['comment'] = 'https://'.SITE_DOMAIN.'/torrents.php?torrentid='.$TorrentID;
586 586
 
587 587
 Tracker::update_tracker('add_torrent', [
@@ -595,8 +595,8 @@ $Debug->set_flag('upload: ocelot updated');
595 595
 // (expire the key after 10 minutes to prevent locking it for too long in case there's a fatal error below)
596 596
 $Cache->cache_value("torrent_{$TorrentID}_lock", true, 600);
597 597
 
598
-//give BP if necessary
599
-if (($Type == "Movies" || $Type == "Anime") && ($T['Container'] == 'ISO' || $T['Container'] == 'M2TS' || $T['Container'] == 'VOB IFO')) {
598
+// Give BP if necessary
599
+if (($Type === "Movies" || $Type === "Anime") && ($T['Container'] === 'ISO' || $T['Container'] === 'M2TS' || $T['Container'] === 'VOB IFO')) {
600 600
     $BPAmt = (int) 2*($TotalSize / (1024*1024*1024))*1000;
601 601
 
602 602
     $DB->query("
@@ -613,11 +613,11 @@ if (($Type == "Movies" || $Type == "Anime") && ($T['Container'] == 'ISO' || $T['
613 613
 }
614 614
 
615 615
 // Add to shop freeleeches if necessary
616
-if ($T['FreeLeechType'] == 3) {
616
+if ($T['FreeLeechType'] === 3) {
617 617
     // Figure out which duration to use
618 618
     $Expiry = 0;
619 619
     foreach ($FreeLeechTags as $Tag => $Exp) {
620
-        if ($Tag == 'global' || in_array($Tag, $Tags)) {
620
+        if ($Tag === 'global' || in_array($Tag, $Tags)) {
621 621
             if (((int) $FreeLeechTags[$Tag]['First']) > $Expiry) {
622 622
                 $Expiry = (int) $FreeLeechTags[$Tag]['First'];
623 623
             }
@@ -649,12 +649,12 @@ $Debug->set_flag('upload: sphinx updated');
649 649
 //******************************************************************************//
650 650
 //---------------------- Recent Uploads ----------------------------------------//
651 651
 
652
-if (trim($T['Image']) != '') {
652
+if (trim($T['Image']) !== '') {
653 653
     $RecentUploads = $Cache->get_value("recent_uploads_$UserID");
654 654
     if (is_array($RecentUploads)) {
655 655
         do {
656 656
             foreach ($RecentUploads as $Item) {
657
-                if ($Item['ID'] == $GroupID) {
657
+                if ($Item['ID'] === $GroupID) {
658 658
                     break 2;
659 659
                 }
660 660
             }
@@ -718,7 +718,7 @@ $Announce .= Artists::display_artists($ArtistForm, false);
718 718
 
719 719
 $Announce .= substr(trim(empty($T['Title']) ? (empty($T['TitleRJ']) ? $T['TitleJP'] : $T['TitleRJ']) : $T['Title']), 0, 100);
720 720
 $Announce .= ' ';
721
-if ($Type != 'Other') {
721
+if ($Type !== 'Other') {
722 722
     $Announce .= '['.Torrents::torrent_info($T, false, false, false).']';
723 723
 }
724 724
 $Title = '['.$T['CategoryName'].'] '.$Announce;
@@ -752,7 +752,7 @@ if (!empty($ArtistsUnescaped)) {
752 752
         $ArtistNameList[] = "Artists LIKE '%|".db_string(str_replace('\\', '\\\\', $Artist['name']), true)."|%'";
753 753
     }
754 754
     // Don't add notification if >2 main artists or if tracked artist isn't a main artist
755
-    if (count($ArtistNameList) > 2 || $Artist['name'] == 'Various Artists') {
755
+    if (count($ArtistNameList) > 2 || $Artist['name'] === 'Various Artists') {
756 756
         $SQL .= " AND (ExcludeVA = '0' AND (";
757 757
         $SQL .= implode(' OR ', array_merge($ArtistNameList, $GuestArtistNameList));
758 758
         $SQL .= " OR Artists = '')) AND (";
@@ -829,7 +829,7 @@ if ($T['Year']) {
829 829
 } else {
830 830
     $SQL .= " AND (FromYear = 0 AND ToYear = 0) ";
831 831
 }
832
-$SQL .= " AND UserID != '".$LoggedUser['ID']."' ";
832
+$SQL .= " AND UserID !== '".$LoggedUser['ID']."' ";
833 833
 
834 834
 $DB->query("
835 835
   SELECT Paranoia
@@ -844,7 +844,7 @@ if (!in_array('notifications', $Paranoia)) {
844 844
     $SQL .= " AND (Users LIKE '%|".$LoggedUser['ID']."|%' OR Users = '') ";
845 845
 }
846 846
 
847
-$SQL .= " AND UserID != '".$LoggedUser['ID']."' ";
847
+$SQL .= " AND UserID !== '".$LoggedUser['ID']."' ";
848 848
 $DB->query($SQL);
849 849
 $Debug->set_flag('upload: notification query finished');
850 850
 

Loading…
Cancel
Save