@@ -70,12 +70,12 @@ discard block |
||
| 70 | 70 | $query->where('postdate', '>', now()->subDays($maxAge)); |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | - if (! empty($excludedCats)) { |
|
| 73 | + if (!empty($excludedCats)) { |
|
| 74 | 74 | $query->whereNotIn('categories_id', $excludedCats); |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | if ($groupName !== -1) { |
| 78 | - $query->whereHas('group', function ($q) use ($groupName) { |
|
| 78 | + $query->whereHas('group', function($q) use ($groupName) { |
|
| 79 | 79 | $q->where('name', $groupName); |
| 80 | 80 | }); |
| 81 | 81 | } |
@@ -241,10 +241,10 @@ discard block |
||
| 241 | 241 | ->where('nzbstatus', NZB::NZB_ADDED) |
| 242 | 242 | ->where('passwordstatus', $this->showPasswords(true)) |
| 243 | 243 | ->whereBetween('categories_id', [Category::TV_ROOT, Category::TV_OTHER]) |
| 244 | - ->when($maxAge > 0, function ($q) use ($maxAge) { |
|
| 244 | + ->when($maxAge > 0, function($q) use ($maxAge) { |
|
| 245 | 245 | $q->where('postdate', '>', now()->subDays($maxAge)); |
| 246 | 246 | }) |
| 247 | - ->when(! empty($excludedCats), function ($q) use ($excludedCats) { |
|
| 247 | + ->when(!empty($excludedCats), function($q) use ($excludedCats) { |
|
| 248 | 248 | $q->whereNotIn('categories_id', $excludedCats); |
| 249 | 249 | }) |
| 250 | 250 | ->whereRaw($this->uSQL($userShows, 'videos_id')) |
@@ -320,7 +320,7 @@ discard block |
||
| 320 | 320 | { |
| 321 | 321 | // Delete NZB from disk. |
| 322 | 322 | $nzbPath = $nzb->NZBPath($identifiers['g']); |
| 323 | - if (! empty($nzbPath)) { |
|
| 323 | + if (!empty($nzbPath)) { |
|
| 324 | 324 | File::delete($nzbPath); |
| 325 | 325 | } |
| 326 | 326 | |
@@ -360,7 +360,7 @@ discard block |
||
| 360 | 360 | */ |
| 361 | 361 | public function updateMulti($guids, $category, $grabs, $videoId, $episodeId, $anidbId, $imdbId) |
| 362 | 362 | { |
| 363 | - if (! \is_array($guids) || \count($guids) < 1) { |
|
| 363 | + if (!\is_array($guids) || \count($guids) < 1) { |
|
| 364 | 364 | return false; |
| 365 | 365 | } |
| 366 | 366 | |
@@ -384,7 +384,7 @@ discard block |
||
| 384 | 384 | $sql = '(1=2 '; |
| 385 | 385 | foreach ($userQuery as $query) { |
| 386 | 386 | $sql .= sprintf('OR (r.%s = %d', $type, $query->$type); |
| 387 | - if (! empty($query->categories)) { |
|
| 387 | + if (!empty($query->categories)) { |
|
| 388 | 388 | $catsArr = explode('|', $query->categories); |
| 389 | 389 | if (\count($catsArr) > 1) { |
| 390 | 390 | $sql .= sprintf(' AND r.categories_id IN (%s)', implode(',', $catsArr)); |
@@ -426,7 +426,7 @@ discard block |
||
| 426 | 426 | $orderBy = $this->getBrowseOrder($orderBy); |
| 427 | 427 | } |
| 428 | 428 | |
| 429 | - $searchFields = Arr::where($searchArr, static function ($value) { |
|
| 429 | + $searchFields = Arr::where($searchArr, static function($value) { |
|
| 430 | 430 | return $value !== -1; |
| 431 | 431 | }); |
| 432 | 432 | |
@@ -436,7 +436,7 @@ discard block |
||
| 436 | 436 | $searchResult = $this->elasticSearch->indexSearch($phrases, $limit); |
| 437 | 437 | } else { |
| 438 | 438 | $searchResult = $this->manticoreSearch->searchIndexes('releases_rt', '', [], $searchFields); |
| 439 | - if (! empty($searchResult)) { |
|
| 439 | + if (!empty($searchResult)) { |
|
| 440 | 440 | $searchResult = Arr::wrap(Arr::get($searchResult, 'id')); |
| 441 | 441 | } |
| 442 | 442 | } |
@@ -464,12 +464,12 @@ discard block |
||
| 464 | 464 | $query->where('postdate', '>', now()->subDays($maxAge)); |
| 465 | 465 | } |
| 466 | 466 | |
| 467 | - if (! empty($excludedCats)) { |
|
| 467 | + if (!empty($excludedCats)) { |
|
| 468 | 468 | $query->whereNotIn('categories_id', $excludedCats); |
| 469 | 469 | } |
| 470 | 470 | |
| 471 | 471 | if ((int) $groupName !== -1) { |
| 472 | - $query->whereHas('group', function ($q) use ($groupName) { |
|
| 472 | + $query->whereHas('group', function($q) use ($groupName) { |
|
| 473 | 473 | $q->where('name', $groupName); |
| 474 | 474 | }); |
| 475 | 475 | } |
@@ -534,7 +534,7 @@ discard block |
||
| 534 | 534 | $searchResult = $this->elasticSearch->indexSearchApi($searchName, $limit); |
| 535 | 535 | } else { |
| 536 | 536 | $searchResult = $this->manticoreSearch->searchIndexes('releases_rt', $searchName, ['searchname']); |
| 537 | - if (! empty($searchResult)) { |
|
| 537 | + if (!empty($searchResult)) { |
|
| 538 | 538 | $searchResult = Arr::wrap(Arr::get($searchResult, 'id')); |
| 539 | 539 | } |
| 540 | 540 | } |
@@ -549,12 +549,12 @@ discard block |
||
| 549 | 549 | $query->where('postdate', '>', now()->subDays($maxAge)); |
| 550 | 550 | } |
| 551 | 551 | |
| 552 | - if (! empty($excludedCats)) { |
|
| 552 | + if (!empty($excludedCats)) { |
|
| 553 | 553 | $query->whereNotIn('categories_id', $excludedCats); |
| 554 | 554 | } |
| 555 | 555 | |
| 556 | 556 | if ((int) $groupName !== -1) { |
| 557 | - $query->whereHas('group', function ($q) use ($groupName) { |
|
| 557 | + $query->whereHas('group', function($q) use ($groupName) { |
|
| 558 | 558 | $q->where('name', $groupName); |
| 559 | 559 | }); |
| 560 | 560 | } |
@@ -626,11 +626,11 @@ discard block |
||
| 626 | 626 | $show = self::fromQuery($showQry); |
| 627 | 627 | |
| 628 | 628 | if ($show->isNotEmpty()) { |
| 629 | - if ((! empty($episode) && ! empty($series)) && $show[0]->episodes !== '') { |
|
| 629 | + if ((!empty($episode) && !empty($series)) && $show[0]->episodes !== '') { |
|
| 630 | 630 | $showSql .= ' AND r.tv_episodes_id IN ('.$show[0]->episodes.') AND tve.series = '.$series; |
| 631 | - } elseif (! empty($episode) && $show[0]->episodes !== '') { |
|
| 631 | + } elseif (!empty($episode) && $show[0]->episodes !== '') { |
|
| 632 | 632 | $showSql = sprintf('AND r.tv_episodes_id IN (%s)', $show[0]->episodes); |
| 633 | - } elseif (! empty($series) && empty($episode)) { |
|
| 633 | + } elseif (!empty($series) && empty($episode)) { |
|
| 634 | 634 | // If $series is set but episode is not, return Season Packs and Episodes |
| 635 | 635 | $showSql .= ' AND r.tv_episodes_id IN ('.$show[0]->episodes.') AND tve.series = '.$series; |
| 636 | 636 | } |
@@ -644,26 +644,26 @@ discard block |
||
| 644 | 644 | } |
| 645 | 645 | |
| 646 | 646 | // If $name is set it is a fallback search, add available SxxExx/airdate info to the query |
| 647 | - if (! empty($name) && $showSql === '') { |
|
| 648 | - if (! empty($series) && (int) $series < 1900) { |
|
| 647 | + if (!empty($name) && $showSql === '') { |
|
| 648 | + if (!empty($series) && (int) $series < 1900) { |
|
| 649 | 649 | $name .= sprintf(' S%s', str_pad($series, 2, '0', STR_PAD_LEFT)); |
| 650 | - if (! empty($episode) && ! str_contains($episode, '/')) { |
|
| 650 | + if (!empty($episode) && !str_contains($episode, '/')) { |
|
| 651 | 651 | $name .= sprintf('E%s', str_pad($episode, 2, '0', STR_PAD_LEFT)); |
| 652 | 652 | } |
| 653 | 653 | // If season is not empty but episode is, add a wildcard to the search |
| 654 | 654 | if (empty($episode)) { |
| 655 | 655 | $name .= '*'; |
| 656 | 656 | } |
| 657 | - } elseif (! empty($airDate)) { |
|
| 657 | + } elseif (!empty($airDate)) { |
|
| 658 | 658 | $name .= sprintf(' %s', str_replace(['/', '-', '.', '_'], ' ', $airDate)); |
| 659 | 659 | } |
| 660 | 660 | } |
| 661 | - if (! empty($name)) { |
|
| 661 | + if (!empty($name)) { |
|
| 662 | 662 | if (config('nntmux.elasticsearch_enabled') === true) { |
| 663 | 663 | $searchResult = $this->elasticSearch->indexSearchTMA($name, $limit); |
| 664 | 664 | } else { |
| 665 | 665 | $searchResult = $this->manticoreSearch->searchIndexes('releases_rt', $name, ['searchname']); |
| 666 | - if (! empty($searchResult)) { |
|
| 666 | + if (!empty($searchResult)) { |
|
| 667 | 667 | $searchResult = Arr::wrap(Arr::get($searchResult, 'id')); |
| 668 | 668 | } |
| 669 | 669 | } |
@@ -679,11 +679,11 @@ discard block |
||
| 679 | 679 | NZB::NZB_ADDED, |
| 680 | 680 | $this->showPasswords(), |
| 681 | 681 | $showSql, |
| 682 | - (! empty($name) && ! empty($searchResult)) ? 'AND r.id IN ('.implode(',', $searchResult).')' : '', |
|
| 682 | + (!empty($name) && !empty($searchResult)) ? 'AND r.id IN ('.implode(',', $searchResult).')' : '', |
|
| 683 | 683 | Category::getCategorySearch($cat, 'tv'), |
| 684 | 684 | $maxAge > 0 ? sprintf('AND r.postdate > NOW() - INTERVAL %d DAY', $maxAge) : '', |
| 685 | 685 | $minSize > 0 ? sprintf('AND r.size >= %d', $minSize) : '', |
| 686 | - ! empty($excludedCategories) ? sprintf('AND r.categories_id NOT IN('.implode(',', $excludedCategories).')') : '' |
|
| 686 | + !empty($excludedCategories) ? sprintf('AND r.categories_id NOT IN('.implode(',', $excludedCategories).')') : '' |
|
| 687 | 687 | ); |
| 688 | 688 | $baseSql = sprintf( |
| 689 | 689 | "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, |
@@ -719,7 +719,7 @@ discard block |
||
| 719 | 719 | if ($releases !== null) { |
| 720 | 720 | return $releases; |
| 721 | 721 | } |
| 722 | - $releases = ((! empty($name) && ! empty($searchResult)) || empty($name)) ? self::fromQuery($sql) : []; |
|
| 722 | + $releases = ((!empty($name) && !empty($searchResult)) || empty($name)) ? self::fromQuery($sql) : []; |
|
| 723 | 723 | if (count($releases) !== 0 && $releases->isNotEmpty()) { |
| 724 | 724 | $releases[0]->_totalrows = $this->getPagerCount( |
| 725 | 725 | preg_replace('#LEFT(\s+OUTER)?\s+JOIN\s+(?!tv_episodes)\s+.*ON.*=.*\n#i', ' ', $baseSql) |
@@ -767,11 +767,11 @@ discard block |
||
| 767 | 767 | |
| 768 | 768 | $show = self::fromQuery($showQry); |
| 769 | 769 | if ($show->isNotEmpty()) { |
| 770 | - if ((! empty($episode) && ! empty($series)) && $show[0]->episodes !== '') { |
|
| 770 | + if ((!empty($episode) && !empty($series)) && $show[0]->episodes !== '') { |
|
| 771 | 771 | $showSql .= ' AND r.tv_episodes_id IN ('.$show[0]->episodes.') AND tve.series = '.$series; |
| 772 | - } elseif (! empty($episode) && $show[0]->episodes !== '') { |
|
| 772 | + } elseif (!empty($episode) && $show[0]->episodes !== '') { |
|
| 773 | 773 | $showSql = sprintf('AND r.tv_episodes_id IN (%s)', $show[0]->episodes); |
| 774 | - } elseif (! empty($series) && empty($episode)) { |
|
| 774 | + } elseif (!empty($series) && empty($episode)) { |
|
| 775 | 775 | // If $series is set but episode is not, return Season Packs and Episodes |
| 776 | 776 | $showSql .= ' AND r.tv_episodes_id IN ('.$show[0]->episodes.') AND tve.series = '.$series; |
| 777 | 777 | } |
@@ -784,26 +784,26 @@ discard block |
||
| 784 | 784 | } |
| 785 | 785 | } |
| 786 | 786 | // If $name is set it is a fallback search, add available SxxExx/airdate info to the query |
| 787 | - if (! empty($name) && $showSql === '') { |
|
| 788 | - if (! empty($series) && (int) $series < 1900) { |
|
| 787 | + if (!empty($name) && $showSql === '') { |
|
| 788 | + if (!empty($series) && (int) $series < 1900) { |
|
| 789 | 789 | $name .= sprintf(' S%s', str_pad($series, 2, '0', STR_PAD_LEFT)); |
| 790 | - if (! empty($episode) && ! str_contains($episode, '/')) { |
|
| 790 | + if (!empty($episode) && !str_contains($episode, '/')) { |
|
| 791 | 791 | $name .= sprintf('E%s', str_pad($episode, 2, '0', STR_PAD_LEFT)); |
| 792 | 792 | } |
| 793 | 793 | // If season is not empty but episode is, add a wildcard to the search |
| 794 | 794 | if (empty($episode)) { |
| 795 | 795 | $name .= '*'; |
| 796 | 796 | } |
| 797 | - } elseif (! empty($airDate)) { |
|
| 797 | + } elseif (!empty($airDate)) { |
|
| 798 | 798 | $name .= sprintf(' %s', str_replace(['/', '-', '.', '_'], ' ', $airDate)); |
| 799 | 799 | } |
| 800 | 800 | } |
| 801 | - if (! empty($name)) { |
|
| 801 | + if (!empty($name)) { |
|
| 802 | 802 | if (config('nntmux.elasticsearch_enabled') === true) { |
| 803 | 803 | $searchResult = $this->elasticSearch->indexSearchTMA($name, $limit); |
| 804 | 804 | } else { |
| 805 | 805 | $searchResult = $this->manticoreSearch->searchIndexes('releases_rt', $name, ['searchname']); |
| 806 | - if (! empty($searchResult)) { |
|
| 806 | + if (!empty($searchResult)) { |
|
| 807 | 807 | $searchResult = Arr::wrap(Arr::get($searchResult, 'id')); |
| 808 | 808 | } |
| 809 | 809 | } |
@@ -819,11 +819,11 @@ discard block |
||
| 819 | 819 | NZB::NZB_ADDED, |
| 820 | 820 | $this->showPasswords(), |
| 821 | 821 | $showSql, |
| 822 | - (! empty($searchResult) ? 'AND r.id IN ('.implode(',', $searchResult).')' : ''), |
|
| 822 | + (!empty($searchResult) ? 'AND r.id IN ('.implode(',', $searchResult).')' : ''), |
|
| 823 | 823 | Category::getCategorySearch($cat, 'tv'), |
| 824 | 824 | ($maxAge > 0 ? sprintf('AND r.postdate > NOW() - INTERVAL %d DAY', $maxAge) : ''), |
| 825 | 825 | ($minSize > 0 ? sprintf('AND r.size >= %d', $minSize) : ''), |
| 826 | - ! empty($excludedCategories) ? sprintf('AND r.categories_id NOT IN('.implode(',', $excludedCategories).')') : '' |
|
| 826 | + !empty($excludedCategories) ? sprintf('AND r.categories_id NOT IN('.implode(',', $excludedCategories).')') : '' |
|
| 827 | 827 | ); |
| 828 | 828 | $baseSql = sprintf( |
| 829 | 829 | "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, |
@@ -875,19 +875,19 @@ discard block |
||
| 875 | 875 | $cacheKey = md5(json_encode(func_get_args())); |
| 876 | 876 | $cacheTTL = now()->addMinutes(config('nntmux.cache_expiry_medium')); |
| 877 | 877 | |
| 878 | - return Cache::remember($cacheKey, $cacheTTL, function () use ($imDbId, $tmDbId, $traktId, $offset, $limit, $name, $cat, $maxAge, $minSize, $excludedCategories) { |
|
| 878 | + return Cache::remember($cacheKey, $cacheTTL, function() use ($imDbId, $tmDbId, $traktId, $offset, $limit, $name, $cat, $maxAge, $minSize, $excludedCategories) { |
|
| 879 | 879 | $query = self::query() |
| 880 | 880 | ->with(['movieinfo', 'group', 'category', 'category.parent', 'nfo']) |
| 881 | 881 | ->whereBetween('categories_id', [Category::MOVIE_ROOT, Category::MOVIE_OTHER]) |
| 882 | 882 | ->where('nzbstatus', NZB::NZB_ADDED) |
| 883 | 883 | ->where('passwordstatus', $this->showPasswords()); |
| 884 | 884 | |
| 885 | - if (! empty($name)) { |
|
| 885 | + if (!empty($name)) { |
|
| 886 | 886 | if (config('nntmux.elasticsearch_enabled') === true) { |
| 887 | 887 | $searchResult = $this->elasticSearch->indexSearchTMA($name, $limit); |
| 888 | 888 | } else { |
| 889 | 889 | $searchResult = $this->manticoreSearch->searchIndexes('releases_rt', $name, ['searchname']); |
| 890 | - if (! empty($searchResult)) { |
|
| 890 | + if (!empty($searchResult)) { |
|
| 891 | 891 | $searchResult = Arr::wrap(Arr::get($searchResult, 'id')); |
| 892 | 892 | } |
| 893 | 893 | } |
@@ -900,24 +900,24 @@ discard block |
||
| 900 | 900 | } |
| 901 | 901 | |
| 902 | 902 | if ($imDbId !== -1 && is_numeric($imDbId)) { |
| 903 | - $query->whereHas('movieinfo', function ($q) use ($imDbId) { |
|
| 903 | + $query->whereHas('movieinfo', function($q) use ($imDbId) { |
|
| 904 | 904 | $q->where('imdbid', $imDbId); |
| 905 | 905 | }); |
| 906 | 906 | } |
| 907 | 907 | |
| 908 | 908 | if ($tmDbId !== -1 && is_numeric($tmDbId)) { |
| 909 | - $query->whereHas('movieinfo', function ($q) use ($tmDbId) { |
|
| 909 | + $query->whereHas('movieinfo', function($q) use ($tmDbId) { |
|
| 910 | 910 | $q->where('tmdbid', $tmDbId); |
| 911 | 911 | }); |
| 912 | 912 | } |
| 913 | 913 | |
| 914 | 914 | if ($traktId !== -1 && is_numeric($traktId)) { |
| 915 | - $query->whereHas('movieinfo', function ($q) use ($traktId) { |
|
| 915 | + $query->whereHas('movieinfo', function($q) use ($traktId) { |
|
| 916 | 916 | $q->where('traktid', $traktId); |
| 917 | 917 | }); |
| 918 | 918 | } |
| 919 | 919 | |
| 920 | - if (! empty($excludedCategories)) { |
|
| 920 | + if (!empty($excludedCategories)) { |
|
| 921 | 921 | $query->whereNotIn('categories_id', $excludedCategories); |
| 922 | 922 | } |
| 923 | 923 | |
@@ -962,7 +962,7 @@ discard block |
||
| 962 | 962 | } |
| 963 | 963 | |
| 964 | 964 | $results = $this->search(['searchname' => getSimilarName($name)], -1, '', '', -1, -1, 0, config('nntmux.items_per_page'), '', -1, $excludedCats, 'basic', [$parentCat]); |
| 965 | - if (! $results) { |
|
| 965 | + if (!$results) { |
|
| 966 | 966 | return $ret; |
| 967 | 967 | } |
| 968 | 968 | |