@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | $this->colorCLI->header('Removing '.($type === '' ? 'All crap releases ' : $type.' crap releases').' - no time limit.', true); |
155 | 155 | } |
156 | 156 | } else { |
157 | - if (! is_numeric($time)) { |
|
157 | + if (!is_numeric($time)) { |
|
158 | 158 | $this->error = 'Error, time must be a number or full.'; |
159 | 159 | |
160 | 160 | return $this->returnError(); |
@@ -630,7 +630,7 @@ discard block |
||
630 | 630 | { |
631 | 631 | $status = sprintf('AND status = %d', Binaries::BLACKLIST_ENABLED); |
632 | 632 | |
633 | - if (! empty($this->blacklistID) && $this->delete === false) { |
|
633 | + if (!empty($this->blacklistID) && $this->delete === false) { |
|
634 | 634 | $status = ''; |
635 | 635 | } |
636 | 636 | |
@@ -727,7 +727,7 @@ discard block |
||
727 | 727 | $searchResult = (new ElasticSearchSiteSearch())->indexSearch($regexMatch, 100); |
728 | 728 | } else { |
729 | 729 | $searchResult = (new ManticoreSearch())->searchIndexes('releases_rt', $regexMatch, ['name,searchname']); |
730 | - if (! empty($searchResult)) { |
|
730 | + if (!empty($searchResult)) { |
|
731 | 731 | $searchResult = Arr::wrap(Arr::get($searchResult, 'id')); |
732 | 732 | } |
733 | 733 | } |
@@ -741,7 +741,7 @@ discard block |
||
741 | 741 | SELECT r.guid, r.searchname, r.id |
742 | 742 | FROM releases r %s %s %s %s', |
743 | 743 | $regexSQL, |
744 | - ! empty($searchResult) ? ' WHERE r.id IN ('.implode(',', $searchResult).')' : '', |
|
744 | + !empty($searchResult) ? ' WHERE r.id IN ('.implode(',', $searchResult).')' : '', |
|
745 | 745 | $groupID, |
746 | 746 | $this->crapTime, |
747 | 747 | ); |
@@ -1107,7 +1107,7 @@ discard block |
||
1107 | 1107 | } |
1108 | 1108 | break; |
1109 | 1109 | case 'size': |
1110 | - if (! is_numeric($args[2])) { |
|
1110 | + if (!is_numeric($args[2])) { |
|
1111 | 1111 | break; |
1112 | 1112 | } |
1113 | 1113 | switch ($args[1]) { |
@@ -1122,7 +1122,7 @@ discard block |
||
1122 | 1122 | } |
1123 | 1123 | break; |
1124 | 1124 | case 'adddate': |
1125 | - if (! is_numeric($args[2])) { |
|
1125 | + if (!is_numeric($args[2])) { |
|
1126 | 1126 | break; |
1127 | 1127 | } |
1128 | 1128 | switch ($args[1]) { |
@@ -1135,7 +1135,7 @@ discard block |
||
1135 | 1135 | } |
1136 | 1136 | break; |
1137 | 1137 | case 'postdate': |
1138 | - if (! is_numeric($args[2])) { |
|
1138 | + if (!is_numeric($args[2])) { |
|
1139 | 1139 | break; |
1140 | 1140 | } |
1141 | 1141 | switch ($args[1]) { |
@@ -1148,7 +1148,7 @@ discard block |
||
1148 | 1148 | } |
1149 | 1149 | break; |
1150 | 1150 | case 'completion': |
1151 | - if (! is_numeric($args[2])) { |
|
1151 | + if (!is_numeric($args[2])) { |
|
1152 | 1152 | break; |
1153 | 1153 | } |
1154 | 1154 | if ($args[1] === 'smaller') { |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | $themes = scandir(base_path().'/resources/views/themes', SCANDIR_SORT_ASCENDING); |
20 | 20 | $themeList[] = 'None'; |
21 | 21 | foreach ($themes as $theme) { |
22 | - if (! str_contains($theme, '.') && ! \in_array($theme, $ignoredThemes, false) && File::isDirectory(base_path().'/resources/views/themes/'.$theme)) { |
|
22 | + if (!str_contains($theme, '.') && !\in_array($theme, $ignoredThemes, false) && File::isDirectory(base_path().'/resources/views/themes/'.$theme)) { |
|
23 | 23 | $themeList[] = $theme; |
24 | 24 | } |
25 | 25 | } |
@@ -39,12 +39,12 @@ discard block |
||
39 | 39 | $string = ''; |
40 | 40 | $gzFile = @gzopen($filePath, 'rb', 0); |
41 | 41 | if ($gzFile) { |
42 | - while (! gzeof($gzFile)) { |
|
42 | + while (!gzeof($gzFile)) { |
|
43 | 43 | $temp = gzread($gzFile, 1024); |
44 | 44 | // Check for empty string. |
45 | 45 | // Without this the loop would be endless and consume 100% CPU. |
46 | 46 | // Do not set $string empty here, as the data might still be good. |
47 | - if (! $temp) { |
|
47 | + if (!$temp) { |
|
48 | 48 | break; |
49 | 49 | } |
50 | 50 | $string .= $temp; |
@@ -102,15 +102,14 @@ discard block |
||
102 | 102 | $fileSpecTemplate = '%s/%s%s'; |
103 | 103 | $fileSpec = ''; |
104 | 104 | |
105 | - if (! empty($options['id']) && \in_array( |
|
105 | + if (!empty($options['id']) && \in_array( |
|
106 | 106 | $options['type'], |
107 | 107 | ['anime', 'audio', 'audiosample', 'book', 'console', 'games', 'movies', 'music', 'preview', 'sample', 'tvrage', 'video', 'xxx'], |
108 | 108 | false |
109 | 109 | ) |
110 | 110 | ) { |
111 | 111 | $fileSpec = sprintf($fileSpecTemplate, $options['type'], $options['id'], $options['suffix']); |
112 | - $fileSpec = file_exists(storage_path('covers/').$fileSpec) ? $fileSpec : |
|
113 | - sprintf($fileSpecTemplate, $options['type'], 'no', $options['suffix']); |
|
112 | + $fileSpec = file_exists(storage_path('covers/').$fileSpec) ? $fileSpec : sprintf($fileSpecTemplate, $options['type'], 'no', $options['suffix']); |
|
114 | 113 | } |
115 | 114 | |
116 | 115 | return $fileSpec; |
@@ -378,7 +378,7 @@ discard block |
||
378 | 378 | |
379 | 379 | $done = false; |
380 | 380 | // Get all the parts (in portions of $this->messageBuffer to not use too much memory). |
381 | - while (! $done) { |
|
381 | + while (!$done) { |
|
382 | 382 | // Increment last until we reach $groupLast (group newest article). |
383 | 383 | if ($total > $this->messageBuffer) { |
384 | 384 | if ((string) ($first + $this->messageBuffer) > $groupLast) { |
@@ -402,7 +402,7 @@ discard block |
||
402 | 402 | $scanSummary = $this->scan($groupMySQL, $first, $last); |
403 | 403 | |
404 | 404 | // Check if we fetched headers. |
405 | - if (! empty($scanSummary)) { |
|
405 | + if (!empty($scanSummary)) { |
|
406 | 406 | // If new group, update first record & postdate |
407 | 407 | if ($groupMySQL['first_record_postdate'] === null && (int) $groupMySQL['first_record'] === 0) { |
408 | 408 | $groupMySQL['first_record'] = $scanSummary['firstArticleNumber']; |
@@ -426,7 +426,7 @@ discard block |
||
426 | 426 | } |
427 | 427 | |
428 | 428 | $scanSummary['lastArticleDate'] = (isset($scanSummary['lastArticleDate']) ? strtotime($scanSummary['lastArticleDate']) : false); |
429 | - if (! is_numeric($scanSummary['lastArticleDate'])) { |
|
429 | + if (!is_numeric($scanSummary['lastArticleDate'])) { |
|
430 | 430 | $scanSummary['lastArticleDate'] = $this->postdate($scanSummary['lastArticleNumber'], $groupNNTP); |
431 | 431 | } |
432 | 432 | |
@@ -575,7 +575,7 @@ discard block |
||
575 | 575 | |
576 | 576 | // If set we are running in partRepair mode. |
577 | 577 | if ($partRepair && $missingParts !== null) { |
578 | - if (! \in_array($header['Number'], $missingParts, false)) { |
|
578 | + if (!\in_array($header['Number'], $missingParts, false)) { |
|
579 | 579 | // If article isn't one that is missing skip it. |
580 | 580 | continue; |
581 | 581 | } |
@@ -620,15 +620,15 @@ discard block |
||
620 | 620 | |
621 | 621 | unset($headers); // Reclaim memory now that headers are split. |
622 | 622 | |
623 | - if (! empty($this->_binaryBlacklistIdsToUpdate)) { |
|
623 | + if (!empty($this->_binaryBlacklistIdsToUpdate)) { |
|
624 | 624 | $this->updateBlacklistUsage(); |
625 | 625 | } |
626 | 626 | |
627 | - if ($this->_echoCLI && ! $partRepair) { |
|
627 | + if ($this->_echoCLI && !$partRepair) { |
|
628 | 628 | $this->outputHeaderInitial(); |
629 | 629 | } |
630 | 630 | |
631 | - if (! empty($stdHeaders)) { |
|
631 | + if (!empty($stdHeaders)) { |
|
632 | 632 | $this->storeHeaders($stdHeaders); |
633 | 633 | } |
634 | 634 | unset($stdHeaders); |
@@ -703,9 +703,9 @@ discard block |
||
703 | 703 | // Loop articles, figure out files/parts. |
704 | 704 | foreach ($headers as $this->header) { |
705 | 705 | // Set up the info for inserting into parts/binaries/collections tables. |
706 | - if (! isset($articles[$this->header['matches'][1]])) { |
|
706 | + if (!isset($articles[$this->header['matches'][1]])) { |
|
707 | 707 | // Attempt to find the file count. If it is not found, set it to 0. |
708 | - if (! preg_match('/[[(\s](\d{1,5})(\/|[\s_]of[\s_]|-)(\d{1,5})[])\s$:]/i', $this->header['matches'][1], $fileCount)) { |
|
708 | + if (!preg_match('/[[(\s](\d{1,5})(\/|[\s_]of[\s_]|-)(\d{1,5})[])\s$:]/i', $this->header['matches'][1], $fileCount)) { |
|
709 | 709 | $fileCount[1] = $fileCount[3] = 0; |
710 | 710 | } |
711 | 711 | |
@@ -717,7 +717,7 @@ discard block |
||
717 | 717 | $this->header['CollectionKey'] = $collMatch['name'].$fileCount[3]; |
718 | 718 | |
719 | 719 | // If this header's collection key isn't in memory, attempt to insert the collection |
720 | - if (! isset($collectionIDs[$this->header['CollectionKey']])) { |
|
720 | + if (!isset($collectionIDs[$this->header['CollectionKey']])) { |
|
721 | 721 | /* Date from header should be a string this format: |
722 | 722 | * 31 Mar 2014 15:36:04 GMT or 6 Oct 1998 04:38:40 -0500 |
723 | 723 | * Still make sure it's not unix time, convert it to unix time if it is. |
@@ -748,7 +748,7 @@ discard block |
||
748 | 748 | |
749 | 749 | $finalXrefArray = []; |
750 | 750 | foreach ($tempHeaderXrefs as $tempHeaderXref) { |
751 | - if (! in_array($tempHeaderXref, $tempXrefsData, false)) { |
|
751 | + if (!in_array($tempHeaderXref, $tempXrefsData, false)) { |
|
752 | 752 | $finalXrefArray[] = $tempHeaderXref; |
753 | 753 | } |
754 | 754 | } |
@@ -885,12 +885,12 @@ discard block |
||
885 | 885 | $iterator1 = 0; |
886 | 886 | $iterator2 = $msgCount - 1; |
887 | 887 | while (true) { |
888 | - if (! isset($returnArray['firstArticleNumber']) && isset($headers[$iterator1]['Number'])) { |
|
888 | + if (!isset($returnArray['firstArticleNumber']) && isset($headers[$iterator1]['Number'])) { |
|
889 | 889 | $returnArray['firstArticleNumber'] = $headers[$iterator1]['Number']; |
890 | 890 | $returnArray['firstArticleDate'] = $headers[$iterator1]['Date']; |
891 | 891 | } |
892 | 892 | |
893 | - if (! isset($returnArray['lastArticleNumber']) && isset($headers[$iterator2]['Number'])) { |
|
893 | + if (!isset($returnArray['lastArticleNumber']) && isset($headers[$iterator2]['Number'])) { |
|
894 | 894 | $returnArray['lastArticleNumber'] = $headers[$iterator2]['Number']; |
895 | 895 | $returnArray['lastArticleDate'] = $headers[$iterator2]['Date']; |
896 | 896 | } |
@@ -1064,7 +1064,7 @@ discard block |
||
1064 | 1064 | } |
1065 | 1065 | |
1066 | 1066 | // Remove articles that we cant fetch after x attempts. |
1067 | - DB::transaction(function () use ($groupArr) { |
|
1067 | + DB::transaction(function() use ($groupArr) { |
|
1068 | 1068 | DB::delete( |
1069 | 1069 | sprintf( |
1070 | 1070 | 'DELETE FROM missed_parts WHERE attempts >= %d AND groups_id = %d', |
@@ -1103,14 +1103,14 @@ discard block |
||
1103 | 1103 | $currentPost |
1104 | 1104 | ) |
1105 | 1105 | ); |
1106 | - if (! empty($local) && \count($local) > 0) { |
|
1106 | + if (!empty($local) && \count($local) > 0) { |
|
1107 | 1107 | $date = $local[0]->date; |
1108 | 1108 | break; |
1109 | 1109 | } |
1110 | 1110 | |
1111 | 1111 | // If we could not find it locally, try usenet. |
1112 | 1112 | $header = $this->_nntp->getXOVER($currentPost); |
1113 | - if (! $this->_nntp::isError($header) && isset($header[0]['Date']) && $header[0]['Date'] !== '') { |
|
1113 | + if (!$this->_nntp::isError($header) && isset($header[0]['Date']) && $header[0]['Date'] !== '') { |
|
1114 | 1114 | $date = $header[0]['Date']; |
1115 | 1115 | break; |
1116 | 1116 | } |
@@ -1135,7 +1135,7 @@ discard block |
||
1135 | 1135 | } while ($attempts++ <= 20); |
1136 | 1136 | |
1137 | 1137 | // If we didn't get a date, set it to now. |
1138 | - if (! $date) { |
|
1138 | + if (!$date) { |
|
1139 | 1139 | $date = time(); |
1140 | 1140 | } else { |
1141 | 1141 | $date = strtotime($date); |
@@ -1198,7 +1198,7 @@ discard block |
||
1198 | 1198 | $articleTime = $this->postdate($wantedArticle, $data); |
1199 | 1199 | |
1200 | 1200 | // Article doesn't exist, start again with something random |
1201 | - if (! $articleTime) { |
|
1201 | + if (!$articleTime) { |
|
1202 | 1202 | $wantedArticle = random_int($aMin, $aMax); |
1203 | 1203 | $articleTime = $this->postdate($wantedArticle, $data); |
1204 | 1204 | } |
@@ -1270,7 +1270,7 @@ discard block |
||
1270 | 1270 | foreach ($numbers as $number) { |
1271 | 1271 | $sql .= $number.','; |
1272 | 1272 | } |
1273 | - DB::transaction(static function () use ($groupID, $sql) { |
|
1273 | + DB::transaction(static function() use ($groupID, $sql) { |
|
1274 | 1274 | DB::delete(rtrim($sql, ',').') AND groups_id = '.$groupID); |
1275 | 1275 | }, 10); |
1276 | 1276 | } |
@@ -1285,10 +1285,10 @@ discard block |
||
1285 | 1285 | */ |
1286 | 1286 | protected function _retrieveBlackList(string $groupName): void |
1287 | 1287 | { |
1288 | - if (! isset($this->blackList[$groupName])) { |
|
1288 | + if (!isset($this->blackList[$groupName])) { |
|
1289 | 1289 | $this->blackList[$groupName] = $this->getBlacklist(true, self::OPTYPE_BLACKLIST, $groupName, true); |
1290 | 1290 | } |
1291 | - if (! isset($this->whiteList[$groupName])) { |
|
1291 | + if (!isset($this->whiteList[$groupName])) { |
|
1292 | 1292 | $this->whiteList[$groupName] = $this->getBlacklist(true, self::OPTYPE_WHITELIST, $groupName, true); |
1293 | 1293 | } |
1294 | 1294 | $this->_listsFound[$groupName] = ($this->blackList[$groupName] || $this->whiteList[$groupName]); |
@@ -1302,10 +1302,10 @@ discard block |
||
1302 | 1302 | */ |
1303 | 1303 | public function isBlackListed(array $msg, string $groupName): bool |
1304 | 1304 | { |
1305 | - if (! isset($this->_listsFound[$groupName])) { |
|
1305 | + if (!isset($this->_listsFound[$groupName])) { |
|
1306 | 1306 | $this->_retrieveBlackList($groupName); |
1307 | 1307 | } |
1308 | - if (! $this->_listsFound[$groupName]) { |
|
1308 | + if (!$this->_listsFound[$groupName]) { |
|
1309 | 1309 | return false; |
1310 | 1310 | } |
1311 | 1311 | |
@@ -1333,7 +1333,7 @@ discard block |
||
1333 | 1333 | |
1334 | 1334 | // Check if the field is blacklisted. |
1335 | 1335 | |
1336 | - if (! $blackListed && $this->blackList[$groupName]) { |
|
1336 | + if (!$blackListed && $this->blackList[$groupName]) { |
|
1337 | 1337 | foreach ($this->blackList[$groupName] as $blackList) { |
1338 | 1338 | if (preg_match('/'.$blackList->regex.'/i', $field[$blackList->msgcol])) { |
1339 | 1339 | $blackListed = true; |
@@ -1443,7 +1443,7 @@ discard block |
||
1443 | 1443 | */ |
1444 | 1444 | public function delete(int $collectionID): void |
1445 | 1445 | { |
1446 | - DB::transaction(static function () use ($collectionID) { |
|
1446 | + DB::transaction(static function() use ($collectionID) { |
|
1447 | 1447 | DB::delete(sprintf('DELETE FROM collections WHERE id = %d', $collectionID)); |
1448 | 1448 | }, 10); |
1449 | 1449 |
@@ -49,19 +49,19 @@ discard block |
||
49 | 49 | $path = $params[0]; |
50 | 50 | |
51 | 51 | // Check if the path ends with dir separator. |
52 | - if (! Str::endsWith($path, '/')) { |
|
52 | + if (!Str::endsWith($path, '/')) { |
|
53 | 53 | $path .= '/'; |
54 | 54 | } |
55 | 55 | |
56 | 56 | // Check if it's a directory. |
57 | - if (! File::isDirectory($path)) { |
|
57 | + if (!File::isDirectory($path)) { |
|
58 | 58 | $this->echoOut('Folder does not exist: '.$path); |
59 | 59 | |
60 | 60 | return $this->returnValue(); |
61 | 61 | } |
62 | 62 | |
63 | 63 | // Check if we can write to it. |
64 | - if (! is_writable($path)) { |
|
64 | + if (!is_writable($path)) { |
|
65 | 65 | $this->echoOut('Folder is not writable: '.$path); |
66 | 66 | |
67 | 67 | return $this->returnValue(); |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | |
70 | 70 | // Check if the from date is the proper format. |
71 | 71 | if (isset($params[1]) && $params[1] !== '') { |
72 | - if (! $this->checkDate($params[1])) { |
|
72 | + if (!$this->checkDate($params[1])) { |
|
73 | 73 | return $this->returnValue(); |
74 | 74 | } |
75 | 75 | $fromDate = $params[1]; |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | |
78 | 78 | // Check if the to date is the proper format. |
79 | 79 | if (isset($params[2]) && $params[2] !== '') { |
80 | - if (! $this->checkDate($params[2])) { |
|
80 | + if (!$this->checkDate($params[2])) { |
|
81 | 81 | return $this->returnValue(); |
82 | 82 | } |
83 | 83 | $toDate = $params[2]; |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | |
86 | 86 | // Check if the group_id exists. |
87 | 87 | if (isset($params[3]) && $params[3] !== 0) { |
88 | - if (! is_numeric($params[3])) { |
|
88 | + if (!is_numeric($params[3])) { |
|
89 | 89 | $this->echoOut('The group ID is not a number: '.$params[3]); |
90 | 90 | |
91 | 91 | return $this->returnValue(); |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | |
121 | 121 | // Create a path to store the new NZB files. |
122 | 122 | $currentPath = $path.$this->safeFilename($group['name']).'/'; |
123 | - if (! File::isDirectory($currentPath) && ! File::makeDirectory($currentPath) && ! File::isDirectory($currentPath)) { |
|
123 | + if (!File::isDirectory($currentPath) && !File::makeDirectory($currentPath) && !File::isDirectory($currentPath)) { |
|
124 | 124 | throw new \RuntimeException(sprintf('Directory "%s" was not created', $currentPath)); |
125 | 125 | } |
126 | 126 | foreach ($releases as $release) { |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | |
141 | 141 | // Check if the user wants them in gzip, copy it if so. |
142 | 142 | if ($gzip) { |
143 | - if (! copy($nzbFile, $currentFile.'.nzb.gz')) { |
|
143 | + if (!copy($nzbFile, $currentFile.'.nzb.gz')) { |
|
144 | 144 | if ($this->echoCLI) { |
145 | 145 | echo 'Unable to export NZB with GUID: '.$release['guid']; |
146 | 146 | } |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | // If not, decompress it and create a file to store it in. |
151 | 151 | } else { |
152 | 152 | $nzbContents = Utility::unzipGzipFile($nzbFile); |
153 | - if (! $nzbContents) { |
|
153 | + if (!$nzbContents) { |
|
154 | 154 | if ($this->echoCLI) { |
155 | 155 | echo 'Unable to export NZB with GUID: '.$release['guid']; |
156 | 156 | } |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | |
191 | 191 | protected function checkDate($date): bool |
192 | 192 | { |
193 | - if (! preg_match('/^(\d{2}\/){2}\d{4}$/', $date)) { |
|
193 | + if (!preg_match('/^(\d{2}\/){2}\d{4}$/', $date)) { |
|
194 | 194 | $this->echoOut('Wrong date format: '.$date); |
195 | 195 | |
196 | 196 | return false; |
@@ -274,7 +274,7 @@ discard block |
||
274 | 274 | GROUP BY r.id |
275 | 275 | ORDER BY %s %s %s", |
276 | 276 | $this->uSQL($userShows, 'videos_id'), |
277 | - (! empty($excludedCats) ? ' AND r.categories_id NOT IN ('.implode(',', $excludedCats).')' : ''), |
|
277 | + (!empty($excludedCats) ? ' AND r.categories_id NOT IN ('.implode(',', $excludedCats).')' : ''), |
|
278 | 278 | NZB::NZB_ADDED, |
279 | 279 | Category::TV_ROOT, |
280 | 280 | Category::TV_OTHER, |
@@ -344,7 +344,7 @@ discard block |
||
344 | 344 | { |
345 | 345 | // Delete NZB from disk. |
346 | 346 | $nzbPath = $nzb->NZBPath($identifiers['g']); |
347 | - if (! empty($nzbPath)) { |
|
347 | + if (!empty($nzbPath)) { |
|
348 | 348 | File::delete($nzbPath); |
349 | 349 | } |
350 | 350 | |
@@ -384,7 +384,7 @@ discard block |
||
384 | 384 | */ |
385 | 385 | public function updateMulti($guids, $category, $grabs, $videoId, $episodeId, $anidbId, $imdbId) |
386 | 386 | { |
387 | - if (! \is_array($guids) || \count($guids) < 1) { |
|
387 | + if (!\is_array($guids) || \count($guids) < 1) { |
|
388 | 388 | return false; |
389 | 389 | } |
390 | 390 | |
@@ -408,7 +408,7 @@ discard block |
||
408 | 408 | $sql = '(1=2 '; |
409 | 409 | foreach ($userQuery as $query) { |
410 | 410 | $sql .= sprintf('OR (r.%s = %d', $type, $query->$type); |
411 | - if (! empty($query->categories)) { |
|
411 | + if (!empty($query->categories)) { |
|
412 | 412 | $catsArr = explode('|', $query->categories); |
413 | 413 | if (\count($catsArr) > 1) { |
414 | 414 | $sql .= sprintf(' AND r.categories_id IN (%s)', implode(',', $catsArr)); |
@@ -452,7 +452,7 @@ discard block |
||
452 | 452 | $orderBy = $this->getBrowseOrder($orderBy); |
453 | 453 | } |
454 | 454 | |
455 | - $searchFields = Arr::where($searchArr, static function ($value) { |
|
455 | + $searchFields = Arr::where($searchArr, static function($value) { |
|
456 | 456 | return $value !== -1; |
457 | 457 | }); |
458 | 458 | |
@@ -462,7 +462,7 @@ discard block |
||
462 | 462 | $searchResult = $this->elasticSearch->indexSearch($phrases, $limit); |
463 | 463 | } else { |
464 | 464 | $searchResult = $this->manticoreSearch->searchIndexes('releases_rt', '', [], $searchFields); |
465 | - if (! empty($searchResult)) { |
|
465 | + if (!empty($searchResult)) { |
|
466 | 466 | $searchResult = Arr::wrap(Arr::get($searchResult, 'id')); |
467 | 467 | } |
468 | 468 | } |
@@ -553,7 +553,7 @@ discard block |
||
553 | 553 | $searchResult = $this->elasticSearch->indexSearchApi($searchName, $limit); |
554 | 554 | } else { |
555 | 555 | $searchResult = $this->manticoreSearch->searchIndexes('releases_rt', $searchName, ['searchname']); |
556 | - if (! empty($searchResult)) { |
|
556 | + if (!empty($searchResult)) { |
|
557 | 557 | $searchResult = Arr::wrap(Arr::get($searchResult, 'id')); |
558 | 558 | } |
559 | 559 | } |
@@ -569,7 +569,7 @@ discard block |
||
569 | 569 | ((int) $groupName !== -1 ? sprintf(' AND r.groups_id = %d ', UsenetGroup::getIDByName($groupName)) : ''), |
570 | 570 | $catQuery, |
571 | 571 | (\count($excludedCats) > 0 ? ' AND r.categories_id NOT IN ('.implode(',', $excludedCats).')' : ''), |
572 | - (! empty($searchResult) ? 'AND r.id IN ('.implode(',', $searchResult).')' : ''), |
|
572 | + (!empty($searchResult) ? 'AND r.id IN ('.implode(',', $searchResult).')' : ''), |
|
573 | 573 | ($minSize > 0 ? sprintf('AND r.size >= %d', $minSize) : '') |
574 | 574 | ); |
575 | 575 | $baseSql = sprintf( |
@@ -603,7 +603,7 @@ discard block |
||
603 | 603 | if ($releases !== null) { |
604 | 604 | return $releases; |
605 | 605 | } |
606 | - if ($searchName !== -1 && ! empty($searchResult)) { |
|
606 | + if ($searchName !== -1 && !empty($searchResult)) { |
|
607 | 607 | $releases = self::fromQuery($sql); |
608 | 608 | } elseif ($searchName !== -1 && empty($searchResult)) { |
609 | 609 | $releases = collect(); |
@@ -653,13 +653,13 @@ discard block |
||
653 | 653 | ($airDate !== '' ? sprintf('AND DATE(tve.firstaired) = %s', escapeString($airDate)) : '') |
654 | 654 | ); |
655 | 655 | $show = self::fromQuery($showQry); |
656 | - if (! empty($show[0]) && $show->isNotEmpty()) { |
|
657 | - if ((! empty($series) || ! empty($episode) || ! empty($airDate)) && $show[0]->episodes !== '') { |
|
656 | + if (!empty($show[0]) && $show->isNotEmpty()) { |
|
657 | + if ((!empty($series) || !empty($episode) || !empty($airDate)) && $show[0]->episodes !== '') { |
|
658 | 658 | $showSql = sprintf('AND r.tv_episodes_id IN (%s)', $show[0]->episodes); |
659 | 659 | } elseif ((int) $show[0]->video > 0) { |
660 | 660 | $showSql = 'AND r.videos_id = '.$show[0]->video; |
661 | 661 | // If $series is set but episode is not, return Season Packs only |
662 | - if (! empty($series) && empty($episode)) { |
|
662 | + if (!empty($series) && empty($episode)) { |
|
663 | 663 | $showSql .= ' AND r.tv_episodes_id = 0'; |
664 | 664 | } |
665 | 665 | } else { |
@@ -672,22 +672,22 @@ discard block |
||
672 | 672 | } |
673 | 673 | } |
674 | 674 | // If $name is set it is a fallback search, add available SxxExx/airdate info to the query |
675 | - if (! empty($name) && $showSql === '') { |
|
676 | - if (! empty($series) && (int) $series < 1900) { |
|
675 | + if (!empty($name) && $showSql === '') { |
|
676 | + if (!empty($series) && (int) $series < 1900) { |
|
677 | 677 | $name .= sprintf(' S%s', str_pad($series, 2, '0', STR_PAD_LEFT)); |
678 | - if (! empty($episode) && ! str_contains($episode, '/')) { |
|
678 | + if (!empty($episode) && !str_contains($episode, '/')) { |
|
679 | 679 | $name .= sprintf('E%s', str_pad($episode, 2, '0', STR_PAD_LEFT)); |
680 | 680 | } |
681 | - } elseif (! empty($airDate)) { |
|
681 | + } elseif (!empty($airDate)) { |
|
682 | 682 | $name .= sprintf(' %s', str_replace(['/', '-', '.', '_'], ' ', $airDate)); |
683 | 683 | } |
684 | 684 | } |
685 | - if (! empty($name)) { |
|
685 | + if (!empty($name)) { |
|
686 | 686 | if (config('nntmux.elasticsearch_enabled') === true) { |
687 | 687 | $searchResult = $this->elasticSearch->indexSearchTMA($name, $limit); |
688 | 688 | } else { |
689 | 689 | $searchResult = $this->manticoreSearch->searchIndexes('releases_rt', $name, ['searchname']); |
690 | - if (! empty($searchResult)) { |
|
690 | + if (!empty($searchResult)) { |
|
691 | 691 | $searchResult = Arr::wrap(Arr::get($searchResult, 'id')); |
692 | 692 | } |
693 | 693 | } |
@@ -703,11 +703,11 @@ discard block |
||
703 | 703 | NZB::NZB_ADDED, |
704 | 704 | $this->showPasswords(), |
705 | 705 | $showSql, |
706 | - (! empty($name) && ! empty($searchResult)) ? 'AND r.id IN ('.implode(',', $searchResult).')' : '', |
|
706 | + (!empty($name) && !empty($searchResult)) ? 'AND r.id IN ('.implode(',', $searchResult).')' : '', |
|
707 | 707 | (empty($searchResult)) ? Category::getCategorySearch($cat) : '', |
708 | 708 | $maxAge > 0 ? sprintf('AND r.postdate > NOW() - INTERVAL %d DAY', $maxAge) : '', |
709 | 709 | $minSize > 0 ? sprintf('AND r.size >= %d', $minSize) : '', |
710 | - ! empty($excludedCategories) ? sprintf('AND r.categories_id NOT IN('.implode(',', $excludedCategories).')') : '' |
|
710 | + !empty($excludedCategories) ? sprintf('AND r.categories_id NOT IN('.implode(',', $excludedCategories).')') : '' |
|
711 | 711 | ); |
712 | 712 | $baseSql = sprintf( |
713 | 713 | "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, |
@@ -743,7 +743,7 @@ discard block |
||
743 | 743 | if ($releases !== null) { |
744 | 744 | return $releases; |
745 | 745 | } |
746 | - $releases = ((! empty($name) && ! empty($searchResult)) || empty($name)) ? self::fromQuery($sql) : []; |
|
746 | + $releases = ((!empty($name) && !empty($searchResult)) || empty($name)) ? self::fromQuery($sql) : []; |
|
747 | 747 | if (count($releases) !== 0 && $releases->isNotEmpty()) { |
748 | 748 | $releases[0]->_totalrows = $this->getPagerCount( |
749 | 749 | preg_replace('#LEFT(\s+OUTER)?\s+JOIN\s+(?!tv_episodes)\s+.*ON.*=.*\n#i', ' ', $baseSql) |
@@ -789,12 +789,12 @@ discard block |
||
789 | 789 | ); |
790 | 790 | $show = self::fromQuery($showQry); |
791 | 791 | if ($show->isNotEmpty()) { |
792 | - if ((! empty($series) || ! empty($episode) || ! empty($airDate)) && $show[0]->episodes !== '') { |
|
792 | + if ((!empty($series) || !empty($episode) || !empty($airDate)) && $show[0]->episodes !== '') { |
|
793 | 793 | $showSql = sprintf('AND r.tv_episodes_id IN (%s)', $show[0]->episodes); |
794 | 794 | } elseif ((int) $show[0]->video > 0) { |
795 | 795 | $showSql = 'AND r.videos_id = '.$show[0]->video; |
796 | 796 | // If $series is set but episode is not, return Season Packs only |
797 | - if (! empty($series) && empty($episode)) { |
|
797 | + if (!empty($series) && empty($episode)) { |
|
798 | 798 | $showSql .= ' AND r.tv_episodes_id = 0'; |
799 | 799 | } |
800 | 800 | } else { |
@@ -807,22 +807,22 @@ discard block |
||
807 | 807 | } |
808 | 808 | } |
809 | 809 | // If $name is set it is a fallback search, add available SxxExx/airdate info to the query |
810 | - if (! empty($name) && $showSql === '') { |
|
811 | - if (! empty($series) && (int) $series < 1900) { |
|
810 | + if (!empty($name) && $showSql === '') { |
|
811 | + if (!empty($series) && (int) $series < 1900) { |
|
812 | 812 | $name .= sprintf(' S%s', str_pad($series, 2, '0', STR_PAD_LEFT)); |
813 | - if (! empty($episode) && ! str_contains($episode, '/')) { |
|
813 | + if (!empty($episode) && !str_contains($episode, '/')) { |
|
814 | 814 | $name .= sprintf('E%s', str_pad($episode, 2, '0', STR_PAD_LEFT)); |
815 | 815 | } |
816 | - } elseif (! empty($airDate)) { |
|
816 | + } elseif (!empty($airDate)) { |
|
817 | 817 | $name .= sprintf(' %s', str_replace(['/', '-', '.', '_'], ' ', $airDate)); |
818 | 818 | } |
819 | 819 | } |
820 | - if (! empty($name)) { |
|
820 | + if (!empty($name)) { |
|
821 | 821 | if (config('nntmux.elasticsearch_enabled') === true) { |
822 | 822 | $searchResult = $this->elasticSearch->indexSearchTMA($name, $limit); |
823 | 823 | } else { |
824 | 824 | $searchResult = $this->manticoreSearch->searchIndexes('releases_rt', $name, ['searchname']); |
825 | - if (! empty($searchResult)) { |
|
825 | + if (!empty($searchResult)) { |
|
826 | 826 | $searchResult = Arr::wrap(Arr::get($searchResult, 'id')); |
827 | 827 | } |
828 | 828 | } |
@@ -838,11 +838,11 @@ discard block |
||
838 | 838 | NZB::NZB_ADDED, |
839 | 839 | $this->showPasswords(), |
840 | 840 | $showSql, |
841 | - (! empty($searchResult) ? 'AND r.id IN ('.implode(',', $searchResult).')' : ''), |
|
841 | + (!empty($searchResult) ? 'AND r.id IN ('.implode(',', $searchResult).')' : ''), |
|
842 | 842 | Category::getCategorySearch($cat), |
843 | 843 | ($maxAge > 0 ? sprintf('AND r.postdate > NOW() - INTERVAL %d DAY', $maxAge) : ''), |
844 | 844 | ($minSize > 0 ? sprintf('AND r.size >= %d', $minSize) : ''), |
845 | - ! empty($excludedCategories) ? sprintf('AND r.categories_id NOT IN('.implode(',', $excludedCategories).')') : '' |
|
845 | + !empty($excludedCategories) ? sprintf('AND r.categories_id NOT IN('.implode(',', $excludedCategories).')') : '' |
|
846 | 846 | ); |
847 | 847 | $baseSql = sprintf( |
848 | 848 | "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, |
@@ -892,12 +892,12 @@ discard block |
||
892 | 892 | */ |
893 | 893 | public function animeSearch($aniDbID, int $offset = 0, int $limit = 100, string $name = '', array $cat = [-1], int $maxAge = -1, array $excludedCategories = []): mixed |
894 | 894 | { |
895 | - if (! empty($name)) { |
|
895 | + if (!empty($name)) { |
|
896 | 896 | if (config('nntmux.elasticsearch_enabled') === true) { |
897 | 897 | $searchResult = $this->elasticSearch->indexSearchTMA($name, $limit); |
898 | 898 | } else { |
899 | 899 | $searchResult = $this->manticoreSearch->searchIndexes('releases_rt', $name, ['searchname']); |
900 | - if (! empty($searchResult)) { |
|
900 | + if (!empty($searchResult)) { |
|
901 | 901 | $searchResult = Arr::wrap(Arr::get($searchResult, 'id')); |
902 | 902 | } |
903 | 903 | } |
@@ -914,8 +914,8 @@ discard block |
||
914 | 914 | $this->showPasswords(), |
915 | 915 | NZB::NZB_ADDED, |
916 | 916 | ($aniDbID > -1 ? sprintf(' AND r.anidbid = %d ', $aniDbID) : ''), |
917 | - (! empty($searchResult) ? 'AND r.id IN ('.implode(',', $searchResult).')' : ''), |
|
918 | - ! empty($excludedCategories) ? sprintf('AND r.categories_id NOT IN('.implode(',', $excludedCategories).')') : '', |
|
917 | + (!empty($searchResult) ? 'AND r.id IN ('.implode(',', $searchResult).')' : ''), |
|
918 | + !empty($excludedCategories) ? sprintf('AND r.categories_id NOT IN('.implode(',', $excludedCategories).')') : '', |
|
919 | 919 | Category::getCategorySearch($cat), |
920 | 920 | ($maxAge > 0 ? sprintf(' AND r.postdate > NOW() - INTERVAL %d DAY ', $maxAge) : '') |
921 | 921 | ); |
@@ -964,12 +964,12 @@ discard block |
||
964 | 964 | */ |
965 | 965 | 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 |
966 | 966 | { |
967 | - if (! empty($name)) { |
|
967 | + if (!empty($name)) { |
|
968 | 968 | if (config('nntmux.elasticsearch_enabled') === true) { |
969 | 969 | $searchResult = $this->elasticSearch->indexSearchTMA($name, $limit); |
970 | 970 | } else { |
971 | 971 | $searchResult = $this->manticoreSearch->searchIndexes('releases_rt', $name, ['searchname']); |
972 | - if (! empty($searchResult)) { |
|
972 | + if (!empty($searchResult)) { |
|
973 | 973 | $searchResult = Arr::wrap(Arr::get($searchResult, 'id')); |
974 | 974 | } |
975 | 975 | } |
@@ -986,11 +986,11 @@ discard block |
||
986 | 986 | %s %s %s %s %s %s %s', |
987 | 987 | NZB::NZB_ADDED, |
988 | 988 | $this->showPasswords(), |
989 | - (! empty($searchResult) ? 'AND r.id IN ('.implode(',', $searchResult).')' : ''), |
|
989 | + (!empty($searchResult) ? 'AND r.id IN ('.implode(',', $searchResult).')' : ''), |
|
990 | 990 | ($imDbId !== -1 && is_numeric($imDbId)) ? sprintf(' AND m.imdbid = \'%s\' ', $imDbId) : '', |
991 | 991 | ($tmDbId !== -1 && is_numeric($tmDbId)) ? sprintf(' AND m.tmdbid = %d ', $tmDbId) : '', |
992 | 992 | ($traktId !== -1 && is_numeric($traktId)) ? sprintf(' AND m.traktid = %d ', $traktId) : '', |
993 | - ! empty($excludedCategories) ? sprintf('AND r.categories_id NOT IN('.implode(',', $excludedCategories).')') : '', |
|
993 | + !empty($excludedCategories) ? sprintf('AND r.categories_id NOT IN('.implode(',', $excludedCategories).')') : '', |
|
994 | 994 | Category::getCategorySearch($cat), |
995 | 995 | $maxAge > 0 ? sprintf(' AND r.postdate > NOW() - INTERVAL %d DAY ', $maxAge) : '', |
996 | 996 | $minSize > 0 ? sprintf('AND r.size >= %d', $minSize) : '' |
@@ -1042,7 +1042,7 @@ discard block |
||
1042 | 1042 | $parentCat = $catRow['root_categories_id']; |
1043 | 1043 | |
1044 | 1044 | $results = $this->search(['searchname' => getSimilarName($name)], -1, '', '', -1, -1, 0, config('nntmux.items_per_page'), '', -1, $excludedCats, 'basic', [$parentCat]); |
1045 | - if (! $results) { |
|
1045 | + if (!$results) { |
|
1046 | 1046 | return $ret; |
1047 | 1047 | } |
1048 | 1048 |