@@ -169,8 +169,8 @@ discard block |
||
169 | 169 | %s |
170 | 170 | GROUP BY boo.id |
171 | 171 | ORDER BY %s %s', |
172 | - \is_array($bookIDs) && ! empty($bookIDs) ? implode(',', $bookIDs) : -1, |
|
173 | - \is_array($releaseIDs) && ! empty($releaseIDs) ? implode(',', $releaseIDs) : -1, |
|
172 | + \is_array($bookIDs) && !empty($bookIDs) ? implode(',', $bookIDs) : -1, |
|
173 | + \is_array($releaseIDs) && !empty($releaseIDs) ? implode(',', $releaseIDs) : -1, |
|
174 | 174 | $catsrch, |
175 | 175 | $order[0], |
176 | 176 | $order[1] |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | { |
236 | 236 | $browseby = ' '; |
237 | 237 | foreach ($this->getBrowseByOptions() as $bbk => $bbv) { |
238 | - if (! empty($_REQUEST[$bbk])) { |
|
238 | + if (!empty($_REQUEST[$bbk])) { |
|
239 | 239 | $bbs = stripslashes($_REQUEST[$bbk]); |
240 | 240 | $browseby .= ' AND boo.'.$bbv.' '.'LIKE '.escapeString('%'.$bbs.'%'); |
241 | 241 | } |
@@ -365,7 +365,7 @@ discard block |
||
365 | 365 | return false; |
366 | 366 | } |
367 | 367 | |
368 | - if (preg_match('/^([a-z0-9ü!]+ ){1,2}(N|Vol)?\d{1,4}([abc])?$|^([a-z0-9]+ ){1,2}(Jan( |unar|$)|Feb( |ruary|$)|Mar( |ch|$)|Apr( |il|$)|May(?![a-z0-9])|Jun([ e$])|Jul([ y$])|Aug( |ust|$)|Sep( |tember|$)|O([ck])t( |ober|$)|Nov( |ember|$)|De([cz])( |ember|$))/ui', $releasename) && ! preg_match('/Part \d+/i', $releasename)) { |
|
368 | + if (preg_match('/^([a-z0-9ü!]+ ){1,2}(N|Vol)?\d{1,4}([abc])?$|^([a-z0-9]+ ){1,2}(Jan( |unar|$)|Feb( |ruary|$)|Mar( |ch|$)|Apr( |il|$)|May(?![a-z0-9])|Jun([ e$])|Jul([ y$])|Aug( |ust|$)|Sep( |tember|$)|O([ck])t( |ober|$)|Nov( |ember|$)|De([cz])( |ember|$))/ui', $releasename) && !preg_match('/Part \d+/i', $releasename)) { |
|
369 | 369 | if ($this->echooutput) { |
370 | 370 | $this->colorCli->headerOver('Changing category to magazines: ').$this->colorCli->primary($releasename); |
371 | 371 | } |
@@ -373,14 +373,14 @@ discard block |
||
373 | 373 | |
374 | 374 | return false; |
375 | 375 | } |
376 | - if (! empty($releasename) && ! preg_match('/^[a-z0-9]+$|^([0-9]+ ){1,}$|Part \d+/i', $releasename)) { |
|
376 | + if (!empty($releasename) && !preg_match('/^[a-z0-9]+$|^([0-9]+ ){1,}$|Part \d+/i', $releasename)) { |
|
377 | 377 | return $releasename; |
378 | 378 | } |
379 | 379 | |
380 | 380 | return false; |
381 | 381 | } |
382 | 382 | if ($releasetype === 'audiobook') { |
383 | - if (! empty($releasename) && ! preg_match('/^[a-z0-9]+$|^([0-9]+ ){1,}$|Part \d+/i', $releasename)) { |
|
383 | + if (!empty($releasename) && !preg_match('/^[a-z0-9]+$|^([0-9]+ ){1,}$|Part \d+/i', $releasename)) { |
|
384 | 384 | // we can skip category for audiobooks, since we already know it, so as long as the release name is valid return it so that it is postprocessed by amazon. In the future, determining the type of audiobook could be added (Lecture or book), since we can skip lookups on lectures, but for now handle them all the same way |
385 | 385 | return $releasename; |
386 | 386 | } |
@@ -404,7 +404,7 @@ discard block |
||
404 | 404 | |
405 | 405 | $book = false; |
406 | 406 | if ($bookInfo !== '') { |
407 | - if (! $book) { |
|
407 | + if (!$book) { |
|
408 | 408 | $this->colorCli->info('Fetching data from iTunes for '.$bookInfo); |
409 | 409 | $book = $this->fetchItunesBookProperties($bookInfo); |
410 | 410 | } elseif ($amazdata !== null) { |
@@ -511,12 +511,12 @@ discard block |
||
511 | 511 | 'salesrank' => '', |
512 | 512 | 'publisher' => '', |
513 | 513 | 'pages' => '', |
514 | - 'coverurl' => ! empty($iTunesBook->getCover()) ? str_replace('100x100', '800x800', $iTunesBook->getCover()) : '', |
|
514 | + 'coverurl' => !empty($iTunesBook->getCover()) ? str_replace('100x100', '800x800', $iTunesBook->getCover()) : '', |
|
515 | 515 | 'genre' => implode(', ', $iTunesBook->getGenre()), |
516 | 516 | 'overview' => strip_tags($iTunesBook->getDescription()), |
517 | 517 | 'publishdate' => $iTunesBook->getReleaseDate()->format('Y-m-d'), |
518 | 518 | ]; |
519 | - if (! empty($book['coverurl'])) { |
|
519 | + if (!empty($book['coverurl'])) { |
|
520 | 520 | $book['cover'] = 1; |
521 | 521 | } else { |
522 | 522 | $book['cover'] = 0; |
@@ -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; |
@@ -377,7 +377,7 @@ discard block |
||
377 | 377 | |
378 | 378 | $done = false; |
379 | 379 | // Get all the parts (in portions of $this->messageBuffer to not use too much memory). |
380 | - while (! $done) { |
|
380 | + while (!$done) { |
|
381 | 381 | // Increment last until we reach $groupLast (group newest article). |
382 | 382 | if ($total > $this->messageBuffer) { |
383 | 383 | if ((string) ($first + $this->messageBuffer) > $groupLast) { |
@@ -401,7 +401,7 @@ discard block |
||
401 | 401 | $scanSummary = $this->scan($groupMySQL, $first, $last); |
402 | 402 | |
403 | 403 | // Check if we fetched headers. |
404 | - if (! empty($scanSummary)) { |
|
404 | + if (!empty($scanSummary)) { |
|
405 | 405 | // If new group, update first record & postdate |
406 | 406 | if ($groupMySQL['first_record_postdate'] === null && (int) $groupMySQL['first_record'] === 0) { |
407 | 407 | $groupMySQL['first_record'] = $scanSummary['firstArticleNumber']; |
@@ -425,7 +425,7 @@ discard block |
||
425 | 425 | } |
426 | 426 | |
427 | 427 | $scanSummary['lastArticleDate'] = (isset($scanSummary['lastArticleDate']) ? strtotime($scanSummary['lastArticleDate']) : false); |
428 | - if (! is_numeric($scanSummary['lastArticleDate'])) { |
|
428 | + if (!is_numeric($scanSummary['lastArticleDate'])) { |
|
429 | 429 | $scanSummary['lastArticleDate'] = $this->postdate($scanSummary['lastArticleNumber'], $groupNNTP); |
430 | 430 | } |
431 | 431 | |
@@ -574,7 +574,7 @@ discard block |
||
574 | 574 | |
575 | 575 | // If set we are running in partRepair mode. |
576 | 576 | if ($partRepair && $missingParts !== null) { |
577 | - if (! \in_array($header['Number'], $missingParts, false)) { |
|
577 | + if (!\in_array($header['Number'], $missingParts, false)) { |
|
578 | 578 | // If article isn't one that is missing skip it. |
579 | 579 | continue; |
580 | 580 | } |
@@ -619,15 +619,15 @@ discard block |
||
619 | 619 | |
620 | 620 | unset($headers); // Reclaim memory now that headers are split. |
621 | 621 | |
622 | - if (! empty($this->_binaryBlacklistIdsToUpdate)) { |
|
622 | + if (!empty($this->_binaryBlacklistIdsToUpdate)) { |
|
623 | 623 | $this->updateBlacklistUsage(); |
624 | 624 | } |
625 | 625 | |
626 | - if ($this->_echoCLI && ! $partRepair) { |
|
626 | + if ($this->_echoCLI && !$partRepair) { |
|
627 | 627 | $this->outputHeaderInitial(); |
628 | 628 | } |
629 | 629 | |
630 | - if (! empty($stdHeaders)) { |
|
630 | + if (!empty($stdHeaders)) { |
|
631 | 631 | $this->storeHeaders($stdHeaders); |
632 | 632 | } |
633 | 633 | unset($stdHeaders); |
@@ -702,7 +702,7 @@ discard block |
||
702 | 702 | // Loop articles, figure out files/parts. |
703 | 703 | foreach ($headers as $this->header) { |
704 | 704 | // Set up the info for inserting into parts/binaries/collections tables. |
705 | - if (! isset($articles[$this->header['matches'][1]])) { |
|
705 | + if (!isset($articles[$this->header['matches'][1]])) { |
|
706 | 706 | // Attempt to find the file count. If it is not found, set it to 0. |
707 | 707 | $fileCount = $this->getFileCount($this->header['matches'][1]); |
708 | 708 | if ($fileCount[1] === 0 && $fileCount[3] === 0) { |
@@ -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 | } |
@@ -888,12 +888,12 @@ discard block |
||
888 | 888 | $iterator1 = 0; |
889 | 889 | $iterator2 = $msgCount - 1; |
890 | 890 | while (true) { |
891 | - if (! isset($returnArray['firstArticleNumber']) && isset($headers[$iterator1]['Number'])) { |
|
891 | + if (!isset($returnArray['firstArticleNumber']) && isset($headers[$iterator1]['Number'])) { |
|
892 | 892 | $returnArray['firstArticleNumber'] = $headers[$iterator1]['Number']; |
893 | 893 | $returnArray['firstArticleDate'] = $headers[$iterator1]['Date']; |
894 | 894 | } |
895 | 895 | |
896 | - if (! isset($returnArray['lastArticleNumber']) && isset($headers[$iterator2]['Number'])) { |
|
896 | + if (!isset($returnArray['lastArticleNumber']) && isset($headers[$iterator2]['Number'])) { |
|
897 | 897 | $returnArray['lastArticleNumber'] = $headers[$iterator2]['Number']; |
898 | 898 | $returnArray['lastArticleDate'] = $headers[$iterator2]['Date']; |
899 | 899 | } |
@@ -1067,7 +1067,7 @@ discard block |
||
1067 | 1067 | } |
1068 | 1068 | |
1069 | 1069 | // Remove articles that we cant fetch after x attempts. |
1070 | - DB::transaction(function () use ($groupArr) { |
|
1070 | + DB::transaction(function() use ($groupArr) { |
|
1071 | 1071 | DB::delete( |
1072 | 1072 | sprintf( |
1073 | 1073 | 'DELETE FROM missed_parts WHERE attempts >= %d AND groups_id = %d', |
@@ -1106,14 +1106,14 @@ discard block |
||
1106 | 1106 | $currentPost |
1107 | 1107 | ) |
1108 | 1108 | ); |
1109 | - if (! empty($local) && \count($local) > 0) { |
|
1109 | + if (!empty($local) && \count($local) > 0) { |
|
1110 | 1110 | $date = $local[0]->date; |
1111 | 1111 | break; |
1112 | 1112 | } |
1113 | 1113 | |
1114 | 1114 | // If we could not find it locally, try usenet. |
1115 | 1115 | $header = $this->_nntp->getXOVER($currentPost); |
1116 | - if (! $this->_nntp::isError($header) && isset($header[0]['Date']) && $header[0]['Date'] !== '') { |
|
1116 | + if (!$this->_nntp::isError($header) && isset($header[0]['Date']) && $header[0]['Date'] !== '') { |
|
1117 | 1117 | $date = $header[0]['Date']; |
1118 | 1118 | break; |
1119 | 1119 | } |
@@ -1138,7 +1138,7 @@ discard block |
||
1138 | 1138 | } while ($attempts++ <= 20); |
1139 | 1139 | |
1140 | 1140 | // If we didn't get a date, set it to now. |
1141 | - if (! $date) { |
|
1141 | + if (!$date) { |
|
1142 | 1142 | $date = time(); |
1143 | 1143 | } else { |
1144 | 1144 | $date = strtotime($date); |
@@ -1201,7 +1201,7 @@ discard block |
||
1201 | 1201 | $articleTime = $this->postdate($wantedArticle, $data); |
1202 | 1202 | |
1203 | 1203 | // Article doesn't exist, start again with something random |
1204 | - if (! $articleTime) { |
|
1204 | + if (!$articleTime) { |
|
1205 | 1205 | $wantedArticle = random_int($aMin, $aMax); |
1206 | 1206 | $articleTime = $this->postdate($wantedArticle, $data); |
1207 | 1207 | } |
@@ -1273,7 +1273,7 @@ discard block |
||
1273 | 1273 | foreach ($numbers as $number) { |
1274 | 1274 | $sql .= $number.','; |
1275 | 1275 | } |
1276 | - DB::transaction(static function () use ($groupID, $sql) { |
|
1276 | + DB::transaction(static function() use ($groupID, $sql) { |
|
1277 | 1277 | DB::delete(rtrim($sql, ',').') AND groups_id = '.$groupID); |
1278 | 1278 | }, 10); |
1279 | 1279 | } |
@@ -1288,10 +1288,10 @@ discard block |
||
1288 | 1288 | */ |
1289 | 1289 | protected function _retrieveBlackList(string $groupName): void |
1290 | 1290 | { |
1291 | - if (! isset($this->blackList[$groupName])) { |
|
1291 | + if (!isset($this->blackList[$groupName])) { |
|
1292 | 1292 | $this->blackList[$groupName] = $this->getBlacklist(true, self::OPTYPE_BLACKLIST, $groupName, true); |
1293 | 1293 | } |
1294 | - if (! isset($this->whiteList[$groupName])) { |
|
1294 | + if (!isset($this->whiteList[$groupName])) { |
|
1295 | 1295 | $this->whiteList[$groupName] = $this->getBlacklist(true, self::OPTYPE_WHITELIST, $groupName, true); |
1296 | 1296 | } |
1297 | 1297 | $this->_listsFound[$groupName] = ($this->blackList[$groupName] || $this->whiteList[$groupName]); |
@@ -1305,10 +1305,10 @@ discard block |
||
1305 | 1305 | */ |
1306 | 1306 | public function isBlackListed(array $msg, string $groupName): bool |
1307 | 1307 | { |
1308 | - if (! isset($this->_listsFound[$groupName])) { |
|
1308 | + if (!isset($this->_listsFound[$groupName])) { |
|
1309 | 1309 | $this->_retrieveBlackList($groupName); |
1310 | 1310 | } |
1311 | - if (! $this->_listsFound[$groupName]) { |
|
1311 | + if (!$this->_listsFound[$groupName]) { |
|
1312 | 1312 | return false; |
1313 | 1313 | } |
1314 | 1314 | |
@@ -1336,7 +1336,7 @@ discard block |
||
1336 | 1336 | |
1337 | 1337 | // Check if the field is blacklisted. |
1338 | 1338 | |
1339 | - if (! $blackListed && $this->blackList[$groupName]) { |
|
1339 | + if (!$blackListed && $this->blackList[$groupName]) { |
|
1340 | 1340 | foreach ($this->blackList[$groupName] as $blackList) { |
1341 | 1341 | if (preg_match('/'.$blackList->regex.'/i', $field[$blackList->msgcol])) { |
1342 | 1342 | $blackListed = true; |
@@ -1446,7 +1446,7 @@ discard block |
||
1446 | 1446 | */ |
1447 | 1447 | public function delete(int $collectionID): void |
1448 | 1448 | { |
1449 | - DB::transaction(static function () use ($collectionID) { |
|
1449 | + DB::transaction(static function() use ($collectionID) { |
|
1450 | 1450 | DB::delete(sprintf('DELETE FROM collections WHERE id = %d', $collectionID)); |
1451 | 1451 | }, 10); |
1452 | 1452 | |
@@ -1493,7 +1493,7 @@ discard block |
||
1493 | 1493 | |
1494 | 1494 | private function getFileCount($subject): array |
1495 | 1495 | { |
1496 | - if (! preg_match('/[[(\s](\d{1,5})(\/|[\s_]of[\s_]|-)(\d{1,5})[])\s$:]/i', $subject, $fileCount)) { |
|
1496 | + if (!preg_match('/[[(\s](\d{1,5})(\/|[\s_]of[\s_]|-)(\d{1,5})[])\s$:]/i', $subject, $fileCount)) { |
|
1497 | 1497 | $fileCount[1] = $fileCount[3] = 0; |
1498 | 1498 | } |
1499 | 1499 |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | use Symfony\Component\Process\Process; |
17 | 17 | use Zip as ZipStream; |
18 | 18 | |
19 | -if (! function_exists('getRawHtml')) { |
|
19 | +if (!function_exists('getRawHtml')) { |
|
20 | 20 | /** |
21 | 21 | * @param bool $cookie |
22 | 22 | * @return bool|mixed|string |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | } |
52 | 52 | } |
53 | 53 | |
54 | -if (! function_exists('makeFieldLinks')) { |
|
54 | +if (!function_exists('makeFieldLinks')) { |
|
55 | 55 | /** |
56 | 56 | * @return string |
57 | 57 | * |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | } |
82 | 82 | } |
83 | 83 | |
84 | -if (! function_exists('getUserBrowseOrder')) { |
|
84 | +if (!function_exists('getUserBrowseOrder')) { |
|
85 | 85 | /** |
86 | 86 | * @param string $orderBy |
87 | 87 | */ |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | } |
108 | 108 | } |
109 | 109 | |
110 | -if (! function_exists('getUserBrowseOrdering')) { |
|
110 | +if (!function_exists('getUserBrowseOrdering')) { |
|
111 | 111 | function getUserBrowseOrdering(): array |
112 | 112 | { |
113 | 113 | return [ |
@@ -137,21 +137,21 @@ discard block |
||
137 | 137 | } |
138 | 138 | } |
139 | 139 | |
140 | -if (! function_exists('createGUID')) { |
|
140 | +if (!function_exists('createGUID')) { |
|
141 | 141 | /** |
142 | 142 | * @throws Exception |
143 | 143 | */ |
144 | 144 | function createGUID(): string |
145 | 145 | { |
146 | 146 | $data = random_bytes(16); |
147 | - $data[6] = \chr(\ord($data[6]) & 0x0F | 0x40); // set version to 0100 |
|
148 | - $data[8] = \chr(\ord($data[8]) & 0x3F | 0x80); // set bits 6-7 to 10 |
|
147 | + $data[6] = \chr(\ord($data[6]) & 0x0F|0x40); // set version to 0100 |
|
148 | + $data[8] = \chr(\ord($data[8]) & 0x3F|0x80); // set bits 6-7 to 10 |
|
149 | 149 | |
150 | 150 | return vsprintf('%s%s-%s-%s-%s-%s%s%s', str_split(sodium_bin2hex($data), 4)); |
151 | 151 | } |
152 | 152 | } |
153 | 153 | |
154 | -if (! function_exists('getSimilarName')) { |
|
154 | +if (!function_exists('getSimilarName')) { |
|
155 | 155 | /** |
156 | 156 | * @param string $name |
157 | 157 | */ |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | } |
162 | 162 | } |
163 | 163 | |
164 | -if (! function_exists('color')) { |
|
164 | +if (!function_exists('color')) { |
|
165 | 165 | /** |
166 | 166 | * @param string $string |
167 | 167 | */ |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | } |
172 | 172 | } |
173 | 173 | |
174 | -if (! function_exists('human_filesize')) { |
|
174 | +if (!function_exists('human_filesize')) { |
|
175 | 175 | /** |
176 | 176 | * @param int $decimals |
177 | 177 | */ |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | } |
185 | 185 | } |
186 | 186 | |
187 | -if (! function_exists('bcdechex')) { |
|
187 | +if (!function_exists('bcdechex')) { |
|
188 | 188 | /** |
189 | 189 | * @return string |
190 | 190 | */ |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | } |
202 | 202 | } |
203 | 203 | |
204 | -if (! function_exists('runCmd')) { |
|
204 | +if (!function_exists('runCmd')) { |
|
205 | 205 | /** |
206 | 206 | * Run CLI command. |
207 | 207 | * |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | } |
230 | 230 | } |
231 | 231 | |
232 | -if (! function_exists('escapeString')) { |
|
232 | +if (!function_exists('escapeString')) { |
|
233 | 233 | /** |
234 | 234 | * @return string |
235 | 235 | */ |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | } |
240 | 240 | } |
241 | 241 | |
242 | -if (! function_exists('realDuration')) { |
|
242 | +if (!function_exists('realDuration')) { |
|
243 | 243 | /** |
244 | 244 | * @return string |
245 | 245 | */ |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | } |
252 | 252 | } |
253 | 253 | |
254 | -if (! function_exists('is_it_json')) { |
|
254 | +if (!function_exists('is_it_json')) { |
|
255 | 255 | /** |
256 | 256 | * @param array|string $isIt |
257 | 257 | * @return bool |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | return $zipped; |
295 | 295 | } |
296 | 296 | |
297 | -if (! function_exists('release_flag')) { |
|
297 | +if (!function_exists('release_flag')) { |
|
298 | 298 | // Function inspired by c0r3@newznabforums adds country flags on the browse page. |
299 | 299 | /** |
300 | 300 | * @param string $text Text to match against. |
@@ -430,10 +430,10 @@ discard block |
||
430 | 430 | |
431 | 431 | return ''; |
432 | 432 | } |
433 | - if (! function_exists('sanitize')) { |
|
433 | + if (!function_exists('sanitize')) { |
|
434 | 434 | function sanitize(array|string $phrases, array $doNotSanitize = []): string |
435 | 435 | { |
436 | - if (! is_array($phrases)) { |
|
436 | + if (!is_array($phrases)) { |
|
437 | 437 | $wordArray = explode(' ', str_replace('.', ' ', $phrases)); |
438 | 438 | } else { |
439 | 439 | $wordArray = $phrases; |
@@ -444,9 +444,9 @@ discard block |
||
444 | 444 | foreach ($wordArray as $words) { |
445 | 445 | $words = preg_split('/\s+/', $words); |
446 | 446 | foreach ($words as $st) { |
447 | - if (Str::startsWith($st, ['!', '+', '-', '?', '*']) && Str::length($st) > 1 && ! preg_match('/([!+?\-*]){2,}/', $st)) { |
|
447 | + if (Str::startsWith($st, ['!', '+', '-', '?', '*']) && Str::length($st) > 1 && !preg_match('/([!+?\-*]){2,}/', $st)) { |
|
448 | 448 | $str = $st; |
449 | - } elseif (Str::endsWith($st, ['+', '-', '?', '*']) && Str::length($st) > 1 && ! preg_match('/([!+?\-*]){2,}/', $st)) { |
|
449 | + } elseif (Str::endsWith($st, ['+', '-', '?', '*']) && Str::length($st) > 1 && !preg_match('/([!+?\-*]){2,}/', $st)) { |
|
450 | 450 | $str = $st; |
451 | 451 | } else { |
452 | 452 | $str = Sanitizer::escape($st, $doNotSanitize); |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | } |
20 | 20 | $binaries = new Binaries(['NNTP' => $nntp]); |
21 | 21 | |
22 | -if (isset($argv[1]) && ! is_numeric($argv[1])) { |
|
22 | +if (isset($argv[1]) && !is_numeric($argv[1])) { |
|
23 | 23 | $groupName = $argv[1]; |
24 | 24 | $colorCli->header("Updating group: $groupName"); |
25 | 25 | |
@@ -36,8 +36,7 @@ discard block |
||
36 | 36 | } |
37 | 37 | } else { |
38 | 38 | try { |
39 | - $binaries->updateAllGroups((isset($argv[1]) && is_numeric($argv[1]) && $argv[1] > 0 ? $argv[1] : |
|
40 | - $maxHeaders)); |
|
39 | + $binaries->updateAllGroups((isset($argv[1]) && is_numeric($argv[1]) && $argv[1] > 0 ? $argv[1] : $maxHeaders)); |
|
41 | 40 | } catch (Throwable $e) { |
42 | 41 | Illuminate\Support\Facades\Log::error($e->getMessage()); |
43 | 42 | } |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | 'airdate', |
94 | 94 | 'episode_title', |
95 | 95 | ])->first(); |
96 | - if (! empty($result)) { |
|
96 | + if (!empty($result)) { |
|
97 | 97 | return $result->toArray(); |
98 | 98 | } |
99 | 99 | |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | $this->status = self::PROC_EXTFAIL; |
144 | 144 | } |
145 | 145 | |
146 | - if (! empty($hits['title'])) { |
|
146 | + if (!empty($hits['title'])) { |
|
147 | 147 | $hits['title'] = trim(str_replace(['_', '.'], ' ', $hits['title'])); |
148 | 148 | } |
149 | 149 | |
@@ -187,10 +187,10 @@ discard block |
||
187 | 187 | $anidbId = $this->getAnidbByName($tmpName); |
188 | 188 | } |
189 | 189 | |
190 | - if (! empty($anidbId) && is_numeric($anidbId->anidbid) && $anidbId->anidbid > 0) { |
|
190 | + if (!empty($anidbId) && is_numeric($anidbId->anidbid) && $anidbId->anidbid > 0) { |
|
191 | 191 | $updatedAni = $this->checkAniDBInfo($anidbId->anidbid, $cleanArr['epno']); |
192 | 192 | if (empty($updatedAni)) { |
193 | - if (! empty($this->updateTimeCheck($anidbId->anidbid))) { |
|
193 | + if (!empty($this->updateTimeCheck($anidbId->anidbid))) { |
|
194 | 194 | $this->padb->populateTable('info', $anidbId->anidbid); |
195 | 195 | $this->doRandomSleep(); |
196 | 196 | $updatedAni = $this->checkAniDBInfo($anidbId->anidbid); |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | */ |
154 | 154 | public function updatePreDb(array $parameters): void |
155 | 155 | { |
156 | - if (! empty($parameters)) { |
|
156 | + if (!empty($parameters)) { |
|
157 | 157 | $this->insertPredb($parameters); |
158 | 158 | } |
159 | 159 | } |
@@ -214,15 +214,15 @@ discard block |
||
214 | 214 | $resultData = []; |
215 | 215 | try { |
216 | 216 | $query = $this->search->setIndex($rt_index)->option('ranker', 'sph04')->option('sort_method', 'pq')->maxMatches(10000)->limit(10000)->sort('id', 'desc')->stripBadUtf8(true)->trackScores(true); |
217 | - if (! empty($searchArray)) { |
|
217 | + if (!empty($searchArray)) { |
|
218 | 218 | foreach ($searchArray as $key => $value) { |
219 | 219 | $query->search('@@relaxed @'.$key.' '.self::escapeString($value)); |
220 | 220 | } |
221 | - } elseif (! empty($searchString)) { |
|
221 | + } elseif (!empty($searchString)) { |
|
222 | 222 | // If $column is an array and has more than one item, implode it and wrap in parentheses. |
223 | - if (! empty($column) && \count($column) > 1) { |
|
223 | + if (!empty($column) && \count($column) > 1) { |
|
224 | 224 | $searchColumns = '@('.implode(',', $column).')'; |
225 | - } elseif (! empty($column) && \count($column) == 1) { // If $column is an array and has only one item, use as is. |
|
225 | + } elseif (!empty($column) && \count($column) == 1) { // If $column is an array and has only one item, use as is. |
|
226 | 226 | $searchColumns = '@'.$column[0]; |
227 | 227 | } else { |
228 | 228 | $searchColumns = ''; // Careful, this will search all columns. |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | public function beginImport($filesToProcess, bool $useNzbName = false, bool $delete = false, bool $deleteFailed = false): bool|string |
81 | 81 | { |
82 | 82 | // Get all the groups in the DB. |
83 | - if (! $this->getAllGroups()) { |
|
83 | + if (!$this->getAllGroups()) { |
|
84 | 84 | if ($this->browser) { |
85 | 85 | return $this->retVal; |
86 | 86 | } |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | gzwrite($fp, $nzbString); |
146 | 146 | gzclose($fp); |
147 | 147 | |
148 | - if (! File::isFile($path)) { |
|
148 | + if (!File::isFile($path)) { |
|
149 | 149 | $this->echoOut('ERROR: Problem compressing NZB file to: '.$path); |
150 | 150 | |
151 | 151 | // Remove the release. |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | if ($groupID === -1) { |
232 | 232 | if (array_key_exists($group, $this->allGroups)) { |
233 | 233 | $groupID = $this->allGroups[$group]; |
234 | - if (! $groupName) { |
|
234 | + if (!$groupName) { |
|
235 | 235 | $groupName = $group; |
236 | 236 | } |
237 | 237 | } else { |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | } |
266 | 266 | |
267 | 267 | // If we found a group and it's not blacklisted. |
268 | - if ($groupID !== -1 && ! $isBlackListed) { |
|
268 | + if ($groupID !== -1 && !$isBlackListed) { |
|
269 | 269 | // Get the size of the release. |
270 | 270 | if (\count($file->segments->segment) > 0) { |
271 | 271 | foreach ($file->segments->segment as $segment) { |
@@ -17,7 +17,7 @@ |
||
17 | 17 | public function handle(Request $request, Closure $next): Response |
18 | 18 | { |
19 | 19 | // Force Json accept type on api routes |
20 | - if ($request->is('api/*') && ! Str::contains($request->header('accept'), ['/json', '+json'])) { |
|
20 | + if ($request->is('api/*') && !Str::contains($request->header('accept'), ['/json', '+json'])) { |
|
21 | 21 | $request->headers->set('accept', 'application/json,'.$request->header('accept')); |
22 | 22 | } |
23 | 23 |