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