@@ -51,7 +51,7 @@ |
||
51 | 51 | 'search' => ['available' => 'yes', 'supportedParams' => 'id'], |
52 | 52 | 'tv-search' => ['available' => 'yes', 'supportedParams' => 'id,vid,tvdbid,traktid,rid,tvmazeid,imdbid,tmdbid,season,ep'], |
53 | 53 | 'movie-search' => ['available' => 'yes', 'supportedParams' => 'id, imdbid, tmdbid, traktid'], |
54 | - 'audio-search' => ['available' => 'no', 'supportedParams' => ''], |
|
54 | + 'audio-search' => ['available' => 'no', 'supportedParams' => ''], |
|
55 | 55 | ], |
56 | 56 | 'categories' => fractal($category, new CategoryTransformer), |
57 | 57 | ]; |
@@ -19,18 +19,18 @@ |
||
19 | 19 | */ |
20 | 20 | public function release(Request $request): \Illuminate\Http\JsonResponse |
21 | 21 | { |
22 | - $releaseObName = $request->has('relo') && ! empty($request->input('relo')) ? $request->input('relo') : ''; |
|
23 | - $releasePrName = $request->has('relp') && ! empty($request->input('relp')) ? $request->input('relp') : ''; |
|
24 | - $apiToken = $request->has('api_token') && ! empty($request->input('api_token')) ? $request->input('api_token') : ''; |
|
22 | + $releaseObName = $request->has('relo') && !empty($request->input('relo')) ? $request->input('relo') : ''; |
|
23 | + $releasePrName = $request->has('relp') && !empty($request->input('relp')) ? $request->input('relp') : ''; |
|
24 | + $apiToken = $request->has('api_token') && !empty($request->input('api_token')) ? $request->input('api_token') : ''; |
|
25 | 25 | $user = User::query()->where('api_token', $request->input('api_token'))->first(); |
26 | - if (! $user) { |
|
26 | + if (!$user) { |
|
27 | 27 | return response()->json(['message' => 'Indexer inform error, wrong api key!'], 404); |
28 | 28 | } |
29 | 29 | |
30 | - if (! empty($releaseObName) && ! empty($releasePrName) && ! empty($apiToken)) { |
|
30 | + if (!empty($releaseObName) && !empty($releasePrName) && !empty($apiToken)) { |
|
31 | 31 | ReleaseInform::insertOrIgnore(['relOName' => $releaseObName, 'relPName' => $releasePrName, 'api_token' => $apiToken, 'created_at' => now(), 'updated_at' => now()]); |
32 | 32 | $release = Release::whereSearchname($releaseObName)->first(); |
33 | - if (! empty($release)) { |
|
33 | + if (!empty($release)) { |
|
34 | 34 | (new NameFixer)->updateRelease($release, $releasePrName, 'Release Inform API', true, 'Filenames, ', 1, true); |
35 | 35 | } |
36 | 36 |
@@ -196,7 +196,7 @@ |
||
196 | 196 | return $predb; |
197 | 197 | } |
198 | 198 | $sql = self::query()->leftJoin('releases', 'releases.predb_id', '=', 'predb.id')->orderByDesc('predb.predate'); |
199 | - if (! empty($search)) { |
|
199 | + if (!empty($search)) { |
|
200 | 200 | if (config('nntmux.elasticsearch_enabled') === true) { |
201 | 201 | $ids = (new ElasticSearchSiteSearch)->predbIndexSearch($search); |
202 | 202 | } else { |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | public static function updateRelease($id, $name, $searchName, $fromName, $categoryId, $parts, $grabs, $size, $postedDate, $addedDate, $videoId, $episodeId, $imDbId, $aniDbId): void |
276 | 276 | { |
277 | 277 | $movieInfoId = null; |
278 | - if (! empty($imDbId)) { |
|
278 | + if (!empty($imDbId)) { |
|
279 | 279 | $movieInfoId = MovieInfo::whereImdbid($imDbId)->first(['id']); |
280 | 280 | } |
281 | 281 | self::whereId($id)->update( |
@@ -526,12 +526,12 @@ discard block |
||
526 | 526 | |
527 | 527 | preg_match('/(^\w+[-_. ].+?\.(\d+p)).+/i', $rel['searchname'], $similar); |
528 | 528 | |
529 | - if (! empty($similar)) { |
|
529 | + if (!empty($similar)) { |
|
530 | 530 | if (config('nntmux.elasticsearch_enabled') === true) { |
531 | 531 | $searchResult = (new ElasticSearchSiteSearch)->indexSearch($similar[1], 10); |
532 | 532 | } else { |
533 | 533 | $searchResult = (new ManticoreSearch)->searchIndexes('releases_rt', $similar[1]); |
534 | - if (! empty($searchResult)) { |
|
534 | + if (!empty($searchResult)) { |
|
535 | 535 | $searchResult = Arr::wrap(Arr::get($searchResult, 'id')); |
536 | 536 | } |
537 | 537 | } |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | $manticore->truncateRTIndex(Arr::wrap('releases_rt')); |
65 | 65 | $data = []; |
66 | 66 | $total = Release::count(); |
67 | - if (! $total) { |
|
67 | + if (!$total) { |
|
68 | 68 | $this->warn('Releases table is empty. Nothing to do.'); |
69 | 69 | exit(); |
70 | 70 | } |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | ->select(['releases.id', 'releases.name', 'releases.searchname', 'releases.fromname', 'releases.categories_id']) |
85 | 85 | ->selectRaw('IFNULL(GROUP_CONCAT(release_files.name SEPARATOR " "),"") filename') |
86 | 86 | ->groupBy('id') |
87 | - ->chunk($max, function ($releases) use ($manticore, $bar, $data) { |
|
87 | + ->chunk($max, function($releases) use ($manticore, $bar, $data) { |
|
88 | 88 | foreach ($releases as $r) { |
89 | 89 | $data[] = [ |
90 | 90 | 'id' => $r->id, |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | $data = []; |
113 | 113 | |
114 | 114 | $total = Predb::count(); |
115 | - if (! $total) { |
|
115 | + if (!$total) { |
|
116 | 116 | $this->warn('PreDB table is empty. Nothing to do.'); |
117 | 117 | exit(); |
118 | 118 | } |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | ->select(['id', 'title', 'filename', 'source']) |
130 | 130 | ->groupBy('id') |
131 | 131 | ->orderBy('id') |
132 | - ->chunk($max, function ($pre) use ($manticore, $bar, $data) { |
|
132 | + ->chunk($max, function($pre) use ($manticore, $bar, $data) { |
|
133 | 133 | foreach ($pre as $p) { |
134 | 134 | $data[] = [ |
135 | 135 | 'id' => $p->id, |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | $data = ['body' => []]; |
152 | 152 | $elastic = new ElasticSearchSiteSearch; |
153 | 153 | $total = Release::count(); |
154 | - if (! $total) { |
|
154 | + if (!$total) { |
|
155 | 155 | $this->warn('Could not get database information for releases table.'); |
156 | 156 | exit(); |
157 | 157 | } |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | ->select(['releases.id', 'releases.name', 'releases.searchname', 'releases.fromname', 'releases.categories_id', 'releases.postdate']) |
170 | 170 | ->selectRaw('IFNULL(GROUP_CONCAT(release_files.name SEPARATOR " "),"") filename') |
171 | 171 | ->groupBy('id') |
172 | - ->chunk($max, function ($releases) use ($bar, $data) { |
|
172 | + ->chunk($max, function($releases) use ($bar, $data) { |
|
173 | 173 | foreach ($releases as $r) { |
174 | 174 | $searchName = str_replace(['.', '-'], ' ', $r->searchname); |
175 | 175 | $data['body'][] = [ |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | $data = ['body' => []]; |
203 | 203 | $elastic = new ElasticSearchSiteSearch; |
204 | 204 | $total = Predb::count(); |
205 | - if (! $total) { |
|
205 | + if (!$total) { |
|
206 | 206 | $this->warn('Could not get database information for predb table.'); |
207 | 207 | exit(); |
208 | 208 | } |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | ->select(['id', 'title', 'filename', 'source']) |
220 | 220 | ->groupBy('id') |
221 | 221 | ->orderBy('id') |
222 | - ->chunk($max, function ($pre) use ($bar, $data) { |
|
222 | + ->chunk($max, function($pre) use ($bar, $data) { |
|
223 | 223 | foreach ($pre as $p) { |
224 | 224 | $data['body'][] = [ |
225 | 225 | 'index' => [ |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | public function handle(): void |
38 | 38 | { |
39 | 39 | // Check if any options are false |
40 | - if (! $this->option('notindb') && ! $this->option('notondisk')) { |
|
40 | + if (!$this->option('notindb') && !$this->option('notondisk')) { |
|
41 | 41 | $this->error('You must specify at least one option. See: --help'); |
42 | 42 | exit(); |
43 | 43 | } |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | $guid = stristr($filePath->getFilename(), '.nzb.gz', true); |
64 | 64 | if (File::isFile($filePath) && $guid) { |
65 | 65 | // If NZB file guid is not present in DB delete the file from disk |
66 | - if (! $releases->whereGuid($guid)->exists()) { |
|
66 | + if (!$releases->whereGuid($guid)->exists()) { |
|
67 | 67 | if ($delete) { |
68 | 68 | File::delete($filePath); |
69 | 69 | } |
@@ -88,11 +88,11 @@ discard block |
||
88 | 88 | $total = Release::count(); |
89 | 89 | $this->alert("Total releases to check: $total"); |
90 | 90 | |
91 | - Release::where('nzbstatus', 1)->chunkById((int) $this->option('chunksize'), function (Collection $releases) use ($delete, &$checked, &$deleted, $nzb, $rel) { |
|
91 | + Release::where('nzbstatus', 1)->chunkById((int) $this->option('chunksize'), function(Collection $releases) use ($delete, &$checked, &$deleted, $nzb, $rel) { |
|
92 | 92 | echo 'Total done: '.$checked."\r"; |
93 | 93 | foreach ($releases as $r) { |
94 | 94 | |
95 | - if (! $nzb->NZBPath($r->guid)) { |
|
95 | + if (!$nzb->NZBPath($r->guid)) { |
|
96 | 96 | if ($delete) { |
97 | 97 | $rel->deleteSingle(['g' => $r->guid, 'i' => $r->id], $nzb, new ReleaseImage); |
98 | 98 | } |
@@ -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( |
@@ -604,7 +604,7 @@ discard block |
||
604 | 604 | if ($releases !== null) { |
605 | 605 | return $releases; |
606 | 606 | } |
607 | - if ($searchName !== -1 && ! empty($searchResult)) { |
|
607 | + if ($searchName !== -1 && !empty($searchResult)) { |
|
608 | 608 | $releases = self::fromQuery($sql); |
609 | 609 | } elseif ($searchName !== -1 && empty($searchResult)) { |
610 | 610 | $releases = collect(); |
@@ -658,11 +658,11 @@ discard block |
||
658 | 658 | $show = self::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) && ! empty($searchResult)) ? 'AND r.id IN ('.implode(',', $searchResult).')' : '', |
|
714 | + (!empty($name) && !empty($searchResult)) ? 'AND r.id IN ('.implode(',', $searchResult).')' : '', |
|
715 | 715 | Category::getCategorySearch($cat), |
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) && ! empty($searchResult)) || empty($name)) ? self::fromQuery($sql) : []; |
|
754 | + $releases = ((!empty($name) && !empty($searchResult)) || empty($name)) ? self::fromQuery($sql) : []; |
|
755 | 755 | if (count($releases) !== 0 && $releases->isNotEmpty()) { |
756 | 756 | $releases[0]->_totalrows = $this->getPagerCount( |
757 | 757 | preg_replace('#LEFT(\s+OUTER)?\s+JOIN\s+(?!tv_episodes)\s+.*ON.*=.*\n#i', ' ', $baseSql) |
@@ -799,11 +799,11 @@ discard block |
||
799 | 799 | |
800 | 800 | $show = self::fromQuery($showQry); |
801 | 801 | if ($show->isNotEmpty()) { |
802 | - if ((! empty($episode) && ! empty($series)) && $show[0]->episodes !== '') { |
|
802 | + if ((!empty($episode) && !empty($series)) && $show[0]->episodes !== '') { |
|
803 | 803 | $showSql .= ' AND r.tv_episodes_id IN ('.$show[0]->episodes.') AND tve.series = '.$series; |
804 | - } elseif (! empty($episode) && $show[0]->episodes !== '') { |
|
804 | + } elseif (!empty($episode) && $show[0]->episodes !== '') { |
|
805 | 805 | $showSql = sprintf('AND r.tv_episodes_id IN (%s)', $show[0]->episodes); |
806 | - } elseif (! empty($series) && empty($episode)) { |
|
806 | + } elseif (!empty($series) && empty($episode)) { |
|
807 | 807 | // If $series is set but episode is not, return Season Packs and Episodes |
808 | 808 | $showSql .= ' AND r.tv_episodes_id IN ('.$show[0]->episodes.') AND tve.series = '.$series; |
809 | 809 | } |
@@ -816,26 +816,26 @@ discard block |
||
816 | 816 | } |
817 | 817 | } |
818 | 818 | // If $name is set it is a fallback search, add available SxxExx/airdate info to the query |
819 | - if (! empty($name) && $showSql === '') { |
|
820 | - if (! empty($series) && (int) $series < 1900) { |
|
819 | + if (!empty($name) && $showSql === '') { |
|
820 | + if (!empty($series) && (int) $series < 1900) { |
|
821 | 821 | $name .= sprintf(' S%s', str_pad($series, 2, '0', STR_PAD_LEFT)); |
822 | - if (! empty($episode) && ! str_contains($episode, '/')) { |
|
822 | + if (!empty($episode) && !str_contains($episode, '/')) { |
|
823 | 823 | $name .= sprintf('E%s', str_pad($episode, 2, '0', STR_PAD_LEFT)); |
824 | 824 | } |
825 | 825 | // If season is not empty but episode is, add a wildcard to the search |
826 | 826 | if (empty($episode)) { |
827 | 827 | $name .= '*'; |
828 | 828 | } |
829 | - } elseif (! empty($airDate)) { |
|
829 | + } elseif (!empty($airDate)) { |
|
830 | 830 | $name .= sprintf(' %s', str_replace(['/', '-', '.', '_'], ' ', $airDate)); |
831 | 831 | } |
832 | 832 | } |
833 | - if (! empty($name)) { |
|
833 | + if (!empty($name)) { |
|
834 | 834 | if (config('nntmux.elasticsearch_enabled') === true) { |
835 | 835 | $searchResult = $this->elasticSearch->indexSearchTMA($name, $limit); |
836 | 836 | } else { |
837 | 837 | $searchResult = $this->manticoreSearch->searchIndexes('releases_rt', $name, ['searchname']); |
838 | - if (! empty($searchResult)) { |
|
838 | + if (!empty($searchResult)) { |
|
839 | 839 | $searchResult = Arr::wrap(Arr::get($searchResult, 'id')); |
840 | 840 | } |
841 | 841 | } |
@@ -851,11 +851,11 @@ discard block |
||
851 | 851 | NZB::NZB_ADDED, |
852 | 852 | $this->showPasswords(), |
853 | 853 | $showSql, |
854 | - (! empty($searchResult) ? 'AND r.id IN ('.implode(',', $searchResult).')' : ''), |
|
854 | + (!empty($searchResult) ? 'AND r.id IN ('.implode(',', $searchResult).')' : ''), |
|
855 | 855 | Category::getCategorySearch($cat), |
856 | 856 | ($maxAge > 0 ? sprintf('AND r.postdate > NOW() - INTERVAL %d DAY', $maxAge) : ''), |
857 | 857 | ($minSize > 0 ? sprintf('AND r.size >= %d', $minSize) : ''), |
858 | - ! empty($excludedCategories) ? sprintf('AND r.categories_id NOT IN('.implode(',', $excludedCategories).')') : '' |
|
858 | + !empty($excludedCategories) ? sprintf('AND r.categories_id NOT IN('.implode(',', $excludedCategories).')') : '' |
|
859 | 859 | ); |
860 | 860 | $baseSql = sprintf( |
861 | 861 | "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, |
@@ -905,12 +905,12 @@ discard block |
||
905 | 905 | */ |
906 | 906 | public function animeSearch($aniDbID, int $offset = 0, int $limit = 100, string $name = '', array $cat = [-1], int $maxAge = -1, array $excludedCategories = []): mixed |
907 | 907 | { |
908 | - if (! empty($name)) { |
|
908 | + if (!empty($name)) { |
|
909 | 909 | if (config('nntmux.elasticsearch_enabled') === true) { |
910 | 910 | $searchResult = $this->elasticSearch->indexSearchTMA($name, $limit); |
911 | 911 | } else { |
912 | 912 | $searchResult = $this->manticoreSearch->searchIndexes('releases_rt', $name, ['searchname']); |
913 | - if (! empty($searchResult)) { |
|
913 | + if (!empty($searchResult)) { |
|
914 | 914 | $searchResult = Arr::wrap(Arr::get($searchResult, 'id')); |
915 | 915 | } |
916 | 916 | } |
@@ -927,8 +927,8 @@ discard block |
||
927 | 927 | $this->showPasswords(), |
928 | 928 | NZB::NZB_ADDED, |
929 | 929 | ($aniDbID > -1 ? sprintf(' AND r.anidbid = %d ', $aniDbID) : ''), |
930 | - (! empty($searchResult) ? 'AND r.id IN ('.implode(',', $searchResult).')' : ''), |
|
931 | - ! empty($excludedCategories) ? sprintf('AND r.categories_id NOT IN('.implode(',', $excludedCategories).')') : '', |
|
930 | + (!empty($searchResult) ? 'AND r.id IN ('.implode(',', $searchResult).')' : ''), |
|
931 | + !empty($excludedCategories) ? sprintf('AND r.categories_id NOT IN('.implode(',', $excludedCategories).')') : '', |
|
932 | 932 | Category::getCategorySearch($cat), |
933 | 933 | ($maxAge > 0 ? sprintf(' AND r.postdate > NOW() - INTERVAL %d DAY ', $maxAge) : '') |
934 | 934 | ); |
@@ -975,12 +975,12 @@ discard block |
||
975 | 975 | */ |
976 | 976 | 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 |
977 | 977 | { |
978 | - if (! empty($name)) { |
|
978 | + if (!empty($name)) { |
|
979 | 979 | if (config('nntmux.elasticsearch_enabled') === true) { |
980 | 980 | $searchResult = $this->elasticSearch->indexSearchTMA($name, $limit); |
981 | 981 | } else { |
982 | 982 | $searchResult = $this->manticoreSearch->searchIndexes('releases_rt', $name, ['searchname']); |
983 | - if (! empty($searchResult)) { |
|
983 | + if (!empty($searchResult)) { |
|
984 | 984 | $searchResult = Arr::wrap(Arr::get($searchResult, 'id')); |
985 | 985 | } |
986 | 986 | } |
@@ -997,11 +997,11 @@ discard block |
||
997 | 997 | %s %s %s %s %s %s %s', |
998 | 998 | NZB::NZB_ADDED, |
999 | 999 | $this->showPasswords(), |
1000 | - (! empty($searchResult) ? 'AND r.id IN ('.implode(',', $searchResult).')' : ''), |
|
1000 | + (!empty($searchResult) ? 'AND r.id IN ('.implode(',', $searchResult).')' : ''), |
|
1001 | 1001 | ($imDbId !== -1 && is_numeric($imDbId)) ? sprintf(' AND m.imdbid = \'%s\' ', $imDbId) : '', |
1002 | 1002 | ($tmDbId !== -1 && is_numeric($tmDbId)) ? sprintf(' AND m.tmdbid = %d ', $tmDbId) : '', |
1003 | 1003 | ($traktId !== -1 && is_numeric($traktId)) ? sprintf(' AND m.traktid = %d ', $traktId) : '', |
1004 | - ! empty($excludedCategories) ? sprintf('AND r.categories_id NOT IN('.implode(',', $excludedCategories).')') : '', |
|
1004 | + !empty($excludedCategories) ? sprintf('AND r.categories_id NOT IN('.implode(',', $excludedCategories).')') : '', |
|
1005 | 1005 | Category::getCategorySearch($cat), |
1006 | 1006 | $maxAge > 0 ? sprintf(' AND r.postdate > NOW() - INTERVAL %d DAY ', $maxAge) : '', |
1007 | 1007 | $minSize > 0 ? sprintf('AND r.size >= %d', $minSize) : '' |
@@ -1057,7 +1057,7 @@ discard block |
||
1057 | 1057 | } |
1058 | 1058 | |
1059 | 1059 | $results = $this->search(['searchname' => getSimilarName($name)], -1, '', '', -1, -1, 0, config('nntmux.items_per_page'), '', -1, $excludedCats, 'basic', [$parentCat]); |
1060 | - if (! $results) { |
|
1060 | + if (!$results) { |
|
1061 | 1061 | return $ret; |
1062 | 1062 | } |
1063 | 1063 |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | } |
35 | 35 | |
36 | 36 | $res = User::getByRssToken($request->input('r')); |
37 | - if (! $res) { |
|
37 | + if (!$res) { |
|
38 | 38 | return Utility::showApiError(100); |
39 | 39 | } |
40 | 40 | |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | return Utility::showApiError(501); |
53 | 53 | } |
54 | 54 | |
55 | - if (! $request->input('id')) { |
|
55 | + if (!$request->input('id')) { |
|
56 | 56 | return Utility::showApiError(200, 'Parameter id is required'); |
57 | 57 | } |
58 | 58 | |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | |
87 | 87 | $nzbPath = (new NZB)->getNZBPath($request->input('id')); |
88 | 88 | |
89 | - if (! File::exists($nzbPath)) { |
|
89 | + if (!File::exists($nzbPath)) { |
|
90 | 90 | return Utility::showApiError(300, 'NZB file not found!'); |
91 | 91 | } |
92 | 92 | |
@@ -110,9 +110,9 @@ discard block |
||
110 | 110 | 'X-DNZB-Details' => url('/').'/details/'.$request->input('id'), |
111 | 111 | ]; |
112 | 112 | |
113 | - if (! empty($relData['imdbid']) && $relData['imdbid'] > 0) { |
|
113 | + if (!empty($relData['imdbid']) && $relData['imdbid'] > 0) { |
|
114 | 114 | $headers += ['X-DNZB-MoreInfo' => 'http://www.imdb.com/title/tt'.$relData['imdbid']]; |
115 | - } elseif (! empty($relData['tvdb']) && $relData['tvdb'] > 0) { |
|
115 | + } elseif (!empty($relData['tvdb']) && $relData['tvdb'] > 0) { |
|
116 | 116 | $headers += ['X-DNZB-MoreInfo' => 'http://www.thetvdb.com/?tab=series&id='.$relData['tvdb']]; |
117 | 117 | } |
118 | 118 | |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | |
126 | 126 | $cleanName = str_replace([',', ' ', '/', '\\'], '_', $relData['searchname']); |
127 | 127 | |
128 | - return response()->streamDownload(function () use ($nzbPath) { |
|
128 | + return response()->streamDownload(function() use ($nzbPath) { |
|
129 | 129 | echo $nzbPath; |
130 | 130 | }, $cleanName.'.nzb', $headers); |
131 | 131 | } |
@@ -83,18 +83,18 @@ discard block |
||
83 | 83 | Route::post('login', [LoginController::class, 'login'])->name('login.post'); |
84 | 84 | Route::match(['GET', 'POST'], 'logout', [LoginController::class, 'logout'])->name('logout'); |
85 | 85 | |
86 | -Route::middleware('isVerified')->group(function () { |
|
86 | +Route::middleware('isVerified')->group(function() { |
|
87 | 87 | Route::match(['GET', 'POST'], 'resetpassword', [ResetPasswordController::class, 'reset'])->name('resetpassword'); |
88 | 88 | Route::match(['GET', 'POST'], 'profile', [ProfileController::class, 'show'])->name('profile'); |
89 | 89 | |
90 | - Route::prefix('browse')->group(function () { |
|
90 | + Route::prefix('browse')->group(function() { |
|
91 | 91 | Route::match(['GET', 'POST'], 'tags', [BrowseController::class, 'tags'])->name('tags'); |
92 | 92 | Route::match(['GET', 'POST'], 'group', [BrowseController::class, 'group'])->name('group'); |
93 | 93 | Route::match(['GET', 'POST'], 'All', [BrowseController::class, 'index'])->name('All'); |
94 | 94 | Route::match(['GET', 'POST'], '{parentCategory}/{id?}', [BrowseController::class, 'show'])->middleware('clearance')->name('browse'); |
95 | 95 | }); |
96 | 96 | |
97 | - Route::prefix('cart')->group(function () { |
|
97 | + Route::prefix('cart')->group(function() { |
|
98 | 98 | Route::match(['GET', 'POST'], 'index', [CartController::class, 'index'])->name('cart.index'); |
99 | 99 | Route::match(['GET', 'POST'], 'add', [CartController::class, 'store'])->name('cart.add'); |
100 | 100 | Route::match(['GET', 'POST'], 'delete/{id}', [CartController::class, 'destroy'])->name('cart.delete'); |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | Route::match(['GET', 'POST'], 'content', [ContentController::class, 'show'])->name('content'); |
111 | 111 | Route::match(['GET', 'POST'], 'failed', [FailedReleasesController::class, 'failed'])->name('failed'); |
112 | 112 | |
113 | - Route::middleware('clearance')->group(function () { |
|
113 | + Route::middleware('clearance')->group(function() { |
|
114 | 114 | Route::match(['GET', 'POST'], 'Games', [GamesController::class, 'show'])->name('Games'); |
115 | 115 | Route::match(['GET', 'POST'], 'Movies/{id?}', [MovieController::class, 'showMovies'])->name('Movies'); |
116 | 116 | Route::match(['GET', 'POST'], 'movie', [MovieController::class, 'showMovies'])->name('movie'); |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | Route::post('disable2fa', [PasswordSecurityController::class, 'disable2fa'])->name('disable2fa'); |
143 | 143 | }); |
144 | 144 | |
145 | -Route::middleware('role:Admin', '2fa')->prefix('admin')->group(function () { |
|
145 | +Route::middleware('role:Admin', '2fa')->prefix('admin')->group(function() { |
|
146 | 146 | Route::match(['GET', 'POST'], 'index', [AdminPageController::class, 'index'])->name('admin.index'); |
147 | 147 | Route::match(['GET', 'POST'], 'anidb-delete/{id}', [AdminAnidbController::class, 'destroy'])->name('admin.anidb-delete'); |
148 | 148 | Route::match(['GET', 'POST'], 'anidb-edit/{id}', [AdminAnidbController::class, 'edit'])->name('admin.anidb-edit'); |
@@ -205,11 +205,11 @@ discard block |
||
205 | 205 | |
206 | 206 | }); |
207 | 207 | |
208 | -Route::middleware('role_or_permission:Admin|Moderator|edit release')->prefix('admin')->group(function () { |
|
208 | +Route::middleware('role_or_permission:Admin|Moderator|edit release')->prefix('admin')->group(function() { |
|
209 | 209 | Route::match(['GET', 'POST'], 'release-edit', [AdminReleasesController::class, 'edit'])->name('admin.release-edit'); |
210 | 210 | }); |
211 | 211 | |
212 | -Route::post('2faVerify', function () { |
|
212 | +Route::post('2faVerify', function() { |
|
213 | 213 | return redirect()->to(URL()->previous()); |
214 | 214 | })->name('2faVerify')->middleware('2fa'); |
215 | 215 |