@@ -275,7 +275,7 @@ discard block |
||
| 275 | 275 | GROUP BY r.id |
| 276 | 276 | ORDER BY %s %s %s", |
| 277 | 277 | $this->uSQL($userShows, 'videos_id'), |
| 278 | - (! empty($excludedCats) ? ' AND r.categories_id NOT IN ('.implode(',', $excludedCats).')' : ''), |
|
| 278 | + (!empty($excludedCats) ? ' AND r.categories_id NOT IN ('.implode(',', $excludedCats).')' : ''), |
|
| 279 | 279 | NZB::NZB_ADDED, |
| 280 | 280 | Category::TV_ROOT, |
| 281 | 281 | Category::TV_OTHER, |
@@ -345,7 +345,7 @@ discard block |
||
| 345 | 345 | { |
| 346 | 346 | // Delete NZB from disk. |
| 347 | 347 | $nzbPath = $nzb->NZBPath($identifiers['g']); |
| 348 | - if (! empty($nzbPath)) { |
|
| 348 | + if (!empty($nzbPath)) { |
|
| 349 | 349 | File::delete($nzbPath); |
| 350 | 350 | } |
| 351 | 351 | |
@@ -385,7 +385,7 @@ discard block |
||
| 385 | 385 | */ |
| 386 | 386 | public function updateMulti($guids, $category, $grabs, $videoId, $episodeId, $anidbId, $imdbId) |
| 387 | 387 | { |
| 388 | - if (! \is_array($guids) || \count($guids) < 1) { |
|
| 388 | + if (!\is_array($guids) || \count($guids) < 1) { |
|
| 389 | 389 | return false; |
| 390 | 390 | } |
| 391 | 391 | |
@@ -409,7 +409,7 @@ discard block |
||
| 409 | 409 | $sql = '(1=2 '; |
| 410 | 410 | foreach ($userQuery as $query) { |
| 411 | 411 | $sql .= sprintf('OR (r.%s = %d', $type, $query->$type); |
| 412 | - if (! empty($query->categories)) { |
|
| 412 | + if (!empty($query->categories)) { |
|
| 413 | 413 | $catsArr = explode('|', $query->categories); |
| 414 | 414 | if (\count($catsArr) > 1) { |
| 415 | 415 | $sql .= sprintf(' AND r.categories_id IN (%s)', implode(',', $catsArr)); |
@@ -453,7 +453,7 @@ discard block |
||
| 453 | 453 | $orderBy = $this->getBrowseOrder($orderBy); |
| 454 | 454 | } |
| 455 | 455 | |
| 456 | - $searchFields = Arr::where($searchArr, static function ($value) { |
|
| 456 | + $searchFields = Arr::where($searchArr, static function($value) { |
|
| 457 | 457 | return $value !== -1; |
| 458 | 458 | }); |
| 459 | 459 | |
@@ -463,7 +463,7 @@ discard block |
||
| 463 | 463 | $searchResult = $this->elasticSearch->indexSearch($phrases, $limit); |
| 464 | 464 | } else { |
| 465 | 465 | $searchResult = $this->manticoreSearch->searchIndexes('releases_rt', '', [], $searchFields); |
| 466 | - if (! empty($searchResult)) { |
|
| 466 | + if (!empty($searchResult)) { |
|
| 467 | 467 | $searchResult = Arr::wrap(Arr::get($searchResult, 'id')); |
| 468 | 468 | } |
| 469 | 469 | } |
@@ -554,7 +554,7 @@ discard block |
||
| 554 | 554 | $searchResult = $this->elasticSearch->indexSearchApi($searchName, $limit); |
| 555 | 555 | } else { |
| 556 | 556 | $searchResult = $this->manticoreSearch->searchIndexes('releases_rt', $searchName, ['searchname']); |
| 557 | - if (! empty($searchResult)) { |
|
| 557 | + if (!empty($searchResult)) { |
|
| 558 | 558 | $searchResult = Arr::wrap(Arr::get($searchResult, 'id')); |
| 559 | 559 | } |
| 560 | 560 | } |
@@ -570,7 +570,7 @@ discard block |
||
| 570 | 570 | ((int) $groupName !== -1 ? sprintf(' AND r.groups_id = %d ', UsenetGroup::getIDByName($groupName)) : ''), |
| 571 | 571 | $catQuery, |
| 572 | 572 | (\count($excludedCats) > 0 ? ' AND r.categories_id NOT IN ('.implode(',', $excludedCats).')' : ''), |
| 573 | - (! empty($searchResult) ? 'AND r.id IN ('.implode(',', $searchResult).')' : ''), |
|
| 573 | + (!empty($searchResult) ? 'AND r.id IN ('.implode(',', $searchResult).')' : ''), |
|
| 574 | 574 | ($minSize > 0 ? sprintf('AND r.size >= %d', $minSize) : '') |
| 575 | 575 | ); |
| 576 | 576 | $baseSql = sprintf( |
@@ -658,11 +658,11 @@ discard block |
||
| 658 | 658 | $show = $this->fromQuery($showQry); |
| 659 | 659 | |
| 660 | 660 | if ($show->isNotEmpty()) { |
| 661 | - if ((! empty($episode) && ! empty($series)) && $show[0]->episodes !== '') { |
|
| 661 | + if ((!empty($episode) && !empty($series)) && $show[0]->episodes !== '') { |
|
| 662 | 662 | $showSql .= ' AND r.tv_episodes_id IN ('.$show[0]->episodes.') AND tve.series = '.$series; |
| 663 | - } elseif (! empty($episode) && $show[0]->episodes !== '') { |
|
| 663 | + } elseif (!empty($episode) && $show[0]->episodes !== '') { |
|
| 664 | 664 | $showSql = sprintf('AND r.tv_episodes_id IN (%s)', $show[0]->episodes); |
| 665 | - } elseif (! empty($series) && empty($episode)) { |
|
| 665 | + } elseif (!empty($series) && empty($episode)) { |
|
| 666 | 666 | // If $series is set but episode is not, return Season Packs and Episodes |
| 667 | 667 | $showSql .= ' AND r.tv_episodes_id IN ('.$show[0]->episodes.') AND tve.series = '.$series; |
| 668 | 668 | } |
@@ -676,26 +676,26 @@ discard block |
||
| 676 | 676 | } |
| 677 | 677 | |
| 678 | 678 | // If $name is set it is a fallback search, add available SxxExx/airdate info to the query |
| 679 | - if (! empty($name) && $showSql === '') { |
|
| 680 | - if (! empty($series) && (int) $series < 1900) { |
|
| 679 | + if (!empty($name) && $showSql === '') { |
|
| 680 | + if (!empty($series) && (int) $series < 1900) { |
|
| 681 | 681 | $name .= sprintf(' S%s', str_pad($series, 2, '0', STR_PAD_LEFT)); |
| 682 | - if (! empty($episode) && ! str_contains($episode, '/')) { |
|
| 682 | + if (!empty($episode) && !str_contains($episode, '/')) { |
|
| 683 | 683 | $name .= sprintf('E%s', str_pad($episode, 2, '0', STR_PAD_LEFT)); |
| 684 | 684 | } |
| 685 | 685 | // If season is not empty but episode is, add a wildcard to the search |
| 686 | 686 | if (empty($episode)) { |
| 687 | 687 | $name .= '*'; |
| 688 | 688 | } |
| 689 | - } elseif (! empty($airDate)) { |
|
| 689 | + } elseif (!empty($airDate)) { |
|
| 690 | 690 | $name .= sprintf(' %s', str_replace(['/', '-', '.', '_'], ' ', $airDate)); |
| 691 | 691 | } |
| 692 | 692 | } |
| 693 | - if (! empty($name)) { |
|
| 693 | + if (!empty($name)) { |
|
| 694 | 694 | if (config('nntmux.elasticsearch_enabled') === true) { |
| 695 | 695 | $searchResult = $this->elasticSearch->indexSearchTMA($name, $limit); |
| 696 | 696 | } else { |
| 697 | 697 | $searchResult = $this->manticoreSearch->searchIndexes('releases_rt', $name, ['searchname']); |
| 698 | - if (! empty($searchResult)) { |
|
| 698 | + if (!empty($searchResult)) { |
|
| 699 | 699 | $searchResult = Arr::wrap(Arr::get($searchResult, 'id')); |
| 700 | 700 | } |
| 701 | 701 | } |
@@ -711,11 +711,11 @@ discard block |
||
| 711 | 711 | NZB::NZB_ADDED, |
| 712 | 712 | $this->showPasswords(), |
| 713 | 713 | $showSql, |
| 714 | - (! empty($name) && count($searchResult) !== 0) ? 'AND r.id IN ('.implode(',', $searchResult).')' : '', |
|
| 714 | + (!empty($name) && count($searchResult) !== 0) ? 'AND r.id IN ('.implode(',', $searchResult).')' : '', |
|
| 715 | 715 | Category::getCategorySearch($cat, 'tv'), |
| 716 | 716 | $maxAge > 0 ? sprintf('AND r.postdate > NOW() - INTERVAL %d DAY', $maxAge) : '', |
| 717 | 717 | $minSize > 0 ? sprintf('AND r.size >= %d', $minSize) : '', |
| 718 | - ! empty($excludedCategories) ? sprintf('AND r.categories_id NOT IN('.implode(',', $excludedCategories).')') : '' |
|
| 718 | + !empty($excludedCategories) ? sprintf('AND r.categories_id NOT IN('.implode(',', $excludedCategories).')') : '' |
|
| 719 | 719 | ); |
| 720 | 720 | $baseSql = sprintf( |
| 721 | 721 | "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, |
@@ -751,7 +751,7 @@ discard block |
||
| 751 | 751 | if ($releases !== null) { |
| 752 | 752 | return $releases; |
| 753 | 753 | } |
| 754 | - $releases = ((! empty($name) && count($searchResult) !== 0) || empty($name)) ? $this->fromQuery($sql) : []; |
|
| 754 | + $releases = ((!empty($name) && count($searchResult) !== 0) || empty($name)) ? $this->fromQuery($sql) : []; |
|
| 755 | 755 | if (count($releases) !== 0 && $releases->isNotEmpty()) { |
| 756 | 756 | $releases[0]->_totalrows = $releases->count(); |
| 757 | 757 | } |
@@ -797,11 +797,11 @@ discard block |
||
| 797 | 797 | |
| 798 | 798 | $show = $this->fromQuery($showQry); |
| 799 | 799 | if ($show->isNotEmpty()) { |
| 800 | - if ((! empty($episode) && ! empty($series)) && $show[0]->episodes !== '') { |
|
| 800 | + if ((!empty($episode) && !empty($series)) && $show[0]->episodes !== '') { |
|
| 801 | 801 | $showSql .= ' AND r.tv_episodes_id IN ('.$show[0]->episodes.') AND tve.series = '.$series; |
| 802 | - } elseif (! empty($episode) && $show[0]->episodes !== '') { |
|
| 802 | + } elseif (!empty($episode) && $show[0]->episodes !== '') { |
|
| 803 | 803 | $showSql = sprintf('AND r.tv_episodes_id IN (%s)', $show[0]->episodes); |
| 804 | - } elseif (! empty($series) && empty($episode)) { |
|
| 804 | + } elseif (!empty($series) && empty($episode)) { |
|
| 805 | 805 | // If $series is set but episode is not, return Season Packs and Episodes |
| 806 | 806 | $showSql .= ' AND r.tv_episodes_id IN ('.$show[0]->episodes.') AND tve.series = '.$series; |
| 807 | 807 | } |
@@ -814,26 +814,26 @@ discard block |
||
| 814 | 814 | } |
| 815 | 815 | } |
| 816 | 816 | // If $name is set it is a fallback search, add available SxxExx/airdate info to the query |
| 817 | - if (! empty($name) && $showSql === '') { |
|
| 818 | - if (! empty($series) && (int) $series < 1900) { |
|
| 817 | + if (!empty($name) && $showSql === '') { |
|
| 818 | + if (!empty($series) && (int) $series < 1900) { |
|
| 819 | 819 | $name .= sprintf(' S%s', str_pad($series, 2, '0', STR_PAD_LEFT)); |
| 820 | - if (! empty($episode) && ! str_contains($episode, '/')) { |
|
| 820 | + if (!empty($episode) && !str_contains($episode, '/')) { |
|
| 821 | 821 | $name .= sprintf('E%s', str_pad($episode, 2, '0', STR_PAD_LEFT)); |
| 822 | 822 | } |
| 823 | 823 | // If season is not empty but episode is, add a wildcard to the search |
| 824 | 824 | if (empty($episode)) { |
| 825 | 825 | $name .= '*'; |
| 826 | 826 | } |
| 827 | - } elseif (! empty($airDate)) { |
|
| 827 | + } elseif (!empty($airDate)) { |
|
| 828 | 828 | $name .= sprintf(' %s', str_replace(['/', '-', '.', '_'], ' ', $airDate)); |
| 829 | 829 | } |
| 830 | 830 | } |
| 831 | - if (! empty($name)) { |
|
| 831 | + if (!empty($name)) { |
|
| 832 | 832 | if (config('nntmux.elasticsearch_enabled') === true) { |
| 833 | 833 | $searchResult = $this->elasticSearch->indexSearchTMA($name, $limit); |
| 834 | 834 | } else { |
| 835 | 835 | $searchResult = $this->manticoreSearch->searchIndexes('releases_rt', $name, ['searchname']); |
| 836 | - if (! empty($searchResult)) { |
|
| 836 | + if (!empty($searchResult)) { |
|
| 837 | 837 | $searchResult = Arr::wrap(Arr::get($searchResult, 'id')); |
| 838 | 838 | } |
| 839 | 839 | } |
@@ -849,11 +849,11 @@ discard block |
||
| 849 | 849 | NZB::NZB_ADDED, |
| 850 | 850 | $this->showPasswords(), |
| 851 | 851 | $showSql, |
| 852 | - (! empty($searchResult) ? 'AND r.id IN ('.implode(',', $searchResult).')' : ''), |
|
| 852 | + (!empty($searchResult) ? 'AND r.id IN ('.implode(',', $searchResult).')' : ''), |
|
| 853 | 853 | Category::getCategorySearch($cat, 'tv'), |
| 854 | 854 | ($maxAge > 0 ? sprintf('AND r.postdate > NOW() - INTERVAL %d DAY', $maxAge) : ''), |
| 855 | 855 | ($minSize > 0 ? sprintf('AND r.size >= %d', $minSize) : ''), |
| 856 | - ! empty($excludedCategories) ? sprintf('AND r.categories_id NOT IN('.implode(',', $excludedCategories).')') : '' |
|
| 856 | + !empty($excludedCategories) ? sprintf('AND r.categories_id NOT IN('.implode(',', $excludedCategories).')') : '' |
|
| 857 | 857 | ); |
| 858 | 858 | $baseSql = sprintf( |
| 859 | 859 | "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, |
@@ -901,12 +901,12 @@ discard block |
||
| 901 | 901 | */ |
| 902 | 902 | public function animeSearch($aniDbID, int $offset = 0, int $limit = 100, string $name = '', array $cat = [-1], int $maxAge = -1, array $excludedCategories = []): mixed |
| 903 | 903 | { |
| 904 | - if (! empty($name)) { |
|
| 904 | + if (!empty($name)) { |
|
| 905 | 905 | if (config('nntmux.elasticsearch_enabled') === true) { |
| 906 | 906 | $searchResult = $this->elasticSearch->indexSearchTMA($name, $limit); |
| 907 | 907 | } else { |
| 908 | 908 | $searchResult = $this->manticoreSearch->searchIndexes('releases_rt', $name, ['searchname']); |
| 909 | - if (! empty($searchResult)) { |
|
| 909 | + if (!empty($searchResult)) { |
|
| 910 | 910 | $searchResult = Arr::wrap(Arr::get($searchResult, 'id')); |
| 911 | 911 | } |
| 912 | 912 | } |
@@ -923,8 +923,8 @@ discard block |
||
| 923 | 923 | $this->showPasswords(), |
| 924 | 924 | NZB::NZB_ADDED, |
| 925 | 925 | ($aniDbID > -1 ? sprintf(' AND r.anidbid = %d ', $aniDbID) : ''), |
| 926 | - (! empty($searchResult) ? 'AND r.id IN ('.implode(',', $searchResult).')' : ''), |
|
| 927 | - ! empty($excludedCategories) ? sprintf('AND r.categories_id NOT IN('.implode(',', $excludedCategories).')') : '', |
|
| 926 | + (!empty($searchResult) ? 'AND r.id IN ('.implode(',', $searchResult).')' : ''), |
|
| 927 | + !empty($excludedCategories) ? sprintf('AND r.categories_id NOT IN('.implode(',', $excludedCategories).')') : '', |
|
| 928 | 928 | Category::getCategorySearch($cat), |
| 929 | 929 | ($maxAge > 0 ? sprintf(' AND r.postdate > NOW() - INTERVAL %d DAY ', $maxAge) : '') |
| 930 | 930 | ); |
@@ -971,12 +971,12 @@ discard block |
||
| 971 | 971 | */ |
| 972 | 972 | 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 |
| 973 | 973 | { |
| 974 | - if (! empty($name)) { |
|
| 974 | + if (!empty($name)) { |
|
| 975 | 975 | if (config('nntmux.elasticsearch_enabled') === true) { |
| 976 | 976 | $searchResult = $this->elasticSearch->indexSearchTMA($name, $limit); |
| 977 | 977 | } else { |
| 978 | 978 | $searchResult = $this->manticoreSearch->searchIndexes('releases_rt', $name, ['searchname']); |
| 979 | - if (! empty($searchResult)) { |
|
| 979 | + if (!empty($searchResult)) { |
|
| 980 | 980 | $searchResult = Arr::wrap(Arr::get($searchResult, 'id')); |
| 981 | 981 | } |
| 982 | 982 | } |
@@ -993,11 +993,11 @@ discard block |
||
| 993 | 993 | %s %s %s %s %s %s %s', |
| 994 | 994 | NZB::NZB_ADDED, |
| 995 | 995 | $this->showPasswords(), |
| 996 | - (! empty($searchResult) ? 'AND r.id IN ('.implode(',', $searchResult).')' : ''), |
|
| 996 | + (!empty($searchResult) ? 'AND r.id IN ('.implode(',', $searchResult).')' : ''), |
|
| 997 | 997 | ($imDbId !== -1 && is_numeric($imDbId)) ? sprintf(' AND m.imdbid = \'%s\' ', $imDbId) : '', |
| 998 | 998 | ($tmDbId !== -1 && is_numeric($tmDbId)) ? sprintf(' AND m.tmdbid = %d ', $tmDbId) : '', |
| 999 | 999 | ($traktId !== -1 && is_numeric($traktId)) ? sprintf(' AND m.traktid = %d ', $traktId) : '', |
| 1000 | - ! empty($excludedCategories) ? sprintf('AND r.categories_id NOT IN('.implode(',', $excludedCategories).')') : '', |
|
| 1000 | + !empty($excludedCategories) ? sprintf('AND r.categories_id NOT IN('.implode(',', $excludedCategories).')') : '', |
|
| 1001 | 1001 | Category::getCategorySearch($cat, 'movies'), |
| 1002 | 1002 | $maxAge > 0 ? sprintf(' AND r.postdate > NOW() - INTERVAL %d DAY ', $maxAge) : '', |
| 1003 | 1003 | $minSize > 0 ? sprintf('AND r.size >= %d', $minSize) : '' |
@@ -1053,7 +1053,7 @@ discard block |
||
| 1053 | 1053 | } |
| 1054 | 1054 | |
| 1055 | 1055 | $results = $this->search(['searchname' => getSimilarName($name)], -1, '', '', -1, -1, 0, config('nntmux.items_per_page'), '', -1, $excludedCats, 'basic', [$parentCat]); |
| 1056 | - if (! $results) { |
|
| 1056 | + if (!$results) { |
|
| 1057 | 1057 | return $ret; |
| 1058 | 1058 | } |
| 1059 | 1059 | |