@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | $identifiers['i'] = $release?->id; |
| 191 | 191 | } |
| 192 | 192 | |
| 193 | - if (! empty($identifiers['i'])) { |
|
| 193 | + if (!empty($identifiers['i'])) { |
|
| 194 | 194 | $this->manticoreSearch->table($this->config['indexes']['releases']) |
| 195 | 195 | ->deleteDocument($identifiers['i']); |
| 196 | 196 | } else { |
@@ -285,7 +285,7 @@ discard block |
||
| 285 | 285 | |
| 286 | 286 | $success = true; |
| 287 | 287 | foreach ($indexes as $index) { |
| 288 | - if (! \in_array($index, $this->config['indexes'], true)) { |
|
| 288 | + if (!\in_array($index, $this->config['indexes'], true)) { |
|
| 289 | 289 | $this->cli->error('Unsupported index: '.$index); |
| 290 | 290 | $success = false; |
| 291 | 291 | |
@@ -376,7 +376,7 @@ discard block |
||
| 376 | 376 | |
| 377 | 377 | $result = $this->searchIndexes($this->getReleasesIndex(), '', [], $searchArray); |
| 378 | 378 | |
| 379 | - return ! empty($result) ? ($result['id'] ?? []) : []; |
|
| 379 | + return !empty($result) ? ($result['id'] ?? []) : []; |
|
| 380 | 380 | } |
| 381 | 381 | |
| 382 | 382 | /** |
@@ -432,17 +432,17 @@ discard block |
||
| 432 | 432 | |
| 433 | 433 | // Build query string once so we can retry if needed |
| 434 | 434 | $searchExpr = null; |
| 435 | - if (! empty($searchArray)) { |
|
| 435 | + if (!empty($searchArray)) { |
|
| 436 | 436 | $terms = []; |
| 437 | 437 | foreach ($searchArray as $key => $value) { |
| 438 | - if (! empty($value)) { |
|
| 438 | + if (!empty($value)) { |
|
| 439 | 439 | $escapedValue = self::escapeString($value); |
| 440 | - if (! empty($escapedValue)) { |
|
| 440 | + if (!empty($escapedValue)) { |
|
| 441 | 441 | $terms[] = '@@relaxed @'.$key.' '.$escapedValue; |
| 442 | 442 | } |
| 443 | 443 | } |
| 444 | 444 | } |
| 445 | - if (! empty($terms)) { |
|
| 445 | + if (!empty($terms)) { |
|
| 446 | 446 | $searchExpr = implode(' ', $terms); |
| 447 | 447 | } else { |
| 448 | 448 | if (config('app.debug')) { |
@@ -450,7 +450,7 @@ discard block |
||
| 450 | 450 | } |
| 451 | 451 | return []; |
| 452 | 452 | } |
| 453 | - } elseif (! empty($searchString)) { |
|
| 453 | + } elseif (!empty($searchString)) { |
|
| 454 | 454 | $escapedSearch = self::escapeString($searchString); |
| 455 | 455 | if (empty($escapedSearch)) { |
| 456 | 456 | if (config('app.debug')) { |
@@ -460,7 +460,7 @@ discard block |
||
| 460 | 460 | } |
| 461 | 461 | |
| 462 | 462 | $searchColumns = ''; |
| 463 | - if (! empty($column)) { |
|
| 463 | + if (!empty($column)) { |
|
| 464 | 464 | if (count($column) > 1) { |
| 465 | 465 | $searchColumns = '@('.implode(',', $column).')'; |
| 466 | 466 | } else { |
@@ -486,7 +486,7 @@ discard block |
||
| 486 | 486 | ->stripBadUtf8(true) |
| 487 | 487 | ->search($searchExpr); |
| 488 | 488 | |
| 489 | - if (! $avoidSortForIndex) { |
|
| 489 | + if (!$avoidSortForIndex) { |
|
| 490 | 490 | $query->sort('id', 'desc'); |
| 491 | 491 | } |
| 492 | 492 | |
@@ -576,7 +576,7 @@ discard block |
||
| 576 | 576 | 'cache_minutes' => 10, |
| 577 | 577 | ]; |
| 578 | 578 | |
| 579 | - if (! ($autocompleteConfig['enabled'] ?? true)) { |
|
| 579 | + if (!($autocompleteConfig['enabled'] ?? true)) { |
|
| 580 | 580 | return []; |
| 581 | 581 | } |
| 582 | 582 | |
@@ -628,7 +628,7 @@ discard block |
||
| 628 | 628 | // Create a clean suggestion from the searchname |
| 629 | 629 | $suggestion = $this->extractSuggestion($searchname, $query); |
| 630 | 630 | |
| 631 | - if (! empty($suggestion) && ! isset($seen[strtolower($suggestion)])) { |
|
| 631 | + if (!empty($suggestion) && !isset($seen[strtolower($suggestion)])) { |
|
| 632 | 632 | $seen[strtolower($suggestion)] = true; |
| 633 | 633 | $suggestions[] = [ |
| 634 | 634 | 'suggest' => $suggestion, |
@@ -647,7 +647,7 @@ discard block |
||
| 647 | 647 | } |
| 648 | 648 | } |
| 649 | 649 | |
| 650 | - if (! empty($suggestions)) { |
|
| 650 | + if (!empty($suggestions)) { |
|
| 651 | 651 | $cacheMinutes = (int) ($autocompleteConfig['cache_minutes'] ?? 10); |
| 652 | 652 | Cache::put($cacheKey, $suggestions, now()->addMinutes($cacheMinutes)); |
| 653 | 653 | } |
@@ -718,7 +718,7 @@ discard block |
||
| 718 | 718 | 'max_edits' => 4, |
| 719 | 719 | ]; |
| 720 | 720 | |
| 721 | - if (! ($suggestConfig['enabled'] ?? true)) { |
|
| 721 | + if (!($suggestConfig['enabled'] ?? true)) { |
|
| 722 | 722 | return []; |
| 723 | 723 | } |
| 724 | 724 | |
@@ -750,7 +750,7 @@ discard block |
||
| 750 | 750 | ], |
| 751 | 751 | ]); |
| 752 | 752 | |
| 753 | - if (! empty($result) && is_array($result)) { |
|
| 753 | + if (!empty($result) && is_array($result)) { |
|
| 754 | 754 | foreach ($result as $item) { |
| 755 | 755 | if (isset($item['suggest']) && $item['suggest'] !== $query) { |
| 756 | 756 | $suggestions[] = [ |
@@ -772,7 +772,7 @@ discard block |
||
| 772 | 772 | $suggestions = $this->suggestFallback($query, $index); |
| 773 | 773 | } |
| 774 | 774 | |
| 775 | - if (! empty($suggestions)) { |
|
| 775 | + if (!empty($suggestions)) { |
|
| 776 | 776 | Cache::put($cacheKey, $suggestions, now()->addMinutes(5)); |
| 777 | 777 | } |
| 778 | 778 | |
@@ -818,7 +818,7 @@ discard block |
||
| 818 | 818 | // Check if word is similar to query (within edit distance) |
| 819 | 819 | $distance = levenshtein(strtolower($query), $word); |
| 820 | 820 | if ($distance > 0 && $distance <= 3) { |
| 821 | - if (! isset($termCounts[$word])) { |
|
| 821 | + if (!isset($termCounts[$word])) { |
|
| 822 | 822 | $termCounts[$word] = ['count' => 0, 'distance' => $distance]; |
| 823 | 823 | } |
| 824 | 824 | $termCounts[$word]['count']++; |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | { |
| 52 | 52 | // Delete NZB from disk. |
| 53 | 53 | $nzbPath = $nzb->NZBPath($identifiers['g']); |
| 54 | - if (! empty($nzbPath)) { |
|
| 54 | + if (!empty($nzbPath)) { |
|
| 55 | 55 | File::delete($nzbPath); |
| 56 | 56 | } |
| 57 | 57 | |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | */ |
| 100 | 100 | public function updateMulti($guids, $category, $grabs, $videoId, $episodeId, $anidbId, $imdbId) |
| 101 | 101 | { |
| 102 | - if (! \is_array($guids) || \count($guids) < 1) { |
|
| 102 | + if (!\is_array($guids) || \count($guids) < 1) { |
|
| 103 | 103 | return false; |
| 104 | 104 | } |
| 105 | 105 | |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | GROUP BY r.id |
| 189 | 189 | ORDER BY %s %s %s", |
| 190 | 190 | $this->uSQL($userShows, 'videos_id'), |
| 191 | - (! empty($excludedCats) ? ' AND r.categories_id NOT IN ('.implode(',', $excludedCats).')' : ''), |
|
| 191 | + (!empty($excludedCats) ? ' AND r.categories_id NOT IN ('.implode(',', $excludedCats).')' : ''), |
|
| 192 | 192 | Category::TV_ROOT, |
| 193 | 193 | Category::TV_OTHER, |
| 194 | 194 | $this->showPasswords(), |
@@ -236,7 +236,7 @@ discard block |
||
| 236 | 236 | $sql = '(1=2 '; |
| 237 | 237 | foreach ($userQuery as $query) { |
| 238 | 238 | $sql .= sprintf('OR (r.%s = %d', $type, $query->$type); |
| 239 | - if (! empty($query->categories)) { |
|
| 239 | + if (!empty($query->categories)) { |
|
| 240 | 240 | $catsArr = explode('|', $query->categories); |
| 241 | 241 | if (\count($catsArr) > 1) { |
| 242 | 242 | $sql .= sprintf(' AND r.categories_id IN (%s)', implode(',', $catsArr)); |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | |
| 77 | 77 | $orderByUrls = []; |
| 78 | 78 | foreach ($this->releaseBrowseService->getBrowseOrdering() as $orderType) { |
| 79 | - $orderByUrls['orderby'.$orderType] = url('/search?search='.htmlentities($searchString['searchname'], ENT_QUOTES | ENT_HTML5).'&t='.implode(',', $categoryID).'&ob='.$orderType); |
|
| 79 | + $orderByUrls['orderby'.$orderType] = url('/search?search='.htmlentities($searchString['searchname'], ENT_QUOTES|ENT_HTML5).'&t='.implode(',', $categoryID).'&ob='.$orderType); |
|
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | $rslt = $this->releaseSearchService->search( |
@@ -152,10 +152,10 @@ discard block |
||
| 152 | 152 | // Get spell correction suggestions if we have a search query but few/no results |
| 153 | 153 | $spellSuggestion = null; |
| 154 | 154 | $searchQuery = $search ?: ($searchVars['searchadvr'] ?? ''); |
| 155 | - if (! empty($searchQuery) && $this->searchService->isSuggestEnabled()) { |
|
| 155 | + if (!empty($searchQuery) && $this->searchService->isSuggestEnabled()) { |
|
| 156 | 156 | // Get suggestions from search service |
| 157 | 157 | $suggestions = $this->searchService->suggest($searchQuery); |
| 158 | - if (! empty($suggestions)) { |
|
| 158 | + if (!empty($suggestions)) { |
|
| 159 | 159 | // Sort by doc count descending to get best suggestion |
| 160 | 160 | usort($suggestions, fn ($a, $b) => $b['docs'] - $a['docs']); |
| 161 | 161 | // Only show suggestion if it's different from the query |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | if ($searchType !== 'basic' && $request->missing('id') && $request->missing('subject') && $request->anyFilled(['searchadvr', 'searchadvsubject', 'searchadvfilename', 'searchadvposter', 'minage', 'maxage', 'group', 'minsize', 'maxsize', 'search'])) { |
| 169 | 169 | $orderByString = ''; |
| 170 | 170 | foreach ($searchVars as $searchVarKey => $searchVar) { |
| 171 | - $orderByString .= "&$searchVarKey=".htmlentities($searchVar, ENT_QUOTES | ENT_HTML5); |
|
| 171 | + $orderByString .= "&$searchVarKey=".htmlentities($searchVar, ENT_QUOTES|ENT_HTML5); |
|
| 172 | 172 | } |
| 173 | 173 | $orderByString = ltrim($orderByString, '&'); |
| 174 | 174 | |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | public function index(Request $request) |
| 24 | 24 | { |
| 25 | 25 | $ordering = $this->releaseBrowseService->getBrowseOrdering(); |
| 26 | - $orderBy = $request->has('ob') && ! empty($request->input('ob')) ? $request->input('ob') : ''; |
|
| 26 | + $orderBy = $request->has('ob') && !empty($request->input('ob')) ? $request->input('ob') : ''; |
|
| 27 | 27 | $page = $request->has('page') && is_numeric($request->input('page')) ? $request->input('page') : 1; |
| 28 | 28 | $offset = ($page - 1) * config('nntmux.items_per_page'); |
| 29 | 29 | |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | $catarray[] = $category; |
| 72 | 72 | |
| 73 | 73 | $ordering = $this->releaseBrowseService->getBrowseOrdering(); |
| 74 | - $orderBy = $request->has('ob') && ! empty($request->input('ob')) ? $request->input('ob') : ''; |
|
| 74 | + $orderBy = $request->has('ob') && !empty($request->input('ob')) ? $request->input('ob') : ''; |
|
| 75 | 75 | $page = $request->has('page') && is_numeric($request->input('page')) ? $request->input('page') : 1; |
| 76 | 76 | $offset = ($page - 1) * config('nntmux.items_per_page'); |
| 77 | 77 | |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | |
| 134 | 134 | |
| 135 | 135 | // Set Query Parameters based on Request objects |
| 136 | - $outputXML = ! ($request->has('o') && $request->input('o') === 'json'); |
|
| 136 | + $outputXML = !($request->has('o') && $request->input('o') === 'json'); |
|
| 137 | 137 | $minSize = $request->has('minsize') && $request->input('minsize') > 0 ? $request->input('minsize') : 0; |
| 138 | 138 | $offset = $this->offset($request); |
| 139 | 139 | |
@@ -274,7 +274,7 @@ discard block |
||
| 274 | 274 | |
| 275 | 275 | $this->addCoverURL( |
| 276 | 276 | $relData, |
| 277 | - function ($release) { |
|
| 277 | + function($release) { |
|
| 278 | 278 | return getCoverURL(['type' => 'movies', 'id' => $release->imdbid]); |
| 279 | 279 | } |
| 280 | 280 | ); |
@@ -316,9 +316,9 @@ discard block |
||
| 316 | 316 | |
| 317 | 317 | if ($rel && $rel->isNotEmpty()) { |
| 318 | 318 | $data = ReleaseNfo::getReleaseNfo($rel->id); |
| 319 | - if (! empty($data)) { |
|
| 319 | + if (!empty($data)) { |
|
| 320 | 320 | if ($request->has('o') && $request->input('o') === 'file') { |
| 321 | - return response()->streamDownload(function () use ($data) { |
|
| 321 | + return response()->streamDownload(function() use ($data) { |
|
| 322 | 322 | echo $data['nfo']; |
| 323 | 323 | }, $rel['searchname'].'.nfo', ['Content-type:' => 'application/octet-stream']); |
| 324 | 324 | } |
@@ -336,7 +336,7 @@ discard block |
||
| 336 | 336 | // curl -X POST -F "file=@./The.File.nzb" "https://www.tabula-rasa.pw/api/V1/api?t=nzbadd&apikey=xxx" |
| 337 | 337 | // |
| 338 | 338 | case 'nzbAdd': |
| 339 | - if (! User::canPost($uid)) { |
|
| 339 | + if (!User::canPost($uid)) { |
|
| 340 | 340 | return response('User does not have permission to post', 403); |
| 341 | 341 | } |
| 342 | 342 | |
@@ -347,7 +347,7 @@ discard block |
||
| 347 | 347 | return response('Missing parameter (apikey is required for adding an NZB)', 400); |
| 348 | 348 | } |
| 349 | 349 | |
| 350 | - if (! $request->hasFile('file')) { |
|
| 350 | + if (!$request->hasFile('file')) { |
|
| 351 | 351 | return response('Missing parameter (file is required for adding an NZB)', 400); |
| 352 | 352 | } |
| 353 | 353 | |
@@ -362,10 +362,10 @@ discard block |
||
| 362 | 362 | return response('File is not an NZB file', 400); |
| 363 | 363 | } |
| 364 | 364 | // Check if the file is proper xml nzb file. |
| 365 | - if (! isValidNewznabNzb($nzbFile->getContent())) { |
|
| 365 | + if (!isValidNewznabNzb($nzbFile->getContent())) { |
|
| 366 | 366 | return response('File is not a valid Newznab NZB file', 400); |
| 367 | 367 | } |
| 368 | - if (! File::isDirectory(config('nntmux.nzb_upload_folder'))) { |
|
| 368 | + if (!File::isDirectory(config('nntmux.nzb_upload_folder'))) { |
|
| 369 | 369 | @File::makeDirectory(config('nntmux.nzb_upload_folder'), 0775, true); |
| 370 | 370 | } |
| 371 | 371 | |
@@ -412,7 +412,7 @@ discard block |
||
| 412 | 412 | header('Content-type: text/xml'); |
| 413 | 413 | } else { |
| 414 | 414 | // JSON encode the XMLWriter response |
| 415 | - $response = json_encode(xml_to_array($response), JSON_THROW_ON_ERROR | JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES); |
|
| 415 | + $response = json_encode(xml_to_array($response), JSON_THROW_ON_ERROR|JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES); |
|
| 416 | 416 | header('Content-type: application/json'); |
| 417 | 417 | } |
| 418 | 418 | if ($response === false) { |
@@ -455,7 +455,7 @@ discard block |
||
| 455 | 455 | 'search' => ['available' => 'yes', 'supportedParams' => 'q'], |
| 456 | 456 | 'tv-search' => ['available' => 'yes', 'supportedParams' => 'q,vid,tvdbid,traktid,rid,tvmazeid,imdbid,tmdbid,season,ep'], |
| 457 | 457 | 'movie-search' => ['available' => 'yes', 'supportedParams' => 'q,imdbid, tmdbid, traktid'], |
| 458 | - 'audio-search' => ['available' => 'no', 'supportedParams' => ''], |
|
| 458 | + 'audio-search' => ['available' => 'no', 'supportedParams' => ''], |
|
| 459 | 459 | ], |
| 460 | 460 | 'categories' => $this->type === 'caps' |
| 461 | 461 | ? Category::getForMenu() |
@@ -470,9 +470,9 @@ discard block |
||
| 470 | 470 | { |
| 471 | 471 | $maxAge = -1; |
| 472 | 472 | if ($request->has('maxage')) { |
| 473 | - if (! $request->filled('maxage')) { |
|
| 473 | + if (!$request->filled('maxage')) { |
|
| 474 | 474 | return showApiError(201, 'Incorrect parameter (maxage must not be empty)'); |
| 475 | - } elseif (! is_numeric($request->input('maxage'))) { |
|
| 475 | + } elseif (!is_numeric($request->input('maxage'))) { |
|
| 476 | 476 | return showApiError(201, 'Incorrect parameter (maxage must be numeric)'); |
| 477 | 477 | } else { |
| 478 | 478 | $maxAge = (int) $request->input('maxage'); |
@@ -491,7 +491,7 @@ discard block |
||
| 491 | 491 | if ($request->has('cat')) { |
| 492 | 492 | $categoryIDs = urldecode($request->input('cat')); |
| 493 | 493 | // Append Web-DL category ID if HD present for SickBeard / Sonarr compatibility. |
| 494 | - if (str_contains($categoryIDs, (string) Category::TV_HD) && ! str_contains($categoryIDs, (string) Category::TV_WEBDL) && (int) Settings::settingValue('catwebdl') === 0) { |
|
| 494 | + if (str_contains($categoryIDs, (string) Category::TV_HD) && !str_contains($categoryIDs, (string) Category::TV_WEBDL) && (int) Settings::settingValue('catwebdl') === 0) { |
|
| 495 | 495 | $categoryIDs .= (','.Category::TV_WEBDL); |
| 496 | 496 | } |
| 497 | 497 | $categoryID = explode(',', $categoryIDs); |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | public function handle(): void |
| 37 | 37 | { |
| 38 | 38 | // Check if any options are false |
| 39 | - if (! $this->option('notindb') && ! $this->option('notondisk')) { |
|
| 39 | + if (!$this->option('notindb') && !$this->option('notondisk')) { |
|
| 40 | 40 | $this->error('You must specify at least one option. See: --help'); |
| 41 | 41 | exit(); |
| 42 | 42 | } |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | $guid = stristr($filePath->getFilename(), '.nzb.gz', true); |
| 63 | 63 | if (File::isFile($filePath) && $guid) { |
| 64 | 64 | // If NZB file guid is not present in DB delete the file from disk |
| 65 | - if (! $releases->whereGuid($guid)->exists()) { |
|
| 65 | + if (!$releases->whereGuid($guid)->exists()) { |
|
| 66 | 66 | if ($delete) { |
| 67 | 67 | File::delete($filePath); |
| 68 | 68 | } |
@@ -87,11 +87,11 @@ discard block |
||
| 87 | 87 | $total = Release::count(); |
| 88 | 88 | $this->alert("Total releases to check: $total"); |
| 89 | 89 | |
| 90 | - Release::where('nzbstatus', 1)->chunkById((int) $this->option('chunksize'), function (Collection $releases) use ($delete, &$checked, &$deleted, $nzb, $releaseManagement) { |
|
| 90 | + Release::where('nzbstatus', 1)->chunkById((int) $this->option('chunksize'), function(Collection $releases) use ($delete, &$checked, &$deleted, $nzb, $releaseManagement) { |
|
| 91 | 91 | echo 'Total done: '.$checked."\r"; |
| 92 | 92 | foreach ($releases as $r) { |
| 93 | 93 | |
| 94 | - if (! $nzb->NZBPath($r->guid)) { |
|
| 94 | + if (!$nzb->NZBPath($r->guid)) { |
|
| 95 | 95 | if ($delete) { |
| 96 | 96 | $releaseManagement->deleteSingle(['g' => $r->guid, 'i' => $r->id], $nzb, new ReleaseImage); |
| 97 | 97 | } |