Completed
Push — master ( 4bb48e...cd1229 )
by Darko
33s queued 18s
created
Blacklight/Releases.php 1 patch
Spacing   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -274,7 +274,7 @@  discard block
 block discarded – undo
274 274
 				GROUP BY r.id
275 275
 				ORDER BY %s %s %s",
276 276
             $this->uSQL($userShows, 'videos_id'),
277
-            (! empty($excludedCats) ? ' AND r.categories_id NOT IN ('.implode(',', $excludedCats).')' : ''),
277
+            (!empty($excludedCats) ? ' AND r.categories_id NOT IN ('.implode(',', $excludedCats).')' : ''),
278 278
             NZB::NZB_ADDED,
279 279
             Category::TV_ROOT,
280 280
             Category::TV_OTHER,
@@ -344,7 +344,7 @@  discard block
 block discarded – undo
344 344
     {
345 345
         // Delete NZB from disk.
346 346
         $nzbPath = $nzb->NZBPath($identifiers['g']);
347
-        if (! empty($nzbPath)) {
347
+        if (!empty($nzbPath)) {
348 348
             File::delete($nzbPath);
349 349
         }
350 350
 
@@ -384,7 +384,7 @@  discard block
 block discarded – undo
384 384
      */
385 385
     public function updateMulti($guids, $category, $grabs, $videoId, $episodeId, $anidbId, $imdbId)
386 386
     {
387
-        if (! \is_array($guids) || \count($guids) < 1) {
387
+        if (!\is_array($guids) || \count($guids) < 1) {
388 388
             return false;
389 389
         }
390 390
 
@@ -408,7 +408,7 @@  discard block
 block discarded – undo
408 408
         $sql = '(1=2 ';
409 409
         foreach ($userQuery as $query) {
410 410
             $sql .= sprintf('OR (r.%s = %d', $type, $query->$type);
411
-            if (! empty($query->categories)) {
411
+            if (!empty($query->categories)) {
412 412
                 $catsArr = explode('|', $query->categories);
413 413
                 if (\count($catsArr) > 1) {
414 414
                     $sql .= sprintf(' AND r.categories_id IN (%s)', implode(',', $catsArr));
@@ -452,7 +452,7 @@  discard block
 block discarded – undo
452 452
             $orderBy = $this->getBrowseOrder($orderBy);
453 453
         }
454 454
 
455
-        $searchFields = Arr::where($searchArr, static function ($value) {
455
+        $searchFields = Arr::where($searchArr, static function($value) {
456 456
             return $value !== -1;
457 457
         });
458 458
 
@@ -462,7 +462,7 @@  discard block
 block discarded – undo
462 462
             $searchResult = $this->elasticSearch->indexSearch($phrases, $limit);
463 463
         } else {
464 464
             $searchResult = $this->manticoreSearch->searchIndexes('releases_rt', '', [], $searchFields);
465
-            if (! empty($searchResult)) {
465
+            if (!empty($searchResult)) {
466 466
                 $searchResult = Arr::wrap(Arr::get($searchResult, 'id'));
467 467
             }
468 468
         }
@@ -553,7 +553,7 @@  discard block
 block discarded – undo
553 553
                 $searchResult = $this->elasticSearch->indexSearchApi($searchName, $limit);
554 554
             } else {
555 555
                 $searchResult = $this->manticoreSearch->searchIndexes('releases_rt', $searchName, ['searchname']);
556
-                if (! empty($searchResult)) {
556
+                if (!empty($searchResult)) {
557 557
                     $searchResult = Arr::wrap(Arr::get($searchResult, 'id'));
558 558
                 }
559 559
             }
@@ -569,7 +569,7 @@  discard block
 block discarded – undo
569 569
             ((int) $groupName !== -1 ? sprintf(' AND r.groups_id = %d ', UsenetGroup::getIDByName($groupName)) : ''),
570 570
             $catQuery,
571 571
             (\count($excludedCats) > 0 ? ' AND r.categories_id NOT IN ('.implode(',', $excludedCats).')' : ''),
572
-            (! empty($searchResult) ? 'AND r.id IN ('.implode(',', $searchResult).')' : ''),
572
+            (!empty($searchResult) ? 'AND r.id IN ('.implode(',', $searchResult).')' : ''),
573 573
             ($minSize > 0 ? sprintf('AND r.size >= %d', $minSize) : '')
574 574
         );
575 575
         $baseSql = sprintf(
@@ -603,7 +603,7 @@  discard block
 block discarded – undo
603 603
         if ($releases !== null) {
604 604
             return $releases;
605 605
         }
606
-        if ($searchName !== -1 && ! empty($searchResult)) {
606
+        if ($searchName !== -1 && !empty($searchResult)) {
607 607
             $releases = self::fromQuery($sql);
608 608
         } elseif ($searchName !== -1 && empty($searchResult)) {
609 609
             $releases = collect();
@@ -653,13 +653,13 @@  discard block
 block discarded – undo
653 653
                 ($airDate !== '' ? sprintf('AND DATE(tve.firstaired) = %s', escapeString($airDate)) : '')
654 654
             );
655 655
             $show = self::fromQuery($showQry);
656
-            if (! empty($show[0]) && $show->isNotEmpty()) {
657
-                if ((! empty($series) || ! empty($episode) || ! empty($airDate)) && $show[0]->episodes !== '') {
656
+            if (!empty($show[0]) && $show->isNotEmpty()) {
657
+                if ((!empty($series) || !empty($episode) || !empty($airDate)) && $show[0]->episodes !== '') {
658 658
                     $showSql = sprintf('AND r.tv_episodes_id IN (%s)', $show[0]->episodes);
659 659
                 } elseif ((int) $show[0]->video > 0) {
660 660
                     $showSql = 'AND r.videos_id = '.$show[0]->video;
661 661
                     // If $series is set but episode is not, return Season Packs only
662
-                    if (! empty($series) && empty($episode)) {
662
+                    if (!empty($series) && empty($episode)) {
663 663
                         $showSql .= ' AND r.tv_episodes_id = 0';
664 664
                     }
665 665
                 } else {
@@ -672,22 +672,22 @@  discard block
 block discarded – undo
672 672
             }
673 673
         }
674 674
         // If $name is set it is a fallback search, add available SxxExx/airdate info to the query
675
-        if (! empty($name) && $showSql === '') {
676
-            if (! empty($series) && (int) $series < 1900) {
675
+        if (!empty($name) && $showSql === '') {
676
+            if (!empty($series) && (int) $series < 1900) {
677 677
                 $name .= sprintf(' S%s', str_pad($series, 2, '0', STR_PAD_LEFT));
678
-                if (! empty($episode) && ! str_contains($episode, '/')) {
678
+                if (!empty($episode) && !str_contains($episode, '/')) {
679 679
                     $name .= sprintf('E%s', str_pad($episode, 2, '0', STR_PAD_LEFT));
680 680
                 }
681
-            } elseif (! empty($airDate)) {
681
+            } elseif (!empty($airDate)) {
682 682
                 $name .= sprintf(' %s', str_replace(['/', '-', '.', '_'], ' ', $airDate));
683 683
             }
684 684
         }
685
-        if (! empty($name)) {
685
+        if (!empty($name)) {
686 686
             if (config('nntmux.elasticsearch_enabled') === true) {
687 687
                 $searchResult = $this->elasticSearch->indexSearchTMA($name, $limit);
688 688
             } else {
689 689
                 $searchResult = $this->manticoreSearch->searchIndexes('releases_rt', $name, ['searchname']);
690
-                if (! empty($searchResult)) {
690
+                if (!empty($searchResult)) {
691 691
                     $searchResult = Arr::wrap(Arr::get($searchResult, 'id'));
692 692
                 }
693 693
             }
@@ -703,11 +703,11 @@  discard block
 block discarded – undo
703 703
             NZB::NZB_ADDED,
704 704
             $this->showPasswords(),
705 705
             $showSql,
706
-            (! empty($name) && ! empty($searchResult)) ? 'AND r.id IN ('.implode(',', $searchResult).')' : '',
706
+            (!empty($name) && !empty($searchResult)) ? 'AND r.id IN ('.implode(',', $searchResult).')' : '',
707 707
             (empty($searchResult)) ? Category::getCategorySearch($cat) : '',
708 708
             $maxAge > 0 ? sprintf('AND r.postdate > NOW() - INTERVAL %d DAY', $maxAge) : '',
709 709
             $minSize > 0 ? sprintf('AND r.size >= %d', $minSize) : '',
710
-            ! empty($excludedCategories) ? sprintf('AND r.categories_id NOT IN('.implode(',', $excludedCategories).')') : ''
710
+            !empty($excludedCategories) ? sprintf('AND r.categories_id NOT IN('.implode(',', $excludedCategories).')') : ''
711 711
         );
712 712
         $baseSql = sprintf(
713 713
             "SELECT r.searchname, r.guid, r.postdate, r.groups_id, r.categories_id, r.size, r.totalpart, r.fromname, r.passwordstatus, r.grabs, r.comments, r.adddate, r.videos_id, r.tv_episodes_id, r.haspreview, r.jpgstatus,
@@ -743,7 +743,7 @@  discard block
 block discarded – undo
743 743
         if ($releases !== null) {
744 744
             return $releases;
745 745
         }
746
-        $releases = ((! empty($name) && ! empty($searchResult)) || empty($name)) ? self::fromQuery($sql) : [];
746
+        $releases = ((!empty($name) && !empty($searchResult)) || empty($name)) ? self::fromQuery($sql) : [];
747 747
         if (count($releases) !== 0 && $releases->isNotEmpty()) {
748 748
             $releases[0]->_totalrows = $this->getPagerCount(
749 749
                 preg_replace('#LEFT(\s+OUTER)?\s+JOIN\s+(?!tv_episodes)\s+.*ON.*=.*\n#i', ' ', $baseSql)
@@ -789,12 +789,12 @@  discard block
 block discarded – undo
789 789
             );
790 790
             $show = self::fromQuery($showQry);
791 791
             if ($show->isNotEmpty()) {
792
-                if ((! empty($series) || ! empty($episode) || ! empty($airDate)) && $show[0]->episodes !== '') {
792
+                if ((!empty($series) || !empty($episode) || !empty($airDate)) && $show[0]->episodes !== '') {
793 793
                     $showSql = sprintf('AND r.tv_episodes_id IN (%s)', $show[0]->episodes);
794 794
                 } elseif ((int) $show[0]->video > 0) {
795 795
                     $showSql = 'AND r.videos_id = '.$show[0]->video;
796 796
                     // If $series is set but episode is not, return Season Packs only
797
-                    if (! empty($series) && empty($episode)) {
797
+                    if (!empty($series) && empty($episode)) {
798 798
                         $showSql .= ' AND r.tv_episodes_id = 0';
799 799
                     }
800 800
                 } else {
@@ -807,22 +807,22 @@  discard block
 block discarded – undo
807 807
             }
808 808
         }
809 809
         // If $name is set it is a fallback search, add available SxxExx/airdate info to the query
810
-        if (! empty($name) && $showSql === '') {
811
-            if (! empty($series) && (int) $series < 1900) {
810
+        if (!empty($name) && $showSql === '') {
811
+            if (!empty($series) && (int) $series < 1900) {
812 812
                 $name .= sprintf(' S%s', str_pad($series, 2, '0', STR_PAD_LEFT));
813
-                if (! empty($episode) && ! str_contains($episode, '/')) {
813
+                if (!empty($episode) && !str_contains($episode, '/')) {
814 814
                     $name .= sprintf('E%s', str_pad($episode, 2, '0', STR_PAD_LEFT));
815 815
                 }
816
-            } elseif (! empty($airDate)) {
816
+            } elseif (!empty($airDate)) {
817 817
                 $name .= sprintf(' %s', str_replace(['/', '-', '.', '_'], ' ', $airDate));
818 818
             }
819 819
         }
820
-        if (! empty($name)) {
820
+        if (!empty($name)) {
821 821
             if (config('nntmux.elasticsearch_enabled') === true) {
822 822
                 $searchResult = $this->elasticSearch->indexSearchTMA($name, $limit);
823 823
             } else {
824 824
                 $searchResult = $this->manticoreSearch->searchIndexes('releases_rt', $name, ['searchname']);
825
-                if (! empty($searchResult)) {
825
+                if (!empty($searchResult)) {
826 826
                     $searchResult = Arr::wrap(Arr::get($searchResult, 'id'));
827 827
                 }
828 828
             }
@@ -838,11 +838,11 @@  discard block
 block discarded – undo
838 838
             NZB::NZB_ADDED,
839 839
             $this->showPasswords(),
840 840
             $showSql,
841
-            (! empty($searchResult) ? 'AND r.id IN ('.implode(',', $searchResult).')' : ''),
841
+            (!empty($searchResult) ? 'AND r.id IN ('.implode(',', $searchResult).')' : ''),
842 842
             Category::getCategorySearch($cat),
843 843
             ($maxAge > 0 ? sprintf('AND r.postdate > NOW() - INTERVAL %d DAY', $maxAge) : ''),
844 844
             ($minSize > 0 ? sprintf('AND r.size >= %d', $minSize) : ''),
845
-            ! empty($excludedCategories) ? sprintf('AND r.categories_id NOT IN('.implode(',', $excludedCategories).')') : ''
845
+            !empty($excludedCategories) ? sprintf('AND r.categories_id NOT IN('.implode(',', $excludedCategories).')') : ''
846 846
         );
847 847
         $baseSql = sprintf(
848 848
             "SELECT r.searchname, r.guid, r.postdate, r.groups_id, r.categories_id, r.size, r.totalpart, r.fromname, r.passwordstatus, r.grabs, r.comments, r.adddate, r.tv_episodes_id, r.haspreview, r.jpgstatus,
@@ -892,12 +892,12 @@  discard block
 block discarded – undo
892 892
      */
893 893
     public function animeSearch($aniDbID, int $offset = 0, int $limit = 100, string $name = '', array $cat = [-1], int $maxAge = -1, array $excludedCategories = []): mixed
894 894
     {
895
-        if (! empty($name)) {
895
+        if (!empty($name)) {
896 896
             if (config('nntmux.elasticsearch_enabled') === true) {
897 897
                 $searchResult = $this->elasticSearch->indexSearchTMA($name, $limit);
898 898
             } else {
899 899
                 $searchResult = $this->manticoreSearch->searchIndexes('releases_rt', $name, ['searchname']);
900
-                if (! empty($searchResult)) {
900
+                if (!empty($searchResult)) {
901 901
                     $searchResult = Arr::wrap(Arr::get($searchResult, 'id'));
902 902
                 }
903 903
             }
@@ -914,8 +914,8 @@  discard block
 block discarded – undo
914 914
             $this->showPasswords(),
915 915
             NZB::NZB_ADDED,
916 916
             ($aniDbID > -1 ? sprintf(' AND r.anidbid = %d ', $aniDbID) : ''),
917
-            (! empty($searchResult) ? 'AND r.id IN ('.implode(',', $searchResult).')' : ''),
918
-            ! empty($excludedCategories) ? sprintf('AND r.categories_id NOT IN('.implode(',', $excludedCategories).')') : '',
917
+            (!empty($searchResult) ? 'AND r.id IN ('.implode(',', $searchResult).')' : ''),
918
+            !empty($excludedCategories) ? sprintf('AND r.categories_id NOT IN('.implode(',', $excludedCategories).')') : '',
919 919
             Category::getCategorySearch($cat),
920 920
             ($maxAge > 0 ? sprintf(' AND r.postdate > NOW() - INTERVAL %d DAY ', $maxAge) : '')
921 921
         );
@@ -964,12 +964,12 @@  discard block
 block discarded – undo
964 964
      */
965 965
     public function moviesSearch(int $imDbId = -1, int $tmDbId = -1, int $traktId = -1, int $offset = 0, int $limit = 100, string $name = '', array $cat = [-1], int $maxAge = -1, int $minSize = 0, array $excludedCategories = []): mixed
966 966
     {
967
-        if (! empty($name)) {
967
+        if (!empty($name)) {
968 968
             if (config('nntmux.elasticsearch_enabled') === true) {
969 969
                 $searchResult = $this->elasticSearch->indexSearchTMA($name, $limit);
970 970
             } else {
971 971
                 $searchResult = $this->manticoreSearch->searchIndexes('releases_rt', $name, ['searchname']);
972
-                if (! empty($searchResult)) {
972
+                if (!empty($searchResult)) {
973 973
                     $searchResult = Arr::wrap(Arr::get($searchResult, 'id'));
974 974
                 }
975 975
             }
@@ -986,11 +986,11 @@  discard block
 block discarded – undo
986 986
 			%s %s %s %s %s %s %s',
987 987
             NZB::NZB_ADDED,
988 988
             $this->showPasswords(),
989
-            (! empty($searchResult) ? 'AND r.id IN ('.implode(',', $searchResult).')' : ''),
989
+            (!empty($searchResult) ? 'AND r.id IN ('.implode(',', $searchResult).')' : ''),
990 990
             ($imDbId !== -1 && is_numeric($imDbId)) ? sprintf(' AND m.imdbid = \'%s\' ', $imDbId) : '',
991 991
             ($tmDbId !== -1 && is_numeric($tmDbId)) ? sprintf(' AND m.tmdbid = %d ', $tmDbId) : '',
992 992
             ($traktId !== -1 && is_numeric($traktId)) ? sprintf(' AND m.traktid = %d ', $traktId) : '',
993
-            ! empty($excludedCategories) ? sprintf('AND r.categories_id NOT IN('.implode(',', $excludedCategories).')') : '',
993
+            !empty($excludedCategories) ? sprintf('AND r.categories_id NOT IN('.implode(',', $excludedCategories).')') : '',
994 994
             Category::getCategorySearch($cat),
995 995
             $maxAge > 0 ? sprintf(' AND r.postdate > NOW() - INTERVAL %d DAY ', $maxAge) : '',
996 996
             $minSize > 0 ? sprintf('AND r.size >= %d', $minSize) : ''
@@ -1042,7 +1042,7 @@  discard block
 block discarded – undo
1042 1042
             $parentCat = $catRow['root_categories_id'];
1043 1043
 
1044 1044
             $results = $this->search(['searchname' => getSimilarName($name)], -1, '', '', -1, -1, 0, config('nntmux.items_per_page'), '', -1, $excludedCats, 'basic', [$parentCat]);
1045
-            if (! $results) {
1045
+            if (!$results) {
1046 1046
                 return $ret;
1047 1047
             }
1048 1048
 
Please login to merge, or discard this patch.