@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | if ($cat) { |
63 | 63 | $categories = Category::getCategorySearch($cat, null, true); |
64 | 64 | // If categories is empty, we don't want to return anything. |
65 | - if (! empty($categories)) { |
|
65 | + if (!empty($categories)) { |
|
66 | 66 | // if we have more than one category, we need to use whereIn |
67 | 67 | if (\count($categories) > 1) { |
68 | 68 | $query->whereIn('categories_id', $categories); |
@@ -76,12 +76,12 @@ discard block |
||
76 | 76 | $query->where('postdate', '>', now()->subDays($maxAge)); |
77 | 77 | } |
78 | 78 | |
79 | - if (! empty($excludedCats)) { |
|
79 | + if (!empty($excludedCats)) { |
|
80 | 80 | $query->whereNotIn('categories_id', $excludedCats); |
81 | 81 | } |
82 | 82 | |
83 | 83 | if ($groupName !== -1) { |
84 | - $query->whereHas('group', function ($q) use ($groupName) { |
|
84 | + $query->whereHas('group', function($q) use ($groupName) { |
|
85 | 85 | $q->where('name', $groupName); |
86 | 86 | }); |
87 | 87 | } |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | GROUP BY r.id |
280 | 280 | ORDER BY %s %s %s", |
281 | 281 | $this->uSQL($userShows, 'videos_id'), |
282 | - (! empty($excludedCats) ? ' AND r.categories_id NOT IN ('.implode(',', $excludedCats).')' : ''), |
|
282 | + (!empty($excludedCats) ? ' AND r.categories_id NOT IN ('.implode(',', $excludedCats).')' : ''), |
|
283 | 283 | NZB::NZB_ADDED, |
284 | 284 | Category::TV_ROOT, |
285 | 285 | Category::TV_OTHER, |
@@ -349,7 +349,7 @@ discard block |
||
349 | 349 | { |
350 | 350 | // Delete NZB from disk. |
351 | 351 | $nzbPath = $nzb->NZBPath($identifiers['g']); |
352 | - if (! empty($nzbPath)) { |
|
352 | + if (!empty($nzbPath)) { |
|
353 | 353 | File::delete($nzbPath); |
354 | 354 | } |
355 | 355 | |
@@ -389,7 +389,7 @@ discard block |
||
389 | 389 | */ |
390 | 390 | public function updateMulti($guids, $category, $grabs, $videoId, $episodeId, $anidbId, $imdbId) |
391 | 391 | { |
392 | - if (! \is_array($guids) || \count($guids) < 1) { |
|
392 | + if (!\is_array($guids) || \count($guids) < 1) { |
|
393 | 393 | return false; |
394 | 394 | } |
395 | 395 | |
@@ -413,7 +413,7 @@ discard block |
||
413 | 413 | $sql = '(1=2 '; |
414 | 414 | foreach ($userQuery as $query) { |
415 | 415 | $sql .= sprintf('OR (r.%s = %d', $type, $query->$type); |
416 | - if (! empty($query->categories)) { |
|
416 | + if (!empty($query->categories)) { |
|
417 | 417 | $catsArr = explode('|', $query->categories); |
418 | 418 | if (\count($catsArr) > 1) { |
419 | 419 | $sql .= sprintf(' AND r.categories_id IN (%s)', implode(',', $catsArr)); |
@@ -457,7 +457,7 @@ discard block |
||
457 | 457 | $orderBy = $this->getBrowseOrder($orderBy); |
458 | 458 | } |
459 | 459 | |
460 | - $searchFields = Arr::where($searchArr, static function ($value) { |
|
460 | + $searchFields = Arr::where($searchArr, static function($value) { |
|
461 | 461 | return $value !== -1; |
462 | 462 | }); |
463 | 463 | |
@@ -467,7 +467,7 @@ discard block |
||
467 | 467 | $searchResult = $this->elasticSearch->indexSearch($phrases, $limit); |
468 | 468 | } else { |
469 | 469 | $searchResult = $this->manticoreSearch->searchIndexes('releases_rt', '', [], $searchFields); |
470 | - if (! empty($searchResult)) { |
|
470 | + if (!empty($searchResult)) { |
|
471 | 471 | $searchResult = Arr::wrap(Arr::get($searchResult, 'id')); |
472 | 472 | } |
473 | 473 | } |
@@ -558,7 +558,7 @@ discard block |
||
558 | 558 | $searchResult = $this->elasticSearch->indexSearchApi($searchName, $limit); |
559 | 559 | } else { |
560 | 560 | $searchResult = $this->manticoreSearch->searchIndexes('releases_rt', $searchName, ['searchname']); |
561 | - if (! empty($searchResult)) { |
|
561 | + if (!empty($searchResult)) { |
|
562 | 562 | $searchResult = Arr::wrap(Arr::get($searchResult, 'id')); |
563 | 563 | } |
564 | 564 | } |
@@ -574,7 +574,7 @@ discard block |
||
574 | 574 | ((int) $groupName !== -1 ? sprintf(' AND r.groups_id = %d ', UsenetGroup::getIDByName($groupName)) : ''), |
575 | 575 | $catQuery, |
576 | 576 | (\count($excludedCats) > 0 ? ' AND r.categories_id NOT IN ('.implode(',', $excludedCats).')' : ''), |
577 | - (! empty($searchResult) ? 'AND r.id IN ('.implode(',', $searchResult).')' : ''), |
|
577 | + (!empty($searchResult) ? 'AND r.id IN ('.implode(',', $searchResult).')' : ''), |
|
578 | 578 | ($minSize > 0 ? sprintf('AND r.size >= %d', $minSize) : '') |
579 | 579 | ); |
580 | 580 | $baseSql = sprintf( |
@@ -608,7 +608,7 @@ discard block |
||
608 | 608 | if ($releases !== null) { |
609 | 609 | return $releases; |
610 | 610 | } |
611 | - if ($searchName !== -1 && ! empty($searchResult)) { |
|
611 | + if ($searchName !== -1 && !empty($searchResult)) { |
|
612 | 612 | $releases = self::fromQuery($sql); |
613 | 613 | } elseif ($searchName !== -1 && empty($searchResult)) { |
614 | 614 | $releases = collect(); |
@@ -662,11 +662,11 @@ discard block |
||
662 | 662 | $show = self::fromQuery($showQry); |
663 | 663 | |
664 | 664 | if ($show->isNotEmpty()) { |
665 | - if ((! empty($episode) && ! empty($series)) && $show[0]->episodes !== '') { |
|
665 | + if ((!empty($episode) && !empty($series)) && $show[0]->episodes !== '') { |
|
666 | 666 | $showSql .= ' AND r.tv_episodes_id IN ('.$show[0]->episodes.') AND tve.series = '.$series; |
667 | - } elseif (! empty($episode) && $show[0]->episodes !== '') { |
|
667 | + } elseif (!empty($episode) && $show[0]->episodes !== '') { |
|
668 | 668 | $showSql = sprintf('AND r.tv_episodes_id IN (%s)', $show[0]->episodes); |
669 | - } elseif (! empty($series) && empty($episode)) { |
|
669 | + } elseif (!empty($series) && empty($episode)) { |
|
670 | 670 | // If $series is set but episode is not, return Season Packs and Episodes |
671 | 671 | $showSql .= ' AND r.tv_episodes_id IN ('.$show[0]->episodes.') AND tve.series = '.$series; |
672 | 672 | } |
@@ -680,26 +680,26 @@ discard block |
||
680 | 680 | } |
681 | 681 | |
682 | 682 | // If $name is set it is a fallback search, add available SxxExx/airdate info to the query |
683 | - if (! empty($name) && $showSql === '') { |
|
684 | - if (! empty($series) && (int) $series < 1900) { |
|
683 | + if (!empty($name) && $showSql === '') { |
|
684 | + if (!empty($series) && (int) $series < 1900) { |
|
685 | 685 | $name .= sprintf(' S%s', str_pad($series, 2, '0', STR_PAD_LEFT)); |
686 | - if (! empty($episode) && ! str_contains($episode, '/')) { |
|
686 | + if (!empty($episode) && !str_contains($episode, '/')) { |
|
687 | 687 | $name .= sprintf('E%s', str_pad($episode, 2, '0', STR_PAD_LEFT)); |
688 | 688 | } |
689 | 689 | // If season is not empty but episode is, add a wildcard to the search |
690 | 690 | if (empty($episode)) { |
691 | 691 | $name .= '*'; |
692 | 692 | } |
693 | - } elseif (! empty($airDate)) { |
|
693 | + } elseif (!empty($airDate)) { |
|
694 | 694 | $name .= sprintf(' %s', str_replace(['/', '-', '.', '_'], ' ', $airDate)); |
695 | 695 | } |
696 | 696 | } |
697 | - if (! empty($name)) { |
|
697 | + if (!empty($name)) { |
|
698 | 698 | if (config('nntmux.elasticsearch_enabled') === true) { |
699 | 699 | $searchResult = $this->elasticSearch->indexSearchTMA($name, $limit); |
700 | 700 | } else { |
701 | 701 | $searchResult = $this->manticoreSearch->searchIndexes('releases_rt', $name, ['searchname']); |
702 | - if (! empty($searchResult)) { |
|
702 | + if (!empty($searchResult)) { |
|
703 | 703 | $searchResult = Arr::wrap(Arr::get($searchResult, 'id')); |
704 | 704 | } |
705 | 705 | } |
@@ -715,11 +715,11 @@ discard block |
||
715 | 715 | NZB::NZB_ADDED, |
716 | 716 | $this->showPasswords(), |
717 | 717 | $showSql, |
718 | - (! empty($name) && ! empty($searchResult)) ? 'AND r.id IN ('.implode(',', $searchResult).')' : '', |
|
718 | + (!empty($name) && !empty($searchResult)) ? 'AND r.id IN ('.implode(',', $searchResult).')' : '', |
|
719 | 719 | Category::getCategorySearch($cat, 'tv'), |
720 | 720 | $maxAge > 0 ? sprintf('AND r.postdate > NOW() - INTERVAL %d DAY', $maxAge) : '', |
721 | 721 | $minSize > 0 ? sprintf('AND r.size >= %d', $minSize) : '', |
722 | - ! empty($excludedCategories) ? sprintf('AND r.categories_id NOT IN('.implode(',', $excludedCategories).')') : '' |
|
722 | + !empty($excludedCategories) ? sprintf('AND r.categories_id NOT IN('.implode(',', $excludedCategories).')') : '' |
|
723 | 723 | ); |
724 | 724 | $baseSql = sprintf( |
725 | 725 | "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, |
@@ -755,7 +755,7 @@ discard block |
||
755 | 755 | if ($releases !== null) { |
756 | 756 | return $releases; |
757 | 757 | } |
758 | - $releases = ((! empty($name) && ! empty($searchResult)) || empty($name)) ? self::fromQuery($sql) : []; |
|
758 | + $releases = ((!empty($name) && !empty($searchResult)) || empty($name)) ? self::fromQuery($sql) : []; |
|
759 | 759 | if (count($releases) !== 0 && $releases->isNotEmpty()) { |
760 | 760 | $releases[0]->_totalrows = $this->getPagerCount( |
761 | 761 | preg_replace('#LEFT(\s+OUTER)?\s+JOIN\s+(?!tv_episodes)\s+.*ON.*=.*\n#i', ' ', $baseSql) |
@@ -803,11 +803,11 @@ discard block |
||
803 | 803 | |
804 | 804 | $show = self::fromQuery($showQry); |
805 | 805 | if ($show->isNotEmpty()) { |
806 | - if ((! empty($episode) && ! empty($series)) && $show[0]->episodes !== '') { |
|
806 | + if ((!empty($episode) && !empty($series)) && $show[0]->episodes !== '') { |
|
807 | 807 | $showSql .= ' AND r.tv_episodes_id IN ('.$show[0]->episodes.') AND tve.series = '.$series; |
808 | - } elseif (! empty($episode) && $show[0]->episodes !== '') { |
|
808 | + } elseif (!empty($episode) && $show[0]->episodes !== '') { |
|
809 | 809 | $showSql = sprintf('AND r.tv_episodes_id IN (%s)', $show[0]->episodes); |
810 | - } elseif (! empty($series) && empty($episode)) { |
|
810 | + } elseif (!empty($series) && empty($episode)) { |
|
811 | 811 | // If $series is set but episode is not, return Season Packs and Episodes |
812 | 812 | $showSql .= ' AND r.tv_episodes_id IN ('.$show[0]->episodes.') AND tve.series = '.$series; |
813 | 813 | } |
@@ -820,26 +820,26 @@ discard block |
||
820 | 820 | } |
821 | 821 | } |
822 | 822 | // If $name is set it is a fallback search, add available SxxExx/airdate info to the query |
823 | - if (! empty($name) && $showSql === '') { |
|
824 | - if (! empty($series) && (int) $series < 1900) { |
|
823 | + if (!empty($name) && $showSql === '') { |
|
824 | + if (!empty($series) && (int) $series < 1900) { |
|
825 | 825 | $name .= sprintf(' S%s', str_pad($series, 2, '0', STR_PAD_LEFT)); |
826 | - if (! empty($episode) && ! str_contains($episode, '/')) { |
|
826 | + if (!empty($episode) && !str_contains($episode, '/')) { |
|
827 | 827 | $name .= sprintf('E%s', str_pad($episode, 2, '0', STR_PAD_LEFT)); |
828 | 828 | } |
829 | 829 | // If season is not empty but episode is, add a wildcard to the search |
830 | 830 | if (empty($episode)) { |
831 | 831 | $name .= '*'; |
832 | 832 | } |
833 | - } elseif (! empty($airDate)) { |
|
833 | + } elseif (!empty($airDate)) { |
|
834 | 834 | $name .= sprintf(' %s', str_replace(['/', '-', '.', '_'], ' ', $airDate)); |
835 | 835 | } |
836 | 836 | } |
837 | - if (! empty($name)) { |
|
837 | + if (!empty($name)) { |
|
838 | 838 | if (config('nntmux.elasticsearch_enabled') === true) { |
839 | 839 | $searchResult = $this->elasticSearch->indexSearchTMA($name, $limit); |
840 | 840 | } else { |
841 | 841 | $searchResult = $this->manticoreSearch->searchIndexes('releases_rt', $name, ['searchname']); |
842 | - if (! empty($searchResult)) { |
|
842 | + if (!empty($searchResult)) { |
|
843 | 843 | $searchResult = Arr::wrap(Arr::get($searchResult, 'id')); |
844 | 844 | } |
845 | 845 | } |
@@ -855,11 +855,11 @@ discard block |
||
855 | 855 | NZB::NZB_ADDED, |
856 | 856 | $this->showPasswords(), |
857 | 857 | $showSql, |
858 | - (! empty($searchResult) ? 'AND r.id IN ('.implode(',', $searchResult).')' : ''), |
|
858 | + (!empty($searchResult) ? 'AND r.id IN ('.implode(',', $searchResult).')' : ''), |
|
859 | 859 | Category::getCategorySearch($cat, 'tv'), |
860 | 860 | ($maxAge > 0 ? sprintf('AND r.postdate > NOW() - INTERVAL %d DAY', $maxAge) : ''), |
861 | 861 | ($minSize > 0 ? sprintf('AND r.size >= %d', $minSize) : ''), |
862 | - ! empty($excludedCategories) ? sprintf('AND r.categories_id NOT IN('.implode(',', $excludedCategories).')') : '' |
|
862 | + !empty($excludedCategories) ? sprintf('AND r.categories_id NOT IN('.implode(',', $excludedCategories).')') : '' |
|
863 | 863 | ); |
864 | 864 | $baseSql = sprintf( |
865 | 865 | "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, |
@@ -909,12 +909,12 @@ discard block |
||
909 | 909 | */ |
910 | 910 | public function animeSearch($aniDbID, int $offset = 0, int $limit = 100, string $name = '', array $cat = [-1], int $maxAge = -1, array $excludedCategories = []): mixed |
911 | 911 | { |
912 | - if (! empty($name)) { |
|
912 | + if (!empty($name)) { |
|
913 | 913 | if (config('nntmux.elasticsearch_enabled') === true) { |
914 | 914 | $searchResult = $this->elasticSearch->indexSearchTMA($name, $limit); |
915 | 915 | } else { |
916 | 916 | $searchResult = $this->manticoreSearch->searchIndexes('releases_rt', $name, ['searchname']); |
917 | - if (! empty($searchResult)) { |
|
917 | + if (!empty($searchResult)) { |
|
918 | 918 | $searchResult = Arr::wrap(Arr::get($searchResult, 'id')); |
919 | 919 | } |
920 | 920 | } |
@@ -931,8 +931,8 @@ discard block |
||
931 | 931 | $this->showPasswords(), |
932 | 932 | NZB::NZB_ADDED, |
933 | 933 | ($aniDbID > -1 ? sprintf(' AND r.anidbid = %d ', $aniDbID) : ''), |
934 | - (! empty($searchResult) ? 'AND r.id IN ('.implode(',', $searchResult).')' : ''), |
|
935 | - ! empty($excludedCategories) ? sprintf('AND r.categories_id NOT IN('.implode(',', $excludedCategories).')') : '', |
|
934 | + (!empty($searchResult) ? 'AND r.id IN ('.implode(',', $searchResult).')' : ''), |
|
935 | + !empty($excludedCategories) ? sprintf('AND r.categories_id NOT IN('.implode(',', $excludedCategories).')') : '', |
|
936 | 936 | Category::getCategorySearch($cat), |
937 | 937 | ($maxAge > 0 ? sprintf(' AND r.postdate > NOW() - INTERVAL %d DAY ', $maxAge) : '') |
938 | 938 | ); |
@@ -979,12 +979,12 @@ discard block |
||
979 | 979 | */ |
980 | 980 | 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 |
981 | 981 | { |
982 | - if (! empty($name)) { |
|
982 | + if (!empty($name)) { |
|
983 | 983 | if (config('nntmux.elasticsearch_enabled') === true) { |
984 | 984 | $searchResult = $this->elasticSearch->indexSearchTMA($name, $limit); |
985 | 985 | } else { |
986 | 986 | $searchResult = $this->manticoreSearch->searchIndexes('releases_rt', $name, ['searchname']); |
987 | - if (! empty($searchResult)) { |
|
987 | + if (!empty($searchResult)) { |
|
988 | 988 | $searchResult = Arr::wrap(Arr::get($searchResult, 'id')); |
989 | 989 | } |
990 | 990 | } |
@@ -1001,11 +1001,11 @@ discard block |
||
1001 | 1001 | %s %s %s %s %s %s %s', |
1002 | 1002 | NZB::NZB_ADDED, |
1003 | 1003 | $this->showPasswords(), |
1004 | - (! empty($searchResult) ? 'AND r.id IN ('.implode(',', $searchResult).')' : ''), |
|
1004 | + (!empty($searchResult) ? 'AND r.id IN ('.implode(',', $searchResult).')' : ''), |
|
1005 | 1005 | ($imDbId !== -1 && is_numeric($imDbId)) ? sprintf(' AND m.imdbid = \'%s\' ', $imDbId) : '', |
1006 | 1006 | ($tmDbId !== -1 && is_numeric($tmDbId)) ? sprintf(' AND m.tmdbid = %d ', $tmDbId) : '', |
1007 | 1007 | ($traktId !== -1 && is_numeric($traktId)) ? sprintf(' AND m.traktid = %d ', $traktId) : '', |
1008 | - ! empty($excludedCategories) ? sprintf('AND r.categories_id NOT IN('.implode(',', $excludedCategories).')') : '', |
|
1008 | + !empty($excludedCategories) ? sprintf('AND r.categories_id NOT IN('.implode(',', $excludedCategories).')') : '', |
|
1009 | 1009 | Category::getCategorySearch($cat, 'movies'), |
1010 | 1010 | $maxAge > 0 ? sprintf(' AND r.postdate > NOW() - INTERVAL %d DAY ', $maxAge) : '', |
1011 | 1011 | $minSize > 0 ? sprintf('AND r.size >= %d', $minSize) : '' |
@@ -1061,7 +1061,7 @@ discard block |
||
1061 | 1061 | } |
1062 | 1062 | |
1063 | 1063 | $results = $this->search(['searchname' => getSimilarName($name)], -1, '', '', -1, -1, 0, config('nntmux.items_per_page'), '', -1, $excludedCats, 'basic', [$parentCat]); |
1064 | - if (! $results) { |
|
1064 | + if (!$results) { |
|
1065 | 1065 | return $ret; |
1066 | 1066 | } |
1067 | 1067 |