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

Loading…
Cancel
Save